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
|
---|---|---|---|---|---|
2a8b4a3d38df52cebe64857544213a70ad52daf9 | 1,433 | /*
Copyright 2004, Martian Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package vimclojure.nailgun;
import java.io.PrintStream;
import org.apache.tools.ant.ExitException;
/**
* Security exception which wraps an exit status code.
* @author Pete Kirkham
*/
public class NGExitException extends ExitException {
public NGExitException(int status) {
super(status);
}
/**
* A lot of code out there, for example ant's Launcher,
* runs inside a try/catch (Throwable) which will squash
* this exception; most also calll printStackTrace(), so
* this re-throws the exception to escape the handling code.
*/
public void printStackTrace (PrintStream out) {
throw this;
}
public void reallyPrintStackTrace (PrintStream out) {
super.printStackTrace(out);
}
}
| 29.854167 | 74 | 0.67411 |
d218a6f7b7814c881501a49709e527cdaa946258 | 19,299 | /*******************************************************************************
* 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.testing.sdo.model.dataobject.xpathpositional;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import junit.textui.TestRunner;
import org.eclipse.persistence.sdo.SDOConstants;
import org.eclipse.persistence.sdo.SDOProperty;
public class SDODataObjectGetBooleanByPositionalPathTest extends SDODataObjectGetByPositionalPathTestCases {
public SDODataObjectGetBooleanByPositionalPathTest(String name) {
super(name);
}
public static void main(String[] args) {
String[] arguments = { "-c", "org.eclipse.persistence.testing.sdo.model.dataobject.xpathpositional.SDODataObjectGetBooleanByPositionalPathTest" };
TestRunner.main(arguments);
}
//1. purpose: getBoolean with Defined Boolean Property
public void testGetBooleanConversionWithPathFromDefinedBooleanPropertyBracketPositionalSet() {
// dataObject's type add boolean property
property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_BOOLEAN);
property_c.setMany(true);
type_c.addDeclaredProperty(property_c);
dataObject_c._setType(type_c);
Boolean bb = new Boolean(true);
List b = new ArrayList();
//b.add(bb);
dataObject_c.set(property_c, b);// c dataobject's a property has value boolean 'true'
dataObject_a.setBoolean(property3, true);
this.assertEquals(bb.booleanValue(), dataObject_a.getBoolean(property3));
}
//1. purpose: getBoolean with Defined Boolean Property
public void testGetBooleanConversionWithPathFromDefinedBooleanPropertyDotPositionalSet() {
// dataObject's type add boolean property
property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_BOOLEAN);
property_c.setMany(true);
type_c.addDeclaredProperty(property_c);
dataObject_c._setType(type_c);
Boolean bb = new Boolean(true);
List b = new ArrayList();
dataObject_c.set(property_c, b);// c dataobject's a property has value boolean 'true'
dataObject_a.setBoolean(property + ".0", true);
this.assertEquals(true, dataObject_a.getBoolean(property + ".0"));
}
//1. purpose: getBoolean with Defined Boolean Property
public void testGetBooleanConversionWithPathFromDefinedBooleanPropertyBracketInPathMiddle() {
property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_BOOLEAN);
type_c.addDeclaredProperty(property_c);
dataObject_c._setType(type_c);
Boolean b = new Boolean(true);
dataObject_a.setBoolean(property1, true);// c dataobject's a property has value boolean 'true'
this.assertEquals(true, dataObject_a.getBoolean(property1));
}
/*public void testGetBooleanConversionWithPathFromDefinedBooleanPropertyEqualSignBracketInPathDotSet() {
property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_BOOLEAN);
property_c.setMany(true);
type_c.addDeclaredProperty(property_c);
dataObject_c.setType(type_c);
Boolean bb = new Boolean(true);
List b = new ArrayList();
dataObject_c.set(property_c, b);// c dataobject's a property has value boolean 'true'
dataObject_a.setBoolean(property2+"[number=1]", true);
this.assertEquals(true, dataObject_a.getBoolean(property2+"[number=1]"));
}*/
//2. purpose: getBoolean with Undefined Boolean Property
public void testGetBooleanConversionFromUnDefinedBooleanProperty() {
property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_BOOLEAN);
//type_c.addDeclaredProperty(property_c);
dataObject_c._setType(type_c);
try {
dataObject_a.getBoolean(property);
} catch (Exception e) {
fail("No Exception expected, but caught " + e.getClass());
}
}
//3. purpose: getBoolean with Byte property
public void testGetBooleanFromByte() {
property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_BYTE);
type_c.addDeclaredProperty(property_c);
dataObject_c._setType(type_c);
byte theByte = 1;
dataObject_c.set(property_c, theByte);
try {
boolean value = dataObject_a.getBoolean(property);
boolean controlValue = true;
assertEquals(controlValue, value);
//TODO: conversion not supported by sdo spec but is supported by TopLink
} catch (ClassCastException e) {
}
}
//4. purpose: getBoolean with character property
public void testGetBooleanFromCharacter() {
property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_CHARACTER);
property_c.setMany(true);
type_c.addDeclaredProperty(property_c);
dataObject_c._setType(type_c);
Character bb = new Character('1');
List b = new ArrayList();
dataObject_c.set(property_c, b);// c dataobject's a property has value boolean 'true'
dataObject_a.setChar(property + ".0", bb.charValue());
this.assertEquals(true, dataObject_a.getBoolean(property + ".0"));
/*property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_CHARACTER);
type_c.addDeclaredProperty(property_c);
dataObject_c.setType(type_c);
try {
dataObject_a.getBoolean(property);
fail("ClassCastException should be thrown.");
} catch (ClassCastException e) {
}*/
}
//5. purpose: getBoolean with Double Property
public void testGetBooleanFromDouble() {
property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_DOUBLE);
property_c.setMany(true);
type_c.addDeclaredProperty(property_c);
dataObject_c._setType(type_c);
Double bb = new Double(1);
List b = new ArrayList();
dataObject_c.set(property_c, b);// c dataobject's a property has value boolean 'true'
dataObject_a.setDouble(property + ".0", bb.doubleValue());
this.assertEquals(true, dataObject_a.getBoolean(property + ".0"));
/*property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_DOUBLE);
type_c.addDeclaredProperty(property_c);
dataObject_c.setType(type_c);
try {
dataObject_a.getBoolean(property);
fail("ClassCastException should be thrown.");
} catch (ClassCastException e) {
}*/
}
//6. purpose: getBoolean with float Property
public void testGetBooleanFromFloat() {
property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_FLOAT);
property_c.setMany(true);
type_c.addDeclaredProperty(property_c);
dataObject_c._setType(type_c);
Float bb = new Float(1);
List b = new ArrayList();
dataObject_c.set(property_c, b);// c dataobject's a property has value boolean 'true'
dataObject_a.setFloat(property + ".0", bb.floatValue());
this.assertEquals(true, dataObject_a.getBoolean(property + ".0"));
/*property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_FLOAT);
type_c.addDeclaredProperty(property_c);
dataObject_c.setType(type_c);
try {
dataObject_a.getBoolean(property);
fail("ClassCastException should be thrown.");
} catch (ClassCastException e) {
}*/
}
//7. purpose: getBooleab with int Property
public void testGetBooleanFromInt() {
property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_INT);
property_c.setMany(true);
type_c.addDeclaredProperty(property_c);
dataObject_c._setType(type_c);
//short s = 1;
Integer bb = new Integer(1);
List b = new ArrayList();
dataObject_c.set(property_c, b);// c dataobject's a property has value boolean 'true'
dataObject_a.setInt(property + ".0", bb.intValue());
this.assertEquals(true, dataObject_a.getBoolean(property + ".0"));
/*property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_INT);
type_c.addDeclaredProperty(property_c);
dataObject_c.setType(type_c);
try {
dataObject_a.getBoolean(property);
fail("ClassCastException should be thrown.");
} catch (ClassCastException e) {
}*/
}
//8. purpose: getBoolea with long Property
public void testGetBooleanFromLong() {
property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_LONG);
property_c.setMany(true);
type_c.addDeclaredProperty(property_c);
dataObject_c._setType(type_c);
long s = 1;
Long bb = new Long(s);
List b = new ArrayList();
dataObject_c.set(property_c, b);// c dataobject's a property has value boolean 'true'
dataObject_a.setLong(property + ".0", bb.longValue());
this.assertEquals(true, dataObject_a.getBoolean(property + ".0"));
/*property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_LONG);
type_c.addDeclaredProperty(property_c);
dataObject_c.setType(type_c);
try {
dataObject_a.getBoolean(property);
fail("ClassCastException should be thrown.");
} catch (ClassCastException e) {
}*/
}
//9. purpose: getBytes with short Property
public void testGetBooleanFromShort() {
property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_SHORT);
property_c.setMany(true);
type_c.addDeclaredProperty(property_c);
dataObject_c._setType(type_c);
short s = 1;
Short bb = new Short(s);
List b = new ArrayList();
dataObject_c.set(property_c, b);// c dataobject's a property has value boolean 'true'
dataObject_a.setShort(property + ".0", bb.shortValue());
this.assertEquals(true, dataObject_a.getBoolean(property + ".0"));
/*property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_SHORT);
type_c.addDeclaredProperty(property_c);
dataObject_c.setType(type_c);
try {
dataObject_a.getBoolean(property);
fail("ClassCastException should be thrown.");
} catch (ClassCastException e) {
}*/
}
//10. purpose: getBoolean with Defined String Property
public void testGetBooleanConversionFromDefinedStringProperty() {
property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_STRING);
type_c.addDeclaredProperty(property_c);
dataObject_c._setType(type_c);
String str = "true";
Boolean B_STR = new Boolean(str);
dataObject_c.setString(property_c, str);// add it to instance list
this.assertEquals(B_STR.booleanValue(), dataObject_a.getBoolean(property));
}
//1. purpose: getBoolean with Defined Boolean Property
public void testGetBooleanConversionWithPathFromDefinedBooleanStringBracketPositionalSet() {
// dataObject's type add boolean property
property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_BOOLEAN);
property_c.setMany(true);
type_c.addDeclaredProperty(property_c);
dataObject_c._setType(type_c);
String str = "true";
Boolean bb = new Boolean(str);
List b = new ArrayList();
//b.add(bb);
dataObject_c.set(property_c, b);// c dataobject's a property has value boolean 'true'
dataObject_a.set(property3, bb);
this.assertEquals(bb.booleanValue(), dataObject_a.getBoolean(property3));
}
//1. purpose: getBoolean with Defined Boolean Property
public void testGetBooleanConversionWithPathFromDefinedStringPropertyDotPositionalSet() {
// dataObject's type add boolean property
property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_BOOLEAN);
property_c.setMany(true);
type_c.addDeclaredProperty(property_c);
dataObject_c._setType(type_c);
String str = "true";
Boolean bb = new Boolean(str);
List b = new ArrayList();
dataObject_c.set(property_c, b);// c dataobject's a property has value boolean 'true'
dataObject_a.set(property + ".0", bb);
this.assertEquals(true, dataObject_a.getBoolean(property + ".0"));
}
//1. purpose: getBoolean with Defined Boolean Property
public void testGetBooleanConversionWithPathFromDefinedStringPropertyBracketInPathMiddle() {
property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_BOOLEAN);
type_c.addDeclaredProperty(property_c);
dataObject_c._setType(type_c);
String str = "true";
Boolean b = new Boolean(str);
dataObject_a.set(property1, b);// c dataobject's a property has value boolean 'true'
this.assertEquals(true, dataObject_a.getBoolean(property1));
}
/* public void testGetBooleanConversionWithPathFromDefinedStringPropertyEqualSignBracketInPathDotSet() {
property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_BOOLEAN);
property_c.setMany(true);
type_c.addDeclaredProperty(property_c);
dataObject_c.setType(type_c);
String str = "true";
Boolean bb = new Boolean(str);
List b = new ArrayList();
dataObject_c.set(property_c, b);// c dataobject's a property has value boolean 'true'
dataObject_a.set(property2+"[number=1]", bb);
this.assertEquals(true, dataObject_a.getBoolean(property2+"[number=1]"));
}*/
//11. purpose: getDouble with Undefined string Property
public void testGetBooleanConversionFromUnDefinedStringProperty() {
property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_STRING);
//type_c.addDeclaredProperty(property_c);
dataObject_c._setType(type_c);
try {
dataObject_a.getBoolean(property);
} catch (Exception e) {
fail("No Exception expected, but caught " + e.getClass());
}
}
//12. purpose: getBoolean with bytes property
public void testGetBooleanFromBytes() {
property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_BYTES);
type_c.addDeclaredProperty(property_c);
dataObject_c._setType(type_c);
byte[] bytes = new byte[] { 10, 100 };
dataObject_c.set(property_c, bytes);
try {
dataObject_a.getBoolean(property);
} catch (Exception e) {
fail("No Exception expected, but caught " + e.getClass());
}
}
//13. purpose: getBoolean with decimal property
public void testGetBooleanFromDecimal() {
property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_DECIMAL);
type_c.addDeclaredProperty(property_c);
dataObject_c._setType(type_c);
try {
boolean value = dataObject_a.getBoolean(property);
boolean controlValue = false;
assertEquals(controlValue, value);
//TODO: conversion not supported by sdo spec but is supported by TopLink
} catch (ClassCastException e) {
}
}
//14. purpose: getBoolean with integer property
public void testGetBooleanFromInteger() {
property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_INTEGER);
type_c.addDeclaredProperty(property_c);
dataObject_c._setType(type_c);
dataObject_c.set(property_c, new BigInteger("1"));
try {
boolean value = dataObject_a.getBoolean(property);
boolean controlValue = true;
assertEquals(controlValue, value);
//TODO: conversion not supported by sdo spec but is supported by TopLink
} catch (ClassCastException e) {
}
}
//22. purpose: getBoolean with date property
public void testGetBooleanFromDate() {
property_c = new SDOProperty(aHelperContext);
property_c.setName(PROPERTY_NAME_C);
property_c.setType(SDOConstants.SDO_DATE);
type_c.addDeclaredProperty(property_c);
dataObject_c._setType(type_c);
dataObject_c.set(property_c, Calendar.getInstance().getTime());
try {
dataObject_a.getBoolean(property);
} catch (Exception e) {
fail("No Exception expected, but caught " + e.getClass());
}
}
//purpose: getDouble with nul value
public void testGetBooleanWithNullArgument() {
try {
String path = null;
dataObject_a.getBoolean(path);
} catch (Exception e) {
fail("No Exception expected, but caught " + e.getClass());
}
}
}
| 38.140316 | 154 | 0.666615 |
337339ca7b6423aef118c7fcd2e24770b3fa9074 | 529 | package com.jstarcraft.nlp.tokenization;
import com.huaban.analysis.jieba.JiebaSegmenter;
import com.huaban.analysis.jieba.JiebaSegmenter.SegMode;
import com.jstarcraft.nlp.tokenization.jieba.JiebaTokenizer;
public class JiebaTokenizerTestCase extends NlpTokenizerTestCase {
@Override
protected NlpTokenizer<? extends NlpToken> getTokenizer() {
JiebaSegmenter segmenter = new JiebaSegmenter();
SegMode mode = SegMode.SEARCH;
return new JiebaTokenizer(segmenter, mode);
}
}
| 31.117647 | 67 | 0.746692 |
42f46dc8b00c5b06df1a0e2969b8f69825e69831 | 911 | package com.github.arthurfiorette.sinklibrary.command;
import com.github.arthurfiorette.sinklibrary.command.wrapper.CommandInfo;
import com.github.arthurfiorette.sinklibrary.command.wrapper.CommandInfo.CommandInfoBuilder;
import com.github.arthurfiorette.sinklibrary.command.wrapper.CommandWrapper;
import lombok.experimental.UtilityClass;
@UtilityClass
public class CommandUtils {
public CommandWrapper[] wrapAll(final BaseCommand[] commands) {
final CommandWrapper[] wrapped = new CommandWrapper[commands.length];
for (int i = 0; i < commands.length; i++) {
wrapped[i] = CommandUtils.wrap(commands[i]);
}
return wrapped;
}
public CommandWrapper wrap(final BaseCommand command) {
final CommandInfoBuilder builder = CommandInfo.builder();
command.info(builder);
final CommandWrapper wrapper = new CommandWrapper(command, builder.build());
return wrapper;
}
}
| 32.535714 | 92 | 0.769484 |
3c3b805ce8e72d50d536f41c2125e7e6a3945747 | 916 | package com.nurisezgin.securesharedpreferences.util.checker;
import org.junit.Test;
import static com.nurisezgin.securesharedpreferences.util.checker.ParamChecker.*;
/**
* Created by nurisezgin on 07/02/2017.
*/
public class ParamCheckerTest {
@Test (expected = InValidContentException.class)
public void should_isNullCorrect() throws InValidContentException {
check(null, isNull());
}
@Test (expected = InValidContentException.class)
public void should_isEmptyCorrect() throws InValidContentException {
check("", isEmpty());
}
@Test (expected = InValidContentException.class)
public void should_isNullOrEmpty() throws InValidContentException {
check(null, isNullOrEmpty());
}
@Test (expected = InValidContentException.class)
public void should_isNullOrEmpty1() throws InValidContentException {
check("", isNullOrEmpty());
}
} | 28.625 | 81 | 0.724891 |
db27c0d2ba3275960370def4dad2567500b8bf7c | 601 | package com.test.performance.demo;
import com.test.performance.testcase.AbstractTestCaseExecutor;
import com.test.performance.testcase.TestCaseResult;
public class DemoTestCaseImpl extends AbstractTestCaseExecutor {
public DemoTestCaseImpl(){
//System.out.println(System.getProperties());
}
@Override
protected TestCaseResult run(String trackingId) {
//System.out.println(" run test case with trackingId:" + trackingId);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
return new TestCaseResult();
}
}
| 25.041667 | 80 | 0.71381 |
15f1d1529b1017a8e87ecfb0d4ea7eba17b7a52b | 2,187 | package com.eixox.reflection;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.List;
import com.eixox.globalization.Culture;
public class AbstractAspectMember implements AspectMember {
private final AspectMember member;
public AbstractAspectMember(AspectMember member) {
this.member = member;
}
public final <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
return this.member.getAnnotation(annotationClass);
}
public final Annotation[] getAnnotations() {
return this.member.getAnnotations();
}
public final Annotation[] getDeclaredAnnotations() {
return this.member.getDeclaredAnnotations();
}
public final boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) {
return this.member.isAnnotationPresent(annotationClass);
}
public final Class<?> getDeclaringClass() {
return this.member.getDeclaringClass();
}
public final int getModifiers() {
return this.member.getModifiers();
}
public final String getName() {
return this.member.getName();
}
public final boolean isSynthetic() {
return this.member.isSynthetic();
}
public final Class<?> getDataType() {
return this.member.getDataType();
}
public final Object getValue(Object instance) {
return this.member.getValue(instance);
}
public final void setValue(Object instance, Object value) {
this.member.setValue(instance, value);
}
public final Type getGenericType() {
return this.member.getGenericType();
}
public final String getValueToString(Object instance, Culture culture) {
Object value = this.member.getValue(instance);
if (value == null)
return "";
else
return value.toString();
}
public final boolean isReadOnly() {
return this.member.isReadOnly();
}
public final boolean isArray() {
return getDataType().isArray();
}
public final boolean isList() {
return List.class.isAssignableFrom(getDataType());
}
public final boolean isPrimitive() {
return getDataType().isPrimitive();
}
public final boolean isEnum() {
return getDataType().isEnum();
}
public final boolean isString() {
return String.class.isAssignableFrom(getDataType());
}
}
| 22.090909 | 88 | 0.74257 |
4a66cd8fcb72d2aec94233a1b6dc73e8b1f2811a | 440 | package org.ualr.mobileapps.sneakercalendar.ui.signup;
public class SignupResult {
private int errorMessage;
private boolean successful;
public SignupResult(int errorMessage, boolean successful) {
this.errorMessage = errorMessage;
this.successful = successful;
}
public int getErrorMessage() {
return errorMessage;
}
public boolean isSuccessful() {
return successful;
}
}
| 22 | 63 | 0.684091 |
795d9c2ff98603602ca9523c913c7b57dcc72532 | 1,331 | package cn.ideabuffer.process.extension.retry.nodes;
import cn.ideabuffer.process.core.ProcessListener;
import cn.ideabuffer.process.core.Processor;
import cn.ideabuffer.process.core.rules.Rule;
import com.github.rholder.retry.Retryer;
import java.util.List;
import java.util.concurrent.Executor;
/**
* @author sangjian.sj
* @date 2020/05/06
*/
public class DefaultRetryNode<R> extends AbstractRetryableNode<R> {
public DefaultRetryNode() {
super(null);
}
public DefaultRetryNode(Retryer<R> retryer) {
super(retryer);
}
public DefaultRetryNode(boolean parallel, Retryer<R> retryer) {
super(parallel, retryer);
}
public DefaultRetryNode(Rule rule, Retryer<R> retryer) {
super(rule, retryer);
}
public DefaultRetryNode(boolean parallel, Executor executor,
Retryer<R> retryer) {
super(parallel, executor, retryer);
}
public DefaultRetryNode(boolean parallel, Rule rule, Executor executor,
Retryer<R> retryer) {
super(parallel, rule, executor, retryer);
}
public DefaultRetryNode(boolean parallel, Rule rule, Executor executor,
List<ProcessListener<R>> listeners, Processor<R> processor,
Retryer<R> retryer) {
super(parallel, rule, executor, listeners, processor, retryer);
}
}
| 27.163265 | 75 | 0.694966 |
e93a4058efa6d7c6801a4c85bc75e293dc325911 | 1,076 | package game;
import enums.ActorType;
import enums.Direction;
public class PacMan extends Actor {
private Direction direction;
public PacMan(Point position) {
if (position == null) {
throw new IllegalArgumentException("Invalid position to initialize PacMan");
}
this.position = position;
this.actorType = ActorType.PACMAN;
this.direction = Direction.LEFT;
}
public Direction getDirection() {
return direction;
}
public void setDirection(Direction direction) {
if (direction == null) {
throw new IllegalArgumentException("Invalid direction for PacMan");
}
this.direction = direction;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[");
sb.append(this.actorType);
sb.append(", position: ").append(this.position.x).append(",").append(this.position.y).append(")");
sb.append(", direction: ").append(this.direction);
sb.append("]");
return sb.toString();
}
}
| 26.243902 | 106 | 0.61803 |
bd1b9f4a362d77b9d7ed9893608575d6ac36e08b | 1,371 | package com.dianping.cat.report.task.problem;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import org.junit.Test;
import org.unidal.lookup.ComponentTestCase;
import com.dianping.cat.Constants;
import com.dianping.cat.report.page.problem.task.ProblemReportBuilder;
import com.dianping.cat.report.task.TaskBuilder;
public class ProblemReportBuilderTest extends ComponentTestCase {
@Test
public void testDailyTask() {
TaskBuilder builder = lookup(TaskBuilder.class, ProblemReportBuilder.ID);
try {
builder.buildDailyTask(ProblemReportBuilder.ID, Constants.CAT,
new SimpleDateFormat("yyyy-MM-dd").parse("2016-02-25"));
} catch (ParseException e) {
e.printStackTrace();
}
}
@Test
public void testWeeklyTask() {
TaskBuilder builder = lookup(TaskBuilder.class, ProblemReportBuilder.ID);
try {
builder.buildWeeklyTask(ProblemReportBuilder.ID, Constants.CAT,
new SimpleDateFormat("yyyy-MM-dd").parse("2016-02-20"));
} catch (ParseException e) {
e.printStackTrace();
}
}
@Test
public void testMonthlyTask() {
TaskBuilder builder = lookup(TaskBuilder.class, ProblemReportBuilder.ID);
try {
builder.buildMonthlyTask(ProblemReportBuilder.ID, Constants.CAT,
new SimpleDateFormat("yyyy-MM-dd").parse("2016-01-01"));
} catch (ParseException e) {
e.printStackTrace();
}
}
}
| 26.882353 | 75 | 0.741794 |
dffac8789c3e45f62a263a250040d3130b55268f | 2,250 | package org.apache.hadoop.examples.iterative;
import java.io.IOException;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.FloatWritable;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapred.IterativeMapper;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.MapReduceBase;
import org.apache.hadoop.mapred.OutputCollector;
import org.apache.hadoop.mapred.Reporter;
public class MatrixMul1Map extends MapReduceBase implements
IterativeMapper<IntIntPairWritable, FloatWritable, NullWritable, NullWritable, IntWritable, IntFloatPairWritable> {
private int count = 0;
private JobConf conf;
private FileSystem fs;
private String subNDir;
private int taskid;
private int iteration;
@Override
public void configure(JobConf job){
conf = job;
try {
fs = FileSystem.get(job);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
subNDir = job.get(Common.SUBSTATE);
taskid = Util.getTaskId(conf);
}
@Override
public void map(IntIntPairWritable key, FloatWritable value, NullWritable nokey, NullWritable noval,
OutputCollector<IntWritable, IntFloatPairWritable> output, Reporter report)
throws IOException {
count++;
report.setStatus(String.valueOf(count));
output.collect(new IntWritable(key.getY()), new IntFloatPairWritable(key.getX(), value.get()));
//System.out.println(key.getY() + "\t" + new IntFloatPairWritable(key.getX(), value.get()));
}
@Override
public Path[] initStateData() throws IOException {
Path remotePath = new Path(this.subNDir + taskid);
Path localPath = new Path(Common.LOCAL_STATE + taskid);
fs.copyToLocalFile(remotePath, localPath);
Path[] paths = new Path[1];
paths[0] = localPath;
return paths;
}
@Override
public Path initStaticData() throws IOException {
return null;
}
@Override
public void iterate() {
System.out.println("iteration " + (iteration++));
}
@Override
public void map(IntIntPairWritable arg0, FloatWritable arg1,
OutputCollector<IntWritable, IntFloatPairWritable> arg2,
Reporter arg3) throws IOException {
// TODO Auto-generated method stub
}
}
| 28.481013 | 117 | 0.755111 |
a1234da98443537dbe15ffd6839b644f0087f42a | 127 | package cn.woodwhales.mapstruct.converter;
/**
* @author woodwhales
* @date 2020-12-24 21:44
*/
public interface Param {
}
| 14.111111 | 42 | 0.700787 |
762f8cf69d1a1f6a965bd0639ec6577a8d722472 | 1,600 | package de.bogenliga.application.business.user.impl.entity;
import java.sql.Timestamp;
import de.bogenliga.application.business.user.impl.types.SignInResult;
import de.bogenliga.application.common.component.entity.BusinessEntity;
/**
* I represent the user sign in history business entity.
* <p>
* The sign in history documents each sign in attempt of an user.
*
* @author Andre Lehnert, BettercallPaul gmbh
*/
public class UserSignInHistoryBE implements BusinessEntity {
private static final long serialVersionUID = -3350215655826737938L;
private long signInUserId;
private SignInResult signInResult;
private Timestamp signInAtUtc;
/**
* Constructor
*/
public UserSignInHistoryBE() {
// empty constructor
}
@Override
public String toString() {
return "UserBE{" +
"signInUserId=" + signInUserId +
", signInResult='" + signInResult + '\'' +
", signInAtUtc='" + signInAtUtc + '\'' +
'}';
}
public long getSignInUserId() {
return signInUserId;
}
public void setSignInUserId(final long signInUserId) {
this.signInUserId = signInUserId;
}
public SignInResult getSignInResult() {
return signInResult;
}
public void setSignInResult(final SignInResult signInResult) {
this.signInResult = signInResult;
}
public Timestamp getSignInAtUtc() {
return signInAtUtc;
}
public void setSignInAtUtc(final Timestamp signInAtUtc) {
this.signInAtUtc = signInAtUtc;
}
}
| 22.857143 | 71 | 0.65875 |
6b7bf1b8b0bb5f9f2e90fffdec7ef57abfd3d3a0 | 2,274 | /*
* 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.tuscany.sca.itest;
import static org.junit.Assert.assertEquals;
import java.net.URI;
import org.apache.tuscany.sca.Node;
import org.apache.tuscany.sca.TuscanyRuntime;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.oasisopen.sca.NoSuchServiceException;
public class Test1DistributedSyncServiceTestCase {
private static final URI DOMAIN = URI.create("uri:Test1DistributedTestCase?bind=127.0.0.1:8765");
protected static Node clientNode, serviceNode;
@BeforeClass
public static void setUp() throws Exception {
serviceNode = TuscanyRuntime.runComposite(DOMAIN, "test1SyncService.composite", "target/classes");
clientNode = TuscanyRuntime.runComposite(DOMAIN, "test1Client.composite", "target/classes");
}
@AfterClass
public static void tearDown() throws Exception {
if (clientNode != null) clientNode.stop();
if (serviceNode != null) serviceNode.stop();
}
@Test
public void testReference() throws NoSuchServiceException {
Service1 test = clientNode.getService(Service1.class, "Client");
assertEquals("Service1NonAsyncServerImpl.operation1 foo" +
"Service1NonAsyncServerImpl.operation1 fooTypeOne" +
"Service1NonAsyncServerImpl.operation1 fooTypeTwo",
test.operation1("foo"));
}
}
| 38.542373 | 107 | 0.709323 |
0feedb6458a7e782165fc2686568c41d9830e653 | 946 | package io.vertx.tp.optic;
import io.vertx.tp.ke.init.KePin;
import io.vertx.tp.optic.atom.Income;
import io.vertx.tp.optic.atom.Lexeme;
import java.util.Objects;
/*
* T seeking in the environment of kernel.
*/
public class Pocket {
/*
* Lookup interface
*/
public static <T> T lookup(final Class<T> clazz) {
/*
* Get lexeme reference here.
*/
final Lexeme<T> lexeme = KePin.get(clazz);
if (Objects.isNull(lexeme)) {
/*
* Null pointer
*/
return null;
} else {
/*
* Implementation pointer
*/
return lexeme.instance();
}
}
public static <T> Income income(final Class<T> clazz, final Object... args) {
final Income income = Income.in(clazz);
for (final Object arg : args) {
income.in(arg);
}
return income;
}
}
| 22.52381 | 81 | 0.526427 |
7fa2a760e5eb5e073ce9f6495871db3d4f4a0bfb | 17,019 | /*
* Copyright (c) 2009, GoodData Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the distribution.
* * Neither the name of the GoodData Corporation 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 com.gooddata.processor;
import com.gooddata.Constants;
import com.gooddata.exception.*;
import com.gooddata.integration.model.Project;
import com.gooddata.integration.rest.GdcRESTApiWrapper;
import com.gooddata.integration.rest.configuration.NamePasswordConfiguration;
import com.gooddata.util.CSVReader;
import com.gooddata.util.CSVWriter;
import com.gooddata.util.FileUtil;
import com.gooddata.util.StringUtil;
import org.apache.commons.cli.*;
import org.apache.log4j.Logger;
import java.io.*;
import java.util.*;
/**
* Utility that creates a new Zendesk V3 project for every V1 Zendesk project.
* The utility copies all users from the old V1 project to the new V3 project.
* It needs to be executed under the [email protected], as adding users to projects is only allowed to the admin of the
* domain where the user has been created. We assume that all Zendesk users are in the default GoodData domain.
*
* @author Zdenek Svoboda <[email protected]>
* @version 1.0
*/
public class CreateZendeskV3Projects {
private static Logger l = Logger.getLogger(CreateZendeskV3Projects.class);
private boolean finishedSucessfuly = false;
//Options data
public static String[] CLI_PARAM_HELP = {"help", "h"};
public static String[] CLI_PARAM_USERNAME = {"username", "u"};
public static String[] CLI_PARAM_PASSWORD = {"password", "p"};
public static String[] CLI_PARAM_HOST = {"host", "h"};
public static String[] CLI_PARAM_TEMPLATE = {"template", "t"};
public static String[] CLI_PARAM_VERSION = {"version", "v"};
public static String[] CLI_PARAM_LIST = {"input", "i"};
public static String[] CLI_PARAM_OUTPUT = {"output", "o"};
public static String[] CLI_PARAM_TOKEN = {"token", "a"};
// Command line options
private static Options ops = new Options();
public static Option[] mandatoryOptions = {
new Option(CLI_PARAM_USERNAME[1], CLI_PARAM_USERNAME[0], true, "GoodData username"),
new Option(CLI_PARAM_PASSWORD[1], CLI_PARAM_PASSWORD[0], true, "GoodData password"),
new Option(CLI_PARAM_LIST[1], CLI_PARAM_LIST[0], true, "List of the V1 projects that needs to be converted (single column CSV with the V1 project hash)"),
new Option(CLI_PARAM_OUTPUT[1], CLI_PARAM_OUTPUT[0], true, "List that associates the old V1 project and the new V3 project (two columns: [old hash,new hash])."),
new Option(CLI_PARAM_TEMPLATE[1], CLI_PARAM_TEMPLATE[0], true, "The template to create the new V3 projects from")
};
public static Option[] optionalOptions = {
new Option(CLI_PARAM_HOST[1], CLI_PARAM_HOST[0], true, "GoodData host (default secure.gooddata.com)"),
new Option(CLI_PARAM_TOKEN[1], CLI_PARAM_TOKEN[0], true, "Create project access token.")
};
public static Option[] helpOptions = {
new Option(CLI_PARAM_HELP[1], CLI_PARAM_HELP[0], false, "Print command reference"),
new Option(CLI_PARAM_VERSION[1], CLI_PARAM_VERSION[0], false, "Prints the tool version.")
};
private CliParams cliParams = null;
private ProcessingContext ctx = new ProcessingContext();
public CreateZendeskV3Projects(CommandLine ln) {
try {
cliParams = parse(ln);
String username = cliParams.get(CLI_PARAM_USERNAME[0]);
String password = cliParams.get(CLI_PARAM_PASSWORD[0]);
String input = cliParams.get(CLI_PARAM_LIST[0]);
String output = cliParams.get(CLI_PARAM_OUTPUT[0]);
String template = cliParams.get(CLI_PARAM_TEMPLATE[0]);
String host = cliParams.get(CLI_PARAM_HOST[0]);
String token = cliParams.get(CLI_PARAM_TOKEN[0]);
NamePasswordConfiguration config = new NamePasswordConfiguration("https", host, username, password);
cliParams.setHttpConfig(config);
CSVReader reader = FileUtil.createUtf8CsvReader(new File(input));
CSVWriter writer = FileUtil.createUtf8CsvWriter(new File(output));
CSVWriter tool = FileUtil.createUtf8CsvWriter(new File(output+".tool"));
tool.writeNext(new String[] {"login","project","role","project-state","user-state"});
int rowCnt = 1;
String[] row = reader.readNext();
while(row != null && row.length > 0) {
if(row.length > 1) {
throw new InvalidArgumentException("The row "+rowCnt+" of the '"+input+"' contains more than one column!");
}
String oldProjectHash = row[0];
String newProjectHash = "ERROR: Failed to access the corresponding V1 project.";
try {
newProjectHash = processProject(oldProjectHash, template, token, tool);
}
catch (GdcProjectAccessException e) {
l.info("The project "+oldProjectHash+" either doesn't exist, is disabled, or can't be accessed by the user that invoked this tool.");
}
writer.writeNext(new String[] {oldProjectHash,newProjectHash});
writer.flush();
tool.flush();
row = reader.readNext();
rowCnt++;
}
writer.close();
tool.close();
reader.close();
finishedSucessfuly = true;
} catch (InterruptedException e) {
l.error("Interrupted during project creation." + e.getMessage());
l.debug(e);
Throwable c = e.getCause();
while (c != null) {
l.debug("Caused by: ", c);
c = c.getCause();
}
finishedSucessfuly = false;
} catch (IOException e) {
l.error("Encountered an IO problem. Please check that all files that you use in your command line arguments and commands exist." + e.getMessage());
l.debug(e);
Throwable c = e.getCause();
while (c != null) {
l.debug("Caused by: ", c);
c = c.getCause();
}
finishedSucessfuly = false;
}
catch (HttpMethodException e) {
l.debug("Error executing GoodData REST API: " + e);
Throwable c = e.getCause();
while (c != null) {
l.debug("Caused by: ", c);
c = c.getCause();
}
String msg = e.getMessage();
String requestId = e.getRequestId();
if (requestId != null) {
msg += "\n\n" +
"If you believe this is not your fault, good people from support\n" +
"portal (http://support.gooddata.com) may help you.\n\n" +
"Show them this error ID: " + requestId;
}
l.error(msg);
finishedSucessfuly = false;
} catch (GdcRestApiException e) {
l.error("REST API invocation error: " + e.getMessage());
l.debug(e, e);
Throwable c = e.getCause();
while (c != null) {
if (c instanceof HttpMethodException) {
HttpMethodException ex = (HttpMethodException) c;
String msg = ex.getMessage();
if (msg != null && msg.length() > 0 && msg.indexOf("/ldm/manage") > 0) {
l.error("Error creating/updating logical data model (executing MAQL DDL).");
if (msg.indexOf(".date") > 0) {
l.error("Bad time dimension schemaReference.");
} else {
l.error("You are either trying to create a data object that already exists " +
"(executing the same MAQL multiple times) or providing a wrong reference " +
"or schemaReference in your XML configuration.");
}
}
}
l.debug("Caused by: ", c);
c = c.getCause();
}
finishedSucessfuly = false;
} catch (GdcException e) {
l.error("Unrecognized error: " + e.getMessage());
l.debug(e);
Throwable c = e.getCause();
while (c != null) {
l.debug("Caused by: ", c);
c = c.getCause();
}
finishedSucessfuly = false;
} finally {
/*
if (cliParams != null)
context.getRestApi(cliParams).logout();
*/
}
}
/**
* Creates a new V3 projects from the template identified by the templateUri for the V1 project that is passed in
* the oldProjectHash parameter
* Copies all users from the V1 to the V3 project with appropriate roles
* @param oldProjectHash the old V1 project hash
* @param templateUri the new V3 project template URI
* @param token project creation token (redirects the new projects to the correct DWH server)
* @return the new V3 project hash
*/
private String processProject(String oldProjectHash, String templateUri, String token, CSVWriter tool) throws InterruptedException {
Project project = ctx.getRestApi(cliParams).getProjectById(oldProjectHash);
Map<String,GdcRESTApiWrapper.GdcUser> activeUsers = new HashMap<String,GdcRESTApiWrapper.GdcUser>();
l.info("Getting users from project " + oldProjectHash);
List<GdcRESTApiWrapper.GdcUser> users = ctx.getRestApi(cliParams).getProjectUsers(oldProjectHash, true);
for(GdcRESTApiWrapper.GdcUser user : users) {
activeUsers.put(user.getUri(), user);
}
l.info(users.size() + " users retrieved from project " + oldProjectHash);
l.info("Getting roles from project " + oldProjectHash);
List<GdcRESTApiWrapper.GdcRole> roles = ctx.getRestApi(cliParams).getProjectRoles(oldProjectHash);
l.info(roles.size() + " roles retrieved from project " + oldProjectHash);
String newName = project.getName()+" (new)";
String newProjectHash = ctx.getRestApi(cliParams).createProject(StringUtil.toTitle(newName), StringUtil.toTitle(newName), templateUri, "Pg", token);
checkProjectCreationStatus(newProjectHash, cliParams, ctx);
l.info("New V3 project created: " + newProjectHash);
for(GdcRESTApiWrapper.GdcRole role : roles) {
l.info("Getting users from role " + role.getIdentifier());
List<String> userUris = ctx.getRestApi(cliParams).getRoleUsers(role, true);
l.info(userUris.size() + " users retrieved from role " + role.getIdentifier());
for(String userUri : userUris) {
GdcRESTApiWrapper.GdcUser user = activeUsers.get(userUri);
if(user != null) {
l.info("Adding user "+user.getLogin()+" to the new V3 project " + newProjectHash+ " with role "+role.getIdentifier());
tool.writeNext(new String[] {user.getLogin(),newProjectHash,role.getIdentifier(),"ENABLED","ENABLED"});
}
else {
l.info("Detected suspended user " + userUri);
}
}
}
return newProjectHash;
}
/**
* Parse and validate the cli arguments
*
* @param ln parsed command line
* @return parsed cli parameters wrapped in the CliParams
* @throws com.gooddata.exception.InvalidArgumentException in case of nonexistent or incorrect cli args
*/
protected CliParams parse(CommandLine ln) throws InvalidArgumentException {
l.debug("Parsing cli " + ln);
CliParams cp = new CliParams();
if (cp.containsKey(CLI_PARAM_VERSION[0])) {
l.info("GoodData CL version 1.3.0");
System.exit(0);
}
if (ln.hasOption(CLI_PARAM_HELP[1])) {
printHelp();
}
for (Option o : mandatoryOptions) {
String name = o.getLongOpt();
if (ln.hasOption(name))
cp.put(name, ln.getOptionValue(name));
else {
l.info("Please specify the mandatory option "+name+"("+o.getOpt()+")");
printHelp();
System.exit(0);
}
}
for (Option o : optionalOptions) {
String name = o.getLongOpt();
if (ln.hasOption(name))
cp.put(name, ln.getOptionValue(name));
}
// use default host if there is no host in the CLI params
if (!cp.containsKey(CLI_PARAM_HOST[0])) {
cp.put(CLI_PARAM_HOST[0], Defaults.DEFAULT_HOST);
}
l.debug("Using host " + cp.get(CLI_PARAM_HOST[0]));
return cp;
}
private void printHelp() {
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp("createZendeskProjects [<options> ...]", ops);
}
private static boolean checkJavaVersion() {
String version = System.getProperty("java.version");
if (version.startsWith("1.8") || version.startsWith("1.7") || version.startsWith("1.6") || version.startsWith("1.5"))
return true;
l.error("You're running Java " + version + ". Please use Java 1.5 or higher for running this tool. " +
"Please refer to http://java.sun.com/javase/downloads/index.jsp for a more recent Java version.");
throw new InternalErrorException("You're running Java " + version + ". Please use use Java 1.5 or higher for running this tool. " +
"Please refer to http://java.sun.com/javase/downloads/index.jsp for a more recent Java version.");
}
/**
* The main CLI processor
*
* @param args command line argument
*/
public static void main(String[] args) {
checkJavaVersion();
for (Option o : mandatoryOptions)
ops.addOption(o);
for (Option o : optionalOptions)
ops.addOption(o);
for (Option o : helpOptions)
ops.addOption(o);
try {
CommandLineParser parser = new GnuParser();
CommandLine cmdline = parser.parse(ops, args);
CreateZendeskV3Projects gdi = new CreateZendeskV3Projects(cmdline);
if (!gdi.finishedSucessfuly) {
System.exit(1);
}
} catch (org.apache.commons.cli.ParseException e) {
l.error("Error parsing command line parameters: ", e);
l.debug("Error parsing command line parameters", e);
}
}
/**
* Checks the project status. Waits till the status is ENABLED or DELETED
*
* @param projectId project ID
* @param p cli parameters
* @param ctx current context
* @throws InterruptedException internal problem with making file writable
*/
private void checkProjectCreationStatus(String projectId, CliParams p, ProcessingContext ctx) throws InterruptedException {
l.debug("Checking project " + projectId + " loading status.");
String status = null;
do {
status = ctx.getRestApi(p).getProjectStatus(projectId);
l.debug("Project " + projectId + " loading status = " + status);
Thread.sleep(Constants.POLL_INTERVAL);
} while (!("DELETED".equalsIgnoreCase(status) || "ENABLED".equalsIgnoreCase(status)));
}
}
| 46.247283 | 173 | 0.611728 |
a94cb249a733af9bfca36a93275ee60ed1f21b26 | 1,582 | public class Area {
private Point2D upLeftCorner;
private double width;
private double height;
public Area(Point2D upLeftCorner, double width, double height) {
this.upLeftCorner = upLeftCorner;
this.width = width;
this.height = height;
}
public Point2D getUpLeftCorner() {
return upLeftCorner;
}
public void setUpLeftCorner(Point2D upLeftCorner) {
this.upLeftCorner = upLeftCorner;
}
public double getWidth() {
return width;
}
public void setWidth(double width) {
this.width = width;
}
public double getHeight() {
return height;
}
public void setHeight(double height) {
this.height = height;
}
public boolean hasInside(Point2D point) {
if (point.getX() >= this.upLeftCorner.getX() &&
point.getX() <= (this.upLeftCorner.getX() + this.width) &&
point.getY() >= this.upLeftCorner.getY() &&
point.getY() <= (this.upLeftCorner.getY() + this.height)) {
return true;
}
return false;
}
public boolean intersects(Area other) {
if (this.upLeftCorner.getX() <= (other.upLeftCorner.getX() + other.width) &&
(this.upLeftCorner.getX() + this.width) >= other.upLeftCorner.getX() &&
this.upLeftCorner.getY() <= (other.upLeftCorner.getY() + other.height) &&
(this.upLeftCorner.getY() + this.height) >= other.upLeftCorner.getY()) {
return true;
}
return false;
}
}
| 27.275862 | 89 | 0.575853 |
3d2bfdf852688e08eb735f94eedf55c80f70913a | 4,151 | package it.unimi.di.wikipedia.categories;
import it.unimi.dsi.fastutil.ints.IntArrayFIFOQueue;
import it.unimi.dsi.fastutil.ints.IntArrayPriorityQueue;
import it.unimi.dsi.fastutil.ints.IntPriorityQueue;
import it.unimi.dsi.fastutil.ints.IntSet;
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
import it.unimi.dsi.fastutil.objects.ObjectSet;
import it.unimi.dsi.logging.ProgressLogger;
import it.unimi.dsi.webgraph.ImmutableGraph;
import it.unimi.dsi.webgraph.LazyIntIterator;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HittingDistanceMinimizer {
public static final Logger LOGGER = LoggerFactory.getLogger(HittingDistanceMinimizer.class);
final ImmutableGraph transposed;
final int[] minMilestoneDistance;
final int[] closestMilestone;
final IntSet milestones;
final ObjectSet<Visitor> runningVisitors;
final IntPriorityQueue milestoneQueue;
final ProgressLogger pl;
public HittingDistanceMinimizer(ImmutableGraph transposedGraph, IntSet milestones) {
this.transposed = transposedGraph;
this.milestones = milestones;
minMilestoneDistance = new int[transposedGraph.numNodes()];
Arrays.fill(minMilestoneDistance, Integer.MAX_VALUE);
closestMilestone = new int[transposedGraph.numNodes()];
Arrays.fill(closestMilestone, -1);
milestoneQueue = new IntArrayPriorityQueue(milestones.toIntArray());
runningVisitors = new ObjectOpenHashSet<Visitor>();
pl = new ProgressLogger(LOGGER, "milestones");
pl.expectedUpdates = milestones.size();
}
private class Visitor extends Thread {
final int start;
final int[] dists;
final ImmutableGraph graph;
Visitor(final ImmutableGraph graph, int startingNode) {
this.start = startingNode;
dists = new int[ graph.numNodes() ];
this.graph = graph.copy();
}
@Override
public void run() {
final IntArrayFIFOQueue queue = new IntArrayFIFOQueue();
Arrays.fill( dists, Integer.MAX_VALUE ); // Initially, all distances are infinity.
int curr, succ;
queue.enqueue( start );
dists[ start ] = 0;
LazyIntIterator successors;
while( ! queue.isEmpty() ) {
curr = queue.dequeueInt();
successors = graph.successors( curr );
int d = graph.outdegree( curr );
while( d-- != 0 ) {
succ = successors.nextInt();
if ( dists[ succ ] == Integer.MAX_VALUE ) {
dists[ succ ] = dists[ curr ] + 1;
queue.enqueue( succ );
}
}
}
startNewThreadAfter(this);
}
@Override
public int hashCode() { return start; }
@Override
public boolean equals(Object o) {
return (((o instanceof Visitor)) && ((Visitor) o).start == this.start);
}
}
private synchronized void startNewThreadAfter(Visitor thread) {
if (thread != null) {
if (!runningVisitors.remove(thread)) {
throw new IllegalStateException(
"Thread " + thread + " signaled completion but was not present.");
}
updateClosestMilestonesAfter(thread.start, thread.dists);
pl.update();
}
if (!milestoneQueue.isEmpty()) {
int milestone = milestoneQueue.dequeueInt();
Visitor visitor = new Visitor(transposed, milestone);
runningVisitors.add(visitor);
visitor.start();
} else
if (runningVisitors.isEmpty()) {
synchronized (this) {
this.notifyAll();
}
}
}
private void updateClosestMilestonesAfter(int milestone, int[] distances) {
final int numNodes = transposed.numNodes();
for (int node = 0; node < numNodes; node++) {
if (distances[node] < minMilestoneDistance[node] && node != milestone) {
minMilestoneDistance[node] = distances[node];
closestMilestone[node] = milestone;
}
}
}
public int[] compute() {
return compute(Runtime.getRuntime().availableProcessors());
}
public int[] compute(int nOfThreads) {
pl.start("Starting a BFS for each milestone (with " + nOfThreads + " parallel threads)...");
for (int i = 0; i < nOfThreads; i++) {
startNewThreadAfter(null);
}
try {
synchronized (this) {
while (!milestoneQueue.isEmpty())
this.wait();
}
} catch (InterruptedException e) { throw new RuntimeException(e); }
pl.done();
return closestMilestone;
}
}
| 27.490066 | 94 | 0.71019 |
96753a21e9acb76deff12945325c173be72b510c | 285 | package com.fakecompany.personmonolith.exception;
public class DataNotFoundException extends GeneralRuntimeException{
private static final long serialVersionUID = 1L;
public DataNotFoundException(String message){
super(DataNotFoundException.class,message);
}
}
| 23.75 | 67 | 0.785965 |
271a011c18d5852c102ac96b7756efa4b929610c | 4,152 | package com.zb.study.extend;
import org.springframework.beans.BeansException;
import org.springframework.beans.PropertyValues;
import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor;
import org.springframework.stereotype.Component;
import java.beans.PropertyDescriptor;
/**
* @description: InstantiationAwareBeanPostProcessor扩展点
* Bean的后置处理器
* 调用时间:实例化bean之前
* @author: zhangbing
* @create: 2020-11-18 15:43
**/
@Component
public class TestInstantiationAwareBeanPostProcessor implements InstantiationAwareBeanPostProcessor {
/**
* 实例化之前调用
*
* @param beanClass the class of the bean to be instantiated
* @param beanName the name of the bean
* @return
* @throws BeansException
*/
@Override
public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException {
if (beanClass == A.class) {
System.out.println("postProcessBeforeInstantiation:在实例化A之前调用,返回一个B的实例");
//若在此处返回一个对象 spring会认为你已经进行初始化过了 不会在调用postProcessAfterInstantiation 直接调用postProcessAfterInitialization
return new B();
}
/**
* 可以拿到 Class对象和beanName
* 如果在这一步 自己通过反射 返回对应的实例 那么spring就不在走后面实例化bean的逻辑了
*
* AOP的切面的解析和通知的解析都是通过AnnotationAwareAspectJAutoProxyCreator 实现了InstantiationAwareBeanPostProcessor
* 在这个方法中执行的 解析成切面类和通知类
*
*/
return null;
}
/**
* 实例化之后调用
*
* @param bean the bean instance created, with properties not having been set yet
* @param beanName the name of the bean
* @return
* @throws BeansException
*/
@Override
public boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException {
/**
* 正常情况下 spring容器在实例化之后 会调用此方法
*/
if (bean instanceof CustomerClass) {
System.out.println("postProcessAfterInstantiation:实例化CustomerClass 之后调用,设置bean的name参数为 123");
((CustomerClass) bean).setName("123");
}
return false;
}
/**
* 属性赋值时调用
*
* @param pvs the property values that the factory is about to apply (never {@code null})
* @param bean the bean instance created, but whose properties have not yet been set
* @param beanName the name of the bean
* @return
* @throws BeansException
*/
@Override
public PropertyValues postProcessProperties(PropertyValues pvs, Object bean, String beanName) throws BeansException {
/**
* @Autowired,@Resource等注解原理基于此方法实现
*/
return null;
}
/**
* 属性赋值时 调用 但是目前这个方法已被spring 弃用了
*
* @param pvs the property values that the factory is about to apply (never {@code null})
* @param pds the relevant property descriptors for the target bean (with ignored
* dependency types - which the factory handles specifically - already filtered out)
* @param bean the bean instance created, but whose properties have not yet been set
* @param beanName the name of the bean
* @return
* @throws BeansException
*/
@Override
public PropertyValues postProcessPropertyValues(PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName) throws BeansException {
return null;
}
/**
* BeanPostProcessor的方法 初始化之前调用
*
* @param bean the new bean instance
* @param beanName the name of the bean
* @return
* @throws BeansException
*/
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
if (bean instanceof CustomerClass) {
System.out.println("postProcessBeforeInitialization:CustomerClass对象初始化之前被调用:postProcessBeforeInitialization");
}
return null;
}
/**
* BeanPostProcessor的方法 初始化之后调用
*
* @param bean the new bean instance
* @param beanName the name of the bean
* @return
* @throws BeansException
*/
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
if (bean instanceof A) {
System.out.println("postProcessAfterInitialization:A对象是自己实例化的,spring直接调用初始化之后的方法,在此处设置name参数");
((A) bean).setName("当前A实例是被B代理的");
} else if (bean instanceof CustomerClass) {
System.out.println("postProcessAfterInitialization:CustomerClass对象初始化之后被调用:postProcessAfterInitialization");
}
return null;
}
}
| 29.446809 | 148 | 0.745183 |
882d9fef6203c7afc476449d99ee9d564bb100d9 | 1,479 | /*
* Copyright 2014 MIR@MU.
*
* 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 cz.muni.fi.mir.services;
import java.util.List;
import java.util.concurrent.Future;
import cz.muni.fi.mir.scheduling.ApplicationTask;
import cz.muni.fi.mir.scheduling.TaskStatus;
/**
* Non-persistent service for getting information about long-running tasks
* like mass import or application runs.
*
* TODO: remove finished tasks automatically?
*/
public interface TaskService {
/**
* Submit the task to asynchronous task executor and save
* it along with it's Future result.
* @param task
* @return Future reference to task result
*/
public abstract Future<TaskStatus> submitTask(ApplicationTask task);
/**
* Get statuses of all registered tasks.
* @return
*/
public abstract List<TaskStatus> getTasks();
/**
* Remove all finished (or cancelled) tasks.
*/
public void removeFinishedTasks();
}
| 29 | 75 | 0.709939 |
867f93da73c66a2082a303d68615318f8b22ae81 | 8,649 | /*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package apple.laf;
import apple.laf.JRSUIConstants.*;
@SuppressWarnings("unchecked")
public class JRSUIState {
// static HashSet<JRSUIState> states = new HashSet<JRSUIState>();
final long encodedState;
long derivedEncodedState;
static JRSUIState prototype = new JRSUIState(0);
public static JRSUIState getInstance() {
return prototype.derive();
}
JRSUIState(final Widget widget) {
this(widget.apply(0));
}
JRSUIState(final long encodedState) {
this.encodedState = derivedEncodedState = encodedState;
}
boolean isDerivationSame() {
return encodedState == derivedEncodedState;
}
public <T extends JRSUIState> T derive() {
if (isDerivationSame()) return (T)this;
final T derivation = (T)createDerivation();
// if (!states.add(derivation)) {
// System.out.println("dupe: " + states.size());
// }
return derivation;
}
public <T extends JRSUIState> T createDerivation() {
return (T)new JRSUIState(derivedEncodedState);
}
public void reset() {
derivedEncodedState = encodedState;
}
public void set(final Property property) {
derivedEncodedState = property.apply(derivedEncodedState);
}
public void apply(final JRSUIControl control) {
control.setEncodedState(encodedState);
}
@Override
public boolean equals(final Object obj) {
if (!(obj instanceof JRSUIState)) return false;
return encodedState == ((JRSUIState)obj).encodedState && getClass().equals(obj.getClass());
}
public boolean is(Property property) {
return (byte)((derivedEncodedState & property.encoding.mask) >> property.encoding.shift) == property.ordinal;
}
@Override
public int hashCode() {
return (int)(encodedState ^ (encodedState >>> 32)) ^ getClass().hashCode();
}
public static class AnimationFrameState extends JRSUIState {
final int animationFrame;
int derivedAnimationFrame;
AnimationFrameState(final long encodedState, final int animationFrame) {
super(encodedState);
this.animationFrame = derivedAnimationFrame = animationFrame;
}
@Override
boolean isDerivationSame() {
return super.isDerivationSame() && (animationFrame == derivedAnimationFrame);
}
@Override
public <T extends JRSUIState> T createDerivation() {
return (T)new AnimationFrameState(derivedEncodedState, derivedAnimationFrame);
}
@Override
public void reset() {
super.reset();
derivedAnimationFrame = animationFrame;
}
public void setAnimationFrame(final int frame) {
this.derivedAnimationFrame = frame;
}
@Override
public void apply(final JRSUIControl control) {
super.apply(control);
control.set(Key.ANIMATION_FRAME, animationFrame);
}
@Override
public boolean equals(final Object obj) {
if (!(obj instanceof AnimationFrameState)) return false;
return animationFrame == ((AnimationFrameState)obj).animationFrame && super.equals(obj);
}
@Override
public int hashCode() {
return super.hashCode() ^ animationFrame;
}
}
public static class ValueState extends JRSUIState {
final double value;
double derivedValue;
ValueState(final long encodedState, final double value) {
super(encodedState);
this.value = derivedValue = value;
}
@Override
boolean isDerivationSame() {
return super.isDerivationSame() && (value == derivedValue);
}
@Override
public <T extends JRSUIState> T createDerivation() {
return (T)new ValueState(derivedEncodedState, derivedValue);
}
@Override
public void reset() {
super.reset();
derivedValue = value;
}
public void setValue(final double value) {
derivedValue = value;
}
@Override
public void apply(final JRSUIControl control) {
super.apply(control);
control.set(Key.VALUE, value);
}
@Override
public boolean equals(final Object obj) {
if (!(obj instanceof ValueState)) return false;
return value == ((ValueState)obj).value && super.equals(obj);
}
@Override
public int hashCode() {
final long bits = Double.doubleToRawLongBits(value);
return super.hashCode() ^ (int)bits ^ (int)(bits >>> 32);
}
}
public static class TitleBarHeightState extends ValueState {
TitleBarHeightState(final long encodedState, final double value) {
super(encodedState, value);
}
@Override
public <T extends JRSUIState> T createDerivation() {
return (T)new TitleBarHeightState(derivedEncodedState, derivedValue);
}
@Override
public void apply(final JRSUIControl control) {
super.apply(control);
control.set(Key.WINDOW_TITLE_BAR_HEIGHT, value);
}
}
public static class ScrollBarState extends ValueState {
final double thumbProportion;
double derivedThumbProportion;
final double thumbStart;
double derivedThumbStart;
ScrollBarState(final long encodedState, final double value, final double thumbProportion, final double thumbStart) {
super(encodedState, value);
this.thumbProportion = derivedThumbProportion = thumbProportion;
this.thumbStart = derivedThumbStart = thumbStart;
}
@Override
boolean isDerivationSame() {
return super.isDerivationSame() && (thumbProportion == derivedThumbProportion) && (thumbStart == derivedThumbStart);
}
@Override
public <T extends JRSUIState> T createDerivation() {
return (T)new ScrollBarState(derivedEncodedState, derivedValue, derivedThumbProportion, derivedThumbStart);
}
@Override
public void reset() {
super.reset();
derivedThumbProportion = thumbProportion;
derivedThumbStart = thumbStart;
}
public void setThumbPercent(final double thumbPercent) {
derivedThumbProportion = thumbPercent;
}
public void setThumbStart(final double thumbStart) {
derivedThumbStart = thumbStart;
}
@Override
public void apply(final JRSUIControl control) {
super.apply(control);
control.set(Key.THUMB_PROPORTION, thumbProportion);
control.set(Key.THUMB_START, thumbStart);
}
@Override
public boolean equals(final Object obj) {
if (!(obj instanceof ScrollBarState)) return false;
return (thumbProportion == ((ScrollBarState)obj).thumbProportion) && (thumbStart == ((ScrollBarState)obj).thumbStart) && super.equals(obj);
}
@Override
public int hashCode() {
final long bits = Double.doubleToRawLongBits(thumbProportion) ^ Double.doubleToRawLongBits(thumbStart);
return super.hashCode() ^ (int)bits ^ (int)(bits >>> 32);
}
}
}
| 32.637736 | 151 | 0.636259 |
67488be651ec8c6ef73de3b63850c46e229450d3 | 2,117 | /*
This file is part of BORG.
BORG is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
BORG 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 BORG; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Copyright 2008 by Mike Berger
*/
package net.sf.borg.ui.util;
import java.awt.GridBagConstraints;
import java.awt.Insets;
/**
* A factory for creating GridBagConstraints objects in a standard way. Saves lots
* of LOC.
*/
public class GridBagConstraintsFactory {
static private final Insets defaultInsets = new Insets(4, 4, 4, 4);
/**
* Creates GridBagConstraints
*
* @param x the x
* @param y the y
*
* @return the grid bag constraints
*/
public static GridBagConstraints create(int x, int y) {
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = x;
gbc.gridy = y;
gbc.insets = defaultInsets;
return gbc;
}
/**
* Creates GridBagConstraints
*
* @param x the x
* @param y the y
* @param fill the fill
*
* @return the grid bag constraints
*/
public static GridBagConstraints create(int x, int y, int fill) {
GridBagConstraints gbc = create(x, y);
gbc.fill = fill;
return gbc;
}
/**
* Creates GridBagConstraints
*
* @param x the x
* @param y the y
* @param fill the fill
* @param weightx the weightx
* @param weighty the weighty
*
* @return the grid bag constraints
*/
public static GridBagConstraints create(int x, int y, int fill,
double weightx, double weighty) {
GridBagConstraints gbc = create(x, y, fill);
gbc.weightx = weightx;
gbc.weighty = weighty;
return gbc;
}
}
| 25.202381 | 82 | 0.695324 |
06b8e1d88219444b470c6547c55162a8b81bcdff | 463 | package com.taobao.arthas.core.security;
import java.security.Principal;
/**
* 本地连接的特殊处理 {@link Principal}.
*
* @author hengyunabc 2021-09-01
*/
public final class LocalConnectionPrincipal implements Principal {
public LocalConnectionPrincipal() {
}
@Override
public String getName() {
return null;
}
public String getUsername() {
return null;
}
public String getPassword() {
return null;
}
} | 17.148148 | 66 | 0.645788 |
ced7ceea5ad78d3f2a97a9e7afd5d93bed45b115 | 679 | package jdk.nashorn.internal.scripts;
import jdk.nashorn.internal.runtime.PropertyMap;
import jdk.nashorn.internal.runtime.ScriptObject;
public class JD extends ScriptObject {
private static final PropertyMap map$ = PropertyMap.newMap(JD.class);
public static PropertyMap getInitialMap() {
return map$;
}
public JD(PropertyMap map) {
super(map);
}
public JD(ScriptObject proto) {
super(proto, getInitialMap());
}
public JD(PropertyMap map, long[] primitiveSpill, Object[] objectSpill) {
super(map, primitiveSpill, objectSpill);
}
public static ScriptObject allocate(PropertyMap map) {
return new JD(map);
}
}
| 23.413793 | 76 | 0.703976 |
a68ca7810cc14489de888a406818a94e7731ceb8 | 93 | package com.swak.paxos.common;
/**
* 节点ID
*
* @author DELL
*/
public class NodeId {
}
| 8.454545 | 30 | 0.602151 |
0a1c50f357677c8b539c09cd0245ac4c37d2c3c9 | 518 | package com.simple.creact.library.framework.datasource;
import com.simple.creact.library.framework.Closeable;
import com.simple.creact.library.framework.IParameter;
import com.simple.creact.library.framework.ParameterFactory;
/**
* R-DataFetcher从DB/network/File System 获得的原始数据类型
* P-Parameter Type
*
* @author:YJJ
* @date:2016/3/9
* @email:[email protected]
*/
public interface DataFetcher<R> extends Closeable, ParameterFactory {
R fetchData(IParameter extra, String... values) throws Exception;
}
| 25.9 | 69 | 0.777992 |
ae34cd0ddf88627b4d2dee115d66494e8791d6bb | 1,694 | /*
*
* Copyright 2020. Explore in HMS. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.genar.hmssandbox.huawei.pushkit;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import androidx.appcompat.app.AppCompatActivity;
import com.genar.hmssandbox.huawei.R;
public class NotificationTargetActivityPushKit extends AppCompatActivity {
/**
* to back to main activity
*/
private Button btnBack;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_notification_route_pushkit);
initUI();
initListener();
}
/**
* Initialize UI Elements
*/
private void initUI(){
btnBack = findViewById(R.id.btn_back_push_route_act);
}
/**
* Initialize Listeners of UI Elements
*/
private void initListener(){
btnBack.setOnClickListener(v -> {
Intent intent = new Intent(NotificationTargetActivityPushKit.this, MainActivityPushKit.class);
startActivity(intent);
});
}
}
| 26.888889 | 106 | 0.691263 |
9229e63a9ba8f4f559657b750fe1c05db2bd4e3e | 299 | package testFLProject;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
public class IfstatementTest2 {
@Test public void test3_4() {
Ifstatement ifTest = new Ifstatement();
assertThat(ifTest.plus(3), is(4));
}
} | 21.357143 | 47 | 0.675585 |
533353fb229255394656f49aa5d50a183353b362 | 162 | package com.testsigma.automator.webservices;
public enum JSONCompareMode {
STRICT,
LENIENT,
NON_EXTENSIBLE,
STRICT_ORDER,
JSON_PATH,
JSON_SCHEMA
}
| 12.461538 | 44 | 0.759259 |
e14c2cf7944d152500b2994366114bc060de6d1e | 3,071 | package com.bestvike.linq.enumerable;
import com.bestvike.function.Func1;
import com.bestvike.function.Predicate1;
import com.bestvike.linq.IEnumerable;
import com.bestvike.linq.exception.ExceptionArgument;
import com.bestvike.linq.exception.ThrowHelper;
/**
* Created by 许崇雷 on 2019-07-26.
*/
public final class Loop {
private Loop() {
}
public static <TSource> IEnumerable<TSource> loop(TSource seed, Func1<TSource, TSource> next) {
if (next == null)
ThrowHelper.throwArgumentNullException(ExceptionArgument.next);
return new LoopIterator<>(seed, next);
}
public static <TSource> IEnumerable<TSource> loop(TSource seed, Predicate1<TSource> condition, Func1<TSource, TSource> next) {
if (condition == null)
ThrowHelper.throwArgumentNullException(ExceptionArgument.condition);
if (next == null)
ThrowHelper.throwArgumentNullException(ExceptionArgument.next);
return new LoopIterator2<>(seed, condition, next);
}
}
final class LoopIterator<TSource> extends AbstractIterator<TSource> {
private final TSource seed;
private final Func1<TSource, TSource> next;
LoopIterator(TSource seed, Func1<TSource, TSource> next) {
this.seed = seed;
this.next = next;
}
@Override
public AbstractIterator<TSource> clone() {
return new LoopIterator<>(this.seed, this.next);
}
@Override
public boolean moveNext() {
switch (this.state) {
case 1:
this.current = this.seed;
this.state = 2;
return true;
case 2:
this.current = this.next.apply(this.current);
return true;
default:
return false;
}
}
}
final class LoopIterator2<TSource> extends AbstractIterator<TSource> {
private final TSource seed;
private final Predicate1<TSource> condition;
private final Func1<TSource, TSource> next;
LoopIterator2(TSource seed, Predicate1<TSource> condition, Func1<TSource, TSource> next) {
this.seed = seed;
this.condition = condition;
this.next = next;
}
@Override
public AbstractIterator<TSource> clone() {
return new LoopIterator2<>(this.seed, this.condition, this.next);
}
@Override
public boolean moveNext() {
TSource item;
switch (this.state) {
case 1:
item = this.seed;
if (this.condition.apply(item)) {
this.current = item;
this.state = 2;
return true;
}
this.close();
return false;
case 2:
item = this.next.apply(this.current);
if (this.condition.apply(item)) {
this.current = item;
return true;
}
this.close();
return false;
default:
return false;
}
}
}
| 28.700935 | 130 | 0.582546 |
ea99ca597a78c5f816622773278537ad3d98233f | 419 | package com.whalecloud.service;
/**
*
* 验证码平台
*
* @author zhaoyanac
* @date 2019/10/31
*/
public interface CodeService {
/**
*
* 添加
*
* @param phone
* @param code
*/
void add(String phone, String code);
/**
*
* 验证码是否正确
*
* @param phone
* @param code
* @return
*/
Boolean isTrue(String phone, String code) throws Exception;
}
| 11.971429 | 63 | 0.513126 |
d27d82fd3fdbb57fc1a5eaac5fca6c6f99ade539 | 178 | package net.sf.l2j.commons.mmocore;
import java.nio.channels.SocketChannel;
/**
* @author KenM
*/
public interface IAcceptFilter
{
public boolean accept(SocketChannel sc);
} | 16.181818 | 41 | 0.758427 |
580b7f55fa4433871fd78e6414f074c032774903 | 5,443 | package com.atlassian.jira.ext.calendar.model;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.index.DocumentConstants;
import com.atlassian.jira.issue.priority.Priority;
import org.jmock.Mock;
import org.jmock.MockObjectTestCase;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
public class TestIssueComparator extends MockObjectTestCase {
public void testCompare() throws ParseException {
Mock mockIssue1;
Mock mockIssue2;
Mock mockIssue1Priority;
Mock mockIssue2Priority;
Issue issue1;
Issue issue2;
Timestamp issue1DueDate = new Timestamp(new SimpleDateFormat("ddMMyyyy").parse("01011970").getTime());
Timestamp issue2DueDate = new Timestamp(new SimpleDateFormat("ddMMyyyy").parse("02011970").getTime());
Priority issue1Priority;
Priority issue2Priority;
mockIssue1Priority = new Mock(Priority.class);
mockIssue1Priority.expects(atLeastOnce()).method("compareTo").with(isA(Priority.class)).will(returnValue(1));
issue1Priority = (Priority) mockIssue1Priority.proxy();
mockIssue1 = new Mock(Issue.class);
mockIssue1.expects(atLeastOnce()).method("getDueDate").withNoArguments().will(returnValue(issue1DueDate));
issue1 = (Issue) mockIssue1.proxy();
mockIssue2Priority = new Mock(Priority.class);
mockIssue2Priority.expects(atLeastOnce()).method("compareTo").with(isA(Priority.class)).will(returnValue(1));
issue2Priority = (Priority) mockIssue2Priority.proxy();
mockIssue2 = new Mock(Issue.class);
mockIssue2.expects(atLeastOnce()).method("getDueDate").withNoArguments().will(returnValue(issue2DueDate));
issue2 = (Issue) mockIssue2.proxy();
IssueComparator issueComparator = new IssueComparator(DocumentConstants.ISSUE_DUEDATE);
/* Test comparison using issue due date */
assertEquals(0, issueComparator.compare(null, null));
assertEquals(0, issueComparator.compare(issue1, issue1));
assertEquals(0, issueComparator.compare(issue2, issue2));
assertEquals(
issue1DueDate.compareTo(issue2DueDate),
issueComparator.compare(issue1, issue2)
);
assertEquals(
issue2DueDate.compareTo(issue1DueDate),
issueComparator.compare(issue2, issue1)
);
mockIssue2.reset();
mockIssue2.expects(atLeastOnce()).method("getDueDate").withNoArguments().will(returnValue(null));
issue2 = (Issue) mockIssue2.proxy();
assertEquals(1, issueComparator.compare(issue1, issue2));
assertEquals(-1, issueComparator.compare(issue2, issue1));
/* Test comparison using issue priority */
mockIssue1.reset();
mockIssue1.expects(atLeastOnce()).method("getDueDate").withNoArguments().will(returnValue(issue1DueDate));
mockIssue1.expects(atLeastOnce()).method("getPriorityObject").withNoArguments().will(returnValue(issue1Priority));
issue1 = (Issue) mockIssue1.proxy();
mockIssue2.reset();
mockIssue2.expects(atLeastOnce()).method("getDueDate").withNoArguments().will(returnValue(issue1DueDate));
mockIssue2.expects(atLeastOnce()).method("getPriorityObject").withNoArguments().will(returnValue(issue2Priority));
issue2 = (Issue) mockIssue2.proxy();
assertEquals(1, issueComparator.compare(issue1, issue2));
assertEquals(1, issueComparator.compare(issue2, issue1));
mockIssue1.reset();
mockIssue1.expects(atLeastOnce()).method("getDueDate").withNoArguments().will(returnValue(issue1DueDate));
mockIssue1.expects(atLeastOnce()).method("getPriorityObject").withNoArguments().will(returnValue(null));
issue1 = (Issue) mockIssue1.proxy();
mockIssue2.reset();
mockIssue2.expects(atLeastOnce()).method("getDueDate").withNoArguments().will(returnValue(issue1DueDate));
mockIssue2.expects(atLeastOnce()).method("getPriorityObject").withNoArguments().will(returnValue(issue2Priority));
issue2 = (Issue) mockIssue2.proxy();
assertEquals(-1, issueComparator.compare(issue1, issue2));
assertEquals(1, issueComparator.compare(issue2, issue1));
mockIssue1.reset();
mockIssue1.expects(atLeastOnce()).method("getDueDate").withNoArguments().will(returnValue(issue1DueDate));
mockIssue1.expects(atLeastOnce()).method("getPriorityObject").withNoArguments().will(returnValue(issue1Priority));
mockIssue1.expects(atLeastOnce()).method("getId").withNoArguments().will(returnValue(new Long(1L)));
issue1 = (Issue) mockIssue1.proxy();
mockIssue2.reset();
mockIssue2.expects(atLeastOnce()).method("getDueDate").withNoArguments().will(returnValue(issue1DueDate));
mockIssue2.expects(atLeastOnce()).method("getPriorityObject").withNoArguments().will(returnValue(issue1Priority));
mockIssue2.expects(atLeastOnce()).method("getId").withNoArguments().will(returnValue(new Long(2L)));
issue2 = (Issue) mockIssue2.proxy();
assertEquals(
new Long(1).compareTo(new Long(2)),
issueComparator.compare(issue1, issue2)
);
assertEquals(
new Long(2).compareTo(new Long(1)),
issueComparator.compare(issue2, issue1)
);
}
}
| 46.127119 | 122 | 0.693735 |
20afee0623a7120cc478c635cffa91ef7675fe16 | 367 | public class Lion implements Eudemon, Action {
public void update(double oldCount, double newCount, String name, String treasure) {
System.out.println("Lion known " + name + " took " + treasure + "\noldCount = " + oldCount + ", newCount = " + newCount);
attacks(name);
}
public void attacks(String name) {
System.out.println("Lion attacks " + name);
}
}
| 28.230769 | 123 | 0.678474 |
3be9b26a0b289525818e4a80f38456bd986ca773 | 2,927 | package org.bian.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.bian.dto.SDCustomerPositionRetrieveOutputModelServiceDomainRetrieveActionRecordControlRecordPortfolioAnalysis;
import org.bian.dto.SDCustomerPositionRetrieveOutputModelServiceDomainRetrieveActionRecordServiceDomainActivityAnalysis;
import org.bian.dto.SDCustomerPositionRetrieveOutputModelServiceDomainRetrieveActionRecordServiceDomainPerformanceAnalysis;
import javax.validation.Valid;
/**
* SDCustomerPositionRetrieveOutputModelServiceDomainRetrieveActionRecord
*/
public class SDCustomerPositionRetrieveOutputModelServiceDomainRetrieveActionRecord {
private SDCustomerPositionRetrieveOutputModelServiceDomainRetrieveActionRecordServiceDomainActivityAnalysis serviceDomainActivityAnalysis = null;
private SDCustomerPositionRetrieveOutputModelServiceDomainRetrieveActionRecordServiceDomainPerformanceAnalysis serviceDomainPerformanceAnalysis = null;
private SDCustomerPositionRetrieveOutputModelServiceDomainRetrieveActionRecordControlRecordPortfolioAnalysis controlRecordPortfolioAnalysis = null;
/**
* Get serviceDomainActivityAnalysis
* @return serviceDomainActivityAnalysis
**/
public SDCustomerPositionRetrieveOutputModelServiceDomainRetrieveActionRecordServiceDomainActivityAnalysis getServiceDomainActivityAnalysis() {
return serviceDomainActivityAnalysis;
}
public void setServiceDomainActivityAnalysis(SDCustomerPositionRetrieveOutputModelServiceDomainRetrieveActionRecordServiceDomainActivityAnalysis serviceDomainActivityAnalysis) {
this.serviceDomainActivityAnalysis = serviceDomainActivityAnalysis;
}
/**
* Get serviceDomainPerformanceAnalysis
* @return serviceDomainPerformanceAnalysis
**/
public SDCustomerPositionRetrieveOutputModelServiceDomainRetrieveActionRecordServiceDomainPerformanceAnalysis getServiceDomainPerformanceAnalysis() {
return serviceDomainPerformanceAnalysis;
}
public void setServiceDomainPerformanceAnalysis(SDCustomerPositionRetrieveOutputModelServiceDomainRetrieveActionRecordServiceDomainPerformanceAnalysis serviceDomainPerformanceAnalysis) {
this.serviceDomainPerformanceAnalysis = serviceDomainPerformanceAnalysis;
}
/**
* Get controlRecordPortfolioAnalysis
* @return controlRecordPortfolioAnalysis
**/
public SDCustomerPositionRetrieveOutputModelServiceDomainRetrieveActionRecordControlRecordPortfolioAnalysis getControlRecordPortfolioAnalysis() {
return controlRecordPortfolioAnalysis;
}
public void setControlRecordPortfolioAnalysis(SDCustomerPositionRetrieveOutputModelServiceDomainRetrieveActionRecordControlRecordPortfolioAnalysis controlRecordPortfolioAnalysis) {
this.controlRecordPortfolioAnalysis = controlRecordPortfolioAnalysis;
}
}
| 43.044118 | 188 | 0.884865 |
3592bab7b88ba7493aaa33aa39151b33e949f0c1 | 208 | package com.pateo.spider.download;
import com.pateo.spider.domain.Page;
public class HtmlCleanerDownload implements Downloadable {
@Override
public Page download(String url) {
return null;
}
}
| 13.866667 | 58 | 0.75 |
1bcd431f7a437a3ee360101a74a141739d910c1d | 1,636 | import java.util.Arrays;
/*
* @lc app=leetcode id=646 lang=java
*
* [646] Maximum Length of Pair Chain
*
* https://leetcode.com/problems/maximum-length-of-pair-chain/description/
*
* algorithms
* Medium (54.11%)
* Likes: 1667
* Dislikes: 92
* Total Accepted: 87.9K
* Total Submissions: 161.9K
* Testcase Example: '[[1,2],[2,3],[3,4]]'
*
* You are given an array of n pairs pairs where pairs[i] = [lefti, righti] and
* lefti < righti.
*
* A pair p2 = [c, d] follows a pair p1 = [a, b] if b < c. A chain of pairs can
* be formed in this fashion.
*
* Return the length longest chain which can be formed.
*
* You do not need to use up all the given intervals. You can select pairs in
* any order.
*
*
* Example 1:
*
*
* Input: pairs = [[1,2],[2,3],[3,4]]
* Output: 2
* Explanation: The longest chain is [1,2] -> [3,4].
*
*
* Example 2:
*
*
* Input: pairs = [[1,2],[7,8],[4,5]]
* Output: 3
* Explanation: The longest chain is [1,2] -> [4,5] -> [7,8].
*
*
*
* Constraints:
*
*
* n == pairs.length
* 1 <= n <= 1000
* -1000 <= lefti < righti < 1000
*
*
*/
// @lc code=start
class Solution {
public int findLongestChain(int[][] pairs) {
Arrays.sort(pairs, (a, b) -> (a[0] - b[0]));
int n = pairs.length;
int[] dp = new int[n];
dp[0] = 1;
for (int i = 1; i < n; ++i) {
int max = 1;
for (int j = 0; j < i; ++j) {
if (pairs[j][1] < pairs[i][0]) {
max = Math.max(max, dp[j] + 1);
}
}
dp[i] = max;
}
int max = 0;
for (int i = 0; i < n; ++i) {
max = Math.max(max, dp[i]);
}
return max;
}
}
// @lc code=end
// 跟300 lIS的题类似
| 19.95122 | 79 | 0.542787 |
9f47012a031b29b95dc25d584cd9b2f05b6f0ba5 | 247 | package io.kenxue.cicd.domain.factory.sys;
import io.kenxue.cicd.domain.domain.sys.Role;
/**
* 角色表
* @author mikey
* @date 2021-12-03 17:27:04
*/
public class RoleFactory {
public static Role getRole(){
return new Role();
}
}
| 17.642857 | 45 | 0.65587 |
bb6d1444606efbc3ef932614554e78308af83df1 | 1,735 | package com.zerrium.zping.server;
import net.fabricmc.api.DedicatedServerModInitializer;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
import net.fabricmc.fabric.api.networking.v1.PlayerLookup;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import static com.zerrium.zping.models.ZPingGeneral.*;
import static com.zerrium.zping.utils.ZPingGeneralUtils.*;
@Environment(EnvType.SERVER)
public class ZPingServer implements DedicatedServerModInitializer {
@Override
public void onInitializeServer() {
ServerPlayNetworking.registerGlobalReceiver(PING_PACKET_ID, (server, player, handler, buf, responseSender) -> {
BlockPos hitPos = buf.readBlockPos();
String hitName = buf.readString();
String dimensionName = buf.readString();
server.execute(() -> {
// Everything in this lambda is run on the render thread
PacketByteBuf sendBuf = PacketByteBufs.create();
sendBuf.writeBlockPos(hitPos);
sendBuf.writeString(hitName);
sendBuf.writeString(dimensionName);
for (ServerPlayerEntity otherPlayer : PlayerLookup.tracking((ServerWorld) player.world, hitPos)) {
if(otherPlayer != player)
ServerPlayNetworking.send(otherPlayer, PING_PACKET_ID, sendBuf);
}
});
});
logInfo("Server initialized!");
}
}
| 41.309524 | 119 | 0.696254 |
c2f5ae70ef5e9a8532aede36affd0b182d34b63b | 8,832 | /*
* Copyright 2017 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.apps.forscience.whistlepunk.review;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.Nullable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.google.android.apps.forscience.whistlepunk.AccessibilityUtils;
import com.google.android.apps.forscience.whistlepunk.DataService;
import com.google.android.apps.forscience.whistlepunk.ExportService;
import com.google.android.apps.forscience.whistlepunk.ExportService.ExportProgress;
import com.google.android.apps.forscience.whistlepunk.R;
import com.google.android.apps.forscience.whistlepunk.RxDataController;
import com.google.android.apps.forscience.whistlepunk.WhistlePunkApplication;
import com.google.android.apps.forscience.whistlepunk.accounts.AppAccount;
import com.google.android.apps.forscience.whistlepunk.analytics.TrackerConstants;
import com.google.android.apps.forscience.whistlepunk.filemetadata.Trial;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import com.google.android.material.snackbar.Snackbar;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import java.util.List;
import java.util.Objects;
/** Shows options for exporting. */
public class ExportOptionsDialogFragment extends BottomSheetDialogFragment {
private static final String KEY_ACCOUNT_KEY = "account_key";
private static final String KEY_EXPERIMENT_ID = "experiment_id";
private static final String KEY_TRIAL_ID = "trial_id";
private static final String KEY_SAVE_LOCALLY = "save_locally";
private static final String TAG = "ExportOptionsDialog";
private String trialId;
private boolean saveLocally;
private CheckBox relativeTime;
private List<String> sensorIds;
private ProgressBar progressBar;
private Button exportButton;
private Disposable untilStop;
public static ExportOptionsDialogFragment createOptionsDialog(
AppAccount appAccount, String experimentId, String trialId, boolean saveLocally) {
Bundle args = new Bundle();
args.putString(KEY_ACCOUNT_KEY, appAccount.getAccountKey());
args.putString(KEY_EXPERIMENT_ID, experimentId);
args.putString(KEY_TRIAL_ID, trialId);
args.putBoolean(KEY_SAVE_LOCALLY, saveLocally);
ExportOptionsDialogFragment fragment = new ExportOptionsDialogFragment();
fragment.setArguments(args);
return fragment;
}
@Override
public void onStart() {
super.onStart();
trialId = getArguments().getString(KEY_TRIAL_ID);
saveLocally = getArguments().getBoolean(KEY_SAVE_LOCALLY);
untilStop =
ExportService.bind(getActivity())
// Only look at events for this trial or the default value
.filter(
progress ->
Objects.equals(progress.getId(), trialId) || progress.getId().equals(""))
.observeOn(AndroidSchedulers.mainThread())
.doOnNext(
progress -> {
if (progress.getState() == ExportProgress.EXPORT_COMPLETE) {
// Reset the progress only after the UI has consumed this.
ExportService.resetProgress(trialId);
}
})
.subscribe(this::updateProgress);
}
private void updateProgress(ExportProgress progress) {
progressBar.setVisibility(
progress.getState() == ExportProgress.EXPORTING ? View.VISIBLE : View.INVISIBLE);
exportButton.setEnabled(progress.getState() != ExportProgress.EXPORTING);
if (progress.getState() == ExportProgress.EXPORTING) {
progressBar.setProgress(progress.getProgress());
} else if (progress.getState() == ExportProgress.EXPORT_COMPLETE) {
// Finish dialog and send the filename.
if (getActivity() != null) {
if (saveLocally) {
requestDownload(progress);
} else {
requestExport(progress);
}
}
} else if (progress.getState() == ExportProgress.ERROR) {
if (getActivity() != null) {
Snackbar bar =
AccessibilityUtils.makeSnackbar(
getView(), getString(R.string.export_error), Snackbar.LENGTH_LONG);
bar.show();
}
}
}
private void requestExport(ExportProgress progress) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("application/octet-stream");
intent.putExtra(Intent.EXTRA_STREAM, progress.getFileUri());
if (!getActivity().getPackageManager().queryIntentActivities(intent, 0).isEmpty()) {
getActivity()
.startActivity(
Intent.createChooser(intent, getString(R.string.export_run_chooser_title)));
dismiss();
} else {
Snackbar bar =
AccessibilityUtils.makeSnackbar(
getView(), getString(R.string.no_app_found_for_csv), Snackbar.LENGTH_LONG);
bar.show();
}
}
private void requestDownload(ExportProgress progress) {
Activity activity = getActivity();
ExportService.requestDownloadPermissions(
() -> {
Uri sourceUri = progress.getFileUri();
ExportService.saveToDownloads(activity, sourceUri);
dismiss();
},
activity,
android.R.id.content,
TrackerConstants.CATEGORY_RUNS,
TrackerConstants.LABEL_RUN_REVIEW);
}
@Override
public void onStop() {
super.onStop();
if (untilStop != null) {
untilStop.dispose();
}
}
@Nullable
@Override
public View onCreateView(
LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.dialog_export_options, container, false);
relativeTime = (CheckBox) view.findViewById(R.id.export_relative_time);
progressBar = (ProgressBar) view.findViewById(R.id.progress);
progressBar.setMax(100);
view.findViewById(R.id.action_cancel)
.setOnClickListener(
v -> {
// TODO: could cancel the export action here: requires saving references in
// ExportService.
dismiss();
});
AppAccount appAccount =
WhistlePunkApplication.getAccount(getContext(), getArguments(), KEY_ACCOUNT_KEY);
final String experimentId = getArguments().getString(KEY_EXPERIMENT_ID);
// onCreateView is called before onStart so we need to grab these values for onCreateView
final String trialId = getArguments().getString(KEY_TRIAL_ID);
final boolean saveLocally = getArguments().getBoolean(KEY_SAVE_LOCALLY);
DataService.bind(getActivity())
.map(
appSingleton -> {
return appSingleton.getDataController(appAccount);
})
.flatMap(dc -> RxDataController.getExperimentById(dc, experimentId))
.subscribe(
experiment -> {
Trial trial = experiment.getTrial(trialId);
sensorIds = trial.getSensorIds();
// TODO: fill in UI with these sensors.
},
error -> {
if (Log.isLoggable(TAG, Log.ERROR)) {
Log.e(TAG, "Unable to bind DataService in ExportOptionsDialogFragment", error);
}
throw new IllegalStateException(
"Unable to bind DataService in ExportOptionsDialogFragment", error);
});
exportButton = (Button) view.findViewById(R.id.action_export);
if (saveLocally) {
TextView title = (TextView) view.findViewById(R.id.export_title);
title.setText(R.string.download_options_title);
exportButton.setText(R.string.download_copy_action);
}
exportButton.setOnClickListener(
v -> {
ExportService.exportTrial(
getActivity(),
appAccount,
experimentId,
trialId,
relativeTime.isChecked(),
saveLocally,
sensorIds.toArray(new String[] {}));
});
return view;
}
}
| 39.428571 | 100 | 0.689198 |
681ddf37fbe57682407ffc95e55c509147c074f5 | 230 | package br.ufc.dc.tpii.helloci;
import static org.junit.Assert.*;
import org.junit.Test;
public class AppTest {
@Test
public void testSayHello() {
App app = new App();
assertEquals("Hello World!", app.sayHello());
}
}
| 14.375 | 47 | 0.686957 |
0714abee887a7a9d7cfd4c0d099279a0a525b9d3 | 622 | package nl.beerik.easyenchantments.config;
import java.util.List;
import net.minecraft.item.DyeColor;
public class EEConfig {
//Client
public static boolean clientBoolean;
public static List<String> clientStringList;
public static DyeColor clientDyeColorEnum;
public static boolean modelTranslucency;
public static float modelScale;
// Server
public static boolean serverBoolean;
public static List<String> serverStringList;
public static DyeColor serverEnumDyeColor;
public static int electricFurnaceEnergySmeltCostPerTick = 100;
public static int heatCollectorTransferAmountPerTick = 100;
}
| 25.916667 | 64 | 0.807074 |
f177be0bd1bde3687b309a8ad6728177990fb960 | 2,470 | package cmps252.HW4_2.UnitTesting;
import static org.junit.jupiter.api.Assertions.*;
import java.io.FileNotFoundException;
import java.util.List;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import cmps252.HW4_2.Customer;
import cmps252.HW4_2.FileParser;
@Tag("38")
class Record_4457 {
private static List<Customer> customers;
@BeforeAll
public static void init() throws FileNotFoundException {
customers = FileParser.getCustomers(Configuration.CSV_File);
}
@Test
@DisplayName("Record 4457: FirstName is Rodrigo")
void FirstNameOfRecord4457() {
assertEquals("Rodrigo", customers.get(4456).getFirstName());
}
@Test
@DisplayName("Record 4457: LastName is Sanots")
void LastNameOfRecord4457() {
assertEquals("Sanots", customers.get(4456).getLastName());
}
@Test
@DisplayName("Record 4457: Company is Rominger Funeral Home")
void CompanyOfRecord4457() {
assertEquals("Rominger Funeral Home", customers.get(4456).getCompany());
}
@Test
@DisplayName("Record 4457: Address is 2800 Hamilton Blvd")
void AddressOfRecord4457() {
assertEquals("2800 Hamilton Blvd", customers.get(4456).getAddress());
}
@Test
@DisplayName("Record 4457: City is South Plainfield")
void CityOfRecord4457() {
assertEquals("South Plainfield", customers.get(4456).getCity());
}
@Test
@DisplayName("Record 4457: County is Middlesex")
void CountyOfRecord4457() {
assertEquals("Middlesex", customers.get(4456).getCounty());
}
@Test
@DisplayName("Record 4457: State is NJ")
void StateOfRecord4457() {
assertEquals("NJ", customers.get(4456).getState());
}
@Test
@DisplayName("Record 4457: ZIP is 7080")
void ZIPOfRecord4457() {
assertEquals("7080", customers.get(4456).getZIP());
}
@Test
@DisplayName("Record 4457: Phone is 908-757-4095")
void PhoneOfRecord4457() {
assertEquals("908-757-4095", customers.get(4456).getPhone());
}
@Test
@DisplayName("Record 4457: Fax is 908-757-9362")
void FaxOfRecord4457() {
assertEquals("908-757-9362", customers.get(4456).getFax());
}
@Test
@DisplayName("Record 4457: Email is [email protected]")
void EmailOfRecord4457() {
assertEquals("[email protected]", customers.get(4456).getEmail());
}
@Test
@DisplayName("Record 4457: Web is http://www.rodrigosanots.com")
void WebOfRecord4457() {
assertEquals("http://www.rodrigosanots.com", customers.get(4456).getWeb());
}
}
| 25.729167 | 77 | 0.736032 |
616c9084127d09f24145e78ffde44affbe2275dd | 1,163 | /** Ben F Rayfield offers this software opensource MIT license */
package mutable.compilers.java.impl;
import java.io.File;
import java.security.ProtectionDomain;
import java.util.HashMap;
import java.util.Map;
import mutable.util.Files;
public class DirClassLoader extends ClassLoader{
public final File dir;
public final ClassLoader parent;
protected final Map<String,Class> classesCreated = new HashMap();
public DirClassLoader(File dir, ClassLoader parent){
this.dir = dir;
this.parent = parent;
}
public synchronized Class findClass(String name){
Class c = classesCreated.get(name);
if(c != null) return c;
try{
return parent.loadClass(name);
}catch(ClassNotFoundException e){
File f = classFileFromClassName(name);
byte[] bytecode = Files.read(f);
c = defineClass(name, bytecode, 0, bytecode.length);
classesCreated.put(name, c);
return c;
}
}
public File classFileFromClassName(String className){
String[] tokens = className.trim().split("\\.");
File f = this.dir;
for(int i=0; i<tokens.length; i++){
f = new File(f, i==tokens.length-1 ? tokens[i]+".class" : tokens[i]);
}
return f;
}
}
| 24.229167 | 72 | 0.706793 |
65772c7aab65a35adb32083894764ea421e107ce | 1,789 | // Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
import com.code_intelligence.jazzer.api.FuzzedDataProvider;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.lang.RuntimeException;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.CannotCompileException;
import javassist.NotFoundException;
import java.lang.NullPointerException;
public class ClassFuzzer {
public static void fuzzerTestOneInput(FuzzedDataProvider data) {
ClassPool pool = ClassPool.getDefault();
CtClass cc = null;
try {
cc = pool.makeClass(new ByteArrayInputStream(data.consumeRemainingAsBytes()));
} catch (IOException | RuntimeException e) {
}
try {
cc.getSuperclass();
cc.getNestedClasses();
cc.getClassFile();
cc.getInterfaces();
cc.getDeclaringClass();
cc.getComponentType();
} catch (NotFoundException | NullPointerException e) {
}
try {
cc.toBytecode();
} catch (IOException | NullPointerException | CannotCompileException e) {
}
}
}
| 31.946429 | 90 | 0.652879 |
8d7beff58b0c7441b38fbc46446ebf03a12adfcb | 4,410 | package de.fred4jupiter.fredbet.web.image;
import de.fred4jupiter.fredbet.domain.AppUser;
import de.fred4jupiter.fredbet.domain.ImageGroup;
import de.fred4jupiter.fredbet.domain.ImageMetaData;
import de.fred4jupiter.fredbet.security.FredBetPermission;
import de.fred4jupiter.fredbet.service.image.ImageAdministrationService;
import de.fred4jupiter.fredbet.web.WebMessageUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import java.util.Base64;
import java.util.List;
@Controller
@RequestMapping("/image")
public class ImageUploadController {
private static final String REDIRECT_SHOW_PAGE = "redirect:/image/show";
private final ImageAdministrationService imageAdministrationService;
private final WebMessageUtil messageUtil;
private final ImageCommandMapper imageCommandMapper;
public ImageUploadController(ImageAdministrationService imageAdministrationService, WebMessageUtil messageUtil,
ImageCommandMapper imageCommandMapper) {
this.imageAdministrationService = imageAdministrationService;
this.messageUtil = messageUtil;
this.imageCommandMapper = imageCommandMapper;
}
@ModelAttribute("availableImages")
public List<ImageCommand> availableImages(@AuthenticationPrincipal AppUser currentUser) {
return imageCommandMapper.toListOfImageCommand(loadImageMetaData(currentUser));
}
private List<ImageMetaData> loadImageMetaData(AppUser currentUser) {
if (currentUser.hasPermission(FredBetPermission.PERM_DELETE_ALL_IMAGES)) {
return imageAdministrationService.fetchAllImagesExceptUserProfileImages();
} else {
return imageAdministrationService.fetchImagesOfUserExceptUserProfileImages(currentUser.getUsername());
}
}
@ModelAttribute("availableImageGroups")
public List<String> availableImageGroups() {
return imageAdministrationService.findAvailableImageGroups();
}
@ModelAttribute("imageUploadCommand")
public ImageUploadCommand initImageUploadCommand() {
return new ImageUploadCommand();
}
@GetMapping("/show")
public String showUploadPage() {
return "image/image_upload";
}
@PostMapping("/upload")
public String uploadImage(ImageUploadCommand imageUploadCommand, RedirectAttributes redirect) {
if (StringUtils.isBlank(imageUploadCommand.getMyFileBase64())) {
messageUtil.addErrorMsg(redirect, "image.upload.msg.noFileGiven");
return REDIRECT_SHOW_PAGE;
}
final byte[] imageByte = Base64.getDecoder().decode(imageUploadCommand.getMyFileBase64().split(",")[1]);
if (imageByte.length == 0) {
messageUtil.addErrorMsg(redirect, "image.upload.msg.noFileGiven");
return REDIRECT_SHOW_PAGE;
}
final ImageGroup imageGroup = imageAdministrationService.findOrCreateImageGroup(imageUploadCommand.getGalleryGroup());
imageAdministrationService.saveImage(imageByte, imageGroup.getId(), imageUploadCommand.getDescription());
messageUtil.addInfoMsg(redirect, "image.upload.msg.saved");
return REDIRECT_SHOW_PAGE;
}
@GetMapping("/delete/{imageKey}")
public String deleteImage(@PathVariable("imageKey") String imageKey, RedirectAttributes redirect, @AuthenticationPrincipal AppUser currentUser) {
if (!isAllowedToDeleteImageWithImageKey(currentUser, imageKey)) {
messageUtil.addErrorMsg(redirect, "image.gallery.msg.delete.perm.denied");
return REDIRECT_SHOW_PAGE;
}
imageAdministrationService.deleteImageByImageKey(imageKey);
messageUtil.addInfoMsg(redirect, "image.gallery.msg.deleted");
return REDIRECT_SHOW_PAGE;
}
private boolean isAllowedToDeleteImageWithImageKey(AppUser currentUser, String imageKey) {
if (currentUser.hasPermission(FredBetPermission.PERM_DELETE_ALL_IMAGES)) {
return true;
}
return imageAdministrationService.isImageOfUser(imageKey, currentUser);
}
}
| 40.833333 | 150 | 0.7322 |
f7494783915af4700d6e2d42086fcce18beb695e | 107 | package com.stone.pile.util;
/**
* Created by admin on 2017/5/12.
*/
public class TransitionHelper {
}
| 11.888889 | 33 | 0.682243 |
96d403814813f959c085aa262a2febb3b35ae476 | 557 | package com.jokls.jok.dataset.writer;
import com.jokls.jok.dataset.IDataset;
/**
* Copyright (C) 2019
* All rights reserved
*
* @author: marik.wei
* @mail: [email protected]
* Date: 2019/6/22 15:07
*/
public interface IMapWriter {
void put(String name, int value);
void put(String name, long value);
void put(String name, double value);
void put(String name, String value);
void put(String name, byte[] value);
void put(String name, String[] value);
void put(String name, Object value);
IDataset getDataset();
}
| 17.967742 | 42 | 0.664273 |
00334994057d99d643d7adb5156b744a885bed65 | 1,522 | package br.com.joinersa.contaeletrica.entities;
/**
* Created by Joiner on 16/07/2016.
*/
public class Aparelho {
private int idImagem;
private String nome;
private float potencia;
private float tempo;
private String periodo;
public Aparelho() {}
public Aparelho(String nome, float potencia, float tempo, String periodo) {
this.nome = nome;
this.potencia = potencia;
this.tempo = tempo;
this.periodo = periodo;
}
public Aparelho(int idImagem, String nome, float potencia, float tempo, String periodo) {
this.idImagem = idImagem;
this.nome = nome;
this.potencia = potencia;
this.tempo = tempo;
this.periodo = periodo;
}
public int getIdImagem() {
return idImagem;
}
public void setIdImagem(int idImagem) {
this.idImagem = idImagem;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public float getPotencia() {
return potencia;
}
public void setPotencia(float potencia) {
this.potencia = potencia;
}
public float getTempo() {
return tempo;
}
public void setTempo(float tempo) {
this.tempo = tempo;
}
public String getPeriodo() {
return periodo;
}
public void setPeriodo(String periodo) {
this.periodo = periodo;
}
}
| 21.43662 | 94 | 0.57293 |
a2922c9fb07ea735cc0e5300799288380796e20f | 2,073 | /*
* Copyright 2010 Ning, Inc.
*
* Ning 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.asynchttpclient.multipart;
import java.io.IOException;
import java.io.OutputStream;
public class ByteArrayPart extends AbstractFilePart {
private final byte[] bytes;
private final String fileName;
public ByteArrayPart(String name, byte[] bytes) {
this(name, bytes, null);
}
public ByteArrayPart(String name, byte[] bytes, String contentType) {
this(name, bytes, contentType, null);
}
public ByteArrayPart(String name, byte[] bytes, String contentType, String charset) {
this(name, bytes, contentType, charset, null);
}
public ByteArrayPart(String name, byte[] bytes, String contentType, String charset, String fileName) {
this(name, bytes, contentType, charset, fileName, null);
}
public ByteArrayPart(String name, byte[] bytes, String contentType, String charset, String fileName, String contentId) {
super(name, contentType, charset, contentId);
if (bytes == null) {
throw new NullPointerException("bytes");
}
this.bytes = bytes;
this.fileName = fileName;
}
@Override
public String getFileName() {
return fileName;
}
@Override
protected void sendData(OutputStream out) throws IOException {
out.write(bytes);
}
@Override
protected long getDataLength() {
return bytes.length;
}
public byte[] getBytes() {
return bytes;
}
}
| 29.614286 | 124 | 0.677279 |
234e272e4c1bc7662580072205983a0764ced19f | 1,009 | package com.arjim.webserver.user.service;
import com.arjim.webserver.user.model.*;
import java.util.List;
import java.util.Map;
/**
* 部门
*
* @author arjim
* @description
* @date 2020-11-27 09:38:52
*/
public interface UserDepartmentService {
UserDepartmentEntity queryObject(Long id);
List<UserDepartmentEntity> queryList(Map<String, Object> map);
List<ImFriendUserInfo> queryGroupAndUser();
List<ImGroupUserData> queryOffice();
int queryTotal(Map<String, Object> map);
void save(UserDepartmentEntity userDepartment);
int update(UserDepartmentEntity userDepartment);
int delete(Long id);
int deleteBatch(Long[] ids);
List<ImFriendUserInfoData> findAllUserByOffice(ImGroupUserData group);
List<ImFriendUserInfoData> findUserByOffice(ImGroupUserData group);
int updateSign(ImFriendUserInfo imFriendUserInfo);
List<ImGroupUserData> getGroup(UserAccountEntity loginUser);
public List<ImOfficeUser> queryOfficeUser();
public ImGroupUserData findGroupById(String id);
}
| 21.468085 | 71 | 0.77998 |
6ee2bc3b75a3e664c8125fd7b9401c2f2419a886 | 509 | /*
* Ven's Aliucord Plugins
* Copyright (C) 2021 Vendicated
*
* 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
*/
package com.discord.databinding;
import android.view.View;
import androidx.viewbinding.ViewBinding;
public class WidgetMediaBinding implements ViewBinding {
public View getRoot() { return new View(null); }
}
| 25.45 | 67 | 0.738703 |
85bcad4d5f65eace4c29597da604e46ca3582a6a | 1,932 | package br.com.fernandomachado.galaxy;
import br.com.fernandomachado.galaxy.dao.singleton.MaterialSingletonDAOTest;
import br.com.fernandomachado.galaxy.dao.singleton.TranslationSingletonDAOTest;
import br.com.fernandomachado.galaxy.model.numeral.roman.RomanNumeralFactoryTest;
import br.com.fernandomachado.galaxy.model.numeral.roman.RomanNumeralHelperTest;
import br.com.fernandomachado.galaxy.parser.regex.RegexParserUtilsTest;
import br.com.fernandomachado.galaxy.parser.regex.processor.VariableContainerTest;
import br.com.fernandomachado.galaxy.parser.regex.simple.SimpleRegexParserTest;
import br.com.fernandomachado.galaxy.parser.regex.simple.pattern.SimpleCommandTest;
import br.com.fernandomachado.galaxy.parser.regex.simple.pattern.SimpleTokenTest;
import br.com.fernandomachado.galaxy.parser.regex.simple.processor.SimpleMaterialEntryProcessorTest;
import br.com.fernandomachado.galaxy.parser.regex.simple.processor.SimpleMaterialQueryProcessorTest;
import br.com.fernandomachado.galaxy.parser.regex.simple.processor.SimpleTranslationEntryProcessorTest;
import br.com.fernandomachado.galaxy.parser.regex.simple.processor.SimpleTranslationQueryProcessorTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({
RomanNumeralFactoryTest.class,
RomanNumeralHelperTest.class,
MaterialSingletonDAOTest.class,
TranslationSingletonDAOTest.class,
VariableContainerTest.class,
RegexParserUtilsTest.class,
SimpleCommandTest.class,
SimpleTokenTest.class,
SimpleTranslationEntryProcessorTest.class,
SimpleTranslationQueryProcessorTest.class,
SimpleMaterialEntryProcessorTest.class,
SimpleMaterialQueryProcessorTest.class,
SimpleRegexParserTest.class
})
public class TestSuite {
}
| 42.933333 | 104 | 0.807453 |
fc3b186e5e8f96c89f33cff0c30b1e463d06a684 | 252 | package com.rrvrafael.cursojava.aula31;
public class TesteCarro {
public static void main(String[] args) {
Carro carro = new Carro();
carro.marca = "Fiat";
double km = 10;
carro.calcularCombustivel(km);
}
}
| 16.8 | 44 | 0.607143 |
198c8a52f697d1d9f259fc020fefb4666793835d | 14,440 | /*
* Copyright (c) 2010-2015 Pivotal Software, 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. See accompanying
* LICENSE file.
*/
package event;
import util.*;
import hydra.*;
import com.gemstone.gemfire.cache.*;
/**
* A Hydra test that concurrently performs a number of cache-related
* (both entry and region) operations while adding and removing listeners.
* Verifies listeners are invoked when expected and in the correct order.
*
* @see ListenerPrms
* @see ListenerBB
*
* @author lhughes
* @since 5.0
*/
public class ListenerTest extends EventTest {
static protected final int ADD_LISTENER = 1;
static protected final int REMOVE_LISTENER = 2;
static protected final int INIT_LISTENERS = 3;
static protected final int SET_LISTENER = 4;
// ========================================================================
// initialization methods
// ========================================================================
/**
* Creates and {@linkplain #initialize initializes} the singleton
* instance of <code>ListenerTest</code> in this VM.
*/
public synchronized static void HydraTask_initialize() {
if (eventTest == null) {
eventTest = new ListenerTest();
eventTest.initialize();
}
}
// ========================================================================
// override methods in EventTest
// ========================================================================
/**
* returns the number of VMs with listeners
*
* In the listener test, we simply assume there is at least one listener
* for any region. This method is invoked when we invalidate the region
* to ensure that at least some minimum number of listeners are invoked.
* It is not used to determine the expected counts for various events.
*/
protected int getNumVMsWithListeners() {
return 1;
}
// ========================================================================
// additional methods (not in EventTest)
// ========================================================================
/**
* HydraTask method to perform listener operations (add, remove, set, init),
* stores the expected list of listeners to be invoked in the BB and then
* performs a random entry operation. Listeners add their name to the
* InvokedListener List in the BB when invoked. In serialExecution mode,
* the two listener lists are then compared to ensure that the listeners
* were invoked in the expected order.
*/
public synchronized static void HydraTask_exerciseListeners() {
//Region rootRegion = CacheUtil.getCache().getRegion(REGION_NAME);
((ListenerTest)eventTest).exerciseListeners();
}
/**
* see HydraTask_exerciseListeners
*/
protected void exerciseListeners() {
long startTime = System.currentTimeMillis();
if (isSerialExecution) {
logExecutionNumber();
}
do {
// randomly select the region
Region aRegion = getRandomRegion(true);
if (aRegion == null) {
Log.getLogWriter().info("no regions available, returning");
return;
}
Log.getLogWriter().info("Invoked exerciseListeners for region " + aRegion.getName());
int listenerOp = getListenerOp();
switch (listenerOp) {
case ADD_LISTENER:
addListener(aRegion);
break;
case REMOVE_LISTENER:
removeListener(aRegion);
break;
case INIT_LISTENERS:
initListener(aRegion);
break;
case SET_LISTENER:
setListener(aRegion);
break;
default:
throw new TestException("Unknown Listener Operation " + listenerOp);
}
if (isCarefulValidation) {
writeExpectedListenerListToBB(aRegion);
clearInvokedListenerList(aRegion.getName());
}
doOperation(aRegion);
if (isCarefulValidation) {
compareListenerLists(aRegion.getName());
}
} while (System.currentTimeMillis() - startTime < minTaskGranularityMS);
}
/**
* Perform a random region or entry operation
*
* @param aRegion - targeted region
*/
protected void doOperation(Region aRegion) {
// randomly select entry vs. region operation (90% entry operations)
int randInt = TestConfig.tab().getRandGen().nextInt(1, 100);
if (randInt < 90) {
doEntryOperation(aRegion);
} else {
doRegionOperation(aRegion);
}
}
/**
* Perform a random entry operation
*
* @param aRegion - targeted region
*/
protected void doEntryOperation(Region aRegion) {
// execute a random operation to invoke callbacks
int whichOp = getOperation(EventPrms.entryOperations, isMirrored);
switch (whichOp) {
case ADD_OPERATION:
addObject(aRegion, true);
break;
case INVALIDATE_OPERATION:
invalidateObject(aRegion, false);
break;
case DESTROY_OPERATION:
destroyObject(aRegion, false);
break;
case UPDATE_OPERATION:
updateObject(aRegion);
break;
case READ_OPERATION:
readObject(aRegion);
break;
case LOCAL_INVALIDATE_OPERATION:
invalidateObject(aRegion, true);
break;
case LOCAL_DESTROY_OPERATION:
destroyObject(aRegion, true);
break;
default: {
throw new TestException("Unknown operation " + whichOp);
}
}
}
/**
* Perform a random region operation
*
* @param aRegion - targeted region
*/
protected void doRegionOperation(Region aRegion) {
long numRegions = getNumNonRootRegions();
int whichOp = getOperation(EventPrms.regionOperations, false);
if (numRegions == 0) // no regions other than the roots; add another
whichOp = ADD_OPERATION;
else if (numRegions >= maxRegions)
whichOp = DESTROY_OPERATION;
// Don't allow destructive region operations on root regions
if (aRegion.getParentRegion() == null) {
whichOp = ADD_OPERATION;
}
switch (whichOp) {
case ADD_OPERATION:
addRegion(aRegion);
break;
case DESTROY_OPERATION:
destroyRegion(false, aRegion);
break;
case INVALIDATE_OPERATION:
invalidateRegion(false, aRegion);
break;
case LOCAL_DESTROY_OPERATION:
destroyRegion(true, aRegion);
break;
case LOCAL_INVALIDATE_OPERATION:
invalidateRegion(true, aRegion);
break;
case REGION_CLOSE_OPERATION:
closeRegion(aRegion);
break;
case CLEAR_OPERATION:
clearRegion(aRegion);
break;
default: {
throw new TestException("Unknown operation " + whichOp);
}
}
}
/**
* Return a random operation to perform on the cacheListenerList.
*/
protected int getListenerOp() {
int op = 0;
String operation = TestConfig.tab().stringAt(ListenerPrms.listenerOperations);
if (operation.equals("add"))
op = ADD_LISTENER;
else if (operation.equals("remove"))
op = REMOVE_LISTENER;
else if (operation.equals("init"))
op = INIT_LISTENERS;
else if (operation.equals("set"))
op = SET_LISTENER;
else
throw new TestException("Unknown listenerOperation " + operation);
return op;
}
/**
* Returns a new instance of CacheListener for the type given by EventPrms.listeners
*/
protected CacheListener getNewListener() {
MultiListener newListener = new MultiListener( NameFactory.getNextListenerName() );
Log.getLogWriter().info("getNewListener() returns listener " + newListener.getName());
return newListener;
}
/**
* Adds a listener to the existing listener list in the indicated Region
*
* @param aRegion - the targeted region for the listener operation
*/
protected void addListener(Region aRegion) {
AttributesMutator mutator = aRegion.getAttributesMutator();
// Add a random listener from the list of availableListeners
CacheListener newListener = getNewListener();
Log.getLogWriter().info("adding listener " + ((MultiListener)newListener).getName() + " to existing list of " + getCacheListenerNames(aRegion));
mutator.addCacheListener( newListener );
Log.getLogWriter().info("After adding listener " + ((MultiListener)newListener).getName() + " new list = " + getCacheListenerNames(aRegion));
}
/**
* Removes a listener from the existing listener list in the indicated Region
*
* @param aRegion - the targeted region for the listener operation
*/
protected void removeListener(Region aRegion) {
// From existing listeners for this region, pick one to remove
RegionAttributes ratts = aRegion.getAttributes();
CacheListener[] assignedListeners = ratts.getCacheListeners();
if (assignedListeners.length == 0) {
Log.getLogWriter().info("removeListeners invoked, but no assigned listeners to remove. Returning.");
return;
}
int randInt = TestConfig.tab().getRandGen().nextInt(0, assignedListeners.length-1);
Log.getLogWriter().info("Removing listener " + ((MultiListener)assignedListeners[randInt]).getName() + " from list of assignedCacheListeners " + getCacheListenerNames(aRegion));
AttributesMutator mutator = aRegion.getAttributesMutator();
mutator.removeCacheListener( assignedListeners[randInt] );
Log.getLogWriter().info("After removing listener " + ((MultiListener)assignedListeners[randInt]).getName() + " listener list = " + getCacheListenerNames(aRegion));
}
/**
* Initializes the listener list with ListenerPrms.maxListeners entries
*
* @param aRegion - the targeted region for the listener operation
*/
protected void initListener(Region aRegion) {
int maxListeners = TestConfig.tab().intAt(ListenerPrms.maxListeners, 10);
StringBuffer aStr = new StringBuffer();
// initialize with a minimum of 3 listeners
int randInt = TestConfig.tab().getRandGen().nextInt(3, maxListeners-1);
CacheListener[] newListenerList = new CacheListener[randInt];
for (int i=0; i < randInt; i++) {
newListenerList[i] = getNewListener();
aStr.append( ((MultiListener)newListenerList[i]).getName() + ":" );
}
Log.getLogWriter().info("Initializing cacheListeners with " + aStr);
aRegion.getAttributesMutator().initCacheListeners( newListenerList );
Log.getLogWriter().info("After initCacheListeners, list = " + getCacheListenerNames(aRegion));
}
/**
* Initializes the listener list with a single listener (set vs. init)
*
* @param aRegion - the targeted region for the listener operation
*/
protected void setListener(Region aRegion) {
AttributesMutator mutator = aRegion.getAttributesMutator();
Log.getLogWriter().info("Clearing existing listenerList of " + getCacheListenerNames(aRegion));
// Clear out existing listeners (to avoid IllegalStateException if > 1)
mutator.initCacheListeners( null );
Log.getLogWriter().info("After init (with null array) list = " + getCacheListenerNames(aRegion));
CacheListener newListener = getNewListener();
Log.getLogWriter().info("setListener calling setCacheListener with " + ((MultiListener)newListener).getName());
// Add a random listener from the list of availableListeners
mutator.setCacheListener( newListener );
Log.getLogWriter().info("After setCacheListener cacheListenerList = " + getCacheListenerNames(aRegion));
}
/**
* Writes the listener list for the indicated region out to the BB
*
* @param aRegion - the targeted region
*
* @see ListenerBB.ExpectedListeners
*/
protected void writeExpectedListenerListToBB(Region aRegion) {
String expected = getCacheListenerNames(aRegion);
String clientName = System.getProperty( "clientName" );
String key = ListenerBB.ExpectedListeners + clientName + "_" + aRegion.getName();
ListenerBB.getBB().getSharedMap().put(key, expected);
}
/**
* Compares the Expected and Invoked Listener Lists in ListenerBB
*
* @param regionName - name of targeted region
*
* @see ListenerBB.ExpectedListeners
* @see ListenerBB.InvokedListeners
*/
protected void compareListenerLists(String regionName) {
String clientName = System.getProperty( "clientName" );
String key = ListenerBB.ExpectedListeners + clientName + "_" + regionName;
String expected = (String)ListenerBB.getBB().getSharedMap().get(key);
Log.getLogWriter().info("Expected listener list (" + key + ") = " + expected);
key = ListenerBB.InvokedListeners + clientName + "_" + regionName;
String invoked = (String)ListenerBB.getBB().getSharedMap().get(key);
Log.getLogWriter().info("Invoked listener list (" + key + ") = " + invoked);
// It's possible that we didn't do any actual operations (if there were
// no keys to invalidate, etc.
if (invoked.equals(""))
return;
if (!expected.equals(invoked)) {
StringBuffer aStr = new StringBuffer();
aStr.append("Listeners may not have been invoked in order expected.\n");
aStr.append("ExpectedList = " + expected + "\n");
aStr.append("InvokedList = " + invoked + "\n");
throw new TestException(aStr.toString());
}
}
/**
* Utility method to get a string containing the names of the listeners
* (separated by ":") for the given region.
*/
protected String getCacheListenerNames(Region aRegion) {
StringBuffer aStr = new StringBuffer();
CacheListener[] list = aRegion.getAttributes().getCacheListeners();
for (int i=0; i < list.length; i++) {
aStr.append( ((MultiListener)list[i]).getName() + ":");
}
return aStr.toString();
}
/**
* Clears the InvokedListener list in the BB.
*
* @param regionName - name of targeted region (for cacheListener & cache Operations)
*/
protected void clearInvokedListenerList(String regionName) {
String clientName = System.getProperty( "clientName" );
String key = ListenerBB.InvokedListeners + clientName + "_" + regionName;
ListenerBB.getBB().getSharedMap().put(key, "");
}
}
| 33.425926 | 180 | 0.669183 |
6a2ca2253590d9e8ca060ec2cbbdd5865cac30c7 | 113,060 | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.authorization.fluent;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;
import com.azure.resourcemanager.authorization.fluent.models.ApplicationsAddKeyRequestBodyInner;
import com.azure.resourcemanager.authorization.fluent.models.ApplicationsAddPasswordRequestBodyInner;
import com.azure.resourcemanager.authorization.fluent.models.ApplicationsCheckMemberGroupsRequestBody;
import com.azure.resourcemanager.authorization.fluent.models.ApplicationsCheckMemberObjectsRequestBody;
import com.azure.resourcemanager.authorization.fluent.models.ApplicationsExpand;
import com.azure.resourcemanager.authorization.fluent.models.ApplicationsGetAvailableExtensionPropertiesRequestBody;
import com.azure.resourcemanager.authorization.fluent.models.ApplicationsGetByIdsRequestBody;
import com.azure.resourcemanager.authorization.fluent.models.ApplicationsGetMemberGroupsRequestBody;
import com.azure.resourcemanager.authorization.fluent.models.ApplicationsGetMemberObjectsRequestBody;
import com.azure.resourcemanager.authorization.fluent.models.ApplicationsOrderby;
import com.azure.resourcemanager.authorization.fluent.models.ApplicationsRemoveKeyRequestBody;
import com.azure.resourcemanager.authorization.fluent.models.ApplicationsRemovePasswordRequestBody;
import com.azure.resourcemanager.authorization.fluent.models.ApplicationsSelect;
import com.azure.resourcemanager.authorization.fluent.models.ApplicationsValidatePropertiesRequestBody;
import com.azure.resourcemanager.authorization.fluent.models.Get1ItemsItem;
import com.azure.resourcemanager.authorization.fluent.models.MicrosoftGraphApplicationInner;
import com.azure.resourcemanager.authorization.fluent.models.MicrosoftGraphDirectoryObjectInner;
import com.azure.resourcemanager.authorization.fluent.models.MicrosoftGraphExtensionPropertyInner;
import com.azure.resourcemanager.authorization.fluent.models.MicrosoftGraphHomeRealmDiscoveryPolicyInner;
import com.azure.resourcemanager.authorization.fluent.models.MicrosoftGraphKeyCredentialInner;
import com.azure.resourcemanager.authorization.fluent.models.MicrosoftGraphPasswordCredentialInner;
import com.azure.resourcemanager.authorization.fluent.models.MicrosoftGraphTokenIssuancePolicyInner;
import com.azure.resourcemanager.authorization.fluent.models.MicrosoftGraphTokenLifetimePolicyInner;
import java.util.List;
import java.util.Map;
import reactor.core.publisher.Mono;
/** An instance of this class provides access to all the operations defined in ApplicationsClient. */
public interface ApplicationsClient {
/**
* Get createdOnBehalfOf from applications.
*
* @param applicationId key: id of application.
* @param select Select properties to be returned.
* @param expand Expand related entities.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return createdOnBehalfOf from applications.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<MicrosoftGraphDirectoryObjectInner>> getCreatedOnBehalfOfWithResponseAsync(
String applicationId, List<Get1ItemsItem> select, List<String> expand);
/**
* Get createdOnBehalfOf from applications.
*
* @param applicationId key: id of application.
* @param select Select properties to be returned.
* @param expand Expand related entities.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return createdOnBehalfOf from applications.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<MicrosoftGraphDirectoryObjectInner> getCreatedOnBehalfOfAsync(
String applicationId, List<Get1ItemsItem> select, List<String> expand);
/**
* Get createdOnBehalfOf from applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return createdOnBehalfOf from applications.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<MicrosoftGraphDirectoryObjectInner> getCreatedOnBehalfOfAsync(String applicationId);
/**
* Get createdOnBehalfOf from applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return createdOnBehalfOf from applications.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
MicrosoftGraphDirectoryObjectInner getCreatedOnBehalfOf(String applicationId);
/**
* Get createdOnBehalfOf from applications.
*
* @param applicationId key: id of application.
* @param select Select properties to be returned.
* @param expand Expand related entities.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return createdOnBehalfOf from applications.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<MicrosoftGraphDirectoryObjectInner> getCreatedOnBehalfOfWithResponse(
String applicationId, List<Get1ItemsItem> select, List<String> expand, Context context);
/**
* Get ref of createdOnBehalfOf from applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return ref of createdOnBehalfOf from applications.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<String>> getRefCreatedOnBehalfOfWithResponseAsync(String applicationId);
/**
* Get ref of createdOnBehalfOf from applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return ref of createdOnBehalfOf from applications.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<String> getRefCreatedOnBehalfOfAsync(String applicationId);
/**
* Get ref of createdOnBehalfOf from applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return ref of createdOnBehalfOf from applications.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
String getRefCreatedOnBehalfOf(String applicationId);
/**
* Get ref of createdOnBehalfOf from applications.
*
* @param applicationId key: id of application.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return ref of createdOnBehalfOf from applications.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<String> getRefCreatedOnBehalfOfWithResponse(String applicationId, Context context);
/**
* Update the ref of navigation property createdOnBehalfOf in applications.
*
* @param applicationId key: id of application.
* @param body New navigation property ref values.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<Void>> setRefCreatedOnBehalfOfWithResponseAsync(String applicationId, Map<String, Object> body);
/**
* Update the ref of navigation property createdOnBehalfOf in applications.
*
* @param applicationId key: id of application.
* @param body New navigation property ref values.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Void> setRefCreatedOnBehalfOfAsync(String applicationId, Map<String, Object> body);
/**
* Update the ref of navigation property createdOnBehalfOf in applications.
*
* @param applicationId key: id of application.
* @param body New navigation property ref values.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
void setRefCreatedOnBehalfOf(String applicationId, Map<String, Object> body);
/**
* Update the ref of navigation property createdOnBehalfOf in applications.
*
* @param applicationId key: id of application.
* @param body New navigation property ref values.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<Void> setRefCreatedOnBehalfOfWithResponse(String applicationId, Map<String, Object> body, Context context);
/**
* Delete ref of navigation property createdOnBehalfOf for applications.
*
* @param applicationId key: id of application.
* @param ifMatch ETag.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<Void>> deleteRefCreatedOnBehalfOfWithResponseAsync(String applicationId, String ifMatch);
/**
* Delete ref of navigation property createdOnBehalfOf for applications.
*
* @param applicationId key: id of application.
* @param ifMatch ETag.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Void> deleteRefCreatedOnBehalfOfAsync(String applicationId, String ifMatch);
/**
* Delete ref of navigation property createdOnBehalfOf for applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Void> deleteRefCreatedOnBehalfOfAsync(String applicationId);
/**
* Delete ref of navigation property createdOnBehalfOf for applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
void deleteRefCreatedOnBehalfOf(String applicationId);
/**
* Delete ref of navigation property createdOnBehalfOf for applications.
*
* @param applicationId key: id of application.
* @param ifMatch ETag.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<Void> deleteRefCreatedOnBehalfOfWithResponse(String applicationId, String ifMatch, Context context);
/**
* Get extensionProperties from applications.
*
* @param applicationId key: id of application.
* @param top Show only the first n items.
* @param skip Skip the first n items.
* @param search Search items by search phrases.
* @param filter Filter items by property values.
* @param count Include count of items.
* @param orderby Order items by property values.
* @param select Select properties to be returned.
* @param expand Expand related entities.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return extensionProperties from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedFlux<MicrosoftGraphExtensionPropertyInner> listExtensionPropertiesAsync(
String applicationId,
Integer top,
Integer skip,
String search,
String filter,
Boolean count,
List<ApplicationsOrderby> orderby,
List<ApplicationsSelect> select,
List<String> expand);
/**
* Get extensionProperties from applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return extensionProperties from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedFlux<MicrosoftGraphExtensionPropertyInner> listExtensionPropertiesAsync(String applicationId);
/**
* Get extensionProperties from applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return extensionProperties from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<MicrosoftGraphExtensionPropertyInner> listExtensionProperties(String applicationId);
/**
* Get extensionProperties from applications.
*
* @param applicationId key: id of application.
* @param top Show only the first n items.
* @param skip Skip the first n items.
* @param search Search items by search phrases.
* @param filter Filter items by property values.
* @param count Include count of items.
* @param orderby Order items by property values.
* @param select Select properties to be returned.
* @param expand Expand related entities.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return extensionProperties from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<MicrosoftGraphExtensionPropertyInner> listExtensionProperties(
String applicationId,
Integer top,
Integer skip,
String search,
String filter,
Boolean count,
List<ApplicationsOrderby> orderby,
List<ApplicationsSelect> select,
List<String> expand,
Context context);
/**
* Create new navigation property to extensionProperties for applications.
*
* @param applicationId key: id of application.
* @param body New navigation property.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return represents an Azure Active Directory object.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<MicrosoftGraphExtensionPropertyInner>> createExtensionPropertiesWithResponseAsync(
String applicationId, MicrosoftGraphExtensionPropertyInner body);
/**
* Create new navigation property to extensionProperties for applications.
*
* @param applicationId key: id of application.
* @param body New navigation property.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return represents an Azure Active Directory object.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<MicrosoftGraphExtensionPropertyInner> createExtensionPropertiesAsync(
String applicationId, MicrosoftGraphExtensionPropertyInner body);
/**
* Create new navigation property to extensionProperties for applications.
*
* @param applicationId key: id of application.
* @param body New navigation property.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return represents an Azure Active Directory object.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
MicrosoftGraphExtensionPropertyInner createExtensionProperties(
String applicationId, MicrosoftGraphExtensionPropertyInner body);
/**
* Create new navigation property to extensionProperties for applications.
*
* @param applicationId key: id of application.
* @param body New navigation property.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return represents an Azure Active Directory object.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<MicrosoftGraphExtensionPropertyInner> createExtensionPropertiesWithResponse(
String applicationId, MicrosoftGraphExtensionPropertyInner body, Context context);
/**
* Get extensionProperties from applications.
*
* @param applicationId key: id of application.
* @param extensionPropertyId key: id of extensionProperty.
* @param select Select properties to be returned.
* @param expand Expand related entities.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return extensionProperties from applications.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<MicrosoftGraphExtensionPropertyInner>> getExtensionPropertiesWithResponseAsync(
String applicationId, String extensionPropertyId, List<ApplicationsSelect> select, List<String> expand);
/**
* Get extensionProperties from applications.
*
* @param applicationId key: id of application.
* @param extensionPropertyId key: id of extensionProperty.
* @param select Select properties to be returned.
* @param expand Expand related entities.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return extensionProperties from applications.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<MicrosoftGraphExtensionPropertyInner> getExtensionPropertiesAsync(
String applicationId, String extensionPropertyId, List<ApplicationsSelect> select, List<String> expand);
/**
* Get extensionProperties from applications.
*
* @param applicationId key: id of application.
* @param extensionPropertyId key: id of extensionProperty.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return extensionProperties from applications.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<MicrosoftGraphExtensionPropertyInner> getExtensionPropertiesAsync(
String applicationId, String extensionPropertyId);
/**
* Get extensionProperties from applications.
*
* @param applicationId key: id of application.
* @param extensionPropertyId key: id of extensionProperty.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return extensionProperties from applications.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
MicrosoftGraphExtensionPropertyInner getExtensionProperties(String applicationId, String extensionPropertyId);
/**
* Get extensionProperties from applications.
*
* @param applicationId key: id of application.
* @param extensionPropertyId key: id of extensionProperty.
* @param select Select properties to be returned.
* @param expand Expand related entities.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return extensionProperties from applications.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<MicrosoftGraphExtensionPropertyInner> getExtensionPropertiesWithResponse(
String applicationId,
String extensionPropertyId,
List<ApplicationsSelect> select,
List<String> expand,
Context context);
/**
* Update the navigation property extensionProperties in applications.
*
* @param applicationId key: id of application.
* @param extensionPropertyId key: id of extensionProperty.
* @param body New navigation property values.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<Void>> updateExtensionPropertiesWithResponseAsync(
String applicationId, String extensionPropertyId, MicrosoftGraphExtensionPropertyInner body);
/**
* Update the navigation property extensionProperties in applications.
*
* @param applicationId key: id of application.
* @param extensionPropertyId key: id of extensionProperty.
* @param body New navigation property values.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Void> updateExtensionPropertiesAsync(
String applicationId, String extensionPropertyId, MicrosoftGraphExtensionPropertyInner body);
/**
* Update the navigation property extensionProperties in applications.
*
* @param applicationId key: id of application.
* @param extensionPropertyId key: id of extensionProperty.
* @param body New navigation property values.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
void updateExtensionProperties(
String applicationId, String extensionPropertyId, MicrosoftGraphExtensionPropertyInner body);
/**
* Update the navigation property extensionProperties in applications.
*
* @param applicationId key: id of application.
* @param extensionPropertyId key: id of extensionProperty.
* @param body New navigation property values.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<Void> updateExtensionPropertiesWithResponse(
String applicationId, String extensionPropertyId, MicrosoftGraphExtensionPropertyInner body, Context context);
/**
* Delete navigation property extensionProperties for applications.
*
* @param applicationId key: id of application.
* @param extensionPropertyId key: id of extensionProperty.
* @param ifMatch ETag.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<Void>> deleteExtensionPropertiesWithResponseAsync(
String applicationId, String extensionPropertyId, String ifMatch);
/**
* Delete navigation property extensionProperties for applications.
*
* @param applicationId key: id of application.
* @param extensionPropertyId key: id of extensionProperty.
* @param ifMatch ETag.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Void> deleteExtensionPropertiesAsync(String applicationId, String extensionPropertyId, String ifMatch);
/**
* Delete navigation property extensionProperties for applications.
*
* @param applicationId key: id of application.
* @param extensionPropertyId key: id of extensionProperty.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Void> deleteExtensionPropertiesAsync(String applicationId, String extensionPropertyId);
/**
* Delete navigation property extensionProperties for applications.
*
* @param applicationId key: id of application.
* @param extensionPropertyId key: id of extensionProperty.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
void deleteExtensionProperties(String applicationId, String extensionPropertyId);
/**
* Delete navigation property extensionProperties for applications.
*
* @param applicationId key: id of application.
* @param extensionPropertyId key: id of extensionProperty.
* @param ifMatch ETag.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<Void> deleteExtensionPropertiesWithResponse(
String applicationId, String extensionPropertyId, String ifMatch, Context context);
/**
* Get homeRealmDiscoveryPolicies from applications.
*
* @param applicationId key: id of application.
* @param top Show only the first n items.
* @param skip Skip the first n items.
* @param search Search items by search phrases.
* @param filter Filter items by property values.
* @param count Include count of items.
* @param orderby Order items by property values.
* @param select Select properties to be returned.
* @param expand Expand related entities.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return homeRealmDiscoveryPolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedFlux<MicrosoftGraphHomeRealmDiscoveryPolicyInner> listHomeRealmDiscoveryPoliciesAsync(
String applicationId,
Integer top,
Integer skip,
String search,
String filter,
Boolean count,
List<ApplicationsOrderby> orderby,
List<ApplicationsSelect> select,
List<ApplicationsExpand> expand);
/**
* Get homeRealmDiscoveryPolicies from applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return homeRealmDiscoveryPolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedFlux<MicrosoftGraphHomeRealmDiscoveryPolicyInner> listHomeRealmDiscoveryPoliciesAsync(String applicationId);
/**
* Get homeRealmDiscoveryPolicies from applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return homeRealmDiscoveryPolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<MicrosoftGraphHomeRealmDiscoveryPolicyInner> listHomeRealmDiscoveryPolicies(String applicationId);
/**
* Get homeRealmDiscoveryPolicies from applications.
*
* @param applicationId key: id of application.
* @param top Show only the first n items.
* @param skip Skip the first n items.
* @param search Search items by search phrases.
* @param filter Filter items by property values.
* @param count Include count of items.
* @param orderby Order items by property values.
* @param select Select properties to be returned.
* @param expand Expand related entities.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return homeRealmDiscoveryPolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<MicrosoftGraphHomeRealmDiscoveryPolicyInner> listHomeRealmDiscoveryPolicies(
String applicationId,
Integer top,
Integer skip,
String search,
String filter,
Boolean count,
List<ApplicationsOrderby> orderby,
List<ApplicationsSelect> select,
List<ApplicationsExpand> expand,
Context context);
/**
* Get ref of homeRealmDiscoveryPolicies from applications.
*
* @param applicationId key: id of application.
* @param top Show only the first n items.
* @param skip Skip the first n items.
* @param search Search items by search phrases.
* @param filter Filter items by property values.
* @param count Include count of items.
* @param orderby Order items by property values.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return ref of homeRealmDiscoveryPolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedFlux<String> listRefHomeRealmDiscoveryPoliciesAsync(
String applicationId,
Integer top,
Integer skip,
String search,
String filter,
Boolean count,
List<ApplicationsOrderby> orderby);
/**
* Get ref of homeRealmDiscoveryPolicies from applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return ref of homeRealmDiscoveryPolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedFlux<String> listRefHomeRealmDiscoveryPoliciesAsync(String applicationId);
/**
* Get ref of homeRealmDiscoveryPolicies from applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return ref of homeRealmDiscoveryPolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<String> listRefHomeRealmDiscoveryPolicies(String applicationId);
/**
* Get ref of homeRealmDiscoveryPolicies from applications.
*
* @param applicationId key: id of application.
* @param top Show only the first n items.
* @param skip Skip the first n items.
* @param search Search items by search phrases.
* @param filter Filter items by property values.
* @param count Include count of items.
* @param orderby Order items by property values.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return ref of homeRealmDiscoveryPolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<String> listRefHomeRealmDiscoveryPolicies(
String applicationId,
Integer top,
Integer skip,
String search,
String filter,
Boolean count,
List<ApplicationsOrderby> orderby,
Context context);
/**
* Create new navigation property ref to homeRealmDiscoveryPolicies for applications.
*
* @param applicationId key: id of application.
* @param body New navigation property ref value.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return dictionary of <any>.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<Map<String, Object>>> createRefHomeRealmDiscoveryPoliciesWithResponseAsync(
String applicationId, Map<String, Object> body);
/**
* Create new navigation property ref to homeRealmDiscoveryPolicies for applications.
*
* @param applicationId key: id of application.
* @param body New navigation property ref value.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return dictionary of <any>.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Map<String, Object>> createRefHomeRealmDiscoveryPoliciesAsync(String applicationId, Map<String, Object> body);
/**
* Create new navigation property ref to homeRealmDiscoveryPolicies for applications.
*
* @param applicationId key: id of application.
* @param body New navigation property ref value.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return dictionary of <any>.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Map<String, Object> createRefHomeRealmDiscoveryPolicies(String applicationId, Map<String, Object> body);
/**
* Create new navigation property ref to homeRealmDiscoveryPolicies for applications.
*
* @param applicationId key: id of application.
* @param body New navigation property ref value.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return dictionary of <any>.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<Map<String, Object>> createRefHomeRealmDiscoveryPoliciesWithResponse(
String applicationId, Map<String, Object> body, Context context);
/**
* Invoke action addKey.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return keyCredential.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<MicrosoftGraphKeyCredentialInner>> addKeyWithResponseAsync(
String applicationId, ApplicationsAddKeyRequestBodyInner body);
/**
* Invoke action addKey.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return keyCredential.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<MicrosoftGraphKeyCredentialInner> addKeyAsync(String applicationId, ApplicationsAddKeyRequestBodyInner body);
/**
* Invoke action addKey.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return keyCredential.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
MicrosoftGraphKeyCredentialInner addKey(String applicationId, ApplicationsAddKeyRequestBodyInner body);
/**
* Invoke action addKey.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return keyCredential.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<MicrosoftGraphKeyCredentialInner> addKeyWithResponse(
String applicationId, ApplicationsAddKeyRequestBodyInner body, Context context);
/**
* Invoke action addPassword.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return passwordCredential.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<MicrosoftGraphPasswordCredentialInner>> addPasswordWithResponseAsync(
String applicationId, ApplicationsAddPasswordRequestBodyInner body);
/**
* Invoke action addPassword.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return passwordCredential.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<MicrosoftGraphPasswordCredentialInner> addPasswordAsync(
String applicationId, ApplicationsAddPasswordRequestBodyInner body);
/**
* Invoke action addPassword.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return passwordCredential.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
MicrosoftGraphPasswordCredentialInner addPassword(
String applicationId, ApplicationsAddPasswordRequestBodyInner body);
/**
* Invoke action addPassword.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return passwordCredential.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<MicrosoftGraphPasswordCredentialInner> addPasswordWithResponse(
String applicationId, ApplicationsAddPasswordRequestBodyInner body, Context context);
/**
* Invoke action checkMemberGroups.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of Post200ApplicationJsonItemsItem.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<List<String>>> checkMemberGroupsWithResponseAsync(
String applicationId, ApplicationsCheckMemberGroupsRequestBody body);
/**
* Invoke action checkMemberGroups.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of Post200ApplicationJsonItemsItem.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<List<String>> checkMemberGroupsAsync(String applicationId, ApplicationsCheckMemberGroupsRequestBody body);
/**
* Invoke action checkMemberGroups.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of Post200ApplicationJsonItemsItem.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
List<String> checkMemberGroups(String applicationId, ApplicationsCheckMemberGroupsRequestBody body);
/**
* Invoke action checkMemberGroups.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of Post200ApplicationJsonItemsItem.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<List<String>> checkMemberGroupsWithResponse(
String applicationId, ApplicationsCheckMemberGroupsRequestBody body, Context context);
/**
* Invoke action checkMemberObjects.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of String.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<List<String>>> checkMemberObjectsWithResponseAsync(
String applicationId, ApplicationsCheckMemberObjectsRequestBody body);
/**
* Invoke action checkMemberObjects.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of String.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<List<String>> checkMemberObjectsAsync(String applicationId, ApplicationsCheckMemberObjectsRequestBody body);
/**
* Invoke action checkMemberObjects.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of String.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
List<String> checkMemberObjects(String applicationId, ApplicationsCheckMemberObjectsRequestBody body);
/**
* Invoke action checkMemberObjects.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of String.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<List<String>> checkMemberObjectsWithResponse(
String applicationId, ApplicationsCheckMemberObjectsRequestBody body, Context context);
/**
* Invoke action getMemberGroups.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of String.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<List<String>>> getMemberGroupsWithResponseAsync(
String applicationId, ApplicationsGetMemberGroupsRequestBody body);
/**
* Invoke action getMemberGroups.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of String.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<List<String>> getMemberGroupsAsync(String applicationId, ApplicationsGetMemberGroupsRequestBody body);
/**
* Invoke action getMemberGroups.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of String.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
List<String> getMemberGroups(String applicationId, ApplicationsGetMemberGroupsRequestBody body);
/**
* Invoke action getMemberGroups.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of String.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<List<String>> getMemberGroupsWithResponse(
String applicationId, ApplicationsGetMemberGroupsRequestBody body, Context context);
/**
* Invoke action getMemberObjects.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of String.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<List<String>>> getMemberObjectsWithResponseAsync(
String applicationId, ApplicationsGetMemberObjectsRequestBody body);
/**
* Invoke action getMemberObjects.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of String.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<List<String>> getMemberObjectsAsync(String applicationId, ApplicationsGetMemberObjectsRequestBody body);
/**
* Invoke action getMemberObjects.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of String.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
List<String> getMemberObjects(String applicationId, ApplicationsGetMemberObjectsRequestBody body);
/**
* Invoke action getMemberObjects.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of String.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<List<String>> getMemberObjectsWithResponse(
String applicationId, ApplicationsGetMemberObjectsRequestBody body, Context context);
/**
* Invoke action removeKey.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<Void>> removeKeyWithResponseAsync(String applicationId, ApplicationsRemoveKeyRequestBody body);
/**
* Invoke action removeKey.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Void> removeKeyAsync(String applicationId, ApplicationsRemoveKeyRequestBody body);
/**
* Invoke action removeKey.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
void removeKey(String applicationId, ApplicationsRemoveKeyRequestBody body);
/**
* Invoke action removeKey.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<Void> removeKeyWithResponse(String applicationId, ApplicationsRemoveKeyRequestBody body, Context context);
/**
* Invoke action removePassword.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<Void>> removePasswordWithResponseAsync(
String applicationId, ApplicationsRemovePasswordRequestBody body);
/**
* Invoke action removePassword.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Void> removePasswordAsync(String applicationId, ApplicationsRemovePasswordRequestBody body);
/**
* Invoke action removePassword.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
void removePassword(String applicationId, ApplicationsRemovePasswordRequestBody body);
/**
* Invoke action removePassword.
*
* @param applicationId key: id of application.
* @param body Action parameters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<Void> removePasswordWithResponse(
String applicationId, ApplicationsRemovePasswordRequestBody body, Context context);
/**
* Invoke action restore.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return represents an Azure Active Directory object.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<MicrosoftGraphDirectoryObjectInner>> restoreWithResponseAsync(String applicationId);
/**
* Invoke action restore.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return represents an Azure Active Directory object.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<MicrosoftGraphDirectoryObjectInner> restoreAsync(String applicationId);
/**
* Invoke action restore.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return represents an Azure Active Directory object.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
MicrosoftGraphDirectoryObjectInner restore(String applicationId);
/**
* Invoke action restore.
*
* @param applicationId key: id of application.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return represents an Azure Active Directory object.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<MicrosoftGraphDirectoryObjectInner> restoreWithResponse(String applicationId, Context context);
/**
* Get owners from applications.
*
* @param applicationId key: id of application.
* @param top Show only the first n items.
* @param skip Skip the first n items.
* @param search Search items by search phrases.
* @param filter Filter items by property values.
* @param count Include count of items.
* @param orderby Order items by property values.
* @param select Select properties to be returned.
* @param expand Expand related entities.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return owners from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedFlux<MicrosoftGraphDirectoryObjectInner> listOwnersAsync(
String applicationId,
Integer top,
Integer skip,
String search,
String filter,
Boolean count,
List<ApplicationsOrderby> orderby,
List<ApplicationsSelect> select,
List<String> expand);
/**
* Get owners from applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return owners from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedFlux<MicrosoftGraphDirectoryObjectInner> listOwnersAsync(String applicationId);
/**
* Get owners from applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return owners from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<MicrosoftGraphDirectoryObjectInner> listOwners(String applicationId);
/**
* Get owners from applications.
*
* @param applicationId key: id of application.
* @param top Show only the first n items.
* @param skip Skip the first n items.
* @param search Search items by search phrases.
* @param filter Filter items by property values.
* @param count Include count of items.
* @param orderby Order items by property values.
* @param select Select properties to be returned.
* @param expand Expand related entities.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return owners from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<MicrosoftGraphDirectoryObjectInner> listOwners(
String applicationId,
Integer top,
Integer skip,
String search,
String filter,
Boolean count,
List<ApplicationsOrderby> orderby,
List<ApplicationsSelect> select,
List<String> expand,
Context context);
/**
* Get ref of owners from applications.
*
* @param applicationId key: id of application.
* @param top Show only the first n items.
* @param skip Skip the first n items.
* @param search Search items by search phrases.
* @param filter Filter items by property values.
* @param count Include count of items.
* @param orderby Order items by property values.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return ref of owners from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedFlux<String> listRefOwnersAsync(
String applicationId,
Integer top,
Integer skip,
String search,
String filter,
Boolean count,
List<ApplicationsOrderby> orderby);
/**
* Get ref of owners from applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return ref of owners from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedFlux<String> listRefOwnersAsync(String applicationId);
/**
* Get ref of owners from applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return ref of owners from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<String> listRefOwners(String applicationId);
/**
* Get ref of owners from applications.
*
* @param applicationId key: id of application.
* @param top Show only the first n items.
* @param skip Skip the first n items.
* @param search Search items by search phrases.
* @param filter Filter items by property values.
* @param count Include count of items.
* @param orderby Order items by property values.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return ref of owners from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<String> listRefOwners(
String applicationId,
Integer top,
Integer skip,
String search,
String filter,
Boolean count,
List<ApplicationsOrderby> orderby,
Context context);
/**
* Create new navigation property ref to owners for applications.
*
* @param applicationId key: id of application.
* @param body New navigation property ref value.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return dictionary of <any>.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<Map<String, Object>>> createRefOwnersWithResponseAsync(
String applicationId, Map<String, Object> body);
/**
* Create new navigation property ref to owners for applications.
*
* @param applicationId key: id of application.
* @param body New navigation property ref value.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return dictionary of <any>.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Map<String, Object>> createRefOwnersAsync(String applicationId, Map<String, Object> body);
/**
* Create new navigation property ref to owners for applications.
*
* @param applicationId key: id of application.
* @param body New navigation property ref value.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return dictionary of <any>.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Map<String, Object> createRefOwners(String applicationId, Map<String, Object> body);
/**
* Create new navigation property ref to owners for applications.
*
* @param applicationId key: id of application.
* @param body New navigation property ref value.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return dictionary of <any>.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<Map<String, Object>> createRefOwnersWithResponse(
String applicationId, Map<String, Object> body, Context context);
/**
* Get tokenIssuancePolicies from applications.
*
* @param applicationId key: id of application.
* @param top Show only the first n items.
* @param skip Skip the first n items.
* @param search Search items by search phrases.
* @param filter Filter items by property values.
* @param count Include count of items.
* @param orderby Order items by property values.
* @param select Select properties to be returned.
* @param expand Expand related entities.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return tokenIssuancePolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedFlux<MicrosoftGraphTokenIssuancePolicyInner> listTokenIssuancePoliciesAsync(
String applicationId,
Integer top,
Integer skip,
String search,
String filter,
Boolean count,
List<ApplicationsOrderby> orderby,
List<ApplicationsSelect> select,
List<ApplicationsExpand> expand);
/**
* Get tokenIssuancePolicies from applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return tokenIssuancePolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedFlux<MicrosoftGraphTokenIssuancePolicyInner> listTokenIssuancePoliciesAsync(String applicationId);
/**
* Get tokenIssuancePolicies from applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return tokenIssuancePolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<MicrosoftGraphTokenIssuancePolicyInner> listTokenIssuancePolicies(String applicationId);
/**
* Get tokenIssuancePolicies from applications.
*
* @param applicationId key: id of application.
* @param top Show only the first n items.
* @param skip Skip the first n items.
* @param search Search items by search phrases.
* @param filter Filter items by property values.
* @param count Include count of items.
* @param orderby Order items by property values.
* @param select Select properties to be returned.
* @param expand Expand related entities.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return tokenIssuancePolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<MicrosoftGraphTokenIssuancePolicyInner> listTokenIssuancePolicies(
String applicationId,
Integer top,
Integer skip,
String search,
String filter,
Boolean count,
List<ApplicationsOrderby> orderby,
List<ApplicationsSelect> select,
List<ApplicationsExpand> expand,
Context context);
/**
* Get ref of tokenIssuancePolicies from applications.
*
* @param applicationId key: id of application.
* @param top Show only the first n items.
* @param skip Skip the first n items.
* @param search Search items by search phrases.
* @param filter Filter items by property values.
* @param count Include count of items.
* @param orderby Order items by property values.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return ref of tokenIssuancePolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedFlux<String> listRefTokenIssuancePoliciesAsync(
String applicationId,
Integer top,
Integer skip,
String search,
String filter,
Boolean count,
List<ApplicationsOrderby> orderby);
/**
* Get ref of tokenIssuancePolicies from applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return ref of tokenIssuancePolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedFlux<String> listRefTokenIssuancePoliciesAsync(String applicationId);
/**
* Get ref of tokenIssuancePolicies from applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return ref of tokenIssuancePolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<String> listRefTokenIssuancePolicies(String applicationId);
/**
* Get ref of tokenIssuancePolicies from applications.
*
* @param applicationId key: id of application.
* @param top Show only the first n items.
* @param skip Skip the first n items.
* @param search Search items by search phrases.
* @param filter Filter items by property values.
* @param count Include count of items.
* @param orderby Order items by property values.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return ref of tokenIssuancePolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<String> listRefTokenIssuancePolicies(
String applicationId,
Integer top,
Integer skip,
String search,
String filter,
Boolean count,
List<ApplicationsOrderby> orderby,
Context context);
/**
* Create new navigation property ref to tokenIssuancePolicies for applications.
*
* @param applicationId key: id of application.
* @param body New navigation property ref value.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return dictionary of <any>.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<Map<String, Object>>> createRefTokenIssuancePoliciesWithResponseAsync(
String applicationId, Map<String, Object> body);
/**
* Create new navigation property ref to tokenIssuancePolicies for applications.
*
* @param applicationId key: id of application.
* @param body New navigation property ref value.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return dictionary of <any>.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Map<String, Object>> createRefTokenIssuancePoliciesAsync(String applicationId, Map<String, Object> body);
/**
* Create new navigation property ref to tokenIssuancePolicies for applications.
*
* @param applicationId key: id of application.
* @param body New navigation property ref value.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return dictionary of <any>.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Map<String, Object> createRefTokenIssuancePolicies(String applicationId, Map<String, Object> body);
/**
* Create new navigation property ref to tokenIssuancePolicies for applications.
*
* @param applicationId key: id of application.
* @param body New navigation property ref value.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return dictionary of <any>.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<Map<String, Object>> createRefTokenIssuancePoliciesWithResponse(
String applicationId, Map<String, Object> body, Context context);
/**
* Get tokenLifetimePolicies from applications.
*
* @param applicationId key: id of application.
* @param top Show only the first n items.
* @param skip Skip the first n items.
* @param search Search items by search phrases.
* @param filter Filter items by property values.
* @param count Include count of items.
* @param orderby Order items by property values.
* @param select Select properties to be returned.
* @param expand Expand related entities.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return tokenLifetimePolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedFlux<MicrosoftGraphTokenLifetimePolicyInner> listTokenLifetimePoliciesAsync(
String applicationId,
Integer top,
Integer skip,
String search,
String filter,
Boolean count,
List<ApplicationsOrderby> orderby,
List<ApplicationsSelect> select,
List<ApplicationsExpand> expand);
/**
* Get tokenLifetimePolicies from applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return tokenLifetimePolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedFlux<MicrosoftGraphTokenLifetimePolicyInner> listTokenLifetimePoliciesAsync(String applicationId);
/**
* Get tokenLifetimePolicies from applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return tokenLifetimePolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<MicrosoftGraphTokenLifetimePolicyInner> listTokenLifetimePolicies(String applicationId);
/**
* Get tokenLifetimePolicies from applications.
*
* @param applicationId key: id of application.
* @param top Show only the first n items.
* @param skip Skip the first n items.
* @param search Search items by search phrases.
* @param filter Filter items by property values.
* @param count Include count of items.
* @param orderby Order items by property values.
* @param select Select properties to be returned.
* @param expand Expand related entities.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return tokenLifetimePolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<MicrosoftGraphTokenLifetimePolicyInner> listTokenLifetimePolicies(
String applicationId,
Integer top,
Integer skip,
String search,
String filter,
Boolean count,
List<ApplicationsOrderby> orderby,
List<ApplicationsSelect> select,
List<ApplicationsExpand> expand,
Context context);
/**
* Get ref of tokenLifetimePolicies from applications.
*
* @param applicationId key: id of application.
* @param top Show only the first n items.
* @param skip Skip the first n items.
* @param search Search items by search phrases.
* @param filter Filter items by property values.
* @param count Include count of items.
* @param orderby Order items by property values.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return ref of tokenLifetimePolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedFlux<String> listRefTokenLifetimePoliciesAsync(
String applicationId,
Integer top,
Integer skip,
String search,
String filter,
Boolean count,
List<ApplicationsOrderby> orderby);
/**
* Get ref of tokenLifetimePolicies from applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return ref of tokenLifetimePolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedFlux<String> listRefTokenLifetimePoliciesAsync(String applicationId);
/**
* Get ref of tokenLifetimePolicies from applications.
*
* @param applicationId key: id of application.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return ref of tokenLifetimePolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<String> listRefTokenLifetimePolicies(String applicationId);
/**
* Get ref of tokenLifetimePolicies from applications.
*
* @param applicationId key: id of application.
* @param top Show only the first n items.
* @param skip Skip the first n items.
* @param search Search items by search phrases.
* @param filter Filter items by property values.
* @param count Include count of items.
* @param orderby Order items by property values.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return ref of tokenLifetimePolicies from applications.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<String> listRefTokenLifetimePolicies(
String applicationId,
Integer top,
Integer skip,
String search,
String filter,
Boolean count,
List<ApplicationsOrderby> orderby,
Context context);
/**
* Create new navigation property ref to tokenLifetimePolicies for applications.
*
* @param applicationId key: id of application.
* @param body New navigation property ref value.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return dictionary of <any>.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<Map<String, Object>>> createRefTokenLifetimePoliciesWithResponseAsync(
String applicationId, Map<String, Object> body);
/**
* Create new navigation property ref to tokenLifetimePolicies for applications.
*
* @param applicationId key: id of application.
* @param body New navigation property ref value.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return dictionary of <any>.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Map<String, Object>> createRefTokenLifetimePoliciesAsync(String applicationId, Map<String, Object> body);
/**
* Create new navigation property ref to tokenLifetimePolicies for applications.
*
* @param applicationId key: id of application.
* @param body New navigation property ref value.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return dictionary of <any>.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Map<String, Object> createRefTokenLifetimePolicies(String applicationId, Map<String, Object> body);
/**
* Create new navigation property ref to tokenLifetimePolicies for applications.
*
* @param applicationId key: id of application.
* @param body New navigation property ref value.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return dictionary of <any>.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<Map<String, Object>> createRefTokenLifetimePoliciesWithResponse(
String applicationId, Map<String, Object> body, Context context);
/**
* Invoke function delta.
*
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of microsoft.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<List<MicrosoftGraphApplicationInner>>> deltaWithResponseAsync();
/**
* Invoke function delta.
*
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of microsoft.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<List<MicrosoftGraphApplicationInner>> deltaAsync();
/**
* Invoke function delta.
*
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of microsoft.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
List<MicrosoftGraphApplicationInner> delta();
/**
* Invoke function delta.
*
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of microsoft.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<List<MicrosoftGraphApplicationInner>> deltaWithResponse(Context context);
/**
* Invoke action getAvailableExtensionProperties.
*
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of microsoft.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<List<MicrosoftGraphExtensionPropertyInner>>> getAvailableExtensionPropertiesWithResponseAsync(
ApplicationsGetAvailableExtensionPropertiesRequestBody body);
/**
* Invoke action getAvailableExtensionProperties.
*
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of microsoft.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<List<MicrosoftGraphExtensionPropertyInner>> getAvailableExtensionPropertiesAsync(
ApplicationsGetAvailableExtensionPropertiesRequestBody body);
/**
* Invoke action getAvailableExtensionProperties.
*
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of microsoft.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
List<MicrosoftGraphExtensionPropertyInner> getAvailableExtensionProperties(
ApplicationsGetAvailableExtensionPropertiesRequestBody body);
/**
* Invoke action getAvailableExtensionProperties.
*
* @param body Action parameters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of microsoft.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<List<MicrosoftGraphExtensionPropertyInner>> getAvailableExtensionPropertiesWithResponse(
ApplicationsGetAvailableExtensionPropertiesRequestBody body, Context context);
/**
* Invoke action getByIds.
*
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of microsoft.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<List<MicrosoftGraphDirectoryObjectInner>>> getByIdsWithResponseAsync(
ApplicationsGetByIdsRequestBody body);
/**
* Invoke action getByIds.
*
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of microsoft.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<List<MicrosoftGraphDirectoryObjectInner>> getByIdsAsync(ApplicationsGetByIdsRequestBody body);
/**
* Invoke action getByIds.
*
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of microsoft.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
List<MicrosoftGraphDirectoryObjectInner> getByIds(ApplicationsGetByIdsRequestBody body);
/**
* Invoke action getByIds.
*
* @param body Action parameters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return array of microsoft.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<List<MicrosoftGraphDirectoryObjectInner>> getByIdsWithResponse(
ApplicationsGetByIdsRequestBody body, Context context);
/**
* Invoke action validateProperties.
*
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<Void>> validatePropertiesWithResponseAsync(ApplicationsValidatePropertiesRequestBody body);
/**
* Invoke action validateProperties.
*
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Void> validatePropertiesAsync(ApplicationsValidatePropertiesRequestBody body);
/**
* Invoke action validateProperties.
*
* @param body Action parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
void validateProperties(ApplicationsValidatePropertiesRequestBody body);
/**
* Invoke action validateProperties.
*
* @param body Action parameters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<Void> validatePropertiesWithResponse(ApplicationsValidatePropertiesRequestBody body, Context context);
}
| 48.986135 | 120 | 0.733124 |
2238faac26e6728cfdb634e0693514d4825a66ac | 6,349 | package de.tum.repairchain;
import android.app.ProgressDialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.Button;
import android.widget.ImageView;
import de.tum.repairchain.ipfs.AddIPFSContent;
import java.io.File;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import de.tum.repairchain.ipfs.IPFSDaemon;
import de.tum.repairchain.ipfs.IPFSDaemonService;
import de.tum.repairchain.ipfs.State;
import io.ipfs.kotlin.IPFS;
import io.ipfs.kotlin.model.BandWidthInfo;
import io.ipfs.kotlin.model.VersionInfo;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import static de.tum.repairchain.Constants.*;
import static de.tum.repairchain.Helpers.*;
/**
* Upload Image
*
*
*
*/
public class UploadImage extends AppCompatActivity {
private IPFSDaemon ipfsDaemon = new IPFSDaemon(this);
private boolean running = false;
private String hashString;
// Contains the actual image file
private File imageFile;
private Uri photoURI;
// Contains the directory of the file. Don't know why it is a File type
private File outputDir;
@BindView(R.id.btn_addFile)
Button addFile;
@BindView(R.id.img_photo_taken)
ImageView photoTaken;
@OnClick ({R.id.btn_addFile})
public void clickAddFileButton(Button btn) {
Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
startActivityForResult(cameraIntent, PHOTO_REQUEST);
}
@OnClick ({R.id.btn_done})
public void clickDoneButton(Button btn) {
imageFile.delete();
finish();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_upload_image);
ButterKnife.bind(this);
outputDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);
Log.i("UploadImage", "activity has been called");
if (!ipfsDaemon.isReady()) {
ipfsDaemon.download(this, new Function0<Unit>() {
@Override
public Unit invoke() {
Log.d("Done", "Done");
return null;
}
});
} else {
if (!State.isDaemonRunning) {
startService();
}
}
try {
imageFile = File.createTempFile("tempImage", ".png", outputDir);
photoURI = Uri.fromFile(imageFile);
} catch (Exception e) {
Log.e("UploadImage", "file creation failed", e);
}
}
private void startService() {
startService(new Intent(this, IPFSDaemonService.class));
State.isDaemonRunning = true;
final ProgressDialog progressDialog = new ProgressDialog(this);
progressDialog.setMessage("starting daemon");
progressDialog.show();
new Thread(new Runnable() {
@Override
public void run() {
VersionInfo version = null;
while (version == null) {
try {
Thread.sleep(1000);
version = new IPFS().getInfo().version();
} catch (Exception e) {
Log.d("Exception IPFS", "IPFS daemon is not running.");
}
}
runOnUiThread(new Runnable() {
@Override
public void run() {
progressDialog.dismiss();
startInfoRefresh();
}
});
}
}).start();
}
@Override
protected void onResume() {
super.onResume();
startInfoRefresh();
}
@Override
protected void onPause() {
super.onPause();
running = false;
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.i("UploadImage", "onactivityresult called");
if (resultCode == RETURN_IMAGE_HASH) {
String fileHash = data.getStringExtra(RETURN_IMAGE_URL);
Log.i("UploadImage", "Successfully returned the image url: " + fileHash);
Intent returnToReport = new Intent();
returnToReport.setAction(RETURN_HASH);
returnToReport.putExtra(IPFS_UPLOAD_DONE, fileHash);
setResult(IMAGE_ADDED, returnToReport);
new DownloadImageTask(UploadImage.this, photoTaken).execute(fileHash);
} else if (requestCode == PHOTO_REQUEST){
Intent addIpfsIntent = new Intent(getApplicationContext(), AddIPFSContent.class);
addIpfsIntent.setAction(Intent.ACTION_SEND);
addIpfsIntent.setData(photoURI);
startActivityForResult(addIpfsIntent, JUST_SOME_CODE);
}
}
private void startInfoRefresh() {
new Thread(new Runnable() {
@Override
public void run() {
running = true;
while (running) {
try {
Thread.sleep(2000);
//VersionInfo version = ipfs.getInfo().version();
BandWidthInfo bandWidth = new IPFS().getStats().bandWidth();
String bandWidthText;
if (bandWidth != null) {
bandWidthText = "TotlalIn:" + bandWidth.getTotalIn() + "\n" +
"TotalOut:" + bandWidth.getTotalOut() + "\n" +
"RateIn:" + bandWidth.getRateIn() + "\n" +
"RateOut:" + bandWidth.getRateOut();
} else {
bandWidthText = " could not get information";
}
Log.d("BandWidth", bandWidthText);
} catch (Exception e){
Log.d("IPFS service error", "IPFS service is not started.");
}
}
}
}).start();
}
}
| 33.067708 | 97 | 0.569539 |
6c379916ead5a292e8afc68186cdeef91bd25a4c | 1,643 | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See the LICENSE file in the project root for full license information.
package com.microsoft.store.partnercenter.countryvalidationrules;
import java.text.MessageFormat;
import com.fasterxml.jackson.core.type.TypeReference;
import com.microsoft.store.partnercenter.BasePartnerComponentString;
import com.microsoft.store.partnercenter.IPartner;
import com.microsoft.store.partnercenter.PartnerService;
import com.microsoft.store.partnercenter.models.countryvalidationrules.CountryValidationRules;
import com.microsoft.store.partnercenter.utils.ParameterValidator;
/**
* The country validation rules operations implementation.
*/
public class CountryValidationRulesOperations
extends BasePartnerComponentString
implements ICountryValidationRules
{
/**
* Initializes a new instance of the CountryValidationRulesOperations class.
* @param rootPartnerOperations The root partner operations instance
* @param country The country
*/
protected CountryValidationRulesOperations(IPartner rootPartnerOperations, String country)
{
super(rootPartnerOperations, country);
ParameterValidator.isValidCountryCode(country);
}
/**
* Gets the market specific validation data by country.
*/
@Override
public CountryValidationRules get()
{
return this.getPartner().getServiceClient().get(
this.getPartner(),
new TypeReference<CountryValidationRules>(){},
MessageFormat.format(
PartnerService.getInstance().getConfiguration().getApis().get("GetCountryValidationRulesByCountry").getPath(),
this.getContext()));
}
} | 34.957447 | 114 | 0.806452 |
8dc747ee115f0cbaef10dc6ef75f0709dfe516a1 | 6,097 | package ax.stardust.skvirrel.component.keyboard;
import android.content.Context;
import android.os.Handler;
import android.util.AttributeSet;
import android.util.SparseArray;
import android.view.View;
import android.view.inputmethod.InputConnection;
import android.widget.Button;
import android.widget.LinearLayout;
import org.apache.commons.lang3.StringUtils;
import ax.stardust.skvirrel.R;
import ax.stardust.skvirrel.component.widget.KeyboardlessEditText;
/**
* Custom implementation of a keyboard used within the application.
*/
public abstract class SkvirrelKeyboard extends LinearLayout implements View.OnClickListener, View.OnLongClickListener {
private static final int HIDE_DELAY = 25;
private static final int CONTINUOUS_DELETE_DELAY = 60;
// common buttons
protected Button button0;
protected Button button1;
protected Button button2;
protected Button button3;
protected Button button4;
protected Button button5;
protected Button button6;
protected Button button7;
protected Button button8;
protected Button button9;
protected Button buttonDelete;
protected final SparseArray<String> keyValues = new SparseArray<>();
private InputConnection inputConnection;
private final Handler hideDelayHandler = new Handler();
private final Handler continuousDeleteHandler = new Handler();
private final Runnable continuousDeleteAction = new Runnable() {
@Override
public void run() {
actionDelete();
continuousDeleteHandler.postDelayed(continuousDeleteAction, CONTINUOUS_DELETE_DELAY);
}
};
/**
* Creates a new instance of skvirrel keyboard with given context
*
* @param context context for keyboard
*/
public SkvirrelKeyboard(Context context) {
this(context, null, 0);
}
/**
* Creates a new instance of skvirrel keyboard with given context and attribute set
*
* @param context context for keyboard
* @param attrs attribute set for keyboard
*/
public SkvirrelKeyboard(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
/**
* Creates a new instance of skvirrel keyboard with given context, attribute set and style attribute
*
* @param context context for keyboard
* @param attrs attribute set for keyboard
* @param defStyleAttr style attribute
*/
public SkvirrelKeyboard(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initialize(context);
}
private void initialize(Context context) {
inflateLayout(context);
findViews();
setListeners();
setKeyValues();
}
/**
* Inflates keyboard layout from context
*
* @param context context from which layout is inflated
*/
protected abstract void inflateLayout(Context context);
/**
* Find views needed for the keyboard
*/
protected abstract void findViews();
/**
* Set listeners needed for the keyboard
*/
protected abstract void setListeners();
/**
* Set keyboard key(button values)
*/
protected abstract void setKeyValues();
/**
* To configure separator character button depending on type of input, example usage
* could be to hide the button depending on input type
*
* @param input input type for which separator character button is configured
*/
public abstract void configureSeparatorButton(KeyboardlessEditText.Input input);
@Override
public boolean onLongClick(View view) {
if (inputConnection != null) {
if (view != null) {
if (isDeleteButton(view)) {
continuousDeleteHandler.post(continuousDeleteAction);
}
}
}
return false;
}
@Override
public void onClick(View view) {
if (inputConnection != null) {
if (isDeleteButton(view)) {
continuousDeleteHandler.removeCallbacks(continuousDeleteAction);
actionDelete();
} else {
String keyValue = keyValues.get(view.getId());
inputConnection.commitText(keyValue, 1);
}
}
}
/**
* Sets input connection to this keyboard
*
* @param inputConnection input connection of this keyboard
*/
public void setInputConnection(InputConnection inputConnection) {
this.inputConnection = inputConnection;
}
/**
* Enables/disables delete button of this keyboard depending on parameter
*
* @param enable true if delete button should be enabled else false
*/
public void enableDeleteButton(boolean enable) {
buttonDelete.setEnabled(enable);
// Nothing more to delete in field
continuousDeleteHandler.removeCallbacks(continuousDeleteAction);
}
/**
* To make this keyboard visible
*/
public void show() {
hideDelayHandler.removeCallbacksAndMessages(null);
setVisibility(View.VISIBLE);
}
/**
* To hide the keyboard with a small delay
*/
public void delayedHide() {
hideDelayHandler.postDelayed(this::hide, HIDE_DELAY);
}
private boolean isDeleteButton(View view) {
return R.id.numeric_keyboard_button_del == view.getId() ||
R.id.alphanumeric_keyboard_button_del == view.getId();
}
private void hide() {
setVisibility(View.GONE);
}
/**
* DON'T EVER, EVER call this before you have checked that:
* - inputConnection is not null
* - calling method has a view that's not null
* - calling method has a view with id: R.id.button_del
*/
private void actionDelete() {
CharSequence selectedText = inputConnection.getSelectedText(0);
if (StringUtils.isEmpty(selectedText)) {
inputConnection.deleteSurroundingText(1, 0);
} else {
inputConnection.commitText("", 1);
}
}
} | 30.034483 | 119 | 0.657865 |
5d5280d3c1808629deb1609a3da6552a73924008 | 1,199 | package net.renfei.dao.persistences;
import java.util.List;
import net.renfei.dao.entity.PostsDO;
import net.renfei.dao.entity.PostsDOExample;
import net.renfei.dao.entity.PostsDOWithBLOBs;
import org.apache.ibatis.annotations.Param;
public interface PostsDOMapper {
long countByExample(PostsDOExample example);
int deleteByExample(PostsDOExample example);
int deleteByPrimaryKey(Long id);
int insert(PostsDOWithBLOBs record);
int insertSelective(PostsDOWithBLOBs record);
List<PostsDOWithBLOBs> selectByExampleWithBLOBs(PostsDOExample example);
List<PostsDO> selectByExample(PostsDOExample example);
PostsDOWithBLOBs selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") PostsDOWithBLOBs record, @Param("example") PostsDOExample example);
int updateByExampleWithBLOBs(@Param("record") PostsDOWithBLOBs record, @Param("example") PostsDOExample example);
int updateByExample(@Param("record") PostsDO record, @Param("example") PostsDOExample example);
int updateByPrimaryKeySelective(PostsDOWithBLOBs record);
int updateByPrimaryKeyWithBLOBs(PostsDOWithBLOBs record);
int updateByPrimaryKey(PostsDO record);
} | 32.405405 | 117 | 0.792327 |
26168f6dfe562755beb438aff6161a1fc8912b81 | 2,231 | package com.huawei.hackzurich;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
public class ItemAdapter extends RecyclerView.Adapter<ItemAdapter.Viewholder> {
private Context context;
private ArrayList<ItemModel> courseModelArrayList;
// Constructor
public ItemAdapter(Context context, ArrayList<ItemModel> courseModelArrayList) {
this.context = context;
this.courseModelArrayList = courseModelArrayList;
}
@NonNull
@Override
public ItemAdapter.Viewholder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
// to inflate the layout for each item of recycler view.
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_card, parent, false);
return new Viewholder(view);
}
@Override
public void onBindViewHolder(@NonNull ItemAdapter.Viewholder holder, int position) {
// to set data to textview and imageview of each card layout
ItemModel model = courseModelArrayList.get(position);
holder.courseNameTV.setText(model.getCourse_name());
holder.courseRatingTV.setText("" + model.getCourse_rating());
holder.courseIV.setImageResource(model.getCourse_image());
}
@Override
public int getItemCount() {
// this method is used for showing number
// of card items in recycler view.
return courseModelArrayList.size();
}
// View holder class for initializing of
// your views such as TextView and Imageview.
public class Viewholder extends RecyclerView.ViewHolder {
private ImageView courseIV;
private TextView courseNameTV, courseRatingTV;
public Viewholder(@NonNull View itemView) {
super(itemView);
courseIV = itemView.findViewById(R.id.idIVCourseImage);
courseNameTV = itemView.findViewById(R.id.idTVCourseName);
courseRatingTV = itemView.findViewById(R.id.idTVCourseRating);
}
}
} | 36.57377 | 104 | 0.718512 |
dd74797996783815a439d75b0561d439edc14d48 | 2,047 | /*
* 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.sling.api.servlets;
import javax.annotation.Nonnull;
import javax.servlet.Servlet;
import org.apache.sling.api.SlingHttpServletRequest;
import aQute.bnd.annotation.ConsumerType;
/**
* The <code>OptingServlet</code> interface may be implemented by
* <code>Servlets</code> used by Sling which may choose to not handle all
* requests for which they would be selected based on their registration
* properties.
*
* Note that servlets implementing this interface can have an impact
* on system performance, as their resolution cannot be cached: the
* resolver has no insight into which parts of the request cause
* {@link #accepts} to return true.
*/
@ConsumerType
public interface OptingServlet extends Servlet {
/**
* Examines the request, and return <code>true</code> if this servlet is
* willing to handle the request. If <code>false</code> is returned, the
* request will be ignored by this servlet, and may be handled by other
* servlets.
*
* @param request The request to examine
* @return <code>true</code> if this servlet will handle the request,
* <code>false</code> otherwise
*/
boolean accepts(@Nonnull SlingHttpServletRequest request);
}
| 39.365385 | 76 | 0.738153 |
483c2cf8865fa0f93bc35d8e5615ff88bdc52b51 | 196 | package com.wytings.demo;
/**
* Created by rex on 12/9/16.
*/
public class MyApp extends App {
@Override
protected void initialize() {
G.i("app has benn initialized");
}
}
| 15.076923 | 40 | 0.612245 |
7d1f436d16b5f1e89df898567bba96660b513808 | 5,356 | /*
* MIT License
*
* Copyright 2018 Sabre GLBL Inc.
*
* 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.sabre.oss.yare.core.call;
import com.sabre.oss.yare.core.invocation.Invocation;
import com.sabre.oss.yare.core.model.Attribute;
import com.sabre.oss.yare.core.model.Expression;
import com.sabre.oss.yare.core.model.ExpressionFactory;
import com.sabre.oss.yare.core.model.Rule;
import com.sabre.oss.yare.core.model.type.InternalParameterizedType;
import org.junit.jupiter.api.Test;
import java.math.BigDecimal;
import java.util.*;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
import static org.assertj.core.api.Assertions.assertThat;
class ConsequenceFactoryTest {
private ConsequenceFactory consequenceFactory;
@Test
void shouldProperlyConvertActionParametersAndCallActionInvocations() {
// given
Map<String, Argument.Invocation> invocations = new LinkedHashMap<>();
Map<String, Argument.Invocation> proceedInvocations = new LinkedHashMap<>();
consequenceFactory = new ConsequenceFactory((invocation) -> {
invocations.put(invocation.getCall(), invocation);
return context -> {
proceedInvocations.put(invocation.getCall(), invocation);
return null;
};
});
Map<String, Object> bindings = new HashMap<>();
bindings.put(ProcessingContext.CONTEXT, new Object());
bindings.put(ProcessingContext.CURRENT_RULE_NAME, "ruleOne");
// when
Invocation<ProcessingContext, Void> consequence = consequenceFactory.createConsequence(ruleWithName("ruleOne"), getActions());
consequence.proceed(new StaticProcessingContext(bindings, new Object[0]));
// then
assertThat(consequence).isNotNull();
assertThat(invocations.size()).isEqualTo(2);
assertThat(invocations).containsKey("actionOne");
Argument.Invocation actionInvocation = invocations.get("actionOne");
assertThat(actionInvocation.getName()).isEqualTo("First Action");
assertThat(actionInvocation.getCall()).isEqualTo("actionOne");
List<Argument> arguments = actionInvocation.getArguments();
assertThat(arguments).containsExactly(
Argument.valueOf("arg1", Boolean.FALSE),
Argument.valueOf("arg2", Boolean.TRUE),
Argument.valueOf("arg3", 1234L),
Argument.valueOf("arg4", BigDecimal.valueOf(-123, 456)),
Argument.valueOf("arg5", "Just a string"),
Argument.valueOf("arg6", new InternalParameterizedType(null, List.class, Long.class), asList(1L, 2L)),
Argument.valueOf("arg7", new InternalParameterizedType(null, List.class, String.class), asList("one", "two")));
assertThat(invocations).containsKey("actionTwo");
actionInvocation = invocations.get("actionTwo");
assertThat(actionInvocation.getName()).isEqualTo("Second action");
assertThat(actionInvocation.getCall()).isEqualTo("actionTwo");
arguments = actionInvocation.getArguments();
assertThat(arguments.size()).isEqualTo(0);
assertThat(proceedInvocations).containsKeys("actionOne", "actionTwo");
}
private Rule ruleWithName(String ruleName) {
return new Rule(
Collections.singleton(new Attribute("ruleName", String.class, ruleName)),
Collections.emptyList(),
null,
Collections.emptyList());
}
private List<Expression.Invocation> getActions() {
return asList(
ExpressionFactory.actionOf("First Action", "actionOne", asList(
ExpressionFactory.valueOf("arg1", false),
ExpressionFactory.valueOf("arg2", true),
ExpressionFactory.valueOf("arg3", 1234L),
ExpressionFactory.valueOf("arg4", BigDecimal.valueOf(-123, 456)),
ExpressionFactory.valueOf("arg5", "Just a string"),
ExpressionFactory.valueOf("arg6", asList(1L, 2L)),
ExpressionFactory.valueOf("arg7", asList("one", "two")))),
ExpressionFactory.actionOf("Second action", "actionTwo", emptyList())
);
}
}
| 46.573913 | 134 | 0.677184 |
794e903889fea79ac72383f62b5d8f9b72361396 | 1,383 | package io.github.nichetoolkit.rest.error.data;
import io.github.nichetoolkit.rest.RestErrorStatus;
import io.github.nichetoolkit.rest.RestError;
import io.github.nichetoolkit.rest.RestErrorException;
import io.github.nichetoolkit.rest.RestStatus;
/**
* <p>DataCreateException</p>
* @author Cyan ([email protected])
* @version v1.0.0
*/
public class DataCreateException extends RestErrorException {
public DataCreateException() {
super(RestErrorStatus.DATA_CREATE_FAILED);
}
public DataCreateException(RestErrorStatus status) {
super(status);
}
public DataCreateException(RestStatus status) {
super(status, RestError.error(status));
}
public DataCreateException(String resource) {
super(RestErrorStatus.DATA_CREATE_FAILED, RestError.error(resource, RestErrorStatus.DATA_CREATE_FAILED));
}
public DataCreateException(String resource, String message) {
super(RestErrorStatus.DATA_CREATE_FAILED, RestError.error(resource, RestErrorStatus.DATA_CREATE_FAILED, message));
}
public DataCreateException(String resource, Object value, String message) {
super(RestErrorStatus.DATA_CREATE_FAILED, RestError.error(resource, value, RestErrorStatus.DATA_CREATE_FAILED, message));
}
@Override
public DataCreateException get() {
return new DataCreateException();
}
}
| 32.162791 | 129 | 0.749096 |
b0eab1a19153e99b8bbe872ca548f2244a2222fe | 5,060 | /*
* Copyright 2012 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
//The MIT License
//
//Copyright (c) 2009 Carl Bystršm
//
//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.netty.example.http.websocketx.client;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPromise;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.handler.codec.http.FullHttpResponse;
import io.netty.handler.codec.http.websocketx.CloseWebSocketFrame;
import io.netty.handler.codec.http.websocketx.PongWebSocketFrame;
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker;
import io.netty.handler.codec.http.websocketx.WebSocketFrame;
import io.netty.handler.codec.http.websocketx.WebSocketHandshakeException;
import io.netty.util.CharsetUtil;
public class WebSocketClientHandler extends SimpleChannelInboundHandler<Object> {
private final WebSocketClientHandshaker handshaker;
private ChannelPromise handshakeFuture;
public WebSocketClientHandler(WebSocketClientHandshaker handshaker) {
this.handshaker = handshaker;
}
public ChannelFuture handshakeFuture() {
return handshakeFuture;
}
@Override
public void handlerAdded(ChannelHandlerContext ctx) {
handshakeFuture = ctx.newPromise();
}
@Override
public void channelActive(ChannelHandlerContext ctx) {
handshaker.handshake(ctx.channel());
}
@Override
public void channelInactive(ChannelHandlerContext ctx) {
System.out.println("WebSocket Client disconnected!");
}
@Override
public void messageReceived(ChannelHandlerContext ctx, Object msg) throws Exception {
Channel ch = ctx.channel();
if (!handshaker.isHandshakeComplete()) {
try {
handshaker.finishHandshake(ch, (FullHttpResponse) msg);
System.out.println("WebSocket Client connected!");
handshakeFuture.setSuccess();
} catch (WebSocketHandshakeException e) {
System.out.println("WebSocket Client failed to connect");
handshakeFuture.setFailure(e);
}
return;
}
if (msg instanceof FullHttpResponse) {
FullHttpResponse response = (FullHttpResponse) msg;
throw new IllegalStateException(
"Unexpected FullHttpResponse (getStatus=" + response.status() +
", content=" + response.content().toString(CharsetUtil.UTF_8) + ')');
}
WebSocketFrame frame = (WebSocketFrame) msg;
if (frame instanceof TextWebSocketFrame) {
TextWebSocketFrame textFrame = (TextWebSocketFrame) frame;
System.out.println("WebSocket Client received message: " + textFrame.text());
} else if (frame instanceof PongWebSocketFrame) {
System.out.println("WebSocket Client received pong");
} else if (frame instanceof CloseWebSocketFrame) {
System.out.println("WebSocket Client received closing");
ch.close();
}
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
cause.printStackTrace();
if (!handshakeFuture.isDone()) {
handshakeFuture.setFailure(cause);
}
ctx.close();
}
}
| 40.48 | 97 | 0.713834 |
44508a435fa23834a03d1ed0e708440c37521352 | 4,704 | package no.jsosi;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class Navntype {
private final static Map<Integer, String> nameById = new HashMap<>();
static {
// copy from
// http://www.kartverket.no/globalassets/standard/sosi-standarden-del-1-og-2/sosi-standarden/stedsnavn.pdf
// and "fixed" using sed 's/^[ ]*/r(/g'|sed -E 's/[[:space:]]+/,"/'|sed
// 's/$/");/g' and such
// https://github.com/phaza/norwegian-ssr-parser/blob/master/src/SSR/Feature/NameType.php
r(1, "Berg");
r(2, "Fjell");
r(239, "Fjellside");
r(3, "Fjellområde");
r(246, "Skogområde");
r(247, "Landskapsområde");
r(4, "Hei");
r(5, "Høyde");
r(6, "Ås");
r(7, "Rygg");
r(8, "Haug");
r(211, "Topp (fjelltopp/tind)");
r(212, "Hylle (hjell)");
r(245, "Fjellkant (aksel)");
r(9, "Bakke");
r(10, "Li");
r(11, "Stup");
r(12, "Vidde");
r(13, "Slette");
r(14, "Mo");
r(15, "Dalføre");
r(16, "Dal");
r(17, "Botn");
r(244, "Senkning");
r(18, "Skar");
r(19, "Juv");
r(20, "Søkk");
r(21, "Stein");
r(260, "Grotte");
r(22, "Heller");
r(213, "Terrengdetalj");
r(84, "Øy i sjø");
r(216, "Øygruppe i sjø");
r(85, "Holme i sjø");
r(265, "Holmegruppe i sjø");
r(86, "Halvøy i sjø");
r(87, "Nes i sjø");
r(88, "Eid i sjø");
r(89, "Strand i sjø");
r(90, "Skjær i sjø");
r(91, "Båe i sjø");
r(92, "Grunne i sjø");
r(93, "Renne");
r(94, "Banke i sjø");
r(95, "Bakke i sjø");
r(96, "Søkk i sjø");
r(97, "Dyp (havdyp)");
r(98, "Rygg i sjø");
r(99, "Egg");
r(217, "Klakk");
r(256, "Fiskeplass");
r(100, "By");
r(132, "Bydel");
r(101, "Tettsted");
r(266, "Tettsteddel");
r(102, "Tettbebyggelse");
r(103, "Bygdelag (bygd)");
r(104, "Grend");
r(105, "Boligfelt");
r(228, "Hyttefelt");
r(106, "Borettslag");
r(107, "Industriområde");
r(280, "Gard");
r(108, "Bruk (gardsbruk)");
r(109, "Enebolig/mindre boligbygg (villa)");
r(259, "Boligblokk");
r(110, "Fritidsbolig (hytte, sommerhus)");
r(111, "Seter (sel, støl)");
r(112, "Bygg for jordbruk, fiske og fangst");
r(113, "Fabrikk");
r(114, "Kraftstasjon");
r(218, "Bergverk (underjord./dagbrudd)");
r(115, "Verksted");
r(116, "Forretningsbygg");
r(117, "Hotell");
r(118, "Pensjonat");
r(119, "Turisthytte");
r(267, "Serveringssted");
r(191, "Campingplass");
r(270, "Adm. tettsted");
r(183, "Sogn");
r(184, "Grunnkrets");
r(185, "Allmenning");
r(186, "Skytefelt");
r(187, "Verneområder");
r(188, "Soneinndeling til havs");
r(253, "Annen adm. Inndeling");
r(258, "Grensemerke");
r(190, "Idrettsanlegg");
r(210, "Skytebane");
r(235, "Gravplass");
r(192, "Skiheis");
r(193, "Fjellheis");
r(194, "Slalåm- og utforbakke");
r(195, "Småbåthavn");
r(222, "Badeplass");
r(223, "Fornøyelsespark");
r(196, "Rørledning");
r(197, "Oljeinstallasjon (Sjø)");
r(198, "Kraftledning");
r(199, "Kraftgate (Rørgate)");
r(200, "Kabel");
r(201, "Dam");
r(202, "Tømmerrenne");
r(203, "Taubane");
r(204, "Fløtningsannlegg");
r(205, "Fiskeoppdrettsanlegg");
r(206, "Gammel bosettingsplass");
r(207, "Offersted");
r(208, "Severdighet");
r(209, "Utsiktspunkt");
r(224, "Melkeplass");
r(225, "Annen kulturdetalj");
r(233, "Gjerde");
r(234, "Stø");
r(254, "Varde");
r(272, "Lanterne");
r(273, "Stang");
r(274, "Stake");
r(275, "Lysbøye");
r(276, "Båke");
r(277, "Overett");
}
private static void r(int id, String name) {
nameById.put(Integer.valueOf(id), name);
}
public static String getName(int id) {
return nameById.get(Integer.valueOf(id));
}
public static Set<Integer> getIds() {
return Collections.unmodifiableSet(nameById.keySet());
}
public static Map<Integer, String> getNameById() {
return Collections.unmodifiableMap(nameById);
}
}
| 28.337349 | 114 | 0.479804 |
0c0fc43d9047a5a7830dd6adae9613ac469ac4aa | 828 | package common.entities.payload.client_to_server;
import common.entities.Token;
import common.entities.payload.PayloadType;
/**
* A payload from client to server that
* contains the data for a user to leave a channel.
* <p>
* Created on 2020.12.10.
*
* @author Shari Sun
* @version 1.0.0
* @since 1.0.0
*/
public class LeaveChannel extends AuthenticatablePayload {
/** The serial version ID used for serialization. */
private static final long serialVersionUID = 1L;
private final String channelId;
public LeaveChannel(
int priority,
String userId,
Token token,
String channelId
) {
super(PayloadType.LEAVE_CHANNEL, priority, userId, token);
this.channelId = channelId;
}
public String getChannelId() {
return this.channelId;
}
}
| 21.789474 | 63 | 0.677536 |
a566a7fbdf04b2d84bf3a21c247b4a15a76bd5d1 | 4,899 | /*
* Copyright (C) 2018. Uber Technologies
*
* 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.uber.nullaway.jarinfer;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.errorprone.BaseErrorProneCompiler;
import com.google.errorprone.ErrorProneInMemoryFileManager;
import com.google.errorprone.bugpatterns.BugChecker;
import com.google.errorprone.scanner.ScannerSupplier;
import com.sun.tools.javac.main.Main;
import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.tools.JavaFileObject;
import javax.tools.StandardLocation;
/**
* Utility type for compiling Java code using Error Prone. Similar to {@link
* com.google.errorprone.CompilationTestHelper} but does not require providing any Error Prone
* checker.
*
* <p>A great deal of code is taken from {@link com.google.errorprone.CompilationTestHelper}
*/
public class CompilerUtil {
private static final ImmutableList<String> DEFAULT_ARGS =
ImmutableList.of(
"-encoding",
"UTF-8",
// print stack traces for completion failures
"-XDdev");
private final ErrorProneInMemoryFileManager fileManager;
private final List<JavaFileObject> sources = new ArrayList<>();
private final BaseErrorProneCompiler compiler;
private final ByteArrayOutputStream outputStream;
private List<String> args = ImmutableList.of();
public CompilerUtil(Class<?> klass) {
this.fileManager = new ErrorProneInMemoryFileManager(klass);
try {
fileManager.setLocation(StandardLocation.SOURCE_PATH, Collections.<File>emptyList());
} catch (IOException e) {
throw new RuntimeException("unexpected IOException", e);
}
outputStream = new ByteArrayOutputStream();
this.compiler =
BaseErrorProneCompiler.builder()
.redirectOutputTo(
new PrintWriter(
new BufferedWriter(new OutputStreamWriter(outputStream, UTF_8)), true))
.report(
ScannerSupplier.fromBugCheckerClasses(
Collections.<Class<? extends BugChecker>>emptySet()))
.build();
}
/**
* Adds a source file to the test compilation, from an existing resource file.
*
* @param path the path to the source file
*/
public CompilerUtil addSourceFile(String path) {
this.sources.add(fileManager.forResource(path));
return this;
}
public CompilerUtil addSourceLines(String path, String... lines) {
this.sources.add(fileManager.forSourceLines(path, lines));
return this;
}
/**
* Sets custom command-line arguments for the compilation. These will be appended to the default
* compilation arguments.
*/
public CompilerUtil setArgs(List<String> args) {
this.args = args;
return this;
}
private Main.Result compile(Iterable<JavaFileObject> sources, String[] args) {
return compiler.run(args, fileManager, ImmutableList.copyOf(sources), null);
}
public String getOutput() {
return outputStream.toString();
}
/**
* Creates a list of arguments to pass to the compiler, including the list of source files to
* compile. Uses DEFAULT_ARGS as the base and appends the extraArgs passed in.
*/
private static List<String> buildArguments(List<String> extraArgs) {
return ImmutableList.<String>builder()
.addAll(DEFAULT_ARGS)
.addAll(disableImplicitProcessing(extraArgs))
.build();
}
/**
* Pass -proc:none unless annotation processing is explicitly enabled, to avoid picking up
* annotation processors via service loading.
*/
private static List<String> disableImplicitProcessing(List<String> args) {
if (args.indexOf("-processor") != -1 || args.indexOf("-processorpath") != -1) {
return args;
}
return ImmutableList.<String>builder().addAll(args).add("-proc:none").build();
}
public Main.Result run() {
Preconditions.checkState(!sources.isEmpty(), "No source files to compile");
List<String> allArgs = buildArguments(args);
return compile(sources, allArgs.toArray(new String[allArgs.size()]));
}
}
| 35.244604 | 98 | 0.719739 |
016d63bf524029fd09c180a9d5cf8888b3851965 | 609 | package com.jiedangou.i17dl.api.sdk.bean.param.req.receivemanagement;
import com.jiedangou.i17dl.api.sdk.bean.param.req.BaseReq;
/**
* 订单管理-列表
* Created on 2018/1/22
*
* @author Jianghao(howechiang @ gmail.com)
*/
public class IndexReq extends BaseReq {
private Integer page;
public Integer getPage() {
return page;
}
public void setPage(Integer page) {
this.page = page;
}
private Integer pigeSize;
public Integer getPigeSize() {
return pigeSize;
}
public void setPigeSize(Integer pigeSize) {
this.pigeSize = pigeSize;
}
}
| 18.454545 | 69 | 0.65353 |
36c774b8ffe0f6f6ddb5426bec17ccfd5a414983 | 1,982 | package serializers.wobly;
import static serializers.core.metadata.SerializerProperties.APIStyle.REFLECTION;
import static serializers.core.metadata.SerializerProperties.Features.OPTIMIZED;
import static serializers.core.metadata.SerializerProperties.Features.SUPPORTS_BACKWARD_COMPATIBILITY;
import static serializers.core.metadata.SerializerProperties.Features.SUPPORTS_CYCLIC_REFERENCES;
import static serializers.core.metadata.SerializerProperties.Features.USER_MANAGED_TYPE_IDS;
import static serializers.core.metadata.SerializerProperties.Format.BINARY;
import static serializers.core.metadata.SerializerProperties.Mode.CODE_FIRST;
import static serializers.core.metadata.SerializerProperties.ValueType.POJO_WITH_ANNOTATIONS;
import serializers.MediaContentTestGroup;
import serializers.core.metadata.SerializerProperties;
import serializers.wobly.compact.WoblyCompactUtils;
import serializers.wobly.simple.WoblySimpleUtils;
public class Wobly {
public static void register(MediaContentTestGroup groups) {
SerializerProperties.SerializerPropertiesBuilder builder = SerializerProperties.builder();
SerializerProperties properties = builder
.format(BINARY)
.mode(CODE_FIRST)
.apiStyle(REFLECTION)
.valueType(POJO_WITH_ANNOTATIONS)
.feature(SUPPORTS_BACKWARD_COMPATIBILITY)
.feature(SUPPORTS_CYCLIC_REFERENCES)
.feature(USER_MANAGED_TYPE_IDS)
.name("wobly")
.projectUrl("https://code.google.com/archive/p/wobly/")
.build();
groups.media.add(new WoblySimpleUtils.WoblyTransformer(),
new WoblySimpleUtils.WoblySerializer(properties));
SerializerProperties compact_properties = properties.toBuilder()
.feature(OPTIMIZED)
.optimizedDescription("compact")
.build();
groups.media.add(new WoblyCompactUtils.WoblyTransformer(),
new WoblyCompactUtils.WoblySerializer(compact_properties));
}
}
| 44.044444 | 103 | 0.780525 |
d860e1d7d3549412b6920f7b33002f4d1d50be29 | 8,816 | /*
* Copyright 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.gwt.user.server.rpc;
import com.google.gwt.user.server.rpc.impl.StandardSerializationPolicy;
import com.google.gwt.user.server.rpc.impl.TypeNameObfuscator;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* API for loading a {@link SerializationPolicy}.
*/
public final class SerializationPolicyLoader {
/**
* Keyword for listing the serializable fields of an enhanced class that are
* visible to client code.
*/
public static final String CLIENT_FIELDS_KEYWORD = "@ClientFields";
/**
* Keyword for final field serialization strategy.
*/
public static final String FINAL_FIELDS_KEYWORD = "@FinalFields";
/**
* Default encoding for serialization policy files.
*/
public static final String SERIALIZATION_POLICY_FILE_ENCODING = "UTF-8";
private static final String FORMAT_ERROR_MESSAGE = "Expected: className, "
+ "[true | false], [true | false], [true | false], [true | false], typeId, signature";
/**
* Returns the serialization policy file name from the serialization
* policy strong name.
*
* @param serializationPolicyStrongName the serialization policy strong name
* @return the serialization policy file name from the serialization
* policy strong name
*/
public static String getSerializationPolicyFileName(
String serializationPolicyStrongName) {
return serializationPolicyStrongName + ".gwt.rpc";
}
/**
* Loads a SerializationPolicy from an input stream.
*
* @param inputStream stream to load from
* @return a {@link SerializationPolicy} loaded from the input stream
*
* @throws IOException if an error occurs while reading the stream
* @throws ParseException if the input stream is not properly formatted
* @throws ClassNotFoundException if a class specified in the serialization
* policy cannot be loaded
*
* @deprecated see {@link #loadFromStream(InputStream, List)}
*/
@Deprecated
public static SerializationPolicy loadFromStream(InputStream inputStream)
throws IOException, ParseException, ClassNotFoundException {
List<ClassNotFoundException> classNotFoundExceptions = new ArrayList<ClassNotFoundException>();
SerializationPolicy serializationPolicy = loadFromStream(inputStream,
classNotFoundExceptions);
if (!classNotFoundExceptions.isEmpty()) {
// Just report the first failure.
throw classNotFoundExceptions.get(0);
}
return serializationPolicy;
}
/**
* Loads a SerializationPolicy from an input stream and optionally record any
* {@link ClassNotFoundException}s.
*
* @param inputStream stream to load the SerializationPolicy from.
* @param classNotFoundExceptions if not <code>null</code>, all of the
* {@link ClassNotFoundException}s thrown while loading this
* serialization policy will be added to this list
* @return a {@link SerializationPolicy} loaded from the input stream.
*
* @throws IOException if an error occurs while reading the stream
* @throws ParseException if the input stream is not properly formatted
*/
public static SerializationPolicy loadFromStream(InputStream inputStream,
List<ClassNotFoundException> classNotFoundExceptions) throws IOException,
ParseException {
if (inputStream == null) {
throw new NullPointerException("inputStream");
}
Map<Class<?>, Boolean> whitelistSer = new HashMap<Class<?>, Boolean>();
Map<Class<?>, Boolean> whitelistDeser = new HashMap<Class<?>, Boolean>();
Map<Class<?>, String> typeIds = new HashMap<Class<?>, String>();
Map<Class<?>, Set<String>> clientFields = new HashMap<Class<?>, Set<String>>();
boolean shouldSerializeFinalFields = false;
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
InputStreamReader isr = new InputStreamReader(inputStream,
SERIALIZATION_POLICY_FILE_ENCODING);
BufferedReader br = new BufferedReader(isr);
String line = br.readLine();
int lineNum = 1;
while (line != null) {
line = line.trim();
if (line.length() > 0) {
String[] components = line.split(",");
if (components[0].equals(CLIENT_FIELDS_KEYWORD)) {
/*
* Lines starting with '@ClientFields' list potentially serializable fields known to
* client code for classes that may be enhanced with additional fields on the server.
* If additional server fields are found, they will be serizalized separately from the
* normal RPC process and transmitted to the client as an opaque blob of data stored
* in a WeakMapping associated with the object instance.
*/
String binaryTypeName = components[1].trim();
Class<?> clazz;
try {
clazz = Class.forName(binaryTypeName, false, contextClassLoader);
HashSet<String> fieldNames = new HashSet<String>();
for (int i = 2; i < components.length; i++) {
fieldNames.add(components[i]);
}
clientFields.put(clazz, fieldNames);
} catch (ClassNotFoundException ex) {
// Ignore the error, but add it to the list of errors if one was
// provided.
if (classNotFoundExceptions != null) {
classNotFoundExceptions.add(ex);
}
}
} else if (components[0].equals(FINAL_FIELDS_KEYWORD)) {
shouldSerializeFinalFields = Boolean.valueOf(components[1].trim());
} else {
if (components.length != 2 && components.length != 7) {
throw new ParseException(FORMAT_ERROR_MESSAGE, lineNum);
}
for (int i = 0; i < components.length; i++) {
components[i] = components[i].trim();
if (components[i].length() == 0) {
throw new ParseException(FORMAT_ERROR_MESSAGE, lineNum);
}
}
String binaryTypeName = components[0].trim();
boolean fieldSer;
boolean instantSer;
boolean fieldDeser;
boolean instantDeser;
String typeId;
if (components.length == 2) {
fieldSer = fieldDeser = true;
instantSer = instantDeser = Boolean.valueOf(components[1]);
typeId = binaryTypeName;
} else {
int idx = 1;
// TODO: Validate the instantiable string better.
fieldSer = Boolean.valueOf(components[idx++]);
instantSer = Boolean.valueOf(components[idx++]);
fieldDeser = Boolean.valueOf(components[idx++]);
instantDeser = Boolean.valueOf(components[idx++]);
typeId = components[idx++];
if (!fieldSer && !fieldDeser
&& !TypeNameObfuscator.SERVICE_INTERFACE_ID.equals(typeId)) {
throw new ParseException("Type " + binaryTypeName
+ " is neither field serializable, field deserializable "
+ "nor the service interface", lineNum);
}
}
try {
Class<?> clazz = Class.forName(binaryTypeName, false,
contextClassLoader);
if (fieldSer) {
whitelistSer.put(clazz, instantSer);
}
if (fieldDeser) {
whitelistDeser.put(clazz, instantDeser);
}
typeIds.put(clazz, typeId);
} catch (ClassNotFoundException ex) {
// Ignore the error, but add it to the list of errors if one was
// provided.
if (classNotFoundExceptions != null) {
classNotFoundExceptions.add(ex);
}
}
}
}
line = br.readLine();
lineNum++;
}
return new StandardSerializationPolicy(whitelistSer, whitelistDeser,
typeIds, clientFields, shouldSerializeFinalFields);
}
private SerializationPolicyLoader() {
}
}
| 37.675214 | 99 | 0.654152 |
41dafefcbb6668d8ad88b5af1ab75bf940ef1eb8 | 2,796 | /*
* Copyright 2012-2015 Viant.
*
* 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.caucho.hessian.io;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.*;
import com.caucho.hessian.HessianException;
/**
* Proxy for a java annotation for known object types.
*/
public class AnnotationInvocationHandler implements InvocationHandler {
private Class _annType;
private HashMap<String,Object> _valueMap;
public AnnotationInvocationHandler(Class annType,
HashMap<String,Object> valueMap)
{
_annType = annType;
_valueMap = valueMap;
}
@Override
public Object invoke(Object proxy, Method method, Object []args)
throws Throwable
{
String name = method.getName();
boolean zeroArgs = args == null || args.length == 0;
if (name.equals("annotationType") && zeroArgs)
return _annType;
else if (name.equals("toString") && zeroArgs)
return toString();
else if (name.equals("hashCode") && zeroArgs)
return doHashCode();
else if (name.equals("equals") && ! zeroArgs && args.length == 1)
return doEquals(args[0]);
else if (! zeroArgs)
return null;
return _valueMap.get(method.getName());
}
public int doHashCode()
{
return 13;
}
public boolean doEquals(Object value)
{
if (! (value instanceof Annotation))
return false;
Annotation ann = (Annotation) value;
if (! _annType.equals(ann.annotationType()))
return false;
return true;
}
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("@");
sb.append(_annType.getName());
sb.append("[");
boolean isFirst = true;
for (Map.Entry entry : _valueMap.entrySet()) {
if (! isFirst)
sb.append(", ");
isFirst = false;
sb.append(entry.getKey());
sb.append("=");
if (entry.getValue() instanceof String)
sb.append('"').append(entry.getValue()).append('"');
else
sb.append(entry.getValue());
}
sb.append("]");
return sb.toString();
}
}
| 24.964286 | 81 | 0.652718 |
6dd13c92ffbd39d1789091cea6161630116918db | 11,734 | package com.webcheckers.model.board;
import com.webcheckers.ui.boardView.Move;
import com.webcheckers.ui.boardView.Position;
import java.util.Stack;
import java.util.HashMap;
import java.util.Map;
/**
* Model tier class that represents the checkers board.
*
* @author Dan Wang
* @author Emily Lederman
* @author Kevin Paradis
* @author Nathan Farrell
*/
public class Board {
//The color of the player whose turn it currently is
public enum ActiveColor {RED, WHITE}
//The mode of the Game View
public enum ViewMode {PLAY, SPECTATOR, REPLAY}
private Space[][] board;
public ActiveColor currentTurn;
//Number of checker pieces on the board per color
private int numOfWhitePieces = 0;
private int numOfRedPieces = 0;
//A stack to remember what pieces were captured in a given turn
private Stack<Piece> capturedPieces = new Stack<>();
//Used to determine the size of the board
public static final int size = 8;
/**
* Creates a board used for keeping track of the state
* of the game.
*
* @throws Exception occurs if the given column or row of a space
* is greater or less than the bounds established by a standard
* game board
*/
public Board() throws Exception {
this.board = new Space[size][size];
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
//Black spaces
if ((i%2 == 0 && j%2 == 1) || (i%2 == 1 && j%2 == 0)) {
this.board[i][j] = new Space(i, j, Space.Color.BLACK);
}
//White spaces
else {
this.board[i][j] = new Space(i, j, Space.Color.WHITE);
}
}
}
this.currentTurn = ActiveColor.RED;
}
/**
* Creates a Board object based off a given game board and current turn.
*
* @param board the game board to crate the Board after
* @param turn the current turn
* @throws Exception occurs if the given column or row of a space
* is greater or less than the bounds established by a standard
* game board
*/
public Board(Space[][] board, Board.ActiveColor turn) throws Exception {
this.board = board;
this.currentTurn = turn;
int red = 0;
int white = 0;
//Count the number of pieces on the passed in board
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
Space space = this.board[i][j];
if (space.getPiece() != null) {
if (space.getPiece().getColor() == Piece.Color.RED) {
red++;
}
if (space.getPiece().getColor() == Piece.Color.WHITE) {
white++;
}
}
}
}
this.numOfRedPieces = red;
this.numOfWhitePieces = white;
}
/**
* Populates the board with pieces in the starting game formation.
*/
public void newGame() {
//Places white pieces at the top of the board
for (int i = 0; i < 3; i++) {
for (int j = 0; j < size; j++) {
Space space = this.board[i][j];
if (space.isValid()) {
space.setPiece(new Piece(Piece.Color.WHITE,
Piece.Type.SINGLE));
}
}
}
//Places red pieces at the bottom of the board
for (int i = size - 3; i < size; i++) {
for (int j = 0; j < size; j++) {
Space space = this.board[i][j];
if (space.isValid()) {
space.setPiece(new Piece(Piece.Color.RED,
Piece.Type.SINGLE));
}
}
}
this.numOfRedPieces = 12;
this.numOfWhitePieces = 12;
}
/**
* Move a piece on the game board.
*
* @param move the start and end coordinates of the piece to move
*/
public void makeMove(Move move) {
Position start = move.getStart();
Position end = move.getEnd();
Piece piece = this.board[start.getRow()][start.getCell()].getPiece();
this.board[start.getRow()][start.getCell()].removePiece();
this.board[end.getRow()][end.getCell()].setPiece(piece);
//Determine if the move made was a jump and store the
//middle Space here so the piece can be "captured"
Space middle = getMiddle(move);
//"Capture" an opponents Piece if a jump occurred
if (middle != null) {
//Update the piece count
if(middle.getPiece().getColor() == Piece.Color.RED){
numOfRedPieces--;
}else{
numOfWhitePieces--;
}
this.capturedPieces.push(middle.getPiece());
board[middle.getRow()][middle.getCol()].removePiece();
}
if(end.getRow() == 0 || end.getRow() == size - 1){
Space space = this.board[end.getRow()][end.getCell()];
if(space.getPiece().getType() != Piece.Type.KING){
makeKing(this.board[end.getRow()][end.getCell()]);
}
}
}
/**
* Undo a previously made move on the game board.
*
* @param move the start and end coordinates of the move that was just made
*/
public void undoMove(Move move) {
//Reverse the move
Position start = move.getEnd();
Position end = move.getStart();
Piece piece = this.board[start.getRow()][start.getCell()].getPiece();
this.board[start.getRow()][start.getCell()].removePiece();
this.board[end.getRow()][end.getCell()].setPiece(piece);
//Determine if the move made was a jump and store the
//middle Space here so the piece can be "captured"
Space middle = getMiddle(move);
//"Capture" an opponents Piece if a jump occurred
if (middle != null) {
//Update the piece count
if(middle.getPiece().getColor() == Piece.Color.RED){
numOfRedPieces++;
}else{
numOfWhitePieces++;
}
//Replace a piece if the middle space is null. This is in case
//a player chooses to undo a jump
if (middle.getPiece() == null && !this.capturedPieces.empty()) {
board[middle.getRow()][middle.getCol()].setPiece(this.capturedPieces.pop());
}
}
if(start.getRow() == 0 || start.getRow() == size - 1){
Space space = this.board[end.getRow()][end.getCell()];
if(space.getPiece().getType() == Piece.Type.KING){
Piece.Color color = space.getPiece().getColor();
space.removePiece();
space.setPiece(new Piece(color, Piece.Type.SINGLE));
}
}
}
/**
* Change the current turn so that it is the other players.
*/
public void toggleTurn() {
if (this.currentTurn.equals(ActiveColor.RED)) {
this.currentTurn = ActiveColor.WHITE;
} else {
this.currentTurn = ActiveColor.RED;
}
//Create a new Stack so pieces captured in a previous
//turn are not remembered
this.capturedPieces = new Stack<>();
}
/**
* Finds the first instance of a players piece on the board.
*
* @param player the desired players piece color
* @return the coordinates for that piece as a Space
*/
public Space findPiece(Piece.Color player) {
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
if (player == Piece.Color.RED) {
Space space = board[i][j];
if (space.getPiece() != null &&
space.getPiece().getColor() == Piece.Color.RED) {
return space;
}
} else {
Space space = board[i][j];
if (space.getPiece() != null &&
space.getPiece().getColor() == Piece.Color.WHITE) {
return space;
}
}
}
}
return null;
}
/**
* Get the Space which a piece is jumping over.
*
* @param move the Move being made
* @return the Space that was jumped over (if a jump occurred)
*/
public Space getMiddle(Move move) {
Position start = move.getStart();
Position end = move.getEnd();
//The row and column location of the middle Space
int rowMiddle = 0;
int colMiddle = 0;
//Indicates the Piece is moving "upwards"
if (start.getRow() > end.getRow()) {
int distance = start.getRow() - end.getRow();
//Indicates a jump did not occur
if (distance < 2) {
return null;
}
rowMiddle = start.getRow() - 1;
//Indicates a leftwards move
if (start.getCell() < end.getCell()) {
colMiddle = start.getCell() + 1;
}
//Move occurred to the right of the start Position
else {
colMiddle = start.getCell() - 1;
}
}
//Indicates the Piece is moving "downwards"
if (start.getRow() < end.getRow()) {
int distance = end.getRow() - start.getRow();
//Indicates a jump did not occur
if (distance < 2) {
return null;
}
rowMiddle = start.getRow() + 1;
//Indicates a leftwards move
if (start.getCell() < end.getCell()) {
colMiddle = start.getCell() + 1;
}
//Move occurred to the right of the start Position
else {
colMiddle = start.getCell() - 1;
}
}
return board[rowMiddle][colMiddle];
}
/**
* Retrieves num of white pieces.
*
* @return # of white pieces
*/
public int getNumOfWhitePieces(){
return numOfWhitePieces;
}
/**
* Retrieves num of red pieces
*
* @return # of red pieces
*/
public int getNumOfRedPieces(){
return numOfRedPieces;
}
/**
* Retrieves the 2d array of Spaces representing the game board.
*
* @return 2d array of Spaces.
*/
public Space[][] getBoard() {
return this.board;
}
/**
* Turn a single piece into a king
*
* @param space - the space that has the piece to upgrade
* @return if the piece was successfully upgraded.
*/
public boolean makeKing(Space space){
Piece piece = space.getPiece();
boolean result = false;
//Check if piece is a single
if(piece.getType() == Piece.Type.SINGLE){
//Check piece color
if(piece.getColor() == Piece.Color.RED){
//Check if piece is in the correct row for promotion
if(space.getRow() == 0){
space.removePiece();
space.setPiece(new Piece(piece.getColor(), Piece.Type.KING));
result = true;
}
}
else if(piece.getColor() == Piece.Color.WHITE){
if(space.getRow() == size-1){
space.removePiece();
space.setPiece(new Piece(piece.getColor(), Piece.Type.KING));
result = true;
}
}
}
return result;
}
}
| 30.7979 | 92 | 0.514317 |
6978f7332f9db0851ca0cbf15d8d47d08d78bcbf | 1,121 | package com.procergs.starter.web.controllers;
import java.io.IOException;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.procergs.starter.db.OfferDao;
import com.procergs.starter.domain.Offer;
@WebServlet("/teste")
public class OfferController extends HttpServlet {
private static final long serialVersionUID = -6794238896686584661L;
List<Offer> offers = new OfferDao().getList();
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
{
RequestDispatcher dispatcher = req.getRequestDispatcher("inicio.jsp");
req.setAttribute("offers", offers);
dispatcher.forward(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// TODO Auto-generated method stub
}
}
| 27.341463 | 112 | 0.768064 |
8398d0e16dbdc8e9f139c143ff387fddfdad7743 | 284 | package org.biolink.model;
import java.util.List;
import lombok.*;
/* version: 2.2.16 */
/**
One or more causally connected executions of molecular functions
**/
@Data
@EqualsAndHashCode(callSuper=false)
public class BiologicalProcess extends BiologicalProcessOrActivity {
} | 14.947368 | 68 | 0.760563 |
2e3517ea963fff3c398e7fdd664df7473842170a | 250 | package org.amphiaraus.roundedlayout.sample;
import android.app.Application;
/**
* author: EwenQin
* since : 2017/8/3 上午11:51.
*/
public class App extends Application {
@Override public void onCreate() {
super.onCreate();
}
}
| 14.705882 | 44 | 0.668 |
4bbe227958a18cffed8ff585b567cbe0886efa9b | 2,041 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package de.guntram.mcmod.fabrictools;
import com.google.common.collect.Lists;
import de.guntram.mcmod.fabrictools.Types.ConfigurationSelectList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* @author gbl
*/
public class VolatileConfiguration implements IConfiguration {
private Map<String, ConfigurationItem> items;
public VolatileConfiguration() {
items = new HashMap<>();
}
public void addItem(ConfigurationItem item) {
items.put(item.key, item);
}
@Override
public List<String> getKeys() {
return Lists.newArrayList(items.keySet());
}
@Override
public Object getValue(String option) {
return items.get(option).getValue();
}
@Override
public boolean setValue(String option, Object value) {
ConfigurationItem item = items.get(option);
if (item == null) {
return false;
}
item.setValue(value);
return true;
}
@Override
public Object getDefault(String option) {
return items.get(option).defaultValue;
}
@Override
public Object getMin(String option) {
return items.get(option).minValue;
}
@Override
public Object getMax(String option) {
return items.get(option).maxValue;
}
@Override
public String getTooltip(String option) {
return items.get(option).toolTip;
}
@Override
public boolean isSelectList(String option) {
return items.get(option) instanceof ConfigurationSelectList;
}
@Override
public String[] getListOptions(String option) {
ConfigurationItem item = items.get(option);
if (item instanceof ConfigurationSelectList) {
return ((ConfigurationSelectList)item).getOptions();
}
return null;
}
}
| 24.297619 | 79 | 0.653111 |
9db5e6f70fa14b1927bca7cdddb2cd024cf7d9a5 | 9,428 | /*
* Copyright © 2017-2021 Ocado (Ocava)
*
* 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.ocadotechnology.event.scheduling;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.util.concurrent.AtomicDouble;
import com.ocadotechnology.event.EventUtil;
import com.ocadotechnology.time.TimeProvider;
/**
* A simulation-only implementation of EventScheduler which tracks which simulated thread is active in each event,
* permitting simulated thread handover to be implemented.
*/
public class SourceTrackingEventScheduler extends TypedEventScheduler {
private final Logger logger = LoggerFactory.getLogger(getClass());
private final SimpleDiscreteEventScheduler backingScheduler;
private final SourceSchedulerTracker tracker;
private final AtomicBoolean delayed = new AtomicBoolean(false);
private final List<MutableCancelableHolder> delayedDoNowRunnables = new ArrayList<>();
private final AtomicDouble delayEndTime = new AtomicDouble(Double.NaN);
private Cancelable delayEndEvent;
public SourceTrackingEventScheduler(SourceSchedulerTracker tracker, EventSchedulerType type, SimpleDiscreteEventScheduler backingScheduler) {
super(type);
this.backingScheduler = backingScheduler;
this.tracker = tracker;
}
public SourceTrackingEventScheduler createSibling(EventSchedulerType type) {
return new SourceTrackingEventScheduler(tracker, type, backingScheduler);
}
/**
* Simulates a GC or computational pause in this simulated 'thread'. If the 'thread' is currently paused, it will
* start running again at the latest of the current and new pause end times.
*/
public void delayExecutionUntil(double delayEndTime) {
delayExecutionUntil(delayEndTime, false);
}
/**
* Stops this scheduler (simulated thread) from executing any tasks before dealyEndTime.<br>
* <em>Other schedulers (simulated threads) are unaffected.</em><br><br>
*
* There are two return-from-this-call behaviours:<br>
* Blocking behaviour:<br>
* "This method returns when the timeProvider time equals delayEndTime.
* No events will have run for this scheduler, but other schedulers (simulated threads)
* will have run through all their events up to delayEndTime.<br>
* Any doNow events the caller then adds will run after all overdue delayed events have run
* (but before any doNow events those delayed events may add).
* Any doAt events the caller adds will run after all delayed events
* (we only add doAt events in the future, so this is expected behaviour).
* The delayed events will only start executing once the caller event has completed."
* <br>
* Non-blocking behaviour:<br>
* "This method returns immediately (with time unchanged).
* No events will have run for this scheduler (or any others) as no time has passed.<br>
* Any doNow events the caller then adds will be run first.
* Any doAt events the caller adds will be run in time order (as expected),
* The caller can schedule events earlier than delayedEndTime (as long as they are after "now")
* and they will be executed in order at the maximum of delayedEndTime and their scheduled time.
* <br><br>
* <em>This method is reentrant safe.</em>
*/
public void delayExecutionUntil(double delayEndTime, boolean blocking) {
logger.info("Delaying execution on thread {}: {} until {}",
type, (blocking ? "blocking" : "non-blocking"), EventUtil.logTime(delayEndTime));
if (this.delayEndTime.get() >= delayEndTime) {
// Either we're trying to delay in the past (in which case delayedEndEvent will be null and we should not delay)
// or, we're delaying within a delay (in which case delayedEndEvent will not be null and we're already delaying)
return;
}
delayed.set(true);
if (delayEndEvent != null) {
delayEndEvent.cancel();
}
this.delayEndTime.set(delayEndTime);
double delayStartTime = getTimeProvider().getTime();
// Use the backing scheduler so that ending the delay is not itself delayed. Would cause an infinite loop.
delayEndEvent = backingScheduler.doAt(delayEndTime, () -> delayFinished(delayStartTime), "Scheduler " + type + (blocking ? " blocking" : " delayed"));
if (blocking) {
// This causes the scheduler to run through all events up to delayEndTime and call "wrappedDoAt/Now" for each
// which adds to the delayedDoNowRunnables.
backingScheduler.blockEvent(() -> !delayed.get()); // exitCondition should be true when the delay is over
}
}
private void delayFinished(double delayStartTime) {
logger.info("Resuming execution on thread {}. Pause started at {}", type, EventUtil.logTime(delayStartTime));
delayed.set(false);
delayEndEvent = null;
// The doNow queue will be empty (otherwise we wouldn't have run our doAt).
// We don't want to actually run the delayed Runnables now as they'll interfere with the blocking Runnable (if any)
// So, we can schedule them on the doNow queue to preserve ordering.
delayedDoNowRunnables.stream()
.filter(h -> !h.wasCancelled)
.forEach(this::doNow); // schedules
delayedDoNowRunnables.clear();
}
@Override
public boolean hasOnlyDaemonEvents() {
return backingScheduler.hasOnlyDaemonEvents();
}
@Override
public void cancel(Event e) {
backingScheduler.cancel(e);
}
@Override
public void stop() {
backingScheduler.stop();
}
@Override
public TimeProvider getTimeProvider() {
return backingScheduler.getTimeProvider();
}
@Override
public long getThreadId() {
return backingScheduler.getThreadId();
}
@Override
public double getMinimumTimeDelta() {
return backingScheduler.getMinimumTimeDelta();
}
@Override
public Cancelable doNow(Runnable r, String description) {
MutableCancelableHolder cancelableHolder = new MutableCancelableHolder(r, description);
doNow(cancelableHolder);
return cancelableHolder;
}
private void doNow(MutableCancelableHolder cancelableHolder) {
Runnable newRunnable = wrappedForDoNow(cancelableHolder);
cancelableHolder.setCancelable(backingScheduler.doNow(newRunnable, cancelableHolder.description));
}
@Override
public Cancelable doAt(double time, Runnable r, String description, boolean isDaemon) {
MutableCancelableHolder cancelableHolder = new MutableCancelableHolder(r, description);
doAt(time, isDaemon, cancelableHolder);
return cancelableHolder;
}
private void doAt(double time, boolean isDaemon, MutableCancelableHolder cancelableHolder) {
Runnable newRunnable = wrappedForDoAt(cancelableHolder, isDaemon);
Cancelable cancelable = backingScheduler.doAt(time, newRunnable, cancelableHolder.description, isDaemon);
cancelableHolder.setCancelable(cancelable);
}
@Override
public boolean isThreadHandoverRequired() {
return !type.equals(tracker.getActiveSchedulerType());
}
private Runnable wrappedForDoNow(MutableCancelableHolder cancelableHolder) {
return () -> {
tracker.setActiveSchedulerType(type);
if (delayed.get()) {
delayedDoNowRunnables.add(cancelableHolder);
return;
}
cancelableHolder.runnable.run();
};
}
private Runnable wrappedForDoAt(MutableCancelableHolder cancelableHolder, boolean isDaemon) {
return () -> {
tracker.setActiveSchedulerType(type);
if (delayed.get()) {
doAt(delayEndTime.get(), isDaemon, cancelableHolder);
return;
}
cancelableHolder.runnable.run();
};
}
private static final class MutableCancelableHolder implements Cancelable {
private final Runnable runnable;
private final String description;
private Cancelable cancelable;
private boolean wasCancelled = false;
public MutableCancelableHolder(Runnable runnable, String description) {
this.runnable = runnable;
this.description = description;
}
public void setCancelable(Cancelable cancelable) {
this.cancelable = cancelable;
}
@Override
public void cancel() {
cancelable.cancel();
wasCancelled = true;
}
}
}
| 40.119149 | 158 | 0.683814 |
27bda4867a9ed0dbb9f1d6caf6b847f9584ebf54 | 525 | package cz.muni.fi.spnp.gui.components.menu.view.includes;
import cz.muni.fi.spnp.gui.components.mainwindow.Model;
import cz.muni.fi.spnp.gui.components.menu.view.general.GeneralItemsTableViewCollapsable;
/**
* Collapsable table view with the includes supporting operations add, edit and delete.
*/
public class IncludesCollapsableView extends GeneralItemsTableViewCollapsable<IncludeViewModel> {
public IncludesCollapsableView(Model model) {
super(model, "Includes", new IncludesTableView(model));
}
}
| 32.8125 | 97 | 0.788571 |
6971f3aa3e699b3ddd23697ba6b299bf7e5e5d9d | 369 | package com.stresstest.random.permutations.external;
public class ExternalObjectWithDefaultEnum {
final private ExternalDefaultEnum externalDefaultEnum;
public ExternalObjectWithDefaultEnum(final ExternalDefaultEnum enumPublic) {
this.externalDefaultEnum = enumPublic;
}
public ExternalDefaultEnum getExternalDefaultEnum() {
return externalDefaultEnum;
}
}
| 26.357143 | 77 | 0.840108 |
2f128b543f2419e61e346f399eba71b9aff9ea5c | 1,627 | /*
* Copyright (c) 2020, MicroRaft.
*
* 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.microraft.tutorial;
import io.microraft.RaftNode;
import io.microraft.statemachine.StateMachine;
import io.microraft.tutorial.atomicregister.AtomicRegister;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
/*
TO RUN THIS TEST ON YOUR MACHINE:
$ gh repo clone MicroRaft/MicroRaft
$ cd MicroRaft && ./mvnw clean test -Dtest=io.microraft.tutorial.LeaderElectionTest -DfailIfNoTests=false -Ptutorial
YOU CAN SEE THIS CLASS AT:
https://github.com/MicroRaft/MicroRaft/blob/master/microraft-tutorial/src/test/java/io/microraft/tutorial/LeaderElectionTest.java
*/
public class LeaderElectionTest
extends BaseLocalTest {
@Override
protected StateMachine createStateMachine() {
return new AtomicRegister();
}
@Test
public void testLeaderElection() {
RaftNode leader = waitUntilLeaderElected();
assertThat(leader).isNotNull();
System.out.println(leader.getLocalEndpoint().getId() + " is the leader!");
}
}
| 29.053571 | 132 | 0.73571 |
441ff43bd8765819572e676331f62e3380b9073e | 7,718 | /**
*
* http-toolbox: Command line HTTP tools
* Copyright (c) 2014, Sandeep Gupta
*
* http://sangupta.com/projects/http-toolbox
*
* 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.sangupta.httptools;
import io.airlift.command.Command;
import io.airlift.command.Option;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.LineIterator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sangupta.jerry.http.WebInvoker;
import com.sangupta.jerry.http.WebResponse;
import com.sangupta.jerry.util.AssertUtils;
import com.sangupta.jerry.util.GsonUtils;
/**
* Download all URLs and persist them to disk.
*
* @author sangupta
*
*/
@Command(name = "download", description = "Download URLs to the disk")
public class DownloadUrlCommand extends HttpToolBoxCommand {
private static final Logger LOGGER = LoggerFactory.getLogger(DownloadUrlCommand.class);
@Option(name = { "-u", "--urlFile" }, description = "File containing one URL per line", required = true)
public String urlFile;
@Option(name = { "-p", "--prefix" }, description = "Prefix to be appended to each URL")
public String prefix;
@Option(name = { "-s", "--suffix" }, description = "Suffix to be appended to each URL")
public String suffix;
@Option(name = { "-n", "--numThreads" }, description = "Number of threads to spawn for crawling, default is 20")
public int numThreads = 10;
@Option(name = { "-o", "--output" }, description = "Output folder where individual files are written", required = true)
public String outputFolder;
/**
* The runnable tasks that we create before we fire threads for downloading
*/
private final List<Runnable> downloadTasks = new ArrayList<Runnable>();
/**
* The suffix for each filename that we write to disk
*/
private final String storeSuffix = "." + UUID.randomUUID().toString() + ".response";
/**
* Keeps track of current progress
*/
private AtomicInteger count = new AtomicInteger();
/**
* The base directory where we need to write data
*/
private File outputDir;
/**
* Indicates if we need to split folders as number of files per folder will be huge
*/
private boolean splitFolders;
/**
* Total number of tasks that we have created
*/
private int numTasks;
@Override
public void run() {
File file = new File(this.urlFile);
if(file == null || !file.exists()) {
System.out.println("URL file cannot be found.");
return;
}
if(!file.isFile()) {
System.out.println("URL file does not represent a valid file.");
return;
}
if(this.numThreads <=0 || this.numThreads > 50) {
System.out.println("Number of assigned threads should be between 1 and 50");
return;
}
outputDir = new File(this.outputFolder);
if(outputDir.exists() && !outputDir.isDirectory()) {
System.out.println("Output folder does not represent a valid directory");
return;
}
if(!outputDir.exists()) {
outputDir.mkdirs();
}
// try and parse and read all URLs
int line = 1;
try {
LineIterator iterator = FileUtils.lineIterator(file);
while(iterator.hasNext()) {
++line;
String readURL = iterator.next();
createURLTask(readURL);
}
} catch(IOException e) {
System.out.println("Unable to read URLs from the file at line: " + line);
return;
}
// all set - create number of threads
// and start fetching
ExecutorService service = Executors.newFixedThreadPool(this.numThreads);
final long start = System.currentTimeMillis();
for(Runnable runnable : this.downloadTasks) {
service.submit(runnable);
}
// intialize some variables
this.numTasks = this.downloadTasks.size();
this.downloadTasks.clear();
if(this.numTasks > 1000) {
this.splitFolders = true;
}
// shutdown
shutdownAndAwaitTermination(service);
final long end = System.currentTimeMillis();
// everything done
System.out.println(this.downloadTasks.size() + " urls downloaded in " + (end - start) + " millis.");
}
/**
* Create a {@link Runnable} task for downloading and storage for the given
* URL.
*
* @param url
* the url to be downloaded
*/
private void createURLTask(String url) {
if(AssertUtils.isEmpty(url)) {
return;
}
if(AssertUtils.isNotEmpty(this.prefix)) {
url = this.prefix + url;
}
if(AssertUtils.isNotEmpty(this.suffix)) {
url = url + this.suffix;
}
final String downloadURL = url;
this.downloadTasks.add(new Runnable() {
@Override
public void run() {
downloadAndStoreURL(downloadURL);
}
});
}
/**
* Download the URL from web and then ask for storage.
*
* @param url
* the URL to be downloaded
*/
private void downloadAndStoreURL(String url) {
int current = count.incrementAndGet();
System.out.println("Download " + current + "/" + this.numTasks + " url: " + url + "...");
WebResponse response = WebInvoker.getResponse(url);
if(response == null) {
LOGGER.debug("Unable to fetch response for URL from server: {}", url);
return;
}
if(!response.isSuccess()) {
LOGGER.debug("Non-success response for URL from server: {}", url);
return;
}
store(current, url, response);
}
/**
* Store the downloaded web response to disk.
*
* @param current
* the current index count
*
* @param url
* the URL that was downloaded
*
* @param response
* the response from the server
*/
private void store(int current, String url, WebResponse response) {
String json = GsonUtils.getGson().toJson(response);
try {
if(this.splitFolders) {
int first = current % 16;
int second = (current / 16) % 16;
File folder = new File(this.outputDir.getAbsolutePath() + File.separator + first + File.separator + second);
folder.mkdirs();
FileUtils.write(new File(folder, "url-" + current + this.storeSuffix), json);
} else {
FileUtils.write(new File(this.outputDir, "url-" + current + this.storeSuffix), json);
}
} catch (IOException e) {
LOGGER.error("Unable to write web response from URL {} to disk: {}", url, json);
}
}
/**
* Terminate the thread pool
*
* @param pool
* the thread pool to terminate
*/
private void shutdownAndAwaitTermination(ExecutorService pool) {
pool.shutdown(); // Disable new tasks from being submitted
try {
// Wait a while for existing tasks to terminate
if (!pool.awaitTermination(1, TimeUnit.DAYS)) {
pool.shutdownNow(); // Cancel currently executing tasks
// Wait a while for tasks to respond to being cancelled
if (!pool.awaitTermination(60, TimeUnit.SECONDS))
System.err.println("Pool did not terminate");
}
} catch (InterruptedException ie) {
// (Re-)Cancel if current thread also interrupted
pool.shutdownNow();
// Preserve interrupt status
Thread.currentThread().interrupt();
}
}
}
| 27.663082 | 120 | 0.679321 |
1e15af6fa5e193a6bf74bfe077ed873648c06a9d | 995 | package com.appsmith.server.services;
import com.appsmith.external.models.DatasourceTestResult;
import com.appsmith.server.acl.AclPermission;
import com.appsmith.server.domains.Datasource;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.util.List;
import java.util.Set;
public interface DatasourceService extends CrudService<Datasource, String> {
Mono<DatasourceTestResult> testDatasource(Datasource datasource);
Mono<Datasource> findByName(String name, AclPermission permission);
Mono<Datasource> findById(String id, AclPermission aclPermission);
Mono<Datasource> findById(String id);
Set<String> extractKeysFromDatasource(Datasource datasource);
Mono<Datasource> validateDatasource(Datasource datasource);
Mono<Datasource> save(Datasource datasource);
Flux<Datasource> findAllByOrganizationId(String organizationId, AclPermission readDatasources);
Flux<Datasource> saveAll(List<Datasource> datasourceList);
}
| 31.09375 | 99 | 0.80603 |
ee3b2d1228497c02a6b9a8bdd875a5c78b0e160e | 2,547 | /*
* 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.aliyuncs.sofa.transform.v20190815;
import com.aliyuncs.sofa.model.v20190815.QueryLinkeBahamutCloudtenantresetcloudaccessResponse;
import com.aliyuncs.transform.UnmarshallerContext;
public class QueryLinkeBahamutCloudtenantresetcloudaccessResponseUnmarshaller {
public static QueryLinkeBahamutCloudtenantresetcloudaccessResponse unmarshall(QueryLinkeBahamutCloudtenantresetcloudaccessResponse queryLinkeBahamutCloudtenantresetcloudaccessResponse, UnmarshallerContext _ctx) {
queryLinkeBahamutCloudtenantresetcloudaccessResponse.setRequestId(_ctx.stringValue("QueryLinkeBahamutCloudtenantresetcloudaccessResponse.RequestId"));
queryLinkeBahamutCloudtenantresetcloudaccessResponse.setResultCode(_ctx.stringValue("QueryLinkeBahamutCloudtenantresetcloudaccessResponse.ResultCode"));
queryLinkeBahamutCloudtenantresetcloudaccessResponse.setResultMessage(_ctx.stringValue("QueryLinkeBahamutCloudtenantresetcloudaccessResponse.ResultMessage"));
queryLinkeBahamutCloudtenantresetcloudaccessResponse.setErrorMessage(_ctx.stringValue("QueryLinkeBahamutCloudtenantresetcloudaccessResponse.ErrorMessage"));
queryLinkeBahamutCloudtenantresetcloudaccessResponse.setErrorMsgParamsMap(_ctx.stringValue("QueryLinkeBahamutCloudtenantresetcloudaccessResponse.ErrorMsgParamsMap"));
queryLinkeBahamutCloudtenantresetcloudaccessResponse.setMessage(_ctx.stringValue("QueryLinkeBahamutCloudtenantresetcloudaccessResponse.Message"));
queryLinkeBahamutCloudtenantresetcloudaccessResponse.setResponseStatusCode(_ctx.longValue("QueryLinkeBahamutCloudtenantresetcloudaccessResponse.ResponseStatusCode"));
queryLinkeBahamutCloudtenantresetcloudaccessResponse.setResult(_ctx.booleanValue("QueryLinkeBahamutCloudtenantresetcloudaccessResponse.Result"));
queryLinkeBahamutCloudtenantresetcloudaccessResponse.setSuccess(_ctx.booleanValue("QueryLinkeBahamutCloudtenantresetcloudaccessResponse.Success"));
return queryLinkeBahamutCloudtenantresetcloudaccessResponse;
}
} | 68.837838 | 213 | 0.870828 |
389af8f9eb9250c5694f0d0cefd3e2957f076a06 | 23,978 | /*
* Copyright 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.fpl.gim.examplegame.utils;
import android.net.Uri;
import com.google.fpl.gim.examplegame.Choice;
import com.google.fpl.gim.examplegame.ChoiceMoment;
import com.google.fpl.gim.examplegame.ChoiceMomentData;
import com.google.fpl.gim.examplegame.Mission;
import com.google.fpl.gim.examplegame.Moment;
import com.google.fpl.gim.examplegame.Outcome;
import com.google.fpl.gim.examplegame.SfxMoment;
import com.google.fpl.gim.examplegame.SfxMomentData;
import com.google.fpl.gim.examplegame.SpokenTextMoment;
import com.google.fpl.gim.examplegame.SpokenTextMomentData;
import com.google.fpl.gim.examplegame.TimerMoment;
import com.google.fpl.gim.examplegame.TimerMomentData;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
/**
* A class for parsing a mission in a file.
*/
public class MissionParser {
private static final String TAG = MissionParser.class.getSimpleName();
private static final String ELEMENT_MISSION = "mission";
private static final String MISSION_ATTRIBUTE_START_ID = "start_id";
private static final String MISSION_ATTRIBUTE_NAME = "name";
private static final String ELEMENT_MOMENT = "moment";
// Types of moments.
private static final String MOMENT_TYPE_TIMER = "timer";
private static final String MOMENT_TYPE_SFX = "sfx";
private static final String MOMENT_TYPE_SPOKEN_TEXT = "spoken_text";
private static final String MOMENT_TYPE_CHOICE = "choice";
// Attributes for all moments.
private static final String MOMENT_ATTRIBUTE_TYPE = "type";
private static final String MOMENT_ATTRIBUTE_ID = "id";
// Attributes for specific types of moments.
private static final String ELEMENT_CHOICE = "choice";
private static final String ELEMENT_DESCRIPTION = "description";
private static final String ELEMENT_NEXT_MOMENT = "next_moment";
private static final String NEXT_MOMENT_ATTRIBUTE_ID = "id";
private static final String ELEMENT_LENGTH_MINUTES = "length_minutes";
private static final String ELEMENT_TIMEOUT_LENGTH_MINUTES = "timeout_length_minutes";
private static final String ELEMENT_DEFAULT_CHOICE = "default_choice";
private static final String ELEMENT_URI = "uri";
private static final String DEFAULT_CHOICE_ATTRIBUTE_ID = "id";
private static final String ELEMENT_OUTCOME = "outcome";
private static final String CHOICE_ATTRIBUTE_ID = "id";
private static final String ELEMENT_TEXT_TO_SPEAK = "text_to_speak";
private static final String ELEMENT_FICTIONAL_PROGRESS = "fictional_progress";
private static final String ELEMENT_ICON = "icon";
private static final String ICON_ATTRIBUTE_NAME = "name";
// Attributes for outcomes.
private static final String OUTCOME_ATTRIBUTE_DEPLETE_WEAPON = "deplete_weapon";
private static final String OUTCOME_ATTRIBUTE_INCREMENT_ENEMIES = "increment_enemies";
// ID that signifies the moment whose next is this is an ending moment.
private static final String DEFAULT_END_ID = null;
// ID that signifies that this Choice should only be displayed when the user's weapon is
// charged.
public static final String FIRE_WEAPON_CHOICE_ID = "fire";
/**
* Adds the Moments that define a Mission to that Mission by reading from input. Assumes
* XML file.
* @param missionStream The InputStream to read from.
* @param mission The Mission object to add Moments to.
* @throws MissionParseException
*/
public static void parseMission(InputStream missionStream, Mission mission) throws
MissionParseException {
Document doc = getDocumentFromInputStream(missionStream);
doc.getDocumentElement().normalize();
// Find the Mission's starting Moment.
NodeList missionNodes = doc.getElementsByTagName(ELEMENT_MISSION);
String startId = null;
for (int i = 0; i < missionNodes.getLength(); i++) {
Node missionNode = missionNodes.item(i);
if (isElementNode(missionNode)) {
startId = ((Element) missionNode).getAttribute(MISSION_ATTRIBUTE_START_ID);
Utils.logDebug(TAG, "Start id is \"" + startId + "\".");
break;
}
}
mission.setFirstMomentId(startId);
// Each Moment is represented as an Element
NodeList momentsList = doc.getElementsByTagName(ELEMENT_MOMENT);
for (int i = 0; i < momentsList.getLength(); i++) {
Node momentNode = momentsList.item(i);
// We check to make sure that we have Elements, though getElementsByTagName should
// provide only Elements.
if (isElementNode(momentNode)) {
Moment moment;
Element momentElement = (Element) momentNode;
// Data for all Moments
String id = momentElement.getAttribute(MOMENT_ATTRIBUTE_ID);
String momentType = momentElement.getAttribute(MOMENT_ATTRIBUTE_TYPE);
// Ideally would use Java 7 to switch on the strings themselves, but
// project is not configured to use Java 7.
if (momentType.equals(MOMENT_TYPE_CHOICE)) {
Utils.logDebug(TAG, "Choice moment created.");
ChoiceMomentData momentData = parseChoiceMomentElement(id, momentElement);
moment = new ChoiceMoment(mission, momentData);
} else if (momentType.equals(MOMENT_TYPE_SFX)) {
Utils.logDebug(TAG, "Sfx moment created.");
SfxMomentData momentData = parseSfxMoment(id, momentElement);
moment = new SfxMoment(mission, momentData);
} else if (momentType.equals(MOMENT_TYPE_TIMER)) {
Utils.logDebug(TAG, "Timer moment created.");
TimerMomentData momentData = parseTimerMoment(id, momentElement);
moment = new TimerMoment(mission, momentData);
} else if (momentType.equals(MOMENT_TYPE_SPOKEN_TEXT)) {
Utils.logDebug(TAG, "Spoken text moment created.");
SpokenTextMomentData momentData = parseSpokenTextMoment(id, momentElement);
moment = new SpokenTextMoment(mission, momentData);
} else {
throw new MissionParseException("Moment type invalid.");
}
mission.addMoment(id, moment);
}
}
}
/**
* Everything in an XML document is represented as a Document Object Model Node. Elements are
* defined between opening and closing tags, for example "<element></element>".
* @param node a DOM Node from a Document
* @return true if the DOM Node is an Element.
*/
private static boolean isElementNode(Node node) {
return node.getNodeType() == Node.ELEMENT_NODE;
}
/**
* Parses an Element representing an SfxMoment to create SfxMomentData.
* @param momentId Already parsed data about the Moment.
* @param momentElement the DOM Element to be parsed.
* @return data to construct an SfxMoment
*/
private static SfxMomentData parseSfxMoment(String momentId, Element momentElement)
throws MissionParseException {
Uri uri = parseUriElement(findSingleChildElementByTag(momentElement, ELEMENT_URI));
String nextMomentId = getNextMomentId(momentElement);
ArrayList<String> fictionalProgress = parseMomentFictionalProgress(momentElement);
return new SfxMomentData(momentId, nextMomentId, fictionalProgress, uri);
}
/**
* Parses an Element representing a TimerMoment to create TimerMomentData.
* @param momentId Already parsed data about the Moment.
* @param momentElement the DOM Element to be parsed.
* @return data to construct a TimerMoment
*/
private static TimerMomentData parseTimerMoment(String momentId, Element momentElement)
throws MissionParseException {
float momentLengthMinutes = parseLengthMinutesElement(
findSingleChildElementByTag(momentElement, ELEMENT_LENGTH_MINUTES));
String nextMomentId = getNextMomentId(momentElement);
ArrayList<String> fictionalProgress = parseMomentFictionalProgress(momentElement);
return new TimerMomentData(momentId, nextMomentId, fictionalProgress, momentLengthMinutes);
}
/**
* Parses an Element representing a SpokenTextMoment to create SpokenTextMomentData.
* @param momentId Already parsed data about the Moment.
* @param momentElement the DOM Element to be parsed.
* @return data to construct an SpokenTextMoment
*/
private static SpokenTextMomentData parseSpokenTextMoment(String momentId,
Element momentElement) throws MissionParseException {
String textToSpeak = parseTextToSpeakElement(
findSingleChildElementByTag(momentElement, ELEMENT_TEXT_TO_SPEAK));
String nextMomentId = getNextMomentId(momentElement);
ArrayList<String> fictionalProgress = parseMomentFictionalProgress(momentElement);
return new SpokenTextMomentData(momentId, nextMomentId, fictionalProgress, textToSpeak);
}
/**
* Parses an Element representing a ChoiceMoment to create ChoiceMomentData.
* @param momentId Already parsed data about the Moment.
* @param momentElement the DOM Element to be parsed.
* @return data to construct an ChoiceMoment
*/
private static ChoiceMomentData parseChoiceMomentElement(String momentId,
Element momentElement) throws MissionParseException {
String description = getDescription(momentElement);
float timeoutLengthMinutes = parseTimeoutLengthMinutesElement(
findSingleChildElementByTag(momentElement, ELEMENT_TIMEOUT_LENGTH_MINUTES));
String defaultChoiceId = parseDefaultChoiceElement(
findSingleChildElementByTag(momentElement, ELEMENT_DEFAULT_CHOICE));
ArrayList<String> fictionalProgress = parseMomentFictionalProgress(momentElement);
ChoiceMomentData data = new ChoiceMomentData(momentId, fictionalProgress, description,
defaultChoiceId, timeoutLengthMinutes);
NodeList choiceNodes = momentElement.getElementsByTagName(ELEMENT_CHOICE);
if (choiceNodes.getLength() > ChoiceMoment.MAXIMUM_NUM_OF_CHOICES) {
throw new MissionParseException("ChoiceMoments can have no more than "
+ ChoiceMoment.MAXIMUM_NUM_OF_CHOICES + " Choices.");
}
if (choiceNodes.getLength() < ChoiceMoment.MINIMUM_NUM_OF_CHOICES) {
throw new MissionParseException("ChoiceMoments can have no fewer than "
+ ChoiceMoment.MINIMUM_NUM_OF_CHOICES + " Choices.");
}
boolean defaultChoiceIsExistingChoice = false;
for (int i = 0; i < choiceNodes.getLength(); i++) {
Node choiceNode = choiceNodes.item(i);
if (isElementNode(choiceNode)) {
Choice choice = parseChoiceElement((Element) choiceNode);
if (choice.getChoiceId() == defaultChoiceId ||
choice.getChoiceId().equals(defaultChoiceId)) {
defaultChoiceIsExistingChoice = true;
}
data.addChoice(choice);
}
}
if (!defaultChoiceIsExistingChoice) {
throw new MissionParseException("Default choice ID is not a valid Choice.");
}
return data;
}
/**
* Creates a Choice from a DOM Element representing a Choice.
* @param choiceElement The DOM element representing a Choice.
* @return a Choice as defined in the DOM Element.
*/
private static Choice parseChoiceElement(Element choiceElement) throws MissionParseException {
String id = choiceElement.getAttribute(CHOICE_ATTRIBUTE_ID);
String description = getDescription(choiceElement);
String nextMomentId = getNextMomentId(choiceElement);
Outcome outcome =
parseOutcomeElement(findSingleChildElementByTag(choiceElement, ELEMENT_OUTCOME));
boolean requiresChargedWeapon = false;
if (id.equals(MissionParser.FIRE_WEAPON_CHOICE_ID)) {
requiresChargedWeapon = true;
}
ArrayList<String> fictionalProgress = parseNestedFictionalProgress(choiceElement);
String iconName =
parseIconElement(findSingleChildElementByTag(choiceElement, ELEMENT_ICON));
return new Choice(id, description, nextMomentId, outcome, requiresChargedWeapon,
fictionalProgress, iconName);
}
/**
* Creates an Outcome from a DOM Element representing an Outcome.
* @param outcomeElement The DOM element representing an Outcome.
* @return an Outcome as defined in the DOM Element.
*/
private static Outcome parseOutcomeElement(Element outcomeElement) {
boolean depleteWeapon =
Boolean.valueOf(outcomeElement.getAttribute(OUTCOME_ATTRIBUTE_DEPLETE_WEAPON));
boolean incrementEnemies =
Boolean.valueOf(outcomeElement.getAttribute(OUTCOME_ATTRIBUTE_INCREMENT_ENEMIES));
return new Outcome(depleteWeapon, incrementEnemies);
}
/**
* Given an XML element that has a nested next_moment element, finds the next moment ID.
* @param element An XML element.
* @return The next moment ID for the element.
*/
private static String getNextMomentId(Element element) throws MissionParseException {
Element nextMomentElement = findSingleChildElementByTag(element, ELEMENT_NEXT_MOMENT);
// If the element does not have a next moment, then set to the default end signifier.
if (nextMomentElement == null) {
return DEFAULT_END_ID;
}
return parseNextMomentElement(nextMomentElement);
}
/**
* Given an XML element that has a nested description element, finds the description.
* @param element An XML element.
* @return The description for the element.
*/
private static String getDescription(Element element) throws MissionParseException {
return parseDescriptionElement(findSingleChildElementByTag(element, ELEMENT_DESCRIPTION));
}
/**
* Finds the first occurrence of a child Element of a given tag within a parent's tree.
* @param parent An Element with child Elements
* @param tag The Element to find
* @return The first occurrence of an Element of type tag within the parent's child tree.
*/
private static Element findSingleChildElementByTag(Element parent, String tag)
throws MissionParseException {
Node node = null;
NodeList nodes = parent.getElementsByTagName(tag);
for (int i = 0; i < nodes.getLength(); i++) {
node = nodes.item(i);
if (isElementNode(node)) {
break;
}
node = null;
}
// All attributes are required except the 'next_moment' attribute. The lack of a
// 'next_moment' attribute signifies that the moment is the last moment in the mission.
if (!tag.equals(ELEMENT_NEXT_MOMENT) && node == null) {
throw new MissionParseException(tag + " could not be found.");
}
return (Element) node;
}
private static String parseNextMomentElement(Element nextMomentElement) {
String nextMomentId = nextMomentElement.getAttribute(NEXT_MOMENT_ATTRIBUTE_ID);
if (nextMomentId == null || nextMomentId.equals("")) {
return DEFAULT_END_ID;
}
return nextMomentId;
}
private static float parseLengthMinutesElement(Element lengthMinutesElement)
throws MissionParseException {
Node node = lengthMinutesElement.getFirstChild();
if (node == null) {
throw new MissionParseException("Length minutes element could not be found.");
}
return Float.parseFloat(node.getTextContent());
}
private static Uri parseUriElement(Element uriElement) throws MissionParseException {
Node node = uriElement.getFirstChild();
if (node == null) {
throw new MissionParseException("URI element could not be found.");
}
return Uri.parse(node.getTextContent());
}
private static String parseTextToSpeakElement(Element textToSpeakElement)
throws MissionParseException {
Node node = textToSpeakElement.getFirstChild();
if (node == null) {
throw new MissionParseException("Text to speak element could not be found.");
}
return node.getTextContent();
}
private static String parseDescriptionElement(Element descriptionElement)
throws MissionParseException {
Node node = descriptionElement.getFirstChild();
if (node == null) {
throw new MissionParseException("Description element could not be found.");
}
return descriptionElement.getTextContent();
}
private static float parseTimeoutLengthMinutesElement(Element timeoutLengthMinutesElement)
throws MissionParseException {
Node node = timeoutLengthMinutesElement.getFirstChild();
if (node == null) {
throw new MissionParseException("Timeout length minutes element could not be found.");
}
return Float.parseFloat(timeoutLengthMinutesElement.getFirstChild().getTextContent());
}
private static String parseDefaultChoiceElement(Element defaultChoiceElement)
throws MissionParseException {
String defaultChoice = defaultChoiceElement.getAttribute(DEFAULT_CHOICE_ATTRIBUTE_ID);
if (defaultChoice == null) {
throw new MissionParseException("Default choice element could not be found.");
}
if (defaultChoice.equals(FIRE_WEAPON_CHOICE_ID)) {
throw new MissionParseException("Default choice cannot be 'fire'.");
}
return defaultChoice;
}
/**
* Determines the name of a mission.
* @param missionStream InputStream to read from.
* @return A string of the name of the mission. Empty string if a name is not specified.
* @throws MissionParseException
*/
public static String getMissionName(InputStream missionStream) throws MissionParseException {
Document doc = getDocumentFromInputStream(missionStream);
doc.getDocumentElement().normalize();
NodeList missionNodes = doc.getElementsByTagName(ELEMENT_MISSION);
String missionName;
for (int i = 0; i < missionNodes.getLength(); i++) {
Node missionNode = missionNodes.item(i);
if (isElementNode(missionNode)) {
// Gives an empty string if the attribute is missing.
missionName = ((Element) missionNode).getAttribute(MISSION_ATTRIBUTE_NAME);
if (missionName.equals("")) {
throw new MissionParseException("Mission name missing.");
}
Utils.logDebug(TAG, "Mission name is " + missionName);
return missionName;
}
}
// No Element Node for Mission.
throw new MissionParseException("Mission element could not be found.");
}
/**
* Creates a Document given an InputStream.
* @param missionStream The stream to open a document from.
* @return The document, successfully parsed from xml.
* @throws MissionParseException
*/
private static Document getDocumentFromInputStream(InputStream missionStream) throws
MissionParseException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder;
try {
builder = factory.newDocumentBuilder();
} catch (ParserConfigurationException e) {
e.printStackTrace();
throw new MissionParseException("ParserConfigurationException while reading mission.");
}
Document doc;
try {
doc = builder.parse(missionStream);
} catch (SAXException e) {
e.printStackTrace();
throw new MissionParseException("SAXException while reading mission.");
} catch (IOException e) {
e.printStackTrace();
throw new MissionParseException("IOException while reading mission.");
}
return doc;
}
/**
* Determines the Fictional Progress strings associated with a moment.
* @param momentElement The moment to parse.
* @return A list of Fictional Progress strings.
*/
private static ArrayList<String> parseMomentFictionalProgress(Element momentElement)
throws MissionParseException {
ArrayList<String> progress = new ArrayList<>();
NodeList fictionalProgressNodes =
momentElement.getElementsByTagName(ELEMENT_FICTIONAL_PROGRESS);
for (int i = 0; i < fictionalProgressNodes.getLength(); i++) {
Node node = fictionalProgressNodes.item(i);
Element parent = (Element) node.getParentNode();
if (isElementNode(node) && parent.getTagName().equals(ELEMENT_MOMENT)) {
String progressString = parseFictionalProgressElement((Element) node);
progress.add(progressString);
}
}
return progress;
}
private static String parseFictionalProgressElement(Element element)
throws MissionParseException {
Node node = element.getFirstChild();
if (node == null) {
throw new MissionParseException("Fictional Progress Element not found");
}
String progressString = element.getFirstChild().getTextContent();
if (progressString.equals("")) {
throw new MissionParseException("Fictional Progress empty.");
}
return progressString;
}
private static ArrayList<String> parseNestedFictionalProgress(Element parent)
throws MissionParseException {
ArrayList<String> progressStrings = new ArrayList<>();
NodeList nodeList = parent.getElementsByTagName(ELEMENT_FICTIONAL_PROGRESS);
for (int i = 0; i < nodeList.getLength(); i++) {
Node node = nodeList.item(i);
if (isElementNode(node)) {
String progressString = parseFictionalProgressElement((Element) node);
progressStrings.add(progressString);
}
}
return progressStrings;
}
private static String parseIconElement(Element iconElement) throws MissionParseException {
String iconResourceName = iconElement.getAttribute(ICON_ATTRIBUTE_NAME);
if (iconResourceName == null || iconResourceName.equals("")) {
throw new MissionParseException("Icon element has no name attribute.");
}
return iconResourceName;
}
}
| 43.675774 | 99 | 0.678831 |
9aada397c960b6d1ac2d5ed7c03a38f7de8d782c | 380 | package com.core.app.ui.test2;
import android.content.Context;
import com.core.app.di.PerActivity;
import com.core.app.ui.base.IPresenter;
@PerActivity
public interface ITest2Presenter<V extends ITest2View> extends IPresenter<V> {
void init(Context context, String mainTopicTitle, int subTopicId);
void loadData();
void checkAnswer(int i);
void restest();
}
| 21.111111 | 78 | 0.752632 |
906c4bab7625b8c5c617176f8f9b086711f55ece | 4,410 | package se.lnu.siq.s4rdm3x.experiments.system;
/*
public class TeamMates extends System {
@Override
public String getName() {
return "TeamMates";
}
@Override
public HuGMe.ArchDef createAndMapArch(Graph a_g) {
HuGMe.ArchDef ad = new HuGMe.ArchDef();
HuGMe.ArchDef.Component commonUtil = createAddAndMapComponent(a_g, ad, "common.util","teammates/common/util/");
HuGMe.ArchDef.Component commonException = createAddAndMapComponent(a_g, ad,"common.exception", "teammates/common/exception/");
HuGMe.ArchDef.Component commonDataTransfer = createAddAndMapComponent(a_g, ad,"common.datatransfer", "teammates/common/datatransfer/");
HuGMe.ArchDef.Component uiAutomated = createAddAndMapComponent(a_g, ad,"ui.automated","teammates/ui/automated/");
HuGMe.ArchDef.Component uiController = createAddAndMapComponent(a_g, ad,"ui.controller","teammates/ui/controller/");
HuGMe.ArchDef.Component uiView = createAddAndMapComponent(a_g, ad, "ui.view", new String[]{"teammates/ui/datatransfer/", "teammates/ui/pagedata/", "teammates/ui/template/"});
HuGMe.ArchDef.Component logicCore = createAddAndMapComponent(a_g, ad,"logic.core", "teammates/logic/core/");
HuGMe.ArchDef.Component logicApi = createAddAndMapComponent(a_g, ad,"logic.api", "teammates/logic/api/");
HuGMe.ArchDef.Component logicBackdoor = createAddAndMapComponent(a_g, ad, "logic.backdoor", "teammates/logic/backdoor/");
HuGMe.ArchDef.Component storageEntity = createAddAndMapComponent(a_g, ad,"storage.entity", "teammates/storage/entity/");
HuGMe.ArchDef.Component storageApi = createAddAndMapComponent(a_g, ad,"storage.api", "teammates/storage/api/");
HuGMe.ArchDef.Component storageSearch = createAddAndMapComponent(a_g, ad,"storage.search", "teammates/storage/search/");
uiAutomated.addDependencyTo(commonUtil);
uiAutomated.addDependencyTo(commonException);
uiAutomated.addDependencyTo(commonDataTransfer);
uiAutomated.addDependencyTo(logicApi);
uiController.addDependencyTo(commonUtil);
uiController.addDependencyTo(commonException);
uiController.addDependencyTo(commonDataTransfer);
uiController.addDependencyTo(logicApi);
uiAutomated.addDependencyTo(commonUtil);
uiAutomated.addDependencyTo(commonException);
uiAutomated.addDependencyTo(commonDataTransfer);
uiView.addDependencyTo(commonUtil);
uiView.addDependencyTo(commonException);
uiView.addDependencyTo(commonDataTransfer);
logicCore.addDependencyTo(commonUtil);
logicCore.addDependencyTo(commonException);
logicCore.addDependencyTo(commonDataTransfer);
logicCore.addDependencyTo(storageApi);
logicApi.addDependencyTo(commonUtil);
logicApi.addDependencyTo(commonException);
logicApi.addDependencyTo(commonDataTransfer);
logicBackdoor.addDependencyTo(commonUtil);
logicBackdoor.addDependencyTo(commonException);
logicBackdoor.addDependencyTo(commonDataTransfer);
logicBackdoor.addDependencyTo(storageApi);
storageEntity.addDependencyTo(commonUtil);
storageEntity.addDependencyTo(commonException);
storageEntity.addDependencyTo(commonDataTransfer);
storageApi.addDependencyTo(commonUtil);
storageApi.addDependencyTo(commonException);
storageApi.addDependencyTo(commonDataTransfer);
storageSearch.addDependencyTo(commonUtil);
storageSearch.addDependencyTo(commonException);
storageSearch.addDependencyTo(commonDataTransfer);
commonDataTransfer.addDependencyTo(storageEntity);
return ad;
}
@Override
public boolean load(Graph a_g) {
LoadJar c = new LoadJar("data/teammatesV5.110.jar", "");
try {
c.run(a_g);
} catch (IOException e) {
java.lang.System.out.println(e);
return false;
}
return true;
}
private HuGMe.ArchDef.Component createAddAndMapComponent(Graph a_g, HuGMe.ArchDef a_ad, String a_componentName, String a_package) {
HuGMe.ArchDef.Component c = a_ad.addComponent(a_componentName);
c.mapToNodes(a_g, new Selector.Pkg(a_package));
return c;
}
}*/
| 48.461538 | 183 | 0.706803 |
73c1fcced752c15939b304eb6e5889d8e39c216d | 521 | package com.prohelion.maps;
import java.util.GregorianCalendar;
public interface Environment {
double getLatitude();
void setLatitude(double latitude);
double getLongitude();
void setLongitude(double longitude);
double getGradient();
void setGradient(double gradient);
GregorianCalendar getGregorianCalendar();
void setGregorianCalendar(GregorianCalendar calendar);
int getWindDirection();
void setWindDirection(int direction);
int getWindSpeed();
void setWindSpeed(int speed);
}
| 15.787879 | 55 | 0.761996 |
6a23c70049544cf7dac9ada2ca60c008d5e2f5a4 | 2,198 | /*
* hsb-kintel-17
* Copyright (C) 2018 hsb-kintel-17
* This file is covered by the LICENSE file in the root of this project.
*/
package de.kintel.ki.cli;
import com.google.common.collect.Lists;
import de.kintel.ki.model.Field;
import de.kintel.ki.model.Piece;
import de.kintel.ki.model.Player;
import de.kintel.ki.model.Rank;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
/**
* Created by kintel on 21.01.2018.
*/
public class Test {
public static void main(String[] args) {
new Test().run();
}
private void run() {
Field fieldA = new Field(false);
final Piece pieceA1 = new Piece(Player.SCHWARZ);
pieceA1.setRank(Rank.magenta);
final Piece pieceA2 = new Piece(Player.SCHWARZ);
pieceA2.setRank(Rank.rot);
fieldA.addStein(pieceA1);
fieldA.addStein(pieceA2);
Field fieldB = new Field(false);
final Piece pieceB1 = new Piece(Player.WEISS);
pieceB1.setRank(Rank.gruen);
final Piece pieceB2 = new Piece(Player.WEISS);
pieceB2.setRank(Rank.gelb);
final Piece pieceB3 = new Piece(Player.WEISS);
pieceB3.setRank(Rank.gelb);
fieldB.addStein(pieceB1);
fieldB.addStein(pieceB2);
fieldB.addStein(pieceB3);
RowRecord r1 = new RowRecord( Lists.newArrayList(new Field(true), fieldB, fieldA, fieldB, fieldB, fieldB, fieldB, fieldB, fieldB));
RowRecord r2 = new RowRecord( Lists.newArrayList(fieldA, fieldB, fieldB, fieldB, fieldB, fieldB, fieldB, fieldB, fieldB));
RowRecord r3 = new RowRecord( Lists.newArrayList(fieldA, fieldB, fieldB, fieldB, fieldB, fieldB, fieldB, fieldA, fieldB));
TablePrinter tablePrinter = new TablePrinter("", generateBoardHeader() );
tablePrinter.print(Lists.newArrayList(r1, r2, r3));
TablePrinter tablePrinter2 = new TablePrinter("", generateBoardHeader() );
tablePrinter2.print(Lists.newArrayList(r1, r2, r3));
}
public List<String> generateBoardHeader() {
return IntStream.rangeClosed(0, 9).boxed().map(String::valueOf).collect(Collectors.toList());
}
}
| 33.30303 | 139 | 0.675614 |
6b4c9c9a38fdc1d5d735956ecb43ffeaca928fd4 | 1,862 | package sep.gaia.controller.settings;
import javax.swing.JLabel;
import javax.swing.JSlider;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import sep.gaia.resources.ResourceMaster;
import sep.gaia.resources.tiles2d.TileCache;
import sep.gaia.resources.tiles2d.TileManager;
/**
* This class is to implement the <code>ActionListener</code> interface
* to check if the user wants to change the maximal cache size.
*
* @author Max Witzelsperger
*
*/
public class SliderListener implements ChangeListener {
private static final long MEGABYTE_TO_BYTE = 1024 * 1024;
/**
* the current size of the cache, which is to be set to 0 when the maximum
* cache size changes
*/
private JLabel cacheSize;
private static long maximumSizeOnDisk;
/**
* Constructs a new <code>SliderListener</code>, which changes the size
* of the tile cache dependent on the status of the slider that
* <code>this</code> is attached to. When the cache size is changed,
* the cached data gets automatically deleted.
*
* @param cacheSize shows the current cache size to the user, which
* is set to 0 when <code>stateChanged</code> is invoked
*/
public SliderListener(JLabel cacheSize) {
assert cacheSize != null : "JLabel with cache size must not be null!";
this.cacheSize = cacheSize;
}
@Override
public void stateChanged(ChangeEvent c) {
JSlider source = (JSlider)c.getSource();
TileManager manager = (TileManager) ResourceMaster.getInstance().getResourceManager(TileManager.MANAGER_LABEL);
TileCache cache = manager.getCache();
cache.setMaximumSizeOnDisk(source.getValue() * MEGABYTE_TO_BYTE);
this.cacheSize.setText("0");
cache.clear();
cache.manage();
SliderListener.maximumSizeOnDisk = source.getValue();
}
public static long getMaximum() {
return maximumSizeOnDisk;
}
}
| 27.791045 | 113 | 0.743824 |
63e868f40e9e247298f9c7d001b23730ef71ea5b | 538 | package com.github.windsekirun.daggerautoinject.sample;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.github.windsekirun.daggerautoinject.InjectBroadcastReceiver;
import dagger.android.AndroidInjection;
/**
* Created by pyxis on 18. 4. 25.
*/
@InjectBroadcastReceiver
public class MainBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
AndroidInjection.inject(this, context);
}
}
| 24.454545 | 71 | 0.789963 |
4411a4021f2f7396ed05e15222d54e3fa7c1881d | 169 | package com.dashboard.service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class AttendenceServiceImpl {
}
| 16.9 | 46 | 0.822485 |
525ebd18c5f17ef2933705ced1cc5a2c6e6e89eb | 410 | package command.Turtle;
import command.Command;
import turtle.Turtle;
public class LeftCommand implements Command{
private Turtle myTurtle;
private double myMovement;
public LeftCommand(double movement, Turtle turtle){
myTurtle = turtle;
myMovement = Math.toRadians(movement);
}
public double execute(){
myTurtle.setDirection(myTurtle.getDirection() - myMovement);
return myMovement;
}
}
| 19.52381 | 62 | 0.765854 |
af69e13304970835315150c77a918886a75280b7 | 3,677 | /* **************************************************************************
* $OpenLDAP$
*
* Copyright (C) 1999, 2000, 2001 Novell, Inc. All Rights Reserved.
*
* THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND
* TREATIES. USE, MODIFICATION, AND REDISTRIBUTION OF THIS WORK IS SUBJECT
* TO VERSION 2.0.1 OF THE OPENLDAP PUBLIC LICENSE, A COPY OF WHICH IS
* AVAILABLE AT HTTP://WWW.OPENLDAP.ORG/LICENSE.HTML OR IN THE FILE "LICENSE"
* IN THE TOP-LEVEL DIRECTORY OF THE DISTRIBUTION. ANY USE OR EXPLOITATION
* OF THIS WORK OTHER THAN AS AUTHORIZED IN VERSION 2.0.1 OF THE OPENLDAP
* PUBLIC LICENSE, OR OTHER PRIOR WRITTEN CONSENT FROM NOVELL, COULD SUBJECT
* THE PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY.
******************************************************************************/
package org.ietf.ldap;
/**
* <p>An LDAPSearchResults provides access to all results received during
* the operation (entries and exceptions).</p>
*
* @see <a href="../../../../api/com/novell/ldap/LDAPSearchResults.html">
com.novell.ldap.LDAPSearchResults</a>
*/
public class LDAPSearchResults
{
private com.novell.ldap.LDAPSearchResults results;
/**
* Constructs searchResults from a com.novell.ldap.LDAPSearchResults object
*/
/* package */
LDAPSearchResults( com.novell.ldap.LDAPSearchResults results)
{
this.results = results;
}
/**
* get the com.novell.ldap.LDAPSearchResults object
*/
/* package */
com.novell.ldap.LDAPSearchResults getWrappedObject()
{
return results;
}
/**
* Returns a count of the entries in the search result.
*
* @see <a href="../../../../api/com/novell/ldap/LDAPSearchResults.html#getCount()">
com.novell.ldap.LDAPSearchResults.getCount()</a>
*/
public int getCount()
{
return results.getCount();
}
/**
* Returns the latest server controls returned by the server
* in the context of this search request, or null
* if no server controls were returned.
*
* @see <a href="../../../../api/com/novell/ldap/LDAPSearchResults.html#getResponseControls()">
com.novell.ldap.LDAPSearchResults.getResponseControls()</a>
*/
public LDAPControl[] getResponseControls()
{
com.novell.ldap.LDAPControl[] controls = results.getResponseControls();
if( controls == null) {
return null;
}
LDAPControl[] ietfControls = new LDAPControl[controls.length];
for( int i=0; i < controls.length; i++) {
ietfControls[i] = new LDAPControl( controls[i]);
}
return ietfControls;
}
/**
* Reports if there are more search results.
*
* @see <a href="../../../../api/com/novell/ldap/LDAPSearchResults.html#hasMore()">
com.novell.ldap.LDAPSearchResults.hasMoreElements()</a>
*/
public boolean hasMore()
{
return results.hasMore();
}
/**
* Returns the next result as an LDAPEntry.
*
* @see <a href="../../../../api/com/novell/ldap/LDAPSearchResults.html#next()">
com.novell.ldap.LDAPSearchResults.next()</a>
*/
public LDAPEntry next() throws LDAPException
{
try {
return new LDAPEntry( results.next());
} catch( com.novell.ldap.LDAPException ex) {
if( ex instanceof com.novell.ldap.LDAPReferralException) {
throw new LDAPReferralException(
(com.novell.ldap.LDAPReferralException)ex);
} else {
throw new LDAPException( ex);
}
}
}
}
| 32.830357 | 99 | 0.594506 |
e62d3614428100e21075c56c15a50ebbc66c63df | 787 | package org.activiti.engine.impl.bpmn.helper;
import java.io.Serializable;
public class TaskSimpleInfo implements Serializable{
private static final long serialVersionUID = 1L;
private String taskId;
private String taskDefiniotinKey;
private String assignee;
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getAssignee() {
return assignee;
}
public void setAssignee(String assignee) {
this.assignee = assignee;
}
public String getTaskDefiniotinKey() {
return taskDefiniotinKey;
}
public void setTaskDefiniotinKey(String taskDefiniotinKey) {
this.taskDefiniotinKey = taskDefiniotinKey;
}
@Override
public String toString() {
return "taskId:="+taskId;
}
}
| 16.061224 | 61 | 0.740788 |
d125947e274cc4e86032aa4c2fb777abe25ef680 | 1,124 | /**
* This file is part of eps4j-core, http://github.com/eps4j/eps4j-core
*
* Copyright (c) 2017, Arnaud Malapert, Université Nice Sophia Antipolis. All rights reserved.
*
* Licensed under the BSD 3-clause license.
* See LICENSE file in the project root for full license information.
*/
/**
* This file is part of eps4j.
*
* Copyright (c) 2017, Arnaud Malapert (Université Côte d’Azur, CNRS, I3S, France)
* All rights reserved.
*
* This software may be modified and distributed under the terms
* of the BSD license. See the LICENSE file for details.
*/
package org.eps4j.specs.actors;
import org.chocosolver.pf4cs.IUpDown;
import org.eps4j.specs.msg.IBetter;
import org.eps4j.specs.msg.IJob;
/**
*
* @param <B> Better concrete class
* @param <J> job concrete class
*/
public interface IForemanEPS<B extends IBetter, J extends IJob> extends IUpDown {
boolean hasEnded();
/**
* @return <code>true</code> if job is finished.
*/
boolean recordCollect(J job, B better);
void recordCollect(B better);
void recordBetter(J job, B better);
void recordBetter(B better);
B getBetter();
} | 23.914894 | 94 | 0.708185 |
600b692b2d3694699a45a60b67c3e180d14fe30d | 4,443 | package com.dwarfeng.dutil.develop.reuse;
import java.util.Collection;
import java.util.Iterator;
import java.util.Objects;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
/**
* 复用工具类。
*
* <p>
* 由于只是包含静态字段以及静态方法的工具类,因此该类禁止继承或者外部实例化。
*
* @author DwArFeng
* @since 0.2.1-beta
*/
public final class ResuseUtil {
/**
* 根据指定的复用池生成一个线程安全的复用池。
*
* @param <E>
* 复用池的存储元素的类型。
* @param reusePool
* 指定的复用池。
* @return 指定的复用池生成的线程安全的复用池。
* @throws NullPointerException
* 入口参数为 <code>null</code>。
*/
public static <E> SyncReusePool<E> syncReusePool(ReusePool<E> reusePool) throws NullPointerException {
Objects.requireNonNull(reusePool, "入口参数 reusePool 不能为 null。");
return new InnerSyncReusePool<>(reusePool);
}
private static final class InnerSyncReusePool<E> implements SyncReusePool<E> {
private final ReusePool<E> delegate;
private final ReadWriteLock lock = new ReentrantReadWriteLock();
public InnerSyncReusePool(ReusePool<E> delegate) {
this.delegate = delegate;
}
/**
* {@inheritDoc}
*/
@Override
public ReadWriteLock getLock() {
return lock;
}
/**
* {@inheritDoc}
*/
@Override
public int size() {
lock.readLock().lock();
try {
return delegate.size();
} finally {
lock.readLock().unlock();
}
}
/**
* {@inheritDoc}
*/
@Override
public boolean isEmpty() {
lock.readLock().lock();
try {
return delegate.isEmpty();
} finally {
lock.readLock().unlock();
}
}
/**
* {@inheritDoc}
*/
@Override
public boolean contains(Object object) {
lock.readLock().lock();
try {
return delegate.contains(object);
} finally {
lock.readLock().unlock();
}
}
/**
* {@inheritDoc}
*/
@Override
public boolean containsAll(Collection<?> collection) throws NullPointerException {
lock.readLock().lock();
try {
return delegate.containsAll(collection);
} finally {
lock.readLock().unlock();
}
}
/**
* {@inheritDoc}
*/
@Override
public Condition getCondition(Object object) {
lock.readLock().lock();
try {
return delegate.getCondition(object);
} finally {
lock.readLock().unlock();
}
}
/**
* {@inheritDoc}
*/
@Override
public boolean put(E element, Condition condition) {
lock.writeLock().lock();
try {
return delegate.put(element, condition);
} finally {
lock.writeLock().unlock();
}
}
/**
* {@inheritDoc}
*/
@Override
public boolean remove(Object object) {
lock.writeLock().lock();
try {
return delegate.remove(object);
} finally {
lock.writeLock().unlock();
}
}
/**
* {@inheritDoc}
*/
@Override
public boolean removeAll(Collection<?> collection) {
lock.writeLock().lock();
try {
return delegate.removeAll(collection);
} finally {
lock.writeLock().unlock();
}
}
/**
* {@inheritDoc}
*/
@Override
public boolean retainAll(Collection<?> collection) {
lock.writeLock().lock();
try {
return delegate.retainAll(collection);
} finally {
lock.writeLock().unlock();
}
}
/**
* {@inheritDoc}
*/
@Override
public void clear() {
lock.writeLock().lock();
try {
delegate.clear();
} finally {
lock.writeLock().unlock();
}
}
/**
* {@inheritDoc}
*/
@Override
public BatchOperator<E> batchOperator() {
lock.readLock().lock();
try {
return delegate.batchOperator();
} finally {
lock.readLock().unlock();
}
}
/**
* {@inheritDoc}
*/
@Override
public Iterator<E> iterator() {
lock.readLock().lock();
try {
return delegate.iterator();
} finally {
lock.readLock().unlock();
}
}
/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
lock.readLock().lock();
try {
return delegate.hashCode();
} finally {
lock.readLock().unlock();
}
}
/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object obj) {
lock.readLock().lock();
try {
return delegate.equals(obj);
} finally {
lock.readLock().unlock();
}
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
lock.readLock().lock();
try {
return delegate.toString();
} finally {
lock.readLock().unlock();
}
}
}
// 禁止外部实例化。
private ResuseUtil() {
}
}
| 17.355469 | 103 | 0.600495 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.