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 |
|---|---|---|---|---|---|
3de8b1bd94010d1dca10c6c87826c1abc71ec7e7 | 2,587 | package cn.edu.nju.software.jksc.symys.activities;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.HashMap;
import cn.edu.nju.software.jksc.symys.R;
public class FailScore extends Activity {
HashMap<String,Object> gameData;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fail);
TextView tx = (TextView)findViewById(R.id.header);
TextView best_score = (TextView) findViewById(R.id.best_score);
Typeface custom_font = Typeface.createFromAsset(getAssets(),
"font/HarringtON.TTF");
tx.setTypeface(custom_font);
best_score.setTypeface(custom_font);
best_score.setText("BestScore:" + "23333");
gameData = (HashMap<String,Object>) getIntent().getSerializableExtra("gameData");
ImageView replay = (ImageView) findViewById(R.id.score_replay);
replay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
replay();
}
});
ImageView home = (ImageView) findViewById(R.id.score_home);
home.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
home();
}
});
}
private void replay(){
Intent intent = new Intent(FailScore.this,GamePanel.class);
intent.putExtra("gameData", gameData);
finish();
startActivity(intent);
}
private void home(){
finish();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_fail_score, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| 29.735632 | 89 | 0.648628 |
bb3338aea3c282bc6cc99e61bbd3d044ba39bcb9 | 1,349 | package org.narrative.network.core.user.services.activityrate;
import org.narrative.network.core.user.User;
import org.narrative.network.core.user.UserActivityRateLimit;
import org.narrative.network.shared.tasktypes.AreaTaskImpl;
import java.time.Instant;
import java.time.ZonedDateTime;
import static org.narrative.common.util.CoreUtils.*;
/**
* Date: 2019-06-12
* Time: 17:57
*
* @author jonmark
*/
public abstract class GetUserActivityRateLimitCountTaskBase extends AreaTaskImpl<Long> {
private final User user;
protected GetUserActivityRateLimitCountTaskBase(User user) {
assert exists(user) : "This task should always be provided with a user to check their activity rate for!";
this.user = user;
}
public abstract UserActivityRateLimit getRateLimit();
// jw: let's force implementation through a more explicit function. This allows us to force a int result, and we can
// provide the user more naturally than using protected access on the property.
protected abstract long getUserActivityRateCount(User user, Instant after);
@Override
protected Long doMonitoredTask() {
Instant after = ZonedDateTime.now(user.getFormatPreferences().getZoneId()).truncatedTo(getRateLimit().getLimitPeriod()).toInstant();
return getUserActivityRateCount(user, after);
}
}
| 33.725 | 140 | 0.75315 |
7bc565592b3e87b159c840a3ecf370f4ec5adc28 | 2,871 | package com.project.convertedCode.includes.vendor.swiftmailer.swiftmailer.lib.dependency_maps;
import com.project.convertedCode.globalNamespace.classes.Swift_DependencyContainer;
import com.runtimeconverter.runtime.RuntimeStack;
import com.runtimeconverter.runtime.interfaces.ContextConstants;
import com.runtimeconverter.runtime.includes.RuntimeIncludable;
import com.runtimeconverter.runtime.includes.IncludeEventException;
import com.runtimeconverter.runtime.classes.RuntimeClassBase;
import com.runtimeconverter.runtime.RuntimeEnv;
import com.runtimeconverter.runtime.interfaces.UpdateRuntimeScopeInterface;
import com.runtimeconverter.runtime.arrays.ZPair;
/*
Converted with The Runtime Converter (runtimeconverter.com)
vendor/swiftmailer/swiftmailer/lib/dependency_maps/message_deps.php
*/
public class file_message_deps_php implements RuntimeIncludable {
public static final file_message_deps_php instance = new file_message_deps_php();
public final void include(RuntimeEnv env, RuntimeStack stack) throws IncludeEventException {
Scope3134 scope = new Scope3134();
stack.pushScope(scope);
this.include(env, stack, scope);
stack.popScope();
}
public final void include(RuntimeEnv env, RuntimeStack stack, Scope3134 scope)
throws IncludeEventException {
env.callMethod(
env.callMethod(
env.callMethod(
env.callMethod(
Swift_DependencyContainer.runtimeStaticObject.getInstance(
env),
"register",
file_message_deps_php.class,
"message.message"),
"asNewInstanceOf",
file_message_deps_php.class,
"Swift_Message"),
"register",
file_message_deps_php.class,
"message.mimepart"),
"asNewInstanceOf",
file_message_deps_php.class,
"Swift_MimePart");
}
private static final ContextConstants runtimeConverterContextContantsInstance =
new ContextConstants()
.setDir("/vendor/swiftmailer/swiftmailer/lib/dependency_maps")
.setFile(
"/vendor/swiftmailer/swiftmailer/lib/dependency_maps/message_deps.php");
public ContextConstants getContextConstants() {
return runtimeConverterContextContantsInstance;
}
private static class Scope3134 implements UpdateRuntimeScopeInterface {
public void updateStack(RuntimeStack stack) {}
public void updateScope(RuntimeStack stack) {}
}
}
| 40.43662 | 100 | 0.640195 |
aa1724c09e1ed0caa252b256711a31918d52dd58 | 9,166 | package org.jutility.io.database;
/*
* #%L
* jutility-incubation
* %%
* Copyright (C) 2013 - 2014 jutility.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.
* #L%
*/
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.jutility.common.reflection.ReflectionException;
import org.jutility.common.reflection.ReflectionUtils;
/**
*
*
* @author Peter J. Radics
* @version 0.1
* @param <T>
* the type of the prototype.
*
*/
public class Prototype<T> {
private final Class<? extends T> type;
private final Map<String, ?> primaryKeyValueMap;
private final Map<PropertyInfo, Prototype<?>> elementPrototypes;
private final Map<ListPropertyInfo, List<Prototype<?>>> elementListPrototypes;
private T deserializedObject;
private Prototype<?> referencePrototype;
/**
* Getter for the type
*
* @return the type.
*/
public Class<? extends T> getType() {
return this.type;
}
/**
* Getter for the primary key-value map.
*
* @return the primary key-value map.
*/
public Map<String, ?> getPrimaryKeyValueMap() {
return Collections.unmodifiableMap(this.primaryKeyValueMap);
}
/**
* Returns the prototype of the provided element property.
*
* @param elementProperty
* the element property.
* @return the element property prototype.
*/
public Prototype<?> getElementPrototype(PropertyInfo elementProperty) {
return this.elementPrototypes.get(elementProperty);
}
/**
* Returns the element properties.
*
* @return the element properties.
*/
public Collection<PropertyInfo> getElementProperties() {
return this.elementPrototypes.keySet();
}
/**
* Returns the element property prototypes.
*
* @return the element property prototypes.
*/
public Map<PropertyInfo, Prototype<?>> getElementPrototypes() {
return Collections.unmodifiableMap(this.elementPrototypes);
}
/**
* Adds an element property prototype.
*
* @param elementProperty
* the element property.
* @param elementPrototype
* the element prototype.
* @return the previous element prototype.
*/
public Prototype<?> addElementPrototype(PropertyInfo elementProperty,
Prototype<?> elementPrototype) {
return this.elementPrototypes.put(elementProperty, elementPrototype);
}
/**
* Removes an element property prototype.
*
* @param elementProperty
* the element property.
* @return the removed element prototype.
*/
public Prototype<?> removeElementPrototye(PropertyInfo elementProperty) {
return this.elementPrototypes.remove(elementProperty);
}
/**
* Clears the element prototype map.
*/
public void clearElementPrototypes() {
this.elementPrototypes.clear();
}
/**
* Returns the prototype list for the element list property.
*
* @param elementListProperty
* the element list property.
* @return the prototype list for the element list property.
*/
public List<Prototype<?>> getElementListPrototypes(
ListPropertyInfo elementListProperty) {
return this.elementListPrototypes.get(elementListProperty);
}
/**
* Returns the element list properties.
*
* @return the element list properties.
*/
public Collection<ListPropertyInfo> getElementListProperties() {
return this.elementListPrototypes.keySet();
}
/**
* Returns the element list property prototypes.
*
* @return the element list property prototypes.
*/
public Map<ListPropertyInfo, List<Prototype<?>>> getElementListPrototypes() {
return Collections.unmodifiableMap(this.elementListPrototypes);
}
/**
* Adds element list property prototypes.
*
* @param elementListProperty
* the element list property.
* @param elementListPrototypes
* the element list prototype.
* @return the previous element prototypes.
*/
public List<Prototype<?>> addElementListPrototypes(
ListPropertyInfo elementListProperty,
List<Prototype<?>> elementListPrototypes) {
return this.elementListPrototypes.put(elementListProperty,
elementListPrototypes);
}
/**
* Removes element list property prototypes.
*
* @param elementListProperty
* the element list property.
* @return the removed element prototypes.
*/
public List<Prototype<?>> removeElementListPrototyes(
ListPropertyInfo elementListProperty) {
return this.elementListPrototypes.remove(elementListProperty);
}
/**
* Clears the element list prototypes.
*/
public void clearElementListPrototypes() {
this.elementListPrototypes.clear();
}
/**
* Sets the reference prototype.
*
* @param referencePrototype
* the reference prototype.
*/
public void setReferencePrototype(Prototype<?> referencePrototype) {
this.referencePrototype = referencePrototype;
}
/**
* Returns whether or not this is a referenced prototype.
*
* @return {@code true} if this is a referenced prototype; {@code false}
* otherwise.
*/
public boolean isReferencePrototype() {
return this.referencePrototype == null;
}
/**
* Getter for the deserialized object.
*
* @return the deserialized object.
* @throws DBSerializationException
*/
public T getDeserializedObject()
throws DBSerializationException {
if (!this.isReferencePrototype()) {
try {
return ReflectionUtils.castValue(this.getType(),
this.referencePrototype.getDeserializedObject());
}
catch (ReflectionException e) {
throw new DBSerializationException(
"Could not retrieve deserialized object from reference prototype!",
e);
}
}
return this.deserializedObject;
}
/**
* Setter for the deserialized object.
*
* @param deserializedObject
* the new value.
* @throws DBSerializationException
*/
public void setDeserializedObject(T deserializedObject)
throws DBSerializationException {
this.deserializedObject = deserializedObject;
if (!this.isReferencePrototype()) {
throw new DBSerializationException(
"Trying to set deserialized value of prototype in non reference prototype");
}
}
/**
* Creates a new prototype
*
* @param type
* the type of the prototype.
* @param primaryKeyValueMap
* the primary key-value map.
*/
public Prototype(Class<? extends T> type, Map<String, ?> primaryKeyValueMap) {
if (type == null || primaryKeyValueMap == null
|| primaryKeyValueMap.isEmpty()) {
throw new IllegalArgumentException(
"Cannot create Prototype from provided values!");
}
this.type = type;
this.primaryKeyValueMap = primaryKeyValueMap;
this.elementPrototypes = new LinkedHashMap<PropertyInfo, Prototype<?>>();
this.elementListPrototypes = new LinkedHashMap<ListPropertyInfo, List<Prototype<?>>>();
this.deserializedObject = null;
this.referencePrototype = null;
}
@Override
public boolean equals(Object obj) {
if (obj != null && obj instanceof Prototype) {
Prototype<?> other = (Prototype<?>) obj;
return (this.getType() == other.getType())
&& this.getPrimaryKeyValueMap().equals(
other.getPrimaryKeyValueMap());
}
return false;
}
@Override
public int hashCode() {
return this.type.hashCode() + this.primaryKeyValueMap.hashCode();
}
static <T> Prototype<T> createPrototype(Class<T> type,
Map<String, ?> primaryKeyValueMap) {
return new Prototype<T>(type, primaryKeyValueMap);
}
}
| 27.525526 | 96 | 0.61499 |
b37c609c390965398aa0cbf88c8e83c27b5139f4 | 1,926 | package cn.stt.pingpp.constant;
/**
* @Author shitongtong
* <p>
* Created by shitongtong on 2017/7/21.
*/
public interface Constants {
/**
* Secret key
*/
String apiKey = "sk_test_54mXT88G84eD8S8WX9LS8WjD";
/**
* 应用标识
*/
String appId = "app_qPmjfP5mT0y5rDy5";
/**
* RSA 私钥
*/
String rsaPrivateKey ="-----BEGIN RSA PRIVATE KEY-----\n" +
"MIICXAIBAAKBgQC/nImKTiOJJ5NKGTsqYafE+V10fvZNHCtvP2VBkmiEx82d+IFJ\n" +
"22tPqg135vRVOOWeJs1igH+hH29vpUdnYUwQSfL9ougnpZHRN4KOpyAjMF95cpmb\n" +
"CMdYz/JYnjIBlmp8Vcx+nLtP15umJg7pKQQeh5Q7hyf1A+UajDoNucxtGwIDAQAB\n" +
"AoGADipXbLccH26ij+7PlfGEQqagxxT/xnGXsHDCXpehTHes9snBXSFwjIIo3r1f\n" +
"QNGlAA0kT+zqApJdXaadYcIqqkTdgLAahjbtEgJakax2YpaEpdcy9w+c7msGDZzf\n" +
"7blT16DNRgJ/lJhaPmGsFki4tbu7g6X/h2ocAhfDYf6ajBECQQDf3mtYzhXE87CV\n" +
"UdsbbUpDqf+8rM48QG8MpPahjJjgiMduhF0ojqY66seCelpqerLfKD6YbAunmsu5\n" +
"XYNuPhgjAkEA2xzj/245UtadXJJzPX7MnlZ0K7YLzdkuIzssQSX8KvDSFrxHTEAn\n" +
"olpjUdCwhJLoR4D/VgXc6OwxWieHtPBqqQJBANKS9yxAJS/t/MJnjY6d3YYKCNij\n" +
"PxZjkVE2dhp9EmvZnKWy8aGtlGTE5Ecx6YxQv6GyzDY5IzlTHJ/Oe0seMzsCQFAd\n" +
"2TP9fpJOjM1bcy2qHnFK1UFiWCCVZ6xUJ5NOq0ycL4VGpJ852gQgHq68qr5e5PW4\n" +
"MiSnEiZMrqLzT0iWm7kCQErFRnXpRiNkVTBE2EEa8KZO/anbJoe0GjScngJCgwuv\n" +
"lkqk555V9IF1war4VV9H9GPZ/Lt1WyWOMgf1kKPf7S8=\n" +
"-----END RSA PRIVATE KEY-----";
/**
* RSA 公钥
*/
String rsaPublicKey = "-----BEGIN PUBLIC KEY-----\n" +
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC/nImKTiOJJ5NKGTsqYafE+V10\n" +
"fvZNHCtvP2VBkmiEx82d+IFJ22tPqg135vRVOOWeJs1igH+hH29vpUdnYUwQSfL9\n" +
"ougnpZHRN4KOpyAjMF95cpmbCMdYz/JYnjIBlmp8Vcx+nLtP15umJg7pKQQeh5Q7\n" +
"hyf1A+UajDoNucxtGwIDAQAB\n" +
"-----END PUBLIC KEY-----";
}
| 39.306122 | 82 | 0.680166 |
e54a999fabe7eaec282d376af43a38b653d0e2be | 730 | package ChainOfResponsability;
import Clases.Empleado;
import FactoryStrategy.Producto;
import FactoryStrategy.Bodega;
public class VerificarExistenciaBodega extends VerificadorBase{
private Empleado encargado;
private Bodega bodega;
public VerificarExistenciaBodega(Empleado encargado) {
this.encargado = encargado;
}
public void setBodega(Bodega bodega) {
this.bodega=bodega;
}
public boolean verificar(Producto producto) {
//Chequear si el producto esta en stock de la bodega
if(!bodega.productoInBodega(producto)) {
//Se corta el proceso si no existe el producto en bodega
return false;
}else {
//Intenta seguir con la cadena de verificacion
return super.verificar(producto);
}
}
}
| 23.548387 | 63 | 0.764384 |
cbf5be28ca1309c413639663a1c513aaf7ee7f09 | 2,035 | package au.gov.qld.pub.orders.service;
import static com.google.common.collect.ImmutableMap.of;
import static java.util.Arrays.asList;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.when;
import java.util.List;
import java.util.Map;
import javax.mail.internet.MimeMessage;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.mail.javamail.MimeMessageHelper;
import au.gov.qld.pub.orders.dao.FormFileDAO;
import au.gov.qld.pub.orders.entity.FormFile;
@RunWith(MockitoJUnitRunner.class)
public class FileAttachmentServiceTest {
private static final String FILE_ID_0 = "file id 0";
private static final String FILE_ID_1 = "file id 1";
private static final String FILE_ID_2 = "file id 2";
private static final String FILE_ID_3 = "file id 3";
FileAttachmentService service;
@Mock FileService fileService;
@Mock FormFileDAO dao;
@Mock FormFile formFile;
@Mock MimeMessage message;
@Mock MimeMessageHelper helper;
List<Map<String, String>> paidItemsFields;
@Before
public void setUp() {
paidItemsFields = asList((Map<String, String>)of("fileId0", FILE_ID_0, "fileId1", FILE_ID_1, "fileId2", FILE_ID_2, "fileId3", FILE_ID_3));
service = new FileAttachmentService(fileService);
}
@Test
public void attachFilesToMessageForBusiness() throws Exception {
when(formFile.getName()).thenReturn("some name");
when(formFile.getData()).thenReturn("some data".getBytes());
when(fileService.find(FILE_ID_0)).thenReturn(formFile);
when(fileService.find(FILE_ID_1)).thenReturn(formFile);
when(fileService.find(FILE_ID_2)).thenReturn(formFile);
when(fileService.find(FILE_ID_3)).thenReturn(formFile);
service.append(message, helper, false, paidItemsFields);
}
@Test
public void doNotAttachFilesToMessageForCustomer() throws Exception {
service.append(message, helper, true, paidItemsFields);
verifyNoInteractions(fileService);
}
}
| 32.301587 | 140 | 0.78231 |
6e7e08e06dfd2fa97f7ab9d4d9bbc552bd934f4b | 9,123 | /*******************************************************************************
* Copyright 2021 Danny Kunz
*
* 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.
******************************************************************************/
/*
Copyright 2017 Danny Kunz
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.omnaest.genomics.ensembl;
import static org.junit.Assert.assertEquals;
import java.util.List;
import java.util.stream.Collectors;
import org.junit.Ignore;
import org.junit.Test;
import org.omnaest.genomics.ensembl.domain.Exon;
import org.omnaest.genomics.ensembl.domain.GeneLocation;
import org.omnaest.genomics.ensembl.domain.SpeciesAccessor;
import org.omnaest.genomics.ensembl.domain.Variant;
import org.omnaest.genomics.ensembl.domain.VariantConsequence;
import org.omnaest.utils.JSONHelper;
public class EnsemblUtilsTest
{
@Test
@Ignore
public void testGetInstance() throws Exception
{
GeneLocation location = EnsemblUtils.getInstance()
.findSpecies("human")
.get()
.findGene("BHMT")
.get()
.getLocation();
//System.out.println(location);
assertEquals(5, location.getChromosome());
assertEquals("GRCh38", location.getReferenceAssembly());
assertEquals(79111779, location.getPosition()
.getStart());
assertEquals(79132290, location.getPosition()
.getEnd());
}
@Test
@Ignore
public void testGetILocation() throws Exception
{
GeneLocation location = EnsemblUtils.getInstance()
.findSpecies("Homo sapiens (Human)")
.get()
.findGene("BHMT")
.get()
.getLocation();
//System.out.println(location);
assertEquals("5", location.getChromosome());
assertEquals("GRCh38", location.getReferenceAssembly());
assertEquals(79111779, location.getPosition()
.getStart());
assertEquals(79132290, location.getPosition()
.getEnd());
}
@Test
@Ignore
public void testGetVariants() throws Exception
{
List<Variant> variants = EnsemblUtils.getInstance()
.findSpecies("human")
.get()
.findGene("BHMT")
.get()
.getVariants();
System.out.println(variants);
}
@Test
@Ignore
public void testGetUniprotId() throws Exception
{
String uniprotId = EnsemblUtils.getInstance()
.findSpecies("human")
.get()
.findGene("BHMT")
.get()
.getUniprotId();
System.out.println(uniprotId);
}
@Test
@Ignore
public void testGetExons() throws Exception
{
List<Exon> exons = EnsemblUtils.getInstance()
.findSpecies("human")
.get()
.findGene("BHMT")
.get()
.getExons();
System.out.println(JSONHelper.prettyPrint(exons));
}
@Test
@Ignore
public void testGetProteinTranscripts() throws Exception
{
String proteinSequence = EnsemblUtils.getInstance()
.findSpecies("human")
.get()
.findGene("BHMT")
.get()
.getProteinTranscripts()
.findFirst()
.get()
.getProteinSequence();
System.out.println(proteinSequence.substring(0, 100));
}
@Test
@Ignore
public void testReferenceLocation() throws Exception
{
GeneLocation location = EnsemblUtils.getInstance()
.findSpecies("human")
.get()
.findGene("BHMT")
.get()
.getLocation("GRCh37");
assertEquals(78407632, location.getPosition()
.getStart());
assertEquals(78428111, location.getPosition()
.getEnd());
assertEquals("GRCh37", location.getReferenceAssembly());
assertEquals("5", location.getChromosome());
}
@Test
@Ignore
public void testGetProteinSequences() throws Exception
{
List<String> proteinSequences = EnsemblUtils.getInstance()
.findSpecies("human")
.get()
.findGene("DMGDH")
.get()
.getProteinSequences()
.collect(Collectors.toList());
// System.out.println(JSONHelper.prettyPrint(proteinSequences));
assertEquals(2, proteinSequences.size());
}
@Test
@Ignore
public void testVariantDetail() throws Exception
{
SpeciesAccessor speciesAccessor = EnsemblUtils.getInstance()
.getHuman();
assertEquals(VariantConsequence.MISSENSE, speciesAccessor.findVariantDetail("rs682985")
.getConsequence());
assertEquals(VariantConsequence._3_PRIME_UTR, speciesAccessor.findVariantDetail("rs6114998")
.getConsequence());
}
@Test
@Ignore
public void testVariantDetailUsingCacheAndRest() throws Exception
{
SpeciesAccessor speciesAccessor = EnsemblUtils.getInstance()
.usingLocalCache()
.getHuman();
assertEquals(VariantConsequence.MISSENSE, speciesAccessor.findVariantDetail("rs682985")
.getConsequence());
assertEquals(VariantConsequence._3_PRIME_UTR, speciesAccessor.findVariantDetail("rs6114998")
.getConsequence());
}
@Test
@Ignore
public void testVariantDetailUsingFTP() throws Exception
{
SpeciesAccessor speciesAccessor = EnsemblUtils.getInstance()
.usingFTPLargeVariationFileIndexSupport()
.usingLocalCache()
.getHuman();
assertEquals(VariantConsequence.MISSENSE, speciesAccessor.findVariantDetail("rs682985")
.getConsequence());
assertEquals(VariantConsequence._3_PRIME_UTR, speciesAccessor.findVariantDetail("rs6114998")
.getConsequence());
}
}
| 39.493506 | 100 | 0.473857 |
1a7fe28137511a697cdb4f8a7be3be86b698a6d5 | 2,604 | package ofuangka.geographiccenter.api.resource;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import javax.inject.Inject;
import javax.validation.Valid;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.container.ResourceContext;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import org.apache.commons.codec.binary.StringUtils;
import ofuangka.geographiccenter.api.dao.GroupDao;
import ofuangka.geographiccenter.api.dao.MemberDao;
import ofuangka.geographiccenter.api.domain.Member;
import ofuangka.geographiccenter.api.security.SecurityService;
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public class MemberCollectionResource {
@Context
private ResourceContext context;
@Inject
private MemberDao memberDao;
@Inject
private SecurityService securityService;
@Inject
private GroupDao groupDao;
@GET
public List<Member> list(@QueryParam("gid") String groupId) {
return memberDao.getByGroupId(groupId);
}
@POST
public Member create(@Valid Member member) {
String groupId = member.getGroupId();
/* only add members to groups that exist */
if (groupDao.get(groupId) != null) {
String userId = securityService.getUserId();
String username = securityService.getUsername();
Date now = Calendar.getInstance().getTime();
/* a member can only appear in a group once */
Member existingMember = getMemberWithUserId(userId, groupId);
if (existingMember == null) {
member.setUserId(userId);
member.setUsername(username);
member.setGroupId(groupId);
member.setLastUpdatedTs(now);
return memberDao.create(member);
} else {
existingMember.setUsername(username);
existingMember.setLat(member.getLat());
existingMember.setLng(member.getLng());
existingMember.setLastUpdatedTs(now);
return memberDao.update(existingMember);
}
} else {
throw new SecurityException("Group does not exist");
}
}
@Path("/{memberId}")
public MemberInstanceResource getMemberInstanceResource() {
return context.getResource(MemberInstanceResource.class);
}
private Member getMemberWithUserId(String userId, String groupId) {
Member ret = null;
List<Member> members = memberDao.getByGroupId(groupId);
for (Member member : members) {
if (StringUtils.equals(userId, member.getUserId())) {
ret = member;
break;
}
}
return ret;
}
}
| 27.410526 | 68 | 0.753456 |
fcfbeddbf817323e13b81b29248240c4163cfda5 | 4,355 |
public class Message {
// Identificador. Todas as mensagens possuem o mesmo identificador.
public final int id = 2345;
// Controle de erro. Verificar e tratar erro no envio das mensagens.
private String errorControl;
// Apelido da máquina que enviou a mensagem.
private String nicknameSource;
// Apelido da máquina destino.
private String nicknameDestination;
// Tipo de mensagem. M = mensagem simples; A = mensagem deve ser salva em um arquivo.
private char dataType;
// Conteúdo da mensagem.
private String content;
private Message(String errorControl, String nicknameSource, String nicknameDestination, char dataType, String content) {
this.errorControl = errorControl;
this.nicknameSource = nicknameSource;
this.nicknameDestination = nicknameDestination;
this.dataType = dataType;
this.content = content;
}
// Converte uma mensagem formatada em String, para um objeto mensagem.
public static Message from(String rawValue) {
final String[] values = rawValue.split(";");
if (values.length != 2) {
return null;
}
if (!values[0].equals("2345")) {
return null;
}
final String[] newValues = values[1].split(":");
if (newValues.length != 5) {
return null;
}
final String errorControl = newValues[0];
final String nicknameSource = newValues[1];
final String nicknameDestination = newValues[2];
final char dataType = newValues[3].charAt(0);
final String content = newValues[4];
return new Message(errorControl, nicknameSource, nicknameDestination, dataType, content);
}
// Utilizado para verificar se ocorreu um erro no envio da mensagem. OK = Mensagem entregue;
// NAOCOPIADO = A mensagem foi entregue a todas as máquinas na rede, ou a máquina não foi encontrada;
// ERRO = Ocorreu um erro.
public String getErrorControl() {
return errorControl;
}
// Utilizado para atualizar o estado de uma mensagem. OK = Mensagem entregue;
// NAOCOPIADO = A mensagem foi entregue a todas as máquinas na rede, ou a máquina não foi encontrada;
// ERRO = Ocorreu um erro.
public void setErrorControl(String errorControl) {
this.errorControl = errorControl;
}
// Retorna o apelido da máquina que enviou a mensagem.
public String getNicknameSource() {
return nicknameSource;
}
// Retorna o apelido da máquina que deve receber a mensagem.
public String getNicknameDestination() {
return nicknameDestination;
}
// Retorna o tipo da mensagem. M = mensagem simples; A = mensagem deve ser salva em um arquivo.
public char getDataType() {
return dataType;
}
// Retorna o texto contido na mensagem.
public String getContent() {
return content;
}
// Utilizamos este método para garantir que quando ocorrer erro no envio de uma mensagem,
// ela seja reenviada apenas uma vez. Duas mensagens são iguais se as seguintes propriedades
// são iguais:
// - O apelido da maquina que enviou a mensagem;
// - O apelido da máquina que deve receber a mensagem;
// - O tipo da mensagem;
// - O conteúdo da mensagem.
// Se esses atributos forem iguais, então as mensagem é a mesma.
// Foi ignorado o atributo para controle de erro, pois no primeiro momento que a mensagem
// volta com erro, o estado da mesma é trocado para "naocopiado, assim se ela voltar novamente
// com erro, elas não seriam iguais.
@Override
public boolean equals(Object obj) {
if (obj instanceof Message) {
Message message = (Message) obj;
if (message.nicknameSource.equals(nicknameSource) &&
message.nicknameDestination.equals(nicknameDestination) &&
message.dataType == dataType &&
message.content.equals(content)) {
return true;
}
}
return false;
}
// Formata a mensagem para String, para poder ser enviada na rede.
@Override
public String toString() {
return String.format("%d;%s:%s:%s:%c:%s",
id,
errorControl,
nicknameSource,
nicknameDestination,
dataType,
content);
}
}
| 35.696721 | 124 | 0.650287 |
b99a4732faf86bdca01d6856194fedd4c0f43644 | 1,729 | /*
* Copyright 2014-2019 Logo Business Solutions
* (a.k.a. LOGO YAZILIM SAN. VE TIC. A.S)
*
* 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.lbs.tedam.model;
import com.lbs.tedam.data.config.DataConfig;
import com.lbs.tedam.data.service.TestDataConfig;
import com.lbs.tedam.test.BaseServiceTest;
import com.lbs.tedam.util.EnumsV2.TedamSocketMessageType;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {TestDataConfig.class, DataConfig.class})
public class TedamSocketMessageTest extends BaseServiceTest {
@Test
public void testSetters() {
TedamSocketMessage tedamSocketMessage = new TedamSocketMessage("detail", TedamSocketMessageType.JOB);
tedamSocketMessage.setDetail("detail");
tedamSocketMessage.setTedamSocketMessageType(TedamSocketMessageType.CLIENT);
}
@Test
public void testGetters() {
TedamSocketMessage tedamSocketMessage = new TedamSocketMessage();
tedamSocketMessage.getDetail();
tedamSocketMessage.getTedamSocketMessageType();
}
}
| 36.020833 | 109 | 0.763447 |
7438f6270d1b5f3eca2cb0ba29c7c99f2a026b0f | 1,163 | /**
* Copyright © 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.thinkgem.jeesite.modules.smuser.service;
import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.smuser.entity.SmUser;
import com.thinkgem.jeesite.modules.smuser.dao.SmUserDao;
/**
* 模拟患者表Service
* @author Jackiet
* @version 2017-04-13
*/
@Service
@Transactional(readOnly = true)
public class SmUserService extends CrudService<SmUserDao, SmUser> {
public SmUser get(String id) {
return super.get(id);
}
public List<SmUser> findList(SmUser smUser) {
return super.findList(smUser);
}
public Page<SmUser> findPage(Page<SmUser> page, SmUser smUser) {
return super.findPage(page, smUser);
}
@Transactional(readOnly = false)
public void save(SmUser smUser) {
super.save(smUser);
}
@Transactional(readOnly = false)
public void delete(SmUser smUser) {
super.delete(smUser);
}
} | 24.744681 | 108 | 0.755804 |
510c601bf09bac2bd77d554ebb51abb423a3f474 | 1,563 | package rocks.inspectit.ui.rcp.ci.form.page;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.editor.FormPage;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import rocks.inspectit.ui.rcp.InspectIT;
import rocks.inspectit.ui.rcp.InspectITImages;
import rocks.inspectit.ui.rcp.ci.form.part.SensorAssignmentMasterBlock;
/**
* Page for method sensor definitions.
*
* @author Ivan Senic
*
*/
public class MethodSensorDefinitionsPage extends FormPage {
/**
* Id of the page.
*/
private static final String ID = MethodSensorDefinitionsPage.class.getName();
/**
* Page title.
*/
private static final String TITLE = "Sensor Definitions";
/**
* Method sensor master block.
*/
private SensorAssignmentMasterBlock sensorAssignmentMasterBlock;
/**
* Default constructor.
*
* @param editor
* {@link FormEditor} page belongs to.
*/
public MethodSensorDefinitionsPage(FormEditor editor) {
super(editor, ID, TITLE);
this.sensorAssignmentMasterBlock = new SensorAssignmentMasterBlock(this);
}
/**
* {@inheritDoc}
*/
@Override
protected void createFormContent(IManagedForm managedForm) {
ScrolledForm form = managedForm.getForm();
form.setText(TITLE);
form.setImage(InspectIT.getDefault().getImage(InspectITImages.IMG_TIMER));
FormToolkit toolkit = managedForm.getToolkit();
toolkit.decorateFormHeading(form.getForm());
sensorAssignmentMasterBlock.createContent(managedForm);
}
}
| 25.209677 | 78 | 0.753679 |
b27d9dde9ecfbe29b6f059d385af636c0081c313 | 5,680 | package com.skytala.eCommerce.domain.accounting.relations.glAccount.control.history;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import com.google.common.base.Splitter;
import com.skytala.eCommerce.domain.accounting.relations.glAccount.command.history.AddGlAccountHistory;
import com.skytala.eCommerce.domain.accounting.relations.glAccount.command.history.DeleteGlAccountHistory;
import com.skytala.eCommerce.domain.accounting.relations.glAccount.command.history.UpdateGlAccountHistory;
import com.skytala.eCommerce.domain.accounting.relations.glAccount.event.history.GlAccountHistoryAdded;
import com.skytala.eCommerce.domain.accounting.relations.glAccount.event.history.GlAccountHistoryDeleted;
import com.skytala.eCommerce.domain.accounting.relations.glAccount.event.history.GlAccountHistoryFound;
import com.skytala.eCommerce.domain.accounting.relations.glAccount.event.history.GlAccountHistoryUpdated;
import com.skytala.eCommerce.domain.accounting.relations.glAccount.mapper.history.GlAccountHistoryMapper;
import com.skytala.eCommerce.domain.accounting.relations.glAccount.model.history.GlAccountHistory;
import com.skytala.eCommerce.domain.accounting.relations.glAccount.query.history.FindGlAccountHistorysBy;
import com.skytala.eCommerce.framework.exceptions.RecordNotFoundException;
import com.skytala.eCommerce.framework.pubsub.Scheduler;
import static com.skytala.eCommerce.framework.pubsub.ResponseUtil.*;
@RestController
@RequestMapping("/accounting/glAccount/glAccountHistorys")
public class GlAccountHistoryController {
private static Map<String, RequestMethod> validRequests = new HashMap<>();
public GlAccountHistoryController() {
validRequests.put("find", RequestMethod.GET);
validRequests.put("add", RequestMethod.POST);
validRequests.put("update", RequestMethod.PUT);
validRequests.put("removeById", RequestMethod.DELETE);
}
/**
*
* @param allRequestParams
* all params by which you want to find a GlAccountHistory
* @return a List with the GlAccountHistorys
* @throws Exception
*/
@GetMapping("/find")
public ResponseEntity<List<GlAccountHistory>> findGlAccountHistorysBy(@RequestParam(required = false) Map<String, String> allRequestParams) throws Exception {
FindGlAccountHistorysBy query = new FindGlAccountHistorysBy(allRequestParams);
if (allRequestParams == null) {
query.setFilter(new HashMap<>());
}
List<GlAccountHistory> glAccountHistorys =((GlAccountHistoryFound) Scheduler.execute(query).data()).getGlAccountHistorys();
return ResponseEntity.ok().body(glAccountHistorys);
}
/**
* creates a new GlAccountHistory entry in the ofbiz database
*
* @param glAccountHistoryToBeAdded
* the GlAccountHistory thats to be added
* @return true on success; false on fail
*/
@RequestMapping(method = RequestMethod.POST, value = "/add", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<GlAccountHistory> createGlAccountHistory(@RequestBody GlAccountHistory glAccountHistoryToBeAdded) throws Exception {
AddGlAccountHistory command = new AddGlAccountHistory(glAccountHistoryToBeAdded);
GlAccountHistory glAccountHistory = ((GlAccountHistoryAdded) Scheduler.execute(command).data()).getAddedGlAccountHistory();
if (glAccountHistory != null)
return successful(glAccountHistory);
else
return conflict(null);
}
/**
* Updates the GlAccountHistory with the specific Id
*
* @param glAccountHistoryToBeUpdated
* the GlAccountHistory thats to be updated
* @return true on success, false on fail
* @throws Exception
*/
@RequestMapping(method = RequestMethod.PUT, value = "/{nullVal}", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<String> updateGlAccountHistory(@RequestBody GlAccountHistory glAccountHistoryToBeUpdated,
@PathVariable String nullVal) throws Exception {
// glAccountHistoryToBeUpdated.setnull(null);
UpdateGlAccountHistory command = new UpdateGlAccountHistory(glAccountHistoryToBeUpdated);
try {
if(((GlAccountHistoryUpdated) Scheduler.execute(command).data()).isSuccess())
return noContent();
} catch (RecordNotFoundException e) {
return notFound();
}
return conflict();
}
@GetMapping("/{glAccountHistoryId}")
public ResponseEntity<GlAccountHistory> findById(@PathVariable String glAccountHistoryId) throws Exception {
HashMap<String, String> requestParams = new HashMap<String, String>();
requestParams.put("glAccountHistoryId", glAccountHistoryId);
try {
List<GlAccountHistory> foundGlAccountHistory = findGlAccountHistorysBy(requestParams).getBody();
if(foundGlAccountHistory.size()==1){ return successful(foundGlAccountHistory.get(0));
}else{
return notFound();
}
} catch (RecordNotFoundException e) {
return notFound();
}
}
@DeleteMapping("/{glAccountHistoryId}")
public ResponseEntity<String> deleteGlAccountHistoryByIdUpdated(@PathVariable String glAccountHistoryId) throws Exception {
DeleteGlAccountHistory command = new DeleteGlAccountHistory(glAccountHistoryId);
try {
if (((GlAccountHistoryDeleted) Scheduler.execute(command).data()).isSuccess())
return noContent();
} catch (RecordNotFoundException e) {
return notFound();
}
return conflict();
}
}
| 38.120805 | 159 | 0.792782 |
03ee81285662b632665cb64ea3d00e5e7712081c | 10,858 | /*
* 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 com.gengoai.apollo.ml.model.sequence;
import cc.mallet.fst.*;
import cc.mallet.optimize.LimitedMemoryBFGS;
import cc.mallet.optimize.Optimizable;
import cc.mallet.pipe.SerialPipes;
import cc.mallet.pipe.TokenSequence2FeatureVectorSequence;
import cc.mallet.types.*;
import cc.mallet.util.MalletLogger;
import com.gengoai.ParameterDef;
import com.gengoai.apollo.ml.DataSet;
import com.gengoai.apollo.ml.Datum;
import com.gengoai.apollo.ml.model.LabelType;
import com.gengoai.apollo.ml.model.Params;
import com.gengoai.apollo.ml.model.SingleSourceFitParameters;
import com.gengoai.apollo.ml.model.SingleSourceModel;
import com.gengoai.apollo.ml.observation.Observation;
import com.gengoai.apollo.ml.observation.Variable;
import com.gengoai.apollo.ml.observation.VariableSequence;
import com.gengoai.conversion.Cast;
import lombok.NonNull;
import java.util.Arrays;
import java.util.function.Consumer;
import java.util.logging.Level;
import java.util.regex.Pattern;
import static com.gengoai.apollo.ml.model.sequence.Order.FIRST;
import static com.gengoai.collection.Arrays2.arrayOfInt;
import static com.gengoai.function.Functional.with;
/**
* <p>A wrapper around Mallet's CRF implementation</p>
*
* @author David B. Bracewell
*/
public class MalletCrf extends SingleSourceModel<MalletCrf.Parameters, MalletCrf> {
private static final long serialVersionUID = 1L;
public static final ParameterDef<Boolean> FULLY_CONNECTED = ParameterDef.boolParam("fullyConnected");
public static final ParameterDef<Order> ORDER = ParameterDef.param("order", Order.class);
public static final ParameterDef<String> START_STATE = ParameterDef.strParam("startState");
public static final ParameterDef<Integer> THREADS = ParameterDef.intParam("numThreads");
private SerialPipes pipes;
private CRF model;
private String startState;
/**
* Instantiates a new MalletCrf with default parameters.
*/
public MalletCrf() {
super(new Parameters());
}
/**
* Instantiates a new MalletCrf with the given parameters.
*
* @param parameters the parameters
*/
public MalletCrf(@NonNull Parameters parameters) {
super(parameters);
}
/**
* Instantiates a new MalletCrf with the given parameter updater.
*
* @param updater the updater
*/
public MalletCrf(@NonNull Consumer<Parameters> updater) {
super(with(new Parameters(), updater));
}
@Override
public void estimate(DataSet preprocessed) {
if(parameters.verbose.value()) {
MalletLogger.getLogger(ThreadedOptimizable.class.getName())
.setLevel(Level.INFO);
MalletLogger.getLogger(CRFTrainerByValueGradients.class.getName())
.setLevel(Level.INFO);
MalletLogger.getLogger(CRF.class.getName())
.setLevel(Level.INFO);
MalletLogger.getLogger(CRFOptimizableByBatchLabelLikelihood.class.getName())
.setLevel(Level.INFO);
MalletLogger.getLogger(LimitedMemoryBFGS.class.getName())
.setLevel(Level.INFO);
} else {
MalletLogger.getLogger(ThreadedOptimizable.class.getName())
.setLevel(Level.OFF);
MalletLogger.getLogger(CRFTrainerByValueGradients.class.getName())
.setLevel(Level.OFF);
MalletLogger.getLogger(CRF.class.getName())
.setLevel(Level.OFF);
MalletLogger.getLogger(CRFOptimizableByBatchLabelLikelihood.class.getName())
.setLevel(Level.OFF);
MalletLogger.getLogger(LimitedMemoryBFGS.class.getName())
.setLevel(Level.OFF);
}
Alphabet dataAlphabet = new Alphabet();
pipes = new SerialPipes(Arrays.asList(new SequenceToTokenSequence(),
new TokenSequence2FeatureVectorSequence(dataAlphabet, false, true)));
pipes.setDataAlphabet(dataAlphabet);
pipes.setTargetAlphabet(new LabelAlphabet());
InstanceList trainingData = new InstanceList(pipes);
for(Datum datum : preprocessed) {
com.gengoai.apollo.ml.observation.Sequence<?> x = datum.get(parameters.input.value()).asSequence();
com.gengoai.apollo.ml.observation.Sequence<?> y = datum.get(parameters.output.value()).asSequence();
Label[] target = new Label[x.size()];
LabelAlphabet labelAlphabet = Cast.as(trainingData.getTargetAlphabet());
for(int j = 0; j < target.length; j++) {
target[j] = labelAlphabet.lookupLabel(y.get(j).asVariable().getName(), true);
}
trainingData.addThruPipe(new Instance(x, new LabelSequence(target), null, null));
}
model = new CRF(pipes, null);
int[] order = {};
switch(parameters.order.value()) {
case FIRST:
order = arrayOfInt(1);
break;
case SECOND:
order = arrayOfInt(1, 2);
break;
case THIRD:
order = arrayOfInt(1, 2, 3);
break;
}
MalletSequenceValidator sv = Cast.as(parameters.validator.value() instanceof MalletSequenceValidator
? parameters.validator.value()
: null);
Pattern allowed = sv == null
? null
: sv.getAllowed();
Pattern forbidden = sv == null
? null
: sv.getForbidden();
model.addOrderNStates(trainingData,
order,
null,
parameters.startState.value(),
forbidden,
allowed,
parameters.fullyConnected.value());
this.startState = parameters.startState.value();
model.setWeightsDimensionAsIn(trainingData, false);
CRFOptimizableByBatchLabelLikelihood batchOptLabel = new CRFOptimizableByBatchLabelLikelihood(model,
trainingData,
parameters.numberOfThreads
.value());
ThreadedOptimizable optLabel = new ThreadedOptimizable(batchOptLabel,
trainingData,
model.getParameters().getNumFactors(),
new CRFCacheStaleIndicator(model));
Optimizable.ByGradientValue[] opts = {optLabel};
CRFTrainerByValueGradients crfTrainer = new CRFTrainerByValueGradients(model, opts);
crfTrainer.setMaxResets(0);
crfTrainer.train(trainingData, parameters.maxIterations.value());
optLabel.shutdown();
}
@Override
public Parameters getFitParameters() {
return new Parameters();
}
@Override
public LabelType getLabelType(@NonNull String name) {
if(parameters.output.value().equals(name)) {
return LabelType.Sequence;
}
throw new IllegalArgumentException("'" + name + "' is not a valid output for this model.");
}
@Override
protected Observation transform(@NonNull Observation observation) {
int length = observation.asSequence().size();
Sequence<?> sequence = Cast.as(model.getInputPipe()
.instanceFrom(new Instance(observation, null, null, null)).getData());
Sequence<?> bestOutput = model.transduce(sequence);
SumLattice lattice = new SumLatticeDefault(model, sequence, true);
Transducer.State sj = model.getState(startState);
VariableSequence labeling = new VariableSequence();
for(int i = 0; i < sequence.size(); i++) {
Transducer.State si = model.getState((String) bestOutput.get(i));
String label = (String) bestOutput.get(i);
double pS = lattice.getGammaProbability(i, si);
double PSjSi = lattice.getXiProbability(i, sj, si);
double score = Math.max(pS, PSjSi);
sj = si;
labeling.add(Variable.real(label, score));
}
return labeling;
}
@Override
protected void updateMetadata(@NonNull DataSet data) {
data.updateMetadata(parameters.output.value(), m -> {
m.setEncoder(null);
m.setType(VariableSequence.class);
m.setDimension(-1);
});
}
/**
* MalletCrf Fit Parameters
*/
public static class Parameters extends SingleSourceFitParameters<Parameters> {
private static final long serialVersionUID = 1L;
/**
* The sequence validator to user during inference (default {@link SequenceValidator#ALWAYS_TRUE})
*/
public final Parameter<SequenceValidator> validator = parameter(Params.Sequence.validator,
SequenceValidator.ALWAYS_TRUE);
/**
* The number of threads to use for training (default 20)
*/
public final Parameter<Integer> numberOfThreads = parameter(THREADS, 20);
/**
* The order of the CRF (default {@link Order#FIRST})
*/
public final Parameter<Order> order = parameter(ORDER, FIRST);
/**
* The maximum number of iterations to run for (default 250).
*/
public final Parameter<Integer> maxIterations = parameter(Params.Optimizable.maxIterations, 250);
/**
* Parameter denoting whether the generated graphical model is fully connected (default true).
*/
public final Parameter<Boolean> fullyConnected = parameter(FULLY_CONNECTED, true);
/**
* Parameter denoting the start state (default O).
*/
public final Parameter<String> startState = parameter(START_STATE, "O");
}
}//END OF MalletCRF
| 42.085271 | 126 | 0.627187 |
11135fd1661555a22b73cb5eb52f5091738848a4 | 5,832 | package drawable.fragment;
import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.view.ViewPager;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.incarmedia.R;
import com.incarmedia.adapter.KaLaOKPersonalInfoAdapter;
import com.incarmedia.adapter.MyViewPagerAdapter;
import com.incarmedia.bean.KaLaOKInfoBean;
import com.incarmedia.incommon.util.Constant;
import com.incarmedia.incommon.webapi.HttpCallbackListener;
import com.incarmedia.incommon.webapi.HttpUtil;
import com.incarmedia.ui.view.CircleIndicator;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.listener.PauseOnScrollListener;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
public class MyUpLoadFragment extends Fragment {
private View view;
private MyViewPagerAdapter adapter;
private ViewPager ok_pager_mysong;
private List<GridView> gridLists;
private KaLaOKPersonalInfoAdapter adapterGrid;
private int PAGE_SIZE = 4; //单页数量
private CircleIndicator indicator;
private Handler mhandle;
private List<GridView> mLists;
private ArrayList<KaLaOKInfoBean> kalaInfoLists;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
view = inflater.inflate(R.layout.fragment_my_song, container, false);
gridLists = new ArrayList<GridView>();
ok_pager_mysong = (ViewPager) view.findViewById(R.id.id_viewpager_ok_mysong);
indicator = (CircleIndicator) view.findViewById(R.id.id_indiacator_kala_mysong);
kalaInfoLists = new ArrayList<KaLaOKInfoBean>();
mLists = new ArrayList<>();
mLists.addAll(init(kalaInfoLists, view.getContext()));
adapter = new MyViewPagerAdapter(view.getContext(), mLists);
ok_pager_mysong.setAdapter(adapter);
indicator.setViewPager(ok_pager_mysong);
ok_pager_mysong.setOffscreenPageLimit(3);
List<BasicNameValuePair> params = new ArrayList<>();
params.add(new BasicNameValuePair("act", "2"));
KaraUserHome(params);
mhandle = new Handler(){
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if(msg.what==0){
mLists.clear();
mLists.addAll(init(kalaInfoLists, getActivity()));
indicator.setViewPager(ok_pager_mysong);
adapter.notifyDataSetChanged();
}
}
};
return view;
}
public List<GridView> init(List<KaLaOKInfoBean> json, Context context) {
if (json.size() == 0) {
return new ArrayList<GridView>();
}
gridLists.clear();
final int PageCount = (int) Math.ceil(json.size() / (double) PAGE_SIZE);
for (int i = 0; i < PageCount; i++) {
GridView gv = new GridView(context);
gv.setAdapter(adapterGrid = new KaLaOKPersonalInfoAdapter(context, json, i, PAGE_SIZE));
gv.setGravity(Gravity.CENTER_VERTICAL);
gv.setClickable(true);
gv.setFocusable(true);
gv.setHorizontalSpacing(40);
gv.setVerticalSpacing(20);
ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
gv.setLayoutParams(lp);
ViewGroup.LayoutParams layoutParams = gv.getLayoutParams();
// gv.setNumColumns(GridView.AUTO_FIT);
gv.setNumColumns(1);
gv.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);
gv.setOnScrollListener(new PauseOnScrollListener(ImageLoader.getInstance(), true, false));
// gv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
//
// @Override
// public void onItemClick(AdapterView<?> parent, View view,
// int position, long id) {
// clickListener.onItemClickListener(mViewPager
// .getCurrentItem() * MyGridViewAdapter.PAGE_SIZE + position);
// }
// });
gridLists.add(gv);
}
return gridLists;
}
private void KaraUserHome(List<BasicNameValuePair> param) {
HttpUtil.sendHttpRequest(Constant.KaraUserHome, param, new HttpCallbackListener() {
@Override
public void onFinish(String response) {
Type typeSongInFo = new TypeToken<ArrayList<KaLaOKInfoBean>>() {
}.getType();
try {
JSONObject json = new JSONObject(response);
String msc = null;
msc = json.getJSONArray("msc").toString();
Gson gson = new Gson();
kalaInfoLists = gson.fromJson(msc, typeSongInFo);
mhandle.sendEmptyMessage(0);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onError(Exception e) {
}
@Override
public void onNetError() {
}
});
}
}
| 37.87013 | 141 | 0.638203 |
cef48aeddee8535e1345708e0fe102d816b244c3 | 3,674 | /*
* 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.geode.redis.internal.collections;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import com.pholser.junit.quickcheck.Property;
import com.pholser.junit.quickcheck.generator.InRange;
import com.pholser.junit.quickcheck.generator.Size;
import com.pholser.junit.quickcheck.runner.JUnitQuickcheck;
import it.unimi.dsi.fastutil.Hash;
import org.junit.runner.RunWith;
@RunWith(JUnitQuickcheck.class)
public class SizeableObject2ObjectOpenCustomHashMapWithCursorQuickCheckTest {
private static final Hash.Strategy<Integer> NATURAL_HASH = new Hash.Strategy<Integer>() {
@Override
public int hashCode(Integer o) {
return o.hashCode();
}
@Override
public boolean equals(Integer a, Integer b) {
return a.equals(b);
}
};
@Property
public void scanWithConcurrentModifications_ReturnsExpectedElements(
@Size(min = 2, max = 500) Set<@InRange(minInt = 0, maxInt = 500) Integer> initialData,
@Size(max = 500) Set<@InRange(minInt = 0, maxInt = 1000) Integer> dataToAdd,
@Size(max = 500) Set<@InRange(minInt = 0, maxInt = 500) Integer> keysToRemove) {
SizeableObject2ObjectOpenCustomHashMapWithCursor<Integer, Integer> map =
new SizeableObject2ObjectOpenCustomHashMapWithCursor<>(NATURAL_HASH);
initialData.forEach(i -> map.put(i, i));
HashMap<Integer, Integer> scanned = new HashMap<>();
int cursor = map.scan(0, initialData.size() / 2, HashMap::put, scanned);
dataToAdd.forEach(i -> map.put(i, i));
map.keySet().removeAll(keysToRemove);
cursor = map.scan(cursor, 100000, HashMap::put, scanned);
assertThat(cursor).isEqualTo(0);
// Test that we can scan all of the entries what were in the map the entire time.
Set<Integer> expectedKeys = new HashSet<>(initialData);
expectedKeys.removeAll(keysToRemove);
assertThat(scanned.keySet()).containsAll(expectedKeys);
}
@Property
public void scanWithNoModificationsDoesNotReturnDuplicates(
@Size(min = 2, max = 500) Set<@InRange(minInt = 0, maxInt = 500) Integer> initialData) {
SizeableObject2ObjectOpenCustomHashMapWithCursor<Integer, Integer> map =
new SizeableObject2ObjectOpenCustomHashMapWithCursor<>(NATURAL_HASH);
initialData.forEach(i -> map.put(i, i));
List<Integer> scanned = new ArrayList<>();
int cursor = map.scan(0, initialData.size() / 2, (data, key, value) -> data.add(key), scanned);
cursor = map.scan(cursor, 100000, (data, key, value) -> data.add(key), scanned);
assertThat(cursor).isEqualTo(0);
// Test that no duplicate entries were added and no entries were missed.
assertThat(scanned).hasSize(initialData.size());
assertThat(scanned).containsExactlyInAnyOrderElementsOf(initialData);
}
}
| 40.822222 | 100 | 0.737616 |
52ac0b6417e71de5dd4fd8697d7b3eef6010ba1a | 15,373 | /* SPDX-License-Identifier: Apache-2.0 */
/* Copyright Contributors to the ODPi Egeria project. */
package org.odpi.openmetadata.accessservices.assetcatalog;
import org.odpi.openmetadata.accessservices.assetcatalog.model.rest.body.SearchParameters;
import org.odpi.openmetadata.accessservices.assetcatalog.model.rest.responses.AssetCatalogOMASAPIResponse;
import org.odpi.openmetadata.accessservices.assetcatalog.model.rest.responses.AssetDescriptionResponse;
import org.odpi.openmetadata.accessservices.assetcatalog.model.rest.responses.AssetResponse;
import org.odpi.openmetadata.accessservices.assetcatalog.model.rest.responses.ClassificationsResponse;
import org.odpi.openmetadata.accessservices.assetcatalog.model.rest.responses.RelationshipResponse;
import org.odpi.openmetadata.accessservices.assetcatalog.model.rest.responses.RelationshipsResponse;
import org.odpi.openmetadata.commonservices.ffdc.InvalidParameterHandler;
import org.odpi.openmetadata.commonservices.ffdc.RESTExceptionHandler;
import org.odpi.openmetadata.commonservices.ffdc.exceptions.InvalidParameterException;
import org.odpi.openmetadata.commonservices.ffdc.rest.FFDCRESTClient;
import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException;
/**
* The Asset Catalog Open Metadata Access Service (OMAS) provides an interface to search for assets including
* data stores, event feeds, APIs and data sets, related assets and relationships.
* Also, it can return the connection details for the asset metadata.
* The Asset Catalog OMAS includes:
* <ul>
* <li>Client-side provides language-specific client packages to make it easier for data tools and applications to call the interface.</li>
* <li>OMAS Server calls to retrieve assets and information related to the assets.</li>
* </ul>
*/
public class AssetCatalog extends FFDCRESTClient implements AssetCatalogInterface {
private static final String BASE_PATH = "/servers/{0}/open-metadata/access-services/asset-catalog/users/{1}";
private static final String ASSET_DETAILS = "/asset-details/{2}?assetType={3}";
private static final String ASSET_UNIVERSE = "/asset-universe/{2}?assetType={3}";
private static final String ASSET_RELATIONSHIPS = "/asset-relationships/{2}?assetType={3}&relationshipType={4}&from={5}&pageSize={6}";
private static final String ASSET_CLASSIFICATIONS = "/asset-classifications/{2}?assetType={3}&classificationName={4}";
private static final String LINKING_ASSET = "/linking-assets/from/{2}/to/{3}";
private static final String LINKING_RELATIONSHIPS = "/linking-assets-relationships/from/{2}/to/{3}";
private static final String ASSETS_FROM_NEIGHBORHOOD = "/assets-from-neighborhood/{2}";
private static final String SEARCH = "/search/{2}";
private static final String ASSET_CONTEXT = "/asset-context/{2}?assetType={3}";
private static final String RELATIONSHIP_BETWEEN_ENTITIES = "/relationship-between-entities/{2}/{3}?relationshipType={4}";
private static final String GUID_PARAMETER = "assetGUID";
private static final String START_ASSET_GUID = "startAssetGUID";
private static final String END_ASSET_GUID = "endAssetGUID";
private static final String SEARCH_PARAMETERS = "searchParameters";
private InvalidParameterHandler invalidParameterHandler = new InvalidParameterHandler();
private RESTExceptionHandler exceptionHandler = new RESTExceptionHandler();
/**
* Create a new AssetConsumer client.
*
* @param serverName name of the server to connect to
* @param serverPlatformURLRoot the network address of the server running the OMAS REST servers
* @throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException if parameter validation fails
*/
public AssetCatalog(String serverName, String serverPlatformURLRoot)
throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException {
super(serverName, serverPlatformURLRoot);
}
public AssetCatalog(String serverName, String serverPlatformURLRoot, String userId, String password)
throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException {
super(serverName, serverPlatformURLRoot, userId, password);
}
/**
* {@inheritDoc}
*/
@Override
public AssetDescriptionResponse getAssetDetails(String userId,
String assetGUID,
String assetType)
throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException {
String methodName = "getAssetDetails";
validateUserAndAssetGUID(userId, assetGUID, methodName, GUID_PARAMETER);
AssetDescriptionResponse response = callGetRESTCall(methodName, AssetDescriptionResponse.class,
serverPlatformURLRoot + BASE_PATH + ASSET_DETAILS, serverName, userId, assetGUID, assetType);
detectExceptions(methodName, response);
return response;
}
/**
* {@inheritDoc}
*/
@Override
public AssetDescriptionResponse getAssetUniverse(String userId,
String assetGUID,
String assetType)
throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException {
String methodName = "getAssetUniverse";
validateUserAndAssetGUID(userId, assetGUID, methodName, GUID_PARAMETER);
AssetDescriptionResponse response = callGetRESTCall(methodName, AssetDescriptionResponse.class,
serverPlatformURLRoot + BASE_PATH + ASSET_UNIVERSE, serverName, userId, assetGUID, assetType);
detectExceptions(methodName, response);
return response;
}
/**
* {@inheritDoc}
*/
@Override
public RelationshipsResponse getAssetRelationships(String userId,
String assetGUID,
String assetType,
String relationshipType,
Integer from,
Integer pageSize)
throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException {
String methodName = "getAssetRelationships";
validateUserAndAssetGUID(userId, assetGUID, methodName, GUID_PARAMETER);
invalidParameterHandler.validatePaging(from, pageSize, methodName);
RelationshipsResponse relationshipsResponse = callGetRESTCall(methodName, RelationshipsResponse.class,
serverPlatformURLRoot + BASE_PATH + ASSET_RELATIONSHIPS, serverName,
userId, assetGUID, assetType, relationshipType, from, pageSize);
detectExceptions(methodName, relationshipsResponse);
return relationshipsResponse;
}
/**
* {@inheritDoc}
*/
@Override
public ClassificationsResponse getClassificationsForAsset(String userId,
String assetGUID,
String assetType,
String classificationName)
throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException {
String methodName = "getClassificationsForAsset";
validateUserAndAssetGUID(userId, assetGUID, methodName, GUID_PARAMETER);
ClassificationsResponse classificationsResponse = callGetRESTCall(methodName, ClassificationsResponse.class,
serverPlatformURLRoot + BASE_PATH + ASSET_CLASSIFICATIONS,
serverName, userId, assetGUID, assetType, classificationName);
detectExceptions(methodName, classificationsResponse);
return classificationsResponse;
}
/**
* {@inheritDoc}
*/
@Override
public AssetDescriptionResponse getLinkingAssets(String userId,
String startAssetGUID,
String endAssetGUID)
throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException {
String methodName = "getLinkingAssets";
validateStartAndEndAssetsGUIDs(userId, startAssetGUID, endAssetGUID, methodName);
AssetDescriptionResponse response = callGetRESTCall(methodName, AssetDescriptionResponse.class,
serverPlatformURLRoot + BASE_PATH + LINKING_ASSET, serverName,
userId, startAssetGUID, endAssetGUID);
detectExceptions(methodName, response);
return response;
}
/**
* {@inheritDoc}
*/
@Override
public RelationshipsResponse getLinkingRelationships(String userId,
String startAssetGUID,
String endAssetGUID)
throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException {
String methodName = "getLinkingRelationships";
validateStartAndEndAssetsGUIDs(userId, startAssetGUID, endAssetGUID, methodName);
RelationshipsResponse response = callGetRESTCall(methodName, RelationshipsResponse.class,
serverPlatformURLRoot + BASE_PATH + LINKING_RELATIONSHIPS, serverName,
userId, startAssetGUID, endAssetGUID);
detectExceptions(methodName, response);
return response;
}
/**
* {@inheritDoc}
*/
@Override
public AssetDescriptionResponse getAssetsFromNeighborhood(String userId,
String assetGUID,
SearchParameters searchParameters)
throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException {
String methodName = "getAssetsFromNeighborhood";
validateSearchParams(userId, assetGUID, searchParameters, methodName);
AssetDescriptionResponse response = callPostRESTCall(methodName, AssetDescriptionResponse.class,
serverPlatformURLRoot + BASE_PATH + ASSETS_FROM_NEIGHBORHOOD, serverName, userId, assetGUID, searchParameters);
detectExceptions(methodName, response);
return response;
}
/**
* {@inheritDoc}
*/
@Override
public AssetResponse searchByType(String userId,
String searchCriteria,
SearchParameters searchParameters)
throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException {
String methodName = "searchByType";
invalidParameterHandler.validateUserId(methodName, userId);
invalidParameterHandler.validateSearchString(searchCriteria, "searchCriteria", methodName);
invalidParameterHandler.validateObject(searchParameters, SEARCH_PARAMETERS, methodName);
AssetResponse assetResponse = callPostRESTCall(methodName, AssetResponse.class,
serverPlatformURLRoot + BASE_PATH + SEARCH, searchParameters, serverName, userId, searchCriteria);
detectExceptions(methodName, assetResponse);
return assetResponse;
}
/**
* {@inheritDoc}
*/
@Override
public AssetResponse getAssetContext(String userId,
String assetGUID,
String assetType)
throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException {
String methodName = "getAssetContext";
invalidParameterHandler.validateUserId(methodName, userId);
invalidParameterHandler.validateSearchString(assetGUID, GUID_PARAMETER, methodName);
AssetResponse assetResponse = callGetRESTCall(methodName, AssetResponse.class,
serverPlatformURLRoot + BASE_PATH + ASSET_CONTEXT, serverName, userId, assetGUID, assetType);
detectExceptions(methodName, assetResponse);
return assetResponse;
}
/**
* {@inheritDoc}
*/
@Override
public RelationshipResponse getRelationshipBetweenEntities(String userId,
String entity1GUID,
String entity2GUID,
String relationshipType)
throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException {
String methodName = "getRelationshipBetweenEntities";
validateStartAndEndAssetsGUIDs(userId, entity1GUID, entity2GUID, methodName);
RelationshipResponse relationshipResponse = callGetRESTCall(methodName, RelationshipResponse.class,
serverPlatformURLRoot + BASE_PATH + RELATIONSHIP_BETWEEN_ENTITIES,
serverName, userId, entity1GUID, entity2GUID, relationshipType);
detectExceptions(methodName, relationshipResponse);
return relationshipResponse;
}
private void validateUserAndAssetGUID(String userId,
String assetGUID,
String methodName,
String guidParameter) throws InvalidParameterException {
invalidParameterHandler.validateUserId(methodName, userId);
invalidParameterHandler.validateGUID(assetGUID, guidParameter, methodName);
}
private void validateStartAndEndAssetsGUIDs(String userId,
String startAssetGUID,
String endAssetGUID,
String methodName) throws InvalidParameterException {
validateUserAndAssetGUID(userId, startAssetGUID, methodName, START_ASSET_GUID);
invalidParameterHandler.validateGUID(endAssetGUID, END_ASSET_GUID, methodName);
}
private void validateSearchParams(String userId,
String assetGUID,
SearchParameters searchParameters,
String methodName) throws InvalidParameterException {
validateUserAndAssetGUID(userId, assetGUID, methodName, GUID_PARAMETER);
invalidParameterHandler.validateObject(searchParameters, SEARCH_PARAMETERS, methodName);
}
private void detectExceptions(String methodName,
AssetCatalogOMASAPIResponse response)
throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException {
exceptionHandler.detectAndThrowInvalidParameterException(methodName, response);
exceptionHandler.detectAndThrowPropertyServerException(methodName, response);
}
} | 49.750809 | 140 | 0.670721 |
8a062a8b9b0836821822e1db0f0e1e9a0369b5c4 | 2,627 | /* Copyright 2010, 2017, Oracle and/or its affiliates. All rights reserved. */
package example;
import example.common.ExampleModule;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.StringTokenizer;
import oracle.jbo.JboException;
import oracle.jbo.client.Configuration;
import oracle.jbo.domain.Date;
import oracle.jbo.domain.Number;
import oracle.jbo.server.ApplicationModuleImpl;
// ---------------------------------------------------------------------
// --- File generated by Oracle ADF Business Components Design Time.
// --- Custom code may be added to this class.
// --- Warning: Do not modify method signatures of generated methods.
// ---------------------------------------------------------------------
public class ExampleModuleImpl extends ApplicationModuleImpl implements ExampleModule {
/**This is the default constructor (do not remove)
*/
public ExampleModuleImpl() {
}
/**Sample main for debugging Business Components code using the tester.
*/
public static void main(String[] args) {
launchTester("example", /* package name */
"ExampleModuleLocal" /* Configuration Name */);
}
private void callStoredProcedure(String stmt, Object[] bindVars) {
PreparedStatement st = null;
try {
// 1. Create a JDBC PreparedStatement for
st = getDBTransaction().createPreparedStatement("begin "+stmt+";end;",0);
if (bindVars != null) {
// 2. Loop over values for the bind variables passed in, if any
for (int z = 0; z < bindVars.length; z++) {
// 3. Set the value of each bind variable in the statement
st.setObject(z + 1, bindVars[z]);
}
}
// 4. Execute the statement
st.executeUpdate();
}
catch (SQLException e) {
throw new JboException(e);
}
finally {
if (st != null) {
try {
// 5. Close the statement
st.close();
}
catch (SQLException e) {}
}
}
}
public void collectDataUsingStoredProcedure(String v, Number n, Date d) {
Object[] procArgs = new Object[]{v,n,d};
callStoredProcedure("example_pkg.do_something(?,?,?)",procArgs);
getDBTransaction().commit();
/*
* Force the query displaying the data in the example table to re-execute
*/
getExamplePkgTable().executeQuery();
}
/**Container's getter for ExamplePkgTable
*/
public ExamplePkgTableImpl getExamplePkgTable() {
return (ExamplePkgTableImpl)findViewObject("ExamplePkgTable");
}
}
| 32.432099 | 88 | 0.60906 |
d202997f6343cfd3d49641e43bd72b989e1f529e | 7,596 | /*
* Copyright 2000-2017 JetBrains s.r.o.
*
* 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.intellij.psi.impl.beanProperties;
import com.intellij.codeInsight.daemon.QuickFixBundle;
import com.intellij.codeInsight.daemon.impl.quickfix.CreateFromUsageUtils;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
import com.intellij.psi.codeStyle.VariableKind;
import com.intellij.psi.util.PropertyUtil;
import com.intellij.psi.util.PropertyUtilBase;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
public class CreateJavaBeanPropertyFix implements LocalQuickFix, IntentionAction {
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.beanProperties.CreateJavaBeanPropertyFix");
protected final String myPropertyName;
@NotNull protected final SmartPsiElementPointer<PsiClass> myPsiClass;
@NotNull protected final PsiType myType;
private final boolean myGetter;
private final boolean mySetter;
private final boolean myField;
public CreateJavaBeanPropertyFix(@NotNull PsiClass psiClass, @NotNull String propertyName,
@NotNull PsiType propertyType,
boolean getterRequired,
boolean setterRequired,
boolean fieldRequired) {
myPropertyName = propertyName;
myPsiClass = SmartPointerManager.getInstance(psiClass.getProject()).createSmartPsiElementPointer(psiClass);
myType = propertyType;
myGetter = getterRequired;
mySetter = setterRequired;
myField = fieldRequired;
}
@Override
@NotNull
public String getName() {
if (myGetter && mySetter && myField) return QuickFixBundle.message("create.readable.writable.property.with.field", myPropertyName);
if (myField && myGetter) return QuickFixBundle.message("create.readable.property.with.field", myPropertyName);
if (myField && mySetter) return QuickFixBundle.message("create.writable.property.with.field", myPropertyName);
if (!myField && myGetter) return QuickFixBundle.message("create.readable.property", myPropertyName);
if (!myField && mySetter) return QuickFixBundle.message("create.writable.property", myPropertyName);
return QuickFixBundle.message("create.readable.writable.property.with.field", myPropertyName);
}
protected void doFix() throws IncorrectOperationException {
if (myField) createField();
if (mySetter) createSetter(myField);
if (myGetter) createGetter(myField);
}
@Override
@NotNull
public String getFamilyName() {
return getName();
}
@Override
public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) {
applyFix(project);
}
private void applyFix(final Project project) {
WriteCommandAction.writeCommandAction(project, myPsiClass.getContainingFile()).withName(getName()).run(() -> {
try {
doFix();
}
catch (IncorrectOperationException e) {
LOG.error("Cannot create property", e);
}
});
}
@Override
@NotNull
public String getText() {
return getName();
}
@Override
public boolean isAvailable(@NotNull final Project project, final Editor editor, final PsiFile file) {
return true;
}
@Override
public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException {
applyFix(project);
}
@Override
public boolean startInWriteAction() {
return false;
}
private String getFieldName() {
final JavaCodeStyleManager styleManager = JavaCodeStyleManager.getInstance(myPsiClass.getProject());
return styleManager.suggestVariableName(VariableKind.FIELD, myPropertyName, null, myType).names[0];
}
private void createSetter(final boolean createField) throws IncorrectOperationException {
final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(myPsiClass.getProject()).getElementFactory();
final String methodName = PropertyUtilBase.suggestSetterName(myPropertyName);
final String typeName = myType.getCanonicalText();
@NonNls final String text;
PsiClass psiClass = myPsiClass.getElement();
if (psiClass == null) return;
boolean isInterface = psiClass.isInterface();
if (isInterface) {
text = "public void " + methodName + "(" + typeName + " " + myPropertyName + ");";
}
else if (createField) {
@NonNls String fieldName = getFieldName();
if (fieldName.equals(myPropertyName)) {
fieldName = "this." + fieldName;
}
text = "public void " + methodName + "(" + typeName + " " + myPropertyName + ") {" + fieldName + "=" + myPropertyName + ";}";
}
else {
text = "public void " + methodName + "(" + typeName + " " + myPropertyName + ") {}";
}
final PsiMethod method = elementFactory.createMethodFromText(text, null);
final PsiMethod psiElement = (PsiMethod)psiClass.add(method);
if (!isInterface && !createField) {
CreateFromUsageUtils.setupMethodBody(psiElement, psiClass);
}
}
private void createGetter(final boolean createField) throws IncorrectOperationException {
final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(myPsiClass.getProject()).getElementFactory();
final String methodName = PropertyUtilBase.suggestGetterName(myPropertyName, myType);
final String typeName = myType.getCanonicalText();
@NonNls final String text;
PsiClass psiClass = myPsiClass.getElement();
if (psiClass == null) return;
boolean isInterface = psiClass.isInterface();
if (createField) {
final String fieldName = getFieldName();
text = "public " + typeName + " " + methodName + "() { return " + fieldName + "; }";
}
else {
if (isInterface) {
text = typeName + " " + methodName + "();";
}
else {
text = "public " + typeName + " " + methodName + "() { return null; }";
}
}
final PsiMethod method = elementFactory.createMethodFromText(text, null);
final PsiMethod psiElement = (PsiMethod)psiClass.add(method);
if (!createField && !isInterface) {
CreateFromUsageUtils.setupMethodBody(psiElement);
}
}
private void createField() throws IncorrectOperationException {
final String fieldName = getFieldName();
final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(myPsiClass.getProject()).getElementFactory();
final PsiField psiField = elementFactory.createField(fieldName, myType);
PsiClass psiClass = myPsiClass.getElement();
if (psiClass == null) return;
psiClass.add(psiField);
}
}
| 40.190476 | 135 | 0.720642 |
1abfd7a1e3865f3a93986e31d8061bc214a47669 | 2,517 | ///******************************************************************************
//
//Copyright (c) 2010, Cormac Flanagan (University of California, Santa Cruz)
// and Stephen Freund (Williams College)
//
//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 names of the University of California, Santa Cruz
// and Williams College 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
//HOLDER 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 acme.util.option;
//
//
///**
// * An option configurable on the command line.
// */
//public abstract class CommandLineOptionWithRunnable<T> extends CommandLineOption<T> {
//
// /** Runnable to run when setting */
// protected final Runnable onSet;
//
// public CommandLineOptionWithRunnable(String id, T dV, boolean hasArg, Kind kind, String usage, Runnable onSet) {
// super(id, dV, hasArg, kind, usage);
// this.onSet = onSet;
// onSet.run();
// }
//
// @Override
// public void set(T val) {
// super.set(val);
// if (onSet != null) {
// onSet.run();
// }
// }
//
//}
//
//
| 37.567164 | 115 | 0.668653 |
d7b0f43f0200bb32c1dfbbd73e4da366126c3bb3 | 2,325 | package org.middlepath.dassembler.linker;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import org.middlepath.mcapi.block.SubChunkBlock;
import org.middlepath.mcapi.redstoneutils.Endian;
import org.middlepath.mcapi.redstoneutils.MemoryCell;
import org.middlepath.mcapi.redstoneutils.AbstractMemoryWord;
public class ExampleMemoryWord extends AbstractMemoryWord<SubChunkBlock, Byte, Integer> {
public ExampleMemoryWord(Collection<MemoryCell<SubChunkBlock>> cells) {
super(cells);
}
public ExampleMemoryWord(List<ExampleMemoryCell> cells) {
super(cells);
}
public ExampleMemoryCell getAnyCell() {
return ExampleMemoryCell.class.cast(cells.stream().findAny().get());
}
/**
* All cells in the word will have the same x row coordinate
*
* @return
*/
public int getZRow() {
return getAnyCell().getRowIndex();
}
public boolean isInstructionWord() {
return getAnyCell().isInstruction();
}
@Override
public int compare(MemoryCell<SubChunkBlock> o1, MemoryCell<SubChunkBlock> o2) {
SubChunkBlock s1 = o1.getContextObject();
SubChunkBlock s2 = o2.getContextObject();
if (getEndianness() == Endian.BIG_ENDIAN)
return s2.getCoordinate().getGlobalX() - s1.getCoordinate().getGlobalX();
else
return s1.getCoordinate().getGlobalX() - s2.getCoordinate().getGlobalX();
}
@Override
public Byte getValue() {
Iterator<MemoryCell<SubChunkBlock>> iterator = this.getMemoryCells().iterator();
int retInt = 0;
for (int i = 0; i < 8; i++) {
if (!iterator.hasNext())
return (byte) retInt;
int bit = (iterator.next().getValue()) ? 1 : 0;
retInt |= (bit << i);
}
return (byte)retInt;
}
@Override
public void setValue(Byte word) {
Iterator<MemoryCell<SubChunkBlock>> iterator = this.getMemoryCells().iterator();
int temp = word;
for (int i = 0; i < 8; i++) {
if (!iterator.hasNext())
break;
boolean bit = (((temp >>> i) & 1) == 1);
iterator.next().setValue(bit);
}
}
@Override
public Endian getEndianness() {
//Pretty sure that the bit order is always Big Endian
//return Endian.BIG_ENDIAN;
ExampleMemoryCell anyCell = getAnyCell();
return (anyCell.isInstruction()) ? Endian.BIG_ENDIAN : Endian.LITTLE_ENDIAN;
}
@Override
public Integer getAddressableKey() {
return this.getZRow();
}
}
| 26.123596 | 89 | 0.709677 |
db05440434e067edfdadca29610c87e123423612 | 4,472 | /**
* This class is generated by jOOQ
*/
package appengine.parser.mysqlmodels.tables;
import appengine.parser.mysqlmodels.Keys;
import appengine.parser.mysqlmodels._6txkrsiwk3;
import appengine.parser.mysqlmodels.tables.records.UbereatsRecord;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Generated;
import org.jooq.Field;
import org.jooq.Identity;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.UniqueKey;
import org.jooq.impl.TableImpl;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.8.3"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class Ubereats extends TableImpl<UbereatsRecord> {
private static final long serialVersionUID = -977428072;
/**
* The reference instance of <code>6txKRsiwk3.ubereats</code>
*/
public static final Ubereats UBEREATS = new Ubereats();
/**
* The class holding records for this type
*/
@Override
public Class<UbereatsRecord> getRecordType() {
return UbereatsRecord.class;
}
/**
* The column <code>6txKRsiwk3.ubereats.uuid</code>.
*/
public final TableField<UbereatsRecord, String> UUID = createField("uuid", org.jooq.impl.SQLDataType.VARCHAR.length(100), this, "");
/**
* The column <code>6txKRsiwk3.ubereats.title</code>.
*/
public final TableField<UbereatsRecord, String> TITLE = createField("title", org.jooq.impl.SQLDataType.VARCHAR.length(50), this, "");
/**
* The column <code>6txKRsiwk3.ubereats.item_description</code>.
*/
public final TableField<UbereatsRecord, String> ITEM_DESCRIPTION = createField("item_description", org.jooq.impl.SQLDataType.VARCHAR.length(500), this, "");
/**
* The column <code>6txKRsiwk3.ubereats.image_url</code>.
*/
public final TableField<UbereatsRecord, String> IMAGE_URL = createField("image_url", org.jooq.impl.SQLDataType.VARCHAR.length(200), this, "");
/**
* The column <code>6txKRsiwk3.ubereats.query</code>.
*/
public final TableField<UbereatsRecord, String> QUERY = createField("query", org.jooq.impl.SQLDataType.VARCHAR.length(20), this, "");
/**
* The column <code>6txKRsiwk3.ubereats.city_id</code>.
*/
public final TableField<UbereatsRecord, Integer> CITY_ID = createField("city_id", org.jooq.impl.SQLDataType.INTEGER, this, "");
/**
* The column <code>6txKRsiwk3.ubereats.store_uuid</code>.
*/
public final TableField<UbereatsRecord, String> STORE_UUID = createField("store_uuid", org.jooq.impl.SQLDataType.VARCHAR.length(100), this, "");
/**
* The column <code>6txKRsiwk3.ubereats.id</code>.
*/
public final TableField<UbereatsRecord, Integer> ID = createField("id", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
/**
* Create a <code>6txKRsiwk3.ubereats</code> table reference
*/
public Ubereats() {
this("ubereats", null);
}
/**
* Create an aliased <code>6txKRsiwk3.ubereats</code> table reference
*/
public Ubereats(String alias) {
this(alias, UBEREATS);
}
private Ubereats(String alias, Table<UbereatsRecord> aliased) {
this(alias, aliased, null);
}
private Ubereats(String alias, Table<UbereatsRecord> aliased, Field<?>[] parameters) {
super(alias, null, aliased, parameters, "");
}
/**
* {@inheritDoc}
*/
@Override
public Schema getSchema() {
return _6txkrsiwk3._6TXKRSIWK3;
}
/**
* {@inheritDoc}
*/
@Override
public Identity<UbereatsRecord, Integer> getIdentity() {
return Keys.IDENTITY_UBEREATS;
}
/**
* {@inheritDoc}
*/
@Override
public UniqueKey<UbereatsRecord> getPrimaryKey() {
return Keys.KEY_UBEREATS_PRIMARY;
}
/**
* {@inheritDoc}
*/
@Override
public List<UniqueKey<UbereatsRecord>> getKeys() {
return Arrays.<UniqueKey<UbereatsRecord>>asList(Keys.KEY_UBEREATS_UBEREATS_UUID_PK, Keys.KEY_UBEREATS_PRIMARY);
}
/**
* {@inheritDoc}
*/
@Override
public Ubereats as(String alias) {
return new Ubereats(alias, this);
}
/**
* Rename this table
*/
public Ubereats rename(String name) {
return new Ubereats(name, null);
}
}
| 27.604938 | 160 | 0.656977 |
f11dbdb219262ab26464fce55dfa56d3f5bacbbd | 1,631 | /*
* #%L
* ch.vorburger.exec
* %%
* Copyright (C) 2012 - 2018 Michael Vorburger
* %%
* 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.
* #L%
*/
package ch.vorburger.exec;
import org.apache.commons.exec.LogOutputStream;
/**
* OutputStream which watches out for the occurrence of a keyword (String).
*
* <p>Used to watch check the console output of a daemon ManagedProcess for some "started up OK" kind
* of message.
*
* @author Michael Vorburger
*/
// intentionally package local for now
class CheckingConsoleOutputStream extends LogOutputStream {
private final String watchOutFor;
private boolean seenIt = false;
CheckingConsoleOutputStream(String watchOutFor) {
if (watchOutFor.contains("\n")) {
throw new IllegalArgumentException("Cannot handle newlines (CR) ...");
}
this.watchOutFor = watchOutFor;
}
@Override
protected void processLine(String line, @SuppressWarnings("unused") int level) {
if (line.contains(watchOutFor)) {
seenIt = true;
}
}
public boolean hasSeenIt() {
return seenIt;
}
}
| 28.614035 | 101 | 0.689148 |
1f27ef48b661caa6119bf0c35caca7bb5269757e | 2,514 | package luyao.parser.arsc.bean;
import luyao.parser.utils.BytesReader;
import java.io.IOException;
/**
* Created by luyao
* on 2018/12/21 10:57
*/
public class ResTablePackageHeader {
/*
struct ResTable_package
{
struct ResChunk_header header;
// If this is a base package, its ID. Package IDs start
// at 1 (corresponding to the value of the package bits in a
// resource identifier). 0 means this is not a base package.
uint32_t id;
// Actual name of this package, \0-terminated.
uint16_t name[128];
// Offset to a ResStringPool_header defining the resource
// type symbol table. If zero, this package is inheriting from
// another base package (overriding specific values in it).
uint32_t typeStrings;
// Last index into typeStrings that is for public use by others.
uint32_t lastPublicType;
// Offset to a ResStringPool_header defining the resource
// key symbol table. If zero, this package is inheriting from
// another base package (overriding specific values in it).
uint32_t keyStrings;
// Last index into keyStrings that is for public use by others.
uint32_t lastPublicKey;
uint32_t typeIdOffset;
};
*/
public ResChunkHeader chunkHeader;
public int id; // 包的ID,等于Package Id,一般用户包的值Package Id为0X7F,系统资源包的Package Id为0X01。
public String name; // 包名称
public int typeStrings; // 资源类型字符串池在 ResTablePackage 中的偏移量
public int lastPublicType; // 最后一个导出的Public类型字符串在类型字符串资源池中的索引,目前这个值设置为类型字符串资源池的元素个数。
public int keyStrings; // 资源名称字符池在 ResTablePackage 中的偏移
public int lastPublicKey; // 最后一个导出的Public资源名称字符串在资源项名称字符串资源池中的索引,目前这个值设置为资源项名称字符串资源池的元素个数。
public ResTablePackageHeader(BytesReader reader) throws IOException {
chunkHeader = new ResChunkHeader(reader);
id=reader.readInt();
name = new String(reader.read(256));
typeStrings = reader.readInt();
lastPublicType = reader.readInt();
keyStrings = reader.readInt();
lastPublicKey = reader.readInt();
}
@Override
public String toString() {
return "ResTablePackageHeader{" +
"\nchunkHeader=" + chunkHeader.toString() +
", \nid=" + id +
", \nname='" + name + '\'' +
", \ntypeStrings=" + typeStrings +
", \nlastPublicType=" + lastPublicType +
", \nkeyStrings=" + keyStrings +
", \nlastPublicKey=" + lastPublicKey +
'}';
}
}
| 32.230769 | 95 | 0.663087 |
feb7256b5e26ce061171f126727399050147993d | 1,087 | package io.github.vm.patlego.enc.commands;
import org.apache.commons.lang3.StringUtils;
import org.apache.karaf.shell.api.action.Action;
import org.apache.karaf.shell.api.action.Argument;
import org.apache.karaf.shell.api.action.Command;
import org.apache.karaf.shell.api.action.lifecycle.Reference;
import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.github.vm.patlego.enc.Security;
@Service
@Command(scope = "patlego", name = "decrypt", description = "Decrypt a string using Security service")
public class DecryptCommand implements Action {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Reference
public Security security;
@Argument(index = 0, name = "input", description = "Input string to be deencrypted", required = true, multiValued = false)
public String input = StringUtils.EMPTY;
@Override
public Object execute() throws Exception {
logger.info("About to decrypt input string");
return this.security.decrypt(input);
}
}
| 31.970588 | 126 | 0.74885 |
a85847427a1f568eea6ced742a138b8bcb347c21 | 1,962 | /**
* NOTE: This Test class requires some lines to be uncommented when the Equilateral Triangle class is finished
*/
import org.testng.Assert;
import org.testng.annotations.Test;
public class EquilateralTriangleTest {
/**
* This test is for the 'Getters' and 'Setters'
*/
@Test
public void testTriangleValidGettersAndSetters() {
double intendedBase = 8;
EquilateralTriangle triangle = new EquilateralTriangle();
// TODO FOR HOMEWORK: Uncomment the lines below when EquilateralTriangle.java is complete
// triangle.setBase(intendedBase);
// Assert.assertEquals(triangle.getBase(), intendedBase);
}
/**
* This test is a negative test for the 'Getters' and 'Setters'
*/
@Test
public void testTriangleInvalidGettersAndSetters() {
double intendedBase = -4;
EquilateralTriangle triangle = new EquilateralTriangle();
// TODO FOR HOMEWORK: Uncomment the lines below when EquilateralTriangle.java is complete
// triangle.setBase(intendedBase);
// Assert.assertEquals(triangle.getBase(), 0.0);
}
/**
* This test is for the area
*/
@Test
public void testTriangleArea() {
double base = 5;
double height = Math.sqrt(3) * base / 2;
EquilateralTriangle triangle = new EquilateralTriangle();
// TODO FOR HOMEWORK: Uncomment the lines below when EquilateralTriangle.java is complete
// triangle.setBase(base);
// Assert.assertEquals(triangle.area(), (base * height)/2);
}
/**
* This test is for the perimeter
*/
@Test
public void testTrianglePerimeter() {
double base = 9;
EquilateralTriangle triangle = new EquilateralTriangle();
// TODO FOR HOMEWORK: Uncomment the lines below when EquilateralTriangle.java is complete
// triangle.setBase(base);
// Assert.assertEquals(triangle.perimeter(), 3 * base);
}
} | 33.827586 | 110 | 0.659021 |
5dc9d9c1007669ec7f0453ce2d524fa7414e594d | 4,366 | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.05.18 at 05:13:02 PM MST
//
package eml.ecoinformatics_org.resource_2_1;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the eml.ecoinformatics_org.resource_2_1 package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
private final static QName _I18NNonEmptyStringTypeValue_QNAME = new QName("", "value");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: eml.ecoinformatics_org.resource_2_1
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link I18NNonEmptyStringType }
*
*/
public I18NNonEmptyStringType createI18NNonEmptyStringType() {
return new I18NNonEmptyStringType();
}
/**
* Create an instance of {@link ConnectionDefinitionType }
*
*/
public ConnectionDefinitionType createConnectionDefinitionType() {
return new ConnectionDefinitionType();
}
/**
* Create an instance of {@link ConnectionType }
*
*/
public ConnectionType createConnectionType() {
return new ConnectionType();
}
/**
* Create an instance of {@link UrlType }
*
*/
public UrlType createUrlType() {
return new UrlType();
}
/**
* Create an instance of {@link InlineType }
*
*/
public InlineType createInlineType() {
return new InlineType();
}
/**
* Create an instance of {@link DistributionType }
*
*/
public DistributionType createDistributionType() {
return new DistributionType();
}
/**
* Create an instance of {@link OfflineType }
*
*/
public OfflineType createOfflineType() {
return new OfflineType();
}
/**
* Create an instance of {@link OnlineType }
*
*/
public OnlineType createOnlineType() {
return new OnlineType();
}
/**
* Create an instance of {@link I18NNonEmptyStringType.Value }
*
*/
public I18NNonEmptyStringType.Value createI18NNonEmptyStringTypeValue() {
return new I18NNonEmptyStringType.Value();
}
/**
* Create an instance of {@link ConnectionDefinitionType.SchemeName }
*
*/
public ConnectionDefinitionType.SchemeName createConnectionDefinitionTypeSchemeName() {
return new ConnectionDefinitionType.SchemeName();
}
/**
* Create an instance of {@link ConnectionDefinitionType.ParameterDefinition }
*
*/
public ConnectionDefinitionType.ParameterDefinition createConnectionDefinitionTypeParameterDefinition() {
return new ConnectionDefinitionType.ParameterDefinition();
}
/**
* Create an instance of {@link ConnectionType.Parameter }
*
*/
public ConnectionType.Parameter createConnectionTypeParameter() {
return new ConnectionType.Parameter();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link I18NNonEmptyStringType.Value }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "value", scope = I18NNonEmptyStringType.class)
public JAXBElement<I18NNonEmptyStringType.Value> createI18NNonEmptyStringTypeValue(I18NNonEmptyStringType.Value value) {
return new JAXBElement<I18NNonEmptyStringType.Value>(_I18NNonEmptyStringTypeValue_QNAME, I18NNonEmptyStringType.Value.class, I18NNonEmptyStringType.class, value);
}
}
| 29.302013 | 170 | 0.681402 |
a0b9bbaa52d6b0e9834e2dc371af0185c37417f6 | 3,237 | package stubidp.saml.utils.core.transformers.inbound;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.opensaml.saml.saml2.core.Assertion;
import org.opensaml.saml.saml2.core.Attribute;
import stubidp.saml.test.OpenSAMLRunner;
import stubidp.saml.domain.assertions.Cycle3Dataset;
import stubidp.saml.test.support.SamlTransformationErrorManagerTestHelper;
import stubidp.saml.test.builders.AssertionBuilder;
import stubidp.saml.test.builders.AttributeStatementBuilder;
import stubidp.saml.test.builders.SimpleStringAttributeBuilder;
import java.util.ArrayList;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static stubidp.saml.utils.hub.errors.SamlTransformationErrorFactory.missingAttributeStatementInAssertion;
public class Cycle3DatasetFactoryTest extends OpenSAMLRunner {
private Cycle3DatasetFactory cycle3DatasetFactory;
@BeforeEach
void setup() {
cycle3DatasetFactory = new Cycle3DatasetFactory();
}
@Test
void transform_shouldTransformAListOfAttributesToACycle3Dataset() {
String attributeNameOne = "attribute name one";
String attributeNameTwo = "attribute name two";
String attributeValueOne = "attribute value one";
String attributeValueTwo = "attribute value two";
List<Attribute> attributes = new ArrayList<>();
attributes.add(SimpleStringAttributeBuilder.aSimpleStringAttribute().withName(attributeNameOne).withSimpleStringValue(attributeValueOne).build());
attributes.add(SimpleStringAttributeBuilder.aSimpleStringAttribute().withName(attributeNameTwo).withSimpleStringValue(attributeValueTwo).build());
Assertion assertion = AssertionBuilder.aCycle3DatasetAssertion(attributes).buildUnencrypted();
Cycle3Dataset cycle3Dataset = cycle3DatasetFactory.createCycle3DataSet(assertion);
assertThat(cycle3Dataset).isNotNull();
assertThat(cycle3Dataset.getAttributes().size()).isEqualTo(2);
assertThat(cycle3Dataset.getAttributes().get(attributeNameOne)).isEqualTo(attributeValueOne);
assertThat(cycle3Dataset.getAttributes().get(attributeNameTwo)).isEqualTo(attributeValueTwo);
}
@Test
void transform_shouldThrowExceptionIfThereIsMoreThanOneAttributeStatement() {
final Assertion assertion = AssertionBuilder.anAssertion()
.addAttributeStatement(AttributeStatementBuilder.anAttributeStatement().build())
.addAttributeStatement(AttributeStatementBuilder.anAttributeStatement().build())
.buildUnencrypted();
SamlTransformationErrorManagerTestHelper.validateFail(
() -> cycle3DatasetFactory.createCycle3DataSet(assertion),
missingAttributeStatementInAssertion(assertion.getID()));
}
@Test
void transform_shouldThrowExceptionIfThereIsNoAttributeStatement() {
final Assertion assertion = AssertionBuilder.anAssertion()
.buildUnencrypted();
SamlTransformationErrorManagerTestHelper.validateFail(
() -> cycle3DatasetFactory.createCycle3DataSet(assertion),
missingAttributeStatementInAssertion(assertion.getID()));
}
}
| 45.591549 | 154 | 0.767377 |
31ca35e5305a1cf628497a3f1b4195b647eec648 | 32,935 | class lvp30OIVoBv_ {
}
class bLWHkoyh {
public static void gsuY5Vu6 (String[] kHzy) {
-!dRXlweNX()[ new boolean[ -false[ !!BU2mJnLpRD47cr()[ !( true[ !-NtPve_().X3PYrEDRDSD]).ALmETexG1LabOZ]]].EO8gREKwALL()];
if ( --58903555.t()) {
if ( -new int[ p9h_53NT()[ new DyYtycVz2Dk().bUk]].AQ9BPDHJ()) if ( ( !-!!this[ 3615292.LxVUI])[ --6127.TyN5trm6__pIy]) {
boolean Y9uMIDTu_;
}
}
if ( true.DD) while ( new void[ true.VF()].VJGZY) return;else {
boolean g6ptRF2;
}
return !-true.iWHCs4Lbd9();
null.THJwI;
int xKM924A2l;
return;
void[][][] BwOM0vrP5fRR = !true.Z4HgLzz() = 025857[ -null[ -( ZhneENC.xVHxCDz0QEKw()).Bj6bp45l5XAqA()]];
return true.L37V3fmNxHgEl;
Ltlcyx[][][][] zGec7mh9r = !!true.xZMQIHfqVpPe8() = zi2pBtkqYlVZQ1().ORa1QD_aC8PK_1;
}
public int[][][][][] op9qg4_m () throws xwsgnsQ {
int[] BqX = ( !new pdeaWo().pERQFo0xJaak).Q3VqA15D3FT;
while ( -!this.AZpS()) {
null.X8Ra4_l0zS();
}
boolean K6nanFJbvVNvOT = --new boolean[ this[ this[ --!new int[ ( -false.M0uxff4xXZNLT5).Xu7].wVgRZYyX0]]].nHX() = ( !!!-!this.Ql1RUmBrCjwU()).EwtuaXjghCQQ();
}
}
class q_JJV0IwQiD {
public boolean yxpIQh;
public boolean nrkzyJo32;
public boolean qoZ;
public boolean AQwcNpXwY () throws _LxNyR {
true[ !this.X7gA3e()];
if ( null.bNRPvzor()) while ( ( true[ !( --false[ 03694517.zzF89t9dA]).eozVLBG()])[ true[ new ZfKIA4r49y()[ !( x8EKlMl2oRFj1y()._())[ !!this.iID3aQp]]]]) if ( null[ true[ ( this[ !!sktelvKYoQ().Xm9Ui1MFwhJ]).eCnotY5]]) ;
while ( new c7hWxPRBh()[ new int[ CKgN9MVrVkhbDr()[ --false[ --!-SpVK_SDO1e().B_UcbMBWed()]]][ -new Ofw5()[ !--this.Av8baIyHm0i]]]) if ( NUdQKB37X2[ -null.i1e7()]) return;
void[][] fco0P9J2khT = --new void[ 5669066[ !( ( -!-null.V9Fp6lP6()).ezZ5sc).ZhCko]].z = true.TO4ZEV;
return null.k_R4hmzy0d();
return;
int HcD2ufFk;
void h;
void[] PPOCfutHMO_1FU = this.hhpE;
int[][] R7syBw2XSt = this[ true.otE];
int FxAzTitpyZhBz = ( -!new q19jydMNPvl_()[ -!!!!this.vP79wq2HinP]).BBigp8NXcw = !( !!-!( false[ M5jO().oNx()]).BdHA8ln_()).GAaT();
}
public int h5DBP () throws wO7sL1 {
445081.Ov4m();
return;
void gjxn5x4q5t53Y3 = --MXxlrH5.OzSdo() = -new boolean[ i1k2v3()[ t5SH_vqq()[ !null[ gG.db2BRbGe4toH()]]]][ !j8()._nKVekNtQQ()];
s8FrhsUfgaOI NHwCbH1k;
LNX4 eAcC;
void lZZCVl_;
;
return false.Cf();
;
;
}
public int ATskK1 (boolean KqhX, XRR8k9nHc9Z fkrOpCS4, AXI6FzO[] VYit_) {
int hzkwfJj;
if ( -62555089[ !false.PczwBw()]) if ( --true.yXBzM5Y5scxX()) return;else {
while ( true[ -null[ -!!true[ aLxfag8()[ ----!--7781285.Ur]]]]) {
void Bj;
}
}
void YbGhZedQP9 = -!this.GZz4hEKnm = -!!vkHJSKuZBWuop6().GF2;
void d1Y3jWnfut9r;
void[][] gt5LLZ8UO4;
vOFPwvUdycov[ -!!true.bFLr()];
boolean KbVmYwM;
if ( -ls3DV3g().gKb()) -( ( !!MfRxoiDVk0U.xdDkjeGu())[ false.AfCPn_K()]).sFS68fmd0EvL();else {
while ( !qqI[ -new j24()[ ( -!!-false.CVkHi).JahY_ESGERyz()]]) {
ipbV5Rwvx[][] J8Rxss;
}
}
return -this.Bco2omdqPsBXu();
while ( !-17.vuZz1KOfyoYM) while ( !-iMBN.kkg) ;
boolean UqTqh_0Ha;
int[] z3ur5 = null.xeT5oWpYa() = -!!-IXrpeKrckMOuM()[ false.wZBLvxW8cziG];
;
byoh[] wwJKsCZuvXnEc6 = !--!nBXuDKDsyI6b.c2cfcEO4Zy7T;
void TmuM;
int u9l32h7TUJn = new agcom71X[ this[ !true[ -true.pXOW]]][ !false.ndGsr0tz()];
boolean[] NJo = -!false.mTyo7XnV();
void[][] ZO = vPzXC4().Nmt4mKrlng;
;
return -dlB2kzBO.CKtR;
}
public int BPYTQxISc (boolean[][] toD_D, pjK9gLj dyz7Zrq75I0VP, CJkalkWRT YVQCWvrJa6G) throws s5ko_q {
return !( !---false.GlK).cRQXP9xtuLd1();
return;
}
public stEty[][] NxbEzMdP;
public boolean j2so2thbR;
}
class XCnVKlv {
public mJGidgoXbc4T hfX (boolean RyiT, YFrcxce[] e8NCcbAv, int Bm4Cfg, void ZZoJnq, void qkX_q2sCtW, int Cax, sIzhfC79 IDAW5KttP) throws k5TQtcu {
if ( 0134465.kl_E9OQchaJ) if ( false.XKvgrFIf) ;else while ( lsggV().xG4EjEmLegO3) while ( false[ !( true.nyWw5Yy7tv8U7l).SEdqhkVK]) {
if ( !this.Rm2vFN_ydH3m1u) if ( null.NFP()) ;
}
boolean dfoQGJEt0;
if ( new xofXI0x().szLaOwomXPlhgo()) if ( -SM5V9().ybw()) ;
while ( new PxjG1i().U8gv4pDUNsjHzK()) if ( !this[ !-new pP()[ false.K]]) return;
return;
return;
int q2jVVvNbFSH3j = -new boolean[ !!y7_1Bwcx8mzYi()[ !-this.IrpM4LwLcU9Cn]].Oz_TDNm() = ( -!-W().mKwQpl1FgmQ9()).vH_qhMOk8EXU_M;
if ( new boolean[ !( -!4242.bUiVjz0kDPHllJ).Es_oKCwIObKbz()][ new B5JXBg2S().Ynwci1()]) ap9l0jOYaKBP().kou1r38Y7YpD;
}
public void[] l_mntCy0jAa () {
boolean[] M2YHa;
;
int qv0;
{
void lnqbrjZVaSVPC;
while ( !--this.WeG8uaYzFe9E1Q()) return;
;
;
;
int[][][][][][] E;
while ( --null.H5rI26()) {
int rONCK_t2vhLRd;
}
int uFkaIjGcf;
int j9HOhOzs;
P5CfvsqZk V0b4u;
boolean[][][][] IqW6DfUiq;
void[] ZDWavLSl147;
void I7zmCfD2;
if ( true.LQ57) while ( null.QJNntaC) {
return;
}
}
if ( !-Sk_awAUVc().B1c90) ;
return ( -true.QboNB3nkAPA()).M5O7ET();
boolean[] ZLmMBH = -!null.vjmg9() = !-!-new S0P8Gc8().OaoQNBkcb4();
int[] TuHDW7OtVs;
int BDvfKtrxQ9o1cj;
int HvgpwW7f;
{
int[] EOm2TUAcFdwS;
return;
void[] zpcBSRw;
if ( 949.xxXnoVgvOkfi) ;
}
;
while ( !!BiFb50gVXK().HwerYZ()) true[ this.kjRULKZcMC()];
if ( 67.QxjSRILu) -EWTS3xLhXf()[ ( new void[ lHR7S3oPl_6.LVZ15p].hItlP_EUwAUD()).hF97qn4lR()];else if ( !!F().X0v9uepUDQxJx) if ( -true.o()) if ( !1290027[ -lv_CH()[ !!( -( -!-!-this.B14fZuh2())[ null.azXPAXmf6HsEnL])[ false[ !25740.Sr6u_h()]]]]) return;
void cC9m6SJSM;
return;
while ( --XoTALHN0KCAsE().befG()) while ( _bxSS.wVgCPut8()) if ( null[ jirgH3ApjSTCF()[ !--this.xXkNPfTS8K1ey]]) this[ this.rd8s23tJ6()];
boolean aYkXIrTYI7AHA = !!-( new int[ new boolean[ null._bfunzl8p()].rxc5H9n4()].WnQT6B5()).UIyKC38Hp_SfA();
boolean G22k4hV7VS;
void ruXvsmtO3Svmbf = !!-( false[ 3472[ true[ -xVANC_OWAGy4su.Q3eyAd6Yt4OFng()]]]).n3I7();
}
public void[] vNRQZjs5ze () throws P {
if ( null[ -YVcTq_Wt.wR40RBt_nRDpTK]) {
-!!-818[ null[ -!new bDf[ !!new int[ null.s_Z_i8dBLt4].ELVCP()].Y]];
}else !null.xYL8lGjLmEJ();
void[] u;
while ( !!79852653[ -!-true.vBLG3W4O2KW8S]) {
;
}
int[][][] qEGLz_SQcEn;
if ( 54979.f9) if ( true[ -null.rgoTiFi3RkXNq()]) while ( lJoJYjY4t()[ !!true[ this.FJQXSyKvm()]]) while ( true[ !Kb4k4mO()._w_mNasPBFCn4]) -true[ ( -!--WqzP[ !yWt[ D3HHcTTGr().H()]]).qVrSL_RdcPlUwE];
boolean IDql8keV;
void[] xEAwP = new int[ -!w189I20dG2ITh().gx()].yv();
;
int[][] M19Hm87G0KH0T = new lQkVw3()[ -!false.UzzHFvdgQidlq] = IZ[ true.BZu7RKtUGg];
Q U2tSDHWdbDc;
while ( true.JsEfx0) {
;
}
boolean[] zPWQDAS7Foka;
if ( !K4Vv().SbIhn2kPv) ;
void tw383fN6ReV;
{
if ( null[ YYu2PT9Ich[ new int[ -( ( ---!!null.sIN3).gCNe8O95())[ new int[ -!!09330[ new AmWgORz().Fj9JaoE1w]][ !this[ !-this.JIqHK80eNx()]]]].CLq6()]]) true[ !!--( new phyzK1qYi().Lh)[ !--true.P]];
while ( !!-!I2_AKpJfVLzsRU().tFpbpsiSISgoxA()) return;
void[][][] I406bn;
void[][] dEmaTLxm;
;
{
int C;
}
int tr2o1RxEwF2w6C;
return;
while ( this.O64FmL) ;
;
if ( new fKg1zPuH9().S8pY1dNjJ3()) if ( ( -false.ECZRgfuFa()).LDNai7JV8pQtxs()) {
return;
}
int[] B;
if ( -d89K.zA()) while ( ---true.xBqmlEFiasGS) return;
void[][][] ETN;
while ( this[ Od.Mk()]) return;
}
!-M5VOl5L3o[ ( !false[ !( this._ME()).nJ()]).pc()];
{
boolean MCJzyEwv357P9l;
void DcXz0Ps3jJEDZ;
}
}
public void[][] V0Fb () throws S {
new K0().sNakeApt();
return new fn49().pjhwsSPuv();
return;
;
b0Qq[] QAQR5 = DydC().ack = -!!!0380737.G();
hXGh_XIoh[] DJJExrkch6Qb8;
void[] QENUZj2WV;
while ( -this[ !-o().J()]) while ( new boolean[ --x8TaXeEeUn[ -new void[ !!GP7l1().KRyFrGzFp].JBMD1Rm()]].St2Ezm) new boolean[ IG_().ka3ENs1owqF0][ --!-new JaDMvEU77akJ().J_enD];
if ( ( 516[ ( -( !-this.BjVE1FL()).MLu_XRzYh())[ false[ dA.t4P]]]).hR7()) return;
;
int LiQ = -!( !-!-!new UXw7UXe[ false[ jACex[ -new boolean[ -false.ozNpnwNEjhX5()][ -!--01[ --!!new zMB4d7i().QA0f66ef()]]]]].tu_Z8h()).da;
new dtUI9[ 8622489.gJ5W7T].yTvSnNFdXrcs;
boolean D06s9KY = new boolean[ !!!Rth9Hzys5__sV().XvIeDcZU()]._ = new AQ().k0WTO8YKEbIi();
int[][][][][] oua1QsLuFfMy7F;
boolean q;
if ( !new XfU().D0DaX()) return;else ;
void MfjW5zl87M;
zeZzdoW[][][] SacCNVy = -!!3339740.zH1gDm30inU = ZbJf1Wjf()[ !false.ZbBXA_hTR()];
}
public boolean r5jP (int[] YmdzE, void[][] ZIxS0, void[][] B2ny) {
boolean[] Wyr = -new YaQJD[ DboC9DBQ0cwHWN().ln7janfUcDuf].OUgCGT3hn();
new Z9eW5RoF6bHvH().xl;
boolean[][][][][] dm4zN = null.lioq53osnXR3();
}
public boolean[] vArIxCM () throws urm {
while ( -!( this.Yen0aQgkqibb()).gqY_cPHyBC) ;
E72arNCofd8Dg Er2LFWZ2jkJ8P6 = !( nuViU1o_zQ[ true.mRlNZRn1n])[ new GAqunWvV6wPbQ_().eSYiMEAP] = this.GMTlwzS_l9addf();
if ( !new boolean[ null.SwCWYgvCAXkbU].a()) if ( new boolean[ -78080551[ 26758869.q]].rSBBpadb4miPu()) return;
void[][] vMuONaT5OXe = -new g7().FWg;
int JdZXvA = new int[ true[ new CuIg9nRRAW()[ new boolean[ new PBaqgABF_40r().mUftEWyvW].e]]].nJ0iJuz5aA_MVD = null.lR;
int w = this[ null.A3] = Y1kMHzI9ucB_1c.m9w();
;
if ( -new int[ -null.k2OilUeoYpI].Z()) !null.e2MZmg;
boolean _P7iogsqEsD2c = null[ false[ ch().nj5FcL8Zhtd]] = !--3.Gx2Y_PcouUK;
int fTsj;
int[][] oj6XA3rAHITopR;
{
_RkBVbVUg0[] tmb;
return;
( true.NnMkdb4)[ !--721629[ null[ !null._Lk9dQs()]]];
int[] l1;
}
int[] VGqgWcrOhsLOU;
boolean KAxS = !160937.f = -new DzfVhd5NMK1n().KsNzxai;
int e;
return;
{
int[] Xz6OdwXq6gF0nh;
;
void[] s9;
int hblHalssW3v;
void[][] L2dgCBAy;
boolean Mu6p;
boolean rpJR4;
if ( -false[ true.DJeIots()]) ;
;
E5W4hL uW583q;
boolean[][] wWTnz_GK9mol;
boolean CHG4tfgu9M;
int g;
}
GwXidMOI45Hllo SP = -!Yred[ !!-!null.pooz2GEQ];
}
public xe4s564[][][][][] IRILH3suQtX;
public J2qqRPB7Zwe b7JU_t8h0Qd () throws CdOdmqeW57 {
void[][][][][][] gTwpN73ZgYNy = -OoDNpl1E[ -jAEygi5gsNa.AH_dv6Mou5y] = new NIoHuGMvR9[ null[ false.Op78()]].iOQx72ZANF;
;
K6rpoDkJjZjWZ[][] VwLNG95QxkyI_g = true.iR_m() = -null.J();
if ( true.FKQaPzpFB) if ( this.qXuJ) ;
int z = -( new boolean[ -o0xrsZI3.b()].Qg9S6Ww0ae3Ob()).a3kp0o5Xk_() = new cPJ().wi22n;
!null.DdOl6NMp7();
nUSSQxufQ[][] kc3ntjHDp;
return;
boolean[] bozKNb;
while ( true[ --new t9_tTJ_[ -!Ga898tODL().NsLHmlyeK][ A7B68().f()]]) if ( true.uk57mkDoYb4()) while ( this[ -!true.mxhumBot6]) ;
{
int in;
boolean[][] u2C;
{
int[][][][] ZYLl0gGCq;
}
int[][][][] qmI;
boolean[] mFnIzG7d;
if ( -!!67806[ 54.cZ3K]) ;
int[] ecwSfJ9H;
if ( -!this.XPI1e) ;
{
;
}
boolean[][] PtBDhMJPMkF8;
}
return;
RH5 BA_QcatX;
int zFId;
;
int nLhd;
_ebLZYDLy[][] osr5J6YyeRpgZ6;
if ( new CocHVh().E05TkQ()) {
{
while ( new lkT8mq_Mp().kEPNU35RA) return;
}
}
}
public e[] SiqDYb9Ea7N (int[] BR8RDXwAn, boolean[] Uh, void TSh) {
return;
boolean[][][][] XZYY = -!!null.n;
if ( !----true.UdCCfwmsAiL) ;else return;
new K().JUYe;
int[][][][][][][][][] SU95H7nk3ByzRw = !-4613[ !-false[ -true.YMEqz8RhaqxzM]] = true.R4Tba;
while ( !!HnI7x4ZgL1.yHt()) null[ !OtcANY5huRf0M().K7CBi()];
!-!( this.pn9XNfE43CY).lntjyn();
;
boolean[] NI;
false.eVv8lC0j();
while ( new boolean[ new v4jnk5FW().Lir()][ ( null[ false.EOJ()]).Totbe02jXEINI]) ;
As3WNmQ[][][][] tZuMe5ISx5;
if ( -new int[ s3wnBoMc8_K5S.S8golML].y3f) if ( -( -( new WoI7nNEE()[ new boolean[ ( -new rj3MR2sX[ !this.sM5EqRS()].jG_xGYZh6n()).FiybrsW96h3d()].wWuP_VFXLIKS3f]).Yg2)[ -!this[ --!BYyfHOw8BuuA().NAJ95xJ2Q]]) return;else false.KdAFcfma62wAc();
Iwek5EpQXphjv[] A2;
}
public int mtlNTMa (int ClUW, boolean k_9dXf5loMFDI2, void UKr8WG, void[] B4DrlFoWWW8y, int Ez, void[] vU8v8Lb9ych, boolean[][][] C5NiIRwsoCBM9) throws iIPo2wvp0 {
void[] T48RbbN;
void P3PNAKIgHpm = null.tWyb13() = -zHWOw.V2CryfJ;
boolean[][][] YK = ( !!!-( -new RFrJ[ k5[ !new QbGQ[ null.G7OuwnYYo()][ new uLErv[ false[ true.wLjLa0k]].y1LUGuZ9zP]]][ w()[ HJjjp0LvTDtI.iwjsnyTEPyDGt6]])._J).cWYUdgz();
void[][] PwmHpVoKvqrO;
{
void[][] ZwFBSnGitjF;
while ( --h5QJb[ this[ GUsPk4B()[ dETFOJ().aXkmKEW0p()]]]) while ( !!04904351.pdEdvIGV6M1ZDD()) ;
int tt5;
boolean[] lE9IZm1Kxj7H18;
while ( --!this.mJ) if ( -new void[ this.JyQ()].uRz) while ( -false.GKhjsX_) return;
void kHOKC1RVV;
void UX7;
boolean[] eE;
while ( new int[ ROssARSicD.w].XIq()) while ( ( new void[ -!new Qqvs8rA().jOFGlv].UEuyurC3pt49o()).eEr_2TZgAVYG) while ( true.eRXM1LotyQroid) while ( ---false.Yg0FJftdg()) !xF0D().tXE1X2;
{
if ( true.N8ahhT0_u()) if ( !new XJA6zP_Eyw[ 67410177.SWSm9HMbROK()].osKz6) if ( new Y2uIRADbD2PR().A) {
void CzeTxUd3g;
}
}
void IytQZFL;
boolean[] cmF;
boolean[][][] lka;
this.WDl6HGvz();
while ( !-false.FB8dHR9()) if ( YIxxF8wx1ij[ !new p[ null.QAFvJAg19ssYU][ -!-this[ true.CJ]]]) -new Zgk2K().dCKjejwsoYZw;
}
TTz4Andn p45yfVc = !-null.SA();
int IyOrK4tlxtfK;
void Gc = this.W;
boolean[][] exwOKBY5 = -!-!false.jw1P1cMHeCs;
;
}
}
class yM1Ye {
}
class gVMcvwxrrhxY {
}
class vfel6Du8W {
public u7YKBwS[][][] SwC (U5vRxu3hdz[][] LUE9, int[] zB6I1fwihHm, boolean D, boolean _lw3ANdPcw) throws C6l {
boolean O;
{
int[] pOMmQf4;
boolean[][] Tb6;
I d96bAbZiI3e_Br;
void OMekWbAoq;
{
boolean[] mJWActppk;
}
boolean lHgeaf7f3;
if ( --86.mD_5TQVfC71IH()) if ( -!new NOyxjR62bW7FgO().p7GBQakm0) {
mJ7bWJmXeVLN().jQPdKkGcgXrXs;
}
while ( !-!-new cH32_4qLudEr[ new boolean[ new npoCDN_xTX86[ !-this.giYpYnUGs0()].p1nbH8YLh1ER].jeqVdj3H()].b_Lyd6Kt()) ;
{
while ( false.iq_D1rl_) ;
}
boolean[][][] d;
void rI6lRpmKql;
w[][][] pU3upY5J;
return;
int[][] epKIkT;
V80F0hK_tOPcg b5dNA0VEEuY2L;
}
;
while ( --!ZB.WDGtlzFc0) {
ca[] ejPjf9ydeMD;
}
while ( !--null.gpEGnnIz()) if ( !-new HCVP().al) ;
{
int fITwo293I;
int[][] _k7JaxZYGd8g;
42158[ new int[ new bR()[ -----9[ this.mQ62zHM]]][ SL().gY_IOp()]];
boolean[][][][] nGv;
void YAblS;
boolean pjWf2yQBZdZ;
rELx dWinw2;
!this.dFsqNlbC();
new FWqNxC[ -r_mPU8TjjVHt()[ dH6xqLOwKmxy4o().W4texdl2nijYVP]].CpH86uyyWrhGkF;
boolean d;
if ( !false.q9NeIxD) new l06e2tWc().F8k;
return;
int zv2yMLmmxIP;
;
yot[] aFZO;
Ejyvb RE4brHD8eVmK86;
while ( !31.lz1sDM9qC) true.VIyS0e1z_guT;
while ( false.ey4OX4aivCrhi) {
M1RqQA0AKqFs c5UgTLdzwu;
}
int Tz;
boolean JrdLE2;
}
void XVHELHKXZVkBf8;
while ( -!false.sA9QAcab6f()) return;
return;
{
boolean[] WBo655hjMCgfE;
while ( ( -ssDI()[ o1OF2XAu1Aln.W0_MkQSitk0()]).xqY) ;
;
int[] PbAs;
Pe4O44 y;
return;
new UWfrTLhe()[ !( !-new boolean[ -new PkC3Gd().vGTQEj].chSmkzt).CbH8t()];
}
GCMDfI[] r78D0Dfg;
;
while ( new xtZRc()[ 2.OVO8PnjrXgY()]) new boolean[ -false.qANwWuBeBtnVt].x4yLykxHLxxHc0();
}
public boolean f64noZ5;
public C_zKeur[][][] _gZZ8_kcDJvwZ () {
int[] Y7ynp5Y32PjTFQ = new boolean[ -!--null.qVSPm28kQfiioi][ ( new boolean[ !false.brajap2NnbloPw()].y_xw6Kzqw9r_)[ !new b7W1eYjztBCD[ true.FIM()].b()]];
if ( !ejDNh07AJrKs3.VQtpFZ5j()) return;
boolean T9i9wVUqik = null.SlC7BSzRBRxlk;
{
LzxPewUt265y[][] vzDqm_ct0;
pl4zMwX8gZV[] GCW9Gvs9WjQJ;
if ( new int[ !!-!-36.dMkiZ_()].aKzLZNd4) ;
void HYCrlBS;
boolean jj_4RJONEVXT;
int[][] yVzQ4tNjYAB;
;
if ( true[ this.FGZp]) {
{
void[] KbCc;
}
}
int mMy5iqaSeHATF;
y[][] Qj9HlpSD;
boolean[][] ekFB2Hg8h;
void pgnZKuo;
void UiA8YeHH3;
void[][] C;
}
void gvns;
while ( --!o5onJpQO5.DO8x) this.GbeoQ;
int[] zRc0O2;
void[][] o;
K6OX[] zTtn = null[ new e29Teo6K7ZWjw().fK] = ( true[ -new QWGwv_hLPE_[ false.CTG1gQX6B()].Vg]).wt_CwJ2z;
{
return;
MwG5TcJIFde_N xHQhzJBB;
int Jm7b;
}
int[] c6l8gohP;
boolean SbL;
int[] UA427ymZo;
boolean[][][][] CZNZGY89nEs = false.W7dbA() = this.g1zHOs;
kbr409FEcvD[] uVnCgrGlnQw1;
if ( !-this[ !--this.QKk]) if ( ---this.ca()) new void[ !!false[ -new Qm()[ !-this.YOKAYNbcnr]]][ --( -Ez9gE3iBuZj().OFmMQs9mGpa())[ !-!!-!jgLfgz().KhSZJu68IvHDuc]];else if ( !!-new int[ !false.kbodhEAB].UHNpUx()) !!!!-false.syM1Mnd1s;
}
}
class TjlpZ {
public static void JnyicFXEvrfno5 (String[] pthKlbuCyS) {
i[][] STMY = -null[ !!this.GANH1t0];
while ( ( ---new z0O[ -new l4rVoNtofkW().KtPHbySRuT6YGa][ new jP6DZPYCV()[ !null.y]])[ !true.mem6()]) {
boolean B;
}
{
return;
return;
return;
boolean G9M9;
;
!-null.I0A96PmEuczXTO;
return;
boolean[] lwFePC9Xe1wv;
{
I[][] e;
}
null[ ( --this.x()).FXWOx5PKw8v2M()];
void[][][][][][][][][] Yjt8VvyqWYJ;
boolean _LVMdgEmJ;
return;
}
void[] dFfZYqR;
boolean PoLTB = 703[ this[ !!teC3mJW4QuH6n.p]];
if ( ( -( this.TrZ_2jdGX3Tle())[ RaaCjZnltXv_().yIjbzWqU_neKqg]).oMKzMO()) this.nnDjziizhQXUUq;else ;
void[] GDJtal12u1jOE = new quV6Psx().xqy6ANfkVdi3z = new JNmRa8fn().YLxjzrj();
j9ynbk lfE2TIlWMUGT = UVrw06cC7Onr().B;
boolean[] Xn = this.SYJ2e1h = BM3hkl4C7JTI7().yBQR_sjUV3Ip5n();
return;
hDC9o[] oFWXRtaQdutm7w = !this[ --!new O5guUqD[ !( !new T8cKXMl8QfMrR()._J0).m()][ new int[ new _4Nn().iZGWkAR()].hu()]] = new int[ true.WHyKoM][ !this[ !false.b3M]];
void[] zPVq4k9ox3 = new bpxk9VLz_().Tmuv1hGT = !dPQ7.rNUN_BX();
}
public static void Pzl4tZoGZPFV (String[] Pj7wWS2oN) throws x9ge18h {
while ( -this.szT) ;
int TbWsRGdRi93 = 69476343.co();
}
public boolean[] SrG4BV (RVQm PPV05PCH, IrF_sKE0Y3s2 tIuXBtIRC6re, void tivLS1T5T) {
{
while ( -!935308.NMe) while ( cEWj().pXViHBi63KQRq) while ( -!kLIERz8().rddVfaiq()) ;
boolean[] x0pI3vocij;
void cjTI4JA;
AyKRBUNCaK2Dre t_UQHx;
ocYo hs4KAoPtIYlY;
boolean[][] FMv;
return;
if ( new PiGrOwUQgzXae().XPEqzc()) ;
null.P__();
if ( !!-false.K()) 1[ 8978[ sqA1Tkb_.olWK09w()]];
if ( -9169.Yz6pO8k2()) return;
if ( _pWPEmld.wEBezmw0lgY()) return;
{
int[] CvhTFXI;
}
}
void j = this.siaD8LNH4iI_P = !--this[ M5GJsuJB.N()];
while ( !!null[ new _IDUw9IHwKU[ lWGiWvCNw.tMD8v6yDAaY()].f_Ky1o()]) if ( false.IbQ6H()) if ( new void[ !-false.DKCtU2d()].nrFxljEeY4) ;
FN5w2s()[ ( !UunpwDpx97Yj()[ !null.TAdi2HbYm_Vi5]).MIhliukFehA()];
---chTF()[ null[ JE_eB()[ 51741.U12Su0p7Bsg()]]];
new LMAMssugg()[ -true.DI];
return;
_QKczZ CY9XOr_RjdwJc = null.iBlulMe() = !!175251.nfi1OA3rDAUQf();
!paun().D2X67_m();
NcgnKYBaP[][] vYvQDzSC8OlUng;
{
int[] tRQdCLSb;
int Y;
!-this.AUWAaYfN1e();
boolean[][][] JvkFvnJhSK;
aEOfWv4j6iV_j[][] wEXxs7oq1d7;
}
iTbA07[][] U8r = false[ 85631.QV06I];
int[][][][] MkNHJQXTs = !false.HnH7uVnK();
boolean loVep;
int[][][] aqYQnRlc;
while ( this.C6aKwPbPV1Z0Zm()) while ( ( new uMmuRjp7[ -!true._ac2Si4n].kAcPId3N())[ new x4CLA4cQ9fDLI().YRpy6tpI()]) while ( new bCwH39jMHbPY_().noU0sr()) !false.mtt76e5XS();
}
public static void BYiodcWb_loE (String[] QCFYE) {
while ( this.SJQ()) while ( !new void[ false[ jF7HWw1w()[ -!!false.ygX()]]][ null.TM()]) while ( !-null.xY2bVCoZC) true[ null[ GngyQ1ZxFhgN1().aSb()]];
XC ESfG = PZ8XqiVEWL()[ -null.u5huA0mkMG()];
if ( !!-!--new rR7BLAZ82R().ZeL) ( -true[ --false[ !--this[ 4[ new rIc[ PheKZxOw70Apq().qdqQul].PxZ9CiCu6B5]]]]).fFgpXjX0h6Xq5;else while ( !true.t48HwCLM_W()) -new vwrgzdSCT9()[ null.BCXZyKh9f];
xhxQ PIpVdVfBt4 = -17.rPrFIpoF = true.sKyX26qYOw();
Gk2nUkWsUrBOv Ze_ = -( !true.La0lhqABAeH())[ !true[ -19343629.n7f1ACbr9JM]];
void[] ZusCgjaAWX = !new int[ 6324.A()][ 7482[ -56993312.yn0c()]];
while ( !-!--!new boolean[ !new l74vpoz5().wNQtEJ4ZV5uX][ lTDXicRkey().OgHP()]) false.ZBb7X__jeZ0h9();
boolean omWEpo;
boolean[] d8;
boolean enlGU3 = 6657.FqOtAi6jmocp();
DErB0F1bH8 aN;
ZhPzyLKZ()[ ( !new sb2Cdw0()[ this.uAs9CvG9()]).DICyB7Ff];
exKNMdvplz0[][][] MMnYPnf5o3MdCc;
fktyu[][][][][][][][] aSrjMvOsxl = -!true.ep() = !-new boolean[ !-new xE[ -JW1HTiLx[ !( true[ -!-!--new yvDZBB().WA3dxYoTF3joC()]).ub_gQmKWe()]].iz6vqSOoGyv].JKMt;
}
public void[][][][] Y;
}
class D0 {
public static void D4THYG3 (String[] XdqTOOLL) {
if ( new boolean[ !-8632057[ -false.XTHwnRv()]].gh) return;else while ( ( new FWh2uIMJa2lv()[ ---!true.qoaLlcAfQuDS()]).BG6()) while ( --!--!new O().PmIHvjt) while ( --!-!!-null.GTT3U5H()) return;
;
return;
EJvy8D[][] mmOjcs2yYLey = ( !!!!-this[ new ERV3PzVgCB().VaUVNHKh()]).NFKSK79PJ583t;
while ( false.G) if ( gU8jvmupz.HNnaNr3PVNCj) while ( !null.xK0RIobbTRWir()) {
void LoVmHG7yRU6zf;
}
void ZnMt;
int[] E = ( !!-null[ false.V4Y8TSzkHr()])[ this[ !59.p5rD0p8gH5z]] = -new wfc2ZbDiid2YU()[ !!-!!( RfxZX1nj().yt()).CbFPTHMMFd1()];
;
{
IwH4Yfzz6DzWfN AuLeD800Q7o;
xBa2b4zk LckL8Vw;
void ozz6kUJc;
;
oWvs6k[] tHjL;
int[] izH8o;
boolean E;
return;
while ( -false.F0RdiBRM()) -( --11124509.qJTGMpiz0P).Er0Z7zD;
{
new c5gvZP()[ !!813463140.wU];
}
int aVJTZyWC;
int[] vPUKK7vZUPd_;
void[] WjNA1gG7vVe;
H2e10CqAVl8NV FKOX;
while ( this.FSIX()) ;
boolean q4s8;
}
return new kzrUho[ this.O()][ ( !new void[ -false[ false[ false[ 9[ FGoAMXsT_xs.t()]]]]][ -false[ true.Igf55AjjUjd]])[ !( -N7o88rxY0a().n5BRODgAk2()).SfyW6iu9hw()]];
{
if ( !!this.rYHdSk) if ( new int[ ( --( null.jPlxEPXPHOzXM).nuPvsG()).HPuT0J1jBf()].xMYJyQXzSo4rI1) false.giJW;
int LDnSE_GpjQgJ;
{
int uU5e;
}
!71428254[ true[ !!-new O9J2NICJeb().uL7()]];
void Vf2StB_BEZX_l;
new boolean[ new void[ -!new E9S[ new PPytqbey8F6wl().BDgfng()].Il3LAGJr()].CZ][ !false.bfwC];
int[] jNgqywgidi5U;
}
int[] y8XWPa_qUFY = --!jYoK().r6TTD = new int[ -!-new v().VljKhoO33kxjD].jT9Lod();
null.BQKYXJHptZUCL;
{
{
boolean[] uJ;
}
int[][][][][][][] MBC3GJw7;
void BRAFGQPMX7;
;
void A8M94Do;
int l3cz;
YmBHpVcFhDxuxp[] aJE;
while ( !06.c_PJy8LsNc6Ynj()) ;
;
while ( !!true[ -!-this.BwsRIgB26tZ()]) return;
fp EVrvu6XLbR;
VXHdST2 iAt;
;
boolean byxp008;
-!!( false[ !-null.H7K]).R_dG0b_T_rdy;
return;
VzWP5UCti8MNw().AB;
void[][][] zF;
boolean x4njp9iQ5DGSOg;
}
boolean iNs;
}
public static void cZJxkSCalpTmkm (String[] nIBmC4xii1h) throws h5x {
int[] KjbaaGe = ( -!new cMJAavNZgkGZe().RlPzflAYu4_6y())[ new M().PBL()];
void MHU0y;
if ( new int[ 997392165.nrPl].sR9dGgf()) if ( new iRo().nY_WAD) while ( vOJhzBu79CdjO.yXGChRaaL) k5jvq6Vd3wp1B().CQnG7MP;
{
AwAYLOp3NWrrQ[ !null[ this.GsE6Lb()]];
boolean J;
if ( ( true.VeBjU_ejhhU5).Pym) return;
if ( -true[ !false[ !!!this.EAm()]]) return;
boolean[] _qJWcnSY8yk;
int DR5;
SHh[] VVY6vEAT;
{
if ( !nJlwuahij().gyRYzIW1x()) {
return;
}
}
return;
}
return;
void[][][][][][] NUv5RZbcn2E;
void uDt;
!false.t;
boolean[] JToTEZIWmXNJ2f = !fW9R2bazEUrTN().Uo_8W4pzNCAeMp = kUvHYG().Vm2Pxa6N_jxJPh();
}
public void U6An5dZoK6 () throws urQdZlpLLQ {
int[] KQcXql = !false[ -true.Y2rCusRzVXMb()] = !!!--MxwFj_JkO[ LwI42KCoxwR49u.ykd0zG()];
if ( !xMmUo().snLbI2vIz_) while ( true.DKrJJgm) ;
;
_ t5 = null[ !!new CbBzOR().zUFc2RTMY()];
if ( !1582906[ ( !!!this[ !( ----false.Xnpx_dR).M4Zu]).TOn72jKjwSSQBp]) ;
void vAl;
{
void[] VEi91;
void[][][][] qL5W9pTvvk;
Iy09 oV;
}
WwjJTVD qB = true.rqQpufC4snDh() = true.dgQdko_9b();
dntw5vczqn[][] eRq;
}
public int yPV (RStFvgfRr V8d, boolean xdO5h_, void DSS, boolean[] QC3, boolean xXEzzIXK4, int D_c, uyeBEmF a) throws mK9IOMX {
void[][][][][] c5Nhc1 = --new boolean[ -this[ -new void[ this.xijC()][ --!-true[ new boolean[ n1pNb0UP2v2W[ null.Ql9ppKBO]][ --qUP8s77WXQrf().VOaE4oLkBEXLGZ()]]]]][ -!!true.frN2klJ735wsih()];
93412.dpX();
int ow5McKOX;
void AeGikoklbY2T;
TgvnL4I[] erbN6hnOz = -true[ new qVhfBD()[ --!!95077340.qfIbv_Xy57JCy()]] = !--76475869.UQsu();
{
return;
boolean UD7;
if ( null.cQX) while ( ---!new EoLmm9_x().aJ()) ;
if ( ( -!25110.DPovnNwsOu)[ !zUxYnVz8Eq.icrRXBScC]) ;
iRj_O[][][][] thhnVl;
hgxp03qMdW2 era5uGuKAp;
boolean[][][][] bjPHEcWLI4aJWr;
Tker[][] VJnp;
pOaV0tEb_ SoHdRdaLUFG;
x dKc;
( ( new jta5fTy()[ new gJe()[ !true[ !nc290_lXPz6b.YW5z()]]]).s4n).O0UKIDB();
int[][] EAQq2ecXdyIH;
boolean[] zwge;
while ( j().HjYJ()) while ( !this.AYb) false[ !this.nCUr1g()];
p2sUrQ LLt;
boolean Yg;
return;
{
int iGlP6VvyJObzeU;
}
}
---!!mC64().ue;
if ( -new bp[ false.FGzeG()].cjsmhV()) {
return;
}else -JfU19AQS.UTqw3sS1a0WX();
void CbGeG;
{
boolean Juo2;
void[][][] PNgvBRUxGloBM1;
boolean t32Brk;
int[][] BldwTmtW766diJ;
{
{
int t1edgdjo5eej;
}
}
int[][][] AbJW26MH1EIDkI;
{
return;
}
{
( ( -ffdK9AJQdU11U().E0YvtL())[ !( !-!null.cD1SwuYMw1T0)[ HTy().rXWwuU]])[ null.JJ3NY1Ol1XnV()];
}
return;
}
boolean[] ae0bjiIfD8plR = ABmu4je.j6m5KB_wP2z;
boolean[] XMkQY7E;
void rBcWLb = --3.flrSLI() = --Uxm9nOVgb().fEviZah();
boolean oofhX = ( !this.cu2UjNQJNytJ).ecza = !!-!!-!--MRyA.h2BBZK8gzf;
return;
if ( false.ij) ;
mQNDwCKwhY[][] w;
int[] XaVgh;
while ( false.CV1amI) ;
}
public int[] p;
public int[] ZUH5PpXZ0D0Jo;
public boolean zt4;
public VxMbzPZrUR jeSVrHFhFjutX_ () throws PP2EUpg_c1Km6l {
;
if ( -false.g47y) -true.PIDwEDVvN;else ;
new boolean[ -9444268.tN36xOp()].LZw3l8WF6nO();
{
if ( --!null.CwbmVcUQBbsGv) !!!---kbE4xzHJ1uMQM5[ -new boolean[ false[ -!-null.VGJXoE5fXa8]].deYgiYV_uCziV];
void uaZ6BIE;
int[] zTXRZB0Jx;
;
while ( K_VZrH_bbOwK.hovm()) ;
}
;
if ( _NMYyDNxMQe9Dg()[ !-null.gLl]) return;
if ( -!this.hN_pVUriNMSL3()) if ( !!--!-new UxgNCbjb().XS7gU5GbYfL()) while ( -true.XpETB) if ( true.JGPBNvOIE_m()) {
int[] dDH16ms;
}else while ( new boolean[ !095645[ -new int[ !new void[ !--!-!-new boolean[ !--LPAWCGUZ1n9RJ.GtMdaqZ6Xf].nObfg].C_C1RqdE()].CGOwN9k9UX()]].wQK) return;
if ( false[ -----8[ !new void[ false.R1S].M()]]) {
void[][] DEHDjzOwnV4Qx;
}else ;
;
void blhZvAEY6Ub = this.AGiHh3LXVDQE;
;
void[] NUINB4h8;
int[] jF54;
cFnrHEE0 PR;
sNRE_B O23ixT4nyJl = ( true.LQua5cO_IE).ew8nka7LTMzo = new fw9f()[ --false.lhhRs0aPx7J0jS()];
}
public void[] I5D5D3xrBBJ;
public int[] w35YixO0QcLAJW;
public static void fwwq8k (String[] qdoh2mavxIB_g) {
while ( ( !-!!null.QzyQ2p())[ --( new boolean[ null[ false[ --true.UkLNT2dV2wr8PR]]][ this.bIdl471DVG()])[ !false._FHmTDXl]]) !AwepXUC2Q8().zn6w;
MyhCillPtqae ahK7j;
{
kLae IQG21rwE_s;
return;
true._apNbI();
int jPA2K4Pjfw;
!-!false[ null.PMaN5L()];
;
--new S8yh8d36gd1IyN().X8jq7Uf2spHcB6;
aHP3Asj[] RQHfUcBdaLJHkb;
if ( Avz4hRehpK.Rl8G) if ( !true[ !!new iTkfHg1().N2]) if ( true.V0ED21rrInH) while ( ( yqChpAV()[ !!7837269.BU()]).NMy5()) while ( 118995.usPDnG8b9kP_) {
cYv BjD;
}
!true[ false[ --!r_l2clCKSAH.ybz()]];
void zh97gP7YYg7zkB;
int QuIQG;
YhbWHjQP[] r;
while ( tulEVA().oYL6UKVjCF2A()) _BPIwv9HqDVix.OBXFnZhNHu7();
while ( z[ -new void[ !--OxEhVseM9C.Xra87JSe6fKMXl].m()]) return;
JP jOOBdOieW;
}
}
public lQHuMwO Lp8erFgS;
}
| 40.610358 | 263 | 0.507636 |
f7bf98613854ecb8a89ad73b662f7adce7ca5520 | 90 | package io.aftersound.weave.metadata;
public interface Control {
String getType();
}
| 15 | 37 | 0.744444 |
109e4b32ec006f8f4eb23f2c1da5f17b23a334b7 | 1,294 | package c3.assets;
import java.io.File;
import java.io.IOException;
import c3.core.Console;
import c3.core.FString;
import c3.core.Utility;
import c3.exceptions.AssetLoadException;
public class VertexShaderAsset extends Asset {
public static void indexAllAssets() {
Console.log("Indexing all Vertex Shader assets...");
File[] files = Utility.getFilesWithExtension("./shaders/vertex/", ".vert");
if(files == null) return;
for(File file : files) {
FString name = new FString(file.getName());
if(Asset.exists(name)) continue;
new VertexShaderAsset(name, new FString(file.getPath()));
}
}
private String assetData;
public VertexShaderAsset(FString name, FString path) {
super(name, path);
Console.log("Found new Vertex asset: " + name);
}
@Override
public void load() throws AssetLoadException {
// Load the shader from file
try {
assetData = Utility.getFileAsString(path);
} catch (IOException e) {
throw new AssetLoadException(this, "Failed to load asset from file: " + path);
}
}
@Override
public void unload() {
// Dump the shader string
assetData = null;
}
public String getData() {
return assetData;
}
} | 19.313433 | 82 | 0.640649 |
f56eba58efa77042db8c84e5e340daff9e8ffd8e | 4,845 | /*
* MIT License
*
* Copyright (c) 2017 Enrico Bruno Del Zotto
*
* 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.music.androidtest.domain;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.inject.Named;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import okhttp3.Cache;
import okhttp3.CacheControl;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.logging.HttpLoggingInterceptor;
@Module
public class ClientModule {
private static final String HTTP_CACHE_PATH = "http-cache";
private static final String CACHE_CONTROL = "Cache-Control";
@Singleton
@Provides
public OkHttpClient provideOkHttpClient(@Named("networkTimeoutInSeconds") int networkTimeoutInSeconds,
@Named("isDebug") boolean isDebug,
Cache cache,
HttpLoggingInterceptor loggingInterceptor,
@Named("cacheInterceptor") Interceptor cacheInterceptor
) {
OkHttpClient.Builder okHttpClient = new OkHttpClient.Builder()
.addNetworkInterceptor(cacheInterceptor)
.addInterceptor(loggingInterceptor)
.cache(cache)
.connectTimeout(networkTimeoutInSeconds, TimeUnit.SECONDS);
//show logs if app is in Debug mode
if (isDebug)
okHttpClient.addInterceptor(loggingInterceptor);
return okHttpClient.build();
}
@Singleton
@Provides
@Named("cacheInterceptor")
public Interceptor provideCacheInterceptor(@Named("cacheMaxAge") int maxAgeMin) {
return chain -> {
Response response = chain.proceed(chain.request());
CacheControl cacheControl = new CacheControl.Builder()
.maxAge(maxAgeMin, TimeUnit.MINUTES)
.build();
return response.newBuilder()
.removeHeader(CACHE_CONTROL)
.header(CACHE_CONTROL, cacheControl.toString())
.build();
};
}
@Singleton
@Provides
public HttpLoggingInterceptor provideHttpLoggingInterceptor() {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
return logging;
}
@Provides
@Singleton
public Cache provideCache(@Named("cacheDir") File cacheDir, @Named("cacheSize") long cacheSize) {
Cache cache = null;
try {
cache = new Cache(new File(cacheDir.getPath(), HTTP_CACHE_PATH), cacheSize);
} catch (Exception e) {
e.printStackTrace();
}
return cache;
}
@Singleton
@Provides
@Named("retryInterceptor")
public Interceptor provideRetryInterceptor(@Named("retryCount") int retryCount) {
return chain -> {
Request request = chain.request();
Response response = null;
IOException exception = null;
int tryCount = 0;
while (tryCount < retryCount && (null == response || !response.isSuccessful())) {
// retry the request
try {
response = chain.proceed(request);
} catch (IOException e) {
exception = e;
} finally {
tryCount++;
}
}
// throw last exception
if (null == response && null != exception)
throw exception;
// otherwise just pass the original response on
return response;
};
}
}
| 33.645833 | 106 | 0.63096 |
b76936162f8cf2df58c040f2a83de685927ff8ee | 613 | package com.leammin.leetcode.easy;
import com.leammin.leetcode.util.AbstractTest;
import com.leammin.leetcode.util.ExpectedTestcase;
import com.leammin.leetcode.util.Testsuite;
/**
* @author Leammin
* @date 2020-06-17
*/
class BinarySearchTest extends AbstractTest<BinarySearch> {
@Override
protected Testsuite<BinarySearch> testsuite() {
return Testsuite.<BinarySearch>builder()
.add(ExpectedTestcase.of(t -> t.search(new int[]{-1,0,3,5,9,12}, 9), 4))
.add(ExpectedTestcase.of(t -> t.search(new int[]{-1,0,3,5,9,12}, 2), -1))
.build();
}
} | 32.263158 | 89 | 0.65416 |
deced1ef15d860e73e5c79f17cf0938f51ee6f04 | 1,638 | package com.example.zhangxiong.fcb;
import java.io.Serializable;
/**
* Created by ZhangXiong on 2017/12/5.
*/
public class Record implements Serializable{
private int rid;
private String account;
private String address;
private String carnumber="";
private String date;
private int state;
private double jindu;
private double weidu;
private byte[]photo;
public int getRid() {
return rid;
}
public void setRid(int rid) {
this.rid = rid;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getCarnumber() {
return carnumber;
}
public void setCarnumber(String carnumber) {
this.carnumber = carnumber;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public double getJindu() {
return jindu;
}
public void setJindu(double jindu) {
this.jindu = jindu;
}
public double getWeidu() {
return weidu;
}
public void setWeidu(double weidu) {
this.weidu = weidu;
}
public byte[] getPhoto() {
return photo;
}
public void setPhoto(byte[] photo) {
this.photo = photo;
}
public int getState() {
return state;
}
public void setState(int state) {
this.state = state;
}
}
| 18 | 48 | 0.586081 |
cd280851e0acd765543321d78abbb088462e6171 | 613 | package com.thoughtworks.inproctester.resteasy;
import com.thoughtworks.inproctester.core.InProcConnection;
import java.net.URI;
public class TesterRoute {
private RouteMatcher routeMatcher;
private InProcConnection httpAppTester;
public TesterRoute(RouteMatcher routeMatcher, InProcConnection httpAppTester) {
this.routeMatcher = routeMatcher;
this.httpAppTester = httpAppTester;
}
public InProcConnection getHttpAppTester() {
return httpAppTester;
}
public boolean matches(URI requestUri) {
return routeMatcher.routeMatches(requestUri);
}
}
| 25.541667 | 83 | 0.747145 |
e9de91a01100dc5c52426717d34bf8c21b33e993 | 431 | // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.filter;
import com.yahoo.jdisc.handler.ResponseHandler;
import com.yahoo.jdisc.http.HttpRequest;
/**
* @author Einar M R Rosenvinge
*/
public interface RequestFilter extends com.yahoo.jdisc.SharedResource, RequestFilterBase {
void filter(HttpRequest request, ResponseHandler handler);
}
| 28.733333 | 104 | 0.784223 |
88fa76071c39f5d2858539e9386f29f7c4e3e377 | 2,452 | /**
* MIT License
* <p>
* Copyright (c) 2017 James
* <p>
* 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:
* <p>
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* <p>
* 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 me.zbl.prototype;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.Arrays;
import java.util.Collection;
import static org.junit.Assert.*;
/**
* 测试原型模式
*/
@RunWith(Parameterized.class)
public class PrototypeTest<P extends Prototype> {
@Parameterized.Parameters
public static Collection<Object[]> setupData() {
return Arrays.asList(
new Object[]{new EstateDriver(), "这是一名旅行车司机"},
new Object[]{new EstateVehicle(), "这是一辆旅行车"},
new Object[]{new EstatePassanger(), "这是一名旅行车乘客"},
new Object[]{new OffRoadDriver(), "这是一名越野车司机"},
new Object[]{new OffRoadVehicle(), "这是一辆越野车"},
new Object[]{new OffRoadPassanger(), "这是一名越野车乘客"}
);
}
private final P prototype;
private final String expectedString;
public PrototypeTest(P prototype, String expectedString) {
this.prototype = prototype;
this.expectedString = expectedString;
}
@Test
public void testPrototype() throws Exception {
assertEquals(this.prototype.toString(), this.expectedString);
final Object clone = this.prototype.clone();
assertNotNull(clone);
assertSame(clone.getClass(), this.prototype.getClass());
assertNotSame(this.prototype, clone);
}
}
| 34.535211 | 81 | 0.718189 |
f6c24e5cefe0f35cc78b08e27e05db8cfd043ed3 | 13,691 | /*******************************************************************************
* Copyright (c) 2014 Opt4J
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*******************************************************************************/
package org.opt4j.viewer;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.TableColumnModelEvent;
import javax.swing.event.TableColumnModelListener;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumnModel;
import org.opt4j.core.Individual;
import org.opt4j.core.IndividualSet;
import org.opt4j.core.IndividualSetListener;
import org.opt4j.core.Objective;
import org.opt4j.core.Objective.Sign;
import org.opt4j.core.Objectives;
import org.opt4j.core.config.Icons;
import org.opt4j.core.config.visualization.DelayTask;
import org.opt4j.core.optimizer.Archive;
import org.opt4j.core.optimizer.Optimizer;
import org.opt4j.core.optimizer.OptimizerIterationListener;
import org.opt4j.viewer.ObjectivesMonitor.ObjectivesListener;
import com.google.inject.Inject;
/**
* A widget that monitors the archive.
*
* @author lukasiewycz
*
*/
@WidgetParameters(title = "Archive Monitor", icon = Icons.ARCHIVE)
public class ArchiveWidget implements OptimizerIterationListener, IndividualSetListener, Widget, ObjectivesListener {
protected final static int OFFSET = 2;
protected final SynchronizedIndividualSet archive;
protected List<Individual> swtIndividuals = Collections.emptyList();
protected final List<Objective> objectives = new ArrayList<>();
protected final List<Objective> order = new ArrayList<>();
protected final JPanel panel = new JPanel();
protected final JTable table;
protected final JCheckBox autoUpdate;
protected final JLabel sizeLabel;
protected boolean changed = true;
protected final List<IndividualMouseListener> individualMouseListeners = new CopyOnWriteArrayList<>();
protected final DelayTask task = new DelayTask(40);
protected static final String INDEX = "#";
/**
* The {@link TableMouseListener} that listens to right and double click of
* the table item.
*
* @author lukasiewycz
*
*/
class TableMouseListener extends MouseAdapter {
private void reservTableShow(MouseEvent e, boolean released) {
if (table.isEnabled()) {
Point p = new Point(e.getX(), e.getY());
int row = table.rowAtPoint(p);
if (row >= 0 && row < table.getRowCount()) {
Individual individual = swtIndividuals.get(row);
if (e.isPopupTrigger()) {
table.getSelectionModel().setSelectionInterval(row, row);
JPopupMenu menu = new JPopupMenu();
for (IndividualMouseListener listener : individualMouseListeners) {
listener.onPopup(individual, table, p, menu);
}
if (menu.getComponentCount() > 0) {
menu.show(table, p.x, p.y);
}
} else if (e.getClickCount() == 2 && released) {
for (IndividualMouseListener listener : individualMouseListeners) {
listener.onDoubleClick(individual, table, p);
}
}
}
}
}
@Override
public void mouseReleased(MouseEvent e) {
reservTableShow(e, true);
}
@Override
public void mousePressed(MouseEvent e) {
reservTableShow(e, false);
}
}
/**
* The model of the table.
*
* @author lukasiewycz
*
*/
protected class Model extends AbstractTableModel {
private static final long serialVersionUID = 1L;
@Override
public String getColumnName(int col) {
if (col == 0) {
return INDEX;
} else if (col == 1) {
return "Individual";
}
final int index = col - OFFSET;
final Objective objective = objectives.get(index);
return objective.getName() + " (" + objective.getSign() + ")";
}
@Override
public int getColumnCount() {
return OFFSET + objectives.size();
}
@Override
public int getRowCount() {
return swtIndividuals.size();
}
@Override
public Object getValueAt(final int row, final int col) {
try {
final Individual individual = swtIndividuals.get(row);
if (individual != null) {
if (col == 0) {
return row + 1;
} else if (col == 1) {
return individual.getPhenotype();
} else if (individual.getState() == Individual.State.EVALUATED) {
final int index = col - OFFSET;
final Objectives o = individual.getObjectives();
final Objective objective = objectives.get(index);
return o.get(objective).getValue();
}
}
} catch (IndexOutOfBoundsException e) {
} catch (NullPointerException e) {
}
return null;
}
}
/**
* Constructs an {@link ArchiveWidget}.
*
* @param archive
* the archive
*/
@Inject
public ArchiveWidget(Archive archive) {
this.archive = new SynchronizedIndividualSet(archive);
this.archive.addListener(this);
table = getTable();
JScrollPane scroll = new JScrollPane(table);
/*
* configure the autoupdate checkbox
*/
autoUpdate = new JCheckBox();
autoUpdate.setSelected(true);
autoUpdate.setText("Auto Update");
autoUpdate.setHorizontalTextPosition(SwingConstants.LEADING);
autoUpdate.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (autoUpdate.isSelected()) {
paint();
}
}
});
sizeLabel = new JLabel(Integer.toString(archive.size()));
/*
* configure the panel
*/
JPanel north = new JPanel();
north.setLayout(new BoxLayout(north, BoxLayout.X_AXIS));
Dimension dim = new Dimension(10, 10);
north.add(new Box.Filler(dim, dim, dim));
north.add(new JLabel("Size: "));
north.add(sizeLabel);
north.add(Box.createHorizontalGlue());
north.add(autoUpdate);
panel.setLayout(new BorderLayout());
panel.add(north, BorderLayout.NORTH);
panel.add(scroll, BorderLayout.CENTER);
table.getColumnModel().addColumnModelListener(new TableColumnModelListener() {
@Override
public void columnAdded(TableColumnModelEvent arg0) {
// nothing to be done
}
@Override
public void columnMarginChanged(ChangeEvent arg0) {
// nothing to be done
}
@Override
public void columnMoved(TableColumnModelEvent arg0) {
// nothing to be done
}
@Override
public void columnRemoved(TableColumnModelEvent arg0) {
// nothing to be done
}
@Override
public void columnSelectionChanged(ListSelectionEvent arg0) {
if (updateOrder()) {
paint();
}
}
});
}
/**
* Register at the {@link Optimizer}.
*
* @param optimizer
* the optimizer
*/
@Inject(optional = true)
public void registerAtOptimizer(Optimizer optimizer) {
optimizer.addOptimizerIterationListener(this);
}
/**
* Register at the {@link ObjectivesMonitor}.
*
* @param objectivesMonitor
* the objectives monitor
*/
@Inject(optional = true)
public void registerAtObjectivesMonitor(ObjectivesMonitor objectivesMonitor) {
objectivesMonitor.addListener(this);
}
/**
* Set the {@link IndividualMouseListener}s to inform.
*
* @param mouseListeners
* the mouse listeners
*/
@Inject(optional = true)
public void addMouseListeners(Set<IndividualMouseListener> mouseListeners) {
this.individualMouseListeners.addAll(mouseListeners);
sortIndividiualMouseListeners();
}
protected final JTable getTable() {
Model model = new Model();
QTable table = new QTable(model);
table.addMouseListener(new TableMouseListener());
final TableColumnModel columnModel = table.getColumnModel();
columnModel.getColumn(0).setPreferredWidth(25);
columnModel.getColumn(1).setPreferredWidth(140);
return table;
}
protected void sortIndividiualMouseListeners() {
List<IndividualMouseListener> list = new ArrayList<>();
list.addAll(individualMouseListeners);
Collections.sort(list, new ToolBarOrderComparator<>());
individualMouseListeners.clear();
individualMouseListeners.addAll(list);
}
/*
* (non-Javadoc)
*
* @see org.opt4j.viewer.Widget#init(org.opt4j.viewer.Viewport)
*/
@Override
public synchronized void init(Viewport viewport) {
// nothing to be done
}
protected boolean updateOrder() {
if (table.getColumnCount() != objectives.size() + OFFSET) {
return false;
}
List<Objective> list = new ArrayList<>();
TableColumnModel model = table.getColumnModel();
for (int i = 0; i < model.getColumnCount(); i++) {
int index = model.getColumn(i).getModelIndex();
if (index >= OFFSET) {
Objective o = objectives.get(index - OFFSET);
list.add(o);
}
}
if (!list.equals(order)) {
order.clear();
order.addAll(list);
return true;
}
return false;
}
/**
* Repaints the table.
*/
protected void paint() {
task.execute(new Runnable() {
@Override
public void run() {
final List<Individual> temp = new ArrayList<>();
temp.addAll(archive);
Collections.sort(temp, new Comp());
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
swtIndividuals = temp;
sizeLabel.setText(Integer.toString(swtIndividuals.size()));
if (table != null) {
if (table.getColumnCount() != table.getModel().getColumnCount()) {
table.createDefaultColumnsFromModel();
}
table.revalidate();
table.repaint();
}
}
});
}
});
}
protected class Comp implements Comparator<Individual> {
@Override
public int compare(Individual arg0, Individual arg1) {
if (arg0 == null) {
if (arg1 == null) {
return 0;
}
return 1;
} else if (arg1 == null) {
return -1;
}
Objectives obj0 = arg0.getObjectives();
Objectives obj1 = arg1.getObjectives();
for (Objective o : order) {
assert obj0.get(o) != null;
assert obj1.get(o) != null;
Double v0 = obj0.get(o).getDouble();
Double v1 = obj1.get(o).getDouble();
int c = 0;
if (v0 == null) {
if (v1 == null) {
continue;
}
c = 1;
} else if (v1 == null) {
c = -1;
} else {
c = v0.compareTo(v1);
}
if (c != 0) {
if (o.getSign() == Sign.MIN) {
return c;
}
return -c;
}
}
return 0;
}
}
/**
* Adds a {@link IndividualMouseListener}.
*
* @param listener
* the individual mouse listener to be added
*/
public void addIndividualMouseListener(IndividualMouseListener listener) {
individualMouseListeners.add(listener);
sortIndividiualMouseListeners();
}
/**
* Removes a {@link IndividualMouseListener}.
*
* @param listener
* the individual mouse listener to be removed
*/
public void removeIndivdiualMouseListener(IndividualMouseListener listener) {
individualMouseListeners.remove(listener);
}
/*
* (non-Javadoc)
*
* @see
* org.opt4j.core.optimizer.OptimizerIterationListener#iterationComplete
* (org.opt4j.core.optimizer.Optimizer, int)
*/
@Override
public synchronized void iterationComplete(int iteration) {
if (changed && autoUpdate.isSelected()) {
changed = false;
paint();
}
}
/*
* (non-Javadoc)
*
* @see org.opt4j.core.IndividualSetListener#individualAdded(org.opt4j.core.
* IndividualSet, org.opt4j.core.Individual)
*/
@Override
public synchronized void individualAdded(IndividualSet collection, Individual individual) {
changed = true;
}
/*
* (non-Javadoc)
*
* @see
* org.opt4j.core.IndividualSetListener#individualRemoved(org.opt4j.core
* .IndividualSet, org.opt4j.core.Individual)
*/
@Override
public synchronized void individualRemoved(IndividualSet collection, Individual individual) {
changed = true;
}
/*
* (non-Javadoc)
*
* @see org.opt4j.viewer.Widget#getPanel()
*/
@Override
public JPanel getPanel() {
return panel;
}
@Override
public void objectives(final Collection<Objective> obj) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
order.addAll(obj);
objectives.addAll(obj);
}
});
paint();
}
}
| 25.590654 | 117 | 0.685414 |
dbc5652f32d808ca1ef535e2d8e2ce2382440b7d | 2,234 | /**
* This file is part of Aion-Lightning <aion-lightning.org>.
*
* Aion-Lightning is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Aion-Lightning is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License
* along with Aion-Lightning.
* If not, see <http://www.gnu.org/licenses/>.
*/
package com.aionemu.gameserver.network.loginserver.serverpackets;
import com.aionemu.commons.network.IPRange;
import com.aionemu.gameserver.configs.network.IPConfig;
import com.aionemu.gameserver.configs.network.NetworkConfig;
import com.aionemu.gameserver.network.loginserver.LoginServerConnection;
import com.aionemu.gameserver.network.loginserver.LsServerPacket;
import java.util.List;
/**
* This is authentication packet that gs will send to login server for
* registration.
*
* @author -Nemesiss-
*/
public class SM_GS_AUTH extends LsServerPacket {
public SM_GS_AUTH() {
super(0x00);
}
@Override
protected void writeImpl(LoginServerConnection con) {
writeC(NetworkConfig.GAMESERVER_ID);
writeC(IPConfig.getDefaultAddress().length);
writeB(IPConfig.getDefaultAddress());
List<IPRange> ranges = IPConfig.getRanges();
int size = ranges.size();
writeD(size);
for (int i = 0; i < size; i++) {
IPRange ipRange = ranges.get(i);
byte[] min = ipRange.getMinAsByteArray();
byte[] max = ipRange.getMaxAsByteArray();
writeC(min.length);
writeB(min);
writeC(max.length);
writeB(max);
writeC(ipRange.getAddress().length);
writeB(ipRange.getAddress());
}
writeH(NetworkConfig.GAME_PORT);
writeD(NetworkConfig.MAX_ONLINE_PLAYERS);
writeS(NetworkConfig.LOGIN_PASSWORD);
}
}
| 34.369231 | 74 | 0.687556 |
dbc86341e88f09ba213fefb71f22718ef3750ecb | 318 | package com.lakeel.altla.sample.wifibatterydrain;
import com.squareup.leakcanary.LeakCanary;
import android.app.Application;
public final class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// LeakCanary
LeakCanary.install(this);
}
}
| 18.705882 | 54 | 0.704403 |
d3e5bd49833290a8c7ad59b0e6d9c09e3492c5a5 | 8,351 | /*
* Copyright 2018 JDCLOUD.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.
*
*
*
*
*
* Contact:
*
* NOTE: This class is auto generated by the jdcloud code generator program.
*/
package com.jdcloud.sdk.service.partner.model;
/**
* distributorProductDTO
*/
public class DistributorProductDTO implements java.io.Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private Number id;
/**
* 服务商ID
*/
private String distributorId;
/**
* 服务商名称
*/
private String distributorName;
/**
* 服务商pin
*/
private String distributorPin;
/**
* 产品类型
*/
private Integer productType;
/**
* 产品ID
*/
private String productId;
/**
* 产品名称
*/
private String productName;
/**
* 状态
*/
private Integer status;
/**
* 说明
*/
private String remark;
/**
* 创建时间
*/
private String createTime;
/**
* 创建人
*/
private String createUser;
/**
* 修改时间
*/
private String updateTime;
/**
* 修改人
*/
private String updateUser;
/**
* 是否删除0未删除,1已删除
*/
private Integer yn;
/**
* get ID
*
* @return
*/
public Number getId() {
return id;
}
/**
* set ID
*
* @param id
*/
public void setId(Number id) {
this.id = id;
}
/**
* get 服务商ID
*
* @return
*/
public String getDistributorId() {
return distributorId;
}
/**
* set 服务商ID
*
* @param distributorId
*/
public void setDistributorId(String distributorId) {
this.distributorId = distributorId;
}
/**
* get 服务商名称
*
* @return
*/
public String getDistributorName() {
return distributorName;
}
/**
* set 服务商名称
*
* @param distributorName
*/
public void setDistributorName(String distributorName) {
this.distributorName = distributorName;
}
/**
* get 服务商pin
*
* @return
*/
public String getDistributorPin() {
return distributorPin;
}
/**
* set 服务商pin
*
* @param distributorPin
*/
public void setDistributorPin(String distributorPin) {
this.distributorPin = distributorPin;
}
/**
* get 产品类型
*
* @return
*/
public Integer getProductType() {
return productType;
}
/**
* set 产品类型
*
* @param productType
*/
public void setProductType(Integer productType) {
this.productType = productType;
}
/**
* get 产品ID
*
* @return
*/
public String getProductId() {
return productId;
}
/**
* set 产品ID
*
* @param productId
*/
public void setProductId(String productId) {
this.productId = productId;
}
/**
* get 产品名称
*
* @return
*/
public String getProductName() {
return productName;
}
/**
* set 产品名称
*
* @param productName
*/
public void setProductName(String productName) {
this.productName = productName;
}
/**
* get 状态
*
* @return
*/
public Integer getStatus() {
return status;
}
/**
* set 状态
*
* @param status
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* get 说明
*
* @return
*/
public String getRemark() {
return remark;
}
/**
* set 说明
*
* @param remark
*/
public void setRemark(String remark) {
this.remark = remark;
}
/**
* get 创建时间
*
* @return
*/
public String getCreateTime() {
return createTime;
}
/**
* set 创建时间
*
* @param createTime
*/
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
/**
* get 创建人
*
* @return
*/
public String getCreateUser() {
return createUser;
}
/**
* set 创建人
*
* @param createUser
*/
public void setCreateUser(String createUser) {
this.createUser = createUser;
}
/**
* get 修改时间
*
* @return
*/
public String getUpdateTime() {
return updateTime;
}
/**
* set 修改时间
*
* @param updateTime
*/
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
/**
* get 修改人
*
* @return
*/
public String getUpdateUser() {
return updateUser;
}
/**
* set 修改人
*
* @param updateUser
*/
public void setUpdateUser(String updateUser) {
this.updateUser = updateUser;
}
/**
* get 是否删除0未删除,1已删除
*
* @return
*/
public Integer getYn() {
return yn;
}
/**
* set 是否删除0未删除,1已删除
*
* @param yn
*/
public void setYn(Integer yn) {
this.yn = yn;
}
/**
* set ID
*
* @param id
*/
public DistributorProductDTO id(Number id) {
this.id = id;
return this;
}
/**
* set 服务商ID
*
* @param distributorId
*/
public DistributorProductDTO distributorId(String distributorId) {
this.distributorId = distributorId;
return this;
}
/**
* set 服务商名称
*
* @param distributorName
*/
public DistributorProductDTO distributorName(String distributorName) {
this.distributorName = distributorName;
return this;
}
/**
* set 服务商pin
*
* @param distributorPin
*/
public DistributorProductDTO distributorPin(String distributorPin) {
this.distributorPin = distributorPin;
return this;
}
/**
* set 产品类型
*
* @param productType
*/
public DistributorProductDTO productType(Integer productType) {
this.productType = productType;
return this;
}
/**
* set 产品ID
*
* @param productId
*/
public DistributorProductDTO productId(String productId) {
this.productId = productId;
return this;
}
/**
* set 产品名称
*
* @param productName
*/
public DistributorProductDTO productName(String productName) {
this.productName = productName;
return this;
}
/**
* set 状态
*
* @param status
*/
public DistributorProductDTO status(Integer status) {
this.status = status;
return this;
}
/**
* set 说明
*
* @param remark
*/
public DistributorProductDTO remark(String remark) {
this.remark = remark;
return this;
}
/**
* set 创建时间
*
* @param createTime
*/
public DistributorProductDTO createTime(String createTime) {
this.createTime = createTime;
return this;
}
/**
* set 创建人
*
* @param createUser
*/
public DistributorProductDTO createUser(String createUser) {
this.createUser = createUser;
return this;
}
/**
* set 修改时间
*
* @param updateTime
*/
public DistributorProductDTO updateTime(String updateTime) {
this.updateTime = updateTime;
return this;
}
/**
* set 修改人
*
* @param updateUser
*/
public DistributorProductDTO updateUser(String updateUser) {
this.updateUser = updateUser;
return this;
}
/**
* set 是否删除0未删除,1已删除
*
* @param yn
*/
public DistributorProductDTO yn(Integer yn) {
this.yn = yn;
return this;
}
} | 16.702 | 76 | 0.527003 |
80443c5452c9a2dda5cdd8fbc57909c05a1636ef | 9,280 | package org.jeecg.modules.business.controller;
import java.util.*;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import net.sf.saxon.expr.instruct.ForEach;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.business.entity.SiteMonitorPoint;
import org.jeecg.modules.business.entity.SysWarnPointRule;
import org.jeecg.modules.business.entity.SysWarnRule;
import org.jeecg.modules.business.service.ISiteMonitorPointService;
import org.jeecg.modules.business.service.ISysWarnPointRuleService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.business.service.ISysWarnRuleService;
import org.jeecg.modules.business.vo.SysWarnPointListVO;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
/**
* @Description: 站点报警策略表
* @Author: jeecg-boot
* @Date: 2020-07-06
* @Version: V1.0
*/
@Api(tags="站点报警策略表")
@RestController
@RequestMapping("/swpr/sysWarnPointRule")
@Slf4j
public class SysWarnPointRuleController extends JeecgController<SysWarnPointRule, ISysWarnPointRuleService> {
@Autowired
private ISysWarnPointRuleService sysWarnPointRuleService;
@Autowired
private ISiteMonitorPointService siteMonitorPointService;
@Autowired
private ISysWarnRuleService sysWarnRuleService;
/**
* 分页列表查询
*
* @param sysWarnPointRule
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "站点报警策略表-分页列表查询")
@ApiOperation(value="站点报警策略表-分页列表查询", notes="站点报警策略表-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(SysWarnPointRule sysWarnPointRule,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Page<SysWarnPointListVO> page = new Page<>(pageNo, pageSize);
IPage<SysWarnPointListVO> pageList = sysWarnPointRuleService.getSysWarnPointList(page);
return Result.ok(pageList);
}
/**
* 添加
*
* @param jsonObject
* @return
*/
@AutoLog(value = "站点报警策略表-添加")
@ApiOperation(value="站点报警策略表-添加", notes="站点报警策略表-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody JSONObject jsonObject) {
List<String> monitorIds = jsonObject.getJSONArray("monitorIds").toJavaList(String.class);
List<String> ruleIds = jsonObject.getJSONArray("ruleIds").toJavaList(String.class);
// //删除 根据monitorIds
if(!monitorIds.isEmpty() && !ruleIds.isEmpty()){
sysWarnPointRuleService
.remove(new QueryWrapper<SysWarnPointRule>().lambda().in(SysWarnPointRule::getMonitorId,monitorIds).in(SysWarnPointRule::getRuleId,ruleIds));
List<SysWarnPointRule> sysWarnPointRules = new ArrayList<>();
for(String monitor : monitorIds) {
for (String rule : ruleIds) {
SysWarnPointRule sysWarnPointRule = new SysWarnPointRule();
sysWarnPointRule.setMonitorId(monitor);
sysWarnPointRule.setRuleId(rule);
String isUsed = sysWarnRuleService.getById(rule).getIsUsed();
sysWarnPointRule.setIsUsed(isUsed);
sysWarnPointRules.add(sysWarnPointRule);
}
}
sysWarnPointRuleService.saveBatch(sysWarnPointRules);
return Result.ok("添加成功!");
}else {
return Result.error("站点和策略不能为空!");
}
}
/**
* 编辑
*
* @param jsonObject
* @return
*/
@AutoLog(value = "站点报警策略表-编辑")
@ApiOperation(value="站点报警策略表-编辑", notes="站点报警策略表-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody JSONObject jsonObject) {
List<String> monitorIds = jsonObject.getJSONArray("monitorIds").toJavaList(String.class);
List<String> ruleIds = jsonObject.getJSONArray("ruleIds").toJavaList(String.class);
QueryWrapper<SysWarnPointRule> lambdaQueryWrapper = new QueryWrapper<SysWarnPointRule>();
if(!monitorIds.isEmpty()){
lambdaQueryWrapper.in("monitor_id",monitorIds);
}
if(!ruleIds.isEmpty())
lambdaQueryWrapper.in("rule_id",ruleIds);
// //删除 根据monitorIds
sysWarnPointRuleService.remove(lambdaQueryWrapper);
List<SysWarnPointRule> sysWarnPointRules = new ArrayList<>();
for(String monitor : monitorIds) {
for (String rule : ruleIds) {
SysWarnPointRule sysWarnPointRule = new SysWarnPointRule();
sysWarnPointRule.setMonitorId(monitor);
sysWarnPointRule.setRuleId(rule);
String isUsed = sysWarnRuleService.getById(rule).getIsUsed();
sysWarnPointRule.setIsUsed(isUsed);
sysWarnPointRules.add(sysWarnPointRule);
}
}
sysWarnPointRuleService.saveBatch(sysWarnPointRules);
return Result.ok("添加成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "站点报警策略表-通过id删除")
@ApiOperation(value="站点报警策略表-通过id删除", notes="站点报警策略表-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
sysWarnPointRuleService.removeById(id);
return Result.ok("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "站点报警策略表-批量删除")
@ApiOperation(value="站点报警策略表-批量删除", notes="站点报警策略表-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.sysWarnPointRuleService.removeByIds(Arrays.asList(ids.split(",")));
return Result.ok("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
@AutoLog(value = "站点报警策略表-通过id查询")
@ApiOperation(value="站点报警策略表-通过id查询", notes="站点报警策略表-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
SysWarnPointRule sysWarnPointRule = sysWarnPointRuleService.getById(id);
if(sysWarnPointRule==null) {
return Result.error("未找到对应数据");
}
return Result.ok(sysWarnPointRule);
}
/**
* 查询站点名称
*
* @param siteType
* @param area
* @return
*/
@AutoLog(value = "站点报警策略表-通过id查询")
@ApiOperation(value="站点报警策略表-通过id查询", notes="站点报警策略表-通过id查询")
@GetMapping(value = "/querySiteName")
public Result<?> querySiteName(@RequestParam(name="siteType",required=false) String siteType,
@RequestParam(name="area",required=false) String area){
List<Map<String,String>> result = new ArrayList<>();
List<SiteMonitorPoint> list;
if(StrUtil.isEmpty(siteType) && StrUtil.isEmpty(area)) {
list = siteMonitorPointService.list(new QueryWrapper<SiteMonitorPoint>().lambda());
}else if(StrUtil.isEmpty(siteType) && !StrUtil.isEmpty(area)){
list = siteMonitorPointService.list(new QueryWrapper<SiteMonitorPoint>().lambda()
.eq(SiteMonitorPoint::getArea,area));
}else if(!StrUtil.isEmpty(siteType) && StrUtil.isEmpty(area)) {
list = siteMonitorPointService.list(new QueryWrapper<SiteMonitorPoint>().lambda()
.eq(SiteMonitorPoint::getSiteType, siteType));
}else {
list = siteMonitorPointService.list(new QueryWrapper<SiteMonitorPoint>().lambda().eq(SiteMonitorPoint::getSiteType, siteType)
.eq(SiteMonitorPoint::getArea,area));
}
list.forEach(siteMonitorPoint -> {
Map<String,String> param = new HashMap<>();
param.put("key",siteMonitorPoint.getId());
param.put("siteName",siteMonitorPoint.getSiteName());
param.put("area",siteMonitorPoint.getArea());
param.put("siteType", siteMonitorPoint.getSiteType());
result.add(param);
});
return Result.ok(result);
}
/**
* 导出excel
*
* @param request
* @param sysWarnPointRule
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, SysWarnPointRule sysWarnPointRule) {
return super.exportXls(request, sysWarnPointRule, SysWarnPointRule.class, "站点报警策略表");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, SysWarnPointRule.class);
}
}
| 33.501805 | 146 | 0.741595 |
7a587538cf1c585740720c01780cf146636b39f4 | 866 | /*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package java.net;
import java.io.IOException;
/**
* Thrown to indicate that there is an error creating or accessing a Socket.
*
* @author Jonathan Payne
* @since 1.0
*/
public
class SocketException extends IOException {
private static final long serialVersionUID = -5935874303556886934L;
/**
* Constructs a new {@code SocketException} with the
* specified detail message.
*
* @param msg the detail message.
*/
public SocketException(String msg) {
super(msg);
}
/**
* Constructs a new {@code SocketException} with no detail message.
*/
public SocketException() {
}
}
| 15.464286 | 79 | 0.618938 |
c31ffde0ffcb255746289f4e187e10684cc5b597 | 1,507 | package io.cucumber.core.plugin;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class FeaturePathFormatter {
private LineFilters lineFilters;
public FeaturePathFormatter() {
this.lineFilters = LineFilters.forCurrentContext();
}
public URI featurePathWithPrefixIfNecessary(final URI featurePath) {
return lineFilters
.getURIForFeaturePath(featurePath)
.map(matchingURI -> featurePathWithPrefix(matchingURI, featurePath))
.orElse(featurePath);
}
private URI featurePathWithPrefix(URI featurePathUri, URI featurePath) {
Set<Integer> allLineNumbersSet = lineFilters.getLineNumbersFor(featurePathUri);
List<Integer> allLineNumbersList = new ArrayList<>(allLineNumbersSet);
long featurePathPrefix = allLineNumbersList.get(0);
URI featureURIWithPrefix = featurePathUri;
try {
featureURIWithPrefix = new URI(featurePath.toString() + ":" + featurePathPrefix);
} catch (URISyntaxException e) {
e.printStackTrace();
}
return featureURIWithPrefix;
}
private URI getURIForFeaturePath(Map<URI, Set<Integer>> map, URI featurePath) {
for (URI currentURI : map.keySet()) {
if (featurePath.equals(currentURI)) {
return currentURI;
}
}
return null;
}
}
| 31.395833 | 94 | 0.665561 |
fb681f230e1f84d9f6d60daa4f69056e2ac9bb93 | 2,411 | package com.bitdubai.fermat_pip_api.layer.module.developer.interfaces;
import com.bitdubai.fermat_api.layer.all_definition.common.system.utils.AddonVersionReference;
import com.bitdubai.fermat_api.layer.all_definition.common.system.utils.PluginVersionReference;
import com.bitdubai.fermat_api.layer.all_definition.developer.DeveloperDatabase;
import com.bitdubai.fermat_api.layer.all_definition.developer.DeveloperDatabaseTable;
import com.bitdubai.fermat_api.layer.all_definition.developer.DeveloperDatabaseTableRecord;
import java.util.List;
/**
* @author furszy
* @author lnacosta
*/
public interface DatabaseTool {
/**
* Through the method <code>listAvailablePlugins</code> you can get a list of available plug-ins where you can use the developer tool.
*
* @return a list of plugin version references.
*/
List<PluginVersionReference> listAvailablePlugins();
/**
* Through the method <code>listAvailableAddons</code> you can get a list of available add-ons where you can use the developer tool.
*
* @return a list of addon version references.
*/
List<AddonVersionReference> listAvailableAddons();
List<DeveloperDatabase> getDatabaseListFromPlugin(PluginVersionReference plugin);
List<DeveloperDatabase> getDatabaseListFromAddon(AddonVersionReference Addon);
List<DeveloperDatabaseTable> getPluginTableListFromDatabase(PluginVersionReference plugin ,
DeveloperDatabase developerDatabase);
List<DeveloperDatabaseTable> getAddonTableListFromDatabase(AddonVersionReference addon ,
DeveloperDatabase developerDatabase);
List<DeveloperDatabaseTableRecord> getPluginTableContent(PluginVersionReference plugin ,
DeveloperDatabase developerDatabase ,
DeveloperDatabaseTable developerDatabaseTable);
List<DeveloperDatabaseTableRecord> getAddonTableContent(AddonVersionReference addon ,
DeveloperDatabase developerDatabase ,
DeveloperDatabaseTable developerDatabaseTable);
}
| 48.22 | 138 | 0.662796 |
9f2c7dd34453a63bd1587bf3447a18bc9487af90 | 3,481 | /*******************************************************************************
* Copyright (c) 2005, 2009 SAP. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* SAP - initial API and implementation
******************************************************************************/
package org.eclipse.persistence.testing.models.wdf.jpa1.employee;
import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
@Entity
@Table(name = "TMP_HOBBY")
@TableGenerator(name = "StringIdGenerator", table = "TMP_STRING_GEN", pkColumnName = "BEAN_NAME", valueColumnName = "MAX_ID")
public class Hobby {
private String id;
private String description;
private String category;
public Hobby() {
}
public Hobby(String aDescription) {
description = aDescription;
}
public Hobby(String txt, String aDescription) {
id = txt;
description = aDescription;
}
@Id
@GeneratedValue(strategy = GenerationType.TABLE, generator = "StringIdGenerator")
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@Basic
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Basic
public String getCategory() {
return category;
}
public void setCategory(final String aCategory) {
category = aCategory;
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof Hobby)) {
return false;
}
final Hobby other = (Hobby) obj;
if (id == null && other.id != null) {
return false;
}
if (id != null && !id.equals(other.id)) {
return false;
}
if (description == null && other.description != null) {
return false;
}
if (description != null && !description.equals(other.description)) {
return false;
}
if (category != null && !category.equals(other.category)) {
return false;
}
if (category == null && other.category != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = 17 + id.hashCode();
result *= 37;
if (description != null) {
result += description.hashCode();
}
result += 17;
result *= 37;
if (category != null) {
result += category.hashCode();
}
return result;
}
@Override
public String toString() {
return id + ":" + category + ":" + description;
}
}
| 28.072581 | 126 | 0.553289 |
4f18b59c10ada0692a8cafb67f9ea7fe1176a7c8 | 3,434 | package org.folio.finc.select;
import io.vertx.core.AsyncResult;
import io.vertx.core.Context;
import io.vertx.core.DeploymentOptions;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
import io.vertx.core.json.JsonObject;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import java.util.Map;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.folio.finc.select.verticles.AbstractSelectMetadataSourceVerticle;
import org.folio.finc.select.verticles.factory.SelectMetadataSourceVerticleFactory;
import org.folio.rest.RestVerticle;
import org.folio.rest.jaxrs.model.Select;
import org.folio.rest.jaxrs.resource.FincSelectMetadataSources.PutFincSelectMetadataSourcesCollectionsSelectAllByIdResponse;
import org.folio.rest.persist.PostgresClient;
import org.folio.rest.tools.utils.TenantTool;
/** Helper class to select/unselect metadata sources for finc-select. */
public class SelectMetadataSourcesHelper {
private final Logger logger = LoggerFactory.getLogger(SelectMetadataSourcesHelper.class);
public SelectMetadataSourcesHelper(Vertx vertx, String tenantId) {
PostgresClient.getInstance(vertx);
}
public void selectAllCollectionsOfMetadataSource(
String metadataSourceID,
Select selectEntity,
Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler,
Context vertxContext) {
try {
vertxContext.runOnContext(
v -> {
String tenantId =
TenantTool.calculateTenantId(okapiHeaders.get(RestVerticle.OKAPI_HEADER_TENANT));
String msg =
String.format(
"Will (un)select metadata collections of metadata source %s for tenant %s.",
metadataSourceID, tenantId);
logger.info(msg);
deploySelectSourceVerticle(vertxContext.owner(), metadataSourceID, tenantId, selectEntity);
String result = new JsonObject().put("message", msg).toString();
asyncResultHandler.handle(
Future.succeededFuture(
Response.ok(result, MediaType.APPLICATION_JSON_TYPE).build()));
});
} catch (Exception e) {
asyncResultHandler.handle(
Future.succeededFuture(
PutFincSelectMetadataSourcesCollectionsSelectAllByIdResponse.respond500WithTextPlain(
e.getCause())));
}
}
private void deploySelectSourceVerticle(
Vertx vertx, String metadataSourceId, String tenantId, Select select) {
AbstractSelectMetadataSourceVerticle verticle =
SelectMetadataSourceVerticleFactory.create(vertx, vertx.getOrCreateContext(), select);
vertx = Vertx.vertx();
JsonObject cfg = vertx.getOrCreateContext().config();
cfg.put("tenantId", tenantId);
cfg.put("metadataSourceId", metadataSourceId);
Future<String> deploy = Future.future();
vertx.deployVerticle(
verticle, new DeploymentOptions().setConfig(cfg).setWorker(true), deploy.completer());
deploy.setHandler(
ar -> {
if (ar.failed()) {
logger.error(
String.format(
"Failed to deploy SelectVerticle for metadata source %s and for tenant %s: %s",
metadataSourceId, tenantId, ar.cause().getMessage()),
ar.cause());
}
});
}
}
| 39.471264 | 124 | 0.697729 |
f4d2fb3bdcfd6e7ab220e00cea3ba59744dff3c1 | 3,736 | package mage.cards.p;
import mage.ApprovingObject;
import mage.abilities.Ability;
import mage.abilities.costs.common.TapTargetCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileSpellEffect;
import mage.abilities.keyword.ReplicateAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInGraveyard;
import mage.target.common.TargetControlledPermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class PsionicRitual extends CardImpl {
private static final FilterControlledPermanent filter
= new FilterControlledPermanent(SubType.HORROR, "an untapped Horror you control");
static {
filter.add(TappedPredicate.UNTAPPED);
}
public PsionicRitual(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{U}{U}");
// Replicate—Tap an untapped Horror you control.
this.addAbility(new ReplicateAbility(new TapTargetCost(new TargetControlledPermanent(filter))));
// Exile target instant or sorcery card from a graveyard and copy it. You may cast the copy without paying its mana cost.
this.getSpellAbility().addEffect(new PsionicRitualEffect());
this.getSpellAbility().addTarget(new TargetCardInGraveyard(StaticFilters.FILTER_CARD_INSTANT_OR_SORCERY));
// Exile Psionic Ritual.
this.getSpellAbility().addEffect(new ExileSpellEffect().concatBy("<br>"));
}
private PsionicRitual(final PsionicRitual card) {
super(card);
}
@Override
public PsionicRitual copy() {
return new PsionicRitual(this);
}
}
class PsionicRitualEffect extends OneShotEffect {
PsionicRitualEffect() {
super(Outcome.Benefit);
staticText = "exile target instant or sorcery card from a graveyard " +
"and copy it. You may cast the copy without paying its mana cost";
}
private PsionicRitualEffect(final PsionicRitualEffect effect) {
super(effect);
}
@Override
public PsionicRitualEffect copy() {
return new PsionicRitualEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Card card = game.getCard(getTargetPointer().getFirst(game, source));
if (player == null || card == null) {
return false;
}
player.moveCards(card, Zone.EXILED, source, game);
Card copiedCard = game.copyCard(card, source, source.getControllerId());
if (copiedCard == null) {
return false;
}
game.getExile().add(source.getSourceId(), "", copiedCard);
game.getState().setZone(copiedCard.getId(), Zone.EXILED);
if (copiedCard.getSpellAbility() == null || !player.chooseUse(
outcome, "Cast the copied card without paying mana cost?", source, game
)) {
return false;
}
game.getState().setValue("PlayFromNotOwnHandZone" + copiedCard.getId(), Boolean.TRUE);
player.cast(
player.chooseAbilityForCast(copiedCard, game, true),
game, true, new ApprovingObject(source, game)
);
game.getState().setValue("PlayFromNotOwnHandZone" + copiedCard.getId(), null);
return true;
}
}
| 34.915888 | 129 | 0.692452 |
e898cec9ec0d8fa2bd30b9c0fafe60c1e2041026 | 1,423 | /*
* An XML document type.
* Localname: int
* Namespace: http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes
* Java type: org.openxmlformats.schemas.officeDocument.x2006.docPropsVTypes.IntDocument
*
* Automatically generated - do not modify.
*/
package org.openxmlformats.schemas.officeDocument.x2006.docPropsVTypes;
import org.apache.xmlbeans.impl.schema.ElementFactory;
import org.apache.xmlbeans.impl.schema.AbstractDocumentFactory;
import org.apache.xmlbeans.impl.schema.DocumentFactory;
import org.apache.xmlbeans.impl.schema.SimpleTypeFactory;
/**
* A document containing one int(@http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes) element.
*
* This is a complex type.
*/
public interface IntDocument extends org.apache.xmlbeans.XmlObject {
DocumentFactory<org.openxmlformats.schemas.officeDocument.x2006.docPropsVTypes.IntDocument> Factory = new DocumentFactory<>(org.apache.poi.schemas.ooxml.system.ooxml.TypeSystemHolder.typeSystem, "int3c74doctype");
org.apache.xmlbeans.SchemaType type = Factory.getType();
/**
* Gets the "int" element
*/
int getInt();
/**
* Gets (as xml) the "int" element
*/
org.apache.xmlbeans.XmlInt xgetInt();
/**
* Sets the "int" element
*/
void setInt(int xint);
/**
* Sets (as xml) the "int" element
*/
void xsetInt(org.apache.xmlbeans.XmlInt xint);
}
| 30.276596 | 217 | 0.731553 |
5431ca37958358395a57d370111f0b63ebdc0948 | 11,258 | package xworker.task;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Future;
import java.util.concurrent.Semaphore;
import org.xmeta.ActionContext;
import org.xmeta.Bindings;
import org.xmeta.Thing;
import org.xmeta.cache.ThingEntry;
import org.xmeta.util.UtilString;
import xworker.lang.executor.Executor;
import xworker.util.UtilAction;
/**
* 任务。
*
* @author Administrator
*
*/
public class Task implements Runnable{
//private static Logger logger = LoggerFactory.getLogger(Task.class);
private static final String TAG = Task.class.getName();
static int uid = 0;
/** 任务状态,等待运行 */
public static final byte STATUS_WAIT = 0;
/** 任务状态,正在运行 */
public static final byte STATUS_RUNNING = 1;
/** 任务状态,已取消 */
public static final byte STATUS_CANCELED = 2;
/** 任务状态,暂停 */
public static final byte STATUS_PAUSED = 3;
/** 任务状态,已停止 */
public static final byte STATUS_FINISHED = 4;
/** 任务事物,任务执行时执行任务事物的run方法。*/
ThingEntry thingEntry;
/** 执行任务时所使用的动作上下文 */
ActionContext actionContext;
/** 任务的状态 */
byte status;
/** 任务执行后情况 */
Future<?> future;
/** 是否在执行完时调用callback,如果调用callbak,则会把返回值以result变量名传入,且调用事物的callbak方法。 */
boolean callback;
/** 是否在取消时调用callbackCacnel。 */
boolean callbackCancel;
/** 是否是计划任务 */
boolean schedule;
private Semaphore semaphore = new Semaphore(1);
private int maxCount;
private int count = 0;
private int id;
/** 执行时间 */
private long executeTime;
/** 执行时的参数 */
private Map<String, Object> parameters;
/** Thread方式执行时创建的Thread */
private Thread thread;
private Map<String, Object> data;
public Task(Thing thing, ActionContext actionContext, boolean schedule){
this(thing, actionContext, true, true, schedule);
}
public Task(Thing thing, ActionContext actionContext, boolean callback, boolean callbackCancel, boolean schedule){
synchronized(Task.class){
id = uid;
uid++;
}
this.thingEntry = new ThingEntry(thing);
this.actionContext = actionContext;
this.status = STATUS_WAIT;
this.callback = callback;
this.callbackCancel = callbackCancel;
this.schedule = schedule;
parameters = thing.doAction("getParams" , actionContext);
if(parameters == null) {
parameters = new HashMap<String, Object>();
}
Map<String, Object> taskParams = UtilAction.getChildChildsResultMap(thing, "TaskVariables", actionContext);
if(taskParams != null) {
parameters.putAll(taskParams);
}
parameters.put("parentContext", actionContext);
/*
*
String params = thing.getStringBlankAsNull("params");
if(params != null){
parameters = UtilData.getObjectByType(thing, "params", Map.class, actionContext);
}
if(parameters == null){
parameters = UtilAction.getChildChildsResultMap(thing, "Variables", actionContext);
}*/
}
public void set(String key, Object value) {
if(data == null) {
data = new HashMap<String, Object>();
}
data.put(key, value);
}
public Object get(String key) {
if(data == null) {
return null;
}
return data.get(key);
}
public Map<String, Object> getData(){
return data;
}
public int getId(){
return id;
}
private void use(){
try {
semaphore.acquire();
} catch (InterruptedException e) {
}
}
private void finish(){
semaphore.release();
}
protected void setThread(Thread thread) {
this.thread = thread;
}
public Thread getThread() {
return this.thread;
}
public void testUseFinish(){
use();
System.out.println(Thread.currentThread().getName() + ": used");
try{
Thread.sleep(1000);
}catch(Exception e){
}
System.out.println(Thread.currentThread().getName() + ": finished");
finish();
}
/**
* 创建界面。
*
* @param actionContext
* @return
*/
public Object createUI(ActionContext actionContext) {
Thing thing = getThing();
return thing.doAction("createUI", actionContext, "task", this);
}
public static void main(String args[]){
try{
final Task t = new Task(null, null , false, false, false);
for(int i=0; i<100;i++){
new Thread(new Runnable(){
public void run(){
while(true){
t.testUseFinish();
}
}
}).start();
}
}catch(Exception e){
e.printStackTrace();
}
}
/**
* 取消任务,如果任务已经完成或已经取消则返回false。如果任务已经启动,则 mayInterruptIfRunning 参数确定是否应该以试图停止任务的方式来中断执行此任务的线程。
* @param mayInterruptIfRunning
* @return
*/
public boolean cancel(boolean mayInterruptIfRunning){
try{
Thing thing = thingEntry.getThing();
use();
boolean canceled = false;
if(schedule){
if(this.status == STATUS_WAIT || status == STATUS_RUNNING || status == STATUS_PAUSED){
if(future != null && !future.isDone()){
if(future.cancel(mayInterruptIfRunning)){
status = STATUS_FINISHED;
end();
canceled = true;
}else{
status = STATUS_CANCELED;
canceled = false;
}
}
}
}else{
canceled = normalTaskCancel(mayInterruptIfRunning);
}
//如果有取消回调的话
if(callbackCancel && thing != null){
ActionContext ac = actionContext;
if(ac == null){
ac = new ActionContext();
}
Bindings bindings = ac.push();
bindings.put("task", this);
bindings.put("stauts", canceled);
try{
thing.doAction("callbackCancel", ac, parameters);
}finally{
ac.pop();
}
}
return canceled;
}finally{
finish();
}
}
private boolean normalTaskCancel(boolean mayInterruptIfRunning){
if(this.status == STATUS_WAIT || status == STATUS_RUNNING){
if(future.isDone()){
return false;
}
if(future != null && future.cancel(mayInterruptIfRunning)){
status = STATUS_FINISHED;
end();
return true;
}if(thread != null){
try {
thread.interrupt();
status = STATUS_CANCELED;
return true;
}catch(Exception e) {
return false;
}
}else{
status = STATUS_CANCELED;
return false;
}
}else{
return false;
}
}
/**
* 暂停定时任务。
*
* @return
*/
public boolean pause(){
try{
use();
if(schedule && status == STATUS_WAIT){
status = STATUS_PAUSED;
return true;
}else{
return false;
}
}finally{
finish();
}
}
/**
* 继续定时任务。
*
* @return
*/
public boolean resume(){
try{
use();
if(schedule && status == STATUS_PAUSED){
status = STATUS_WAIT;
return true;
}else{
return false;
}
}finally{
finish();
}
}
/**
* 获取状态的标签。
*
* @return
*/
public String getStatusLabel(){
switch(status){
case 0:
return UtilString.getString("lang:d=等待&en=Waiting", actionContext);
case 1:
return UtilString.getString("lang:d=运行中&en=Running", actionContext);
case 2:
return UtilString.getString("lang:d=已取消&en=Canceled", actionContext);
case 3:
return UtilString.getString("lang:d=已暂停&en=Paused", actionContext);
case 4:
return UtilString.getString("lang:d=已结束&en=Stopped", actionContext);
}
return UtilString.getString("lang:d=未知状态&en=Unknown", actionContext);
}
private void end(){
status = STATUS_FINISHED;
if(schedule){
if(!(future.isDone() || future.isCancelled())){
future.cancel(false);
}
TaskManager.removeScheduleTask(this);
}else{
TaskManager.removeTask(this);
}
}
public void run(){
Thing thing = thingEntry.getThing();
try{
use();
if(status == STATUS_CANCELED || status == STATUS_FINISHED){
//取消和已经结束的都不应该再执行
end();
return;
}
if(status == STATUS_WAIT){
//只有等待执行的状态才能进入执行
status = STATUS_RUNNING;
}
}finally{
finish();
}
if(status == STATUS_RUNNING){
long start = System.currentTimeMillis();
try{
count++;
if(!schedule){
//普通任务的执行
normalTaskRun();
}else{
scheduleTaskRun();
}
}catch(Exception e){
Executor.error(TAG, "Task excute error, path=" + thing.getMetadata().getPath(), e);
}finally{
executeTime = executeTime + (System.currentTimeMillis() - start);
if(maxCount > 0 && count >= maxCount){
end();
}
}
}
}
/**
* 定时任务的执行。
*/
private void scheduleTaskRun(){
ActionContext ac = actionContext;
Thing thing = thingEntry.getThing();
if(ac == null){
ac = new ActionContext();
}
Bindings bindings = ac.push();
bindings.put("task", this);
try{
if(thing == null){
this.cancel(true);
return;
}
Object result = thing.doAction("doTask", ac, parameters);
if(callback){
bindings.put("result", result);
thing.doAction("callback", ac);
}
}finally{
ac.pop();
if(status == STATUS_CANCELED){
end();
}else{
//定时任务执行完毕后回到等待状态
status = STATUS_WAIT;
}
}
}
/**
* 普通任务的执行。
*/
private void normalTaskRun(){
ActionContext ac = actionContext;
Thing thing = thingEntry.getThing();
if(ac == null){
ac = new ActionContext();
}
Bindings bindings = ac.push();
bindings.put("task", this);
try{
Object result = thing.doAction("doTask", ac, parameters);
if(callback){
bindings.put("result", result);
thing.doAction("callback", ac);
}
}finally{
ac.pop();
//普通任务执行完毕就结束了
end();
}
}
public Thing getThing() {
return thingEntry.getThing();
}
public String getPath(){
Thing thing = thingEntry.getThing();
return thing.getMetadata().getPath();
}
public ActionContext getActionContext() {
return actionContext;
}
public void setActionContext(ActionContext actionContext) {
this.actionContext = actionContext;
}
public byte getStatus() {
return status;
}
public Future<?> getFuture() {
return future;
}
public void setFuture(Future<?> future) {
this.future = future;
}
public int getExecuteMaxCount() {
return maxCount;
}
public void setExecuteMaxCount(int executeCount) {
this.maxCount = executeCount;
}
public int getCount() {
return count;
}
public long getExecuteTime() {
return executeTime;
}
public String getExecuteTimeLabel(){
long days = executeTime / (24 * 3600000);
long time = executeTime % (24 * 3600000);
long hours = time / 3600000;
time = time % 3600000;
long minute = time / 60000;
time = time % 60000;
long second = time / 1000;
time = time % 1000;
String str = "";
if(days > 0){
str = days + UtilString.getString("lang:d=天&en= days", actionContext);
}
if(hours > 0){
str = str + hours + UtilString.getString("lang:d=小时&en= hours", actionContext);
}
if(minute > 0){
str = str + minute + UtilString.getString("lang:d=分钟&en= minutes", actionContext);
}
if(second > 0){
str = str + second + UtilString.getString("lang:d=秒&en= seconds", actionContext);
}
if(time > 0){
str = str + time + UtilString.getString("lang:d=毫秒&en= milliseconds", actionContext);
}
if(str.equals("")){
str = UtilString.getString("lang:d=小于1毫秒&en less 1 millisencond", actionContext);
}
return str;
}
public void setCount(int count) {
this.count = count;
}
public Map<String, Object> getParameters() {
return parameters;
}
public void setParameters(Map<String, Object> parameters) {
this.parameters = parameters;
}
public void putParameter(String key , Object value) {
this.parameters.put(key, value);
}
public void putParameterAll(Map<String, Object> values) {
this.parameters.putAll(values);
}
}
| 21.003731 | 115 | 0.645141 |
6e092156205802cec2f8902591f61bd14e906456 | 993 | package com.jess.arms.base;
import android.app.Application;
import com.jess.arms.base.delegate.AppDelegate;
import com.jess.arms.di.component.AppComponent;
/**
* 本项目由
* mvp
* +dagger2
* +retrofit
* +rxjava
* +androideventbus
* +butterknife组成
* 请配合官方wiki文档https://github.com/JessYanCoding/MVPArms/wiki,学习本框架
*/
public class BaseApplication extends Application implements App {
private AppDelegate mAppDelegate;
@Override
public void onCreate() {
super.onCreate();
this.mAppDelegate = new AppDelegate(this);
this.mAppDelegate.onCreate();
}
/**
* 程序终止的时候执行
*/
@Override
public void onTerminate() {
super.onTerminate();
this.mAppDelegate.onTerminate();
}
/**
* 将AppComponent返回出去,供其它地方使用, AppComponent接口中声明的方法返回的实例,在getAppComponent()拿到对象后都可以直接使用
*
* @return
*/
@Override
public AppComponent getAppComponent() {
return mAppDelegate.getAppComponent();
}
}
| 19.86 | 90 | 0.66566 |
6013f2d7b9640394a88f5563eeead9833642b263 | 296 | package de.accso.ecommerce.billing.infrastructure.messaging;
import de.accso.ecommerce.billing.core.application.BillingMessaging;
import de.accso.ecommerce.common.Event;
public class KafkaBillingMessaging implements BillingMessaging {
@Override
public void send(Event event) {
}
}
| 24.666667 | 68 | 0.797297 |
56faee9f4e7ccc28bc209ebb5e3ec9205eb8a38f | 4,495 | /*******************************************************************************
* Copyright (c) 2015 - 2016 - 2016, Andreas Hefti, inarisoft@yahoo.de
*
* 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.inari.commons.event;
import com.inari.commons.lang.aspect.AspectGroup;
import com.inari.commons.lang.indexed.Indexed;
import com.inari.commons.lang.indexed.IndexedType;
import com.inari.commons.lang.indexed.IndexedTypeKey;
import com.inari.commons.lang.indexed.Indexer;
/** Base implementation of an Event handled by the {@link IEventDispatcher}.
* <p>
* Implement this for a specific Event type bound to a EventListener implementation (L)
* For example if a specified Event is needed to notify specified listener(s) creation and
* implementation of the following interfaces/classes are needed:
* <p>
* <pre>
* public interface TheEventListener {
*
* void onEvent( TheEvent event );
*
* }
*
* public class TheEvent extends Event<TheEventListener> {
*
* public final String anEventAttribute;
*
* public TheEvent( String anEventAttribute ) {
* super();
* this.anEventAttribute = anEventAttribute;
* }
*
* public final void notify( TheEventListener listener ) {
* listener.onEvent( this );
* }
* }
* </pre>
*
*
* @author andreas hefti
*
* @param <L> The type of EventListener the is interested in the specified Event.
*/
public abstract class Event<L> implements IndexedType, Indexed {
/** The {@link EventTypeKey} that specified type type of event */
protected final EventTypeKey indexedTypeKey;
protected Event( EventTypeKey indexedTypeKey ) {
this.indexedTypeKey = indexedTypeKey;
}
/** Use this to get the index/type id of the specified Event */
@Override
public final int index() {
return indexedTypeKey.index();
}
/** Use this to get the {@link EventTypeKey} that specified type type of event */
@Override
public final IndexedTypeKey indexedTypeKey() {
return indexedTypeKey;
}
/** Implements the notification of specified listener.
* For an implementation example have a look at the class documentation example
*
* @param listener the listener to notify.
*/
protected abstract void notify( final L listener );
/** This is called within the IEventDispatcher after the Event has passed all its listeners and can be restored.
* Useful for event pooling.
* This is an empty implementation and does nothing. Override this to get notified on restore
*/
protected void restore() {
// This is an empty implementation and does nothing. Override this to get notified on restore
}
/** This is internally used to create index for specified event type */
protected static final EventTypeKey createTypeKey( Class<? extends Event<?>> type ) {
return Indexer.createIndexedTypeKey( EventTypeKey.class, type );
}
/** Use this to get the EventTypeKey for e given Event class type */
public static final EventTypeKey getTypeKey( Class<? extends Event<?>> type ) {
return Indexer.getIndexedTypeKey( EventTypeKey.class, type );
}
/** Defines a type key for a specified event.
* This is used for indexing the event types.
*/
public static final class EventTypeKey extends IndexedTypeKey {
private static final AspectGroup ASPECT_GROUP = new AspectGroup( "EventTypeKey" );
EventTypeKey( Class<? extends Event<?>> indexedType ) {
super( indexedType );
}
@Override
public final Class<?> baseType() {
return Event.class;
}
@Override
public final AspectGroup aspectGroup() {
return ASPECT_GROUP;
}
}
}
| 35.393701 | 116 | 0.646496 |
6226b78a9d21add7e54e210080b75e90236fdc5d | 16,817 | /**
* Copyright (c) 2009, Christian Schneider
* 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 names of the authors 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 name.cs.csutils;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URI;
import java.net.URL;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import name.cs.csutils.Platform.OS;
public class Launcher {
private static Log log = LogFactory.getLog(Launcher.class);
private static Launcher INSTANCE = newInstance();
private static Launcher PREFERRED_LAUNCHER;
static {
if (Platform.isFlavor(OS.UnixFlavor)) {
PREFERRED_LAUNCHER = null;
} else {
PREFERRED_LAUNCHER = new Java6Launcher();
}
}
private static Launcher newInstance() {
if (Platform.isFlavor(OS.UnixFlavor)) {
return new UnixBrowserLauncher();
} else if (Platform.isFlavor(OS.MacOSFlavor)) {
return new MacBrowserLauncher();
} else if (Platform.isFlavor(OS.WindowsFlavor)) {
return new WindowsBrowserLauncher();
} else {
// no support
return new Launcher();
}
}
// hide constructor
private Launcher() {
super();
}
public static Launcher getInstance() {
return Launcher.INSTANCE;
}
/**
* @throws NullPointerException the argument is null
* @throws IllegalArgumentException the argument is null
* @param url
* @return
*/
public boolean launchURL(URL url) {
if (Launcher.PREFERRED_LAUNCHER == null) {
return false;
}
return Launcher.PREFERRED_LAUNCHER.launchURL(url);
}
public boolean isLaunchURLSupported() {
if (Launcher.PREFERRED_LAUNCHER == null) {
return false;
}
return Launcher.PREFERRED_LAUNCHER.isLaunchURLSupported();
}
public boolean launchMailto(URI mailtoURI) {
if (Launcher.PREFERRED_LAUNCHER == null) {
return false;
}
return Launcher.PREFERRED_LAUNCHER.launchMailto(mailtoURI);
}
public boolean isLaunchMailtoSupported() {
if (Launcher.PREFERRED_LAUNCHER == null) {
return false;
}
return Launcher.PREFERRED_LAUNCHER.isLaunchMailtoSupported();
}
private static boolean exec(String ... command) {
Process proc = null;
CSUtils.ProcessResult res = null;
try {
proc = new ProcessBuilder(command).start();
res = CSUtils.waitFor(proc, 6000, 10);
return !res.timeout && res.status == 0;
} catch (Exception ex) {
return false;
} finally {
if (proc != null) {
proc.destroy();
}
if (res != null && res.interrupted) {
Thread.currentThread().interrupt();
}
}
}
private final static class WindowsBrowserLauncher extends Launcher {
@Override
public boolean launchURL(URL url) {
if (super.launchURL(url)) {
return true;
}
return Launcher.exec(
"rundll32.exe", "url.dll,FileProtocolHandler",
url.toExternalForm());
}
@Override
public boolean isLaunchURLSupported() {
return true;
}
}
private final static class MacBrowserLauncher extends Launcher {
private static Log log = LogFactory.getLog(MacBrowserLauncher.class);
private static final String CLASS_FILEMANAGER = "com.apple.eio.FileManager";
@Override
public boolean launchURL(URL url) {
if (super.launchURL(url)) {
return true;
}
// try first launch-method
try {
Class<?> fileManager = Class.forName(CLASS_FILEMANAGER);
Method openURL = fileManager.getDeclaredMethod("openURL", new Class[] {String.class});
openURL.invoke(null, new Object[] {url.toExternalForm()});
return true;
} catch (ClassNotFoundException ex) {
if (log.isDebugEnabled()) {
log.debug("Could not launch url with "+CLASS_FILEMANAGER+". (Class not found)");
}
} catch (NoSuchMethodException ex) {
if (log.isDebugEnabled()) {
log.debug("Could not launch url with "+CLASS_FILEMANAGER
+". (openURL(java.lang.String) Method not found)");
}
} catch (IllegalAccessException ex) {
if (log.isErrorEnabled()) {
log.error("Could not launch url with "+CLASS_FILEMANAGER,
ex);
}
} catch (InvocationTargetException ex) {
if (log.isErrorEnabled()) {
log.error("Could not launch url with "+CLASS_FILEMANAGER,
ex.getTargetException());
}
} catch (RuntimeException ex) {
// no op
}
// try second launch-method
return Launcher.exec("open", url.toExternalForm());
}
@Override
public boolean isLaunchURLSupported() {
return true;
}
}
private final static class UnixBrowserLauncher extends Launcher {
private Boolean launchURLSupported = null;
// GNOME_DESKTOP_SESSION_ID
// $KDE_FULL_SESSION == 'true'
// $BROWSER
private boolean which(String executable) {
return Launcher.exec("which", executable);
}
private boolean launchURL_BROWSER_ENV_VARIABLE(String url) {
String BROWSER = System.getenv("BROWSER");
return (BROWSER != null) && Launcher.exec(BROWSER, url);
}
@Override
public synchronized boolean launchURL(URL url) {
if (super.launchURL(url)) {
return true;
}
if (!isUnixLaunchURLSupported()) {
return false;
}
final String u = url.toExternalForm();
if (which("xdg-open")
&& Launcher.exec("xdg-open", u)) {
return true;
} else if (launchURL_BROWSER_ENV_VARIABLE(u)) { // $BROWSER
return true;
// note: kfmclient openURL blocks and we don't get a return status == 0
// although the browser window may be opened.
// However kfmclient exec seems to work.
} else if (Platform.maybeDeskopKDE() && which("kfmclient")
&& Launcher.exec("kfmclient", "exec", u)) { // KDE
return true;
} else if (Platform.maybeDeskopGnome() && which("gnome-open")
&& Launcher.exec("gnome-open", u)) { // Gnome
return true;
}
// still not launched, find a browser
// TODO we should try the other browsers in case exec failed
// but this may cause multiple browser windows opening
if (which("firefox")) {
return Launcher.exec("firefox", u);
} else if (which("mozilla")) {
return Launcher.exec("mozilla", u);
} else if (which("konqueror")) {
return Launcher.exec("konqueror", u);
} else if (which("opera")) {
return Launcher.exec("opera", u);
} else if (which("epiphany")) {
return Launcher.exec("epiphany", u);
} else if (which("galeon")) {
return Launcher.exec("galeon", u);
} else if (which("netscape")) {
return Launcher.exec("netscape", "-remote", "openURL("+u+",new-window)");
}
return false;
}
@Override
public boolean isLaunchURLSupported() {
if (super.isLaunchURLSupported()) {
return true;
}
return isUnixLaunchURLSupported();
}
//kfmclient exec mailto:name@example.com
private synchronized boolean isUnixLaunchURLSupported() {
if (super.isLaunchURLSupported()) {
return true;
}
if (launchURLSupported != null) {
return launchURLSupported.booleanValue();
}
// we rely on the 'which' command
if (!which("which")) {
launchURLSupported = Boolean.FALSE;
return false;
}
if (which("xdg-open")) {
launchURLSupported = Boolean.TRUE;
return true;
}
if (System.getenv("BROWSER")!=null) { // $BROWSER
launchURLSupported = Boolean.TRUE;
return true;
} else { // KDE
if (Platform.maybeDeskopKDE() && which("kfmclient")) {
launchURLSupported = Boolean.TRUE;
return true;
}
if (Platform.maybeDeskopGnome() && which("gnome-open")) {
launchURLSupported = Boolean.TRUE;
return true;
}
String[] commands = {
"firefox", "mozilla",
"konqueror", "epiphany", "opera", "galeon",
"netscape"
};
for (String command: commands) {
if (which(command)) {
launchURLSupported = Boolean.TRUE;
return true;
}
}
if (launchURLSupported == null) {
launchURLSupported = Boolean.FALSE;
}
}
return launchURLSupported.booleanValue();
}
@Override
public boolean launchMailto(URI mailtoURI) {
if (super.launchMailto(mailtoURI)) {
return true;
}
if (Platform.maybeDeskopKDE()
&& Launcher.exec("kfmclient", "exec", mailtoURI.toString())) {
return true;
}
return false;
}
}
private static class Java6Launcher extends Launcher {
private boolean launchURL(URL url, boolean test) {
System.out.println(url);
try {
// get the java.awt.Desktop class and test if this feature
// is supported
Class<?> classDesktop = Class.forName("java.awt.Desktop");
final boolean isDesktopSupported = Boolean.TRUE.equals(
classDesktop.getMethod("isDesktopSupported").invoke(null)
);
if (!isDesktopSupported) {
return false;
}
// get the java.awt.Desktop instance
Object objDesktop = classDesktop.getMethod("getDesktop").invoke(null);
// get the java.awt.Desktop$Action.BROWSE enum constant
Class<?> enumAction = Class.forName("java.awt.Desktop$Action");
Object[] enumConstants = enumAction.getEnumConstants();
if (enumConstants == null) {
return false;
}
// test if the browse action is supported
boolean browseSupported = false;
for (Object enumConstant: enumConstants) {
if ("BROWSE".equals(enumConstant.toString())) {
browseSupported = Boolean.TRUE.equals(
classDesktop.getMethod("isSupported", enumAction)
.invoke(objDesktop, enumConstant));
break;
}
}
if (!browseSupported) {
return false;
}
if (!test) {
// call browse
classDesktop.getMethod("browse", URI.class)
.invoke(objDesktop, url.toURI());
}
return true;
} catch (Throwable th) {
return false;
}
}
private boolean launchMailto(URI mailtoURI, boolean test) {
try {
// get the java.awt.Desktop class and test if this feature
// is supported
Class<?> classDesktop = Class.forName("java.awt.Desktop");
final boolean isDesktopSupported = Boolean.TRUE.equals(
classDesktop.getMethod("isDesktopSupported")
.invoke(null, new Object[0])
);
if (!isDesktopSupported) {
return false;
}
// get the java.awt.Desktop instance
Object objDesktop = classDesktop.getMethod("getDesktop").invoke(null);
// get the java.awt.Desktop$Action.BROWSE enum constant
Class<?> enumAction = Class.forName("java.awt.Desktop$Action");
Object[] enumConstants = enumAction.getEnumConstants();
if (enumConstants == null) {
return false;
}
// test if the browse action is supported
boolean browseSupported = false;
for (Object enumConstant: enumConstants) {
if ("MAIL".equals(enumConstant.toString())) {
browseSupported = Boolean.TRUE.equals(
classDesktop.getMethod("isSupported", enumAction)
.invoke(objDesktop, enumConstant));
break;
}
}
if (!browseSupported) {
return false;
}
if (!test) {
// call browse
classDesktop.getMethod("mail", URI.class)
.invoke(objDesktop, mailtoURI);
}
return true;
} catch (Throwable th) {
if (log.isErrorEnabled()) {
log.error("launching URI:'"+mailtoURI+"' failed", th);
}
return false;
}
}
@Override
public boolean launchURL(URL url) {
if (url == null) {
throw new IllegalArgumentException("url==null");
}
return launchURL(url, false);
}
@Override
public boolean isLaunchURLSupported() {
return launchURL(null, true);
}
@Override
public boolean launchMailto(URI mailtoURI) {
return launchMailto(mailtoURI, false);
}
@Override
public boolean isLaunchMailtoSupported() {
return launchMailto(null, true);
}
}
}
| 36.165591 | 102 | 0.521734 |
1c5d3e4bf1f8ecd42cc5976b512a68a4b5ccbf25 | 3,303 |
package ohtu.lukuvinkkikirjasto.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import ohtu.lukuvinkkikirjasto.database.Database;
import ohtu.lukuvinkkikirjasto.hint.Hint;
import ohtu.lukuvinkkikirjasto.hint.HintClass;
import ohtu.lukuvinkkikirjasto.maker.Maker;
public class SQLMakerHintAssociationTable implements MakerHintAssociationTable {
private Database database;
public SQLMakerHintAssociationTable(Database database) throws Exception {
this.database = database;
try (Connection connection = this.database.getConnection()) {
connection
.prepareStatement("CREATE TABLE IF NOT EXISTS TekijaVinkki (tekija_id INTEGER REFERENCES Tekija (id), vinkki_id INTEGER REFERENCES Vinkki (id), PRIMARY KEY (tekija_id, vinkki_id))")
.execute();
}
}
@Override
public List<Maker> findAForB(HintClass object) throws Exception {
try (Connection connection = database.getConnection()) {
PreparedStatement stmt = connection.prepareStatement("SELECT id, tekija FROM Tekija, TekijaVinkki WHERE TekijaVinkki.vinkki_id = ? AND TekijaVinkki.tekija_id = Tekija.id");
stmt.setInt(1, object.getID());
ResultSet rs = stmt.executeQuery();
List<Maker> results = new ArrayList<>();
while (rs.next()) {
results.add(new Maker(rs.getInt("id"), rs.getString("tekija")));
}
return results;
}
}
@Override
public List<HintClass> findBForA(Maker object) throws Exception {
try (Connection connection = database.getConnection()) {
PreparedStatement stmt = connection.prepareStatement("SELECT id, otsikko, kommentti, url, luettu_aikaleima FROM Vinkki, TekijaVinkki WHERE TekijaVinkki.tekija_id = ? AND TekijaVinkki.vinkki_id = Vinkki.id");
stmt.setInt(1, object.getID());
ResultSet rs = stmt.executeQuery();
List<HintClass> results = new ArrayList<>();
while (rs.next()) {
results.add(new HintClass(rs.getInt("id"), rs.getString("otsikko"), rs.getString("kommentti"), rs.getString("url"), rs.getTimestamp("luettu_aikaleima")));
}
return results;
}
}
@Override
public void associate(Maker maker, HintClass hint) throws Exception {
try (Connection connection = database.getConnection()) {
PreparedStatement stmt = connection.prepareStatement("INSERT INTO TekijaVinkki (tekija_id, vinkki_id) VALUES (?, ?)");
stmt.setInt(1, maker.getID());
stmt.setInt(2, hint.getID());
stmt.execute();
}
}
@Override
public void unassociate(Maker maker, HintClass hint) throws Exception {
try (Connection connection = database.getConnection()) {
PreparedStatement stmt = connection.prepareStatement("DELETE FROM TekijaVinkki WHERE tekija_id = ? AND vinkki_id = ?");
stmt.setInt(1, maker.getID());
stmt.setInt(2, hint.getID());
stmt.execute();
}
}
} | 38.858824 | 219 | 0.635786 |
d3c62623467bcc0f2dea10af6f1afb162c4faf60 | 3,595 | /*
* Copyright 2017 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jbpm.process.instance.impl;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;
import org.kie.internal.process.CorrelationKey;
import org.kie.api.runtime.process.ProcessInstance;
import org.jbpm.process.instance.ProcessInstanceManager;
public class DefaultProcessInstanceManager implements ProcessInstanceManager {
private Map<Long, ProcessInstance> processInstances = new ConcurrentHashMap<Long, ProcessInstance>();
private Map<CorrelationKey, ProcessInstance> processInstancesByCorrelationKey = new ConcurrentHashMap<CorrelationKey, ProcessInstance>();
private AtomicLong processCounter = new AtomicLong(0);
public void addProcessInstance(ProcessInstance processInstance, CorrelationKey correlationKey) {
((org.jbpm.process.instance.ProcessInstance) processInstance).setId(processCounter.incrementAndGet());
internalAddProcessInstance(processInstance);
if (correlationKey != null) {
if (processInstancesByCorrelationKey.containsKey(correlationKey)) {
throw new RuntimeException(correlationKey + " already exists");
}
processInstancesByCorrelationKey.put(correlationKey, processInstance);
}
}
public void internalAddProcessInstance(ProcessInstance processInstance) {
processInstances.put(((ProcessInstance)processInstance).getId(), processInstance);
}
public Collection<ProcessInstance> getProcessInstances() {
return Collections.unmodifiableCollection(processInstances.values());
}
public ProcessInstance getProcessInstance(long id) {
return (ProcessInstance) processInstances.get(id);
}
public ProcessInstance getProcessInstance(long id, boolean readOnly) {
return (ProcessInstance) processInstances.get(id);
}
public void removeProcessInstance(ProcessInstance processInstance) {
internalRemoveProcessInstance(processInstance);
}
public void internalRemoveProcessInstance(ProcessInstance processInstance) {
processInstances.remove(((ProcessInstance)processInstance).getId());
for (Entry<CorrelationKey, ProcessInstance> entry : processInstancesByCorrelationKey.entrySet()) {
if (entry.getValue().getId() == processInstance.getId()) {
processInstancesByCorrelationKey.remove(entry.getKey());
}
}
}
public void clearProcessInstances() {
processInstances.clear();
}
public void clearProcessInstancesState() {
}
@Override
public ProcessInstance getProcessInstance(CorrelationKey correlationKey) {
return processInstancesByCorrelationKey.get(correlationKey);
}
public void setProcessCounter(AtomicLong processCounter) {
this.processCounter = processCounter;
}
}
| 38.244681 | 141 | 0.739638 |
8e6a53c2535951973f2177fcc6af49f91eecc0b9 | 277 | package com.neueda.q4j.message;
//@RunWith(Cucumber.class)
//@CucumberOptions(plugin = {"pretty", "html:target/cucumber"}, features = "src/test/resources/scenarios/NeuedaFixFailOnValue.feature", glue= "com.neueda.etiqet.fixture")
public class RunNeuedaFixFailOnValueTest {
}
| 34.625 | 170 | 0.776173 |
69b1779e805372fcceadd116dda33fa0dcfbecc3 | 5,729 | /*
* 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.metron.rest.controller;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import org.apache.metron.indexing.dao.metaalert.MetaAlertStatus;
import org.apache.metron.indexing.dao.metaalert.MetaAlertAddRemoveRequest;
import org.apache.metron.indexing.dao.metaalert.MetaAlertCreateRequest;
import org.apache.metron.indexing.dao.search.SearchResponse;
import org.apache.metron.indexing.dao.update.Document;
import org.apache.metron.rest.RestException;
import org.apache.metron.rest.service.MetaAlertService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/v1/metaalert")
public class MetaAlertController {
@Autowired
private MetaAlertService metaAlertService;
@ApiOperation(value = "Get all meta alerts that contain an alert.")
@ApiResponse(message = "Search results", code = 200)
@RequestMapping(value = "/searchByAlert", method = RequestMethod.POST)
ResponseEntity<SearchResponse> searchByAlert(
@ApiParam(name = "guid", value = "Alert GUID", required = true)
@RequestBody final String guid
) throws RestException {
return new ResponseEntity<>(metaAlertService.getAllMetaAlertsForAlert(guid), HttpStatus.OK);
}
@ApiOperation(value = "Creates a new meta alert from a list of existing alerts. "
+ "The meta alert status will initially be set to 'ACTIVE' and summary statistics "
+ "will be computed from the list of alerts. A list of groups included in the request are also added to the meta alert.")
@ApiResponse(message = "Returns the complete document of the created metaalert.", code = 200)
@RequestMapping(value = "/create", method = RequestMethod.POST)
ResponseEntity<Document> create(
@ApiParam(name = "createRequest", value = "Meta alert create request which includes a list of alert "
+ "get requests and a list of custom groups used to annotate a meta alert", required = true)
@RequestBody final MetaAlertCreateRequest createRequest
) throws RestException {
return new ResponseEntity<>(metaAlertService.create(createRequest), HttpStatus.OK);
}
@ApiOperation(value = "Adds an alert to an existing meta alert. An alert will not be added if it is already contained in a meta alert.")
@ApiResponse(message = "Returns the complete metaalert document with the alerts added.", code = 200)
@RequestMapping(value = "/add/alert", method = RequestMethod.POST)
ResponseEntity<Document> addAlertsToMetaAlert(
@ApiParam(name = "metaAlertAddRemoveRequest", value = "Meta alert add request which includes a meta alert GUID and list of alert get requests", required = true)
@RequestBody final MetaAlertAddRemoveRequest metaAlertAddRemoveRequest
) throws RestException {
return new ResponseEntity<>(metaAlertService.addAlertsToMetaAlert(metaAlertAddRemoveRequest), HttpStatus.OK);
}
@ApiOperation(value = "Removes an alert from an existing meta alert. If the alert to be removed is not in a meta alert, 'false' will be returned.")
@ApiResponse(message = "Returns the complete metaalert document with the alerts removed.", code = 200)
@RequestMapping(value = "/remove/alert", method = RequestMethod.POST)
ResponseEntity<Document> removeAlertsFromMetaAlert(
@ApiParam(name = "metaAlertAddRemoveRequest", value = "Meta alert remove request which includes a meta alert GUID and list of alert get requests", required = true)
@RequestBody final MetaAlertAddRemoveRequest metaAlertAddRemoveRequest
) throws RestException {
return new ResponseEntity<>(metaAlertService.removeAlertsFromMetaAlert(metaAlertAddRemoveRequest), HttpStatus.OK);
}
@ApiOperation(value = "Updates the status of a meta alert to either 'ACTIVE' or 'INACTIVE'.")
@ApiResponse(message = "Returns the complete metaalert document with the updated status.", code = 200)
@RequestMapping(value = "/update/status/{guid}/{status}", method = RequestMethod.POST)
ResponseEntity<Document> updateMetaAlertStatus(
final @ApiParam(name = "guid", value = "Meta alert GUID", required = true)
@PathVariable String guid,
final @ApiParam(name = "status", value = "Meta alert status with a value of either 'ACTIVE' or 'INACTIVE'", required = true)
@PathVariable String status) throws RestException {
return new ResponseEntity<>(metaAlertService.updateMetaAlertStatus(guid,
MetaAlertStatus.valueOf(status.toUpperCase())), HttpStatus.OK);
}
}
| 55.621359 | 169 | 0.769593 |
bab4e1a68cfd667b6d28954327d11e7308d2f4e8 | 4,185 | /*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Copyright @ 2015 Atlassian Pty Ltd
*
* 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 net.java.sip.communicator.impl.gui.main.chatroomslist.createforms;
import java.util.*;
import javax.swing.event.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
/**
* The <tt>CreateChatRoomWizardPage1</tt> is the first page of the
* "Create chat room" wizard. Contains the <tt>SelectAccountPanel</tt>, where
* the user should select the account, for which the new chat room will be
* created.
*
* @author Yana Stamcheva
*/
public class CreateChatRoomWizardPage1
implements WizardPage,
CellEditorListener
{
public static final String IDENTIFIER = "SELECT_ACCOUNT_PANEL";
private SelectAccountPanel selectAccountPanel;
private WizardContainer wizard;
/**
* Creates an instance of <tt>CreateChatRoomWizardPage1</tt>.
* @param wizard the parent wizard container
* @param newChatRoom the object that will collect the information through
* the wizard
* @param protocolProvidersList The list of available
* <tt>ProtocolProviderServices</tt>, from which the user could select.
*/
public CreateChatRoomWizardPage1(WizardContainer wizard,
NewChatRoom newChatRoom,
Iterator<ProtocolProviderService> protocolProvidersList)
{
this.wizard = wizard;
selectAccountPanel
= new SelectAccountPanel(newChatRoom, protocolProvidersList);
selectAccountPanel.addCheckBoxCellListener(this);
}
/**
* Before the panel is displayed checks the selections and enables the
* next button if a checkbox is already selected or disables it if
* nothing is selected.
*/
public void pageShowing()
{
setNextButtonAccordingToCheckBox();
}
/**
* Enables the next button when the user makes a choise and disables it
* if nothing is selected.
*/
private void setNextButtonAccordingToCheckBox()
{
if (selectAccountPanel.isRadioSelected())
this.wizard.setNextFinishButtonEnabled(true);
else
this.wizard.setNextFinishButtonEnabled(false);
}
/**
* When user canceled editing the next button is enabled or disabled
* depending on if the user has selected a check box or not.
*/
public void editingCanceled(ChangeEvent e)
{
setNextButtonAccordingToCheckBox();
}
/**
* When user stopped editing the next button is enabled or disabled
* depending on if the user has selected a check box or not.
*/
public void editingStopped(ChangeEvent e)
{
setNextButtonAccordingToCheckBox();
}
/**
* Returns the identifier of this wizard page.
*/
public Object getIdentifier()
{
return IDENTIFIER;
}
/**
* Returns the identifier of the next wizard page.
*/
public Object getNextPageIdentifier()
{
return CreateChatRoomWizardPage2.IDENTIFIER;
}
/**
* Returns the identifier of the back wizard page.
*/
public Object getBackPageIdentifier()
{
return IDENTIFIER;
}
/**
* Returns the form contained in this wizard page. In this case
*/
public Object getWizardForm()
{
return selectAccountPanel;
}
public void pageHiding()
{
}
public void pageShown()
{
}
public void commitPage()
{
selectAccountPanel.setSelectedAccount();
}
public void pageBack()
{
}
}
| 27 | 78 | 0.673118 |
44567a76d7f9931e5f538bf568f0dad71782ec2c | 136 | package cn.pomit.jpamapper.core.mapper;
import java.io.Serializable;
public interface JMapper<T, ID extends Serializable> {
}
| 17 | 55 | 0.742647 |
aa4f70664ac6a359834fbf802bc6c5a02ebc650d | 20,039 | package com.free.searcher;
import android.app.*;
import android.content.*;
import android.content.pm.*;
import android.graphics.*;
import android.os.*;
import android.text.TextUtils.*;
import android.util.*;
import android.view.*;
import android.view.View.*;
import android.widget.*;
import java.io.*;
import java.util.*;
import com.free.translation.*;
import com.free.searcher.R;
public class FolderChooserActivity extends Activity {
public static final String SELECTED_DIR = FolderChooserActivity.class.getPackage().getName() + ".selectedDir";
static final String MODE = "multiFiles";
// all selected file
private ArrayList<String> selectedFiles = new ArrayList<String>();
private ArrayList<String> curDirSelectedFiles = new ArrayList<String>();
private ArrayList<String> curDirUnSelectedFiles = new ArrayList<String>();
private ArrayList<String> srcFiles = new ArrayList<String>();;
String[] previousSelectedStr = new String[0];
private TextView dir = null;
private ListView listView1 = null;
private ListView listView2 = null;
String suffix = "";
boolean multiFiles = false;
ArrayAdapter srcAdapter;
ArrayAdapter destAdapter;
// Typeface tf;
FileObserver mFileObserver;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d("FolderChooserActivity onCreate", savedInstanceState + ".");
//setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
// Log.d("getApplication", getApplication().toString());
// Log.d("getApplicationInfo", getApplicationInfo().toString());
// Log.d("getApplicationContext", getApplicationContext().toString());
// Log.d("getWindow", getWindow().toString());
// Log.d("getWindowManager", getWindowManager().toString());
Point op = new Point();
getWindowManager().getDefaultDisplay().getSize(op);
// Log.d("getDefaultDisplay", getWindowManager().getDefaultDisplay() + ".");
// Log.d("op", op + ".");
// Log.d("getComponentName", getComponentName().toString());
// Log.d("getRequestedOrientation()", getRequestedOrientation() + ".");
if (op.x < op.y) {
setContentView(R.layout.activity_folder_chooser_vertical);
} else {
setContentView(R.layout.activity_folder_chooser);
}
dir = (TextView) findViewById(R.id.dir);
listView1 = (ListView) findViewById(R.id.files);
srcAdapter = new ArrayAdapter(this, R.layout.simple_list_item_activated_1, srcFiles);
listView1.setAdapter(srcAdapter);
listView1.setFastScrollEnabled(true);
listView1.setScrollBarStyle(0);
listView2 = (ListView) findViewById(R.id.selectedFiles);
listView2.setFastScrollEnabled(true);
listView2.setScrollBarStyle(0);
// tf = Typeface.createFromAsset(getAssets(), "fonts/DejaVuSerifCondensed.ttf");
setTitle(getIntent().getStringExtra(MainFragment.CHOOSER_TITLE));
suffix = getIntent().getStringExtra(MainFragment.SUFFIX);
Log.d("suffix", suffix);
multiFiles = getIntent().getBooleanExtra(MainFragment.MODE, true);
Log.d("multiFiles", multiFiles + "");
if (multiFiles) {
showToast("Long press to select folder.\nClick to select/unselect files or folders");
destAdapter = new ArrayAdapter(this, R.layout.simple_list_item_activated_1, selectedFiles);
listView2.setAdapter(destAdapter);
destAdapter.setup("", curDirUnSelectedFiles, null, multiFiles);
} else {
listView2.setVisibility(View.GONE);
findViewById(R.id.horizontalDivider1).setVisibility(View.GONE);
findViewById(R.id.horizontalDivider2).setVisibility(View.GONE);
findViewById(R.id.horizontalDivider3).setVisibility(View.GONE);
findViewById(R.id.horizontalDivider4).setVisibility(View.GONE);
findViewById(R.id.horizontalDivider5).setVisibility(View.GONE);
findViewById(R.id.add).setVisibility(View.GONE);
findViewById(R.id.addAll).setVisibility(View.GONE);
findViewById(R.id.remove).setVisibility(View.GONE);
findViewById(R.id.removeAll).setVisibility(View.GONE);
}
previousSelectedStr = getIntent().getStringArrayExtra(MainFragment.SELECTED_DIR);
Log.d("Folder onCreate", Util.arrayToString(previousSelectedStr, true, "\r\n"));
if (previousSelectedStr != null) {
Arrays.sort(previousSelectedStr);
if (previousSelectedStr.length > 0) {
File file = new File(previousSelectedStr[0]);
if (file.exists()) {
if (file.isDirectory() && file.getParentFile() == null) {
dir.setText(previousSelectedStr[0]);
changeDir(file);
} else {
dir.setText(file.getParent());
changeDir(file.getParentFile());
}
}
}
}
if (dir.getText() == null || dir.getText().toString().trim().length() == 0) {
File f = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
dir.setText(f.getAbsolutePath());
changeDir(f);
}
srcAdapter.setup(dir.getText().toString(), curDirSelectedFiles, selectedFiles, multiFiles);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.folder_chooser, menu);
return true;
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
Log.d("FolderChooserActivity onSaveInstanceState", outState + ".");
outState.putString("dirText", dir.getText().toString());
outState.putStringArrayList("srcFiles", srcFiles);
outState.putStringArrayList("selectedFiles", selectedFiles);
outState.putStringArrayList("curDirSelectedFiles", curDirSelectedFiles);
if (multiFiles) {
Log.d("curDirUnSelectedFiles", curDirUnSelectedFiles.toString());
outState.putStringArrayList("curDirUnSelectedFiles", curDirUnSelectedFiles);
}
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
Log.d("FolderChooserActivity onRestoreInstanceState", savedInstanceState + ".");
String dirText = savedInstanceState.getString("dirText");
dir.setText(dirText);
srcFiles.addAll(savedInstanceState.getStringArrayList("srcFiles"));
selectedFiles.addAll(savedInstanceState.getStringArrayList("selectedFiles"));
changeDir(new File(dirText));
curDirSelectedFiles.addAll(savedInstanceState.getStringArrayList("curDirSelectedFiles"));
if (multiFiles) {
curDirUnSelectedFiles.addAll(savedInstanceState.getStringArrayList("curDirUnSelectedFiles"));
Log.d("curDirUnSelectedFiles", curDirUnSelectedFiles.toString());
destAdapter.notifyDataSetChanged();
}
}
private void showToast(String st) {
Toast.makeText(this, st, Toast.LENGTH_LONG).show();
}
/**
* Sets up a FileObserver to watch the current directory.
*/
private FileObserver createFileObserver(String path) {
return new FileObserver(path, FileObserver.CREATE | FileObserver.DELETE
| FileObserver.MOVED_FROM | FileObserver.MOVED_TO) {
@Override
public void onEvent(int event, String path) {
debug("FileObserver received event %d", event);
final Activity activity = FolderChooserActivity.this;
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
refreshDirectory();
}
});
}
}
};
}
private void debug(String message, Object... args) {
Log.d("FolderChooserActivity", String.format(message, args));
}
/**
* Refresh the contents of the directory that is currently shown.
*/
private void refreshDirectory() {
changeDir(new File(dir.getText().toString()));
}
@Override
public void onPause() {
super.onPause();
if (mFileObserver != null) {
mFileObserver.stopWatching();
}
}
@Override
public void onResume() {
super.onResume();
if (mFileObserver != null) {
mFileObserver.startWatching();
}
}
/**
* Lưu danh sách file và thư mục trong curDir vào list, allFiles để hiển thị trong TextView List
* @param curDir
*/
private void changeDir(File curDir) {
dir.setText(curDir.getAbsolutePath());
// File[] files = curDir.listFiles();
List<File> files = FileUtil.fileFolderListing(curDir);
// Log.d("filesListing", Util.listToString(files, true, "\r\n"));
if (files != null) { // always dir, already checked
srcFiles.clear();
// tìm danh sách các file có ext thích hợp
// Log.d("SearchActivity.SUFFIX_FILES_CONVERTING", SearchActivity.SUFFIX_FILES_CONVERTING);
String[] suffixes = suffix.toLowerCase().split("; *");
Arrays.sort(suffixes);
for (File f : files) {
String fName = f.getName();
//Log.d("fName", fName);
if (f.isDirectory()) {
srcFiles.add(fName);
} else {
if (suffix.length() > 0) {
if (".*".equals(suffix)) {
srcFiles.add(fName);
} else {
int lastIndexOf = fName.lastIndexOf(".");
if (lastIndexOf >= 0) {
String ext = fName.substring(lastIndexOf);
boolean chosen =Arrays.binarySearch(suffixes, ext.toLowerCase()) >= 0;
if (chosen) {
srcFiles.add(fName);
}
}
}
}
}
}
// điền danh sách vào allFiles
Log.d("srcFiles.size()", "" + srcFiles.size());
} else {
srcFiles.clear();
}
curDirSelectedFiles.clear();
srcAdapter.dir = dir.getText().toString();
srcAdapter.notifyDataSetChanged();
listView1.setActivated(true);
listView1.smoothScrollToPositionFromTop(0, 0, 0);
}
public void up(View view) {
File curDir = new File(dir.getText().toString());
Log.d("curDir", curDir.getAbsolutePath());
File parentFile = curDir.getParentFile();
if (parentFile != null) {
Log.d("curDir.getParentFile()", parentFile.getAbsolutePath());
changeDir(parentFile);
}
}
public void removeFiles(View view) {
if (curDirUnSelectedFiles.size() > 0) {
if (multiFiles) {
selectedFiles.removeAll(curDirUnSelectedFiles);
} else {
selectedFiles.clear();
}
curDirUnSelectedFiles.clear();
destAdapter.notifyDataSetChanged();
srcAdapter.notifyDataSetChanged();
}
}
public void removeAllFiles(View view) {
selectedFiles.clear();
destAdapter.notifyDataSetChanged();
srcAdapter.notifyDataSetChanged();
}
public void addFiles(View view) {
if (curDirSelectedFiles.size() > 0) {
if (multiFiles) {
for (String st : curDirSelectedFiles) {
if (!selectedFiles.contains(st)) {
selectedFiles.add(st);
}
}
} else {
selectedFiles.clear();
selectedFiles.addAll(curDirSelectedFiles);
}
curDirSelectedFiles.clear();
srcAdapter.notifyDataSetChanged();
destAdapter.notifyDataSetChanged();
}
}
public void addAllFiles(View view) {
if (multiFiles) {
String dirSt = dir.getText().toString() + "/";
for (String st : srcFiles) {
String st2 = dirSt + st;
if (!selectedFiles.contains(st2)) {
selectedFiles.add(st2);
}
}
curDirSelectedFiles.clear();
srcAdapter.notifyDataSetChanged();
destAdapter.notifyDataSetChanged();
} else {
String dirSt = dir.getText().toString() + "/";
if (srcFiles.size() == 1
&& new File(dirSt, srcFiles.get(0)).isFile()) {
selectedFiles.clear();
selectedFiles.add(dirSt + srcFiles.get(0));
curDirSelectedFiles.clear();
srcAdapter.notifyDataSetChanged();
destAdapter.notifyDataSetChanged();
}
}
}
public void ok(View view) {
// if (currentSelectedList.size() == 0 && multiFiles) {
// currentSelectedList.add(new File(dir.getText().toString()));
// } else
if (selectedFiles.size() == 0 && curDirSelectedFiles.size() == 0 && !multiFiles && suffix.length() > 0) {
Toast.makeText(this, "Please select a file", Toast.LENGTH_LONG).show();
return;
}
Log.d("selected file", Util.collectionToString(selectedFiles, false, "\r\n"));
String[] fileArr = null;
if (multiFiles) {
if (selectedFiles.size() > 0) {
fileArr = new String[selectedFiles.size()];
selectedFiles.toArray(fileArr);
Arrays.sort(fileArr);
} else if (curDirSelectedFiles.size() > 0) {
fileArr = new String[curDirSelectedFiles.size()];
curDirSelectedFiles.toArray(fileArr);
Arrays.sort(fileArr);
} else {
fileArr = new String[] {dir.getText().toString()};
}
} else {
if (curDirSelectedFiles.size() > 0) {
fileArr = new String[] {curDirSelectedFiles.get(0)};
} else {
fileArr = new String[] {dir.getText().toString()};
}
}
Intent intent = this.getIntent();
intent.putExtra(SELECTED_DIR, fileArr);
intent.putExtra(MODE, multiFiles);
setResult(RESULT_OK, intent);
this.finish();
}
public void cancel(View view) {
Log.d("select previous file", Util.arrayToString(previousSelectedStr, true, "\r\n"));
Intent intent = this.getIntent();
Arrays.sort(previousSelectedStr);
intent.putExtra(SELECTED_DIR, previousSelectedStr);
intent.putExtra(MODE, multiFiles);
setResult(RESULT_CANCELED, intent);
this.finish();
}
class ArrayAdapter extends android.widget.ArrayAdapter<String> implements OnLongClickListener, OnClickListener {
private View selectedTV = null;
private static final int LIGHT_BROWN = 0xFFFFE6D9;
private static final int LIGHT_YELLOW = 0xFFFFFFF0;
private static final int LIGHT_YELLOW2 = 0xFFFFF8D9;
private static final int LIGHT_YELLOW3 = 0xFFF7C0C1;
private List<String> dataset;
private String dir;
private List<String> curSelectedFiles;
private List<String> oppoSelect;
private boolean multiFiles;
public ArrayAdapter(Context context, int textViewResourceId,
List<String> objects) {
super(context, textViewResourceId, objects);
dataset = objects;
}
public void setup(String dir, List<String> curSelect, List<String> oppoSelect, boolean multi) {
this.dir = dir;
this.curSelectedFiles = curSelect;
this.oppoSelect = oppoSelect;
this.multiFiles = multi;
}
public View getView(int position, View convertView, ViewGroup parent) {
TextView text;
if (convertView != null) {
text = (TextView) convertView;
} else {
text = new TextView(getContext());
// text.setLayoutParams(new GridView.LayoutParams(GridView.LayoutParams.MATCH_PARENT,
// GridView.LayoutParams.WRAP_CONTENT));
text.setMinHeight(36);
text.setEnabled(true);
text.setClickable(true);
text.setLongClickable(true);
text.setTextSize(14);
text.setPadding(10, 11, 10, 11);
text.setSingleLine();
text.setHorizontallyScrolling(true);
if (dir.length() > 0) {
text.setEllipsize(TruncateAt.MIDDLE);
} else {
text.setEllipsize(TruncateAt.START);
}
text.setOnLongClickListener(this);
text.setOnClickListener(this);
}
String fileName = getItem(position);
text.setText((CharSequence)fileName);
File f = new File(dir, fileName);
if (f.isDirectory()) {
text.setTypeface(Typeface.DEFAULT);
text.setTextColor(Color.BLUE);
} else {
text.setTypeface(Typeface.DEFAULT);
text.setTextColor(Color.BLACK);
}
String fPath = f.getAbsolutePath();
boolean inSelectedFiles = false;
boolean isPartial = false;
if (oppoSelect != null)
for (String st : oppoSelect) {
if (st.equals(fPath) || fPath.startsWith(st + "/")) {
inSelectedFiles = true;
break;
} else if (st.startsWith(fPath + "/")) {
isPartial = true;
}
}
//Log.d("f.getAbsolutePath()", f.getAbsolutePath());
//Log.d("curSelectedFiles", curSelectedFiles.toString());
if (inSelectedFiles) {
text.setBackgroundColor(LIGHT_YELLOW2);
} else if (curSelectedFiles.contains(fPath)) {
text.setBackgroundColor(LIGHT_BROWN);
} else if (isPartial) {
text.setBackgroundColor(LIGHT_YELLOW3);
} else {
text.setBackgroundColor(LIGHT_YELLOW);
}
return text;
}
public void onClick(View v) {
String fileName = ((TextView) v).getText().toString();
File f = new File(dir, fileName);
String fPath = f.getAbsolutePath();
Log.d("File onClick", fPath);
Log.d("currentSelectedList", Util.collectionToString(curSelectedFiles, true, "\r\n"));
Log.d("currentSelectedList.contains(f)", "" + curSelectedFiles.contains(f));
Log.d("multiFiles", "" + multiFiles);
Log.d("f.exists()", f.exists() + "");
if (f.exists()) {
boolean inSelectedFiles = false;
if (oppoSelect != null)
for (String st : oppoSelect) {
if (fPath.equals(st) || fPath.startsWith(st + "/")) {
inSelectedFiles = true;
break;
}
}
if (!inSelectedFiles) {
if (multiFiles || suffix.length() == 0) {
if (f.isDirectory() && curSelectedFiles.size() == 0 && dir.length() > 0) {
changeDir(f);
} else if (curSelectedFiles.contains(fPath)) {
curSelectedFiles.remove(fPath);
v.setBackgroundColor(LIGHT_YELLOW);
} else {
curSelectedFiles.add(fPath);
v.setBackgroundColor(LIGHT_BROWN);
}
} else {
if (f.isFile()) {
// chọn mới đầu tiên
if (curSelectedFiles.size() == 0) {
curSelectedFiles.add(fPath);
selectedTV = v;
v.setBackgroundColor(LIGHT_BROWN);
} else if (curSelectedFiles.size() > 0) {
if (curSelectedFiles.contains(fPath)) { // đã chọn
curSelectedFiles.clear();
v.setBackgroundColor(LIGHT_YELLOW);
selectedTV = null;
} else { // chọn mới bỏ cũ
curSelectedFiles.clear();
curSelectedFiles.add(fPath);
selectedTV.setBackgroundColor(LIGHT_YELLOW);
v.setBackgroundColor(LIGHT_BROWN);
selectedTV = v;
}
}
} else { // is Directory
curSelectedFiles.clear();
if (selectedTV != null) {
selectedTV.setBackgroundColor(LIGHT_YELLOW);
selectedTV = null;
}
if (dir.length() > 0) {
changeDir(f);
}
}
}
notifyDataSetChanged();
}
}
}
public boolean onLongClick(View v) {
String fileName = ((TextView) v).getText().toString();
File f = new File(dir, fileName);
String fPath = f.getAbsolutePath();
Log.d("File onLongClick", fPath);
Log.d("currentSelectedList", Util.collectionToString(curSelectedFiles, true, "\r\n"));
Log.d("currentSelectedList.contains(f)", "" + curSelectedFiles.contains(f));
Log.d("multiFiles", multiFiles + "");
boolean inSelectedFiles = false;
if (oppoSelect != null)
for (String st : oppoSelect) {
if (fPath.equals(st) || fPath.startsWith(st + "/")) {
inSelectedFiles = true;
break;
}
}
if (!inSelectedFiles) {
if (multiFiles || suffix.length() == 0) {
if (curSelectedFiles.contains(fPath)) {
curSelectedFiles.remove(fPath);
v.setBackgroundColor(LIGHT_YELLOW);
} else {
curSelectedFiles.add(fPath);
v.setBackgroundColor(LIGHT_BROWN);
}
} else { // single file
if (f.isFile()) {
// chọn mới đầu tiên
if (curSelectedFiles.size() == 0) {
curSelectedFiles.add(fPath);
selectedTV = v;
v.setBackgroundColor(LIGHT_BROWN);
} else if (curSelectedFiles.size() > 0) {
if (curSelectedFiles.contains(fPath)) {
// đã chọn
selectedTV = null;
v.setBackgroundColor(LIGHT_YELLOW);
curSelectedFiles.clear();
} else {
// chọn mới bỏ cũ
curSelectedFiles.clear();
curSelectedFiles.add(fPath);
selectedTV.setBackgroundColor(LIGHT_YELLOW);
v.setBackgroundColor(LIGHT_BROWN);
selectedTV = v;
}
}
} else { // is Directory
curSelectedFiles.clear();
if (selectedTV != null) {
selectedTV.setBackgroundColor(LIGHT_YELLOW);
selectedTV = null;
}
if (dir.length() > 0) {
changeDir(f);
}
}
}
notifyDataSetChanged();
}
return true;
}
}
}
| 33.122314 | 113 | 0.664754 |
0d398fdadd2d14f08d65ed299705e445b9714b5c | 396 | package com.github.davio.starter.sandbox;
import com.github.davio.starter.config.EnableMyConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@EnableMyConfig
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
| 24.75 | 68 | 0.79798 |
94290a81ef8625e404012ed689c3399ed1376c26 | 1,783 |
package com.google.sps.servlets;
import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.PreparedQuery;
import com.google.appengine.api.datastore.Query;
import com.google.appengine.api.datastore.Query.SortDirection;
import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.List;
import java.io.IOException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.google.sps.data.Comment;
import java.lang.Long;
/** Servlet that returns some example content. TODO: modify this file to handle comments data */
@WebServlet("/list-post")
public class ListCommentServlet extends HttpServlet {
private List<Comment> comments = new ArrayList<>();
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
Query query = new Query("Messages").addSort("timestamp", SortDirection.DESCENDING);
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
PreparedQuery results = datastore.prepare(query);
for (Entity entity : results.asIterable()) {
long id = entity.getKey().getId();
String com = (String) entity.getProperty("comment");
Double score = (double)(Long)entity.getProperty("score");
long timestamp = (long)entity.getProperty("timestamp");
Comment comment = new Comment(com, score);
comments.add(comment);
}
response.setContentType("application/json;");
response.getWriter().println(new Gson().toJson(comments));
}
} | 35.66 | 98 | 0.765003 |
090ad96b66c259e36cea52f933a250fb343079b2 | 4,059 | /*
* Copyright 2014, The Sporting Exchange Limited
*
* 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 uk.co.exemel.disco.netutil.nio.connected;
import uk.co.exemel.disco.core.api.transcription.Parameter;
import uk.co.exemel.disco.core.api.transcription.ParameterType;
import uk.co.exemel.disco.core.api.transcription.TranscribableParams;
import uk.co.exemel.disco.core.api.transcription.TranscriptionInput;
import uk.co.exemel.disco.core.api.transcription.TranscriptionOutput;
import com.betfair.platform.virtualheap.updates.Update;
import java.util.Set;
/**
*
*/
public class RemoveIndex extends AbstractUpdateAction {
private int parentId;
private int id;
private int index;
private transient Set<Integer> deallocatedIds;
private transient com.betfair.platform.virtualheap.updates.RemoveIndex heapRepresentation;
// used in transcription, change the ordering at your peril!
// add new fields at the end!
private static Parameter[] parameters = new Parameter[] {
new Parameter("parentId", ParameterType.create(int.class), true),
new Parameter("id", ParameterType.create(int.class), true),
new Parameter("index", ParameterType.create(int.class), true)
};
// only used for transcription
public RemoveIndex() {
}
public RemoveIndex(int parentId, int id, int index, Set<Integer> deallocatedIds) {
this.parentId = parentId;
this.id = id;
this.index = index;
this.deallocatedIds = deallocatedIds;
}
public RemoveIndex(com.betfair.platform.virtualheap.updates.RemoveIndex u) {
this(u.getParentId(), u.getId(), u.getIndex(), u.getDeallocatedIds());
this.heapRepresentation = u;
}
@Override
public void transcribe(TranscriptionOutput out, Set<TranscribableParams> params, boolean client) throws Exception {
out.writeObject(parentId, parameters[0], client);
out.writeObject(id, parameters[1], client);
out.writeObject(index, parameters[2], client);
// NOTE: add new fields at the end
}
@Override
public void transcribe(TranscriptionInput in, Set<TranscribableParams> params, boolean client) throws Exception {
parentId = (Integer) in.readObject(parameters[0], client);
id = (Integer) in.readObject(parameters[1], client);
index = (Integer) in.readObject(parameters[2], client);
// NOTE: add new fields at the end
}
@Override
public Parameter[] getParameters() {
return parameters;
}
@Override
public Update getHeapRepresentation() {
if (heapRepresentation == null) {
heapRepresentation = new com.betfair.platform.virtualheap.updates.RemoveIndex(parentId, id, index, deallocatedIds);
}
return heapRepresentation;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
RemoveIndex that = (RemoveIndex) o;
if (id != that.id) return false;
if (parentId != that.parentId) return false;
if (index != that.index) return false;
return true;
}
@Override
public int hashCode() {
int result = parentId;
result = 31 * result + id;
result = 31 * result + index;
return result;
}
@Override
public String toString() {
return "RemoveIndex{" +
"parentId=" + parentId +
", id=" + id +
'}';
}
}
| 33.270492 | 127 | 0.66913 |
a0f5c08b3db3102ee5fd6f9007791faaebba4164 | 2,387 | /*
* This file is part of MCAP-Annotate, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 - 2016 MinigameCore <http://minigamecore.github.io>
* Copyright (c) Contributors
*
* 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 io.github.minigamecore.mcap.annotate.catalog;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.SOURCE;
import org.spongepowered.api.CatalogType;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
/**
* Annotation marking a {@link CatalogType} implementation.
*/
@Documented
@Retention(SOURCE)
@Target(TYPE)
public @interface Catalog {
/**
* The {@link CatalogType} class.
*
* <p>
* Cannot be a {@link CatalogType} already provided by Sponge.
* </p>
*
* @return The CatalogType class.
*/
String catalogTypeClass();
/**
* The class containing the {@link #field()} for which the {@link CatalogType} value has to be changed.
*
* @return The container class.
*/
String containerClass();
/**
* The {@link CatalogType} field name.
*
* <p>
* The field should have {@code public static final} modifiers.
* </p>
*
* @return The field name.
*/
String field();
}
| 31.826667 | 107 | 0.704231 |
95c3b2d7aaf702aa8a558e553178578898fe03f4 | 2,218 | // Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package com.yoonjaepark.flutter_kakao_map;
import net.daum.mf.map.api.MapPOIItem;
import net.daum.mf.map.api.MapPoint;
import net.daum.mf.map.api.MapView;
/** Controller of a single Marker on the map. */
class MarkerController implements MarkerOptionsSink {
private final MapPOIItem marker;
private final int kakaoMapsTag;
private boolean consumeTapEvents;
MarkerController(MapPOIItem marker, boolean consumeTapEvents) {
this.marker = marker;
this.consumeTapEvents = consumeTapEvents;
this.kakaoMapsTag = marker.getTag();
}
void remove(MapView mapView) {
mapView.removePOIItem(marker);
}
@Override
public void setAlpha(float alpha) {
marker.setAlpha(alpha);
}
@Override
public void setAnchor(float u, float v) {
}
@Override
public void setConsumeTapEvents(boolean consumeTapEvents) {
this.consumeTapEvents = consumeTapEvents;
}
@Override
public void setDraggable(boolean draggable) {
marker.setDraggable(draggable);
}
@Override
public void setInfoWindowAnchor(float u, float v) {
}
@Override
public void setInfoWindowText(String title, String snippet) {
}
@Override
public void setPosition(MapPoint position) {
marker.setMapPoint(position);
}
@Override
public void setRotation(float rotation) {
marker.setRotation(rotation);
}
@Override
public void setMarkerType(int markerType) {
marker.setMarkerType(MapPOIItem.MarkerType.values()[markerType]);
}
@Override
public void setMarkerSelectedType(int markerSelectedType) {
marker.setSelectedMarkerType(MapPOIItem.MarkerType.values()[markerSelectedType]);
}
int getKakaoMapsMarkerId() {
return kakaoMapsTag;
}
boolean consumeTapEvents() {
return consumeTapEvents;
}
public void showInfoWindow() {
}
public void hideInfoWindow() {
}
public boolean isInfoWindowShown() {
return false;
}
}
| 23.849462 | 89 | 0.683048 |
0a11bcd62932c47559b6712b7d7bd7c9c5648900 | 5,304 | /*
* 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.yarn.server.resourcemanager.scheduler.capacity;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
public class CSQueuePreemption {
private final boolean preemptionDisabled;
// Indicates if the in-queue preemption setting is ever disabled within the
// hierarchy of this queue.
private final boolean intraQueuePreemptionDisabledInHierarchy;
public CSQueuePreemption(
CSQueue queue,
CapacitySchedulerContext csContext,
CapacitySchedulerConfiguration configuration) {
this.preemptionDisabled = isQueueHierarchyPreemptionDisabled(queue, csContext, configuration);
this.intraQueuePreemptionDisabledInHierarchy =
isIntraQueueHierarchyPreemptionDisabled(queue, csContext, configuration);
}
/**
* The specified queue is cross-queue preemptable if system-wide cross-queue
* preemption is turned on unless any queue in the <em>qPath</em> hierarchy
* has explicitly turned cross-queue preemption off.
* NOTE: Cross-queue preemptability is inherited from a queue's parent.
*
* @param q queue to check preemption state
* @param csContext
* @param configuration capacity scheduler config
* @return true if queue has cross-queue preemption disabled, false otherwise
*/
private boolean isQueueHierarchyPreemptionDisabled(CSQueue q,
CapacitySchedulerContext csContext, CapacitySchedulerConfiguration configuration) {
boolean systemWidePreemption =
csContext.getConfiguration()
.getBoolean(YarnConfiguration.RM_SCHEDULER_ENABLE_MONITORS,
YarnConfiguration.DEFAULT_RM_SCHEDULER_ENABLE_MONITORS);
CSQueue parentQ = q.getParent();
// If the system-wide preemption switch is turned off, all of the queues in
// the qPath hierarchy have preemption disabled, so return true.
if (!systemWidePreemption) return true;
// If q is the root queue and the system-wide preemption switch is turned
// on, then q does not have preemption disabled (default=false, below)
// unless the preemption_disabled property is explicitly set.
if (parentQ == null) {
return configuration.getPreemptionDisabled(q.getQueuePath(), false);
}
// If this is not the root queue, inherit the default value for the
// preemption_disabled property from the parent. Preemptability will be
// inherited from the parent's hierarchy unless explicitly overridden at
// this level.
return configuration.getPreemptionDisabled(q.getQueuePath(),
parentQ.getPreemptionDisabled());
}
/**
* The specified queue is intra-queue preemptable if
* 1) system-wide intra-queue preemption is turned on
* 2) no queue in the <em>qPath</em> hierarchy has explicitly turned off intra
* queue preemption.
* NOTE: Intra-queue preemptability is inherited from a queue's parent.
*
* @param q queue to check intra-queue preemption state
* @param csContext
* @param configuration capacity scheduler config
* @return true if queue has intra-queue preemption disabled, false otherwise
*/
private boolean isIntraQueueHierarchyPreemptionDisabled(CSQueue q,
CapacitySchedulerContext csContext, CapacitySchedulerConfiguration configuration) {
boolean systemWideIntraQueuePreemption =
csContext.getConfiguration().getBoolean(
CapacitySchedulerConfiguration.INTRAQUEUE_PREEMPTION_ENABLED,
CapacitySchedulerConfiguration
.DEFAULT_INTRAQUEUE_PREEMPTION_ENABLED);
// Intra-queue preemption is disabled for this queue if the system-wide
// intra-queue preemption flag is false
if (!systemWideIntraQueuePreemption) return true;
// Check if this is the root queue and the root queue's intra-queue
// preemption disable switch is set
CSQueue parentQ = q.getParent();
if (parentQ == null) {
return configuration
.getIntraQueuePreemptionDisabled(q.getQueuePath(), false);
}
// At this point, the master preemption switch is enabled down to this
// queue's level. Determine whether intra-queue preemption is enabled
// down to this queue's level and return that value.
return configuration.getIntraQueuePreemptionDisabled(q.getQueuePath(),
parentQ.getIntraQueuePreemptionDisabledInHierarchy());
}
public boolean isIntraQueuePreemptionDisabledInHierarchy() {
return intraQueuePreemptionDisabledInHierarchy;
}
public boolean isPreemptionDisabled() {
return preemptionDisabled;
}
}
| 44.2 | 98 | 0.750377 |
81558566ea7e93282f7f836501855035a287d09c | 4,239 | /*******************************************************************************
* Copyright (c) 1998, 2015 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Oracle - initial API and implementation from Oracle TopLink
******************************************************************************/
package org.eclipse.persistence.tools.workbench.utility.classfile;
import java.io.IOException;
import org.eclipse.persistence.tools.workbench.utility.classfile.tools.ClassFileDataInputStream;
import org.eclipse.persistence.tools.workbench.utility.io.IndentingPrintWriter;
/**
* This class models a local variable table attribute:
* u2 attribute_name_index;
* u4 attribute_length;
* u2 local_variable_table_length;
* {
* u2 start_pc;
* u2 length;
* u2 name_index;
* u2 descriptor_index;
* u2 index;
* }[local_variable_table_length] local_variable_table;
*
* See "The Java Virtual Machine Specification" Chapter 4.
*/
public class LocalVariableTableAttribute extends Attribute {
private short count;
private LocalVariable[] localVariables;
/**
* Construct a local variable table attribute from the specified stream
* of byte codes.
*/
LocalVariableTableAttribute(ClassFileDataInputStream stream, short nameIndex, AttributePool pool) throws IOException {
super(stream, nameIndex, pool);
}
void initializeInfo(ClassFileDataInputStream stream) throws IOException {
this.count = stream.readU2();
short cnt = this.count;
this.localVariables = new LocalVariable[cnt];
LocalVariable[] variables = this.localVariables;
for (short i = 0; i < cnt; i++) {
variables[i] = new LocalVariable(stream, this.constantPool());
}
}
public void displayNameOn(IndentingPrintWriter writer) {
super.displayNameOn(writer);
writer.print(" (count: ");
writer.print(this.count);
writer.print(")");
}
void displayInfoStringOn(IndentingPrintWriter writer) {
short cnt = this.count;
LocalVariable[] variables = this.localVariables;
for (short i = 0; i < cnt; i++) {
writer.print(i);
writer.print(": ");
variables[i].displayStringOn(writer);
}
}
public String localVariableName(short index) {
return this.localVariables[index].name();
}
public LocalVariable localVariableNamed(String name) {
short cnt = this.count;
LocalVariable[] variables = this.localVariables;
for (short i = 0; i < cnt; i++) {
LocalVariable localVariable = variables[i];
if (localVariable.isNamed(name)) {
return localVariable;
}
}
return null;
}
public String[] localVariableNames() {
short cnt = this.count;
if (cnt == 0) {
return EMPTY_STRING_ARRAY;
}
String[] localVariableNames = new String[cnt];
for (short i = 0; i < cnt; i++) {
localVariableNames[i] = this.localVariableName(i);
}
return localVariableNames;
}
public void accept(Visitor visitor) {
visitor.visit(this);
short cnt = this.count;
LocalVariable[] variables = this.localVariables;
for (short i = 0; i < cnt; i++) {
variables[i].accept(visitor);
}
}
public short getCount() {
return this.count;
}
public LocalVariable[] getLocalVariables() {
return this.localVariables;
}
public LocalVariable getLocalVariable(short index) {
return this.localVariables[index];
}
void toString(StringBuffer sb) {
sb.append(this.count);
sb.append(" local variable(s)");
}
}
| 32.607692 | 122 | 0.617598 |
8bed35a4ad956517da7560d1511e33fc5b16e11e | 84,156 | // This file was generated by Mendix Modeler.
//
// WARNING: Code you write here will be lost the next time you deploy the project.
package scheduling.proxies;
public class TemplateRequest
{
private final com.mendix.systemwideinterfaces.core.IMendixObject templateRequestMendixObject;
private final com.mendix.systemwideinterfaces.core.IContext context;
/**
* Internal name of this entity
*/
public static final java.lang.String entityName = "Scheduling.TemplateRequest";
/**
* Enum describing members of this entity
*/
public enum MemberNames
{
TemplateRequestID("TemplateRequestID"),
ShortDescription("ShortDescription"),
DetailDescription("DetailDescription"),
DetailDescriptionNoHTML("DetailDescriptionNoHTML"),
FoundContract("FoundContract"),
SelectContractUsingDropDown("SelectContractUsingDropDown"),
FoundServiceProcess("FoundServiceProcess"),
SelectServiceProcessUsingDropDown("SelectServiceProcessUsingDropDown"),
FoundCI("FoundCI"),
SelectCIUsingDropDown("SelectCIUsingDropDown"),
FoundService("FoundService"),
SelectServiceUsingDropDown("SelectServiceUsingDropDown"),
FoundUIP("FoundUIP"),
FoundImpact("FoundImpact"),
FoundEmptyImpact("FoundEmptyImpact"),
SelectImpactUsingDropDown("SelectImpactUsingDropDown"),
FoundUrgency("FoundUrgency"),
FoundEmptyUrgency("FoundEmptyUrgency"),
SelectUrgencyUsingDropDown("SelectUrgencyUsingDropDown"),
FoundPriority("FoundPriority"),
FoundEmptyPriority("FoundEmptyPriority"),
SelectPriorityUsingDropDown("SelectPriorityUsingDropDown"),
FoundDeliveringOrganisation("FoundDeliveringOrganisation"),
SelectDeleveringOrganisationUsingDropDown("SelectDeleveringOrganisationUsingDropDown"),
ProcessType("ProcessType"),
CommitmentResolveTimeBy("CommitmentResolveTimeBy"),
TemplateRequestType("TemplateRequestType"),
CopyCartItems("CopyCartItems"),
CallingOnBehalfOf("CallingOnBehalfOf"),
UseLocation("UseLocation"),
UU95_CallerIsEmpty("UU95_CallerIsEmpty"),
SelectCIUsingDropDown_2("SelectCIUsingDropDown_2"),
SelectCIUsingDropDown_3("SelectCIUsingDropDown_3"),
TemplateRequest_Service_Process("Scheduling.TemplateRequest_Service_Process"),
TemplateRequest_Service("Scheduling.TemplateRequest_Service"),
TemplateRequest_Contract("Scheduling.TemplateRequest_Contract"),
TemplateRequest_Commitment("Scheduling.TemplateRequest_Commitment"),
TemplateRequest_IUP_Combination("Scheduling.TemplateRequest_IUP_Combination"),
TemplateRequest_Impact("Scheduling.TemplateRequest_Impact"),
TemplateRequest_Urgency("Scheduling.TemplateRequest_Urgency"),
TemplateRequest_Priority("Scheduling.TemplateRequest_Priority"),
TemplateRequest_Person("Scheduling.TemplateRequest_Person"),
TemplateRequest_Location("Scheduling.TemplateRequest_Location"),
Receiving_Organisation_TR("Scheduling.Receiving_Organisation_TR"),
Delivering_Organisation_TR("Scheduling.Delivering_Organisation_TR"),
TemplateRequest_Location_Caller("Scheduling.TemplateRequest_Location_Caller"),
TemplateRequest_Person_Caller("Scheduling.TemplateRequest_Person_Caller"),
TemplateRequest_ConfigurationItem("Scheduling.TemplateRequest_ConfigurationItem"),
TemplateRequests_Affected_Items("Scheduling.TemplateRequests_Affected_Items"),
TemplateRequest_Organisation_Caller("Scheduling.TemplateRequest_Organisation_Caller"),
TemplateRequest_Room("Scheduling.TemplateRequest_Room"),
TemplateRequest_Category_Opening("Scheduling.TemplateRequest_Category_Opening"),
TemplateRequest_ConfigurationItem_2("Scheduling.TemplateRequest_ConfigurationItem_2"),
TemplateRequest_ConfigurationItem_3("Scheduling.TemplateRequest_ConfigurationItem_3"),
TemplateRequest_AffectedUsers("Scheduling.TemplateRequest_AffectedUsers");
private java.lang.String metaName;
MemberNames(java.lang.String s)
{
metaName = s;
}
@Override
public java.lang.String toString()
{
return metaName;
}
}
public TemplateRequest(com.mendix.systemwideinterfaces.core.IContext context)
{
this(context, com.mendix.core.Core.instantiate(context, "Scheduling.TemplateRequest"));
}
protected TemplateRequest(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject templateRequestMendixObject)
{
if (templateRequestMendixObject == null)
throw new java.lang.IllegalArgumentException("The given object cannot be null.");
if (!com.mendix.core.Core.isSubClassOf("Scheduling.TemplateRequest", templateRequestMendixObject.getType()))
throw new java.lang.IllegalArgumentException("The given object is not a Scheduling.TemplateRequest");
this.templateRequestMendixObject = templateRequestMendixObject;
this.context = context;
}
/**
* @deprecated Use 'TemplateRequest.load(IContext, IMendixIdentifier)' instead.
*/
@Deprecated
public static scheduling.proxies.TemplateRequest initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException
{
return scheduling.proxies.TemplateRequest.load(context, mendixIdentifier);
}
/**
* Initialize a proxy using context (recommended). This context will be used for security checking when the get- and set-methods without context parameters are called.
* The get- and set-methods with context parameter should be used when for instance sudo access is necessary (IContext.createSudoClone() can be used to obtain sudo access).
*/
public static scheduling.proxies.TemplateRequest initialize(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixObject mendixObject)
{
if (com.mendix.core.Core.isSubClassOf("Scheduling.ScheduledTemplateRequest", mendixObject.getType()))
return scheduling.proxies.ScheduledTemplateRequest.initialize(context, mendixObject);
if (com.mendix.core.Core.isSubClassOf("Scheduling.TemplateTask", mendixObject.getType()))
return scheduling.proxies.TemplateTask.initialize(context, mendixObject);
if (com.mendix.core.Core.isSubClassOf("Scheduling.TemplateTicket", mendixObject.getType()))
return scheduling.proxies.TemplateTicket.initialize(context, mendixObject);
return new scheduling.proxies.TemplateRequest(context, mendixObject);
}
public static scheduling.proxies.TemplateRequest load(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException
{
com.mendix.systemwideinterfaces.core.IMendixObject mendixObject = com.mendix.core.Core.retrieveId(context, mendixIdentifier);
return scheduling.proxies.TemplateRequest.initialize(context, mendixObject);
}
public static java.util.List<? extends scheduling.proxies.TemplateRequest> load(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String xpathConstraint) throws com.mendix.core.CoreException
{
java.util.List<scheduling.proxies.TemplateRequest> result = new java.util.ArrayList<scheduling.proxies.TemplateRequest>();
for (com.mendix.systemwideinterfaces.core.IMendixObject obj : com.mendix.core.Core.retrieveXPathQuery(context, "//Scheduling.TemplateRequest" + xpathConstraint))
result.add(scheduling.proxies.TemplateRequest.initialize(context, obj));
return result;
}
/**
* Commit the changes made on this proxy object.
*/
public final void commit() throws com.mendix.core.CoreException
{
com.mendix.core.Core.commit(context, getMendixObject());
}
/**
* Commit the changes made on this proxy object using the specified context.
*/
public final void commit(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
{
com.mendix.core.Core.commit(context, getMendixObject());
}
/**
* Delete the object.
*/
public final void delete()
{
com.mendix.core.Core.delete(context, getMendixObject());
}
/**
* Delete the object using the specified context.
*/
public final void delete(com.mendix.systemwideinterfaces.core.IContext context)
{
com.mendix.core.Core.delete(context, getMendixObject());
}
/**
* @return value of TemplateRequestID
*/
public final java.lang.Long getTemplateRequestID()
{
return getTemplateRequestID(getContext());
}
/**
* @param context
* @return value of TemplateRequestID
*/
public final java.lang.Long getTemplateRequestID(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Long) getMendixObject().getValue(context, MemberNames.TemplateRequestID.toString());
}
/**
* Set value of TemplateRequestID
* @param templaterequestid
*/
public final void setTemplateRequestID(java.lang.Long templaterequestid)
{
setTemplateRequestID(getContext(), templaterequestid);
}
/**
* Set value of TemplateRequestID
* @param context
* @param templaterequestid
*/
public final void setTemplateRequestID(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Long templaterequestid)
{
getMendixObject().setValue(context, MemberNames.TemplateRequestID.toString(), templaterequestid);
}
/**
* @return value of ShortDescription
*/
public final java.lang.String getShortDescription()
{
return getShortDescription(getContext());
}
/**
* @param context
* @return value of ShortDescription
*/
public final java.lang.String getShortDescription(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.String) getMendixObject().getValue(context, MemberNames.ShortDescription.toString());
}
/**
* Set value of ShortDescription
* @param shortdescription
*/
public final void setShortDescription(java.lang.String shortdescription)
{
setShortDescription(getContext(), shortdescription);
}
/**
* Set value of ShortDescription
* @param context
* @param shortdescription
*/
public final void setShortDescription(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String shortdescription)
{
getMendixObject().setValue(context, MemberNames.ShortDescription.toString(), shortdescription);
}
/**
* @return value of DetailDescription
*/
public final java.lang.String getDetailDescription()
{
return getDetailDescription(getContext());
}
/**
* @param context
* @return value of DetailDescription
*/
public final java.lang.String getDetailDescription(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.String) getMendixObject().getValue(context, MemberNames.DetailDescription.toString());
}
/**
* Set value of DetailDescription
* @param detaildescription
*/
public final void setDetailDescription(java.lang.String detaildescription)
{
setDetailDescription(getContext(), detaildescription);
}
/**
* Set value of DetailDescription
* @param context
* @param detaildescription
*/
public final void setDetailDescription(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String detaildescription)
{
getMendixObject().setValue(context, MemberNames.DetailDescription.toString(), detaildescription);
}
/**
* @return value of DetailDescriptionNoHTML
*/
public final java.lang.String getDetailDescriptionNoHTML()
{
return getDetailDescriptionNoHTML(getContext());
}
/**
* @param context
* @return value of DetailDescriptionNoHTML
*/
public final java.lang.String getDetailDescriptionNoHTML(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.String) getMendixObject().getValue(context, MemberNames.DetailDescriptionNoHTML.toString());
}
/**
* Set value of DetailDescriptionNoHTML
* @param detaildescriptionnohtml
*/
public final void setDetailDescriptionNoHTML(java.lang.String detaildescriptionnohtml)
{
setDetailDescriptionNoHTML(getContext(), detaildescriptionnohtml);
}
/**
* Set value of DetailDescriptionNoHTML
* @param context
* @param detaildescriptionnohtml
*/
public final void setDetailDescriptionNoHTML(com.mendix.systemwideinterfaces.core.IContext context, java.lang.String detaildescriptionnohtml)
{
getMendixObject().setValue(context, MemberNames.DetailDescriptionNoHTML.toString(), detaildescriptionnohtml);
}
/**
* @return value of FoundContract
*/
public final java.lang.Boolean getFoundContract()
{
return getFoundContract(getContext());
}
/**
* @param context
* @return value of FoundContract
*/
public final java.lang.Boolean getFoundContract(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.FoundContract.toString());
}
/**
* Set value of FoundContract
* @param foundcontract
*/
public final void setFoundContract(java.lang.Boolean foundcontract)
{
setFoundContract(getContext(), foundcontract);
}
/**
* Set value of FoundContract
* @param context
* @param foundcontract
*/
public final void setFoundContract(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean foundcontract)
{
getMendixObject().setValue(context, MemberNames.FoundContract.toString(), foundcontract);
}
/**
* @return value of SelectContractUsingDropDown
*/
public final java.lang.Boolean getSelectContractUsingDropDown()
{
return getSelectContractUsingDropDown(getContext());
}
/**
* @param context
* @return value of SelectContractUsingDropDown
*/
public final java.lang.Boolean getSelectContractUsingDropDown(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.SelectContractUsingDropDown.toString());
}
/**
* Set value of SelectContractUsingDropDown
* @param selectcontractusingdropdown
*/
public final void setSelectContractUsingDropDown(java.lang.Boolean selectcontractusingdropdown)
{
setSelectContractUsingDropDown(getContext(), selectcontractusingdropdown);
}
/**
* Set value of SelectContractUsingDropDown
* @param context
* @param selectcontractusingdropdown
*/
public final void setSelectContractUsingDropDown(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean selectcontractusingdropdown)
{
getMendixObject().setValue(context, MemberNames.SelectContractUsingDropDown.toString(), selectcontractusingdropdown);
}
/**
* @return value of FoundServiceProcess
*/
public final java.lang.Boolean getFoundServiceProcess()
{
return getFoundServiceProcess(getContext());
}
/**
* @param context
* @return value of FoundServiceProcess
*/
public final java.lang.Boolean getFoundServiceProcess(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.FoundServiceProcess.toString());
}
/**
* Set value of FoundServiceProcess
* @param foundserviceprocess
*/
public final void setFoundServiceProcess(java.lang.Boolean foundserviceprocess)
{
setFoundServiceProcess(getContext(), foundserviceprocess);
}
/**
* Set value of FoundServiceProcess
* @param context
* @param foundserviceprocess
*/
public final void setFoundServiceProcess(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean foundserviceprocess)
{
getMendixObject().setValue(context, MemberNames.FoundServiceProcess.toString(), foundserviceprocess);
}
/**
* @return value of SelectServiceProcessUsingDropDown
*/
public final java.lang.Boolean getSelectServiceProcessUsingDropDown()
{
return getSelectServiceProcessUsingDropDown(getContext());
}
/**
* @param context
* @return value of SelectServiceProcessUsingDropDown
*/
public final java.lang.Boolean getSelectServiceProcessUsingDropDown(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.SelectServiceProcessUsingDropDown.toString());
}
/**
* Set value of SelectServiceProcessUsingDropDown
* @param selectserviceprocessusingdropdown
*/
public final void setSelectServiceProcessUsingDropDown(java.lang.Boolean selectserviceprocessusingdropdown)
{
setSelectServiceProcessUsingDropDown(getContext(), selectserviceprocessusingdropdown);
}
/**
* Set value of SelectServiceProcessUsingDropDown
* @param context
* @param selectserviceprocessusingdropdown
*/
public final void setSelectServiceProcessUsingDropDown(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean selectserviceprocessusingdropdown)
{
getMendixObject().setValue(context, MemberNames.SelectServiceProcessUsingDropDown.toString(), selectserviceprocessusingdropdown);
}
/**
* @return value of FoundCI
*/
public final java.lang.Boolean getFoundCI()
{
return getFoundCI(getContext());
}
/**
* @param context
* @return value of FoundCI
*/
public final java.lang.Boolean getFoundCI(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.FoundCI.toString());
}
/**
* Set value of FoundCI
* @param foundci
*/
public final void setFoundCI(java.lang.Boolean foundci)
{
setFoundCI(getContext(), foundci);
}
/**
* Set value of FoundCI
* @param context
* @param foundci
*/
public final void setFoundCI(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean foundci)
{
getMendixObject().setValue(context, MemberNames.FoundCI.toString(), foundci);
}
/**
* @return value of SelectCIUsingDropDown
*/
public final java.lang.Boolean getSelectCIUsingDropDown()
{
return getSelectCIUsingDropDown(getContext());
}
/**
* @param context
* @return value of SelectCIUsingDropDown
*/
public final java.lang.Boolean getSelectCIUsingDropDown(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.SelectCIUsingDropDown.toString());
}
/**
* Set value of SelectCIUsingDropDown
* @param selectciusingdropdown
*/
public final void setSelectCIUsingDropDown(java.lang.Boolean selectciusingdropdown)
{
setSelectCIUsingDropDown(getContext(), selectciusingdropdown);
}
/**
* Set value of SelectCIUsingDropDown
* @param context
* @param selectciusingdropdown
*/
public final void setSelectCIUsingDropDown(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean selectciusingdropdown)
{
getMendixObject().setValue(context, MemberNames.SelectCIUsingDropDown.toString(), selectciusingdropdown);
}
/**
* @return value of FoundService
*/
public final java.lang.Boolean getFoundService()
{
return getFoundService(getContext());
}
/**
* @param context
* @return value of FoundService
*/
public final java.lang.Boolean getFoundService(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.FoundService.toString());
}
/**
* Set value of FoundService
* @param foundservice
*/
public final void setFoundService(java.lang.Boolean foundservice)
{
setFoundService(getContext(), foundservice);
}
/**
* Set value of FoundService
* @param context
* @param foundservice
*/
public final void setFoundService(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean foundservice)
{
getMendixObject().setValue(context, MemberNames.FoundService.toString(), foundservice);
}
/**
* @return value of SelectServiceUsingDropDown
*/
public final java.lang.Boolean getSelectServiceUsingDropDown()
{
return getSelectServiceUsingDropDown(getContext());
}
/**
* @param context
* @return value of SelectServiceUsingDropDown
*/
public final java.lang.Boolean getSelectServiceUsingDropDown(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.SelectServiceUsingDropDown.toString());
}
/**
* Set value of SelectServiceUsingDropDown
* @param selectserviceusingdropdown
*/
public final void setSelectServiceUsingDropDown(java.lang.Boolean selectserviceusingdropdown)
{
setSelectServiceUsingDropDown(getContext(), selectserviceusingdropdown);
}
/**
* Set value of SelectServiceUsingDropDown
* @param context
* @param selectserviceusingdropdown
*/
public final void setSelectServiceUsingDropDown(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean selectserviceusingdropdown)
{
getMendixObject().setValue(context, MemberNames.SelectServiceUsingDropDown.toString(), selectserviceusingdropdown);
}
/**
* @return value of FoundUIP
*/
public final java.lang.Boolean getFoundUIP()
{
return getFoundUIP(getContext());
}
/**
* @param context
* @return value of FoundUIP
*/
public final java.lang.Boolean getFoundUIP(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.FoundUIP.toString());
}
/**
* Set value of FoundUIP
* @param founduip
*/
public final void setFoundUIP(java.lang.Boolean founduip)
{
setFoundUIP(getContext(), founduip);
}
/**
* Set value of FoundUIP
* @param context
* @param founduip
*/
public final void setFoundUIP(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean founduip)
{
getMendixObject().setValue(context, MemberNames.FoundUIP.toString(), founduip);
}
/**
* @return value of FoundImpact
*/
public final java.lang.Boolean getFoundImpact()
{
return getFoundImpact(getContext());
}
/**
* @param context
* @return value of FoundImpact
*/
public final java.lang.Boolean getFoundImpact(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.FoundImpact.toString());
}
/**
* Set value of FoundImpact
* @param foundimpact
*/
public final void setFoundImpact(java.lang.Boolean foundimpact)
{
setFoundImpact(getContext(), foundimpact);
}
/**
* Set value of FoundImpact
* @param context
* @param foundimpact
*/
public final void setFoundImpact(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean foundimpact)
{
getMendixObject().setValue(context, MemberNames.FoundImpact.toString(), foundimpact);
}
/**
* @return value of FoundEmptyImpact
*/
public final java.lang.Boolean getFoundEmptyImpact()
{
return getFoundEmptyImpact(getContext());
}
/**
* @param context
* @return value of FoundEmptyImpact
*/
public final java.lang.Boolean getFoundEmptyImpact(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.FoundEmptyImpact.toString());
}
/**
* Set value of FoundEmptyImpact
* @param foundemptyimpact
*/
public final void setFoundEmptyImpact(java.lang.Boolean foundemptyimpact)
{
setFoundEmptyImpact(getContext(), foundemptyimpact);
}
/**
* Set value of FoundEmptyImpact
* @param context
* @param foundemptyimpact
*/
public final void setFoundEmptyImpact(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean foundemptyimpact)
{
getMendixObject().setValue(context, MemberNames.FoundEmptyImpact.toString(), foundemptyimpact);
}
/**
* @return value of SelectImpactUsingDropDown
*/
public final java.lang.Boolean getSelectImpactUsingDropDown()
{
return getSelectImpactUsingDropDown(getContext());
}
/**
* @param context
* @return value of SelectImpactUsingDropDown
*/
public final java.lang.Boolean getSelectImpactUsingDropDown(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.SelectImpactUsingDropDown.toString());
}
/**
* Set value of SelectImpactUsingDropDown
* @param selectimpactusingdropdown
*/
public final void setSelectImpactUsingDropDown(java.lang.Boolean selectimpactusingdropdown)
{
setSelectImpactUsingDropDown(getContext(), selectimpactusingdropdown);
}
/**
* Set value of SelectImpactUsingDropDown
* @param context
* @param selectimpactusingdropdown
*/
public final void setSelectImpactUsingDropDown(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean selectimpactusingdropdown)
{
getMendixObject().setValue(context, MemberNames.SelectImpactUsingDropDown.toString(), selectimpactusingdropdown);
}
/**
* @return value of FoundUrgency
*/
public final java.lang.Boolean getFoundUrgency()
{
return getFoundUrgency(getContext());
}
/**
* @param context
* @return value of FoundUrgency
*/
public final java.lang.Boolean getFoundUrgency(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.FoundUrgency.toString());
}
/**
* Set value of FoundUrgency
* @param foundurgency
*/
public final void setFoundUrgency(java.lang.Boolean foundurgency)
{
setFoundUrgency(getContext(), foundurgency);
}
/**
* Set value of FoundUrgency
* @param context
* @param foundurgency
*/
public final void setFoundUrgency(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean foundurgency)
{
getMendixObject().setValue(context, MemberNames.FoundUrgency.toString(), foundurgency);
}
/**
* @return value of FoundEmptyUrgency
*/
public final java.lang.Boolean getFoundEmptyUrgency()
{
return getFoundEmptyUrgency(getContext());
}
/**
* @param context
* @return value of FoundEmptyUrgency
*/
public final java.lang.Boolean getFoundEmptyUrgency(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.FoundEmptyUrgency.toString());
}
/**
* Set value of FoundEmptyUrgency
* @param foundemptyurgency
*/
public final void setFoundEmptyUrgency(java.lang.Boolean foundemptyurgency)
{
setFoundEmptyUrgency(getContext(), foundemptyurgency);
}
/**
* Set value of FoundEmptyUrgency
* @param context
* @param foundemptyurgency
*/
public final void setFoundEmptyUrgency(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean foundemptyurgency)
{
getMendixObject().setValue(context, MemberNames.FoundEmptyUrgency.toString(), foundemptyurgency);
}
/**
* @return value of SelectUrgencyUsingDropDown
*/
public final java.lang.Boolean getSelectUrgencyUsingDropDown()
{
return getSelectUrgencyUsingDropDown(getContext());
}
/**
* @param context
* @return value of SelectUrgencyUsingDropDown
*/
public final java.lang.Boolean getSelectUrgencyUsingDropDown(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.SelectUrgencyUsingDropDown.toString());
}
/**
* Set value of SelectUrgencyUsingDropDown
* @param selecturgencyusingdropdown
*/
public final void setSelectUrgencyUsingDropDown(java.lang.Boolean selecturgencyusingdropdown)
{
setSelectUrgencyUsingDropDown(getContext(), selecturgencyusingdropdown);
}
/**
* Set value of SelectUrgencyUsingDropDown
* @param context
* @param selecturgencyusingdropdown
*/
public final void setSelectUrgencyUsingDropDown(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean selecturgencyusingdropdown)
{
getMendixObject().setValue(context, MemberNames.SelectUrgencyUsingDropDown.toString(), selecturgencyusingdropdown);
}
/**
* @return value of FoundPriority
*/
public final java.lang.Boolean getFoundPriority()
{
return getFoundPriority(getContext());
}
/**
* @param context
* @return value of FoundPriority
*/
public final java.lang.Boolean getFoundPriority(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.FoundPriority.toString());
}
/**
* Set value of FoundPriority
* @param foundpriority
*/
public final void setFoundPriority(java.lang.Boolean foundpriority)
{
setFoundPriority(getContext(), foundpriority);
}
/**
* Set value of FoundPriority
* @param context
* @param foundpriority
*/
public final void setFoundPriority(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean foundpriority)
{
getMendixObject().setValue(context, MemberNames.FoundPriority.toString(), foundpriority);
}
/**
* @return value of FoundEmptyPriority
*/
public final java.lang.Boolean getFoundEmptyPriority()
{
return getFoundEmptyPriority(getContext());
}
/**
* @param context
* @return value of FoundEmptyPriority
*/
public final java.lang.Boolean getFoundEmptyPriority(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.FoundEmptyPriority.toString());
}
/**
* Set value of FoundEmptyPriority
* @param foundemptypriority
*/
public final void setFoundEmptyPriority(java.lang.Boolean foundemptypriority)
{
setFoundEmptyPriority(getContext(), foundemptypriority);
}
/**
* Set value of FoundEmptyPriority
* @param context
* @param foundemptypriority
*/
public final void setFoundEmptyPriority(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean foundemptypriority)
{
getMendixObject().setValue(context, MemberNames.FoundEmptyPriority.toString(), foundemptypriority);
}
/**
* @return value of SelectPriorityUsingDropDown
*/
public final java.lang.Boolean getSelectPriorityUsingDropDown()
{
return getSelectPriorityUsingDropDown(getContext());
}
/**
* @param context
* @return value of SelectPriorityUsingDropDown
*/
public final java.lang.Boolean getSelectPriorityUsingDropDown(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.SelectPriorityUsingDropDown.toString());
}
/**
* Set value of SelectPriorityUsingDropDown
* @param selectpriorityusingdropdown
*/
public final void setSelectPriorityUsingDropDown(java.lang.Boolean selectpriorityusingdropdown)
{
setSelectPriorityUsingDropDown(getContext(), selectpriorityusingdropdown);
}
/**
* Set value of SelectPriorityUsingDropDown
* @param context
* @param selectpriorityusingdropdown
*/
public final void setSelectPriorityUsingDropDown(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean selectpriorityusingdropdown)
{
getMendixObject().setValue(context, MemberNames.SelectPriorityUsingDropDown.toString(), selectpriorityusingdropdown);
}
/**
* @return value of FoundDeliveringOrganisation
*/
public final java.lang.Boolean getFoundDeliveringOrganisation()
{
return getFoundDeliveringOrganisation(getContext());
}
/**
* @param context
* @return value of FoundDeliveringOrganisation
*/
public final java.lang.Boolean getFoundDeliveringOrganisation(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.FoundDeliveringOrganisation.toString());
}
/**
* Set value of FoundDeliveringOrganisation
* @param founddeliveringorganisation
*/
public final void setFoundDeliveringOrganisation(java.lang.Boolean founddeliveringorganisation)
{
setFoundDeliveringOrganisation(getContext(), founddeliveringorganisation);
}
/**
* Set value of FoundDeliveringOrganisation
* @param context
* @param founddeliveringorganisation
*/
public final void setFoundDeliveringOrganisation(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean founddeliveringorganisation)
{
getMendixObject().setValue(context, MemberNames.FoundDeliveringOrganisation.toString(), founddeliveringorganisation);
}
/**
* @return value of SelectDeleveringOrganisationUsingDropDown
*/
public final java.lang.Boolean getSelectDeleveringOrganisationUsingDropDown()
{
return getSelectDeleveringOrganisationUsingDropDown(getContext());
}
/**
* @param context
* @return value of SelectDeleveringOrganisationUsingDropDown
*/
public final java.lang.Boolean getSelectDeleveringOrganisationUsingDropDown(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.SelectDeleveringOrganisationUsingDropDown.toString());
}
/**
* Set value of SelectDeleveringOrganisationUsingDropDown
* @param selectdeleveringorganisationusingdropdown
*/
public final void setSelectDeleveringOrganisationUsingDropDown(java.lang.Boolean selectdeleveringorganisationusingdropdown)
{
setSelectDeleveringOrganisationUsingDropDown(getContext(), selectdeleveringorganisationusingdropdown);
}
/**
* Set value of SelectDeleveringOrganisationUsingDropDown
* @param context
* @param selectdeleveringorganisationusingdropdown
*/
public final void setSelectDeleveringOrganisationUsingDropDown(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean selectdeleveringorganisationusingdropdown)
{
getMendixObject().setValue(context, MemberNames.SelectDeleveringOrganisationUsingDropDown.toString(), selectdeleveringorganisationusingdropdown);
}
/**
* Set value of ProcessType
* @param processtype
*/
public final slm.proxies.ProcessType getProcessType()
{
return getProcessType(getContext());
}
/**
* @param context
* @return value of ProcessType
*/
public final slm.proxies.ProcessType getProcessType(com.mendix.systemwideinterfaces.core.IContext context)
{
Object obj = getMendixObject().getValue(context, MemberNames.ProcessType.toString());
if (obj == null)
return null;
return slm.proxies.ProcessType.valueOf((java.lang.String) obj);
}
/**
* Set value of ProcessType
* @param processtype
*/
public final void setProcessType(slm.proxies.ProcessType processtype)
{
setProcessType(getContext(), processtype);
}
/**
* Set value of ProcessType
* @param context
* @param processtype
*/
public final void setProcessType(com.mendix.systemwideinterfaces.core.IContext context, slm.proxies.ProcessType processtype)
{
if (processtype != null)
getMendixObject().setValue(context, MemberNames.ProcessType.toString(), processtype.toString());
else
getMendixObject().setValue(context, MemberNames.ProcessType.toString(), null);
}
/**
* Set value of CommitmentResolveTimeBy
* @param commitmentresolvetimeby
*/
public final slm_notifications.proxies.ResolveTimeBy getCommitmentResolveTimeBy()
{
return getCommitmentResolveTimeBy(getContext());
}
/**
* @param context
* @return value of CommitmentResolveTimeBy
*/
public final slm_notifications.proxies.ResolveTimeBy getCommitmentResolveTimeBy(com.mendix.systemwideinterfaces.core.IContext context)
{
Object obj = getMendixObject().getValue(context, MemberNames.CommitmentResolveTimeBy.toString());
if (obj == null)
return null;
return slm_notifications.proxies.ResolveTimeBy.valueOf((java.lang.String) obj);
}
/**
* Set value of CommitmentResolveTimeBy
* @param commitmentresolvetimeby
*/
public final void setCommitmentResolveTimeBy(slm_notifications.proxies.ResolveTimeBy commitmentresolvetimeby)
{
setCommitmentResolveTimeBy(getContext(), commitmentresolvetimeby);
}
/**
* Set value of CommitmentResolveTimeBy
* @param context
* @param commitmentresolvetimeby
*/
public final void setCommitmentResolveTimeBy(com.mendix.systemwideinterfaces.core.IContext context, slm_notifications.proxies.ResolveTimeBy commitmentresolvetimeby)
{
if (commitmentresolvetimeby != null)
getMendixObject().setValue(context, MemberNames.CommitmentResolveTimeBy.toString(), commitmentresolvetimeby.toString());
else
getMendixObject().setValue(context, MemberNames.CommitmentResolveTimeBy.toString(), null);
}
/**
* Set value of TemplateRequestType
* @param templaterequesttype
*/
public final scheduling.proxies.TemplateRequestTypeEnum getTemplateRequestType()
{
return getTemplateRequestType(getContext());
}
/**
* @param context
* @return value of TemplateRequestType
*/
public final scheduling.proxies.TemplateRequestTypeEnum getTemplateRequestType(com.mendix.systemwideinterfaces.core.IContext context)
{
Object obj = getMendixObject().getValue(context, MemberNames.TemplateRequestType.toString());
if (obj == null)
return null;
return scheduling.proxies.TemplateRequestTypeEnum.valueOf((java.lang.String) obj);
}
/**
* Set value of TemplateRequestType
* @param templaterequesttype
*/
public final void setTemplateRequestType(scheduling.proxies.TemplateRequestTypeEnum templaterequesttype)
{
setTemplateRequestType(getContext(), templaterequesttype);
}
/**
* Set value of TemplateRequestType
* @param context
* @param templaterequesttype
*/
public final void setTemplateRequestType(com.mendix.systemwideinterfaces.core.IContext context, scheduling.proxies.TemplateRequestTypeEnum templaterequesttype)
{
if (templaterequesttype != null)
getMendixObject().setValue(context, MemberNames.TemplateRequestType.toString(), templaterequesttype.toString());
else
getMendixObject().setValue(context, MemberNames.TemplateRequestType.toString(), null);
}
/**
* @return value of CopyCartItems
*/
public final java.lang.Boolean getCopyCartItems()
{
return getCopyCartItems(getContext());
}
/**
* @param context
* @return value of CopyCartItems
*/
public final java.lang.Boolean getCopyCartItems(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.CopyCartItems.toString());
}
/**
* Set value of CopyCartItems
* @param copycartitems
*/
public final void setCopyCartItems(java.lang.Boolean copycartitems)
{
setCopyCartItems(getContext(), copycartitems);
}
/**
* Set value of CopyCartItems
* @param context
* @param copycartitems
*/
public final void setCopyCartItems(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean copycartitems)
{
getMendixObject().setValue(context, MemberNames.CopyCartItems.toString(), copycartitems);
}
/**
* @return value of CallingOnBehalfOf
*/
public final java.lang.Boolean getCallingOnBehalfOf()
{
return getCallingOnBehalfOf(getContext());
}
/**
* @param context
* @return value of CallingOnBehalfOf
*/
public final java.lang.Boolean getCallingOnBehalfOf(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.CallingOnBehalfOf.toString());
}
/**
* Set value of CallingOnBehalfOf
* @param callingonbehalfof
*/
public final void setCallingOnBehalfOf(java.lang.Boolean callingonbehalfof)
{
setCallingOnBehalfOf(getContext(), callingonbehalfof);
}
/**
* Set value of CallingOnBehalfOf
* @param context
* @param callingonbehalfof
*/
public final void setCallingOnBehalfOf(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean callingonbehalfof)
{
getMendixObject().setValue(context, MemberNames.CallingOnBehalfOf.toString(), callingonbehalfof);
}
/**
* @return value of UseLocation
*/
public final java.lang.Boolean getUseLocation()
{
return getUseLocation(getContext());
}
/**
* @param context
* @return value of UseLocation
*/
public final java.lang.Boolean getUseLocation(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.UseLocation.toString());
}
/**
* Set value of UseLocation
* @param uselocation
*/
public final void setUseLocation(java.lang.Boolean uselocation)
{
setUseLocation(getContext(), uselocation);
}
/**
* Set value of UseLocation
* @param context
* @param uselocation
*/
public final void setUseLocation(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean uselocation)
{
getMendixObject().setValue(context, MemberNames.UseLocation.toString(), uselocation);
}
/**
* @return value of UU95_CallerIsEmpty
*/
public final java.lang.Boolean getUU95_CallerIsEmpty()
{
return getUU95_CallerIsEmpty(getContext());
}
/**
* @param context
* @return value of UU95_CallerIsEmpty
*/
public final java.lang.Boolean getUU95_CallerIsEmpty(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.UU95_CallerIsEmpty.toString());
}
/**
* Set value of UU95_CallerIsEmpty
* @param uu95_callerisempty
*/
public final void setUU95_CallerIsEmpty(java.lang.Boolean uu95_callerisempty)
{
setUU95_CallerIsEmpty(getContext(), uu95_callerisempty);
}
/**
* Set value of UU95_CallerIsEmpty
* @param context
* @param uu95_callerisempty
*/
public final void setUU95_CallerIsEmpty(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean uu95_callerisempty)
{
getMendixObject().setValue(context, MemberNames.UU95_CallerIsEmpty.toString(), uu95_callerisempty);
}
/**
* @return value of SelectCIUsingDropDown_2
*/
public final java.lang.Boolean getSelectCIUsingDropDown_2()
{
return getSelectCIUsingDropDown_2(getContext());
}
/**
* @param context
* @return value of SelectCIUsingDropDown_2
*/
public final java.lang.Boolean getSelectCIUsingDropDown_2(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.SelectCIUsingDropDown_2.toString());
}
/**
* Set value of SelectCIUsingDropDown_2
* @param selectciusingdropdown_2
*/
public final void setSelectCIUsingDropDown_2(java.lang.Boolean selectciusingdropdown_2)
{
setSelectCIUsingDropDown_2(getContext(), selectciusingdropdown_2);
}
/**
* Set value of SelectCIUsingDropDown_2
* @param context
* @param selectciusingdropdown_2
*/
public final void setSelectCIUsingDropDown_2(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean selectciusingdropdown_2)
{
getMendixObject().setValue(context, MemberNames.SelectCIUsingDropDown_2.toString(), selectciusingdropdown_2);
}
/**
* @return value of SelectCIUsingDropDown_3
*/
public final java.lang.Boolean getSelectCIUsingDropDown_3()
{
return getSelectCIUsingDropDown_3(getContext());
}
/**
* @param context
* @return value of SelectCIUsingDropDown_3
*/
public final java.lang.Boolean getSelectCIUsingDropDown_3(com.mendix.systemwideinterfaces.core.IContext context)
{
return (java.lang.Boolean) getMendixObject().getValue(context, MemberNames.SelectCIUsingDropDown_3.toString());
}
/**
* Set value of SelectCIUsingDropDown_3
* @param selectciusingdropdown_3
*/
public final void setSelectCIUsingDropDown_3(java.lang.Boolean selectciusingdropdown_3)
{
setSelectCIUsingDropDown_3(getContext(), selectciusingdropdown_3);
}
/**
* Set value of SelectCIUsingDropDown_3
* @param context
* @param selectciusingdropdown_3
*/
public final void setSelectCIUsingDropDown_3(com.mendix.systemwideinterfaces.core.IContext context, java.lang.Boolean selectciusingdropdown_3)
{
getMendixObject().setValue(context, MemberNames.SelectCIUsingDropDown_3.toString(), selectciusingdropdown_3);
}
/**
* @return value of TemplateRequest_Service_Process
*/
public final slm.proxies.Service_Process getTemplateRequest_Service_Process() throws com.mendix.core.CoreException
{
return getTemplateRequest_Service_Process(getContext());
}
/**
* @param context
* @return value of TemplateRequest_Service_Process
*/
public final slm.proxies.Service_Process getTemplateRequest_Service_Process(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
{
slm.proxies.Service_Process result = null;
com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.TemplateRequest_Service_Process.toString());
if (identifier != null)
result = slm.proxies.Service_Process.load(context, identifier);
return result;
}
/**
* Set value of TemplateRequest_Service_Process
* @param templaterequest_service_process
*/
public final void setTemplateRequest_Service_Process(slm.proxies.Service_Process templaterequest_service_process)
{
setTemplateRequest_Service_Process(getContext(), templaterequest_service_process);
}
/**
* Set value of TemplateRequest_Service_Process
* @param context
* @param templaterequest_service_process
*/
public final void setTemplateRequest_Service_Process(com.mendix.systemwideinterfaces.core.IContext context, slm.proxies.Service_Process templaterequest_service_process)
{
if (templaterequest_service_process == null)
getMendixObject().setValue(context, MemberNames.TemplateRequest_Service_Process.toString(), null);
else
getMendixObject().setValue(context, MemberNames.TemplateRequest_Service_Process.toString(), templaterequest_service_process.getMendixObject().getId());
}
/**
* @return value of TemplateRequest_Service
*/
public final slm.proxies.Service getTemplateRequest_Service() throws com.mendix.core.CoreException
{
return getTemplateRequest_Service(getContext());
}
/**
* @param context
* @return value of TemplateRequest_Service
*/
public final slm.proxies.Service getTemplateRequest_Service(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
{
slm.proxies.Service result = null;
com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.TemplateRequest_Service.toString());
if (identifier != null)
result = slm.proxies.Service.load(context, identifier);
return result;
}
/**
* Set value of TemplateRequest_Service
* @param templaterequest_service
*/
public final void setTemplateRequest_Service(slm.proxies.Service templaterequest_service)
{
setTemplateRequest_Service(getContext(), templaterequest_service);
}
/**
* Set value of TemplateRequest_Service
* @param context
* @param templaterequest_service
*/
public final void setTemplateRequest_Service(com.mendix.systemwideinterfaces.core.IContext context, slm.proxies.Service templaterequest_service)
{
if (templaterequest_service == null)
getMendixObject().setValue(context, MemberNames.TemplateRequest_Service.toString(), null);
else
getMendixObject().setValue(context, MemberNames.TemplateRequest_Service.toString(), templaterequest_service.getMendixObject().getId());
}
/**
* @return value of TemplateRequest_Contract
*/
public final slm.proxies.Contract getTemplateRequest_Contract() throws com.mendix.core.CoreException
{
return getTemplateRequest_Contract(getContext());
}
/**
* @param context
* @return value of TemplateRequest_Contract
*/
public final slm.proxies.Contract getTemplateRequest_Contract(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
{
slm.proxies.Contract result = null;
com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.TemplateRequest_Contract.toString());
if (identifier != null)
result = slm.proxies.Contract.load(context, identifier);
return result;
}
/**
* Set value of TemplateRequest_Contract
* @param templaterequest_contract
*/
public final void setTemplateRequest_Contract(slm.proxies.Contract templaterequest_contract)
{
setTemplateRequest_Contract(getContext(), templaterequest_contract);
}
/**
* Set value of TemplateRequest_Contract
* @param context
* @param templaterequest_contract
*/
public final void setTemplateRequest_Contract(com.mendix.systemwideinterfaces.core.IContext context, slm.proxies.Contract templaterequest_contract)
{
if (templaterequest_contract == null)
getMendixObject().setValue(context, MemberNames.TemplateRequest_Contract.toString(), null);
else
getMendixObject().setValue(context, MemberNames.TemplateRequest_Contract.toString(), templaterequest_contract.getMendixObject().getId());
}
/**
* @return value of TemplateRequest_Commitment
*/
public final slm_notifications.proxies.Commitment getTemplateRequest_Commitment() throws com.mendix.core.CoreException
{
return getTemplateRequest_Commitment(getContext());
}
/**
* @param context
* @return value of TemplateRequest_Commitment
*/
public final slm_notifications.proxies.Commitment getTemplateRequest_Commitment(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
{
slm_notifications.proxies.Commitment result = null;
com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.TemplateRequest_Commitment.toString());
if (identifier != null)
result = slm_notifications.proxies.Commitment.load(context, identifier);
return result;
}
/**
* Set value of TemplateRequest_Commitment
* @param templaterequest_commitment
*/
public final void setTemplateRequest_Commitment(slm_notifications.proxies.Commitment templaterequest_commitment)
{
setTemplateRequest_Commitment(getContext(), templaterequest_commitment);
}
/**
* Set value of TemplateRequest_Commitment
* @param context
* @param templaterequest_commitment
*/
public final void setTemplateRequest_Commitment(com.mendix.systemwideinterfaces.core.IContext context, slm_notifications.proxies.Commitment templaterequest_commitment)
{
if (templaterequest_commitment == null)
getMendixObject().setValue(context, MemberNames.TemplateRequest_Commitment.toString(), null);
else
getMendixObject().setValue(context, MemberNames.TemplateRequest_Commitment.toString(), templaterequest_commitment.getMendixObject().getId());
}
/**
* @return value of TemplateRequest_IUP_Combination
*/
public final slm.proxies.IUP_Combination getTemplateRequest_IUP_Combination() throws com.mendix.core.CoreException
{
return getTemplateRequest_IUP_Combination(getContext());
}
/**
* @param context
* @return value of TemplateRequest_IUP_Combination
*/
public final slm.proxies.IUP_Combination getTemplateRequest_IUP_Combination(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
{
slm.proxies.IUP_Combination result = null;
com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.TemplateRequest_IUP_Combination.toString());
if (identifier != null)
result = slm.proxies.IUP_Combination.load(context, identifier);
return result;
}
/**
* Set value of TemplateRequest_IUP_Combination
* @param templaterequest_iup_combination
*/
public final void setTemplateRequest_IUP_Combination(slm.proxies.IUP_Combination templaterequest_iup_combination)
{
setTemplateRequest_IUP_Combination(getContext(), templaterequest_iup_combination);
}
/**
* Set value of TemplateRequest_IUP_Combination
* @param context
* @param templaterequest_iup_combination
*/
public final void setTemplateRequest_IUP_Combination(com.mendix.systemwideinterfaces.core.IContext context, slm.proxies.IUP_Combination templaterequest_iup_combination)
{
if (templaterequest_iup_combination == null)
getMendixObject().setValue(context, MemberNames.TemplateRequest_IUP_Combination.toString(), null);
else
getMendixObject().setValue(context, MemberNames.TemplateRequest_IUP_Combination.toString(), templaterequest_iup_combination.getMendixObject().getId());
}
/**
* @return value of TemplateRequest_Impact
*/
public final slm.proxies.Impact getTemplateRequest_Impact() throws com.mendix.core.CoreException
{
return getTemplateRequest_Impact(getContext());
}
/**
* @param context
* @return value of TemplateRequest_Impact
*/
public final slm.proxies.Impact getTemplateRequest_Impact(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
{
slm.proxies.Impact result = null;
com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.TemplateRequest_Impact.toString());
if (identifier != null)
result = slm.proxies.Impact.load(context, identifier);
return result;
}
/**
* Set value of TemplateRequest_Impact
* @param templaterequest_impact
*/
public final void setTemplateRequest_Impact(slm.proxies.Impact templaterequest_impact)
{
setTemplateRequest_Impact(getContext(), templaterequest_impact);
}
/**
* Set value of TemplateRequest_Impact
* @param context
* @param templaterequest_impact
*/
public final void setTemplateRequest_Impact(com.mendix.systemwideinterfaces.core.IContext context, slm.proxies.Impact templaterequest_impact)
{
if (templaterequest_impact == null)
getMendixObject().setValue(context, MemberNames.TemplateRequest_Impact.toString(), null);
else
getMendixObject().setValue(context, MemberNames.TemplateRequest_Impact.toString(), templaterequest_impact.getMendixObject().getId());
}
/**
* @return value of TemplateRequest_Urgency
*/
public final slm.proxies.Urgency getTemplateRequest_Urgency() throws com.mendix.core.CoreException
{
return getTemplateRequest_Urgency(getContext());
}
/**
* @param context
* @return value of TemplateRequest_Urgency
*/
public final slm.proxies.Urgency getTemplateRequest_Urgency(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
{
slm.proxies.Urgency result = null;
com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.TemplateRequest_Urgency.toString());
if (identifier != null)
result = slm.proxies.Urgency.load(context, identifier);
return result;
}
/**
* Set value of TemplateRequest_Urgency
* @param templaterequest_urgency
*/
public final void setTemplateRequest_Urgency(slm.proxies.Urgency templaterequest_urgency)
{
setTemplateRequest_Urgency(getContext(), templaterequest_urgency);
}
/**
* Set value of TemplateRequest_Urgency
* @param context
* @param templaterequest_urgency
*/
public final void setTemplateRequest_Urgency(com.mendix.systemwideinterfaces.core.IContext context, slm.proxies.Urgency templaterequest_urgency)
{
if (templaterequest_urgency == null)
getMendixObject().setValue(context, MemberNames.TemplateRequest_Urgency.toString(), null);
else
getMendixObject().setValue(context, MemberNames.TemplateRequest_Urgency.toString(), templaterequest_urgency.getMendixObject().getId());
}
/**
* @return value of TemplateRequest_Priority
*/
public final slm.proxies.Priority getTemplateRequest_Priority() throws com.mendix.core.CoreException
{
return getTemplateRequest_Priority(getContext());
}
/**
* @param context
* @return value of TemplateRequest_Priority
*/
public final slm.proxies.Priority getTemplateRequest_Priority(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
{
slm.proxies.Priority result = null;
com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.TemplateRequest_Priority.toString());
if (identifier != null)
result = slm.proxies.Priority.load(context, identifier);
return result;
}
/**
* Set value of TemplateRequest_Priority
* @param templaterequest_priority
*/
public final void setTemplateRequest_Priority(slm.proxies.Priority templaterequest_priority)
{
setTemplateRequest_Priority(getContext(), templaterequest_priority);
}
/**
* Set value of TemplateRequest_Priority
* @param context
* @param templaterequest_priority
*/
public final void setTemplateRequest_Priority(com.mendix.systemwideinterfaces.core.IContext context, slm.proxies.Priority templaterequest_priority)
{
if (templaterequest_priority == null)
getMendixObject().setValue(context, MemberNames.TemplateRequest_Priority.toString(), null);
else
getMendixObject().setValue(context, MemberNames.TemplateRequest_Priority.toString(), templaterequest_priority.getMendixObject().getId());
}
/**
* @return value of TemplateRequest_Person
*/
public final nap.proxies.Person getTemplateRequest_Person() throws com.mendix.core.CoreException
{
return getTemplateRequest_Person(getContext());
}
/**
* @param context
* @return value of TemplateRequest_Person
*/
public final nap.proxies.Person getTemplateRequest_Person(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
{
nap.proxies.Person result = null;
com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.TemplateRequest_Person.toString());
if (identifier != null)
result = nap.proxies.Person.load(context, identifier);
return result;
}
/**
* Set value of TemplateRequest_Person
* @param templaterequest_person
*/
public final void setTemplateRequest_Person(nap.proxies.Person templaterequest_person)
{
setTemplateRequest_Person(getContext(), templaterequest_person);
}
/**
* Set value of TemplateRequest_Person
* @param context
* @param templaterequest_person
*/
public final void setTemplateRequest_Person(com.mendix.systemwideinterfaces.core.IContext context, nap.proxies.Person templaterequest_person)
{
if (templaterequest_person == null)
getMendixObject().setValue(context, MemberNames.TemplateRequest_Person.toString(), null);
else
getMendixObject().setValue(context, MemberNames.TemplateRequest_Person.toString(), templaterequest_person.getMendixObject().getId());
}
/**
* @return value of TemplateRequest_Location
*/
public final nap.proxies.Location getTemplateRequest_Location() throws com.mendix.core.CoreException
{
return getTemplateRequest_Location(getContext());
}
/**
* @param context
* @return value of TemplateRequest_Location
*/
public final nap.proxies.Location getTemplateRequest_Location(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
{
nap.proxies.Location result = null;
com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.TemplateRequest_Location.toString());
if (identifier != null)
result = nap.proxies.Location.load(context, identifier);
return result;
}
/**
* Set value of TemplateRequest_Location
* @param templaterequest_location
*/
public final void setTemplateRequest_Location(nap.proxies.Location templaterequest_location)
{
setTemplateRequest_Location(getContext(), templaterequest_location);
}
/**
* Set value of TemplateRequest_Location
* @param context
* @param templaterequest_location
*/
public final void setTemplateRequest_Location(com.mendix.systemwideinterfaces.core.IContext context, nap.proxies.Location templaterequest_location)
{
if (templaterequest_location == null)
getMendixObject().setValue(context, MemberNames.TemplateRequest_Location.toString(), null);
else
getMendixObject().setValue(context, MemberNames.TemplateRequest_Location.toString(), templaterequest_location.getMendixObject().getId());
}
/**
* @return value of Receiving_Organisation_TR
*/
public final nap.proxies.Organisation getReceiving_Organisation_TR() throws com.mendix.core.CoreException
{
return getReceiving_Organisation_TR(getContext());
}
/**
* @param context
* @return value of Receiving_Organisation_TR
*/
public final nap.proxies.Organisation getReceiving_Organisation_TR(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
{
nap.proxies.Organisation result = null;
com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.Receiving_Organisation_TR.toString());
if (identifier != null)
result = nap.proxies.Organisation.load(context, identifier);
return result;
}
/**
* Set value of Receiving_Organisation_TR
* @param receiving_organisation_tr
*/
public final void setReceiving_Organisation_TR(nap.proxies.Organisation receiving_organisation_tr)
{
setReceiving_Organisation_TR(getContext(), receiving_organisation_tr);
}
/**
* Set value of Receiving_Organisation_TR
* @param context
* @param receiving_organisation_tr
*/
public final void setReceiving_Organisation_TR(com.mendix.systemwideinterfaces.core.IContext context, nap.proxies.Organisation receiving_organisation_tr)
{
if (receiving_organisation_tr == null)
getMendixObject().setValue(context, MemberNames.Receiving_Organisation_TR.toString(), null);
else
getMendixObject().setValue(context, MemberNames.Receiving_Organisation_TR.toString(), receiving_organisation_tr.getMendixObject().getId());
}
/**
* @return value of Delivering_Organisation_TR
*/
public final nap.proxies.Organisation getDelivering_Organisation_TR() throws com.mendix.core.CoreException
{
return getDelivering_Organisation_TR(getContext());
}
/**
* @param context
* @return value of Delivering_Organisation_TR
*/
public final nap.proxies.Organisation getDelivering_Organisation_TR(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
{
nap.proxies.Organisation result = null;
com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.Delivering_Organisation_TR.toString());
if (identifier != null)
result = nap.proxies.Organisation.load(context, identifier);
return result;
}
/**
* Set value of Delivering_Organisation_TR
* @param delivering_organisation_tr
*/
public final void setDelivering_Organisation_TR(nap.proxies.Organisation delivering_organisation_tr)
{
setDelivering_Organisation_TR(getContext(), delivering_organisation_tr);
}
/**
* Set value of Delivering_Organisation_TR
* @param context
* @param delivering_organisation_tr
*/
public final void setDelivering_Organisation_TR(com.mendix.systemwideinterfaces.core.IContext context, nap.proxies.Organisation delivering_organisation_tr)
{
if (delivering_organisation_tr == null)
getMendixObject().setValue(context, MemberNames.Delivering_Organisation_TR.toString(), null);
else
getMendixObject().setValue(context, MemberNames.Delivering_Organisation_TR.toString(), delivering_organisation_tr.getMendixObject().getId());
}
/**
* @return value of TemplateRequest_Location_Caller
*/
public final nap.proxies.Location getTemplateRequest_Location_Caller() throws com.mendix.core.CoreException
{
return getTemplateRequest_Location_Caller(getContext());
}
/**
* @param context
* @return value of TemplateRequest_Location_Caller
*/
public final nap.proxies.Location getTemplateRequest_Location_Caller(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
{
nap.proxies.Location result = null;
com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.TemplateRequest_Location_Caller.toString());
if (identifier != null)
result = nap.proxies.Location.load(context, identifier);
return result;
}
/**
* Set value of TemplateRequest_Location_Caller
* @param templaterequest_location_caller
*/
public final void setTemplateRequest_Location_Caller(nap.proxies.Location templaterequest_location_caller)
{
setTemplateRequest_Location_Caller(getContext(), templaterequest_location_caller);
}
/**
* Set value of TemplateRequest_Location_Caller
* @param context
* @param templaterequest_location_caller
*/
public final void setTemplateRequest_Location_Caller(com.mendix.systemwideinterfaces.core.IContext context, nap.proxies.Location templaterequest_location_caller)
{
if (templaterequest_location_caller == null)
getMendixObject().setValue(context, MemberNames.TemplateRequest_Location_Caller.toString(), null);
else
getMendixObject().setValue(context, MemberNames.TemplateRequest_Location_Caller.toString(), templaterequest_location_caller.getMendixObject().getId());
}
/**
* @return value of TemplateRequest_Person_Caller
*/
public final nap.proxies.Person getTemplateRequest_Person_Caller() throws com.mendix.core.CoreException
{
return getTemplateRequest_Person_Caller(getContext());
}
/**
* @param context
* @return value of TemplateRequest_Person_Caller
*/
public final nap.proxies.Person getTemplateRequest_Person_Caller(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
{
nap.proxies.Person result = null;
com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.TemplateRequest_Person_Caller.toString());
if (identifier != null)
result = nap.proxies.Person.load(context, identifier);
return result;
}
/**
* Set value of TemplateRequest_Person_Caller
* @param templaterequest_person_caller
*/
public final void setTemplateRequest_Person_Caller(nap.proxies.Person templaterequest_person_caller)
{
setTemplateRequest_Person_Caller(getContext(), templaterequest_person_caller);
}
/**
* Set value of TemplateRequest_Person_Caller
* @param context
* @param templaterequest_person_caller
*/
public final void setTemplateRequest_Person_Caller(com.mendix.systemwideinterfaces.core.IContext context, nap.proxies.Person templaterequest_person_caller)
{
if (templaterequest_person_caller == null)
getMendixObject().setValue(context, MemberNames.TemplateRequest_Person_Caller.toString(), null);
else
getMendixObject().setValue(context, MemberNames.TemplateRequest_Person_Caller.toString(), templaterequest_person_caller.getMendixObject().getId());
}
/**
* @return value of TemplateRequest_ConfigurationItem
*/
public final cmdb.proxies.ConfigurationItem getTemplateRequest_ConfigurationItem() throws com.mendix.core.CoreException
{
return getTemplateRequest_ConfigurationItem(getContext());
}
/**
* @param context
* @return value of TemplateRequest_ConfigurationItem
*/
public final cmdb.proxies.ConfigurationItem getTemplateRequest_ConfigurationItem(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
{
cmdb.proxies.ConfigurationItem result = null;
com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.TemplateRequest_ConfigurationItem.toString());
if (identifier != null)
result = cmdb.proxies.ConfigurationItem.load(context, identifier);
return result;
}
/**
* Set value of TemplateRequest_ConfigurationItem
* @param templaterequest_configurationitem
*/
public final void setTemplateRequest_ConfigurationItem(cmdb.proxies.ConfigurationItem templaterequest_configurationitem)
{
setTemplateRequest_ConfigurationItem(getContext(), templaterequest_configurationitem);
}
/**
* Set value of TemplateRequest_ConfigurationItem
* @param context
* @param templaterequest_configurationitem
*/
public final void setTemplateRequest_ConfigurationItem(com.mendix.systemwideinterfaces.core.IContext context, cmdb.proxies.ConfigurationItem templaterequest_configurationitem)
{
if (templaterequest_configurationitem == null)
getMendixObject().setValue(context, MemberNames.TemplateRequest_ConfigurationItem.toString(), null);
else
getMendixObject().setValue(context, MemberNames.TemplateRequest_ConfigurationItem.toString(), templaterequest_configurationitem.getMendixObject().getId());
}
/**
* @return value of TemplateRequests_Affected_Items
*/
public final java.util.List<cmdb.proxies.ConfigurationItem> getTemplateRequests_Affected_Items() throws com.mendix.core.CoreException
{
return getTemplateRequests_Affected_Items(getContext());
}
/**
* @param context
* @return value of TemplateRequests_Affected_Items
*/
@SuppressWarnings("unchecked")
public final java.util.List<cmdb.proxies.ConfigurationItem> getTemplateRequests_Affected_Items(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
{
java.util.List<cmdb.proxies.ConfigurationItem> result = new java.util.ArrayList<cmdb.proxies.ConfigurationItem>();
Object valueObject = getMendixObject().getValue(context, MemberNames.TemplateRequests_Affected_Items.toString());
if (valueObject == null)
return result;
for (com.mendix.systemwideinterfaces.core.IMendixObject mendixObject : com.mendix.core.Core.retrieveIdList(context, (java.util.List<com.mendix.systemwideinterfaces.core.IMendixIdentifier>) valueObject))
result.add(cmdb.proxies.ConfigurationItem.initialize(context, mendixObject));
return result;
}
/**
* Set value of TemplateRequests_Affected_Items
* @param templaterequests_affected_items
*/
public final void setTemplateRequests_Affected_Items(java.util.List<cmdb.proxies.ConfigurationItem> templaterequests_affected_items)
{
setTemplateRequests_Affected_Items(getContext(), templaterequests_affected_items);
}
/**
* Set value of TemplateRequests_Affected_Items
* @param context
* @param templaterequests_affected_items
*/
public final void setTemplateRequests_Affected_Items(com.mendix.systemwideinterfaces.core.IContext context, java.util.List<cmdb.proxies.ConfigurationItem> templaterequests_affected_items)
{
java.util.List<com.mendix.systemwideinterfaces.core.IMendixIdentifier> identifiers = new java.util.ArrayList<com.mendix.systemwideinterfaces.core.IMendixIdentifier>();
for (cmdb.proxies.ConfigurationItem proxyObject : templaterequests_affected_items)
identifiers.add(proxyObject.getMendixObject().getId());
getMendixObject().setValue(context, MemberNames.TemplateRequests_Affected_Items.toString(), identifiers);
}
/**
* @return value of TemplateRequest_Organisation_Caller
*/
public final nap.proxies.Organisation getTemplateRequest_Organisation_Caller() throws com.mendix.core.CoreException
{
return getTemplateRequest_Organisation_Caller(getContext());
}
/**
* @param context
* @return value of TemplateRequest_Organisation_Caller
*/
public final nap.proxies.Organisation getTemplateRequest_Organisation_Caller(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
{
nap.proxies.Organisation result = null;
com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.TemplateRequest_Organisation_Caller.toString());
if (identifier != null)
result = nap.proxies.Organisation.load(context, identifier);
return result;
}
/**
* Set value of TemplateRequest_Organisation_Caller
* @param templaterequest_organisation_caller
*/
public final void setTemplateRequest_Organisation_Caller(nap.proxies.Organisation templaterequest_organisation_caller)
{
setTemplateRequest_Organisation_Caller(getContext(), templaterequest_organisation_caller);
}
/**
* Set value of TemplateRequest_Organisation_Caller
* @param context
* @param templaterequest_organisation_caller
*/
public final void setTemplateRequest_Organisation_Caller(com.mendix.systemwideinterfaces.core.IContext context, nap.proxies.Organisation templaterequest_organisation_caller)
{
if (templaterequest_organisation_caller == null)
getMendixObject().setValue(context, MemberNames.TemplateRequest_Organisation_Caller.toString(), null);
else
getMendixObject().setValue(context, MemberNames.TemplateRequest_Organisation_Caller.toString(), templaterequest_organisation_caller.getMendixObject().getId());
}
/**
* @return value of TemplateRequest_Room
*/
public final nap.proxies.Room getTemplateRequest_Room() throws com.mendix.core.CoreException
{
return getTemplateRequest_Room(getContext());
}
/**
* @param context
* @return value of TemplateRequest_Room
*/
public final nap.proxies.Room getTemplateRequest_Room(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
{
nap.proxies.Room result = null;
com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.TemplateRequest_Room.toString());
if (identifier != null)
result = nap.proxies.Room.load(context, identifier);
return result;
}
/**
* Set value of TemplateRequest_Room
* @param templaterequest_room
*/
public final void setTemplateRequest_Room(nap.proxies.Room templaterequest_room)
{
setTemplateRequest_Room(getContext(), templaterequest_room);
}
/**
* Set value of TemplateRequest_Room
* @param context
* @param templaterequest_room
*/
public final void setTemplateRequest_Room(com.mendix.systemwideinterfaces.core.IContext context, nap.proxies.Room templaterequest_room)
{
if (templaterequest_room == null)
getMendixObject().setValue(context, MemberNames.TemplateRequest_Room.toString(), null);
else
getMendixObject().setValue(context, MemberNames.TemplateRequest_Room.toString(), templaterequest_room.getMendixObject().getId());
}
/**
* @return value of TemplateRequest_Category_Opening
*/
public final categories.proxies.Category getTemplateRequest_Category_Opening() throws com.mendix.core.CoreException
{
return getTemplateRequest_Category_Opening(getContext());
}
/**
* @param context
* @return value of TemplateRequest_Category_Opening
*/
public final categories.proxies.Category getTemplateRequest_Category_Opening(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
{
categories.proxies.Category result = null;
com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.TemplateRequest_Category_Opening.toString());
if (identifier != null)
result = categories.proxies.Category.load(context, identifier);
return result;
}
/**
* Set value of TemplateRequest_Category_Opening
* @param templaterequest_category_opening
*/
public final void setTemplateRequest_Category_Opening(categories.proxies.Category templaterequest_category_opening)
{
setTemplateRequest_Category_Opening(getContext(), templaterequest_category_opening);
}
/**
* Set value of TemplateRequest_Category_Opening
* @param context
* @param templaterequest_category_opening
*/
public final void setTemplateRequest_Category_Opening(com.mendix.systemwideinterfaces.core.IContext context, categories.proxies.Category templaterequest_category_opening)
{
if (templaterequest_category_opening == null)
getMendixObject().setValue(context, MemberNames.TemplateRequest_Category_Opening.toString(), null);
else
getMendixObject().setValue(context, MemberNames.TemplateRequest_Category_Opening.toString(), templaterequest_category_opening.getMendixObject().getId());
}
/**
* @return value of TemplateRequest_ConfigurationItem_2
*/
public final cmdb.proxies.ConfigurationItem getTemplateRequest_ConfigurationItem_2() throws com.mendix.core.CoreException
{
return getTemplateRequest_ConfigurationItem_2(getContext());
}
/**
* @param context
* @return value of TemplateRequest_ConfigurationItem_2
*/
public final cmdb.proxies.ConfigurationItem getTemplateRequest_ConfigurationItem_2(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
{
cmdb.proxies.ConfigurationItem result = null;
com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.TemplateRequest_ConfigurationItem_2.toString());
if (identifier != null)
result = cmdb.proxies.ConfigurationItem.load(context, identifier);
return result;
}
/**
* Set value of TemplateRequest_ConfigurationItem_2
* @param templaterequest_configurationitem_2
*/
public final void setTemplateRequest_ConfigurationItem_2(cmdb.proxies.ConfigurationItem templaterequest_configurationitem_2)
{
setTemplateRequest_ConfigurationItem_2(getContext(), templaterequest_configurationitem_2);
}
/**
* Set value of TemplateRequest_ConfigurationItem_2
* @param context
* @param templaterequest_configurationitem_2
*/
public final void setTemplateRequest_ConfigurationItem_2(com.mendix.systemwideinterfaces.core.IContext context, cmdb.proxies.ConfigurationItem templaterequest_configurationitem_2)
{
if (templaterequest_configurationitem_2 == null)
getMendixObject().setValue(context, MemberNames.TemplateRequest_ConfigurationItem_2.toString(), null);
else
getMendixObject().setValue(context, MemberNames.TemplateRequest_ConfigurationItem_2.toString(), templaterequest_configurationitem_2.getMendixObject().getId());
}
/**
* @return value of TemplateRequest_ConfigurationItem_3
*/
public final cmdb.proxies.ConfigurationItem getTemplateRequest_ConfigurationItem_3() throws com.mendix.core.CoreException
{
return getTemplateRequest_ConfigurationItem_3(getContext());
}
/**
* @param context
* @return value of TemplateRequest_ConfigurationItem_3
*/
public final cmdb.proxies.ConfigurationItem getTemplateRequest_ConfigurationItem_3(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
{
cmdb.proxies.ConfigurationItem result = null;
com.mendix.systemwideinterfaces.core.IMendixIdentifier identifier = getMendixObject().getValue(context, MemberNames.TemplateRequest_ConfigurationItem_3.toString());
if (identifier != null)
result = cmdb.proxies.ConfigurationItem.load(context, identifier);
return result;
}
/**
* Set value of TemplateRequest_ConfigurationItem_3
* @param templaterequest_configurationitem_3
*/
public final void setTemplateRequest_ConfigurationItem_3(cmdb.proxies.ConfigurationItem templaterequest_configurationitem_3)
{
setTemplateRequest_ConfigurationItem_3(getContext(), templaterequest_configurationitem_3);
}
/**
* Set value of TemplateRequest_ConfigurationItem_3
* @param context
* @param templaterequest_configurationitem_3
*/
public final void setTemplateRequest_ConfigurationItem_3(com.mendix.systemwideinterfaces.core.IContext context, cmdb.proxies.ConfigurationItem templaterequest_configurationitem_3)
{
if (templaterequest_configurationitem_3 == null)
getMendixObject().setValue(context, MemberNames.TemplateRequest_ConfigurationItem_3.toString(), null);
else
getMendixObject().setValue(context, MemberNames.TemplateRequest_ConfigurationItem_3.toString(), templaterequest_configurationitem_3.getMendixObject().getId());
}
/**
* @return value of TemplateRequest_AffectedUsers
*/
public final java.util.List<customlvnl.proxies.AffectedUsers> getTemplateRequest_AffectedUsers() throws com.mendix.core.CoreException
{
return getTemplateRequest_AffectedUsers(getContext());
}
/**
* @param context
* @return value of TemplateRequest_AffectedUsers
*/
@SuppressWarnings("unchecked")
public final java.util.List<customlvnl.proxies.AffectedUsers> getTemplateRequest_AffectedUsers(com.mendix.systemwideinterfaces.core.IContext context) throws com.mendix.core.CoreException
{
java.util.List<customlvnl.proxies.AffectedUsers> result = new java.util.ArrayList<customlvnl.proxies.AffectedUsers>();
Object valueObject = getMendixObject().getValue(context, MemberNames.TemplateRequest_AffectedUsers.toString());
if (valueObject == null)
return result;
for (com.mendix.systemwideinterfaces.core.IMendixObject mendixObject : com.mendix.core.Core.retrieveIdList(context, (java.util.List<com.mendix.systemwideinterfaces.core.IMendixIdentifier>) valueObject))
result.add(customlvnl.proxies.AffectedUsers.initialize(context, mendixObject));
return result;
}
/**
* Set value of TemplateRequest_AffectedUsers
* @param templaterequest_affectedusers
*/
public final void setTemplateRequest_AffectedUsers(java.util.List<customlvnl.proxies.AffectedUsers> templaterequest_affectedusers)
{
setTemplateRequest_AffectedUsers(getContext(), templaterequest_affectedusers);
}
/**
* Set value of TemplateRequest_AffectedUsers
* @param context
* @param templaterequest_affectedusers
*/
public final void setTemplateRequest_AffectedUsers(com.mendix.systemwideinterfaces.core.IContext context, java.util.List<customlvnl.proxies.AffectedUsers> templaterequest_affectedusers)
{
java.util.List<com.mendix.systemwideinterfaces.core.IMendixIdentifier> identifiers = new java.util.ArrayList<com.mendix.systemwideinterfaces.core.IMendixIdentifier>();
for (customlvnl.proxies.AffectedUsers proxyObject : templaterequest_affectedusers)
identifiers.add(proxyObject.getMendixObject().getId());
getMendixObject().setValue(context, MemberNames.TemplateRequest_AffectedUsers.toString(), identifiers);
}
/**
* @return the IMendixObject instance of this proxy for use in the Core interface.
*/
public final com.mendix.systemwideinterfaces.core.IMendixObject getMendixObject()
{
return templateRequestMendixObject;
}
/**
* @return the IContext instance of this proxy, or null if no IContext instance was specified at initialization.
*/
public final com.mendix.systemwideinterfaces.core.IContext getContext()
{
return context;
}
@Override
public boolean equals(Object obj)
{
if (obj == this)
return true;
if (obj != null && getClass().equals(obj.getClass()))
{
final scheduling.proxies.TemplateRequest that = (scheduling.proxies.TemplateRequest) obj;
return getMendixObject().equals(that.getMendixObject());
}
return false;
}
@Override
public int hashCode()
{
return getMendixObject().hashCode();
}
/**
* @return String name of this class
*/
public static java.lang.String getType()
{
return "Scheduling.TemplateRequest";
}
/**
* @return String GUID from this object, format: ID_0000000000
* @deprecated Use getMendixObject().getId().toLong() to get a unique identifier for this object.
*/
@Deprecated
public java.lang.String getGUID()
{
return "ID_" + getMendixObject().getId().toLong();
}
}
| 35.079617 | 226 | 0.766339 |
0fe18ac955ea1f469bfc6d35ce2f568ecef299da | 2,508 | /*
* 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.iotdb.db.metadata.rescon;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
import org.apache.iotdb.db.metadata.mtree.store.disk.MTreeFlushTaskManager;
import org.apache.iotdb.db.metadata.mtree.store.disk.MTreeReleaseTaskManager;
import org.apache.iotdb.db.metadata.mtree.store.disk.memcontrol.MemManagerHolder;
import org.apache.iotdb.db.metadata.schemaregion.SchemaEngineMode;
public class SchemaResourceManager {
private SchemaResourceManager() {}
public static void initSchemaResource() {
TimeseriesStatistics.getInstance().init();
MemoryStatistics.getInstance().init();
if (IoTDBDescriptor.getInstance()
.getConfig()
.getSchemaEngineMode()
.equals(SchemaEngineMode.Schema_File.toString())) {
initSchemaFileModeResource();
}
}
public static void clearSchemaResource() {
TimeseriesStatistics.getInstance().clear();
MemoryStatistics.getInstance().clear();
if (IoTDBDescriptor.getInstance()
.getConfig()
.getSchemaEngineMode()
.equals(SchemaEngineMode.Schema_File.toString())) {
clearSchemaFileModeResource();
}
}
private static void initSchemaFileModeResource() {
MemManagerHolder.initMemManagerInstance();
MemManagerHolder.getMemManagerInstance().init();
MTreeFlushTaskManager.getInstance().init();
MTreeReleaseTaskManager.getInstance().init();
}
private static void clearSchemaFileModeResource() {
MemManagerHolder.getMemManagerInstance().clear();
// the release task may submit flush task, thus must be shut down and clear first
MTreeReleaseTaskManager.getInstance().clear();
MTreeFlushTaskManager.getInstance().clear();
}
}
| 36.882353 | 85 | 0.748006 |
a4eb6535abf34298410e522eed6b216eeb086120 | 369 | package com.kaleido.fetch.domain.enumeration;
public enum PlateMapStatus {
DRAFT("Draft"), COMPLETED("Completed");
private final String plateMapStatusDescription;
private PlateMapStatus(String value) {
plateMapStatusDescription = value;
}
public String getPlateMapStatusDescription() {
return plateMapStatusDescription;
}
}
| 21.705882 | 51 | 0.723577 |
46f02b5f64474823dfad8b927cac5d2444a2de32 | 1,323 | package org.teachingkidsprogramming.recipes.completed.section02methods;
import org.teachingextensions.logo.Tortoise;
import org.teachingkidsprogramming.recipes.quizzes.graders.HousesQuizAdapter;
import org.teachingkidsprogramming.recipes.quizzes.graders.HousesQuizGrader;
public class HousesQuiz extends HousesQuizAdapter
{
public void small()
{
// 'The current length is 7
length = 7;
}
// 'Create a subroutine called Medium
public void medium()
{
// ' that sets the current length to 21
length = 21;
}
// 'Create a subroutine called Large
public void large()
{
// that sets the current length to 63
length = 63;
}
// Create a subroutine called MoveTheLength
public void moveTheLength()
{
// ' that moves the Tortoise the current length
Tortoise.move(length);
}
// Create a subroutine called TurnTheCorner
public void turnTheCorner()
{
// that turns the Tortoise 1/3 of 360 degrees to the left
Tortoise.turn(-360.0 / 3);
}
// Create a subroutine called DrawASide
public void drawASide()
{
// that calls MoveTheLength and TurnTheCorner
question4();
question5();
}
public static void main(String[] args)
{
new HousesQuizGrader().grade(new HousesQuiz());
}
}
| 26.46 | 77 | 0.676493 |
b8c7da92a2b2d4dad51005db8867af25cf3c2b21 | 311 | package uk.gov.hmcts.cmc.claimstore.services.staff.models;
import lombok.Builder;
import lombok.Value;
import javax.validation.constraints.NotNull;
@Builder
@Value
public class ExpertReportContent {
@NotNull
private final String expertName;
@NotNull
private final String expertReportDate;
}
| 18.294118 | 58 | 0.778135 |
88573d921cc5c6074992d63fb2c6507e54df1d79 | 12,278 | /**
* Copyright (c) 2016-present, RxJava Contributors.
*
* 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.reactivex.internal.operators.observable;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import java.util.NoSuchElementException;
import org.junit.Test;
import org.mockito.InOrder;
import io.reactivex.*;
import io.reactivex.exceptions.TestException;
import io.reactivex.functions.*;
import io.reactivex.testsupport.TestHelper;
public class ObservableLastTest {
@Test
public void lastWithElements() {
Maybe<Integer> last = Observable.just(1, 2, 3).lastElement();
assertEquals(3, last.blockingGet().intValue());
}
@Test
public void lastWithNoElements() {
Maybe<?> last = Observable.empty().lastElement();
assertNull(last.blockingGet());
}
@Test
public void lastMultiSubscribe() {
Maybe<Integer> last = Observable.just(1, 2, 3).lastElement();
assertEquals(3, last.blockingGet().intValue());
assertEquals(3, last.blockingGet().intValue());
}
@Test
public void lastViaObservable() {
Observable.just(1, 2, 3).lastElement();
}
@Test
public void last() {
Maybe<Integer> o = Observable.just(1, 2, 3).lastElement();
MaybeObserver<Integer> observer = TestHelper.mockMaybeObserver();
o.subscribe(observer);
InOrder inOrder = inOrder(observer);
inOrder.verify(observer, times(1)).onSuccess(3);
// inOrder.verify(observer, times(1)).onComplete();
inOrder.verifyNoMoreInteractions();
}
@Test
public void lastWithOneElement() {
Maybe<Integer> o = Observable.just(1).lastElement();
MaybeObserver<Integer> observer = TestHelper.mockMaybeObserver();
o.subscribe(observer);
InOrder inOrder = inOrder(observer);
inOrder.verify(observer, times(1)).onSuccess(1);
// inOrder.verify(observer, times(1)).onComplete();
inOrder.verifyNoMoreInteractions();
}
@Test
public void lastWithEmpty() {
Maybe<Integer> o = Observable.<Integer> empty().lastElement();
MaybeObserver<Integer> observer = TestHelper.mockMaybeObserver();
o.subscribe(observer);
InOrder inOrder = inOrder(observer);
inOrder.verify(observer).onComplete();
inOrder.verify(observer, never()).onError(any(Throwable.class));
inOrder.verifyNoMoreInteractions();
}
@Test
public void lastWithPredicate() {
Maybe<Integer> o = Observable.just(1, 2, 3, 4, 5, 6)
.filter(new Predicate<Integer>() {
@Override
public boolean test(Integer t1) {
return t1 % 2 == 0;
}
})
.lastElement();
MaybeObserver<Integer> observer = TestHelper.mockMaybeObserver();
o.subscribe(observer);
InOrder inOrder = inOrder(observer);
inOrder.verify(observer, times(1)).onSuccess(6);
// inOrder.verify(observer, times(1)).onComplete();
inOrder.verifyNoMoreInteractions();
}
@Test
public void lastWithPredicateAndOneElement() {
Maybe<Integer> o = Observable.just(1, 2)
.filter(
new Predicate<Integer>() {
@Override
public boolean test(Integer t1) {
return t1 % 2 == 0;
}
})
.lastElement();
MaybeObserver<Integer> observer = TestHelper.mockMaybeObserver();
o.subscribe(observer);
InOrder inOrder = inOrder(observer);
inOrder.verify(observer, times(1)).onSuccess(2);
// inOrder.verify(observer, times(1)).onComplete();
inOrder.verifyNoMoreInteractions();
}
@Test
public void lastWithPredicateAndEmpty() {
Maybe<Integer> o = Observable.just(1)
.filter(
new Predicate<Integer>() {
@Override
public boolean test(Integer t1) {
return t1 % 2 == 0;
}
}).lastElement();
MaybeObserver<Integer> observer = TestHelper.mockMaybeObserver();
o.subscribe(observer);
InOrder inOrder = inOrder(observer);
inOrder.verify(observer).onComplete();
inOrder.verify(observer, never()).onError(any(Throwable.class));
inOrder.verifyNoMoreInteractions();
}
@Test
public void lastOrDefault() {
Single<Integer> o = Observable.just(1, 2, 3)
.last(4);
SingleObserver<Integer> observer = TestHelper.mockSingleObserver();
o.subscribe(observer);
InOrder inOrder = inOrder(observer);
inOrder.verify(observer, times(1)).onSuccess(3);
// inOrder.verify(observer, times(1)).onComplete();
inOrder.verifyNoMoreInteractions();
}
@Test
public void lastOrDefaultWithOneElement() {
Single<Integer> o = Observable.just(1).last(2);
SingleObserver<Integer> observer = TestHelper.mockSingleObserver();
o.subscribe(observer);
InOrder inOrder = inOrder(observer);
inOrder.verify(observer, times(1)).onSuccess(1);
// inOrder.verify(observer, times(1)).onComplete();
inOrder.verifyNoMoreInteractions();
}
@Test
public void lastOrDefaultWithEmpty() {
Single<Integer> o = Observable.<Integer> empty()
.last(1);
SingleObserver<Integer> observer = TestHelper.mockSingleObserver();
o.subscribe(observer);
InOrder inOrder = inOrder(observer);
inOrder.verify(observer, times(1)).onSuccess(1);
// inOrder.verify(observer, times(1)).onComplete();
inOrder.verifyNoMoreInteractions();
}
@Test
public void lastOrDefaultWithPredicate() {
Single<Integer> o = Observable.just(1, 2, 3, 4, 5, 6)
.filter(new Predicate<Integer>() {
@Override
public boolean test(Integer t1) {
return t1 % 2 == 0;
}
})
.last(8);
SingleObserver<Integer> observer = TestHelper.mockSingleObserver();
o.subscribe(observer);
InOrder inOrder = inOrder(observer);
inOrder.verify(observer, times(1)).onSuccess(6);
// inOrder.verify(observer, times(1)).onComplete();
inOrder.verifyNoMoreInteractions();
}
@Test
public void lastOrDefaultWithPredicateAndOneElement() {
Single<Integer> o = Observable.just(1, 2)
.filter(new Predicate<Integer>() {
@Override
public boolean test(Integer t1) {
return t1 % 2 == 0;
}
})
.last(4);
SingleObserver<Integer> observer = TestHelper.mockSingleObserver();
o.subscribe(observer);
InOrder inOrder = inOrder(observer);
inOrder.verify(observer, times(1)).onSuccess(2);
// inOrder.verify(observer, times(1)).onComplete();
inOrder.verifyNoMoreInteractions();
}
@Test
public void lastOrDefaultWithPredicateAndEmpty() {
Single<Integer> o = Observable.just(1)
.filter(
new Predicate<Integer>() {
@Override
public boolean test(Integer t1) {
return t1 % 2 == 0;
}
})
.last(2);
SingleObserver<Integer> observer = TestHelper.mockSingleObserver();
o.subscribe(observer);
InOrder inOrder = inOrder(observer);
inOrder.verify(observer, times(1)).onSuccess(2);
// inOrder.verify(observer, times(1)).onComplete();
inOrder.verifyNoMoreInteractions();
}
@Test
public void lastOrErrorNoElement() {
Observable.empty()
.lastOrError()
.test()
.assertNoValues()
.assertError(NoSuchElementException.class);
}
@Test
public void lastOrErrorOneElement() {
Observable.just(1)
.lastOrError()
.test()
.assertNoErrors()
.assertValue(1);
}
@Test
public void lastOrErrorMultipleElements() {
Observable.just(1, 2, 3)
.lastOrError()
.test()
.assertNoErrors()
.assertValue(3);
}
@Test
public void lastOrErrorError() {
Observable.error(new RuntimeException("error"))
.lastOrError()
.to(TestHelper.testConsumer())
.assertNoValues()
.assertErrorMessage("error")
.assertError(RuntimeException.class);
}
@Test
public void dispose() {
TestHelper.checkDisposed(Observable.never().lastElement().toObservable());
TestHelper.checkDisposed(Observable.never().lastElement());
TestHelper.checkDisposed(Observable.just(1).lastOrError().toObservable());
TestHelper.checkDisposed(Observable.just(1).lastOrError());
TestHelper.checkDisposed(Observable.just(1).last(2).toObservable());
TestHelper.checkDisposed(Observable.just(1).last(2));
}
@Test
public void doubleOnSubscribe() {
TestHelper.checkDoubleOnSubscribeObservableToMaybe(new Function<Observable<Object>, MaybeSource<Object>>() {
@Override
public MaybeSource<Object> apply(Observable<Object> o) throws Exception {
return o.lastElement();
}
});
TestHelper.checkDoubleOnSubscribeObservable(new Function<Observable<Object>, ObservableSource<Object>>() {
@Override
public ObservableSource<Object> apply(Observable<Object> o) throws Exception {
return o.lastElement().toObservable();
}
});
TestHelper.checkDoubleOnSubscribeObservableToSingle(new Function<Observable<Object>, SingleSource<Object>>() {
@Override
public SingleSource<Object> apply(Observable<Object> o) throws Exception {
return o.lastOrError();
}
});
TestHelper.checkDoubleOnSubscribeObservable(new Function<Observable<Object>, ObservableSource<Object>>() {
@Override
public ObservableSource<Object> apply(Observable<Object> o) throws Exception {
return o.lastOrError().toObservable();
}
});
TestHelper.checkDoubleOnSubscribeObservableToSingle(new Function<Observable<Object>, SingleSource<Object>>() {
@Override
public SingleSource<Object> apply(Observable<Object> o) throws Exception {
return o.last(2);
}
});
TestHelper.checkDoubleOnSubscribeObservable(new Function<Observable<Object>, ObservableSource<Object>>() {
@Override
public ObservableSource<Object> apply(Observable<Object> o) throws Exception {
return o.last(2).toObservable();
}
});
}
@Test
public void error() {
Observable.error(new TestException())
.lastElement()
.test()
.assertFailure(TestException.class);
}
@Test
public void errorLastOrErrorObservable() {
Observable.error(new TestException())
.lastOrError()
.toObservable()
.test()
.assertFailure(TestException.class);
}
@Test
public void emptyLastOrErrorObservable() {
Observable.empty()
.lastOrError()
.toObservable()
.test()
.assertFailure(NoSuchElementException.class);
}
}
| 32.310526 | 118 | 0.59684 |
369e37a9126a10e11dd98cb302b3d9ef536d67c5 | 1,435 | // This file is auto-generated, don't edit it. Thanks.
package com.antgroup.antchain.openapi.industry.models;
import com.aliyun.tea.*;
public class ContactInfo extends TeaModel {
// 联系人姓名
@NameInMap("name")
@Validation(required = true)
public String name;
// 联系人手机号码
@NameInMap("mobile")
@Validation(required = true)
public String mobile;
// 联系人电话号码
@NameInMap("phone")
public String phone;
// 联系人类型, LEGAL_PERSON-法人;CONTROLLER-实际控制人;AGENT-代理人;OTHER-其他
@NameInMap("type")
@Validation(required = true)
public String type;
public static ContactInfo build(java.util.Map<String, ?> map) throws Exception {
ContactInfo self = new ContactInfo();
return TeaModel.build(map, self);
}
public ContactInfo setName(String name) {
this.name = name;
return this;
}
public String getName() {
return this.name;
}
public ContactInfo setMobile(String mobile) {
this.mobile = mobile;
return this;
}
public String getMobile() {
return this.mobile;
}
public ContactInfo setPhone(String phone) {
this.phone = phone;
return this;
}
public String getPhone() {
return this.phone;
}
public ContactInfo setType(String type) {
this.type = type;
return this;
}
public String getType() {
return this.type;
}
}
| 22.421875 | 84 | 0.619512 |
7675e350b4513523a5572804bb8b5bee3337c0fd | 375 | package com.example.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class ProgressController {
@GetMapping("/progress")
public ModelAndView progress() {
ModelAndView mav = new ModelAndView("progress");
return mav;
}
}
| 22.058824 | 58 | 0.794667 |
d93b800d70b18386252bb2c0be90cb109ab46c61 | 119 | package cn.paxos.jam;
public interface State
{
State onEvent(Event event, StateContext stateContext);
}
| 13.222222 | 57 | 0.697479 |
e5e4f64f695b59c1dc396ef1e7c9992008e4a4f1 | 3,876 | package com.fiicloud.plugindriver.core.configurer;
import com.fiicloud.plugindriver.core.entity.Plugin;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @author Anthony
*/
public class PluginInfoConfigurer<P extends AbstractPlugInDriverConfigurer> {
private P plugInDriverConfigurer;
public PluginInfoConfigurer() {}
public P and() {
return this.plugInDriverConfigurer;
}
public void setPlugInDriverConfigurer(P plugInDriverConfigurer) {
this.plugInDriverConfigurer = plugInDriverConfigurer;
}
public PluginBuilder builder() {
return new PluginBuilder();
}
public class PluginBuilder {
private String id;
private String name;
private String url;
private String bootClass;
private List<String> scanPath;
private List<Class> scanAnnotation;
private String config;
public PluginBuilder id(String id){
this.id = id;
return this;
}
public PluginBuilder name(String name){
this.name = name;
return this;
}
public PluginBuilder url(String url) {
this.url = url;
return this;
}
public PluginBuilder bootClass(String bootClass) {
this.bootClass = bootClass;
return this;
}
public PluginBuilder scanPath(String scanPath) {
this.scanPath = Arrays.asList(scanPath.split(","));
return this;
}
public PluginBuilder scanAnnotation(String scanAnnotation) {
String[] classPaths = scanAnnotation.split(",");
List<Class> classes = new ArrayList<>();
try {
for (String classPath : classPaths) {
Class c = Class.forName(classPath);
classes.add(c);
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
this.scanAnnotation = classes;
return this;
}
public PluginBuilder config(String config) {
this.config = config;
return this;
}
public PluginInfoConfigurer with() {
((com.fiicloud.plugindriver.core.builder.PluginBuilder)PluginInfoConfigurer.this.plugInDriverConfigurer.getPluginDriverBuilder())
.addPlugin(new Plugin(this.id, this.name, this.url, this.bootClass, this.scanPath, this.scanAnnotation, this.config));
return PluginInfoConfigurer.this;
}
public JavaPlugInDriverConfigurer backJava() {
((com.fiicloud.plugindriver.core.builder.PluginBuilder)PluginInfoConfigurer.this.plugInDriverConfigurer.getPluginDriverBuilder())
.addPlugin(new Plugin(this.id, this.name, this.url, this.bootClass, this.scanPath, this.scanAnnotation, this.config));
return (JavaPlugInDriverConfigurer)PluginInfoConfigurer.this.and();
}
public YmlPlugInDriverConfigurer backYml() {
((com.fiicloud.plugindriver.core.builder.PluginBuilder)PluginInfoConfigurer.this.plugInDriverConfigurer.getPluginDriverBuilder())
.addPlugin(new Plugin(this.id, this.name, this.url, this.bootClass, this.scanPath, this.scanAnnotation, this.config));
return (YmlPlugInDriverConfigurer)PluginInfoConfigurer.this.and();
}
public JDBCPlugInDriverConfigurer backJdbc() {
((com.fiicloud.plugindriver.core.builder.PluginBuilder)PluginInfoConfigurer.this.plugInDriverConfigurer.getPluginDriverBuilder())
.addPlugin(new Plugin(this.id, this.name, this.url, this.bootClass, this.scanPath, this.scanAnnotation, this.config));
return (JDBCPlugInDriverConfigurer)PluginInfoConfigurer.this.and();
}
}
}
| 35.888889 | 141 | 0.639061 |
4874b896c645e9bc3bf67ebd061c24a2c0850efe | 3,931 | package io.swagger.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.model.MeasurementTypeHumidityWithTimestamp;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import javax.validation.constraints.*;
/**
* MeasurementSummaryHumidity
*/
@Validated
public class MeasurementSummaryHumidity {
@JsonProperty("average")
private Double average = null;
@JsonProperty("latest")
private MeasurementTypeHumidityWithTimestamp latest = null;
@JsonProperty("minimum")
private MeasurementTypeHumidityWithTimestamp minimum = null;
@JsonProperty("maximum")
private MeasurementTypeHumidityWithTimestamp maximum = null;
public MeasurementSummaryHumidity average(Double average) {
this.average = average;
return this;
}
/**
* Get average
* @return average
**/
@ApiModelProperty(value = "")
public Double getAverage() {
return average;
}
public void setAverage(Double average) {
this.average = average;
}
public MeasurementSummaryHumidity latest(MeasurementTypeHumidityWithTimestamp latest) {
this.latest = latest;
return this;
}
/**
* Get latest
* @return latest
**/
@ApiModelProperty(value = "")
@Valid
public MeasurementTypeHumidityWithTimestamp getLatest() {
return latest;
}
public void setLatest(MeasurementTypeHumidityWithTimestamp latest) {
this.latest = latest;
}
public MeasurementSummaryHumidity minimum(MeasurementTypeHumidityWithTimestamp minimum) {
this.minimum = minimum;
return this;
}
/**
* Get minimum
* @return minimum
**/
@ApiModelProperty(value = "")
@Valid
public MeasurementTypeHumidityWithTimestamp getMinimum() {
return minimum;
}
public void setMinimum(MeasurementTypeHumidityWithTimestamp minimum) {
this.minimum = minimum;
}
public MeasurementSummaryHumidity maximum(MeasurementTypeHumidityWithTimestamp maximum) {
this.maximum = maximum;
return this;
}
/**
* Get maximum
* @return maximum
**/
@ApiModelProperty(value = "")
@Valid
public MeasurementTypeHumidityWithTimestamp getMaximum() {
return maximum;
}
public void setMaximum(MeasurementTypeHumidityWithTimestamp maximum) {
this.maximum = maximum;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
MeasurementSummaryHumidity measurementSummaryHumidity = (MeasurementSummaryHumidity) o;
return Objects.equals(this.average, measurementSummaryHumidity.average) &&
Objects.equals(this.latest, measurementSummaryHumidity.latest) &&
Objects.equals(this.minimum, measurementSummaryHumidity.minimum) &&
Objects.equals(this.maximum, measurementSummaryHumidity.maximum);
}
@Override
public int hashCode() {
return Objects.hash(average, latest, minimum, maximum);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class MeasurementSummaryHumidity {\n");
sb.append(" average: ").append(toIndentedString(average)).append("\n");
sb.append(" latest: ").append(toIndentedString(latest)).append("\n");
sb.append(" minimum: ").append(toIndentedString(minimum)).append("\n");
sb.append(" maximum: ").append(toIndentedString(maximum)).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.525974 | 91 | 0.707962 |
5a6304d1564711d80d0c94bf9a9a7774d78366e6 | 517 | package p005cm.aptoide.p006pt.database.accessors;
import java.util.concurrent.Callable;
/* renamed from: cm.aptoide.pt.database.accessors.bb */
/* compiled from: lambda */
public final /* synthetic */ class C2776bb implements Callable {
/* renamed from: a */
private final /* synthetic */ UpdateAccessor f5993a;
public /* synthetic */ C2776bb(UpdateAccessor updateAccessor) {
this.f5993a = updateAccessor;
}
public final Object call() {
return this.f5993a.mo11685e();
}
}
| 25.85 | 67 | 0.688588 |
3c18854bd538ea258d28e91ad06154c989ebac3d | 2,505 | package io.github.davidstevenrose;
import java.util.ArrayList;
/**
* The definition of an account on Find-A-Group.
*/
public class User {
private String username;
private String password;
private String email;
private ArrayList<Group> groupMember = new ArrayList<>();
private ArrayList<Group> groupLeader = new ArrayList<>();
/**
* This is a no argument constructor for the User class used in the LoginController class.
*
* @author Cameron
*/
public User() {
}
/**
* Creating a new account.
*
* @param username the username of the account
* @param password the password of the account
* @param email the email of the account holder
*/
public User(String username, String password, String email) {
this.username = username;
this.password = password;
this.email = email;
}
/**
* Gets the username of the account.
*
* @return the username
*/
public String getUsername() {
return username;
}
/**
* Sets the username of the account.
*
* @param username the new username
*/
public void setUsername(String username) {
this.username = username;
}
/**
* Gets the password of the account.
*
* @return the password
*/
public String getPassword() {
return password;
}
/**
* Sets the password of the account.
*
* @param password the new password
*/
public void setPassword(String password) {
this.password = password;
}
/**
* Gets the email of the account.
*
* @return the email
*/
public String getEmail() {
return email;
}
/**
* Sets the email of the account.
*
* @param email the new email
*/
public void setEmail(String email) {
this.email = email;
}
/**
* Gets the list of groups the user is a member of.
*
* @return an array list of groups
*/
public ArrayList<Group> getGroupMember() {
return groupMember;
}
/**
* Adds the user to a group.
*
* @param group the group the user joined
*/
public void addGroupMember(Group group) {
groupMember.add(group);
}
/**
* Gets the list of groups the user is the leader of.
*
* @return an array list of groups
*/
public ArrayList<Group> getGroupLeader() {
return groupLeader;
}
/**
* Adds a new group to the user's list of groups he/she is the leader of.
*
* @param group the group the user created
*/
public void addGroupLeader(Group group) {
groupLeader.add(group);
}
} | 19.880952 | 92 | 0.631936 |
76ac5b768600a5e18f48cdec25935339a23a515e | 15,808 | package com.google.android.gms.internal;
import android.os.Binder;
import android.os.Bundle;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import com.google.android.gms.C1114a.C1096c;
import com.google.android.gms.internal.jh.C1658a;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.p039a.C1108c;
import com.google.android.gms.p039a.C1108c.C1110a;
import java.util.List;
public interface mi extends IInterface {
/* renamed from: com.google.android.gms.internal.mi.a */
public static abstract class C1805a extends Binder implements mi {
/* renamed from: com.google.android.gms.internal.mi.a.a */
private static class C1804a implements mi {
private IBinder f4936a;
C1804a(IBinder iBinder) {
this.f4936a = iBinder;
}
public String m7560a() {
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
this.f4936a.transact(2, obtain, obtain2, 0);
obtain2.readException();
String readString = obtain2.readString();
return readString;
} finally {
obtain2.recycle();
obtain.recycle();
}
}
public void m7561a(C1108c c1108c) {
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
obtain.writeStrongBinder(c1108c != null ? c1108c.asBinder() : null);
this.f4936a.transact(9, obtain, obtain2, 0);
obtain2.readException();
} finally {
obtain2.recycle();
obtain.recycle();
}
}
public IBinder asBinder() {
return this.f4936a;
}
public List m7562b() {
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
this.f4936a.transact(3, obtain, obtain2, 0);
obtain2.readException();
List readArrayList = obtain2.readArrayList(getClass().getClassLoader());
return readArrayList;
} finally {
obtain2.recycle();
obtain.recycle();
}
}
public void m7563b(C1108c c1108c) {
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
obtain.writeStrongBinder(c1108c != null ? c1108c.asBinder() : null);
this.f4936a.transact(10, obtain, obtain2, 0);
obtain2.readException();
} finally {
obtain2.recycle();
obtain.recycle();
}
}
public String m7564c() {
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
this.f4936a.transact(4, obtain, obtain2, 0);
obtain2.readException();
String readString = obtain2.readString();
return readString;
} finally {
obtain2.recycle();
obtain.recycle();
}
}
public void m7565c(C1108c c1108c) {
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
obtain.writeStrongBinder(c1108c != null ? c1108c.asBinder() : null);
this.f4936a.transact(14, obtain, obtain2, 0);
obtain2.readException();
} finally {
obtain2.recycle();
obtain.recycle();
}
}
public jh m7566d() {
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
this.f4936a.transact(5, obtain, obtain2, 0);
obtain2.readException();
jh a = C1658a.m6787a(obtain2.readStrongBinder());
return a;
} finally {
obtain2.recycle();
obtain.recycle();
}
}
public String m7567e() {
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
this.f4936a.transact(6, obtain, obtain2, 0);
obtain2.readException();
String readString = obtain2.readString();
return readString;
} finally {
obtain2.recycle();
obtain.recycle();
}
}
public String m7568f() {
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
this.f4936a.transact(7, obtain, obtain2, 0);
obtain2.readException();
String readString = obtain2.readString();
return readString;
} finally {
obtain2.recycle();
obtain.recycle();
}
}
public void m7569g() {
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
this.f4936a.transact(8, obtain, obtain2, 0);
obtain2.readException();
} finally {
obtain2.recycle();
obtain.recycle();
}
}
public boolean m7570h() {
boolean z = false;
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
this.f4936a.transact(11, obtain, obtain2, 0);
obtain2.readException();
if (obtain2.readInt() != 0) {
z = true;
}
obtain2.recycle();
obtain.recycle();
return z;
} catch (Throwable th) {
obtain2.recycle();
obtain.recycle();
}
}
public boolean m7571i() {
boolean z = false;
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
this.f4936a.transact(12, obtain, obtain2, 0);
obtain2.readException();
if (obtain2.readInt() != 0) {
z = true;
}
obtain2.recycle();
obtain.recycle();
return z;
} catch (Throwable th) {
obtain2.recycle();
obtain.recycle();
}
}
public Bundle m7572j() {
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
this.f4936a.transact(13, obtain, obtain2, 0);
obtain2.readException();
Bundle bundle = obtain2.readInt() != 0 ? (Bundle) Bundle.CREATOR.createFromParcel(obtain2) : null;
obtain2.recycle();
obtain.recycle();
return bundle;
} catch (Throwable th) {
obtain2.recycle();
obtain.recycle();
}
}
}
public C1805a() {
attachInterface(this, "com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
}
public static mi m7573a(IBinder iBinder) {
if (iBinder == null) {
return null;
}
IInterface queryLocalInterface = iBinder.queryLocalInterface("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
return (queryLocalInterface == null || !(queryLocalInterface instanceof mi)) ? new C1804a(iBinder) : (mi) queryLocalInterface;
}
public IBinder asBinder() {
return this;
}
public boolean onTransact(int i, Parcel parcel, Parcel parcel2, int i2) {
int i3 = 0;
String a;
boolean h;
switch (i) {
case GoogleMap.MAP_TYPE_SATELLITE /*2*/:
parcel.enforceInterface("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
a = m7547a();
parcel2.writeNoException();
parcel2.writeString(a);
return true;
case GoogleMap.MAP_TYPE_TERRAIN /*3*/:
parcel.enforceInterface("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
List b = m7549b();
parcel2.writeNoException();
parcel2.writeList(b);
return true;
case GoogleMap.MAP_TYPE_HYBRID /*4*/:
parcel.enforceInterface("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
a = m7551c();
parcel2.writeNoException();
parcel2.writeString(a);
return true;
case C1096c.MapAttrs_cameraZoom /*5*/:
parcel.enforceInterface("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
jh d = m7553d();
parcel2.writeNoException();
parcel2.writeStrongBinder(d != null ? d.asBinder() : null);
return true;
case C1096c.MapAttrs_liteMode /*6*/:
parcel.enforceInterface("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
a = m7554e();
parcel2.writeNoException();
parcel2.writeString(a);
return true;
case C1096c.MapAttrs_uiCompass /*7*/:
parcel.enforceInterface("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
a = m7555f();
parcel2.writeNoException();
parcel2.writeString(a);
return true;
case C1096c.MapAttrs_uiRotateGestures /*8*/:
parcel.enforceInterface("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
m7556g();
parcel2.writeNoException();
return true;
case C1096c.MapAttrs_uiScrollGestures /*9*/:
parcel.enforceInterface("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
m7548a(C1110a.m3895a(parcel.readStrongBinder()));
parcel2.writeNoException();
return true;
case C1096c.MapAttrs_uiTiltGestures /*10*/:
parcel.enforceInterface("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
m7550b(C1110a.m3895a(parcel.readStrongBinder()));
parcel2.writeNoException();
return true;
case C1096c.MapAttrs_uiZoomControls /*11*/:
parcel.enforceInterface("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
h = m7557h();
parcel2.writeNoException();
if (h) {
i3 = 1;
}
parcel2.writeInt(i3);
return true;
case C1096c.MapAttrs_uiZoomGestures /*12*/:
parcel.enforceInterface("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
h = m7558i();
parcel2.writeNoException();
if (h) {
i3 = 1;
}
parcel2.writeInt(i3);
return true;
case C1096c.MapAttrs_useViewLifecycle /*13*/:
parcel.enforceInterface("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
Bundle j = m7559j();
parcel2.writeNoException();
if (j != null) {
parcel2.writeInt(1);
j.writeToParcel(parcel2, 1);
return true;
}
parcel2.writeInt(0);
return true;
case C1096c.MapAttrs_zOrderOnTop /*14*/:
parcel.enforceInterface("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
m7552c(C1110a.m3895a(parcel.readStrongBinder()));
parcel2.writeNoException();
return true;
case 1598968902:
parcel2.writeString("com.google.android.gms.ads.internal.mediation.client.INativeContentAdMapper");
return true;
default:
return super.onTransact(i, parcel, parcel2, i2);
}
}
}
String m7547a();
void m7548a(C1108c c1108c);
List m7549b();
void m7550b(C1108c c1108c);
String m7551c();
void m7552c(C1108c c1108c);
jh m7553d();
String m7554e();
String m7555f();
void m7556g();
boolean m7557h();
boolean m7558i();
Bundle m7559j();
}
| 42.042553 | 152 | 0.503543 |
7070575b0685a423874a800804d1d990c2c7cbbf | 6,074 | /*
* Copyright (c) 2015, Nordic Semiconductor
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. 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.
*
* 3. Neither the name of the copyright holder 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
* HOLDER 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 no.nordicsemi.android.nrftoolbox.bpm;
import android.os.Bundle;
import android.widget.TextView;
import java.util.Calendar;
import java.util.UUID;
import no.nordicsemi.android.nrftoolbox.R;
import no.nordicsemi.android.nrftoolbox.profile.BleManager;
import no.nordicsemi.android.nrftoolbox.profile.BleProfileActivity;
// TODO The BPMActivity should be rewritten to use the service approach, like other do.
public class BPMActivity extends BleProfileActivity implements BPMManagerCallbacks {
@SuppressWarnings("unused")
private static final String TAG = "BPMActivity";
private TextView mSystolicView;
private TextView mSystolicUnitView;
private TextView mDiastolicView;
private TextView mDiastolicUnitView;
private TextView mMeanAPView;
private TextView mMeanAPUnitView;
private TextView mPulseView;
private TextView mTimestampView;
@Override
protected void onCreateView(Bundle savedInstanceState) {
setContentView(R.layout.activity_feature_bpm);
setGUI();
}
private void setGUI() {
mSystolicView = (TextView) findViewById(R.id.systolic);
mSystolicUnitView = (TextView) findViewById(R.id.systolic_unit);
mDiastolicView = (TextView) findViewById(R.id.diastolic);
mDiastolicUnitView = (TextView) findViewById(R.id.diastolic_unit);
mMeanAPView = (TextView) findViewById(R.id.mean_ap);
mMeanAPUnitView = (TextView) findViewById(R.id.mean_ap_unit);
mPulseView = (TextView) findViewById(R.id.pulse);
mTimestampView = (TextView) findViewById(R.id.timestamp);
}
@Override
protected int getLoggerProfileTitle() {
return R.string.bpm_feature_title;
}
@Override
protected int getDefaultDeviceName() {
return R.string.bpm_default_name;
}
@Override
protected int getAboutTextId() {
return R.string.bpm_about_text;
}
@Override
protected UUID getFilterUUID() {
return BPMManager.BP_SERVICE_UUID;
}
@Override
protected BleManager<BPMManagerCallbacks> initializeManager() {
final BPMManager manager = BPMManager.getBPMManager(getApplicationContext());
manager.setGattCallbacks(this);
return manager;
}
@Override
protected void setDefaultUI() {
mSystolicView.setText(R.string.not_available_value);
mSystolicUnitView.setText(null);
mDiastolicView.setText(R.string.not_available_value);
mDiastolicUnitView.setText(null);
mMeanAPView.setText(R.string.not_available_value);
mMeanAPUnitView.setText(null);
mPulseView.setText(R.string.not_available_value);
mTimestampView.setText(R.string.not_available);
}
@Override
public void onServicesDiscovered(final boolean optionalServicesFound) {
// this may notify user or show some views
}
@Override
public void onDeviceReady() {
// this may notify user
}
@Override
public void onBloodPressureMeasurementRead(final float systolic, final float diastolic, final float meanArterialPressure, final int unit) {
runOnUiThread(new Runnable() {
@Override
public void run() {
mSystolicView.setText(Float.toString(systolic));
mDiastolicView.setText(Float.toString(diastolic));
mMeanAPView.setText(Float.toString(meanArterialPressure));
mSystolicUnitView.setText(unit == UNIT_mmHG ? R.string.bpm_unit_mmhg : R.string.bpm_unit_kpa);
mDiastolicUnitView.setText(unit == UNIT_mmHG ? R.string.bpm_unit_mmhg : R.string.bpm_unit_kpa);
mMeanAPUnitView.setText(unit == UNIT_mmHG ? R.string.bpm_unit_mmhg : R.string.bpm_unit_kpa);
}
});
}
@Override
public void onIntermediateCuffPressureRead(final float cuffPressure, final int unit) {
runOnUiThread(new Runnable() {
@Override
public void run() {
mSystolicView.setText(Float.toString(cuffPressure));
mDiastolicView.setText(R.string.not_available_value);
mMeanAPView.setText(R.string.not_available_value);
mSystolicUnitView.setText(unit == UNIT_mmHG ? R.string.bpm_unit_mmhg : R.string.bpm_unit_kpa);
mDiastolicUnitView.setText(null);
mMeanAPUnitView.setText(null);
}
});
}
@Override
public void onPulseRateRead(final float pulseRate) {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (pulseRate >= 0)
mPulseView.setText(Float.toString(pulseRate));
else
mPulseView.setText(R.string.not_available_value);
}
});
}
@Override
public void onTimestampRead(final Calendar calendar) {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (calendar != null)
mTimestampView.setText(getString(R.string.bpm_timestamp, calendar));
else
mTimestampView.setText(R.string.not_available);
}
});
}
}
| 35.313953 | 145 | 0.771814 |
f8538bd1833da06c8ebbb19e772210ebaf5cbd48 | 9,320 | /*
* This file is part of TiPi (a Toolkit for Inverse Problems and Imaging)
* developed by the MitiV project.
*
* Copyright (c) 2014 the MiTiV project, http://mitiv.univ-lyon1.fr/
*
* 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 mitiv.linalg;
import mitiv.exception.IncorrectSpaceException;
import mitiv.utils.Poly;
/**
* Implement trust region conjugate gradient algorithm of Steihaug.
*
* References: Trond Steihaug, "The conjugate gradient method and trust regions
* in large scale optimization," SIAM J. Numer. Anal., vol. 20, pp. 626-637
* (1983).
*
* @author Éric.
*
*/
public class TruncatedConjugateGradient {
public static final int SUCCESS = 0;
public static final int FAILURE = -1;
public static final int IN_PROGRESS = 0; /* Algorithm is running. */
public static final int CONVERGED = 1; /*
* Algorithm has converged within
* tolerances.
*/
public static final int TRUNCATED = 2;
public static final int TOO_MANY_ITERATIONS = 3; /* Too many iterations. */
public static final int A_IS_NOT_POSITIVE_DEFINITE = 4; /*
* RHS matrix A is
* not positive
* definite.
*/
public static final int P_IS_NOT_POSITIVE_DEFINITE = 5; /*
* Preconditioner P
* is not positive
* definite.
*/
public static final int BUG = 7;
public static final int FOREVER = -1;
public static final double DEFAULT_ABSOLUTE_TOLERANCE = 0.0;
public static final double DEFAULT_RELATIVE_TOLERANCE = 1E-6;
public static final int DEFAULT_MAXIMUM_ITERATIONS = FOREVER;
/* Instance variables. */
protected double atol = DEFAULT_ABSOLUTE_TOLERANCE;
protected double rtol = DEFAULT_RELATIVE_TOLERANCE;
protected int maxiter = DEFAULT_MAXIMUM_ITERATIONS;
protected LinearOperator A = null;
protected Vector b = null;
protected double delta = 0.0;
public TruncatedConjugateGradient() {
}
public void setDefaults() {
this.atol = DEFAULT_ABSOLUTE_TOLERANCE;
this.rtol = DEFAULT_RELATIVE_TOLERANCE;
this.maxiter = DEFAULT_MAXIMUM_ITERATIONS;
}
public void releaseMemory() {
this.b = null;
}
public void setPreconditioner(LinearOperator P) {
/* FIXME: */
}
public void setRightHandSideVector(Vector b) {
/* FIXME: */
}
public void setLeftHandSideOperator(LinearOperator A) {
/* FIXME: */
}
public double getAbsoluteTolerance() {
return this.atol;
}
public void setAbsoluteTolerance(double atol) {
this.atol = Math.max(0.0, atol);
}
public double getRelativeTolerance() {
return this.rtol;
}
public void setRelativeTolerance(double rtol) {
this.rtol = Math.max(0.0, rtol);
}
public int getMaximumIterations() {
return this.maxiter;
}
public void setMaximumIterations(int maxiter) {
this.maxiter = (maxiter >= 0 ? maxiter : FOREVER);
}
/**
* Adjust vector length along a given direction.
*
* <p> Replace {@code x} by {@code x + alpha*p} so that
* {@code ||x - alpha*p|| = scale}. </p>
*
* @param x The vector to adjust.
* @param p The search direction.
* @param scale The Euclidean norm of the result.
* @param xnrm The Euclidean norm of {@code x}
*
* @throws IncorrectSpaceException Not all vectors belong to the same
* vector space.
*/
public static int adjustStep(Vector x, final Vector p, double delta,
double xnrm) throws IncorrectSpaceException {
if (delta < 0.0) {
return FAILURE;
}
if (xnrm == delta) {
return SUCCESS;
}
/*
* ||x + alpha*p|| = scale <==> a*t^2 + b*t + c = 0
*
* with:
*
* a = ||p||^2
*
* b = 2*<x|p>
*
* c = ||x||^2 - scale^2 = (||x|| - scale)*(||x|| - scale)
*/
double a = p.dot(p);
double b = 2.0*p.dot(x);
double c = (xnrm + delta)*(xnrm - delta);
double[] t = new double[2];
double alpha = 0.0;
if (Poly.solveQuadratic(t, a, b, c) >= 1) {
if (xnrm > delta) {
/* Compute a backward step. */
alpha = Math.min(0.0, t[0]);
} else {
/* Compute a forward step. */
alpha = Math.max(0.0, t[1]);
}
}
if (alpha == 0.0) {
return FAILURE;
}
x.add(alpha, p);
return SUCCESS;
}
public int truncatedConjugateGradient(LinearOperator A, Vector b, Vector x,
double delta, int maxiter)
throws IncorrectSpaceException {
return truncatedConjugateGradient(A, b, x, null, delta, maxiter);
}
/**
* Compute a trust-region step by means of preconditioned truncated linear
* conjugate gradient.
*
*
* @param A
* The LHS operator.
* @param b
* The RHS vector.
* @param x
* A vector to store the solution.
* @param P
* A preconditioner.
* @param scale
* The maximum allowed length of x.
* @param maxiter
* The maximum number of iterations.
* @return A code indicating the reason of stopping the algorithm.
* @throws IncorrectSpaceException
*/
public int truncatedConjugateGradient(LinearOperator A, Vector b, Vector x,
LinearOperator P, double delta, int maxiter)
throws IncorrectSpaceException {
/*
* Check that A.x = b makes sense and whether A input and output spaces
* are the same.
*/
LinearOperator.checkLinearProblem(A, b, x, true);
VectorSpace vsp = b.getSpace();
Vector r = vsp.create(); /* residuals */
Vector p = vsp.create(); /* search direction */
Vector q = vsp.create(); /* q = A.p */
Vector z = null; /* preconditioned residuals: z = P.r */
/*
* Initial solution x = 0 and initial residuals r = b.
*/
x.fill(0);
double xnrm = 0.0;
r.copy(b);
if (P != null) {
/* Check preconditioner P and allocate vector for Z. */
if (P.getInputSpace() != vsp || P.getOutputSpace() != vsp) {
throw new IncorrectSpaceException();
}
z = vsp.create();
P.apply(z, r);
} else {
/*
* Unpreconditioned version of the linear conjugate gradient. Vector
* z is always the same as the residuals r.
*/
z = r;
}
double rho = z.dot(r);
double rho_prev = 0.0;
double epsilon = 0.0;
int iter = 0;
for (;;) {
/* Check step length and then check for convergence. */
if (rho <= epsilon) {
return CONVERGED;
}
if (maxiter >= 0 && iter >= maxiter) {
return TOO_MANY_ITERATIONS;
}
/* Compute new search direction: p = z + beta*p */
if (iter == 0) {
p.copy(z);
} else {
double beta = rho / rho_prev;
p.combine(1.0, z, beta, p);
}
/* Compute optimal step length and update unknown x and residuals r. */
A.apply(q, p);
double gamma = p.dot(q);
if (gamma <= 0.0) {
/*
* Non positive definiteness of A. Apply a truncated forward
* step.
*/
adjustStep(x, p, delta, xnrm);
return A_IS_NOT_POSITIVE_DEFINITE;
}
double alpha = rho/gamma;
x.add(alpha, p);
xnrm = x.norm2();
if (xnrm >= delta) {
/* Apply a truncated backward step. */
adjustStep(x, p, delta, xnrm);
return TRUNCATED;
}
r.add(-alpha, q);
if (P != null) {
P.apply(z, r);
}
rho_prev = rho;
rho = z.dot(r);
++iter;
}
}
}
| 32.137931 | 83 | 0.561373 |
d1fe472e88b0862803b4d1f8c67fc9fccc784967 | 2,598 | package com.ljmu.andre.snaptools.Utils;
import android.app.Activity;
import androidx.annotation.MainThread;
import androidx.core.content.ContextCompat;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import com.ljmu.andre.snaptools.R;
import me.toptas.fancyshowcase.FancyShowCaseView;
import me.toptas.fancyshowcase.FocusShape;
import me.toptas.fancyshowcase.OnViewInflateListener;
import timber.log.Timber;
/**
* This class was created by Andre R M (SID: 701439)
* It and its contents are free to use by all
*/
public class ShowcaseFactory {
public static FancyShowCaseView.Builder getDefaultShowcase(Activity activity, OnDefaultShowcaseInflated defaultShowcaseInflated) {
return getDefaultShowcase(activity, view -> defaultShowcaseInflated.showcaseInflated(
(FancyShowCaseView) view.getParent(),
ResourceUtils.getView(view, R.id.showcase_message_container),
ResourceUtils.getView(view, R.id.showcase_title),
ResourceUtils.getView(view, R.id.showcase_message),
ResourceUtils.getView(view, R.id.showcase_button_close),
ResourceUtils.getView(view, R.id.showcase_button_next)
));
}
public static FancyShowCaseView.Builder getDefaultShowcase(Activity activity, OnViewInflateListener inflateListener) {
return new FancyShowCaseView.Builder(activity)
.backgroundColor(ContextCompat.getColor(activity, R.color.backgroundTertiaryWashed))
.focusShape(FocusShape.ROUNDED_RECTANGLE)
.focusBorderColor(ContextCompat.getColor(activity, R.color.primaryLight))
.focusBorderSize(1)
.customView(R.layout.showcase_basic, inflateListener)
.closeOnTouch(false);
}
@MainThread
public static void detatchCurrentShowcase(Activity activity) {
try {
View androidContent = activity.findViewById(android.R.id.content);
ViewGroup root = (ViewGroup) androidContent.getParent().getParent();
FancyShowCaseView visibleView = (FancyShowCaseView) root.findViewWithTag("ShowCaseViewTag");
if (visibleView != null)
visibleView.removeView();
} catch (Exception e) {
Timber.e(e);
}
}
public interface OnDefaultShowcaseInflated {
void showcaseInflated(FancyShowCaseView showCaseView, ViewGroup messageContainer, TextView txtTitle, TextView txtMessage, Button btnClose, Button btnNext);
}
}
| 39.363636 | 163 | 0.711316 |
1ddba7f29c5efdd475a1146df5c68c3e364fa180 | 1,999 | package com.novoda.pianohero;
import android.media.AudioFormat;
import android.media.AudioManager;
import android.media.AudioTrack;
import android.support.annotation.Nullable;
class AndroidSynthSpeaker implements Speaker {
private static final double durationSeconds = 0.1;
private static final int sampleRate = 8000;
private static final int numSamples = (int) (durationSeconds * sampleRate);
private static final double sample[] = new double[numSamples];
@Nullable
private AudioTrack audioTrack;
@Override
public void start(double frequency) {
byte[] sound = generateTone(frequency);
audioTrack = new AudioTrack(
AudioManager.STREAM_MUSIC,
sampleRate,
AudioFormat.CHANNEL_OUT_MONO,
AudioFormat.ENCODING_PCM_16BIT,
sound.length,
AudioTrack.MODE_STATIC
);
audioTrack.setLoopPoints(0, audioTrack.getBufferSizeInFrames(), -1);
audioTrack.write(sound, 0, sound.length);
audioTrack.play();
}
private byte[] generateTone(double freqOfTone) {
byte generatedSound[] = new byte[2 * numSamples];
// fill out the array
for (int i = 0; i < numSamples; ++i) {
sample[i] = Math.sin(2 * Math.PI * i / (sampleRate / freqOfTone));
}
// convert to 16 bit pcm sound array
// assumes the sample buffer is normalized.
int idx = 0;
for (double dVal : sample) {
// scale to maximum amplitude
short val = (short) ((dVal * 32767));
// in 16 bit wav PCM, first byte is the low order byte
generatedSound[idx++] = (byte) (val & 0x00ff);
generatedSound[idx++] = (byte) ((val & 0xff00) >>> 8);
}
return generatedSound;
}
@Override
public void stop() {
if (audioTrack != null) {
audioTrack.release();
audioTrack = null;
}
}
}
| 30.753846 | 79 | 0.5993 |
8ce3c8651b4f810ed4d4d22a45851ce696d0fbb7 | 1,898 | package edu.fiuba.algo3.modelo.carta;
import edu.fiuba.algo3.modelo.excepciones.PaisNoTePerteneceException;
import edu.fiuba.algo3.modelo.jugador.Jugador;
import edu.fiuba.algo3.modelo.geografia.Pais;
import edu.fiuba.algo3.modelo.excepciones.CartaYaActivadaException;
public class Carta {
private final Pais pais;
private final String simbolo;
private EstadoCarta estado;
public Carta(Pais pais, String simbolo) {
this.pais = pais;
this.simbolo = simbolo;
estado = new CartaNoActivada();
}
public static boolean canjeables(Carta carta1, Carta carta2, Carta carta3){
boolean sonIguales = carta1.canjearConIguales(carta2, carta3) && carta2.canjearConIguales(carta1, carta3);
boolean sonDistintas = carta1.canjearConDiferentes(carta2, carta3) && carta2.canjearConDiferentes(carta1, carta3);
return (sonIguales || sonDistintas || carta1.esComodin() || carta2.esComodin() || carta3.esComodin());
}
private boolean canjearConIguales(Carta carta1, Carta carta2){
return ((carta1.simbolosIguales(simbolo) && carta2.simbolosIguales(simbolo)));
}
private boolean simbolosIguales(String simboloCarta){
return (simbolo.equals(simboloCarta));
}
private boolean canjearConDiferentes(Carta carta1, Carta carta2){
return ((carta1.simbolosDiferentes(simbolo) && carta2.simbolosDiferentes(simbolo)));
}
private boolean simbolosDiferentes(String simboloCarta){
return (!simbolo.equals(simboloCarta));
}
private boolean esComodin(){
return simbolo.equals("Comodin");
}
public Pais getPais(){
return pais;
}
public String getSimbolo(){
return simbolo;
}
public void activarse(Jugador jugador) throws CartaYaActivadaException, PaisNoTePerteneceException {
estado = estado.activarse(jugador, pais);
}
} | 32.724138 | 122 | 0.710221 |
8ac7313197b03af61cbeee457d0f1479d2431876 | 640 | package com.ABC.bitrade.dao;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.stereotype.Repository;
import com.ABC.bitrade.constant.CommonStatus;
import com.ABC.bitrade.dao.base.BaseDao;
import com.ABC.bitrade.entity.Activity;
import com.ABC.bitrade.entity.Coin;
import com.ABC.bitrade.entity.MemberTransaction;
@Repository
public interface ActivityDao extends BaseDao<Activity> {
List<Activity> findAllByStep(int step);
}
| 29.090909 | 72 | 0.829688 |
4e58191bbd9ca7c29271c52b7a09dd2411ee9270 | 3,207 | package ru.stqa.pft.addressbook.applicationmanager;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
import org.testng.Assert;
import ru.stqa.pft.addressbook.model.ContactData;
import ru.stqa.pft.addressbook.model.GroupData;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Administrator on 10/18/2016.
*/
public class ContactHelper extends HelperBase {
public boolean isThereAContact(){
return isElementPresent(By.name("selected[]"));
}
public ContactHelper(WebDriver wd) {
super(wd);
}
public void returnToHomePage() {
click(By.linkText("home page"));
}
public void submitContactCreation() {
click(By.name("submit"));
}
public void fillContactData(ContactData contactData, boolean creation) {
type(By.name("firstname"), contactData.getFirstName());
type(By.name("lastname"), contactData.getLastName());
type(By.name("address"), contactData.getAddress());
type(By.name("home"), contactData.getPhone());
type(By.name("email"), contactData.getEmail());
if(creation){
new Select(wd.findElement(By.name("new_group"))).selectByVisibleText(contactData.getGroup());
} else {
Assert.assertFalse(isElementPresent(By.name("new_group")));
}
}
public void contactCreation() {
click(By.linkText("add new"));
}
public void selectContact(int index) {
wd.findElements(By.name("selected[]")).get(index).click();
}
public void updateContact() {
click(By.name("update"));
}
public void initEditingSelectedContact() {
//click(By.xpath("//table[@id='maintable']/tbody/tr[2]/td[8]/a/img"));
click(By.cssSelector("img[alt=Edit]"));
}
public void deleteSelectedContact() {
click(By.xpath("//div[@id='content']/form[2]/div[2]/input"));
}
public void submitContactDeletion() {
wd.switchTo().alert().accept();
}
public void createContact(ContactData contactData) {
contactCreation();
fillContactData(contactData, true);
submitContactCreation();
returnToHomePage();
}
public int getContactCount() {
return wd.findElements(By.name("selected[]")).size();
}
public List<ContactData> getContactList() {
List<ContactData> contacts = new ArrayList<ContactData>();
List<WebElement> elements = wd.findElements(By.xpath(".//*[@id='maintable']/tbody/tr[@name='entry']"));
for (int i=1 ; i < elements.size()+1 ; i++){
String lastName = wd.findElement(By.xpath(".//*[@id='maintable']/tbody/tr[@name='entry']["+i+"]/td[2]")).getText();
String firstName = wd.findElement(By.xpath(".//*[@id='maintable']/tbody/tr[@name='entry']["+i+"]/td[3]")).getText();
ContactData contact = new ContactData(firstName, lastName, null, null, null, null);
contacts.add(contact);
}
return contacts;
}
}
| 31.441176 | 128 | 0.640162 |
c93d51b48549f41d656156ca32a742d8ca397d4d | 1,506 | package codecube;
import codecube.core.Scanner;
import codecube.core.ScanResult;
import codecube.core.InputFileExtensions;
import codecube.core.LanguagePlugin;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Path;
@Slf4j
abstract class BaseAnalyzer {
private final LanguagePlugin languagePlugin = newLanguagePlugin();
private final Scanner scanner = new Scanner(languagePlugin);
public ScanResult analyze(String source) {
return scanner.apply(source);
}
private LanguagePlugin newLanguagePlugin() {
try {
String inputFileExtension = InputFileExtensions.fromLanguageCode(language());
return new LanguagePlugin(findPluginFile().toUri().toURL(), inputFileExtension);
} catch (IOException e) {
log.warn("newLanguagePlugin failed:", e);
}
// unreachable
return null;
}
abstract String language();
abstract Path findPluginFile();
abstract String fileExtension();
void ensurePlugin(String pluginFile) {
File dest = new File(pluginFile);
if (dest.isFile()) {
return;
}
URL inputUrl = JavaAnalyzer.class.getClassLoader().getResource(pluginFile);
try {
FileUtils.copyURLToFile(inputUrl, dest);
} catch (IOException ex) {
log.error("Error with init plugin", ex);
}
}
}
| 26.892857 | 92 | 0.669987 |
86fef46c241777174f7859969d576cee6ddb4b6f | 2,308 | // ----------------------------------------------------------------------------
// Copyright 2007-2013, GeoTelematic Solutions, 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.
//
// ----------------------------------------------------------------------------
// Change History:
// 2007/03/04 Martin D. Flynn
// -Initial release
// 2007/03/25 Martin D. Flynn
// -Changed return type to 'int' to allow use as a record selector.
// ----------------------------------------------------------------------------
package org.opengts.dbtools;
import java.lang.*;
import java.util.*;
import java.sql.*;
import org.opengts.util.*;
/**
*** <code>DBRecordHandler</code> is the interface for a callback SQL record handler.
**/
public interface DBRecordHandler<RT extends DBRecord>
{
// ------------------------------------------------------------------------
public static final int DBRH_STOP = 0; // stop DBRecord selection loop
public static final int DBRH_SKIP = 1; // skip this record and continue
public static final int DBRH_SAVE = 2; // save this record and continue
// ------------------------------------------------------------------------
/**
*** Callback handler for DBRecords retrieved from a database select
*** @param rcd The DBRecord
*** @return The implementation method should return 'DBRH_STOP' to stop
*** the DBRecord selection/processing loop, or 'DBRH_SKIP' to skip
*** the current record, or 'DBRH_SAVE' to save the current record
*** to be return by the select method in an array of DBRecord's.
**/
public int handleDBRecord(RT rcd)
throws DBException;
}
| 38.466667 | 84 | 0.551993 |
415d7caa608ac9808a01bb1c94273990d603aed3 | 1,335 | package pl.grzeslowski.jsupla.protocoljava.api.entities.cs;
import pl.grzeslowski.jsupla.protocoljava.api.channels.values.ChannelValue;
import javax.validation.constraints.NotNull;
import static pl.grzeslowski.jsupla.protocoljava.api.types.Entity.Version.B;
public class ChannelNewValueB extends ChannelNewValue {
private final int channelId;
public ChannelNewValueB(final int channelId,
final @NotNull ChannelValue value) {
super(0, value);
this.channelId = channelId;
}
@Override
public Version version() {
return B;
}
@Override
public int getChannelId() {
return channelId;
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (!(o instanceof ChannelNewValueB)) {
return false;
}
if (!super.equals(o)) {
return false;
}
final ChannelNewValueB that = (ChannelNewValueB) o;
return channelId == that.channelId;
}
@Override
public final int hashCode() {
return channelId;
}
@Override
public String toString() {
return "ChannelNewValueB{" +
"channelId=" + channelId +
"} " + super.toString();
}
}
| 23.421053 | 76 | 0.592509 |
9ae4659b91c1a638654eba54c21de312c52aca56 | 3,444 | package com.jude.beam.expansion.overlay;
import android.app.ProgressDialog;
import android.support.v7.widget.Toolbar;
import android.view.View;
import com.jude.beam.R;
import com.jude.beam.expansion.BeamBaseActivity;
/**
* Created by Mr.Jude on 2015/8/18.
*/
public class DefaultViewExpansionDelegate extends ViewExpansionDelegate {
private ViewConfig mConfig;
private ProgressDialog mProgressDialog;
private OnRetryListener mRetryListener;
private View mProgressView;
private View mErrorView;
public DefaultViewExpansionDelegate(BeamBaseActivity activity) {
super(activity);
mConfig = getConfig();
}
public DefaultViewExpansionDelegate(BeamBaseActivity activity, ViewConfig mConfig) {
super(activity);
this.mConfig = mConfig;
}
public ViewConfig getConfig(){
return ViewConfig.Default.clone();
}
@Override
public void showProgressDialog(String title) {
if(mProgressDialog!=null&&mProgressDialog.isShowing())mProgressDialog.dismiss();
mProgressDialog = new ProgressDialog(getActivity());
mProgressDialog.setTitle(title);
mProgressDialog.setMessage(mConfig.mProgressTitle);
mProgressDialog.setCancelable(false);
mProgressDialog.show();
}
@Override
public void dismissProgressDialog() {
if (mProgressDialog!=null)
mProgressDialog.dismiss();
}
@Override
public View showProgressPage() {
if (mProgressView ==null){
if (mConfig.mProgressView!=null) mProgressView = mConfig.mProgressView;
else mProgressView = getActivity().getLayoutInflater().inflate(mConfig.mProgressRes,getContainer(),false);
}
if (mProgressView.getParent()==null)getContainer().addView(mProgressView);
setToolbar(mProgressView);
return mProgressView;
}
@Override
public void dismissProgressPage() {
if (mProgressView !=null){
getContainer().removeView(mProgressView);
}
}
@Override
public View showErrorPage() {
if (mErrorView ==null){
if (mConfig.mErrorView!=null) mErrorView = mConfig.mErrorView;
else mErrorView = getActivity().getLayoutInflater().inflate(mConfig.mErrorRes, getContainer(), false);
}
if (mErrorView.getParent()==null)getContainer().addView(mErrorView);
mErrorView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mRetryListener != null) mRetryListener.onRetry();
}
});
setToolbar(mErrorView);
return mErrorView;
}
public void setToolbar(View view){
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
if (toolbar!=null){
getActivity().setSupportActionBar(toolbar);
getActivity().onSetToolbar(toolbar);
}
}
@Override
public void setErrorRetryListener(OnRetryListener listener) {
mRetryListener = listener;
}
@Override
public void dismissErrorPage() {
if (mErrorView!=null){
getContainer().removeView(mErrorView);
}
}
@Override
public void addCustomOverlayView(View view){
getContainer().addView(view);
}
@Override
public void removeCustomOverlayView(View view){
getContainer().removeView(view);
}
}
| 29.186441 | 118 | 0.659408 |
14cfac87cddd63bdcc6e030b0594e2e2c47a398c | 1,552 | package io.klerch.alexa.xmastree.skill.handler;
import io.klerch.alexa.state.handler.AWSDynamoStateHandler;
import io.klerch.alexa.state.utils.AlexaStateException;
import io.klerch.alexa.tellask.model.AlexaInput;
import io.klerch.alexa.tellask.model.AlexaOutput;
import io.klerch.alexa.tellask.model.AlexaOutputSlot;
import io.klerch.alexa.tellask.schema.annotation.AlexaIntentListener;
import io.klerch.alexa.tellask.schema.type.AlexaOutputFormat;
import io.klerch.alexa.tellask.util.AlexaRequestHandlerException;
import io.klerch.alexa.xmastree.skill.SkillConfig;
import io.klerch.alexa.xmastree.skill.model.TreeState;
@AlexaIntentListener(customIntents = "TreeOn")
public class TreeOnHandler extends AbstractIntentHandler {
@Override
public AlexaOutput handleRequest(final AlexaInput input) throws AlexaRequestHandlerException, AlexaStateException {
final AWSDynamoStateHandler dynamoHandler = new AWSDynamoStateHandler(input.getSessionStateHandler().getSession());
final TreeState treeState = dynamoHandler.readModel(TreeState.class).orElse(new TreeState(input.getLocale(), TreeState.MODE.ON));
// set state on
treeState.setState(TreeState.MODE.ON);
// send state of tree to AWS IoT thing shadow
sendIotHook(input, treeState);
return AlexaOutput.tell("SayTreeOn")
.putState(treeState.withHandler(dynamoHandler))
.putSlot(new AlexaOutputSlot("mp3", SkillConfig.getMp3IntroUrl()).formatAs(AlexaOutputFormat.AUDIO))
.build();
}
}
| 47.030303 | 137 | 0.771263 |
70e6e61f1f1889bb9e602e1c8e57f0dbc711c2b8 | 566 | package org.infinispan.distexec;
import org.infinispan.configuration.cache.CacheMode;
import org.testng.annotations.Test;
/**
* Tests for verifying Distributed Executors for REPL_SYNC cache mode, with Topology Aware nodes.
*
* @author Anna Manukyan
*/
@Test(groups = "functional", testName = "distexec.ReplSyncDistributedExecutorWithTopologyAwareNodesTest")
public class ReplSyncDistributedExecutorWithTopologyAwareNodesTest extends DistributedExecutorWithTopologyAwareNodesTest {
public CacheMode getCacheMode() {
return CacheMode.REPL_SYNC;
}
}
| 31.444444 | 122 | 0.809187 |
bd33744aeda9e16d81389d12d7a40bea16af0e6d | 1,182 | package io.protonull.rocksmc;
import java.io.IOException;
import java.util.Objects;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
public final class RocksConfig {
private final RocksMC plugin;
private final Logger logger;
private final Properties properties;
public RocksConfig(final RocksMC plugin) {
this.plugin = Objects.requireNonNull(plugin);
this.logger = plugin.getLogger();
this.properties = new Properties();
}
public void parse() {
try {
this.properties.load(this.plugin.getResource("rocks.properties"));
}
catch (final IOException exception) {
this.logger.log(Level.SEVERE, "Could not load rocks.properties!", exception);
}
}
public void reset() {
this.properties.clear();
}
public String getRocksFileName() {
return this.properties.getProperty("file");
}
public String getRocksDownloadUrl() {
return String.format("https://repo1.maven.org/maven2/org/rocksdb/rocksdbjni/%1$s/rocksdbjni-%1$s.jar",
this.properties.getProperty("version"));
}
}
| 26.863636 | 110 | 0.659052 |
a85817c1d70fdbebbb36ddd76565e307164a3d2d | 412 | package fr.wowcompanion.server.model.mother;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
/**
* Abstract class for Blizzard models
*/
@Data
@MappedSuperclass
public class MotherBlizzardModel {
@Id
@Column(name = "ID", nullable = false, updatable = false, insertable = false, unique = true)
protected Integer id;
} | 20.6 | 96 | 0.747573 |
04f0ecdd70bc233ed334418cad981ec24ae4a49a | 4,185 | begin_unit|revision:0.9.5;language:Java;cregit-version:0.0.1
begin_comment
comment|/* * 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. */
end_comment
begin_package
DECL|package|org.apache.camel.http.common.cookie
package|package
name|org
operator|.
name|apache
operator|.
name|camel
operator|.
name|http
operator|.
name|common
operator|.
name|cookie
package|;
end_package
begin_import
import|import
name|java
operator|.
name|io
operator|.
name|IOException
import|;
end_import
begin_import
import|import
name|java
operator|.
name|net
operator|.
name|CookieManager
import|;
end_import
begin_import
import|import
name|java
operator|.
name|net
operator|.
name|CookieStore
import|;
end_import
begin_import
import|import
name|java
operator|.
name|net
operator|.
name|URI
import|;
end_import
begin_import
import|import
name|java
operator|.
name|util
operator|.
name|Collections
import|;
end_import
begin_import
import|import
name|java
operator|.
name|util
operator|.
name|List
import|;
end_import
begin_import
import|import
name|java
operator|.
name|util
operator|.
name|Map
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|camel
operator|.
name|Exchange
import|;
end_import
begin_comment
comment|/** * A basic implementation of a CamelCookie handler based on the JDK * CookieManager. */
end_comment
begin_class
DECL|class|BaseCookieHandler
specifier|public
specifier|abstract
class|class
name|BaseCookieHandler
implements|implements
name|CookieHandler
block|{
annotation|@
name|Override
DECL|method|storeCookies (Exchange exchange, URI uri, Map<String, List<String>> headerMap)
specifier|public
name|void
name|storeCookies
parameter_list|(
name|Exchange
name|exchange
parameter_list|,
name|URI
name|uri
parameter_list|,
name|Map
argument_list|<
name|String
argument_list|,
name|List
argument_list|<
name|String
argument_list|>
argument_list|>
name|headerMap
parameter_list|)
throws|throws
name|IOException
block|{
name|getCookieManager
argument_list|(
name|exchange
argument_list|)
operator|.
name|put
argument_list|(
name|uri
argument_list|,
name|headerMap
argument_list|)
expr_stmt|;
block|}
annotation|@
name|Override
DECL|method|loadCookies (Exchange exchange, URI uri)
specifier|public
name|Map
argument_list|<
name|String
argument_list|,
name|List
argument_list|<
name|String
argument_list|>
argument_list|>
name|loadCookies
parameter_list|(
name|Exchange
name|exchange
parameter_list|,
name|URI
name|uri
parameter_list|)
throws|throws
name|IOException
block|{
comment|// the map is not used, so we do not need to fetch the headers from the
comment|// exchange
return|return
name|getCookieManager
argument_list|(
name|exchange
argument_list|)
operator|.
name|get
argument_list|(
name|uri
argument_list|,
name|Collections
operator|.
name|emptyMap
argument_list|()
argument_list|)
return|;
block|}
annotation|@
name|Override
DECL|method|getCookieStore (Exchange exchange)
specifier|public
name|CookieStore
name|getCookieStore
parameter_list|(
name|Exchange
name|exchange
parameter_list|)
block|{
return|return
name|getCookieManager
argument_list|(
name|exchange
argument_list|)
operator|.
name|getCookieStore
argument_list|()
return|;
block|}
DECL|method|getCookieManager (Exchange exchange)
specifier|protected
specifier|abstract
name|CookieManager
name|getCookieManager
parameter_list|(
name|Exchange
name|exchange
parameter_list|)
function_decl|;
block|}
end_class
end_unit
| 17.658228 | 810 | 0.805018 |
8a6ca74609e7addfdb97e7c75ea6dfacf95789c2 | 54,400 | /**
* 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
* <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 org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.ExecutionType;
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
import org.apache.hadoop.yarn.security.ContainerTokenIdentifier;
import org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor;
import org.apache.hadoop.yarn.server.nodemanager.Context;
import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Container;
import org.apache.hadoop.yarn.server.nodemanager.executor.ContainerSignalContext;
import org.junit.Test;
import java.io.IOException;
import java.util.concurrent.ConcurrentHashMap;
import static org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.CGroupsHandler.CGROUP_PROCS_FILE;
import static org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.CGroupsHandler.CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES;
import static org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.CGroupsHandler.CGROUP_PARAM_MEMORY_OOM_CONTROL;
import static org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.CGroupsHandler.CGROUP_PARAM_MEMORY_USAGE_BYTES;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
/**
* Test default out of memory handler.
*/
public class TestDefaultOOMHandler {
/**
* Test an OOM situation where there are no containers that can be killed.
*/
@Test(expected = YarnRuntimeException.class)
public void testExceptionThrownWithNoContainersToKill() throws Exception {
Context context = mock(Context.class);
when(context.getContainers()).thenReturn(new ConcurrentHashMap<>(0));
CGroupsHandler cGroupsHandler = mock(CGroupsHandler.class);
when(cGroupsHandler.getCGroupParam(
CGroupsHandler.CGroupController.MEMORY,
"",
CGROUP_PARAM_MEMORY_OOM_CONTROL))
.thenReturn("under_oom 1").thenReturn("under_oom 0");
DefaultOOMHandler handler = new DefaultOOMHandler(context, false) {
@Override
protected CGroupsHandler getCGroupsHandler() {
return cGroupsHandler;
}
};
handler.run();
}
/**
* Test an OOM situation where there are no running containers that
* can be killed.
*/
@Test(expected = YarnRuntimeException.class)
public void testExceptionThrownWithNoRunningContainersToKill()
throws Exception {
ConcurrentHashMap<ContainerId, Container> containers =
new ConcurrentHashMap<>();
Container c1 = createContainer(1, true, 1L, false);
containers.put(c1.getContainerId(), c1);
Context context = mock(Context.class);
when(context.getContainers()).thenReturn(containers);
CGroupsHandler cGroupsHandler = mock(CGroupsHandler.class);
when(cGroupsHandler.getCGroupParam(
CGroupsHandler.CGroupController.MEMORY,
"",
CGROUP_PARAM_MEMORY_OOM_CONTROL))
.thenReturn("under_oom 1").thenReturn("under_oom 0");
DefaultOOMHandler handler = new DefaultOOMHandler(context, false) {
@Override
protected CGroupsHandler getCGroupsHandler() {
return cGroupsHandler;
}
};
handler.run();
}
/**
* We have two running guaranteed containers, both of which are out of limit.
* We should kill the later one.
*/
@Test
public void testBothRunningGuaranteedContainersOverLimitUponOOM()
throws Exception {
ConcurrentHashMap<ContainerId, Container> containers =
new ConcurrentHashMap<>();
Container c1 = createContainer(1, true, 1L, true);
containers.put(c1.getContainerId(), c1);
Container c2 = createContainer(2, true, 2L, true);
containers.put(c2.getContainerId(), c2);
ContainerExecutor ex = createContainerExecutor(containers);
Context context = mock(Context.class);
when(context.getContainers()).thenReturn(containers);
when(context.getContainerExecutor()).thenReturn(ex);
CGroupsHandler cGroupsHandler = mock(CGroupsHandler.class);
when(cGroupsHandler.getCGroupParam(
CGroupsHandler.CGroupController.MEMORY,
"",
CGROUP_PARAM_MEMORY_OOM_CONTROL))
.thenReturn("under_oom 1").thenReturn("under_oom 0");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1234").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(11));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(11));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1235").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(11));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(11));
DefaultOOMHandler handler =
new DefaultOOMHandler(context, false) {
@Override
protected CGroupsHandler getCGroupsHandler() {
return cGroupsHandler;
}
};
handler.run();
verify(ex, times(1)).signalContainer(
new ContainerSignalContext.Builder()
.setPid("1235")
.setContainer(c2)
.setSignal(ContainerExecutor.Signal.KILL)
.build()
);
verify(ex, times(1)).signalContainer(any());
}
/**
* We have two running GUARANTEED containers, one of which is out of limit.
* We should kill the one that's out of its limit. This should
* happen even if it was launched earlier than the other one.
*/
@Test
public void testOneGuaranteedContainerOverLimitUponOOM() throws Exception {
ConcurrentHashMap<ContainerId, Container> containers =
new ConcurrentHashMap<>();
Container c1 = createContainer(1, true, 2L, true);
containers.put(c1.getContainerId(), c1);
Container c2 = createContainer(2, true, 1L, true);
containers.put(c2.getContainerId(), c2);
ContainerExecutor ex = createContainerExecutor(containers);
Context context = mock(Context.class);
when(context.getContainers()).thenReturn(containers);
when(context.getContainerExecutor()).thenReturn(ex);
CGroupsHandler cGroupsHandler = mock(CGroupsHandler.class);
when(cGroupsHandler.getCGroupParam(
CGroupsHandler.CGroupController.MEMORY,
"",
CGROUP_PARAM_MEMORY_OOM_CONTROL))
.thenReturn("under_oom 1").thenReturn("under_oom 0");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1234").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
// container c2 is out of its limit
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1235").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(11));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(11));
DefaultOOMHandler handler =
new DefaultOOMHandler(context, false) {
@Override
protected CGroupsHandler getCGroupsHandler() {
return cGroupsHandler;
}
};
handler.run();
verify(ex, times(1)).signalContainer(
new ContainerSignalContext.Builder()
.setPid("1235")
.setContainer(c2)
.setSignal(ContainerExecutor.Signal.KILL)
.build()
);
verify(ex, times(1)).signalContainer(any());
}
/**
* We have two running GUARANTEE containers, neither of which is out of limit.
* We should kill the later launched one.
*/
@Test
public void testNoGuaranteedContainerOverLimitOOM() throws Exception {
ConcurrentHashMap<ContainerId, Container> containers =
new ConcurrentHashMap<>();
Container c1 = createContainer(1, true, 1L, true);
containers.put(c1.getContainerId(), c1);
Container c2 = createContainer(2, true, 2L, true);
containers.put(c2.getContainerId(), c2);
ContainerExecutor ex = createContainerExecutor(containers);
Context context = mock(Context.class);
when(context.getContainers()).thenReturn(containers);
when(context.getContainerExecutor()).thenReturn(ex);
CGroupsHandler cGroupsHandler = mock(CGroupsHandler.class);
when(cGroupsHandler.getCGroupParam(
CGroupsHandler.CGroupController.MEMORY,
"",
CGROUP_PARAM_MEMORY_OOM_CONTROL))
.thenReturn("under_oom 1").thenReturn("under_oom 0");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1234").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1235").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
DefaultOOMHandler handler =
new DefaultOOMHandler(context, false) {
@Override
protected CGroupsHandler getCGroupsHandler() {
return cGroupsHandler;
}
};
handler.run();
verify(ex, times(1)).signalContainer(
new ContainerSignalContext.Builder()
.setPid("1235")
.setContainer(c2)
.setSignal(ContainerExecutor.Signal.KILL)
.build()
);
verify(ex, times(1)).signalContainer(any());
}
/**
* We have two OPPORTUNISTIC containers, one running and the other not.
* We should kill the running one.
*/
@Test
public void testKillOnlyRunningContainersUponOOM() throws Exception {
ConcurrentHashMap<ContainerId, Container> containers =
new ConcurrentHashMap<>();
Container c1 = createContainer(1, false, 1L, false);
containers.put(c1.getContainerId(), c1);
Container c2 = createContainer(2, false, 2L, true);
containers.put(c2.getContainerId(), c2);
ContainerExecutor ex = createContainerExecutor(containers);
Context context = mock(Context.class);
when(context.getContainers()).thenReturn(containers);
when(context.getContainerExecutor()).thenReturn(ex);
CGroupsHandler cGroupsHandler = mock(CGroupsHandler.class);
when(cGroupsHandler.getCGroupParam(
CGroupsHandler.CGroupController.MEMORY,
"",
CGROUP_PARAM_MEMORY_OOM_CONTROL))
.thenReturn("under_oom 1").thenReturn("under_oom 0");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1234").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
DefaultOOMHandler handler =
new DefaultOOMHandler(context, false) {
@Override
protected CGroupsHandler getCGroupsHandler() {
return cGroupsHandler;
}
};
handler.run();
verify(ex, times(1)).signalContainer(
new ContainerSignalContext.Builder()
.setPid("1235")
.setContainer(c2)
.setSignal(ContainerExecutor.Signal.KILL)
.build()
);
verify(ex, times(1)).signalContainer(any());
}
/**
* We have two 'running' OPPORTUNISTIC containers. Killing the most-
* recently launched one fails because its cgroup.procs file is not
* available. The other OPPORTUNISTIC containers should be killed in
* this case.
*/
@Test
public void testKillOpportunisticContainerWithKillFailuresUponOOM()
throws Exception {
ConcurrentHashMap<ContainerId, Container> containers =
new ConcurrentHashMap<>();
Container c1 = createContainer(1, false, 1L, true);
containers.put(c1.getContainerId(), c1);
Container c2 = createContainer(2, false, 2L, true);
containers.put(c2.getContainerId(), c2);
ContainerExecutor ex = createContainerExecutor(containers);
Context context = mock(Context.class);
when(context.getContainers()).thenReturn(containers);
when(context.getContainerExecutor()).thenReturn(ex);
CGroupsHandler cGroupsHandler = mock(CGroupsHandler.class);
when(cGroupsHandler.getCGroupParam(
CGroupsHandler.CGroupController.MEMORY,
"",
CGROUP_PARAM_MEMORY_OOM_CONTROL))
.thenReturn("under_oom 1").thenReturn("under_oom 0");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1234").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
// c2 process has not started, hence no cgroup.procs file yet
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenThrow(
new ResourceHandlerException(CGROUP_PROCS_FILE + " not found"));
DefaultOOMHandler handler =
new DefaultOOMHandler(context, false) {
@Override
protected CGroupsHandler getCGroupsHandler() {
return cGroupsHandler;
}
};
handler.run();
verify(ex, times(1)).signalContainer(
new ContainerSignalContext.Builder()
.setPid("1235")
.setContainer(c1)
.setSignal(ContainerExecutor.Signal.KILL)
.build()
);
verify(ex, times(1)).signalContainer(any());
}
/**
* We have two 'running' OPPORTUNISTIC containers and one GUARANTEED
* container. Killing two OPPORTUNISTIC containers fails because they
* have not really started running as processes since the root cgroup
* is under oom. We should try to kill one container successfully. In
* this case, the GUARANTEED container should be killed.
*/
@Test
public void testKillGuaranteedContainerWithKillFailuresUponOOM()
throws Exception {
ConcurrentHashMap<ContainerId, Container> containers =
new ConcurrentHashMap<>();
Container c1 = createContainer(1, false, 1L, true);
containers.put(c1.getContainerId(), c1);
Container c2 = createContainer(2, false, 2L, true);
containers.put(c2.getContainerId(), c2);
Container c3 = createContainer(3, true, 2L, true);
containers.put(c3.getContainerId(), c3);
ContainerExecutor ex = createContainerExecutor(containers);
Context context = mock(Context.class);
when(context.getContainers()).thenReturn(containers);
when(context.getContainerExecutor()).thenReturn(ex);
CGroupsHandler cGroupsHandler = mock(CGroupsHandler.class);
when(cGroupsHandler.getCGroupParam(
CGroupsHandler.CGroupController.MEMORY,
"",
CGROUP_PARAM_MEMORY_OOM_CONTROL))
.thenReturn("under_oom 1").thenReturn("under_oom 0");
// c1 process has not started, hence no cgroup.procs file yet
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenThrow(
new ResourceHandlerException(CGROUP_PROCS_FILE + " not found"));
// c2 process has not started, hence no cgroup.procs file yet
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenThrow(
new ResourceHandlerException(CGROUP_PROCS_FILE + " not found"));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c3.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1234").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c3.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c3.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
DefaultOOMHandler handler =
new DefaultOOMHandler(context, false) {
@Override
protected CGroupsHandler getCGroupsHandler() {
return cGroupsHandler;
}
};
handler.run();
verify(ex, times(1)).signalContainer(
new ContainerSignalContext.Builder()
.setPid("1235")
.setContainer(c3)
.setSignal(ContainerExecutor.Signal.KILL)
.build()
);
verify(ex, times(1)).signalContainer(any());
}
/**
* Test an OOM situation where no containers are killed successfully.
*
* We have two 'running' containers, none of which are actually
* running as processes. Their cgroup.procs file is not available,
* so kill them won't succeed.
*/
@Test(expected = YarnRuntimeException.class)
public void testExceptionThrownWhenNoContainersKilledSuccessfully()
throws Exception {
ConcurrentHashMap<ContainerId, Container> containers =
new ConcurrentHashMap<>();
Container c1 = createContainer(1, false, 1L, true);
containers.put(c1.getContainerId(), c1);
Container c2 = createContainer(2, false, 2L, true);
containers.put(c2.getContainerId(), c2);
ContainerExecutor ex = createContainerExecutor(containers);
Context context = mock(Context.class);
when(context.getContainers()).thenReturn(containers);
when(context.getContainerExecutor()).thenReturn(ex);
CGroupsHandler cGroupsHandler = mock(CGroupsHandler.class);
when(cGroupsHandler.getCGroupParam(
CGroupsHandler.CGroupController.MEMORY,
"",
CGROUP_PARAM_MEMORY_OOM_CONTROL))
.thenReturn("under_oom 1").thenReturn("under_oom 0");
// c1 process has not started, hence no cgroup.procs file yet
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenThrow(
new ResourceHandlerException(CGROUP_PROCS_FILE + " not found"));
// c2 process has not started, hence no cgroup.procs file yet
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenThrow(
new ResourceHandlerException(CGROUP_PROCS_FILE + " not found"));
DefaultOOMHandler handler =
new DefaultOOMHandler(context, false) {
@Override
protected CGroupsHandler getCGroupsHandler() {
return cGroupsHandler;
}
};
handler.run();
}
/**
* We have two running opportunistic containers, both of which are out of
* limit. We should kill the later one.
*/
@Test
public void testBothOpportunisticContainersOverLimitUponOOM()
throws Exception {
ConcurrentHashMap<ContainerId, Container> containers =
new ConcurrentHashMap<>();
Container c1 = createContainer(1, false, 1L, true);
containers.put(c1.getContainerId(), c1);
Container c2 = createContainer(2, false, 2L, true);
containers.put(c2.getContainerId(), c2);
ContainerExecutor ex = createContainerExecutor(containers);
Context context = mock(Context.class);
when(context.getContainers()).thenReturn(containers);
when(context.getContainerExecutor()).thenReturn(ex);
CGroupsHandler cGroupsHandler = mock(CGroupsHandler.class);
when(cGroupsHandler.getCGroupParam(
CGroupsHandler.CGroupController.MEMORY,
"",
CGROUP_PARAM_MEMORY_OOM_CONTROL))
.thenReturn("under_oom 1").thenReturn("under_oom 0");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1234").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(11));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(11));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1235").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(11));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(11));
DefaultOOMHandler handler =
new DefaultOOMHandler(context, false) {
@Override
protected CGroupsHandler getCGroupsHandler() {
return cGroupsHandler;
}
};
handler.run();
verify(ex, times(1)).signalContainer(
new ContainerSignalContext.Builder()
.setPid("1235")
.setContainer(c2)
.setSignal(ContainerExecutor.Signal.KILL)
.build()
);
verify(ex, times(1)).signalContainer(any());
}
/**
* We have two running OPPORTUNISTIC containers, one of which is out of
* limit. We should kill the one that's out of its limit. This should
* happen even if it was launched earlier than the other one.
*/
@Test
public void testOneOpportunisticContainerOverLimitUponOOM() throws Exception {
ConcurrentHashMap<ContainerId, Container> containers =
new ConcurrentHashMap<>();
Container c1 = createContainer(1, false, 2L, true);
containers.put(c1.getContainerId(), c1);
Container c2 = createContainer(2, false, 1L, true);
containers.put(c2.getContainerId(), c2);
ContainerExecutor ex = createContainerExecutor(containers);
Context context = mock(Context.class);
when(context.getContainers()).thenReturn(containers);
when(context.getContainerExecutor()).thenReturn(ex);
CGroupsHandler cGroupsHandler = mock(CGroupsHandler.class);
when(cGroupsHandler.getCGroupParam(
CGroupsHandler.CGroupController.MEMORY,
"",
CGROUP_PARAM_MEMORY_OOM_CONTROL))
.thenReturn("under_oom 1").thenReturn("under_oom 0");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1234").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
// contnainer c2 is out of its limit
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1235").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(11));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(11));
DefaultOOMHandler handler =
new DefaultOOMHandler(context, false) {
@Override
protected CGroupsHandler getCGroupsHandler() {
return cGroupsHandler;
}
};
handler.run();
verify(ex, times(1)).signalContainer(
new ContainerSignalContext.Builder()
.setPid("1235")
.setContainer(c2)
.setSignal(ContainerExecutor.Signal.KILL)
.build()
);
verify(ex, times(1)).signalContainer(any());
}
/**
* We have two running OPPORTUNISTIC containers, neither of which is out of
* limit. We should kill the later one.
*/
@Test
public void testNoOpportunisticContainerOverLimitOOM() throws Exception {
ConcurrentHashMap<ContainerId, Container> containers =
new ConcurrentHashMap<>();
Container c1 = createContainer(1, false, 1L, true);
containers.put(c1.getContainerId(), c1);
Container c2 = createContainer(2, false, 2L, true);
containers.put(c2.getContainerId(), c2);
ContainerExecutor ex = createContainerExecutor(containers);
Context context = mock(Context.class);
when(context.getContainers()).thenReturn(containers);
when(context.getContainerExecutor()).thenReturn(ex);
CGroupsHandler cGroupsHandler = mock(CGroupsHandler.class);
when(cGroupsHandler.getCGroupParam(
CGroupsHandler.CGroupController.MEMORY,
"",
CGROUP_PARAM_MEMORY_OOM_CONTROL))
.thenReturn("under_oom 1").thenReturn("under_oom 0");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1234").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1235").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
DefaultOOMHandler handler =
new DefaultOOMHandler(context, false) {
@Override
protected CGroupsHandler getCGroupsHandler() {
return cGroupsHandler;
}
};
handler.run();
verify(ex, times(1)).signalContainer(
new ContainerSignalContext.Builder()
.setPid("1235")
.setContainer(c2)
.setSignal(ContainerExecutor.Signal.KILL)
.build()
);
verify(ex, times(1)).signalContainer(any());
}
/**
* We have two running OPPORTUNISTIC containers and one running GUARANTEED
* container. One of the OPPORTUNISTIC container is out of limit.
* OOM is resolved after killing the OPPORTUNISTIC container that
* exceeded its limit even though it is launched earlier than the
* other OPPORTUNISTIC container.
*/
@Test
public void testKillOneOverLimitOpportunisticContainerUponOOM()
throws Exception {
ConcurrentHashMap<ContainerId, Container> containers =
new ConcurrentHashMap<>();
int currentContainerId = 0;
Container c1 = createContainer(currentContainerId++, false, 2, true);
containers.put(c1.getContainerId(), c1);
Container c2 = createContainer(currentContainerId++, false, 1, true);
containers.put(c2.getContainerId(), c2);
Container c3 = createContainer(currentContainerId++, true, 1, true);
containers.put(c3.getContainerId(), c3);
ContainerExecutor ex = createContainerExecutor(containers);
Context context = mock(Context.class);
when(context.getContainers()).thenReturn(containers);
when(context.getContainerExecutor()).thenReturn(ex);
CGroupsHandler cGroupsHandler = mock(CGroupsHandler.class);
when(cGroupsHandler.getCGroupParam(
CGroupsHandler.CGroupController.MEMORY,
"",
CGROUP_PARAM_MEMORY_OOM_CONTROL))
.thenReturn("under_oom 1")
.thenReturn("under_oom 0");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1234").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
// container c2 is out of its limit
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1235").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(11));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(11));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c3.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1236").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c3.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c3.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
DefaultOOMHandler handler =
new DefaultOOMHandler(context, false) {
@Override
protected CGroupsHandler getCGroupsHandler() {
return cGroupsHandler;
}
};
handler.run();
verify(ex, times(1)).signalContainer(
new ContainerSignalContext.Builder()
.setPid("1235")
.setContainer(c2)
.setSignal(ContainerExecutor.Signal.KILL)
.build()
);
verify(ex, times(1)).signalContainer(any());
}
/**
* We have two running OPPORTUNISTIC containers and one running GUARANTEED
* container. None of the containers exceeded its memory limit.
* OOM is resolved after killing the most recently launched OPPORTUNISTIC
* container.
*/
@Test
public void testKillOneLaterOpportunisticContainerUponOOM() throws Exception {
ConcurrentHashMap<ContainerId, Container> containers =
new ConcurrentHashMap<>();
int currentContainerId = 0;
Container c1 = createContainer(currentContainerId++, false, 1, true);
containers.put(c1.getContainerId(), c1);
Container c2 = createContainer(currentContainerId++, false, 2, true);
containers.put(c2.getContainerId(), c2);
Container c3 = createContainer(currentContainerId++, true, 1, true);
containers.put(c3.getContainerId(), c3);
ContainerExecutor ex = createContainerExecutor(containers);
Context context = mock(Context.class);
when(context.getContainers()).thenReturn(containers);
when(context.getContainerExecutor()).thenReturn(ex);
CGroupsHandler cGroupsHandler = mock(CGroupsHandler.class);
when(cGroupsHandler.getCGroupParam(
CGroupsHandler.CGroupController.MEMORY,
"",
CGROUP_PARAM_MEMORY_OOM_CONTROL))
.thenReturn("under_oom 1")
.thenReturn("under_oom 0");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1234").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1235").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c3.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1236").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c3.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c3.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
DefaultOOMHandler handler =
new DefaultOOMHandler(context, false) {
@Override
protected CGroupsHandler getCGroupsHandler() {
return cGroupsHandler;
}
};
handler.run();
verify(ex, times(1)).signalContainer(
new ContainerSignalContext.Builder()
.setPid("1235")
.setContainer(c2)
.setSignal(ContainerExecutor.Signal.KILL)
.build()
);
verify(ex, times(1)).signalContainer(any());
}
/**
* We have two running OPPORTUNISTIC containers and one running GUARANTEED
* container. One of the OPPORTUNISTIC container is out of limit.
* OOM is resolved after killing both OPPORTUNISTIC containers.
*/
@Test
public void testKillBothOpportunisticContainerUponOOM() throws Exception {
int currentContainerId = 0;
ConcurrentHashMap<ContainerId, Container> containers =
new ConcurrentHashMap<>();
Container c1 = createContainer(currentContainerId++, false, 2, true);
containers.put(c1.getContainerId(), c1);
Container c2 = createContainer(currentContainerId++, false, 1, true);
containers.put(c2.getContainerId(), c2);
Container c3 = createContainer(currentContainerId++, true, 1, true);
containers.put(c3.getContainerId(), c3);
ContainerExecutor ex = createContainerExecutor(containers);
Context context = mock(Context.class);
when(context.getContainers()).thenReturn(containers);
when(context.getContainerExecutor()).thenReturn(ex);
CGroupsHandler cGroupsHandler = mock(CGroupsHandler.class);
when(cGroupsHandler.getCGroupParam(
CGroupsHandler.CGroupController.MEMORY,
"",
CGROUP_PARAM_MEMORY_OOM_CONTROL))
.thenReturn("under_oom 1")
.thenReturn("under_oom 1")
.thenReturn("under_oom 0");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1234").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1235").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(11));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(11));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c3.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1236").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c3.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c3.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
DefaultOOMHandler handler =
new DefaultOOMHandler(context, false) {
@Override
protected CGroupsHandler getCGroupsHandler() {
return cGroupsHandler;
}
};
handler.run();
verify(ex, times(1)).signalContainer(
new ContainerSignalContext.Builder()
.setPid("1235")
.setContainer(c1)
.setSignal(ContainerExecutor.Signal.KILL)
.build()
);
verify(ex, times(1)).signalContainer(
new ContainerSignalContext.Builder()
.setPid("1234")
.setContainer(c2)
.setSignal(ContainerExecutor.Signal.KILL)
.build()
);
verify(ex, times(2)).signalContainer(any());
}
/**
* We have two running OPPORTUNISTIC containers and one running GUARANTEED
* container. The GUARANTEED container is out of limit. OOM is resolved
* after first killing the two OPPORTUNISTIC containers and then the
* GUARANTEED container.
*/
@Test
public void testKillGuaranteedContainerUponOOM() throws Exception {
int currentContainerId = 0;
ConcurrentHashMap<ContainerId, Container> containers =
new ConcurrentHashMap<>();
Container c1 = createContainer(currentContainerId++, false, 2, true);
containers.put(c1.getContainerId(), c1);
Container c2 = createContainer(currentContainerId++, false, 1, true);
containers.put(c2.getContainerId(), c2);
Container c3 = createContainer(currentContainerId++, true, 1, true);
containers.put(c3.getContainerId(), c3);
ContainerExecutor ex = createContainerExecutor(containers);
Context context = mock(Context.class);
when(context.getContainers()).thenReturn(containers);
when(context.getContainerExecutor()).thenReturn(ex);
CGroupsHandler cGroupsHandler = mock(CGroupsHandler.class);
when(cGroupsHandler.getCGroupParam(
CGroupsHandler.CGroupController.MEMORY,
"",
CGROUP_PARAM_MEMORY_OOM_CONTROL))
.thenReturn("under_oom 1")
.thenReturn("under_oom 1")
.thenReturn("under_oom 1")
.thenReturn("under_oom 0");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1234").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1235").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c3.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1236").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c3.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(11));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c3.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(11));
DefaultOOMHandler handler =
new DefaultOOMHandler(context, false) {
@Override
protected CGroupsHandler getCGroupsHandler() {
return cGroupsHandler;
}
};
handler.run();
verify(ex, times(1)).signalContainer(
new ContainerSignalContext.Builder()
.setPid("1234")
.setContainer(c1)
.setSignal(ContainerExecutor.Signal.KILL)
.build()
);
verify(ex, times(1)).signalContainer(
new ContainerSignalContext.Builder()
.setPid("1235")
.setContainer(c1)
.setSignal(ContainerExecutor.Signal.KILL)
.build()
);
verify(ex, times(1)).signalContainer(
new ContainerSignalContext.Builder()
.setPid("1236")
.setContainer(c1)
.setSignal(ContainerExecutor.Signal.KILL)
.build()
);
verify(ex, times(3)).signalContainer(any());
}
/**
* We have two running OPPORTUNISTIC containers and one running GUARANTEED
* container. None of the containers exceeded its memory limit.
* OOM is resolved after killing all running containers.
*/
@Test
public void testKillAllContainersUponOOM() throws Exception {
int currentContainerId = 0;
ConcurrentHashMap<ContainerId, Container> containers =
new ConcurrentHashMap<>();
Container c1 = createContainer(currentContainerId++, false, 1, true);
containers.put(c1.getContainerId(), c1);
Container c2 = createContainer(currentContainerId++, false, 2, true);
containers.put(c2.getContainerId(), c2);
Container c3 = createContainer(currentContainerId++, true, 1, true);
containers.put(c3.getContainerId(), c3);
ContainerExecutor ex = createContainerExecutor(containers);
Context context = mock(Context.class);
when(context.getContainers()).thenReturn(containers);
when(context.getContainerExecutor()).thenReturn(ex);
CGroupsHandler cGroupsHandler = mock(CGroupsHandler.class);
when(cGroupsHandler.getCGroupParam(
CGroupsHandler.CGroupController.MEMORY,
"",
CGROUP_PARAM_MEMORY_OOM_CONTROL))
.thenReturn("under_oom 1")
.thenReturn("under_oom 1")
.thenReturn("under_oom 1")
.thenReturn("under_oom 0");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1234").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1235").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c3.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1236").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c3.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c3.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
DefaultOOMHandler handler =
new DefaultOOMHandler(context, false) {
@Override
protected CGroupsHandler getCGroupsHandler() {
return cGroupsHandler;
}
};
handler.run();
verify(ex, times(1)).signalContainer(
new ContainerSignalContext.Builder()
.setPid("1234")
.setContainer(c2)
.setSignal(ContainerExecutor.Signal.KILL)
.build()
);
verify(ex, times(1)).signalContainer(
new ContainerSignalContext.Builder()
.setPid("1235")
.setContainer(c1)
.setSignal(ContainerExecutor.Signal.KILL)
.build()
);
verify(ex, times(1)).signalContainer(
new ContainerSignalContext.Builder()
.setPid("1236")
.setContainer(c3)
.setSignal(ContainerExecutor.Signal.KILL)
.build()
);
verify(ex, times(3)).signalContainer(any());
}
/**
* We have two running OPPORTUNISTIC containers and one running
* GUARANTEED container.
* None of the containers exceeded its memory limit.
* OOM is not resolved even after killing all running containers.
* A YarnRuntimeException is excepted to be thrown.
*/
@Test(expected = YarnRuntimeException.class)
public void testOOMUnresolvedAfterKillingAllContainers() throws Exception {
int currentContainerId = 0;
ConcurrentHashMap<ContainerId, Container> containers =
new ConcurrentHashMap<>();
Container c1 = createContainer(currentContainerId++, false, 1, true);
containers.put(c1.getContainerId(), c1);
Container c2 = createContainer(currentContainerId++, false, 2, true);
containers.put(c2.getContainerId(), c2);
Container c3 = createContainer(currentContainerId++, true, 3, true);
containers.put(c3.getContainerId(), c3);
ContainerExecutor ex = createContainerExecutor(containers);
Context context = mock(Context.class);
when(context.getContainers()).thenReturn(containers);
when(context.getContainerExecutor()).thenReturn(ex);
CGroupsHandler cGroupsHandler = mock(CGroupsHandler.class);
when(cGroupsHandler.getCGroupParam(
CGroupsHandler.CGroupController.MEMORY,
"",
CGROUP_PARAM_MEMORY_OOM_CONTROL))
.thenReturn("under_oom 1")
.thenReturn("under_oom 1")
.thenReturn("under_oom 1")
.thenReturn("under_oom 1");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1234").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c1.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1235").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c2.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c3.getContainerId().toString(), CGROUP_PROCS_FILE))
.thenReturn("1236").thenReturn("");
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c3.getContainerId().toString(), CGROUP_PARAM_MEMORY_USAGE_BYTES))
.thenReturn(getMB(9));
when(cGroupsHandler.getCGroupParam(CGroupsHandler.CGroupController.MEMORY,
c3.getContainerId().toString(), CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES))
.thenReturn(getMB(9));
DefaultOOMHandler handler =
new DefaultOOMHandler(context, false) {
@Override
protected CGroupsHandler getCGroupsHandler() {
return cGroupsHandler;
}
};
handler.run();
}
private static ContainerId createContainerId(int id) {
ApplicationId applicationId = ApplicationId.newInstance(1, 1);
ApplicationAttemptId applicationAttemptId
= mock(ApplicationAttemptId.class);
when(applicationAttemptId.getApplicationId()).thenReturn(applicationId);
when(applicationAttemptId.getAttemptId()).thenReturn(1);
ContainerId containerId = mock(ContainerId.class);
when(containerId.toString()).thenReturn(Integer.toString(id));
when(containerId.getContainerId()).thenReturn(new Long(1));
return containerId;
}
private static Container createContainer(int containerId,
boolean guaranteed, long launchTime, boolean running) {
Container c1 = mock(Container.class);
ContainerId cid1 = createContainerId(containerId);
when(c1.getContainerId()).thenReturn(cid1);
ContainerTokenIdentifier token = mock(ContainerTokenIdentifier.class);
ExecutionType type =
guaranteed ? ExecutionType.GUARANTEED : ExecutionType.OPPORTUNISTIC;
when(token.getExecutionType()).thenReturn(type);
when(c1.getContainerTokenIdentifier()).thenReturn(token);
when(c1.getResource()).thenReturn(Resource.newInstance(10, 1));
when(c1.getContainerLaunchTime()).thenReturn(launchTime);
when(c1.isRunning()).thenReturn(running);
return c1;
}
String getMB(long mb) {
return Long.toString(mb * 1024 * 1024);
}
private static ContainerExecutor createContainerExecutor(
ConcurrentHashMap<ContainerId, Container> containers)
throws IOException {
ContainerExecutor ex = mock(ContainerExecutor.class);
when(ex.signalContainer(any())).thenAnswer(
invocation -> {
Object[] arguments = invocation.getArguments();
Container container = ((ContainerSignalContext)
arguments[0]).getContainer();
// remove container from NM context immediately
containers.remove(container.getContainerId());
return true;
});
return ex;
}
} | 42.466823 | 142 | 0.707923 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.