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
|
|---|---|---|---|---|---|
f1a94bcf589e0160bb37c067b268240d2586c128
| 732
|
package com.gemini.starwar.Characteristics;
import java.util.List;
public class FilmsDetails {
private final String mTitle;
private final String mEpisode_id;
private final String mCrawl;
private final List<String> mPlanets;
public FilmsDetails(String title, String episode_id, String crawl, List<String> planets) {
mTitle = title;
mEpisode_id = episode_id;
mCrawl = crawl;
mPlanets = planets;
}
public String getmTitle() {
return mTitle;
}
public String getmEpisode_id() {
return mEpisode_id;
}
public String getmCrawl() {
return mCrawl;
}
public List<String> getmPlanets() {
return mPlanets;
}
}
| 17.428571
| 94
| 0.637978
|
d06c932fc6f39bc506384d14e2614593c0652a3e
| 815
|
package com.biservices.wakalni.wakalni.persistence.repositories;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.biservices.wakalni.wakalni.persistence.entities.Menu;
import com.biservices.wakalni.wakalni.persistence.entities.MenuCategory;
import com.biservices.wakalni.wakalni.persistence.entities.Restaurant;
@Repository
public interface MenuRepository extends JpaRepository<Menu, Long> {
List<Menu> findByRestaurant (Restaurant resto);
List<Menu> findByMenuCategory (MenuCategory menuCategory);
List<Menu> findByRestaurantAndMenuCategory (Restaurant resto, MenuCategory menuCategory);
List<Menu> findTop10ByOrderByLikeNumberDesc();
List<Menu> findTop10ByOrderByDontLikeNumberDesc();
}
| 40.75
| 91
| 0.825767
|
3fff8ad3913586cb55b1bd8ae1fcb2195cf56f77
| 1,824
|
package com.fasterxml.jackson.databind.ser.std;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.BeanProperty;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import com.fasterxml.jackson.databind.type.ReferenceType;
import com.fasterxml.jackson.databind.util.NameTransformer;
import java.util.concurrent.atomic.AtomicReference;
public class AtomicReferenceSerializer extends ReferenceTypeSerializer<AtomicReference<?>> {
private static final long serialVersionUID = 1;
public AtomicReferenceSerializer(ReferenceType fullType, boolean staticTyping, TypeSerializer vts, JsonSerializer<Object> ser) {
super(fullType, staticTyping, vts, ser);
}
protected AtomicReferenceSerializer(AtomicReferenceSerializer base, BeanProperty property, TypeSerializer vts, JsonSerializer<?> valueSer, NameTransformer unwrapper, Include contentIncl) {
super(base, property, vts, valueSer, unwrapper, contentIncl);
}
protected AtomicReferenceSerializer withResolved(BeanProperty prop, TypeSerializer vts, JsonSerializer<?> valueSer, NameTransformer unwrapper, Include contentIncl) {
return (this._property == prop && contentIncl == this._contentInclusion && this._valueTypeSerializer == vts && this._valueSerializer == valueSer && this._unwrapper == unwrapper) ? this : new AtomicReferenceSerializer(this, prop, vts, valueSer, unwrapper, contentIncl);
}
protected boolean _isValueEmpty(AtomicReference<?> value) {
return value.get() == null;
}
protected Object _getReferenced(AtomicReference<?> value) {
return value.get();
}
protected Object _getReferencedIfPresent(AtomicReference<?> value) {
return value.get();
}
}
| 48
| 276
| 0.773026
|
5fd7c3539b703e235fff79bc119e754a5babd03e
| 773
|
package org.zalando.opentracing.flowid;
import io.opentracing.noop.NoopTracerFactory;
import org.junit.jupiter.api.Test;
import java.util.HashMap;
import java.util.Map;
import static java.util.Collections.emptyMap;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
class DefaultFlowNoopTracerTest {
private final Flow unit = Flow.create(NoopTracerFactory.create());
@Test
void shouldThrowNoActiveSpanFoundException() {
assertThrows(IllegalStateException.class, unit::currentId);
}
@Test
void writeToShouldNotThrow() {
final Map<String, String> target = new HashMap<>();
unit.writeTo(target::put);
assertEquals(emptyMap(), target);
}
}
| 27.607143
| 70
| 0.741268
|
0a448e2502df4eca9e4a59b112d208a5f6e9aee0
| 1,210
|
package com.ajh.futurestar.web.servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class SetFromPageServlet
*/
@WebServlet("/setfrompage.do")
public class BizFromPageSetterServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public BizFromPageSetterServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.getSession().setAttribute("frompage", request.getParameter("frompage"));
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
| 30.25
| 119
| 0.766942
|
63d5054fa8cbe37906a467281a5d935f6d68ee2a
| 1,938
|
package org.murasaki.battleship;
import org.approvaltests.awt.AwtApprovals;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
import static org.junit.jupiter.api.Assertions.*;
import static org.murasaki.battleship.ShotResultType.*;
class BoardTest {
@Test
void boardSize() {
Board board = new Board();
assertEquals(10, board.coordinates.length);
assertEquals(10, board.coordinates[0].length);
}
@Test
void emptyBoard() {
Board board = new Board();
Arrays.stream(board.coordinates).flatMap(Arrays::stream).forEach(Assertions::assertNotNull);
Arrays.stream(board.coordinates).flatMap(Arrays::stream).forEach(coordinate -> assertNull(board.getShipAt(coordinate)));
}
@Test
void placeShips() {
GuiBoard board = new GuiBoard();
board.placeShip(Ship.AIRCRAFT_CARRIER, new Coordinate(1, 2), Orientation.HORIZONTAL);
board.placeShip(Ship.SUBMARINE, new Coordinate(7, 4), Orientation.VERTICAL);
AwtApprovals.verify(board);
}
@Test
void fireOnShips() {
GuiBoard board = new GuiBoard();
board.placeShip(Ship.AIRCRAFT_CARRIER, new Coordinate(2, 3), Orientation.HORIZONTAL);
board.placeShip(Ship.SUBMARINE, new Coordinate(3, 5), Orientation.VERTICAL);
assertEquals(new ShotResult(MISSED, null), board.fireOn(new Coordinate(6,7)));
assertEquals(new ShotResult(HIT, Ship.AIRCRAFT_CARRIER), board.fireOn(new Coordinate(4,3)));
AwtApprovals.verify(board);
}
@Test
void sinkOnShips() {
GuiBoard board = new GuiBoard();
board.placeShip(Ship.DESTROYER, new Coordinate(3, 4), Orientation.HORIZONTAL);
assertEquals(new ShotResult(HIT, Ship.DESTROYER), board.fireOn(new Coordinate(3,4)));
assertEquals(new ShotResult(SANK, Ship.DESTROYER), board.fireOn(new Coordinate(4,4)));
}
}
| 35.236364
| 128
| 0.68937
|
5a987aa9d3a0b79f19649271377afb2c6d25d2e9
| 735
|
package ml.pkom.easyapi.config;
import java.io.File;
import java.util.LinkedHashMap;
import java.util.Map;
public interface IConfig {
Map<String, Object> configMap = new LinkedHashMap<>();
Object get(String key);
String getString(String key);
int getInt(String key);
boolean getBoolean(String key);
boolean set(String key, Object value);
boolean setString(String key, String value);
boolean setInt(String key, int value);
boolean setBoolean(String key, boolean value);
boolean load(String file);
boolean load(File file);
boolean save(String file);
boolean save(File file);
boolean save(String file, boolean pretty);
boolean save(File file, boolean pretty);
}
| 19.342105
| 58
| 0.69932
|
d98855c005c9556ac9803eb29d0466d934f2fb0f
| 4,482
|
/*
* 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.netbeans.modules.javascript2.model;
import com.oracle.js.parser.ir.FunctionNode;
import java.util.Stack;
import org.netbeans.modules.csl.spi.ParserResult;
import org.netbeans.modules.javascript2.model.api.JsObject;
import org.netbeans.modules.javascript2.model.api.JsWith;
import org.openide.filesystems.FileObject;
/**
*
* @author Petr Pisl
*/
public final class ModelBuilder {
private final JsFunctionImpl globalObject;
private final Stack<JsObjectImpl> stack;
private final Stack<DeclarationScopeImpl> functionStack;
private int anonymObjectCount;
private int withObjectCount;
private JsWith currentWith;
public static final String WITH_OBJECT_NAME_START = "With$"; //NOI18N
public static final String ANONYMOUS_OBJECT_NAME_START = "Anonym$"; //NOI18N
ModelBuilder(JsFunctionImpl globalObject) {
this.globalObject = globalObject;
this.stack = new Stack<>();
this.functionStack = new Stack<>();
anonymObjectCount = 0;
withObjectCount = 0;
setCurrentObject(globalObject);
currentWith = null;
}
/**
* @return the fileScope
*/
public JsObjectImpl getGlobal() {
return globalObject;
}
/**
* @return the currentScope or null
*/
public JsObjectImpl getCurrentObject() {
return stack.isEmpty() ? globalObject : stack.peek();
}
public DeclarationScopeImpl getCurrentDeclarationScope() {
return functionStack.isEmpty() ? globalObject : functionStack.peek();
}
public JsFunctionImpl getCurrentDeclarationFunction() {
JsObject declarationScope = getCurrentDeclarationScope();
while(declarationScope != null && declarationScope.getParent() != null && !(declarationScope instanceof JsFunctionImpl)) {
declarationScope = declarationScope.getParent();
}
if (declarationScope == null) {
declarationScope = globalObject;
}
return (JsFunctionImpl)declarationScope;
}
/**
* @param currentScope the currentScope to set
*/
void setCurrentObject(JsObjectImpl object) {
this.stack.push(object);
if (object instanceof DeclarationScopeImpl) {
this.functionStack.push((DeclarationScopeImpl)object);
}
if (object instanceof JsWith) {
this.currentWith = (JsWith)object;
}
}
void reset() {
if (!stack.empty()) {
JsObject object = stack.pop();
if (object instanceof DeclarationScopeImpl && !functionStack.empty()) {
functionStack.pop();
}
if (object instanceof JsWith && currentWith != null) {
currentWith = currentWith.getOuterWith();
}
}
}
String getUnigueNameForAnonymObject(ParserResult parserResult) {
FileObject fo = parserResult.getSnapshot().getSource().getFileObject();
if (fo != null) {
return fo.getName() + ANONYMOUS_OBJECT_NAME_START + anonymObjectCount++;
}
return ANONYMOUS_OBJECT_NAME_START + anonymObjectCount++;
}
String getUnigueNameForWithObject() {
return WITH_OBJECT_NAME_START + withObjectCount++;
}
public JsWith getCurrentWith() {
return currentWith;
}
public String getFunctionName(FunctionNode node) {
if (node.isAnonymous() ) {
return globalObject.getName() + node.getName().replace(':', '#');
} else {
if (node.isNamedFunctionExpression()) {
return node.getName();
}
return node.getIdent().getName();
}
}
}
| 32.955882
| 130
| 0.661089
|
684fd62d4b687fbd634b3539ae6cc9e95297c8ae
| 1,271
|
package com.sanderp.bartrider.test;
import android.support.test.filters.LargeTest;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import com.sanderp.bartrider.R;
import com.sanderp.bartrider.TripOverviewActivity;
import com.sanderp.bartrider.utility.TestUtils;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.doesNotExist;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class NoNetworkTest {
private TestUtils utils = new TestUtils();
@Rule
public ActivityTestRule mActivityRule = new ActivityTestRule<>(TripOverviewActivity.class, false, false);
@Test
public void checkAll() {
mActivityRule.launchActivity(null);
onView(withId(R.id.fab)).perform(click());
onView(withId(R.id.trip_planner_layout)).check(doesNotExist());
onView(withId(R.id.action_advisory)).perform(click());
onView(withId(R.id.advisory_layout)).check(doesNotExist());
}
}
| 33.447368
| 109
| 0.776554
|
22540adb105f6dbf1bcc7fc58d349bc2f18fc8bb
| 3,223
|
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.trino.operator.scalar.timetz;
import io.airlift.slice.Slice;
import io.trino.spi.TrinoException;
import io.trino.spi.function.Description;
import io.trino.spi.function.LiteralParameters;
import io.trino.spi.function.ScalarFunction;
import io.trino.spi.function.SqlType;
import io.trino.spi.type.LongTimeWithTimeZone;
import static io.trino.spi.StandardErrorCode.INVALID_FUNCTION_ARGUMENT;
import static io.trino.spi.type.DateTimeEncoding.packTimeWithTimeZone;
import static io.trino.spi.type.DateTimeEncoding.unpackOffsetMinutes;
import static io.trino.spi.type.DateTimeEncoding.unpackTimeNanos;
import static io.trino.type.DateTimes.PICOSECONDS_PER_HOUR;
import static io.trino.type.DateTimes.PICOSECONDS_PER_MILLISECOND;
import static io.trino.type.DateTimes.PICOSECONDS_PER_MINUTE;
import static io.trino.type.DateTimes.PICOSECONDS_PER_NANOSECOND;
import static io.trino.type.DateTimes.PICOSECONDS_PER_SECOND;
import static java.util.Locale.ENGLISH;
@Description("Truncate to the specified precision")
@ScalarFunction("date_trunc")
public final class DateTrunc
{
private DateTrunc() {}
@LiteralParameters({"x", "p"})
@SqlType("time(p) with time zone")
public static long truncate(
@SqlType("varchar(x)") Slice unit,
@SqlType("time(p) with time zone") long packedTime)
{
long picos = unpackTimeNanos(packedTime) * PICOSECONDS_PER_NANOSECOND;
return packTimeWithTimeZone(truncate(picos, unit) / PICOSECONDS_PER_NANOSECOND, unpackOffsetMinutes(packedTime));
}
@LiteralParameters({"x", "p"})
@SqlType("time(p) with time zone")
public static LongTimeWithTimeZone truncate(
@SqlType("varchar(x)") Slice unit,
@SqlType("time(p) with time zone") LongTimeWithTimeZone time)
{
return new LongTimeWithTimeZone(truncate(time.getPicoseconds(), unit), time.getOffsetMinutes());
}
private static long truncate(long picos, Slice unit)
{
String unitString = unit.toStringUtf8().toLowerCase(ENGLISH);
switch (unitString) {
case "millisecond":
return picos / PICOSECONDS_PER_MILLISECOND * PICOSECONDS_PER_MILLISECOND;
case "second":
return picos / PICOSECONDS_PER_SECOND * PICOSECONDS_PER_SECOND;
case "minute":
return picos / PICOSECONDS_PER_MINUTE * PICOSECONDS_PER_MINUTE;
case "hour":
return picos / PICOSECONDS_PER_HOUR * PICOSECONDS_PER_HOUR;
default:
throw new TrinoException(INVALID_FUNCTION_ARGUMENT, "'" + unitString + "' is not a valid Time field");
}
}
}
| 41.320513
| 121
| 0.72417
|
2c01c2b76e12e9f4dc72cb73e13f316f7909ca8f
| 86
|
package com.qaprosoft.carina.chulei.mobile.gui.pages.ios;
public class LoginPage {
}
| 17.2
| 57
| 0.790698
|
9a3bf695ec38713ec3ac2d2d8a70fbddd192b531
| 6,658
|
/*
* 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.drill.exec.physical.impl.xsort;
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
import java.util.concurrent.TimeUnit;
import org.apache.drill.common.AutoCloseables;
import org.apache.drill.common.exceptions.UserException;
import org.apache.drill.exec.cache.VectorSerializer;
import org.apache.drill.exec.cache.VectorSerializer.Writer;
import org.apache.drill.exec.memory.BufferAllocator;
import org.apache.drill.exec.physical.impl.spill.SpillSet;
import org.apache.drill.exec.record.SchemaUtil;
import org.apache.drill.exec.record.TransferPair;
import org.apache.drill.exec.record.VectorContainer;
import org.apache.drill.exec.record.VectorWrapper;
import org.apache.drill.shaded.guava.com.google.common.base.Stopwatch;
/**
* Holds a set of spilled batches, represented by a file on disk.
* Handles reads from, and writes to the spill file. The data structure
* is:
* <ul>
* <li>A pointer to a file that contains serialized batches.</li>
* <li>When writing, each batch is appended to the output file.</li>
* <li>When reading, iterates over each spilled batch, and for each
* of those, each spilled record.</li>
* </ul>
* <p>
* Starts out with no current batch. Defines the current batch to be the
* (shell: schema without data) of the last batch spilled to disk.
* <p>
* When reading, has destructive read-once behavior: closing the
* batch (after reading) deletes the underlying spill file.
* <p>
* This single class does three tasks: load data, hold data and
* read data. This should be split into three separate classes. But,
* the original (combined) structure is retained for expedience at
* present.
*/
public class SpilledRun extends BatchGroup {
private InputStream inputStream;
private final String path;
private final SpillSet spillSet;
private final BufferAllocator allocator;
private int spilledBatches;
private long batchSizeBytes;
private Writer writer;
private VectorSerializer.Reader reader;
public SpilledRun(SpillSet spillSet, String path, BufferAllocator allocator) throws IOException {
super(null, allocator);
this.spillSet = spillSet;
this.path = path;
this.allocator = allocator;
writer = spillSet.writer(path);
}
public void spillBatch(VectorContainer newContainer) throws IOException {
writer.write(newContainer);
newContainer.zeroVectors();
logger.trace("Wrote {} records in {} us", newContainer.getRecordCount(), writer.time(TimeUnit.MICROSECONDS));
spilledBatches++;
// Hold onto the husk of the last added container so that we have a
// current container when starting to read rows back later.
currentContainer = newContainer;
currentContainer.setEmpty();
}
public void setBatchSize(long batchSize) {
this.batchSizeBytes = batchSize;
}
public long getBatchSize() { return batchSizeBytes; }
public String getPath() { return path; }
@Override
public int getNextIndex() {
if (mergeIndex == getRecordCount()) {
if (spilledBatches == 0) {
return -1;
}
readBatch();
// The pointer indicates the NEXT index, not the one we
// return here. At this point, we just started reading a
// new batch and have returned index 0. So, the next index
// is 1.
mergeIndex = 1;
return 0;
}
return super.getNextIndex();
}
private void readBatch() {
try {
if (inputStream == null) {
inputStream = spillSet.openForInput(path);
reader = VectorSerializer.reader(allocator, inputStream);
}
Stopwatch watch = Stopwatch.createStarted();
long start = allocator.getAllocatedMemory();
VectorContainer c = reader.read();
long end = allocator.getAllocatedMemory();
logger.trace("Read {} records in {} us; size = {}, memory = {}",
c.getRecordCount(),
watch.elapsed(TimeUnit.MICROSECONDS),
(end - start), end);
if (schema != null) {
c = SchemaUtil.coerceContainer(c, schema, allocator);
}
spilledBatches--;
currentContainer.zeroVectors();
Iterator<VectorWrapper<?>> wrapperIterator = c.iterator();
for (VectorWrapper<?> w : currentContainer) {
TransferPair pair = wrapperIterator.next().getValueVector().makeTransferPair(w.getValueVector());
pair.transfer();
}
currentContainer.setRecordCount(c.getRecordCount());
c.zeroVectors();
} catch (IOException e) {
// Release any partially-loaded data.
currentContainer.clear();
throw UserException.dataReadError(e)
.message("Failure while reading spilled data")
.build(logger);
}
}
/**
* Close resources owned by this batch group. Each can fail; report
* only the first error. This is cluttered because this class tries
* to do multiple tasks. TODO: Split into multiple classes.
*/
@Override
public void close() throws IOException {
try {
AutoCloseables.close(super::close, this::closeWriter,
this::closeInputStream, () -> spillSet.delete(path));
} catch (Exception e) {
throw (e instanceof IOException) ? (IOException) e : new IOException(e);
}
}
private void closeInputStream() throws IOException {
if (inputStream == null) {
return;
}
long readLength = spillSet.getPosition(inputStream);
spillSet.tallyReadBytes(readLength);
inputStream.close();
inputStream = null;
reader = null;
logger.trace("Summary: Read {} bytes from {}", readLength, path);
}
public void closeWriter() throws IOException {
if (writer != null) {
spillSet.close(writer);
logger.trace("Summary: Wrote {} bytes in {} us to {}", writer.getBytesWritten(), writer.time(TimeUnit.MICROSECONDS), path);
writer = null;
}
}
}
| 35.989189
| 129
| 0.698258
|
ddba9ffdfd2bd74e57a328d151dd6f8d34f3cb57
| 13,586
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional information regarding
* copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License. You may obtain a
* copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package org.apache.geode.cache30;
import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS;
import static org.apache.geode.distributed.ConfigurationProperties.DISTRIBUTED_SYSTEM_ID;
import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import java.util.Map;
import java.util.Properties;
import org.junit.Test;
import org.apache.geode.cache.AttributesFactory;
import org.apache.geode.cache.CacheException;
import org.apache.geode.cache.CacheListener;
import org.apache.geode.cache.DataPolicy;
import org.apache.geode.cache.EntryEvent;
import org.apache.geode.cache.EntryNotFoundException;
import org.apache.geode.cache.RegionAttributes;
import org.apache.geode.cache.RegionFactory;
import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache.Scope;
import org.apache.geode.cache.util.CacheListenerAdapter;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.test.dunit.Assert;
import org.apache.geode.test.dunit.AsyncInvocation;
import org.apache.geode.test.dunit.Host;
import org.apache.geode.test.dunit.LogWriterUtils;
import org.apache.geode.test.dunit.SerializableRunnable;
import org.apache.geode.test.dunit.VM;
import org.apache.geode.test.dunit.Wait;
public class DistributedNoAckRegionCCEDUnitTest extends DistributedNoAckRegionDUnitTest {
static volatile boolean ListenerBlocking;
@Override
public Properties getDistributedSystemProperties() {
Properties p = super.getDistributedSystemProperties();
p.put(CONSERVE_SOCKETS, "false");
if (distributedSystemID > 0) {
p.put(DISTRIBUTED_SYSTEM_ID, "" + distributedSystemID);
}
p.put(SOCKET_BUFFER_SIZE, "" + 2000000);
return p;
}
/**
* Returns region attributes for a <code>GLOBAL</code> region
*/
@Override
protected RegionAttributes getRegionAttributes() {
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_NO_ACK);
factory.setDataPolicy(DataPolicy.REPLICATE);
factory.setConcurrencyChecksEnabled(true);
return factory.create();
}
@Override
protected RegionAttributes getRegionAttributes(String type) {
RegionAttributes ra = getCache().getRegionAttributes(type);
if (ra == null) {
throw new IllegalStateException("The region shortcut " + type + " has been removed.");
}
AttributesFactory factory = new AttributesFactory(ra);
factory.setScope(Scope.DISTRIBUTED_NO_ACK);
factory.setConcurrencyChecksEnabled(true);
return factory.create();
}
@Override
@Test
public void testLocalDestroy() {
// replicates don't allow local destroy
}
@Override
@Test
public void testEntryTtlLocalDestroy() {
// replicates don't allow local destroy
}
@Test
public void testClearWithManyEventsInFlight() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
// create replicated regions in VM 0 and 1, then perform concurrent ops
// on the same key while creating the region in VM2. Afterward make
// sure that all three regions are consistent
final String name = this.getUniqueName() + "-CC";
createRegionWithAttribute(vm0, name, false);
createRegionWithAttribute(vm1, name, false);
createRegionWithAttribute(vm2, name, false);
createRegionWithAttribute(vm3, name, false);
vm0.invoke(() -> DistributedNoAckRegionCCEDUnitTest.addBlockingListener());
vm1.invoke(() -> DistributedNoAckRegionCCEDUnitTest.addBlockingListener());
vm2.invoke(() -> DistributedNoAckRegionCCEDUnitTest.addBlockingListener());
AsyncInvocation vm0Ops = vm0.invokeAsync(() -> DistributedNoAckRegionCCEDUnitTest.doManyOps());
AsyncInvocation vm1Ops = vm1.invokeAsync(() -> DistributedNoAckRegionCCEDUnitTest.doManyOps());
AsyncInvocation vm2Ops = vm2.invokeAsync(() -> DistributedNoAckRegionCCEDUnitTest.doManyOps());
// pause to let a bunch of operations build up
Wait.pause(5000);
AsyncInvocation a0 = vm3.invokeAsync(() -> DistributedNoAckRegionCCEDUnitTest.clearRegion());
vm0.invoke(() -> DistributedNoAckRegionCCEDUnitTest.unblockListener());
vm1.invoke(() -> DistributedNoAckRegionCCEDUnitTest.unblockListener());
vm2.invoke(() -> DistributedNoAckRegionCCEDUnitTest.unblockListener());
waitForAsyncProcessing(a0, "");
waitForAsyncProcessing(vm0Ops, "");
waitForAsyncProcessing(vm1Ops, "");
waitForAsyncProcessing(vm2Ops, "");
Wait.pause(2000);// this test has with noack, thus we should wait before validating entries
// check consistency of the regions
Map r0Contents = vm0.invoke(() -> getCCRegionContents());
Map r1Contents = vm1.invoke(() -> getCCRegionContents());
Map r2Contents = vm2.invoke(() -> getCCRegionContents());
Map r3Contents = vm3.invoke(() -> getCCRegionContents());
for (int i = 0; i < 10; i++) {
String key = "cckey" + i;
assertEquals("region contents are not consistent", r0Contents.get(key), r1Contents.get(key));
assertEquals("region contents are not consistent", r1Contents.get(key), r2Contents.get(key));
assertEquals("region contents are not consistent", r2Contents.get(key), r3Contents.get(key));
for (int subi = 1; subi < 3; subi++) {
String subkey = key + "-" + subi;
assertEquals("region contents are not consistent", r0Contents.get(subkey),
r1Contents.get(subkey));
assertEquals("region contents are not consistent", r1Contents.get(subkey),
r2Contents.get(subkey));
assertEquals("region contents are not consistent", r2Contents.get(subkey),
r3Contents.get(subkey));
}
}
}
static void addBlockingListener() {
ListenerBlocking = true;
CCRegion.getAttributesMutator().addCacheListener(new CacheListenerAdapter() {
@Override
public void afterCreate(EntryEvent event) {
onEvent(event);
}
private void onEvent(EntryEvent event) {
boolean blocked = false;
if (event.isOriginRemote()) {
synchronized (this) {
while (ListenerBlocking) {
LogWriterUtils.getLogWriter()
.info("blocking cache operations for " + event.getDistributedMember());
blocked = true;
try {
wait();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
LogWriterUtils.getLogWriter().info("blocking cache listener interrupted");
return;
}
}
}
if (blocked) {
LogWriterUtils.getLogWriter()
.info("allowing cache operations for " + event.getDistributedMember());
}
}
}
@Override
public void close() {
LogWriterUtils.getLogWriter().info("closing blocking listener");
ListenerBlocking = false;
synchronized (this) {
notifyAll();
}
}
@Override
public void afterUpdate(EntryEvent event) {
onEvent(event);
}
@Override
public void afterInvalidate(EntryEvent event) {
onEvent(event);
}
@Override
public void afterDestroy(EntryEvent event) {
onEvent(event);
}
});
}
static void doManyOps() {
// do not include putAll, which requires an Ack to detect failures
doOpsLoopNoFlush(5000, false, false);
}
static void unblockListener() {
CacheListener listener = CCRegion.getCacheListener();
ListenerBlocking = false;
synchronized (listener) {
listener.notifyAll();
}
}
static void clearRegion() {
CCRegion.clear();
}
/**
* This test creates a server cache in vm0 and a peer cache in vm1. It then tests to see if GII
* transferred tombstones to vm1 like it's supposed to. A client cache is created in vm2 and the
* same sort of check is performed for register-interest.
*/
@Test
public void testGIISendsTombstones() {
versionTestGIISendsTombstones();
}
protected void do_version_recovery_if_necessary(final VM vm0, final VM vm1, final VM vm2,
final Object[] params) {
// do nothing here
}
/**
* This tests the concurrency versioning system to ensure that event conflation happens correctly
* and that the statistic is being updated properly
*/
@Test
public void testConcurrentEvents() throws Exception {
versionTestConcurrentEvents();
}
@Test
public void testClearWithConcurrentEvents() {
// need to figure out how to flush clear() ops for verification steps
}
@Test
public void testClearWithConcurrentEventsAsync() {
// need to figure out how to flush clear() ops for verification steps
}
@Test
public void testClearOnNonReplicateWithConcurrentEvents() {
// need to figure out how to flush clear() ops for verification steps
}
@Test
public void testTombstones() {
versionTestTombstones();
}
@Test
public void testOneHopKnownIssues() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3); // this VM, but treat as a remote for uniformity
// create an empty region in vm0 and replicated regions in VM 1 and 3,
// then perform concurrent ops
// on the same key while creating the region in VM2. Afterward make
// sure that all three regions are consistent
final String name = this.getUniqueName() + "-CC";
SerializableRunnable createRegion = new SerializableRunnable("Create Region") {
@Override
public void run() {
try {
final RegionFactory f;
int vmNumber = VM.getCurrentVMNum();
switch (vmNumber) {
case 0:
f = getCache().createRegionFactory(
getRegionAttributes(RegionShortcut.REPLICATE_PROXY.toString()));
break;
case 1:
f = getCache()
.createRegionFactory(getRegionAttributes(RegionShortcut.REPLICATE.toString()));
f.setDataPolicy(DataPolicy.NORMAL);
break;
default:
f = getCache().createRegionFactory(getRegionAttributes());
break;
}
CCRegion = (LocalRegion) f.create(name);
} catch (CacheException ex) {
Assert.fail("While creating region", ex);
}
}
};
vm0.invoke(createRegion); // empty
vm1.invoke(createRegion); // normal
vm2.invoke(createRegion); // replicate
// case 1: entry already invalid on vm2 (replicate) is invalidated by vm0 (empty)
final String invalidationKey = "invalidationKey";
final String destroyKey = "destroyKey";
SerializableRunnable test =
new SerializableRunnable("case 1: second invalidation not applied or distributed") {
@Override
public void run() {
CCRegion.put(invalidationKey, "initialValue");
long invalidationCount = CCRegion.getCachePerfStats().getInvalidates();
CCRegion.invalidate(invalidationKey);
CCRegion.invalidate(invalidationKey);
assertEquals(invalidationCount + 1, CCRegion.getCachePerfStats().getInvalidates());
// also test destroy() while we're at it. It should throw an exception
long destroyCount = CCRegion.getCachePerfStats().getDestroys();
CCRegion.destroy(invalidationKey);
try {
CCRegion.destroy(invalidationKey);
fail("expected an EntryNotFoundException");
} catch (EntryNotFoundException e) {
// expected
}
assertEquals(destroyCount + 1, CCRegion.getCachePerfStats().getDestroys());
}
};
vm0.invoke(test);
// now do the same with the datapolicy=normal region
test.setName("case 2: second invalidation not applied or distributed");
vm1.invoke(test);
}
/**
* This tests the concurrency versioning system to ensure that event conflation happens correctly
* and that the statistic is being updated properly
*/
@Test
public void testConcurrentEventsOnEmptyRegion() {
versionTestConcurrentEventsOnEmptyRegion();
}
/**
* This tests the concurrency versioning system to ensure that event conflation happens correctly
* and that the statistic is being updated properly
*/
@Test
public void testConcurrentEventsOnNonReplicatedRegion() {
versionTestConcurrentEventsOnNonReplicatedRegion();
}
@Test
public void testGetAllWithVersions() {
versionTestGetAllWithVersions();
}
}
| 35.288312
| 100
| 0.685632
|
48ccb58db954b4f19f82d4a0d5d0e1abfcb5ad3f
| 1,570
|
package onemessageui.mpush.bean;
import java.io.Serializable;
public class PushMsgBean implements Serializable {
private static final long serialVersionUID = 123456L;
/**
*
*/
private String msgId;
private String type; // 类型
private String content; // json内容
private String timestamp;
private String classify_key;//筛选类型 群/资产
private String classify_id;//筛选id
private String show;
public String getMsgId() {
return msgId;
}
public void setMsgId(String msgId) {
this.msgId = msgId;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getTimestamp() {
return timestamp;
}
public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}
public String getClassify_key() {
return classify_key;
}
public void setClassify_key(String classify_key) {
this.classify_key = classify_key;
}
public String getClassify_id() {
return classify_id;
}
public void setClassify_id(String classify_id) {
this.classify_id = classify_id;
}
public String getShow() {
return show;
}
public void setShow(String show) {
this.show = show;
}
}
| 20.657895
| 58
| 0.587898
|
ce585ddda993cb1ad9dcb56a9e686c29d2c8868e
| 3,922
|
package uo.idoc;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
import javax.imageio.ImageIO;
import org.openqa.selenium.By;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.Point;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.Augmenter;
import org.openqa.selenium.support.ui.WebDriverWait;
import com.google.common.base.Predicates;
// http://stackoverflow.com/questions/13832322/how-to-capture-the-screenshot-of-only-a-specific-element-using-selenium-webdrive
public class ScreenshotTaker {
private final int waitTimeSeconds;
private final String url;
private final int imageHeight;
private final int imageWidth;
private final String tagName;
public ScreenshotTaker(String url, int imageHeight, int imageWidth, int waitTimeSeconds, String tagName) throws IOException {
this.imageHeight = imageHeight;
this.imageWidth = imageWidth;
this.waitTimeSeconds = waitTimeSeconds;
this.url = url;
this.tagName = tagName;
}
public BufferedImage takePartialScreenshot() throws IOException {
String tempFileURI = createIframeHtml(imageHeight, imageWidth, url).toURI().toString();
WebDriver driver = new Augmenter().augment(new FirefoxDriver());
// Launch driver
driver.get(tempFileURI);
// Wait for the page to load
try {
(new WebDriverWait(driver, waitTimeSeconds)).until(Predicates.<WebDriver> alwaysFalse());
} catch (TimeoutException e) {
}
byte[] screenshotData = ((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES);
//
driver.switchTo().frame(driver.findElement(By.tagName("iframe")));
WebElement ele = driver.findElement(By.tagName(tagName));
// WebElement ele = driver.findElement(By.id("OpenLayers.Layer.Vector_687_svgRoot"));
//Get the location of element on the page
Point point = ele.getLocation();;
//Crop the entire page screenshot to get only element screenshot
BufferedImage fullImg = ImageIO.read(new ByteArrayInputStream(screenshotData));
BufferedImage eleScreenshot = fullImg.getSubimage(point.getX(), point.getY(), ele.getSize().getWidth(),
ele.getSize().getHeight());
driver.close();
return eleScreenshot;
}
public BufferedImage takeScreenshot() throws IOException {
String tempFileURI = createIframeHtml(imageHeight, imageWidth, url).toURI().toString();
WebDriver driver = new Augmenter().augment(new FirefoxDriver());
// Launch driver
driver.get(tempFileURI);
//driver.findElement(By.tagName("svg"));
System.out.println("Waiting for page to load");
// Wait for the page to load
try {
(new WebDriverWait(driver, waitTimeSeconds)).until(Predicates.<WebDriver> alwaysFalse());
} catch (TimeoutException e) {
}
System.out.println("Taking screenshot");
byte[] screenshotData = ((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES);
driver.close();
return ImageIO.read(new ByteArrayInputStream(screenshotData));
}
private static File createIframeHtml(int height, int width, String url) throws IOException {
String data = String.format(
"<html><body><iframe style=\"height: %dpx; width: %dpx;\" src=\"%s\"></iframe><body></html>", height, width,
url);
// Write iframe html
File tempFile = File.createTempFile("iframe", ".html");
Files.write(tempFile.toPath(), data.getBytes(), StandardOpenOption.TRUNCATE_EXISTING);
return tempFile;
}
}
| 35.981651
| 128
| 0.709332
|
14d91a2a9c0fa34c2bd83f4f73722881225ee58e
| 418
|
package command;
import java.util.ArrayList;
import java.util.List;
import command.utility.MultiLine;
import cursor.Cursor;
import node.Node;
public class ConstantCommandFactory extends CommandFactory {
private double myValue;
public ConstantCommandFactory (double value) {
super();
myValue = value;
addParameterTypes(double.class);
addArguments(myValue);
}
}
| 20.9
| 60
| 0.700957
|
740fa38de1b8f9da86cd1e58fcea41b6eaafec49
| 1,118
|
/**
*
*/
package edu.washington.escience.myria.coordinator;
/**
*
*/
public class CatalogException extends Exception {
/** Required for Java serialization. */
private static final long serialVersionUID = 1L;
/**
* @param message the detail message (which is saved for later retrieval by the Throwable.getMessage() method).
*/
public CatalogException(final String message) {
super(message);
}
/**
* @param message the detail message (which is saved for later retrieval by the Throwable.getMessage() method).
* @param cause the cause (which is saved for later by the Throwable.getCause() method). (A null value is permitted,
* and indicates that the cause is nonexistent or unknown.)
*/
public CatalogException(final String message, final Throwable cause) {
super(message, cause);
}
/**
* @param cause the cause (which is saved for later by the Throwable.getCause() method). (A null value is permitted,
* and indicates that the cause is nonexistent or unknown.)
*/
public CatalogException(final Throwable cause) {
super(cause);
}
}
| 29.421053
| 118
| 0.692308
|
dc4f0c76f944158fd5565af25967bfbec46fed30
| 3,466
|
package edu.gatech.gtri.trustmark.v1_0.impl.io.adio.codecs;
import edu.gatech.gtri.trustmark.v1_0.impl.io.adio.AbstractDocumentInputContext;
import edu.gatech.gtri.trustmark.v1_0.impl.io.adio.AbstractDocumentInputDeserializer;
import edu.gatech.gtri.trustmark.v1_0.impl.io.adio.AbstractDocumentOutputContext;
import edu.gatech.gtri.trustmark.v1_0.impl.io.adio.AbstractDocumentOutputSerializer;
import edu.gatech.gtri.trustmark.v1_0.impl.model.agreement.AgreementAttachmentImpl;
import edu.gatech.gtri.trustmark.v1_0.io.ParseException;
import edu.gatech.gtri.trustmark.v1_0.model.agreement.AgreementAttachment;
import edu.gatech.gtri.trustmark.v1_0.model.agreement.AttachmentType;
import org.apache.commons.collections4.BidiMap;
import org.apache.commons.collections4.SetValuedMap;
import org.dom4j.QName;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
* Created by Nicholas Saney on 2017-09-01.
*/
public class AgreementAttachmentCodec extends Codec<AgreementAttachment> {
@Override
public Class<AgreementAttachment> getSupportedType() { return AgreementAttachment.class; }
@Override
public Map<String, QName> getNonTfQualifiedNamesByElementName() { return null; }
@Override
public SetValuedMap<String, String> getAttributeNamesByElementName() { return null; }
@Override
public BidiMap<String, Class<?>> getObjectSequenceParentNameChildTypeMap() { return null; }
@Override
public BidiMap<String, String> getValueSequenceParentNameChildNameMap() { return null; }
@Override
public Set<String> getCdataValueNames() {
return new HashSet<>(Arrays.asList(
"Name",
"Description"
));
}
@Override
public String getIdFor(AgreementAttachment obj) { return null; }
@Override
public <W, Ex extends Exception> void serializeChildrenFor(
AgreementAttachment obj,
AbstractDocumentOutputSerializer<AgreementAttachment, W, Ex> ados,
AbstractDocumentOutputContext<W> context
)
throws Ex
{
ados.serializeValueInObject(context, "Index", obj.getListIndex());
ados.serializeValueInObject(context, "Name", obj.getName());
ados.serializeValueInObject(context, "Description", obj.getDescription());
ados.serializeValueInObject(context, "MimeType", obj.getAttachmentType().mimeType);
ados.serializeValueInObject(context, "DataBase64", obj.getData().getBytesBase64());
}
@Override
public <O> AgreementAttachment deserializeFullObject(
O node,
String id,
String sourceString,
String sourceType,
AbstractDocumentInputDeserializer<AgreementAttachment, O, ?, ?> adid,
AbstractDocumentInputContext context
)
throws ParseException
{
AgreementAttachmentImpl result = new AgreementAttachmentImpl();
result.setListIndex(adid.deserializeNumberValueInObject(node, true, "Index").intValue());
result.setName(adid.deserializeStringValueInObject(node, true, "Name"));
result.setDescription(adid.deserializeStringValueInObject(node, true, "Description"));
result.setAttachmentType(AttachmentType.fromMimeType(adid.deserializeStringValueInObject(node, true, "MimeType")));
result.getData().setBytesBase64(adid.deserializeStringValueInObject(node, true, "DataBase64"));
return result;
}
}
| 40.776471
| 123
| 0.735141
|
42f221a77e962bd223adbeb5f05bc7f4e69367e0
| 2,080
|
package com.images_base.backend.handler;
import com.images_base.backend.exception.BaseException;
import com.images_base.backend.modal.vo.normal.ResponseBodyVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import javax.servlet.http.HttpServletResponse;
import java.sql.SQLException;
/**
* @author zhengzhihao
* <p>
* Created on 2021/12/23
*/
@RestControllerAdvice
public class GlobalExceptionHandler {
private static final Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class);
/**
* 基础异常处理
*
* @param e
* @param response
* @return
*/
@ExceptionHandler(BaseException.class)
public ResponseBodyVO runtimeExceptionHandler(BaseException e, HttpServletResponse response) {
logger.warn("运行时错误:{}", e.getLocalizedMessage());
e.printStackTrace();
response.setStatus(e.getStatus().value());
return new ResponseBodyVO(e.getLocalizedMessage(), null);
}
/**
* sql相关异常处理
*
* @param e
* @return
*/
@ExceptionHandler(SQLException.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public ResponseBodyVO sqlExceptionHandler(SQLException e) {
logger.info("SQL错误:{}", e.getMessage());
return new ResponseBodyVO(e.getMessage(), null);
}
/**
* 缺少参数异常处理
*
* @param e
* @return
*/
@ExceptionHandler(MissingServletRequestParameterException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public ResponseBodyVO missingServletRequestParameterExceptionHandler(MissingServletRequestParameterException e) {
logger.info("请求缺少参数:{}", e.getParameterName());
return new ResponseBodyVO(String.format("请求缺少参数:%s", e.getParameterName()), null);
}
}
| 31.044776
| 117
| 0.725962
|
882261df3543eb670a94dedacf04283224d4d6e2
| 4,520
|
package com.lb_stuff.kataparty.api;
import com.lb_stuff.kataparty.api.IParty.IMember;
import org.bukkit.command.CommandSender;
/**
* Permission checking for {@link CommandSender}s and {@link IMember}s.
*/
public final class Perms
{
private Perms()
{
throw new UnsupportedOperationException();
}
private static boolean P(CommandSender s, String p)
{
return s != null && s.hasPermission("KataParty."+p);
}
private static boolean M(IMember m)
{
return m != null && (m.getRank() == PartyRank.MODERATOR || m.getRank() == PartyRank.ADMIN);
}
private static boolean A(IMember m)
{
return m != null && m.getRank() == PartyRank.ADMIN;
}
public static boolean pluginInfo (CommandSender s ){ return P(s, "info"); }
public static boolean chatToggle (CommandSender s ){ return P(s, "toggle"); }
public static boolean create (CommandSender s ){ return P(s, "create"); }
public static boolean visibilityToggle (CommandSender s ){ return P(s, "hide"); }
public static boolean visibilityToggle (IMember m ){ return A(m); }
public static boolean listHidden (CommandSender s ){ return P(s, "seehidden"); }
public static boolean stickyToggle (CommandSender s ){ return P(s, "stick"); }
public static boolean stickyToggle (IMember m ){ return A(m); }
public static boolean list (CommandSender s ){ return P(s, "list"); }
public static boolean join (CommandSender s ){ return P(s, "join"); }
public static boolean disband (CommandSender s ){ return P(s, "disband"); }
public static boolean disband (IMember m ){ return A(m); }
public static boolean manage (CommandSender s ){ return P(s, "manage"); }
public static boolean rename (IMember m ){ return A(m); }
public static boolean arbiter (CommandSender s ){ return P(s, "arbiter"); }
public static boolean tpGoto (CommandSender s ){ return P(s, "teleport.do"); }
public static boolean tpSummon (IMember m ){ return A(m); }
public static boolean tpPref (CommandSender s ){ return P(s, "teleport.disallow"); }
public static boolean tpToggle (CommandSender s ){ return P(s, "teleport.disable"); }
public static boolean tpToggle (IMember m ){ return M(m); }
public static boolean pvpToggle (IMember m ){ return M(m); }
public static boolean inventoryView (CommandSender s ){ return P(s, "inventory.use"); }
public static boolean inventoryToggle (CommandSender s ){ return P(s, "inventory.enable"); }
public static boolean inventoryToggle (IMember m ){ return M(m); }
public static boolean inviteToggle (CommandSender s ){ return P(s, "invite.enforce"); }
public static boolean inviteCreate (CommandSender s ){ return P(s, "invite.create"); }
public static boolean inviteCreate (IMember m ){ return A(m); }
public static boolean inviteAccept (CommandSender s ){ return P(s, "invite.accept"); }
public static boolean configReload (CommandSender s ){ return P(s, "reload"); }
public static boolean updateInform (CommandSender s ){ return P(s, "update-notify"); }
public static boolean healthToggle (CommandSender s ){ return P(s, "shared-health.toggle"); }
public static boolean healthPartake (CommandSender s ){ return P(s, "shared-health.contribute"); }
public static boolean xpContribute (CommandSender s ){ return P(s, "shared-xp.contribute"); }
public static boolean xpBenefit (CommandSender s ){ return P(s, "shared-xp.benefit"); }
public static boolean potionsContribute(CommandSender s ){ return P(s, "smart-splash-potions.contribute"); }
public static boolean potionsBenefit (CommandSender s ){ return P(s, "smart-splash-potions.benefit"); }
public static boolean rejoin (CommandSender s ){ return P(s, "back.use"); }
public static boolean rejoinPeriod (CommandSender s, String g){ return P(s, "back.grace-periods."+g); }
public static boolean pardon (CommandSender s ){ return P(s, "pardon"); }
public static boolean membersScoreboard(CommandSender s ){ return P(s, "scoreboard"); }
}
| 63.661972
| 118
| 0.622345
|
0fafbb0df2dec2afb8108059d3aaccef0e1bcf58
| 574
|
package net.minecraft.world;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
public interface IInteractionObject extends IWorldNameable {
Container createContainer(InventoryPlayer paramInventoryPlayer, EntityPlayer paramEntityPlayer);
String getGuiID();
}
/* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\net\minecraft\world\IInteractionObject.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
| 33.764706
| 141
| 0.778746
|
dd36ca0613f97afc89d3591f7172fe55f38b4f5e
| 3,265
|
/*
* Copyright © 2020 Richard de Jong
*
* 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 Data;
import Facade.AppFacade;
import java.time.LocalDateTime;
public class Attribute
{
private Object value;
private String name;
private int id;
private final IAttributeDAO attributeDao;
private final DataEntity parent;
private EntityType entityType;
private final Attribute parentDefinition;
public Attribute(IAttributeDAO attributeDao, int id, String name, Object value, DataEntity parent, Attribute parentDefinition, EntityType entityType)
{
this.id = id;
this.name = name;
this.value = value;
this.attributeDao = attributeDao;
this.parent = parent;
this.entityType = entityType;
this.parentDefinition = parentDefinition;
}
public IAttributeDAO getAttributeDao()
{
return attributeDao;
}
public Object getValue()
{
return value;
}
public DaoResult setValue(Object value)
{
if(this.value.equals(value)) return DaoResult.OP_OK; // no change, update is expensive
this.value = value;
if(parent != null)
parent.broadcastUpdate();
return attributeDao.updateAttribute(this);
}
public String getName()
{
return name;
}
public DaoResult setName(String name)
{
this.name = name;
return attributeDao.updateAttribute(this);
}
public EntityType getEntityType()
{
return entityType;
}
public DaoResult setEntityType(EntityType entityType)
{
this.entityType = entityType;
// update presentation layer
return attributeDao.updateAttribute(this);
}
public int getId()
{
return id;
}
public void setId(int id)
{
this.id = id;
}
public AttributeType getAttributeType()
{
return AttributeType.fromClass(value.getClass());
}
public void setAttributeType(AttributeType attributeType)
{
// initialize new value based on attribute Type.
value = switch (attributeType)
{
case STRING -> "";
case DOUBLE -> 0.0;
case DATE -> LocalDateTime.now();
case BOOLEAN -> false;
case INTEGER -> 0;
};
// update presentation layer
attributeDao.updateAttribute(this);
if(parent != null )
AppFacade.appFacade.resetPresentation();
}
public DataEntity getParent()
{
return parent;
}
public Attribute getParentDefinition()
{
return parentDefinition;
}
}
| 24.923664
| 153
| 0.620214
|
69c6d41d485035fbc8522a1c599568fdc14e5ae1
| 3,388
|
/*
* Copyright (c) 2019. Equipment & Tool Institute
*/
package org.etools.j1939_84.controllers.part01;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import org.etools.j1939_84.controllers.DataRepository;
import org.etools.j1939_84.controllers.PartController;
import org.etools.j1939_84.controllers.StepController;
import org.etools.j1939_84.modules.BannerModule;
import org.etools.j1939_84.modules.EngineSpeedModule;
import org.etools.j1939_84.modules.VehicleInformationModule;
import net.soliddesign.j1939tools.modules.CommunicationsModule;
import net.soliddesign.j1939tools.modules.DateTimeModule;
/**
* 6.1 KOEO Data Collection
*/
public class Part01Controller extends PartController {
public Part01Controller(DataRepository dataRepository) {
this(Executors.newSingleThreadScheduledExecutor(),
new BannerModule(),
DateTimeModule.getInstance(),
dataRepository,
new EngineSpeedModule(),
new VehicleInformationModule(),
new CommunicationsModule(),
new Part01Step01Controller(),
new Part01Step02Controller(),
new Part01Step03Controller(dataRepository),
new Part01Step04Controller(dataRepository),
new Part01Step05Controller(dataRepository),
new Part01Step06Controller(dataRepository),
new Part01Step07Controller(dataRepository),
new Part01Step08Controller(dataRepository),
new Part01Step09Controller(dataRepository),
new Part01Step10Controller(dataRepository),
new Part01Step11Controller(dataRepository),
new Part01Step12Controller(dataRepository),
new Part01Step13Controller(dataRepository),
new Part01Step14Controller(dataRepository),
new Part01Step15Controller(dataRepository),
new Part01Step16Controller(dataRepository),
new Part01Step17Controller(dataRepository),
new Part01Step18Controller(dataRepository),
new Part01Step19Controller(dataRepository),
new Part01Step20Controller(dataRepository),
new Part01Step21Controller(dataRepository),
new Part01Step22Controller(dataRepository),
new Part01Step23Controller(),
new Part01Step24Controller(dataRepository),
new Part01Step25Controller(dataRepository),
new Part01Step26Controller(),
new Part01Step27Controller());
}
/**
* Constructor exposed for testing
*/
public Part01Controller(Executor executor,
BannerModule bannerModule,
DateTimeModule dateTimeModule,
DataRepository dataRepository,
EngineSpeedModule engineSpeedModule,
VehicleInformationModule vehicleInformationModule,
CommunicationsModule communicationsModule,
StepController... stepControllers) {
super(executor,
bannerModule,
dateTimeModule,
dataRepository,
engineSpeedModule,
vehicleInformationModule,
communicationsModule,
1,
stepControllers);
}
}
| 40.819277
| 78
| 0.659386
|
9ddaec0b244b2afb3aa1cce98e80d0de4b14b8a0
| 7,845
|
package et.naruto.elect;
import et.naruto.base.Util.DIAG;
import et.naruto.process.base.Processer;
import et.naruto.process.zk.ZKProcess;
import et.naruto.resolutionsurface.Data;
import et.naruto.resolutionsurface.RSArgs;
import et.naruto.resolutionsurface.ResolutionSurface;
import et.naruto.seat.Seat;
import et.naruto.versioner.Dealer;
import et.naruto.versioner.base.Handleable;
import et.naruto.versioner.base.Handler;
public class Master implements Processer, AutoCloseable {
public static class Result {
public final Boolean catched;
public final boolean IsPreLeader() {
return catched!=null;
}
public final boolean IsLeader() {
return IsPreLeader()&&catched;
}
public Result(final Boolean catched) {
this.catched=catched;
}
public final String toString() {
return String.format("Result(%s)", catched);
}
}
private final Args args;
private final Seat pre_master_seat;
private final ResolutionSurface resolution_surface;
private final ZKProcess zkprocess;
private final Dealer<Result> dealer=new Dealer();
public Master(final Args args,final ZKProcess zkprocess) {
this.args=args;
this.pre_master_seat=new Seat(args.GetLeaderPath(),args.GetServerId(),zkprocess);
final Master this_ref=this;
this.resolution_surface=new ResolutionSurface(zkprocess,new RSArgs(args.GetResolutionsPath(),args.GetServerId())) {
public Handler<Boolean> CloseingResolution(final long seq,final Data data) {
return this_ref.CloseingResolution(seq,data);
}
};
this.zkprocess=zkprocess;
zkprocess.AddProcesser(this);
}
public Handler<Boolean> CloseingResolution(final long seq,final Data data) {
Handler<Boolean> r=new Handler();
r.Add(true);
return r;
}
public byte[] NewResolution(final long seq,final Data data) {
return "test new resolution".getBytes();
}
public final String toString() {
return String.format("Master[%s,%s]",this.args.toString(),this.dealer.toString());
}
public final void close() {
this.zkprocess.DelProcesser(this);
this.resolution_surface.close();
this.pre_master_seat.close();
}
public final Handleable<Result> result_handleable() {
return dealer.result_handleable();
}
public final boolean IsPreLeader() {
if(result_handleable().result!=null) {
return result_handleable().result.catched!=null;
}
return false;
}
public final boolean IsLeader() {
if(IsPreLeader()) {
return result_handleable().result.catched;
}
return false;
}
public final boolean Do() {
boolean next=false;
final Handleable<Boolean> pre_master_seat_result_handleable=pre_master_seat.result_handleable();
final Handleable<ResolutionSurface.Result> resolution_surface_out_handleable=resolution_surface.out_handleable();
if(dealer.Watch(
pre_master_seat_result_handleable,
resolution_surface_out_handleable
)){
if(pre_master_seat_result_handleable.result!=null) {
if(pre_master_seat_result_handleable.result) {
if(resolution_surface_out_handleable.result!=null) {
if(resolution_surface_out_handleable.result.succ) {
DIAG.Log.________________________________.D(
"%s leader catched %s.",
this.args.toString(),
this.resolution_surface.toString());
this.dealer.Done(new Result(true));
} else {
final long next_seq=resolution_surface_out_handleable.result.resolution.seq+1;
boolean need_regist=false;
if(resolution_surface.in_request()!=null) {
if(resolution_surface.in_request().seq<next_seq) {
DIAG.Log.________________________________.D(
"%s Regist this next_seq %s.",
this.args.toString(),
next_seq);
need_regist=true;
} else {
if(resolution_surface.in_request().seq==next_seq) {
DIAG.Log.________________________________.D(
"%s Already regist this next_seq %s, Waiting.",
this.args.toString(),
next_seq);
} else {
DIAG.Log.________________________________.Error(
"%s Serious ERROR, Resolution_surface.in is %s, But next_seq turn back to %s.",
this.args.toString(),
resolution_surface.in_request().seq,
next_seq);
}
}
} else {
DIAG.Log.________________________________.D(
"%s First Regist next_seq %s",
this.args.toString(),
next_seq);
need_regist=true;
}
if(need_regist) {
final byte[] new_resolution=NewResolution(
next_seq,
resolution_surface_out_handleable.result.resolution.data
);
if(new_resolution!=null) {
this.resolution_surface.Regist(
new ResolutionSurface.Request(
new_resolution,
next_seq
)
);
}
}
this.dealer.Done(new Result(false));
}
} else {
DIAG.Log.________________________________.D(
"%s Surface prepareing, Waiting.",
this.args.toString());
this.dealer.Done(new Result(false));
}
} else {
DIAG.Log.________________________________.D(
"%s Lost pre leader, Ignore.",
this.args.toString());
this.dealer.Done(new Result(null));
}
} else {
DIAG.Log.________________________________.D(
"%s pre leader catching, waiting.",
this.args.toString());
}
next=true;
}
return next;
}
}
| 44.828571
| 123
| 0.471256
|
6f303bef7b0538a3662495a7c68bd630946d0549
| 13,962
|
/*
* License (MIT)
*
* Copyright (c) 2014. Granite Team
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
* software and associated documentation files (the "Software"), to deal in the
* Software without restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package org.granitemc.granite.reflect;
import com.google.common.collect.Lists;
import org.granitemc.granite.GraniteAPI;
import org.granitemc.granite.api.Granite;
import org.granitemc.granite.api.Server;
import org.granitemc.granite.api.chat.ChatComponent;
import org.granitemc.granite.api.chat.FormattingOutputType;
import org.granitemc.granite.api.entity.player.Player;
import org.granitemc.granite.api.plugin.PluginContainer;
import org.granitemc.granite.reflect.composite.Hook;
import org.granitemc.granite.reflect.composite.HookListener;
import org.granitemc.granite.reflect.composite.ProxyComposite;
import org.granitemc.granite.utils.Mappings;
import org.granitemc.granite.utils.MinecraftUtils;
import java.io.File;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.Proxy;
import java.security.KeyPair;
import java.util.List;
import java.util.UUID;
public class GraniteServerComposite extends ProxyComposite implements Server {
public static GraniteServerComposite instance;
private SCMComposite scm;
public static GraniteServerComposite init() {
return instance = new GraniteServerComposite(new File("."));
}
public GraniteServerComposite(File worldsLocation) {
super(Mappings.getClass("DedicatedServer"), new Class[]{File.class}, worldsLocation);
injectLogger();
injectCommand();
injectSelf();
injectSCM();
addHook("tick", new HookListener() {
@Override
public Object activate(Object self, Method method, Method proxyCallback, Hook hook, Object[] args) {
GraniteAPI.instance.tick();
return null;
}
});
// Start this baby
invoke("startServerThread");
for (PluginContainer c : Granite.getPlugins()) {
c.enable();
}
}
private void injectSCM() {
final GraniteServerComposite me = this;
// Inject SCM
addHook("setConfigManager", new HookListener() {
SCMComposite comp = null;
@Override
public Object activate(Object self, Method method, Method proxyCallback, Hook hook, Object[] args) {
// The arg is null, since we replaced that above
if (comp == null) {
comp = new SCMComposite(me);
}
try {
proxyCallback.invoke(self, Mappings.getClass("ServerConfigurationManager").cast(comp.parent));
hook.setWasHandled(true);
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
scm = comp;
return null;
}
});
}
private void injectLogger() {
// Inject logger, I don't think this is needed but I'll do it anyway just to be on the safe side
Field loggerField = Mappings.getField("MinecraftServer", "logger");
ReflectionUtils.forceStaticAccessible(loggerField);
try {
loggerField.set(null, Granite.getLogger());
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
private void injectCommand() {
// Create command composite
CommandComposite commandComposite = new CommandComposite();
// Inject command composite
Field commandManagerField = Mappings.getField("MinecraftServer", "commandManager");
ReflectionUtils.forceStaticAccessible(commandManagerField);
try {
commandManagerField.set(this.parent, commandComposite.parent);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
private void injectSelf() {
addHook(new HookListener() {
@Override
public Object activate(Object self, Method method, Method proxyCallback, Hook hook, Object[] args) {
// This is needed, for some reason. I don't know. Ask Jason.
if (method.getReturnType().getName().equals(Mappings.getClass("MinecraftServer").getName())) {
hook.setWasHandled(true);
return parent;
}
return null;
}
});
}
@Override
public String getName() {
return (String) invoke("getName");
}
@Override
public void sendMessage(String message) {
Granite.getLogger().info(message);
}
@Override
public void sendMessage(ChatComponent component) {
Granite.getLogger().info(component.toPlainText(FormattingOutputType.ANSI));
}
@Override
public List<Player> getPlayers() {
List<Player> ret = Lists.newArrayList();
try {
List<Object> playerObjs = (List<Object>) Mappings.getField("ServerConfigurationManager", "playerEntityList").get(scm.parent);
for (Object o : playerObjs) {
Player p = (Player) MinecraftUtils.wrap(o);
ret.add(p);
}
return ret;
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return null;
}
@Override
public Player getPlayer(String name) {
for (Player player : getPlayers()) {
if (player.getName().toLowerCase().contains(name.toLowerCase())) {
return player;
}
}
return null;
}
@Override
public Player getPlayerExact(String name) {
for (Player player : getPlayers()) {
if (player.getName().equals(name)) {
return player;
}
}
return null;
}
@Override
public Player getPlayer(UUID uuid) {
for (Player player : getPlayers()) {
if (player.getUniqueID().equals(uuid)) {
return player;
}
}
return null;
}
//TODO: May be important?
public void setUserMessage(String message) {
//Obf: b
invoke("setUserMessage", message);
}
@Override
public boolean canStructuresSpawn() {
//Obf: l
return (boolean) invoke("canStructuresSpawn");
}
@Override
public boolean isHardcore() {
//Obf: o
return (boolean) invoke("isHardcore");
}
public int getOpPermissionLevel() {
//Obf: p
return (Integer) invoke("getOpPermissionLevel");
}
@Override
public void saveAllWorlds(boolean outputLogMessage) {
//Obf: a
invoke("saveAllWorlds", outputLogMessage);
}
@Override
public void stopServer() {
//Obf: r
invoke("stopServer");
}
@Override
public String getServerHostname() {
//Obf: s
return (String) invoke("getServerHostname");
}
@Override
public boolean isServerRunning() {
//Obf: t
return (boolean) invoke("isServerRunning");
}
public void initiateShutdown() {
//Obf: u
invoke("initiateShutdown");
}
@Override
public File getDataDirectory() {
//Obf: w
return (File) invoke("getDataDirectory");
}
//TODO: Add hook for eventual scheduler
public void tick() {
//Obf: y
invoke("tick");
}
@Override
public boolean getAllowNether() {
//Obf: A
return (boolean) invoke("getAllowNether");
}
//TODO: Could be useful?
/*public File getFile(String file) {
//Obf: d
return (File) invoke("getFile(String");
}*/
@Override
public String getHostname() {
//Obf: C
return (String) invoke("getHostname");
}
public void setHostname(String hostname) {
//Obf: c
invoke("setHostname", hostname);
}
@Override
public int getPort() {
//Obf: D
return (Integer) invoke("getPort");
}
@Override
public String getMotd() {
//Obf: E
return (String) invoke("getMotd");
}
@Override
public String getMinecraftVersion() {
//Obf: F
return (String) invoke("getMinecraftVersion");
}
@Override
public int getCurrentPlayerCount() {
//Obf: G
return (Integer) invoke("getCurrentPlayerCount");
}
@Override
public int getMaxPlayers() {
//Obf: H
return (Integer) invoke("getMaxPlayers");
}
/*public String[] getAllUsernames() {
//Obf: I
return (String[]) invoke("getAllUsernames");
}*/
/*public String handleRConCommand(String command) {
//Obf: g
return (String) invoke("handleRConCommand(String)", command);
}*/
public boolean isDebuggingEnabled() {
//Obf: L
return (boolean) invoke("isDebuggingEnabled");
}
public String getServerModName() {
//Obf: getServerModName
return (String) invoke("getServerModName");
}
@Override
public KeyPair getKeyPair() {
//Obf: P
return (KeyPair) invoke("getKeyPair");
}
public void setKeyPair(KeyPair keyPair) {
//Obf: a
invoke("setKeyPair", keyPair);
}
@Override
public int getServerPort() {
//Obf: Q
return (Integer) invoke("getServerPort");
}
public void setServerPort(int port) {
//Obf: b
invoke("setServerPort", port);
}
@Override
public String getFolderName() {
//Obf: T
return (String) invoke("getFolderName");
}
public void setFolderName(String folderName) {
//Obf: k
invoke("setFolderName", folderName);
}
@Override
public boolean allowSpawnMonsters() {
//Obf: V
return (boolean) invoke("allowSpawnMonsters");
}
public boolean canCreateBonusChest(boolean var1) {
//Obf: c
return (boolean) invoke("canCreateBonusChest", var1);
}
public void deleteWorldAndStopServer() {
//Obf: Z
invoke("deleteWorldAndStopServer");
}
@Override
public boolean isSnooperEnabled() {
//Obf: ac
return (boolean) invoke("isSnooperEnabled");
}
public boolean isDedicatedServer() {
//Obf: ad
return (boolean) invoke("isDedicatedServer");
}
@Override
public boolean getCanSpawnAnimals() {
//Obf: ae
return (boolean) invoke("getCanSpawnAnimals");
}
@Override
public void setCanSpawnAnimals(boolean spawnAnimals) {
//Obf: d
invoke("setCanSpawnAnimals", spawnAnimals);
}
@Override
public boolean getCanSpawnNPCs() {
//Obf: af
return (boolean) invoke("getCanSpawnNPCs");
}
@Override
public void setCanSpawnNPCs(boolean spawnNPCs) {
//Obf: e
invoke("setCanSpawnNPCs", spawnNPCs);
}
@Override
public boolean isPvpEnabled() {
//Obf: ag
return (boolean) invoke("isPVPEnabled");
}
@Override
public void setAllowPvp(boolean allowPvP) {
//Obf: f
invoke("setAllowPvp", allowPvP);
}
@Override
public boolean isFlightAllowed() {
//Obf: ah
return (boolean) invoke("isFlightAllowed");
}
@Override
public void setAllowFlight(boolean allowFlight) {
//Obf: g
invoke("setAllowFlight", allowFlight);
}
@Override
public boolean isCommandBlockEnabled() {
//Obf: ai
return (boolean) invoke("isCommandBlockEnabled");
}
@Override
public boolean getGuiEnabled() {
//Obf: aq
return (boolean) invoke("getGuiEnabled");
}
@Override
public int getTickCounter() {
//Obf: ar
return (Integer) invoke("getTickCounter");
}
@Override
public int getSpawnProtectionSize() {
//Obf: au
return (Integer) invoke("getSpawnProtectionSize");
}
public boolean getForceGamemode() {
//Obf: av
return (boolean) invoke("getForceGamemode");
}
public void setForceGamemode(boolean forceGamemode) {
//Obf: i
invoke("setForceGamemode", forceGamemode);
}
@Override
public Proxy getServerProxy() {
//Obf: aw
return (Proxy) invoke("getServerProxy");
}
public long getCurrentTimeMillis() {
//Obf: ax
return (long) invoke("getCurrentTimeMillis");
}
//TODO: What does this do? getBuildHeight? always returns 256
/*public int aI() {
//Obf: aI
return (Integer) invoke("aI");
}*/
public Object worldServerForDimension(int var1) {
return invoke("worldServerForDimension", var1);
}
public boolean isOnServerThread() {
return fieldGet("serverThread") == Thread.currentThread();
}
}
| 26.798464
| 137
| 0.606217
|
fa920b8b89ea3723336b0e504a05265e0c183ccb
| 1,265
|
/*
* Copyright 2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.gradle.execution.plan;
import org.gradle.internal.snapshot.CaseSensitivity;
public class ConsumedAndProducedLocations {
private final RelatedLocations producedLocations;
private final RelatedLocations consumedLocations;
public ConsumedAndProducedLocations(CaseSensitivity caseSensitivity) {
producedLocations = new RelatedLocations(caseSensitivity);
consumedLocations = new RelatedLocations(caseSensitivity);
}
public RelatedLocations getProducedLocations() {
return producedLocations;
}
public RelatedLocations getConsumedLocations() {
return consumedLocations;
}
}
| 33.289474
| 75
| 0.754941
|
246eaa2e5335290485ebba08eb9fef5be6307537
| 4,749
|
package com.mrprona.brawlassistant.base.activity;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Dialog;
import android.os.Build;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.ActionMenuView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import com.mrprona.brawlassistant.R;
/**
* User: ABadretdinov
* Date: 29.01.14
* Time: 12:41
*/
public abstract class BaseActivity extends AppCompatActivity {
protected ActionMenuView mActionMenuView;
protected Toolbar mToolbar;
@Override
public void setContentView(int layoutResID) {
super.setContentView(layoutResID);
initActionBar();
}
@Override
public void setContentView(View view) {
super.setContentView(view);
initActionBar();
}
@Override
public void setContentView(View view, ViewGroup.LayoutParams params) {
super.setContentView(view, params);
initActionBar();
}
private void initActionBar() {
mToolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
mActionMenuView = (ActionMenuView) findViewById(R.id.actionMenuView);
if (mActionMenuView != null) {
mActionMenuView.setVisibility(View.GONE);
}
Log.d("BINH", "initActionBar() called with: " + "");
}
public ActionMenuView getActionMenuView() {
return mActionMenuView;
}
@TargetApi(Build.VERSION_CODES.KITKAT)
public void hideSystemUI() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
this.getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
}
private Dialog mProgressDialog;
public void showProgressDialog(final String message) {
showProgressDialog(message, false);
}
private int sDialogCount = 0;
/**
* Show progress dialog.
*
* @param message
* @param cancelable
*/
public void showProgressDialog(final String message, final boolean cancelable) {
try {
runOnUiThread(new Runnable() {
@Override
public void run() {
try {
Dialog dlg = getProgressDialog();
sDialogCount++;
if (!dlg.isShowing()) {
dlg.setCancelable(cancelable);
dlg.show();
}
} catch (Exception ex) {
// Do nothing
}
}
});
} catch (Exception e) {
}
}
/**
* Hide progress dialog.
*/
public void hideProgressDialog() {
hideProgressDialog(true);
}
public void hideProgressDialog(final boolean isWait) {
runOnUiThread(new Runnable() {
@Override
public void run() {
try {
Dialog dlg = getProgressDialog();
sDialogCount--;
if (dlg != null && dlg.isShowing()) {
if (!isWait) {
sDialogCount = 0;
dlg.dismiss();
} else {
if (sDialogCount <= 0) dlg.dismiss();
}
}
} catch (Exception ex) {
// Do nothing
}
}
});
}
/**
* Returns the shared progress dialog.
*
* @author Binh.TH
*/
@SuppressLint("InflateParams")
private Dialog getProgressDialog() {
if (mProgressDialog == null) { // Create if null
mProgressDialog = new Dialog(this, android.R.style.Theme_Black);
View view = LayoutInflater.from(this).inflate(R.layout.cmn_process, null);
mProgressDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
mProgressDialog.getWindow().setBackgroundDrawableResource(R.color.transparent);
mProgressDialog.setContentView(view);
}
return mProgressDialog;
}
}
| 29.496894
| 91
| 0.560118
|
f3f58c945e663d0a3a4f96eb7e114162acd2a7b9
| 4,690
|
package com.daicy.panda.netty.servlet.impl;
import com.daicy.panda.netty.TracingThreadPoolExecutor;
import com.daicy.panda.netty.handler.NettyServletHandler;
import com.daicy.panda.netty.servlet.AsyncListenerImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.web.util.WebUtils;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
public class AsyncContextImpl implements AsyncContext {
private final HttpServletRequest request;
private final HttpServletResponse response;
private final List<AsyncListener> listeners = new ArrayList<AsyncListener>();
private String dispatchedPath;
private long timeout = 10 * 1000L; // 10 seconds is Tomcat's default
private final TracingThreadPoolExecutor asyncExecutor;
public AsyncContextImpl(ServletRequest request, ServletResponse response) {
this.asyncExecutor = ServletContextImpl.get().getPandaServerBuilder().executor();
this.request = (HttpServletRequest) request;
this.response = (HttpServletResponse) response;
}
@Override
public ServletRequest getRequest() {
return this.request;
}
@Override
public ServletResponse getResponse() {
return this.response;
}
@Override
public boolean hasOriginalRequestAndResponse() {
return (this.request instanceof ServletRequestImpl) && (this.response instanceof ServletResponseImpl);
}
@Override
public void dispatch() {
dispatch(this.request.getRequestURI());
}
@Override
public void dispatch(String path) {
dispatch(null, path);
}
@Override
public void dispatch(ServletContext context, String path) {
this.dispatchedPath = path;
// addListener(new AsyncListenerImpl());
Runnable runnable = new Runnable() {
@Override
public void run() {
ServletRequestImpl servletRequestImpl = (ServletRequestImpl) request;
ServletResponseImpl servletResponseImpl = (ServletResponseImpl) response;
try {
NettyServletHandler.handleRequest0(servletRequestImpl, servletResponseImpl);
complete();
} finally {
if (!servletRequestImpl.isAsyncStarted()) {
servletResponseImpl.close();
}
}
}
};
start(runnable);
}
public String getDispatchedPath() {
return this.dispatchedPath;
}
@Override
public void complete() {
ServletRequestImpl fullRequest = WebUtils.getNativeRequest(request, ServletRequestImpl.class);
if (fullRequest != null) {
fullRequest.setAsyncStarted(false);
}
for (AsyncListener listener : this.listeners) {
try {
listener.onComplete(new AsyncEvent(this, this.request, this.response));
} catch (IOException ex) {
throw new IllegalStateException("AsyncListener failure", ex);
}
}
}
@Override
public void start(Runnable runnable) {
Future futureTask = asyncExecutor.submit(runnable);
try {
futureTask.get(timeout, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
futureTask.cancel(true);
} catch (ExecutionException e) {
futureTask.cancel(true);
} catch (TimeoutException e) {
futureTask.cancel(true);
}
}
@Override
public void addListener(AsyncListener listener) {
this.listeners.add(listener);
}
@Override
public void addListener(AsyncListener listener, ServletRequest request, ServletResponse response) {
this.listeners.add(listener);
}
public List<AsyncListener> getListeners() {
return this.listeners;
}
@Override
public <T extends AsyncListener> T createListener(Class<T> clazz) throws ServletException {
return BeanUtils.instantiateClass(clazz);
}
@Override
public void setTimeout(long timeout) {
this.timeout = timeout;
}
@Override
public long getTimeout() {
return this.timeout;
}
}
| 30.855263
| 111
| 0.638166
|
f2c52eac5490b69ef9b739551caf8940ca5647bc
| 1,007
|
package com.exadel.aem.toolkit.api.annotations.assets.dependson;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Used to define {@code dependsOn} and {@code dependsOnActon} attributes of {@code granite:data} child node of the current
* tab node to engage DependsOn frontend routines. For this to work properly, the {@code aem-authoring-toolkit-assets}
* package must be added to the AEM installation
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(DependsOnTabConfig.class)
@SuppressWarnings("unused")
public @interface DependsOnTab {
/**
* Defines the 'dependsOn' attribute
* @return String representing value the current tab is depending on, non-null
*/
String query();
/**
* Specifies the tab by its title
* @return String value, non-null
*/
String tabTitle();
}
| 32.483871
| 123
| 0.743793
|
a78edd10fbd81563bc0006e15c3f9ceb8751b00d
| 7,321
|
package org.catalyst.slackservice.controllers;
import org.catalyst.slackservice.db.*;
import org.catalyst.slackservice.domain.Action;
import org.catalyst.slackservice.domain.InteractiveMessage;
import org.catalyst.slackservice.services.AnalyticsEvent;
import org.catalyst.slackservice.services.AnalyticsKey;
import org.catalyst.slackservice.services.AnalyticsService;
import org.catalyst.slackservice.services.AppService;
import org.catalyst.slackservice.util.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import play.i18n.MessagesApi;
import play.libs.Json;
import play.libs.concurrent.HttpExecutionContext;
import play.mvc.BodyParser;
import play.mvc.Controller;
import play.mvc.Http;
import play.mvc.Result;
import javax.inject.Inject;
import java.util.concurrent.CompletionStage;
public class UserActionController extends Controller {
final Logger logger = LoggerFactory.getLogger(UserActionController.class);
private final AppConfig _config;
private final MessagesApi _messagesApi;
private final AppService _slackService;
private final HttpExecutionContext _ec;
private final TokenHandler _tokenDb;
private final AnalyticsService _analyticsService;
private final static String PAYLOAD = "payload";
@Inject
public UserActionController(HttpExecutionContext ec, AppConfig config, MessagesApi messagesApi,
AppService slackService, TokenHandler tokenDb, AnalyticsService analyticsService) {
this._config = config;
this._messagesApi = messagesApi;
this._slackService = slackService;
this._ec = ec;
this._tokenDb = tokenDb;
this._analyticsService = analyticsService;
}
@BodyParser.Of(BodyParser.Raw.class)
public CompletionStage<Result> handle(Http.Request httpRequest) {
var messages = new MessageHandler(_messagesApi.preferred(httpRequest));
var requestBodyAsBytes = httpRequest.body().asBytes();
if (requestBodyAsBytes == null || requestBodyAsBytes.isEmpty()) {
logger.error("empty user action content");
return ResultHelper.badRequest(messages, MessageHandler.INVALID_REQUEST);
}
var body = PayloadHelper.getFormUrlEncodedRequestBody(requestBodyAsBytes.decodeString(PayloadHelper.CHARSET_UTF8));
var payload = PayloadHelper.getMapValue(body, PAYLOAD);
if (payload.isEmpty()) {
logger.error("empty user action payload");
return ResultHelper.badRequest(messages, MessageHandler.INVALID_REQUEST);
}
// TODO: move outside of controller
InteractiveMessage interactiveMessage = null;
try {
interactiveMessage = Json.fromJson(Json.parse(payload), InteractiveMessage.class);
} catch(Exception e) {
logger.error(e.getMessage());
}
if (interactiveMessage == null) {
logger.error("null interactive message");
return ResultHelper.badRequest(messages, MessageHandler.INVALID_REQUEST);
}
if (interactiveMessage.callbackId == null || interactiveMessage.actions == null || interactiveMessage.actions.isEmpty()) {
logger.error("null interactive message field");
logger.debug("interactive message fields --> callbackId: {}, actions: {}", interactiveMessage.callbackId, interactiveMessage.actions);
return ResultHelper.badRequest(messages, MessageHandler.MISSING_INTERACTIVE_MESSAGE_FIELDS);
}
if (!RequestVerifier.verified(httpRequest, _config.getSigningSecret(), _config.getToken(), interactiveMessage.token)) {
return ResultHelper.badRequest(messages, MessageHandler.REQUEST_NOT_VERIFIED);
}
if (isUserActionMissingValues(interactiveMessage)) {
logger.error("null user action/team/channel/responseUrl value");
logger.debug("user action values --> channel: {}, team: {}, user: {}, responseUrl: {}",
interactiveMessage.channel, interactiveMessage.team, interactiveMessage.user, interactiveMessage.responseUrl);
return ResultHelper.badRequest(messages, MessageHandler.MISSING_USER_ACTION_VALUES);
}
return handleUserAction(interactiveMessage);
}
private CompletionStage<Result> handleUserAction(final InteractiveMessage iMessage) {
var bot = _tokenDb.getBotInfo(iMessage.team.id);
if (bot == null || bot.userId == null || bot.token == null) {
return ResultHelper.ok();
}
var action = iMessage.actions.stream().findFirst().get();
var localeResult = _slackService.getConversationLocale(iMessage.channel.id, bot);
return localeResult.thenComposeAsync(slackLocale -> {
var key = new AnalyticsKey(_config.getTrackingId(), iMessage.team.id, bot.teamName, iMessage.channel.id, iMessage.user.id, slackLocale);
try {
var event = AnalyticsEvent.createMessageActionEvent(key, action);
_analyticsService.track(event);
}
catch (Exception e) {
logger.error("failed to track user action analytics event {}", action);
}
var localizedMessages = new MessageHandler(_messagesApi, slackLocale);
if (action.value.equals(Action.NO)) {
return _slackService.deleteMessage(iMessage.responseUrl).thenApplyAsync(slackResponse -> noContent(), _ec.current());
}
if (action.value.equals(Action.LEARN_MORE)) {
return _slackService.postLearnMore(localizedMessages, iMessage, bot).thenApplyAsync(response -> noContent(), _ec.current());
}
if (action.value.equals(Action.YES)) {
return handleReplaceMessage(iMessage);
}
return ResultHelper.noContent();
});
}
private CompletionStage<Result> handleReplaceMessage(final InteractiveMessage iMessage) {
var correction = iMessage.actions.stream().findFirst().get().name;
var tokenKey = new TokenKey();
tokenKey.teamId = iMessage.team.id;
tokenKey.userId = iMessage.user.id;
var replacementResult = _slackService.postReplacement(iMessage, _tokenDb.getUserToken(tokenKey));
return replacementResult.thenComposeAsync(replacementResponse -> {
if (!replacementResponse.ok) {
logger.error("unable to replace message for {} {}", tokenKey.teamId, tokenKey.userId);
return ResultHelper.noContent();
}
logger.debug("message replaced: --> {}", correction);
return _slackService.deleteMessage(iMessage.responseUrl).thenApplyAsync(deleteResponse -> noContent(), _ec.current());
}, _ec.current());
}
private static boolean isUserActionMissingValues(final InteractiveMessage iMessage) {
var actions = iMessage.actions.stream().findFirst();
return actions.isEmpty() || actions.get().name == null
|| iMessage.team == null || iMessage.team.id == null
|| iMessage.channel == null || iMessage.channel.id == null
|| iMessage.user == null || iMessage.user.id == null || iMessage.user.name == null
|| iMessage.responseUrl == null;
}
}
| 44.91411
| 148
| 0.682011
|
4f0f5262f6d03d138138b1c0025d760d19e8e23d
| 1,326
|
package ch.bfh.gr33nopo55um.enocean.helper;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
* @class Time logger for performance measurement
*
* @author silas
*/
public class TimeLogger {
private static Logger logger = LogManager.getLogger();
private long startTime = 0;
private String operationName = "";
private long stopTime = 0;
private long getStopTime() {
return stopTime;
}
private void setStopTime() {
this.stopTime = System.currentTimeMillis();
}
private long getStartTime() {
return startTime;
}
public void setStartTime(long startTime) {
this.startTime = startTime;
}
private String getOperationName() {
return operationName;
}
public void setOperationName(String operationName) {
this.operationName = operationName;
}
public void startLogTime() {
//Log current time for performance measurement
this.startTime = System.currentTimeMillis();
}
public void endLogTime() {
//Log current time for performance measurement
this.setStopTime();
long elapsedTime = this.getStopTime() - this.getStartTime();
logger.info(this.getOperationName() + " in: " + elapsedTime + " miliseconds.");
}
}
| 23.263158
| 87
| 0.657617
|
27b15712012a76258820c0ebfdcf2f32631c197a
| 3,328
|
/*
* MAE - Multi-purpose Annotation Environment
*
* Copyright Keigh Rim (krim@brandeis.edu)
* Department of Computer Science, Brandeis University
* Original program by Amber Stubbs (astubbs@cs.brandeis.edu)
*
* MAE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 this program. If not, @see <a href="http://www.gnu.org/licenses">http://www.gnu.org/licenses</a>.
*
* For feedback, reporting bugs, use the project on Github
* @see <a href="https://github.com/keighrim/mae-annotation">https://github.com/keighrim/mae-annotation</a>.
*/
package edu.brandeis.llc.mae.model;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
/**
* Created by krim on 11/19/15.
*/
@DatabaseTable(tableName = DBSchema.TAB_ARG)
public class Argument implements ModelI {
@DatabaseField(generatedId = true, columnName = DBSchema.TAB_ARG_COL_ID)
private int id;
@DatabaseField(index = true, foreign = true, foreignAutoRefresh = true, columnName = DBSchema.TAB_ARG_FCOL_LTAG)
private LinkTag linker;
@DatabaseField(index = true, foreign = true, foreignAutoRefresh = true, columnName = DBSchema.TAB_ARG_FCOL_ETAG)
private ExtentTag argument;
@DatabaseField(foreign = true, canBeNull = false, foreignAutoRefresh = true, columnName = DBSchema.TAB_ARG_FCOL_ART)
private ArgumentType argumentType;
public Argument() {
}
public Argument(ArgumentType argumentType) {
this.setArgumentType(argumentType);
}
public Argument(LinkTag linker, ArgumentType argumentType, ExtentTag argument) {
this.linker = linker;
this.argument = argument;
this.argumentType = argumentType;
}
public String getId() {
return Integer.toString(id);
}
public LinkTag getLinker() {
return linker;
}
public void setLinker(LinkTag linker) {
this.linker = linker;
}
public String getArgumentText() {
return getArgument().getText();
}
public String getArgumentId() {
return getArgument().getId();
}
public ExtentTag getArgument() {
return argument;
}
public void setArgument(ExtentTag argument) {
this.argument = argument;
}
public ArgumentType getArgumentType() {
return argumentType;
}
public void setArgumentType(ArgumentType argumentType) {
this.argumentType = argumentType;
}
public boolean isComplete() {
return getLinker() != null && getArgument() != null;
}
public String getName() {
return this.getArgumentType().getName();
}
@Override
public String toString() {
return String.format("%s (%s), %s of %s", getArgumentId(), getArgumentText(),
getArgumentType(), getLinker().getTid() );
}
}
| 29.451327
| 120
| 0.6875
|
40b398299957c9048e147eb024be463c67bc821c
| 926
|
package dev.sgora.mesheditor.model.geom.polygons;
import dev.sgora.mesheditor.model.geom.Point;
import io.github.stasgora.observetree.Observable;
import java.io.Serializable;
public class Rectangle extends Observable implements Serializable {
private Point position;
private Point size;
private static final long serialVersionUID = 1L;
public Rectangle() {
position = new Point();
addSubObservable(position);
size = new Point();
addSubObservable(size);
}
public boolean contains(Point point) {
return point.getX() >= position.getX() && point.getX() <= position.getX() + size.getX() && point.getY() >= position.getY() && point.getY() <= position.getY() + size.getY();
}
public Point getPosition() {
return position;
}
public void setPosition(Point position) {
this.position = position;
}
public Point getSize() {
return size;
}
public void setSize(Point size) {
this.size = size;
}
}
| 22.585366
| 174
| 0.714903
|
f201344773b601be784565316c1533e9bb5a9cbd
| 8,605
|
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/ads/googleads/v10/services/shared_criterion_service.proto
package com.google.ads.googleads.v10.services;
public final class SharedCriterionServiceProto {
private SharedCriterionServiceProto() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistryLite registry) {
}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
registerAllExtensions(
(com.google.protobuf.ExtensionRegistryLite) registry);
}
static final com.google.protobuf.Descriptors.Descriptor
internal_static_google_ads_googleads_v10_services_MutateSharedCriteriaRequest_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_google_ads_googleads_v10_services_MutateSharedCriteriaRequest_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_google_ads_googleads_v10_services_SharedCriterionOperation_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_google_ads_googleads_v10_services_SharedCriterionOperation_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_google_ads_googleads_v10_services_MutateSharedCriteriaResponse_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_google_ads_googleads_v10_services_MutateSharedCriteriaResponse_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_google_ads_googleads_v10_services_MutateSharedCriterionResult_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_google_ads_googleads_v10_services_MutateSharedCriterionResult_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n@google/ads/googleads/v10/services/shar" +
"ed_criterion_service.proto\022!google.ads.g" +
"oogleads.v10.services\032:google/ads/google" +
"ads/v10/enums/response_content_type.prot" +
"o\0329google/ads/googleads/v10/resources/sh" +
"ared_criterion.proto\032\034google/api/annotat" +
"ions.proto\032\027google/api/client.proto\032\037goo" +
"gle/api/field_behavior.proto\032\031google/api" +
"/resource.proto\032\027google/rpc/status.proto" +
"\"\251\002\n\033MutateSharedCriteriaRequest\022\030\n\013cust" +
"omer_id\030\001 \001(\tB\003\340A\002\022T\n\noperations\030\002 \003(\0132;" +
".google.ads.googleads.v10.services.Share" +
"dCriterionOperationB\003\340A\002\022\027\n\017partial_fail" +
"ure\030\003 \001(\010\022\025\n\rvalidate_only\030\004 \001(\010\022j\n\025resp" +
"onse_content_type\030\005 \001(\0162K.google.ads.goo" +
"gleads.v10.enums.ResponseContentTypeEnum" +
".ResponseContentType\"\257\001\n\030SharedCriterion" +
"Operation\022E\n\006create\030\001 \001(\01323.google.ads.g" +
"oogleads.v10.resources.SharedCriterionH\000" +
"\022?\n\006remove\030\003 \001(\tB-\372A*\n(googleads.googlea" +
"pis.com/SharedCriterionH\000B\013\n\toperation\"\242" +
"\001\n\034MutateSharedCriteriaResponse\0221\n\025parti" +
"al_failure_error\030\003 \001(\0132\022.google.rpc.Stat" +
"us\022O\n\007results\030\002 \003(\0132>.google.ads.googlea" +
"ds.v10.services.MutateSharedCriterionRes" +
"ult\"\262\001\n\033MutateSharedCriterionResult\022D\n\rr" +
"esource_name\030\001 \001(\tB-\372A*\n(googleads.googl" +
"eapis.com/SharedCriterion\022M\n\020shared_crit" +
"erion\030\002 \001(\01323.google.ads.googleads.v10.r" +
"esources.SharedCriterion2\323\002\n\026SharedCrite" +
"rionService\022\361\001\n\024MutateSharedCriteria\022>.g" +
"oogle.ads.googleads.v10.services.MutateS" +
"haredCriteriaRequest\032?.google.ads.google" +
"ads.v10.services.MutateSharedCriteriaRes" +
"ponse\"X\202\323\344\223\0029\"4/v10/customers/{customer_" +
"id=*}/sharedCriteria:mutate:\001*\332A\026custome" +
"r_id,operations\032E\312A\030googleads.googleapis" +
".com\322A\'https://www.googleapis.com/auth/a" +
"dwordsB\207\002\n%com.google.ads.googleads.v10." +
"servicesB\033SharedCriterionServiceProtoP\001Z" +
"Igoogle.golang.org/genproto/googleapis/a" +
"ds/googleads/v10/services;services\242\002\003GAA" +
"\252\002!Google.Ads.GoogleAds.V10.Services\312\002!G" +
"oogle\\Ads\\GoogleAds\\V10\\Services\352\002%Googl" +
"e::Ads::GoogleAds::V10::Servicesb\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
com.google.ads.googleads.v10.enums.ResponseContentTypeProto.getDescriptor(),
com.google.ads.googleads.v10.resources.SharedCriterionProto.getDescriptor(),
com.google.api.AnnotationsProto.getDescriptor(),
com.google.api.ClientProto.getDescriptor(),
com.google.api.FieldBehaviorProto.getDescriptor(),
com.google.api.ResourceProto.getDescriptor(),
com.google.rpc.StatusProto.getDescriptor(),
});
internal_static_google_ads_googleads_v10_services_MutateSharedCriteriaRequest_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_google_ads_googleads_v10_services_MutateSharedCriteriaRequest_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_google_ads_googleads_v10_services_MutateSharedCriteriaRequest_descriptor,
new java.lang.String[] { "CustomerId", "Operations", "PartialFailure", "ValidateOnly", "ResponseContentType", });
internal_static_google_ads_googleads_v10_services_SharedCriterionOperation_descriptor =
getDescriptor().getMessageTypes().get(1);
internal_static_google_ads_googleads_v10_services_SharedCriterionOperation_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_google_ads_googleads_v10_services_SharedCriterionOperation_descriptor,
new java.lang.String[] { "Create", "Remove", "Operation", });
internal_static_google_ads_googleads_v10_services_MutateSharedCriteriaResponse_descriptor =
getDescriptor().getMessageTypes().get(2);
internal_static_google_ads_googleads_v10_services_MutateSharedCriteriaResponse_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_google_ads_googleads_v10_services_MutateSharedCriteriaResponse_descriptor,
new java.lang.String[] { "PartialFailureError", "Results", });
internal_static_google_ads_googleads_v10_services_MutateSharedCriterionResult_descriptor =
getDescriptor().getMessageTypes().get(3);
internal_static_google_ads_googleads_v10_services_MutateSharedCriterionResult_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_google_ads_googleads_v10_services_MutateSharedCriterionResult_descriptor,
new java.lang.String[] { "ResourceName", "SharedCriterion", });
com.google.protobuf.ExtensionRegistry registry =
com.google.protobuf.ExtensionRegistry.newInstance();
registry.add(com.google.api.ClientProto.defaultHost);
registry.add(com.google.api.FieldBehaviorProto.fieldBehavior);
registry.add(com.google.api.AnnotationsProto.http);
registry.add(com.google.api.ClientProto.methodSignature);
registry.add(com.google.api.ClientProto.oauthScopes);
registry.add(com.google.api.ResourceProto.resourceReference);
com.google.protobuf.Descriptors.FileDescriptor
.internalUpdateFileDescriptor(descriptor, registry);
com.google.ads.googleads.v10.enums.ResponseContentTypeProto.getDescriptor();
com.google.ads.googleads.v10.resources.SharedCriterionProto.getDescriptor();
com.google.api.AnnotationsProto.getDescriptor();
com.google.api.ClientProto.getDescriptor();
com.google.api.FieldBehaviorProto.getDescriptor();
com.google.api.ResourceProto.getDescriptor();
com.google.rpc.StatusProto.getDescriptor();
}
// @@protoc_insertion_point(outer_class_scope)
}
| 58.141892
| 121
| 0.771644
|
11ce8d82f7da2f2d7a22523fb40c3520f5a93f3a
| 8,167
|
package ru.maklas.mnet2;
import com.badlogic.gdx.utils.Array;
import ru.maklas.mnet2.serialization.Serializer;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.concurrent.atomic.AtomicInteger;
public class BroadcastSocket {
private final UDPSocket udp;
private final DatagramPacket sendingPacket;
private final DatagramPacket receivingPacket;
private final byte[] uuid;
private final InetAddress address;
private final int port;
private final AtomicInteger seqCounter;
private final Serializer serializer;
private final Object monitor;
private volatile ReceiverBuffer receiver;
private volatile Thread searchingThread;
private volatile int currentSeq;
/**
* @param port {@link BroadcastServlet} must use the same port to communicate
* @param bufferSize max byte[] size that is possible to send over UDP. Recommended to use 512
* @param uuid Unique id for application or application version. So that no other apps that use this library could see your request.
* {@link BroadcastServlet} must have the same UUID in oder to receive your requests!
*/
public BroadcastSocket(int port, int bufferSize, String uuid, Serializer serializer) throws SocketException, UnknownHostException {
this(new JavaUDPSocket(), "255.255.255.255", port, bufferSize, uuid.getBytes(), serializer);
}
/**
*
* @param socket Use {@link JavaUDPSocket} for actual connection
* @param address target broadcast address. Use default 255.255.255.255 if you don't know what to put in here.
* @param port {@link BroadcastServlet} must use the same port to communicate
* @param bufferSize max byte[] size that is possible to send over UDP. Recommended to use 512
* @param uuid Unique id for application or application version. So that no other apps that use this library could see your request.
* {@link BroadcastServlet} must have the same UUID in oder to receive your requests!
*/
public BroadcastSocket(UDPSocket socket, String address, int port, int bufferSize, byte[] uuid, Serializer serializer) throws UnknownHostException, SocketException {
this.udp = socket;
this.address = InetAddress.getByName(address);
this.port = port;
this.seqCounter = new AtomicInteger();
this.serializer = serializer;
this.uuid = LocatorUtils.normalizeUUID(uuid);
this.sendingPacket = new DatagramPacket(new byte[bufferSize], bufferSize);
this.receivingPacket = new DatagramPacket(new byte[bufferSize], bufferSize);
this.monitor = new Object();
socket.setBroadcast(true);
new Thread(new Runnable() {
@Override
public void run() {
BroadcastSocket.this.run();
}
}).start();
}
public boolean isClosed(){
return udp.isClosed();
}
public void close(){
interrupt();
udp.close();
}
/**
* Interrupts current search if it's in action.
* @return true if search was actually interrupted.
*/
public boolean interrupt(){
synchronized (monitor){
if (receiver != null){
receiver.receiver.finished(true);
searchingThread.interrupt();
searchingThread = null;
receiver = null;
return true;
}
}
return false;
}
/**
* Starts async search. Don't forget to synchronzie anything you get onto BroadcastReceiver!
*/
public boolean search(Object data, final int timeMillis, final int resends, final BroadcastReceiver receiver){
synchronized (monitor){
if (this.receiver != null) return false;
final byte[] serialized = serializer.serialize(data);
final int seq = currentSeq = seqCounter.getAndIncrement();
final byte[] fullPackage = LocatorUtils.createRequest(uuid, seq, serialized);
this.receiver = new ReceiverBuffer(receiver);
searchingThread = new Thread(new Runnable() {
@Override
public void run() {
final int resendCD = timeMillis / resends;
for (int i = 0; i < resends; i++) {
sendData(fullPackage);
try {
Thread.sleep(resendCD);
} catch (InterruptedException e) {
return;
}
}
synchronized (monitor){
ReceiverBuffer receiverBuffer = BroadcastSocket.this.receiver;
if (receiverBuffer != null){
receiverBuffer.receiver.finished(false);
BroadcastSocket.this.receiver = null;
BroadcastSocket.this.searchingThread = null;
}
}
}
});
searchingThread.start();
}
return true;
}
public boolean isSearching(){
synchronized (monitor){
return receiver != null;
}
}
private void run() {
UDPSocket udp = this.udp;
DatagramPacket receivingPacket = this.receivingPacket;
byte[] buffer = receivingPacket.getData();
byte[] uuid = this.uuid;
while (!udp.isClosed()){
try {
udp.receive(receivingPacket);
} catch (IOException e) {
if (udp.isClosed()){
break;
} else {
continue;
}
}
int length = receivingPacket.getLength();
if (length < LocatorUtils.minMsgLength){
continue;
}
boolean startsWithUUID = LocatorUtils.startsWithUUID(buffer, uuid);
if (!startsWithUUID
|| !LocatorUtils.isResponse(buffer)){
continue;
}
synchronized (monitor){
ReceiverBuffer receiver = this.receiver;
if (LocatorUtils.getSeq(buffer) != currentSeq || receiver == null) continue;
InetAddress address = receivingPacket.getAddress();
int port = receivingPacket.getPort();
Address addr = new Address(address, port);
if (!receiver.cointains(addr)){
receiver.add(addr);
Object userResponse = serializer.deserialize(buffer, 21, length - 21);
receiver.receiver.receive(new BroadcastResponse(address, port, userResponse));
}
}
}
}
private void sendData(byte[] data){
DatagramPacket sendingPacket = this.sendingPacket;
sendingPacket.setData(data);
sendingPacket.setAddress(address);
sendingPacket.setPort(port);
try {
udp.send(sendingPacket);
} catch (IOException e) {}
}
private static class ReceiverBuffer {
BroadcastReceiver receiver;
Array<Address> respondedAddresses;
public ReceiverBuffer(BroadcastReceiver receiver) {
this.receiver = receiver;
this.respondedAddresses = new Array<Address>();
}
public boolean cointains(Address address){
for (Address respondedAddress : respondedAddresses) {
if (address.address.equals(respondedAddress.address)
&& address.port == respondedAddress.port) return true;
}
return false;
}
public void add(Address address){
respondedAddresses.add(address);
}
}
private static class Address {
InetAddress address;
int port;
public Address(InetAddress address, int port) {
this.address = address;
this.port = port;
}
}
}
| 35.354978
| 169
| 0.585894
|
b8655860a8df00aebbf545cf63e86e87aba5e440
| 1,027
|
package discord.bot.utils.save;
public enum PropertyEnum {
AUTOROLE("autoRole","Role granted to user on server join", ""),
USEREVENTCHANNEL("userEventChannel","Channel where i am supposed to say Hi / Bye", ""),
USEREVENTENABLED("userEventEnabled","Status of the Hi / Bye feature", ""),
VOLUME("volume","Last volume set", "50"),
LOOP("loop", "Loop on track status", "false"),
PREFIX("prefix", "Bot's command prefix", "!");
private String propertyName;
private String propertyNameForUser;
private String defaultValue;
PropertyEnum(String propertyName, String propertyNameForUser, String defaultValue){
this.propertyName = propertyName;
this.propertyNameForUser = propertyNameForUser;
this.defaultValue = defaultValue;
}
public String getPropertyName() {
return propertyName;
}
public String getPropertyNameForUser() {
return propertyNameForUser;
}
public String getDefaultValue() {
return defaultValue;
}
}
| 31.121212
| 91
| 0.682571
|
d8bdc7964890170c2fb7cec0dab8e95eb6ec5b09
| 2,566
|
/*-
* ========================LICENSE_START=================================
* JSoagger
* %%
* Copyright (C) 2019 JSOAGGER
* %%
* 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.
* =========================LICENSE_END==================================
*/
package io.github.jsoagger.jfxcore.engine.components.input;
import io.github.jsoagger.core.bridge.operation.IOperation;
import io.github.jsoagger.core.bridge.result.OperationData;
import io.github.jsoagger.jfxcore.api.IJSoaggerController;
import io.github.jsoagger.jfxcore.viewdef.json.xml.model.VLViewComponentXML;
import com.google.gson.JsonObject;
import javafx.application.Platform;
import javafx.concurrent.Task;
/**
* @author Ramilafananana VONJISOA
*
*/
public class ProfileSimpleButton extends SimpleButton {
// needs GetCurrentUserOperation
private IOperation getCurrentUserOperation;
/**
* Constructor
*/
public ProfileSimpleButton() {
super();
}
@Override
public void buildFrom(IJSoaggerController controller, VLViewComponentXML configuration) {
super.buildFrom(controller, configuration);
button.setText("");
if (getCurrentUserOperation != null) {
Task<Void> loadCurrentUser = new Task<Void>() {
@Override
protected Void call() throws Exception {
getCurrentUserOperation.doOperation(new JsonObject(), res -> {
Platform.runLater(() -> {
button.setText((String) ((OperationData) res.rootData()).getAttributes().get("nickName"));
});
});
return null;
}
@Override
protected void failed() {
super.failed();
Platform.runLater(() -> {
button.setText("--");
});
}
@Override
protected void setException(Throwable t) {
super.setException(t);
Platform.runLater(() -> {
button.setText("--");
});
}
};
Thread t = new Thread(loadCurrentUser);
t.setDaemon(true);
// t.start();
}
}
}
| 27.010526
| 104
| 0.624708
|
32ebc8c967a67a83f91dea74a22b76f208663ae6
| 579
|
package com.ab.view.progress;
import com.ab.R;
import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.widget.TextView;
public class AbCommonProgressDialog extends Dialog {
public AbCommonProgressDialog(Context context) {
super(context, R.style.CustomProgressDialog);
this.setContentView(R.layout.commonprogressdialog);
this.getWindow().getAttributes().gravity = Gravity.CENTER;
}
public void setMessage(String s) {
TextView tvMsg = (TextView) this.findViewById(R.id.id_tv_loadingmsg);
tvMsg.setText(s);
}
}
| 24.125
| 71
| 0.775475
|
c67dbda274287b76ee3801bed6e3033dc2bed560
| 717
|
package android.support.v4.app;
import android.app.Activity;
import java.io.FileDescriptor;
import java.io.PrintWriter;
class ActivityCompatHoneycomb
{
static void dump(Activity paramActivity, String paramString, FileDescriptor paramFileDescriptor, PrintWriter paramPrintWriter, String[] paramArrayOfString)
{
paramActivity.dump(paramString, paramFileDescriptor, paramPrintWriter, paramArrayOfString);
}
static void invalidateOptionsMenu(Activity paramActivity)
{
paramActivity.invalidateOptionsMenu();
}
}
/* Location: E:\Progs\Dev\Android\Decompile\apktool\zssq\zssq-dex2jar.jar
* Qualified Name: android.support.v4.app.ActivityCompatHoneycomb
* JD-Core Version: 0.6.0
*/
| 31.173913
| 157
| 0.779637
|
da36b9c695ea0f3646e5b04570646e01570d43ca
| 619
|
package com.github.sejoslaw.vanillamagic2.core;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
* @author Sejoslaw - https://github.com/Sejoslaw
*/
public final class VMLogger {
public static Logger LOGGER = LogManager.getLogger("VanillaMagic2");
public static void log(Level level, String message) {
LOGGER.log(level, message);
}
public static void logInfo(String message) {
log(Level.INFO, message);
}
public static void logError(String message) {
log(Level.ERROR, message);
}
}
| 24.76
| 72
| 0.701131
|
6fa75b8dc2e6480cd09465487aedfc447bbfe996
| 6,538
|
package us.kbase.dashboardservice;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Generated;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import us.kbase.common.service.UObject;
/**
* <p>Original spec-file type: Narrative</p>
*
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@Generated("com.googlecode.jsonschema2pojo")
@JsonPropertyOrder({
"objectId",
"objectVersion",
"owner",
"permission",
"isPublic",
"isNarratorial",
"title",
"savedTime",
"savedBy",
"permissions",
"cellTypes",
"apps"
})
public class Narrative {
@JsonProperty("objectId")
private Long objectId;
@JsonProperty("objectVersion")
private Long objectVersion;
@JsonProperty("owner")
private String owner;
@JsonProperty("permission")
private String permission;
@JsonProperty("isPublic")
private Long isPublic;
@JsonProperty("isNarratorial")
private Long isNarratorial;
@JsonProperty("title")
private String title;
@JsonProperty("savedTime")
private Long savedTime;
@JsonProperty("savedBy")
private String savedBy;
@JsonProperty("permissions")
private List<UserPermission> permissions;
@JsonProperty("cellTypes")
private List<UObject> cellTypes;
@JsonProperty("apps")
private List<NarrativeApp> apps;
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
@JsonProperty("objectId")
public Long getObjectId() {
return objectId;
}
@JsonProperty("objectId")
public void setObjectId(Long objectId) {
this.objectId = objectId;
}
public Narrative withObjectId(Long objectId) {
this.objectId = objectId;
return this;
}
@JsonProperty("objectVersion")
public Long getObjectVersion() {
return objectVersion;
}
@JsonProperty("objectVersion")
public void setObjectVersion(Long objectVersion) {
this.objectVersion = objectVersion;
}
public Narrative withObjectVersion(Long objectVersion) {
this.objectVersion = objectVersion;
return this;
}
@JsonProperty("owner")
public String getOwner() {
return owner;
}
@JsonProperty("owner")
public void setOwner(String owner) {
this.owner = owner;
}
public Narrative withOwner(String owner) {
this.owner = owner;
return this;
}
@JsonProperty("permission")
public String getPermission() {
return permission;
}
@JsonProperty("permission")
public void setPermission(String permission) {
this.permission = permission;
}
public Narrative withPermission(String permission) {
this.permission = permission;
return this;
}
@JsonProperty("isPublic")
public Long getIsPublic() {
return isPublic;
}
@JsonProperty("isPublic")
public void setIsPublic(Long isPublic) {
this.isPublic = isPublic;
}
public Narrative withIsPublic(Long isPublic) {
this.isPublic = isPublic;
return this;
}
@JsonProperty("isNarratorial")
public Long getIsNarratorial() {
return isNarratorial;
}
@JsonProperty("isNarratorial")
public void setIsNarratorial(Long isNarratorial) {
this.isNarratorial = isNarratorial;
}
public Narrative withIsNarratorial(Long isNarratorial) {
this.isNarratorial = isNarratorial;
return this;
}
@JsonProperty("title")
public String getTitle() {
return title;
}
@JsonProperty("title")
public void setTitle(String title) {
this.title = title;
}
public Narrative withTitle(String title) {
this.title = title;
return this;
}
@JsonProperty("savedTime")
public Long getSavedTime() {
return savedTime;
}
@JsonProperty("savedTime")
public void setSavedTime(Long savedTime) {
this.savedTime = savedTime;
}
public Narrative withSavedTime(Long savedTime) {
this.savedTime = savedTime;
return this;
}
@JsonProperty("savedBy")
public String getSavedBy() {
return savedBy;
}
@JsonProperty("savedBy")
public void setSavedBy(String savedBy) {
this.savedBy = savedBy;
}
public Narrative withSavedBy(String savedBy) {
this.savedBy = savedBy;
return this;
}
@JsonProperty("permissions")
public List<UserPermission> getPermissions() {
return permissions;
}
@JsonProperty("permissions")
public void setPermissions(List<UserPermission> permissions) {
this.permissions = permissions;
}
public Narrative withPermissions(List<UserPermission> permissions) {
this.permissions = permissions;
return this;
}
@JsonProperty("cellTypes")
public List<UObject> getCellTypes() {
return cellTypes;
}
@JsonProperty("cellTypes")
public void setCellTypes(List<UObject> cellTypes) {
this.cellTypes = cellTypes;
}
public Narrative withCellTypes(List<UObject> cellTypes) {
this.cellTypes = cellTypes;
return this;
}
@JsonProperty("apps")
public List<NarrativeApp> getApps() {
return apps;
}
@JsonProperty("apps")
public void setApps(List<NarrativeApp> apps) {
this.apps = apps;
}
public Narrative withApps(List<NarrativeApp> apps) {
this.apps = apps;
return this;
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperties(String name, Object value) {
this.additionalProperties.put(name, value);
}
@Override
public String toString() {
return ((((((((((((((((((((((((((("Narrative"+" [objectId=")+ objectId)+", objectVersion=")+ objectVersion)+", owner=")+ owner)+", permission=")+ permission)+", isPublic=")+ isPublic)+", isNarratorial=")+ isNarratorial)+", title=")+ title)+", savedTime=")+ savedTime)+", savedBy=")+ savedBy)+", permissions=")+ permissions)+", cellTypes=")+ cellTypes)+", apps=")+ apps)+", additionalProperties=")+ additionalProperties)+"]");
}
}
| 25.049808
| 433
| 0.650811
|
72dfec18607950ca9872f8d2f27a187250a1aceb
| 1,629
|
package com.jamesswafford.chess4j.utils;
import com.jamesswafford.chess4j.pieces.*;
import java.util.HashMap;
import java.util.Map;
public final class PieceFactory {
private static Map<String,Piece> charToPieceMap;
private PieceFactory() {
}
static {
charToPieceMap = new HashMap<>();
charToPieceMap.put("R", Rook.WHITE_ROOK);
charToPieceMap.put("r", Rook.BLACK_ROOK);
charToPieceMap.put("N", Knight.WHITE_KNIGHT);
charToPieceMap.put("n", Knight.BLACK_KNIGHT);
charToPieceMap.put("B", Bishop.WHITE_BISHOP);
charToPieceMap.put("b", Bishop.BLACK_BISHOP);
charToPieceMap.put("Q", Queen.WHITE_QUEEN);
charToPieceMap.put("q", Queen.BLACK_QUEEN);
charToPieceMap.put("K", King.WHITE_KING);
charToPieceMap.put("k", King.BLACK_KING);
charToPieceMap.put("P", Pawn.WHITE_PAWN);
charToPieceMap.put("p", Pawn.BLACK_PAWN);
}
public static Piece getPiece(char p) {
return getPiece(String.valueOf(p));
}
public static Piece getPiece(String p) {
return charToPieceMap.get(p);
}
public static Piece getPiece(char p,boolean wtm) {
return getPiece(String.valueOf(p),wtm);
}
public static Piece getPiece(String p,boolean wtm) {
Piece piece = charToPieceMap.get(p);
if (piece==null) {
return null;
}
if (wtm && !piece.isWhite()) {
piece = piece.getOppositeColorPiece();
} else if (!wtm && !piece.isBlack()) {
piece = piece.getOppositeColorPiece();
}
return piece;
}
}
| 28.578947
| 56
| 0.624309
|
89a0545fb1ab39e6a41726081ab82b7514e5854d
| 1,422
|
package com.github.ynfeng.commander.bootstrap;
import com.github.ynfeng.commander.support.logger.CmderLoggerFactory;
import com.google.common.collect.Lists;
import java.util.List;
import org.slf4j.Logger;
public class StartSteps extends Steps {
private static final Logger LOGGER = CmderLoggerFactory.getSystemLogger();
private final List<StartStep> steps = Lists.newArrayList();
private final ShutdownSteps shutdownStpes = new ShutdownSteps();
private int currentStep = 1;
public ShutdownSteps execute() throws Exception {
long duration = takeDuration(this::startupStepByStep);
LOGGER.debug(
"Bootstrap succeeded. Started {} steps in {} ms.",
steps.size(),
duration);
return shutdownStpes;
}
public void add(StartStep startStep) {
steps.add(startStep);
}
private void startupStepByStep() {
steps.forEach(step -> executeChecked(
() -> takeDuration(() -> shutdownStpes.add(new ShutdownStep(step.name(), step.execute()))))
.onException(e -> LOGGER.info("Bootstrap {} [{}/{}] failed with unexpected exception.",
step.name(), currentStep++, steps.size(), e))
.onResult(duration -> LOGGER.debug("Bootstrap [{}/{}]: {} started in {} ms.", currentStep++,
steps.size(), step.name(), duration))
.throwExceptionIfNecessary());
}
}
| 38.432432
| 104
| 0.649086
|
1deb2777000b8be5462fb1136b1cecb8866a9e2d
| 4,118
|
/* FARIS : Factual Arrangement and Representation of Ideas in Sentences
* FAris : Farabi & Aristotle
* Faris : A knight (in Arabic)
* --------------------------------------------------------------------
* Copyright (C) 2015 Abdelkrime Aries (kariminfo0@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package kariminf.faris.philosophical;
import kariminf.faris.process.Processor;
/**
* Quantity (ποσόν, poson, how much). This is the extension of an object, and may be
* either discrete or continuous. Further, its parts may or may not have relative
* positions to each other. All medieval discussions about the nature of the continuum,
* of the infinite and the infinitely divisible, are a long footnote to this text.
* It is of great importance in the development of mathematical ideas in the medieval
* and late Scholastic period. Examples: two cubits long, number, space, (length of) time.
*
* @author Abdelkrime Aries (kariminfo0@gmail.com)
* <br>
* Copyright (c) 2015-2017 Abdelkrime Aries
* <br><br>
* 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
* <br><br>
* http://www.apache.org/licenses/LICENSE-2.0
* <br><br>
* 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.
*/
public class Quantity extends Being{
public static final class QuantityWrapper {
public Quantity quantity;
public double nbr;
public Substance unit; //mesure unit: kilogram, etc.
public boolean cardinal = true;
public boolean plural = false;
public QuantityWrapper (Quantity quantity){
this.quantity = quantity;
}
public void unsafeAddAll(){
nbr = quantity.nbr;
unit = quantity.unit;
cardinal = quantity.cardinal;
plural = quantity.plural;
}
}
private double nbr;
private Substance unit; //mesure unit: kilogram, etc.
private boolean cardinal = true;
private boolean plural;
public Quantity(double nbr) {
this.plural = false;
this.nbr = nbr;
}
public Quantity copy(){
Quantity result;
if(plural){
result = new Quantity();
} else {
result = new Quantity(nbr);
}
result.unit = unit;
result.cardinal = cardinal;
return result;
}
/**
* This means there are a lot (Plural): undefined plural quantity
*/
public Quantity() {
this.plural = true;
}
/**
* We can set ordinal for number quantities
*/
public void setOrdinal(){
if (! plural) cardinal = false;
}
public boolean isPlural(){
return plural;
}
public boolean isCardinal(){
return cardinal;
}
public void addUnit(Substance unit){
this.unit = unit;
}
public double getNumber(){
return nbr;
}
public Substance getUnit(){
return unit;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
String result = "";
if (plural) result += "PL";
else {
result += (cardinal)? "": "O";
result += nbr;
}
result += (unit != null)? ":" + unit: "";
return result;
}
@Override
public void process(Processor pr) {
QuantityWrapper wrapper = new QuantityWrapper(this);
wrapper.unsafeAddAll();
pr.processQuantity(wrapper);
}
}
| 26.567742
| 90
| 0.668286
|
e6e85d568da2205da33c677ad8f89cac664ec5a4
| 1,664
|
package com.example.danieljoaquimpaulino.plusieuractivity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class Main3Activity extends Activity {
EditText not1, not2, not3, Result;
Button btnResult;
private Button btn22= null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main3);
not1 = (EditText)findViewById(R.id.Edit1);
not2 = (EditText)findViewById(R.id.Edit2);
not3 = (EditText)findViewById(R.id.Edit3);
btnResult = (Button)findViewById(R.id.btnCalculer);
Result =(EditText)findViewById(R.id.EditResult);
btnResult.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int n1 = Integer.parseInt(not1.getText().toString());
int n2 = Integer.parseInt(not2.getText().toString());
int n3 = Integer.parseInt(not3.getText().toString());
int RESULT = (n1+n2+n3)/3;
Result.setText(Integer.toString(RESULT));
}
});
btn22 = (Button) findViewById(R.id.btntwo);
btn22.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent result = new Intent(); result.putExtra(MainActivity.BUTTONS, "2");
setResult(RESULT_OK, result);
finish();
} });
}
}
| 25.212121
| 89
| 0.620192
|
71d77c56208cb72b3820da668bb292a62eeedf86
| 5,231
|
package org.jzy3d.plot3d.primitives;
import org.jzy3d.colors.Color;
import org.jzy3d.colors.ISingleColorable;
import org.jzy3d.events.DrawableChangedEvent;
import org.jzy3d.maths.BoundingBox3d;
import org.jzy3d.maths.Coord3d;
import org.jzy3d.maths.Utils;
import org.jzy3d.painters.IPainter;
import org.jzy3d.plot3d.transform.Transform;
/**
* Allows rendering a sphere.
*
* The position and shape of a Sphere3d is defined through its {@link setData()} method. Moreover, a
* Sphere3d is Wireframeable3d and support only one color that is defined trough its
* {@link setColor()} method.
*
* @author Martin Pernollet
*/
public class Sphere extends Wireframeable implements ISingleColorable {
/**
* Initialize a black sphere at the origin with a radius of 10, and slicing of 15.
*/
public Sphere() {
super();
bbox = new BoundingBox3d();
setPosition(Coord3d.ORIGIN);
setVolume(10f);
setSlicing(15, 15);
setColor(Color.BLACK);
}
/** Initialize a sphere with the given parameters. */
public Sphere(Coord3d position, float radius, int slicing, Color color) {
super();
bbox = new BoundingBox3d();
setPosition(position);
setVolume(radius);
setSlicing(slicing, slicing);
setColor(color);
}
/********************************************************/
@Override
public void draw(IPainter painter) {
doTransform(painter);
doDrawSphere(painter);
doDrawBoundsIfDisplayed(painter);
}
protected void doDrawSphere(IPainter painter) {
painter.glTranslatef(position.x, position.y, position.z);
if (faceDisplayed) {
painter.glPolygonMode(PolygonMode.FRONT_AND_BACK, PolygonFill.FILL);
painter.glColor4f(color.r, color.g, color.b, color.a);
// glu.gluSphere(qobj, radius, slices, stacks);
painter.glutSolidSphere(radius, slices, stacks);
}
if (wireframeDisplayed) {
painter.glPolygonMode(PolygonMode.FRONT_AND_BACK, PolygonFill.LINE);
painter.glLineWidth(wireframeWidth);
painter.glColor4f(wireframeColor.r, wireframeColor.g, wireframeColor.b, wireframeColor.a);
// glu.gluSphere(qobj, radius, slices, stacks);
painter.glutSolidSphere(radius, slices, stacks);
// gl.glPolygonMode(GL2.GL_FRONT, GL2.GL_LINE);
// gl.glPolygonMode(GL2.GL_FRONT, GL2.GL_FILL);
}
}
@Override
public void applyGeometryTransform(Transform transform) {
position.set(transform.compute(position));
updateBounds();
}
/*
* protected GLUquadric qobj; public void draw2(){ // qobj = glu.gluNewQuadric();
* //glu.gluSphere(qobj, radius, slices, stacks); }
*/
/**********************************************************************/
/**
* Set the sphere data.
*
* @param position sphere position (may be handled differently in future version)
* @param radius radius of the sphere
* @param slices number of vertical slices (i.e. wireframes)
* @param stacks number of horizontal stacks (i.e. wireframes)
*/
public void setData(Coord3d position, float radius, float height, int slices, int stacks) {
setPosition(position);
setVolume(radius);
setSlicing(slices, stacks);
}
/**
* Set the position of the Sphere and the dimensions of its boundingbox. Note that this position
* will be use to translate the object before drawing it (meaning a glTranslate(position) is
* performed right after the Translate.execute).
*
* @param position
*/
public void setPosition(Coord3d position) {
this.position = position;
updateBounds();
}
public Coord3d getPosition() {
return position;
}
@Override
public void updateBounds() {
bbox.reset();
bbox.add(position.x + radius, position.y + radius, position.z + radius);
bbox.add(position.x - radius, position.y - radius, position.z - radius);
}
/**
* Set the radius of the sphere, and the dimensions of its boundingbox.
*
* @param radius sphere radius
*/
public void setVolume(float radius) {
this.radius = radius;
updateBounds();
}
/**
* Set the sphere slicing parameters, i.e. the subtlety of the circle estimation.
*
* @param verticalWires number of vertical slices
* @param horizontalWires number of horizontal slices
*/
public void setSlicing(int verticalWires, int horizontalWires) {
this.slices = verticalWires;
this.stacks = horizontalWires;
}
/********************************************************/
@Override
public void setColor(Color color) {
this.color = color;
fireDrawableChanged(new DrawableChangedEvent(this, DrawableChangedEvent.FIELD_COLOR));
}
@Override
public Color getColor() {
return color;
}
/********************************************************/
@Override
public String toString(int depth) {
return Utils.blanks(depth) + "(Sphere) radius= " + radius + " x=" + position.x + " y="
+ position.y + " z=" + position.z + " r=" + color.r + " g=" + color.g + " b=" + color.b
+ " a=" + color.a;
}
/********************************************************/
protected Coord3d position;
protected float radius;
protected int slices;
protected int stacks;
protected Color color;
}
| 29.38764
| 100
| 0.64653
|
bf878ae14defa2bc43c0086d030072e77248d27a
| 303
|
/*
* Created on 06-Jan-2006
*/
package uk.org.ponder.beanutil;
import java.util.Iterator;
public interface IterableBeanLocator extends BeanLocator {
/**
* Returns an iteration of the *names* of the beans in this BeanLocator
* @return iterator of names
*/
public Iterator iterator();
}
| 20.2
| 73
| 0.712871
|
78400c6b3b919e55d3986d80ef00eaa677f01dc3
| 2,797
|
/*
* XSample Server
* Copyright (C) 2020-2021 Markus Gärtner <markus.gaertner@ims.uni-stuttgart.de>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
*
*/
package de.unistuttgart.xsample.qe.icarus1.match;
import static org.assertj.core.api.Assertions.assertThat;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.stream.Stream;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import de.unistuttgart.xsample.qe.Result;
import de.unistuttgart.xsample.qe.icarus1.CONLL09SentenceDataReader;
import de.unistuttgart.xsample.qe.icarus1.Location;
import de.unistuttgart.xsample.qe.icarus1.Options;
import de.unistuttgart.xsample.qe.icarus1.SentenceData;
/**
* @author Markus Gärtner
*
*/
class SearchTest {
private List<SentenceData> loadCorpus() throws Exception {
final InputStream in = SearchTest.class.getResourceAsStream("/de/unistuttgart/xsample/qe/icarus1/icarus.conll09");
final Location location = new Location.Base() {
@Override
public InputStream openInputStream() throws IOException { return in; }
};
final CONLL09SentenceDataReader reader = new CONLL09SentenceDataReader(true);
return reader.readAll(location, null);
}
static Stream<Arguments> queryResultProvider() {
return Stream.of(
Arguments.of(Options.emptyOptions, "[form=Icarus]", new long[] {0, 4, 6, 7, 9}),
Arguments.of(new Options(SearchParameters.SEARCH_CASESENSITIVE, true),
"[form=He]", new long[] {3, 4})
);
}
@ParameterizedTest
@MethodSource("queryResultProvider")
void testDummyCorpus(Options options, String queryString, long[] hits) throws Exception {
List<SentenceData> corpus = loadCorpus();
ConstraintContext context = ConstraintContext.defaultContext();
SearchQuery query = new SearchQuery(context);
query.parseQueryString(queryString);
Search search = new Search(query, options, corpus);
assertThat(search.init()).isTrue();
search.execute();
assertThat(search.isDone()).isTrue();
Result result = search.getResult();
assertThat(result.getHits()).containsExactly(hits);
}
}
| 34.109756
| 117
| 0.732571
|
333351f796089f556fce4403cf32aecce4d19a69
| 4,678
|
/* Generated SBE (Simple Binary Encoding) message codec */
package com.euronext.optiq.dd;
public enum TradeType_enum
{
Conventional_Trade((short)1),
Large_in_Scale_LiS_Trade((short)2),
Basis_Trade((short)3),
Large_in_Scale_LiS_Package_Trade((short)4),
Guaranteed_Cross_Trade((short)5),
Against_Actual_Trade((short)6),
Asset_Allocation_Trade((short)7),
Exchange_for_Swap_Trade((short)9),
Exchange_for_Physical_Trade_Cash_Leg((short)10),
Strategy_Leg_Conventional_Trade((short)11),
Strategy_Leg_Large_in_Scale_LiS_Trade((short)12),
Strategy_Leg_Basis_Trade((short)13),
Strategy_Leg_Guaranteed_Cross_Trade((short)14),
Strategy_Leg_Against_Actual_Trade((short)15),
Strategy_Leg_Asset_Allocation_Trade((short)16),
Strategy_Leg_Exchange_For_Swap_Trade((short)18),
Strategy_Leg_Exchange_For_Physical_Trade((short)19),
BoB_Trade((short)20),
AtomX_Trade((short)22),
Trade_Cancellation((short)24),
Out_of_Market_Trade((short)25),
Delta_Neutral_Trade_Underlying_Cash_Leg((short)26),
Market_VWAP_Operation_Trade((short)27),
Euronext_Fund_Service_Trade((short)28),
Secondary_Listing_Trade((short)29),
Request_for_Cross_Trade((short)30),
Request_for_cross_strategy_Leg_Trade((short)31),
Trade_Publication((short)32),
Dark_Trade((short)33),
Delta_Neutral_Trade_Underlying_Future_Leg((short)34),
Total_Traded_Volume((short)36),
ETF_MTF_NAV_Trade_price_in_bp((short)37),
ETF_MTF_NAV_Dark_Trade_price_in_bp((short)38),
Guaranteed_Cross_Negotiated_deal_NLIQ((short)39),
Guaranteed_Cross_Negotiated_deal_OILQ((short)40),
Large_in_Scale_Trade((short)41),
Large_in_Scale_Trade_in_basis_points((short)42),
Large_in_Scale_Package_Trade_in_basis_points((short)43),
Strategy_Leg_Large_in_Scale_Trade_in_basis_points((short)44),
/**
* To be used to represent not present or null.
*/
NULL_VAL((short)255);
private final short value;
TradeType_enum(final short value)
{
this.value = value;
}
public short value()
{
return value;
}
public static TradeType_enum get(final short value)
{
switch (value)
{
case 1: return Conventional_Trade;
case 2: return Large_in_Scale_LiS_Trade;
case 3: return Basis_Trade;
case 4: return Large_in_Scale_LiS_Package_Trade;
case 5: return Guaranteed_Cross_Trade;
case 6: return Against_Actual_Trade;
case 7: return Asset_Allocation_Trade;
case 9: return Exchange_for_Swap_Trade;
case 10: return Exchange_for_Physical_Trade_Cash_Leg;
case 11: return Strategy_Leg_Conventional_Trade;
case 12: return Strategy_Leg_Large_in_Scale_LiS_Trade;
case 13: return Strategy_Leg_Basis_Trade;
case 14: return Strategy_Leg_Guaranteed_Cross_Trade;
case 15: return Strategy_Leg_Against_Actual_Trade;
case 16: return Strategy_Leg_Asset_Allocation_Trade;
case 18: return Strategy_Leg_Exchange_For_Swap_Trade;
case 19: return Strategy_Leg_Exchange_For_Physical_Trade;
case 20: return BoB_Trade;
case 22: return AtomX_Trade;
case 24: return Trade_Cancellation;
case 25: return Out_of_Market_Trade;
case 26: return Delta_Neutral_Trade_Underlying_Cash_Leg;
case 27: return Market_VWAP_Operation_Trade;
case 28: return Euronext_Fund_Service_Trade;
case 29: return Secondary_Listing_Trade;
case 30: return Request_for_Cross_Trade;
case 31: return Request_for_cross_strategy_Leg_Trade;
case 32: return Trade_Publication;
case 33: return Dark_Trade;
case 34: return Delta_Neutral_Trade_Underlying_Future_Leg;
case 36: return Total_Traded_Volume;
case 37: return ETF_MTF_NAV_Trade_price_in_bp;
case 38: return ETF_MTF_NAV_Dark_Trade_price_in_bp;
case 39: return Guaranteed_Cross_Negotiated_deal_NLIQ;
case 40: return Guaranteed_Cross_Negotiated_deal_OILQ;
case 41: return Large_in_Scale_Trade;
case 42: return Large_in_Scale_Trade_in_basis_points;
case 43: return Large_in_Scale_Package_Trade_in_basis_points;
case 44: return Strategy_Leg_Large_in_Scale_Trade_in_basis_points;
}
if ((short)255 == value)
{
return NULL_VAL;
}
throw new IllegalArgumentException("Unknown value: " + value);
}
}
| 30.376623
| 78
| 0.697307
|
35751679c0711558e564549d4767e4cd750ba5cf
| 26,019
|
package com.mentor.nucleus.bp.ui.canvas;
//====================================================================
//
// File: com.mentor.nucleus.bp.ui.canvas.WhitespaceTerminal_c.java
//
// WARNING: Do not edit this generated file
// Generated by ../MC-Java/java.arc, $Revision: 1.111 $
//
// (c) Copyright 2005-2014 by Mentor Graphics Corp. All rights reserved.
//
//====================================================================
import com.mentor.nucleus.bp.core.*;
import org.eclipse.swt.graphics.GC;
import java.util.*;
import java.lang.reflect.*;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import com.mentor.nucleus.bp.core.util.PersistenceUtil;
import org.eclipse.core.runtime.NullProgressMonitor;
import com.mentor.nucleus.bp.core.ui.marker.UmlProblem;
import com.mentor.nucleus.bp.core.common.*;
abstract class EV_WHITESPACE_TERMINAL extends genericEvent_c {
public abstract int getEvtcode();
}
public class WhitespaceTerminal_c extends NonRootModelElement
implements
IAdaptable,
Cloneable {
// Public Constructors
public WhitespaceTerminal_c(ModelRoot modelRoot,
java.util.UUID p_m_term_spec_id) {
super(modelRoot);
//pre-process the uuid so that we re-use null uuid instance rather then creating a new one.
m_term_spec_id = IdAssigner.preprocessUUID(p_m_term_spec_id);
Object[] key = {m_term_spec_id};
addInstanceToMap(key);
}
static public WhitespaceTerminal_c createProxy(ModelRoot modelRoot,
java.util.UUID p_m_term_spec_id, String p_contentPath,
IPath p_localPath) {
ModelRoot resolvedModelRoot = ModelRoot.findModelRoot(modelRoot,
p_contentPath, p_localPath);
// if a model root was not resolved it is most likely
// due to a missing file of the proxy, defualt back to
// the original model root
if (resolvedModelRoot != null)
modelRoot = resolvedModelRoot;
InstanceList instances = modelRoot
.getInstanceList(WhitespaceTerminal_c.class);
WhitespaceTerminal_c new_inst = null;
synchronized (instances) {
Object[] key = {p_m_term_spec_id};
new_inst = (WhitespaceTerminal_c) instances.get(key);
}
String contentPath = PersistenceUtil.resolveRelativePath(p_localPath,
new Path(p_contentPath));
if (modelRoot.isNewCompareRoot()) {
// for comparisons we do not want to change
// the content path
contentPath = p_contentPath;
}
if (new_inst != null && !modelRoot.isCompareRoot()) {
PersistableModelComponent pmc = new_inst.getPersistableComponent();
if (pmc == null) {
// dangling reference, redo this instance
new_inst.batchUnrelate();
//pre-process the uuid so that we re-use null uuid instance rather then creating a new one.
new_inst.m_term_spec_id = IdAssigner
.preprocessUUID(p_m_term_spec_id);
}
}
if (new_inst == null) {
// there is no instance matching the id, create a proxy
// if the resource doesn't exist then this will be a dangling reference
new_inst = new WhitespaceTerminal_c(modelRoot, p_m_term_spec_id);
new_inst.m_contentPath = contentPath;
}
return new_inst;
}
static public WhitespaceTerminal_c resolveInstance(ModelRoot modelRoot,
java.util.UUID p_m_term_spec_id) {
InstanceList instances = modelRoot
.getInstanceList(WhitespaceTerminal_c.class);
WhitespaceTerminal_c source = null;
synchronized (instances) {
Object[] key = {p_m_term_spec_id};
source = (WhitespaceTerminal_c) instances.get(key);
if (source != null && !modelRoot.isCompareRoot()) {
source.convertFromProxy();
source.batchUnrelate();
//pre-process the uuid so that we re-use null uuid instance rather then creating a new one.
source.m_term_spec_id = IdAssigner
.preprocessUUID(p_m_term_spec_id);
return source;
}
}
// there is no instance matching the id
WhitespaceTerminal_c new_inst = new WhitespaceTerminal_c(modelRoot,
p_m_term_spec_id);
return new_inst;
}
public WhitespaceTerminal_c(ModelRoot modelRoot) {
super(modelRoot);
m_term_spec_id = IdAssigner.NULL_UUID;
Object[] key = {m_term_spec_id};
addInstanceToMap(key);
}
public Object getInstanceKey() {
Object[] key = {m_term_spec_id};
return key;
}
public boolean setInstanceKey(UUID p_newKey) {
boolean changed = false;
// round p1
// round p2
// round p3
// round p4
// round p5
if (m_term_spec_id != p_newKey) {
m_term_spec_id = p_newKey;
changed = true;
}
return changed;
}
public boolean equals(Object elem) {
if (!(elem instanceof WhitespaceTerminal_c)) {
return false;
}
// check that the model-roots are the same
if (((NonRootModelElement) elem).getModelRoot() != getModelRoot()) {
return false;
}
return identityEquals(elem);
}
public boolean identityEquals(Object elem) {
if (!(elem instanceof WhitespaceTerminal_c)) {
return false;
}
WhitespaceTerminal_c me = (WhitespaceTerminal_c) elem;
// don't allow an empty id-value to produce a false positive result;
// in this case, use whether the two instances are actually the same
// one in memory, instead
if ((IdAssigner.NULL_UUID.equals(getTerm_spec_id()) || IdAssigner.NULL_UUID
.equals(((WhitespaceTerminal_c) elem).getTerm_spec_id()))
&& this != elem) {
return false;
}
if (!getTerm_spec_id().equals(
((WhitespaceTerminal_c) elem).getTerm_spec_id()))
return false;
return true;
}
public boolean cachedIdentityEquals(Object elem) {
if (!(elem instanceof WhitespaceTerminal_c)) {
return false;
}
WhitespaceTerminal_c me = (WhitespaceTerminal_c) elem;
if (!getTerm_spec_idCachedValue().equals(
((WhitespaceTerminal_c) elem).getTerm_spec_idCachedValue()))
return false;
return true;
}
// Attributes
private java.util.UUID m_term_spec_id;
// declare association references from this class
// referring navigation
TerminalSpecification_c IsSupertypeTerminalSpecification;
public void relateAcrossR201To(TerminalSpecification_c target) {
relateAcrossR201To(target, true);
}
public void relateAcrossR201To(TerminalSpecification_c target,
boolean notifyChanges) {
if (target == null)
return;
if (target == IsSupertypeTerminalSpecification)
return; // already related
if (IsSupertypeTerminalSpecification != target) {
Object oldKey = getInstanceKey();
if (IsSupertypeTerminalSpecification != null) {
IsSupertypeTerminalSpecification.clearBackPointerR201To(this);
if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == true) { //$NON-NLS-1$
Ooaofgraphics.log
.println(
ILogger.CONSISTENCY,
"WhitespaceTerminal_c.relateAcrossR201To(TerminalSpecification_c target)",
"Relate performed across R201 from WhiteSpace Terminal to Terminal Specification without unrelate of prior instance.");
}
}
IsSupertypeTerminalSpecification = target;
m_term_spec_id = target.getTerm_spec_id();
updateInstanceKey(oldKey, getInstanceKey());
target.setBackPointerR201To(this);
target.addRef();
}
}
public void unrelateAcrossR201From(TerminalSpecification_c target) {
unrelateAcrossR201From(target, true);
}
public void unrelateAcrossR201From(TerminalSpecification_c target,
boolean notifyChanges) {
if (target == null)
return;
if (IsSupertypeTerminalSpecification == null)
return; // already unrelated
if (target != IsSupertypeTerminalSpecification) {
Exception e = new Exception();
e.fillInStackTrace();
CanvasPlugin.logError(
"Tried to unrelate from non-related instance across R201",
e);
return;
}
if (target != null) {
target.clearBackPointerR201To(this);
}
if (IsSupertypeTerminalSpecification != null) {
m_term_spec_id = IsSupertypeTerminalSpecification.getTerm_spec_id();
IsSupertypeTerminalSpecification = null;
target.removeRef();
}
}
public static WhitespaceTerminal_c getOneTS_WSTOnR201(
TerminalSpecification_c[] targets) {
return getOneTS_WSTOnR201(targets, null);
}
public static WhitespaceTerminal_c getOneTS_WSTOnR201(
TerminalSpecification_c[] targets, ClassQueryInterface_c test) {
WhitespaceTerminal_c ret_val = null;
if (targets != null) {
for (int i = 0; i < targets.length && ret_val == null; ++i) {
ret_val = getOneTS_WSTOnR201(targets[i], test);
}
}
return ret_val;
}
public static WhitespaceTerminal_c getOneTS_WSTOnR201(
TerminalSpecification_c target) {
return getOneTS_WSTOnR201(target, null);
}
public static WhitespaceTerminal_c getOneTS_WSTOnR201(
TerminalSpecification_c target, boolean loadComponent) {
return getOneTS_WSTOnR201(Ooaofgraphics.getDefaultInstance(), target,
null, loadComponent);
}
public static WhitespaceTerminal_c getOneTS_WSTOnR201(
TerminalSpecification_c target, ClassQueryInterface_c test) {
if (target != null) {
return getOneTS_WSTOnR201(Ooaofgraphics.getDefaultInstance(),
target, test);
}
return null;
}
public static WhitespaceTerminal_c getOneTS_WSTOnR201(ModelRoot modelRoot,
TerminalSpecification_c target, ClassQueryInterface_c test) {
return getOneTS_WSTOnR201(modelRoot, target, test, true);
}
public static WhitespaceTerminal_c getOneTS_WSTOnR201(ModelRoot modelRoot,
TerminalSpecification_c target, ClassQueryInterface_c test,
boolean loadComponent) {
return find_getOneTS_WSTOnR201(modelRoot, target, test);
}
private static WhitespaceTerminal_c find_getOneTS_WSTOnR201(
ModelRoot modelRoot, TerminalSpecification_c target,
ClassQueryInterface_c test) {
if (target != null) {
WhitespaceTerminal_c source = (WhitespaceTerminal_c) target.backPointer_IsSubtypeWhitespaceTerminalIsSubtype_R201;
if (source != null && (test == null || test.evaluate(source))) {
return source;
}
}
// not found
return null;
}
public static WhitespaceTerminal_c[] getManyTS_WSTsOnR201(
TerminalSpecification_c[] targets) {
return getManyTS_WSTsOnR201(targets, null);
}
public static WhitespaceTerminal_c[] getManyTS_WSTsOnR201(
TerminalSpecification_c[] targets, boolean loadComponent) {
return getManyTS_WSTsOnR201(targets, null, loadComponent);
}
public static WhitespaceTerminal_c[] getManyTS_WSTsOnR201(
TerminalSpecification_c[] targets, ClassQueryInterface_c test) {
return getManyTS_WSTsOnR201(targets, test, true);
}
public static WhitespaceTerminal_c[] getManyTS_WSTsOnR201(
TerminalSpecification_c[] targets, ClassQueryInterface_c test,
boolean loadComponent) {
if (targets == null || targets.length == 0 || targets[0] == null)
return new WhitespaceTerminal_c[0];
ModelRoot modelRoot = Ooaofgraphics.getDefaultInstance();
InstanceList instances = modelRoot
.getInstanceList(WhitespaceTerminal_c.class);
Vector matches = new Vector();
for (int i = 0; i < targets.length; i++) {
WhitespaceTerminal_c source = (WhitespaceTerminal_c) targets[i].backPointer_IsSubtypeWhitespaceTerminalIsSubtype_R201;
if (source != null && (test == null || test.evaluate(source))) {
matches.add(source);
}
}
if (matches.size() > 0) {
WhitespaceTerminal_c[] ret_set = new WhitespaceTerminal_c[matches
.size()];
matches.copyInto(ret_set);
return ret_set;
} else {
return new WhitespaceTerminal_c[0];
}
}
public static WhitespaceTerminal_c[] getManyTS_WSTsOnR201(
TerminalSpecification_c target) {
if (target != null) {
TerminalSpecification_c[] targetArray = new TerminalSpecification_c[1];
targetArray[0] = target;
return getManyTS_WSTsOnR201(targetArray);
} else {
WhitespaceTerminal_c[] result = new WhitespaceTerminal_c[0];
return result;
}
}
public static WhitespaceTerminal_c[] getManyTS_WSTsOnR201(
TerminalSpecification_c target, boolean loadComponent) {
if (target != null) {
TerminalSpecification_c[] targetArray = new TerminalSpecification_c[1];
targetArray[0] = target;
return getManyTS_WSTsOnR201(targetArray, loadComponent);
} else {
WhitespaceTerminal_c[] result = new WhitespaceTerminal_c[0];
return result;
}
}
public void batchRelate(ModelRoot modelRoot, boolean notifyChanges,
boolean searchAllRoots) {
batchRelate(modelRoot, false, notifyChanges, searchAllRoots);
}
public void batchRelate(ModelRoot modelRoot, boolean relateProxies,
boolean notifyChanges, boolean searchAllRoots) {
InstanceList instances = null;
ModelRoot baseRoot = modelRoot;
// R201
baseRoot = Ooaofgraphics.getDefaultInstance();
if (baseRoot != modelRoot && modelRoot.isCompareRoot()) {
baseRoot = modelRoot;
}
TerminalSpecification_c relInst21931 = (TerminalSpecification_c) baseRoot
.getInstanceList(TerminalSpecification_c.class).get(
new Object[]{m_term_spec_id});
// if there was no local element, check for any global elements
// failing that proceed to check other model roots
if (relInst21931 == null) {
relInst21931 = (TerminalSpecification_c) Ooaofooa
.getDefaultInstance()
.getInstanceList(TerminalSpecification_c.class)
.get(new Object[]{m_term_spec_id});
}
//synchronized
if (relInst21931 != null) {
if (relateProxies || !isProxy()
|| (inSameComponent(this, relInst21931) && !isProxy())) {
relInst21931.relateAcrossR201To(this, notifyChanges);
}
}
baseRoot = modelRoot;
}
public void batchUnrelate(boolean notifyChanges) {
NonRootModelElement inst = null;
// R201
// TS_TSP
inst = IsSupertypeTerminalSpecification;
unrelateAcrossR201From(IsSupertypeTerminalSpecification, notifyChanges);
if (inst != null) {
inst.removeRef();
}
}
public static void batchRelateAll(ModelRoot modelRoot,
boolean notifyChanges, boolean searchAllRoots) {
batchRelateAll(modelRoot, notifyChanges, searchAllRoots, false);
}
public static void batchRelateAll(ModelRoot modelRoot, boolean notifyChanges, boolean searchAllRoots, boolean relateProxies)
{
InstanceList instances = modelRoot.getInstanceList(WhitespaceTerminal_c.class);
synchronized(instances) {
Iterator<NonRootModelElement> cursor = instances.iterator() ;
while (cursor.hasNext())
{
final WhitespaceTerminal_c inst = (WhitespaceTerminal_c)cursor.next() ;
inst.batchRelate(modelRoot, relateProxies, notifyChanges, searchAllRoots );
}
}
}
public static void clearInstances(ModelRoot modelRoot) {
InstanceList instances = modelRoot
.getInstanceList(WhitespaceTerminal_c.class);
synchronized (instances) {
for (int i = instances.size() - 1; i >= 0; i--) {
((NonRootModelElement) instances.get(i)).delete_unchecked();
}
}
}
public static WhitespaceTerminal_c WhitespaceTerminalInstance(
ModelRoot modelRoot, ClassQueryInterface_c test,
boolean loadComponent) {
WhitespaceTerminal_c result = findWhitespaceTerminalInstance(modelRoot,
test, loadComponent);
return result;
}
private static WhitespaceTerminal_c findWhitespaceTerminalInstance(
ModelRoot modelRoot, ClassQueryInterface_c test,
boolean loadComponent) {
InstanceList instances = modelRoot
.getInstanceList(WhitespaceTerminal_c.class);
synchronized (instances) {
for (int i = 0; i < instances.size(); ++i) {
WhitespaceTerminal_c x = (WhitespaceTerminal_c) instances
.get(i);
if (test == null || test.evaluate(x)) {
return x;
}
}
}
return null;
}
public static WhitespaceTerminal_c WhitespaceTerminalInstance(
ModelRoot modelRoot, ClassQueryInterface_c test) {
return WhitespaceTerminalInstance(modelRoot, test, true);
}
public static WhitespaceTerminal_c WhitespaceTerminalInstance(
ModelRoot modelRoot) {
return WhitespaceTerminalInstance(modelRoot, null, true);
}
public static WhitespaceTerminal_c[] WhitespaceTerminalInstances(
ModelRoot modelRoot, ClassQueryInterface_c test,
boolean loadComponent) {
InstanceList instances = modelRoot
.getInstanceList(WhitespaceTerminal_c.class);
Vector matches = new Vector();
synchronized (instances) {
for (int i = 0; i < instances.size(); ++i) {
WhitespaceTerminal_c x = (WhitespaceTerminal_c) instances
.get(i);
if (test == null || test.evaluate(x)) {
matches.add(x);
}
}
if (matches.size() > 0) {
WhitespaceTerminal_c[] ret_set = new WhitespaceTerminal_c[matches
.size()];
matches.copyInto(ret_set);
return ret_set;
} else {
return new WhitespaceTerminal_c[0];
}
}
}
public static WhitespaceTerminal_c[] WhitespaceTerminalInstances(
ModelRoot modelRoot, ClassQueryInterface_c test) {
return WhitespaceTerminalInstances(modelRoot, test, true);
}
public static WhitespaceTerminal_c[] WhitespaceTerminalInstances(
ModelRoot modelRoot) {
return WhitespaceTerminalInstances(modelRoot, null, true);
}
public boolean delete() {
boolean result = super.delete();
boolean delete_error = false;
String errorMsg = "The following relationships were not torn down by the WhiteSpace Terminal.dispose call: ";
TerminalSpecification_c testR201Inst1 = TerminalSpecification_c
.getOneTS_TSPOnR201(this, false);
if (testR201Inst1 != null) {
delete_error = true;
errorMsg = errorMsg + "201 ";
}
if (delete_error == true) {
if (CanvasPlugin.getDefault().isDebugging()) {
Ooaofgraphics.log.println(ILogger.DELETE,
"WhiteSpace Terminal", errorMsg);
} else {
Exception e = new Exception();
e.fillInStackTrace();
CanvasPlugin.logError(errorMsg, e);
}
}
return result;
}
// end declare instance pool
// declare attribute accessors
public boolean isUUID(String attributeName) {
if (attributeName.equals("term_spec_id")) {
return true;
}
return false;
}
// declare attribute accessors
public long getTerm_spec_idLongBased() {
if (IsSupertypeTerminalSpecification != null) {
return IsSupertypeTerminalSpecification.getTerm_spec_idLongBased();
}
return 0;
}
public java.util.UUID getTerm_spec_id() {
if (IsSupertypeTerminalSpecification != null) {
return IsSupertypeTerminalSpecification.getTerm_spec_id();
}
return IdAssigner.NULL_UUID;
}
public boolean hasSuperType() {
return (IsSupertypeTerminalSpecification != null);
}
public java.util.UUID getTerm_spec_idCachedValue() {
if (!IdAssigner.NULL_UUID.equals(m_term_spec_id))
return m_term_spec_id;
else
return getTerm_spec_id();
}
public void setTerm_spec_id(java.util.UUID newValue) {
m_term_spec_id = IdAssigner.preprocessUUID(newValue);
}
// end declare accessors
public static void checkClassConsistency(ModelRoot modelRoot) {
Ooaofooa.log
.println(ILogger.OPERATION, "WhiteSpace Terminal", //$NON-NLS-1$
" Operation entered: WhiteSpace Terminal::checkClassConsistency"); //$NON-NLS-1$
if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == false) { //$NON-NLS-1$
return;
}
WhitespaceTerminal_c[] objs = WhitespaceTerminal_c
.WhitespaceTerminalInstances(modelRoot, null, false);
for (int i = 0; i < objs.length; i++) {
objs[i].checkConsistency();
}
}
public boolean checkConsistency() {
Ooaofooa.log.println(ILogger.OPERATION, "WhiteSpace Terminal", //$NON-NLS-1$
" Operation entered: WhiteSpace Terminal::checkConsistency"); //$NON-NLS-1$
if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == false) { //$NON-NLS-1$
return true;
}
ModelRoot modelRoot = getModelRoot();
boolean retval = true;
class WhitespaceTerminal_c_test21933_c implements ClassQueryInterface_c {
WhitespaceTerminal_c_test21933_c(java.util.UUID p21934) {
m_p21934 = p21934;
}
private java.util.UUID m_p21934;
public boolean evaluate(Object candidate) {
WhitespaceTerminal_c selected = (WhitespaceTerminal_c) candidate;
boolean retval = false;
retval = (selected.getTerm_spec_id().equals(m_p21934));
return retval;
}
}
WhitespaceTerminal_c[] objs21932 = WhitespaceTerminal_c
.WhitespaceTerminalInstances(
Ooaofgraphics.getDefaultInstance(),
new WhitespaceTerminal_c_test21933_c(getTerm_spec_id()));
if (((objs21932.length) == 0)) {
if (CanvasPlugin.getDefault().isDebugging()) {
Ooaofgraphics.log
.println(ILogger.CONSISTENCY,
"WhiteSpace Terminal", //$NON-NLS-1$
"Consistency: Object: WhiteSpace Terminal: Cardinality of an identifier is zero. " //$NON-NLS-1$
+ "Actual Value: " + Integer.toString(objs21932.length)); //$NON-NLS-1$
} else {
Exception e = new Exception();
CanvasPlugin
.logError(
"Consistency: Object: WhiteSpace Terminal: Cardinality of an identifier is zero. " //$NON-NLS-1$
+ "Actual Value: " //$NON-NLS-1$
+ Integer.toString(objs21932.length), e);
}
retval = false;
}
if (((objs21932.length) > 1)) {
if (CanvasPlugin.getDefault().isDebugging()) {
Ooaofgraphics.log
.println(ILogger.CONSISTENCY,
"WhiteSpace Terminal", //$NON-NLS-1$
"Consistency: Object: WhiteSpace Terminal: Cardinality of an identifier is greater than 1. " //$NON-NLS-1$
+ "Actual Value: " //$NON-NLS-1$
+ Integer.toString(objs21932.length)
+ " Term_Spec_ID: " + "Not Printable"); //$NON-NLS-1$
} else {
Exception e = new Exception();
CanvasPlugin
.logError(
"Consistency: Object: WhiteSpace Terminal: Cardinality of an identifier is greater than 1. " //$NON-NLS-1$
+ "Actual Value: " //$NON-NLS-1$
+ Integer.toString(objs21932.length)
+ " Term_Spec_ID: " + "Not Printable", e); //$NON-NLS-1$
}
retval = false;
}
// WhiteSpace Terminal is a subtype in association: rel.Numb = 201
// The supertype class is: Terminal Specification
class TerminalSpecification_c_test21938_c
implements
ClassQueryInterface_c {
TerminalSpecification_c_test21938_c(java.util.UUID p21939) {
m_p21939 = p21939;
}
private java.util.UUID m_p21939;
public boolean evaluate(Object candidate) {
TerminalSpecification_c selected = (TerminalSpecification_c) candidate;
boolean retval = false;
retval = (selected.getTerm_spec_id().equals(m_p21939));
return retval;
}
}
TerminalSpecification_c[] objs21937 = TerminalSpecification_c
.TerminalSpecificationInstances(Ooaofgraphics
.getDefaultInstance(),
new TerminalSpecification_c_test21938_c(
getTerm_spec_id()));
if (((objs21937.length) != 1)) {
if (CanvasPlugin.getDefault().isDebugging()) {
Ooaofgraphics.log
.println(ILogger.CONSISTENCY,
"WhiteSpace Terminal", //$NON-NLS-1$
"Consistency: Object: WhiteSpace Terminal: Association: 201: Cardinality of a supertype is not equal to 1. " //$NON-NLS-1$
+ "Actual Value: " + Integer.toString(objs21937.length)); //$NON-NLS-1$
} else {
Exception e = new Exception();
CanvasPlugin
.logError(
"Consistency: Object: WhiteSpace Terminal: Association: 201: Cardinality of a supertype is not equal to 1. " //$NON-NLS-1$
+ "Actual Value: " //$NON-NLS-1$
+ Integer.toString(objs21937.length), e);
}
retval = false;
}
return retval;
}
// declare transform functions
public boolean Criteriamet(final int p_X, final int p_Y) {
Ooaofgraphics.log.println(ILogger.OPERATION, "WhiteSpace Terminal",
" Operation entered: WhitespaceTerminal::Criteriamet");
final ModelRoot modelRoot = getModelRoot();
Model_c v_model = Model_c.getOneGD_MDOnR207(TerminalSpecification_c
.getOneTS_TSPOnR201(this));
if (((v_model != null))) {
class ModelTool_test21524_c implements ClassQueryInterface_c {
public boolean evaluate(Object candidate) {
ModelTool_c selected = (ModelTool_c) candidate;
return (selected.getActive() == true);
}
}
ModelTool_c v_tool = ModelTool_c.getOneCT_MTLOnR100(v_model,
new ModelTool_test21524_c());
if (((v_tool != null))) {
GraphicalElement_c v_curElem = GraphicalElement_c
.getOneGD_GEOnR16(ElementSpecification_c
.getOneGD_ESOnR103(v_tool));
Diagram_c v_diagram = Diagram_c.getOneDIM_DIAOnR18(v_model);
int v_unScaledX = Gr_c.Unscale((int) (p_X - v_diagram
.getViewportx()));
int v_unScaledY = Gr_c.Unscale((int) (p_Y - v_diagram
.getViewporty()));
GraphicalElement_c[] v_elems = GraphicalElement_c
.getManyGD_GEsOnR1(v_model);
GraphicalElement_c v_elem = null;
for (int i21307 = 0; i21307 < v_elems.length; i21307++) {
v_elem = v_elems[i21307];
if ((v_curElem != v_elem && v_elem.Isover(v_unScaledX,
v_unScaledY))) {
return false;
}
}
}
}
TerminalSpecification_c v_termSpec = TerminalSpecification_c
.getOneTS_TSPOnR201(this);
if (v_termSpec != null) {
v_termSpec.setSatisfied(true);
} else {
Throwable t = new Throwable();
t.fillInStackTrace();
CorePlugin.logError("Attribute write attempted on null instance.",
t);
}
return true;
} // End criteriaMet
// end transform functions
public Object getAdapter(Class adapter) {
Object superAdapter = super.getAdapter(adapter);
if (superAdapter != null) {
return superAdapter;
}
return null;
}
} // end WhiteSpace Terminal
| 32.728302
| 132
| 0.697798
|
f01e9920d3f63624b373a0275248cc7bb5c43e72
| 361
|
package com.taotao.cloud.java.javase.day17.chap17_3;
/**
* 饿汉式单例
* (1)首先创建一个常量
* (2)构造方法改成私有的,类外部不能创建对象
* (3)通过一个公开的方法,返回这个对象
*
* 优点:线程安全,缺点:声明周期太长,浪费空间
* @author shuigedeng
*
*/
public class SingleTon {
private static final SingleTon instance=new SingleTon();
private SingleTon() {}
public static SingleTon getInstance() {
return instance;
}
}
| 19
| 57
| 0.709141
|
647d9575542efdf96459de56939f48bbb1690ee2
| 1,078
|
package com.sequenceiq.cloudbreak.converter.v4.imagecatalog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.requests.ImageCatalogV4Request;
import com.sequenceiq.cloudbreak.converter.AbstractConversionServiceAwareConverter;
import com.sequenceiq.cloudbreak.domain.ImageCatalog;
@Component
public class ImageCatalogToImageCatalogV4RequestConverter
extends AbstractConversionServiceAwareConverter<ImageCatalog, ImageCatalogV4Request> {
private static final Logger LOGGER = LoggerFactory.getLogger(ImageCatalogToImageCatalogV4RequestConverter.class);
@Override
public ImageCatalogV4Request convert(ImageCatalog source) {
ImageCatalogV4Request imageCatalogRequest = new ImageCatalogV4Request();
imageCatalogRequest.setName(source.getName());
imageCatalogRequest.setUrl(source.getImageCatalogUrl());
imageCatalogRequest.setDescription(source.getDescription());
return imageCatalogRequest;
}
}
| 41.461538
| 117
| 0.820037
|
064cfcd89341c0f46edf015d59282bebc6edbfaa
| 52,652
|
/* The following code was generated by JFlex 1.7.0 tweaked for IntelliJ platform */
package org.zig.parser;
import com.intellij.lexer.FlexLexer;
import com.intellij.psi.tree.IElementType;
import static com.intellij.psi.TokenType.BAD_CHARACTER;
import static com.intellij.psi.TokenType.WHITE_SPACE;
import static org.zig.psi.ZigLangTypes.*;
/**
* This class is a scanner generated by
* <a href="http://www.jflex.de/">JFlex</a> 1.7.0
* from the specification file <tt>ZigLangLexer.flex</tt>
*/
public class ZigLangLexer implements FlexLexer {
/** This character denotes the end of file */
public static final int YYEOF = -1;
/** initial size of the lookahead buffer */
private static final int ZZ_BUFFERSIZE = 16384;
/** lexical states */
public static final int YYINITIAL = 0;
/**
* ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
* ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l
* at the beginning of a line
* l is of the form l = 2*k, k a non negative integer
*/
private static final int ZZ_LEXSTATE[] = {
0, 0
};
/**
* Translates characters to character classes
* Chosen bits are [7, 7, 7]
* Total runtime size is 1928 bytes
*/
public static int ZZ_CMAP(int ch) {
return ZZ_CMAP_A[(ZZ_CMAP_Y[ZZ_CMAP_Z[ch>>14]|((ch>>7)&0x7f)]<<7)|(ch&0x7f)];
}
/* The ZZ_CMAP_Z table has 68 entries */
static final char ZZ_CMAP_Z[] = zzUnpackCMap(
"\1\0\103\200");
/* The ZZ_CMAP_Y table has 256 entries */
static final char ZZ_CMAP_Y[] = zzUnpackCMap(
"\1\0\1\1\53\2\1\3\22\2\1\4\37\2\1\3\237\2");
/* The ZZ_CMAP_A table has 640 entries */
static final char ZZ_CMAP_A[] = zzUnpackCMap(
"\11\20\1\40\1\2\3\3\22\20\1\23\1\25\1\32\2\20\1\107\1\103\1\6\1\116\1\117"+
"\1\110\1\106\1\120\1\50\1\46\1\24\1\45\1\42\6\44\2\26\1\121\1\115\1\101\1"+
"\74\1\102\1\114\1\31\4\30\1\51\1\30\11\27\1\47\12\27\1\112\1\33\1\113\1\104"+
"\1\43\1\20\1\61\1\52\1\57\1\70\1\63\1\66\1\75\1\71\1\65\1\27\1\72\1\67\1\64"+
"\1\41\1\53\1\60\1\62\1\56\1\54\1\55\1\35\1\73\1\77\1\34\1\76\1\100\1\36\1"+
"\105\1\37\1\111\1\20\5\10\1\5\12\10\20\15\1\22\37\4\2\0\36\17\1\16\14\13\1"+
"\14\2\13\1\12\3\11\1\7\213\0\1\21\177\0\13\21\35\0\2\1\5\0\1\21\57\0\1\21"+
"\40\0");
/**
* Translates DFA states to action switch labels.
*/
private static final int [] ZZ_ACTION = zzUnpackAction();
private static final String ZZ_ACTION_PACKED_0 =
"\1\0\1\1\1\2\1\1\1\3\1\4\1\5\1\6"+
"\2\1\1\6\1\7\1\10\1\6\1\5\1\11\1\12"+
"\16\6\1\13\1\6\1\14\1\15\1\16\1\17\1\20"+
"\1\21\1\22\1\23\1\24\1\25\1\26\1\27\1\30"+
"\1\31\1\32\1\33\1\34\6\0\1\35\1\36\1\37"+
"\2\0\1\40\2\0\1\41\1\0\4\6\3\0\1\42"+
"\1\43\1\44\1\45\1\46\1\47\1\6\1\50\25\6"+
"\1\51\1\52\6\6\1\53\1\54\1\6\1\55\1\56"+
"\1\57\1\60\1\61\1\62\1\63\1\64\1\65\1\66"+
"\1\67\1\70\1\71\1\72\1\73\1\74\6\0\1\35"+
"\1\75\1\76\2\77\1\0\1\6\1\0\1\41\10\6"+
"\3\5\1\100\1\101\7\6\1\102\10\6\1\103\1\6"+
"\1\104\1\6\1\105\12\6\1\106\4\6\1\107\1\6"+
"\1\110\1\111\1\112\1\113\6\0\5\6\1\114\3\6"+
"\1\0\6\6\1\115\1\116\21\6\1\117\2\6\1\120"+
"\6\6\1\0\1\6\1\121\5\6\1\77\1\122\10\6"+
"\1\123\2\6\1\124\4\6\1\125\1\126\1\6\1\127"+
"\2\6\1\130\2\6\1\131\1\6\1\132\1\6\1\133"+
"\6\6\1\134\1\135\1\6\1\136\1\137\1\6\1\140"+
"\1\141\3\6\1\142\3\6\1\143\1\144\1\6\1\145"+
"\6\6\1\146\1\6\1\147\4\6\1\150\11\6\1\151"+
"\1\6\1\152\1\153\1\154\1\155\1\6\1\156\1\6"+
"\1\157\1\6\1\160\1\6\1\161\1\6\1\162\5\6"+
"\1\163\1\6\1\164\1\165\2\6\1\166";
private static int [] zzUnpackAction() {
int [] result = new int[366];
int offset = 0;
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAction(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/**
* Translates a state to a row index in the transition table
*/
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
private static final String ZZ_ROWMAP_PACKED_0 =
"\0\0\0\122\0\244\0\366\0\u0148\0\u019a\0\u01ec\0\u023e"+
"\0\u0290\0\u02e2\0\u0334\0\122\0\122\0\u0386\0\u03d8\0\u042a"+
"\0\u047c\0\u04ce\0\u0520\0\u0572\0\u05c4\0\u0616\0\u0668\0\u06ba"+
"\0\u070c\0\u075e\0\u07b0\0\u0802\0\u0854\0\u08a6\0\u08f8\0\u094a"+
"\0\u099c\0\u09ee\0\u0a40\0\u0a92\0\u0ae4\0\u0b36\0\u0b88\0\u0bda"+
"\0\u0c2c\0\122\0\122\0\122\0\122\0\122\0\122\0\122"+
"\0\122\0\122\0\u0c7e\0\u0cd0\0\u0d22\0\u0d74\0\u0dc6\0\u0e18"+
"\0\u0e6a\0\122\0\122\0\u0ebc\0\u0f0e\0\u0f60\0\u0fb2\0\u02e2"+
"\0\122\0\u1004\0\u1056\0\u10a8\0\u10fa\0\u114c\0\u119e\0\u11f0"+
"\0\u1242\0\u1294\0\122\0\122\0\122\0\122\0\u12e6\0\u1338"+
"\0\u138a\0\u13dc\0\u142e\0\u1480\0\u14d2\0\u1524\0\u1576\0\u15c8"+
"\0\u161a\0\u166c\0\u16be\0\u1710\0\u1762\0\u17b4\0\u1806\0\u1858"+
"\0\u18aa\0\u18fc\0\u194e\0\u19a0\0\u19f2\0\u1a44\0\u023e\0\u023e"+
"\0\u1a96\0\u1ae8\0\u1b3a\0\u1b8c\0\u1bde\0\u1c30\0\122\0\122"+
"\0\u1c82\0\122\0\u1cd4\0\122\0\u1d26\0\122\0\122\0\122"+
"\0\122\0\122\0\122\0\u1d78\0\122\0\122\0\u1dca\0\122"+
"\0\122\0\u1e1c\0\u1e6e\0\u1ec0\0\u1f12\0\u1f64\0\u1fb6\0\u2008"+
"\0\u205a\0\u20ac\0\u20fe\0\u2150\0\u21a2\0\122\0\u21f4\0\u02e2"+
"\0\u2246\0\u2298\0\u22ea\0\u233c\0\u238e\0\u23e0\0\u2432\0\u2484"+
"\0\u24d6\0\u2528\0\u257a\0\122\0\122\0\u25cc\0\u261e\0\u2670"+
"\0\u26c2\0\u2714\0\u2766\0\u27b8\0\u023e\0\u280a\0\u285c\0\u28ae"+
"\0\u2900\0\u2952\0\u29a4\0\u29f6\0\u2a48\0\u023e\0\u2a9a\0\u023e"+
"\0\u2aec\0\u023e\0\u2b3e\0\u2b90\0\u2be2\0\u2c34\0\u2c86\0\u2cd8"+
"\0\u2d2a\0\u2d7c\0\u2dce\0\u2e20\0\u023e\0\u2e72\0\u2ec4\0\u2f16"+
"\0\u2f68\0\u023e\0\u2fba\0\122\0\122\0\122\0\122\0\u300c"+
"\0\u305e\0\u30b0\0\u3102\0\u3154\0\u31a6\0\u0fb2\0\u31f8\0\u324a"+
"\0\u329c\0\u32ee\0\u023e\0\u3340\0\u3392\0\u33e4\0\u3436\0\u3488"+
"\0\u34da\0\u352c\0\u357e\0\u35d0\0\u3622\0\u023e\0\u023e\0\u3674"+
"\0\u36c6\0\u3718\0\u376a\0\u37bc\0\u380e\0\u3860\0\u38b2\0\u3904"+
"\0\u3956\0\u39a8\0\u39fa\0\u3a4c\0\u3a9e\0\u3af0\0\u3b42\0\u3b94"+
"\0\u023e\0\u3be6\0\u3c38\0\u023e\0\u3c8a\0\u3cdc\0\u3d2e\0\u3d80"+
"\0\u3dd2\0\u3e24\0\u3e76\0\u3ec8\0\u023e\0\u3f1a\0\u3f6c\0\u3fbe"+
"\0\u4010\0\u4062\0\u40b4\0\u023e\0\u4106\0\u4158\0\u41aa\0\u41fc"+
"\0\u424e\0\u42a0\0\u42f2\0\u4344\0\u023e\0\u4396\0\u43e8\0\u023e"+
"\0\u443a\0\u448c\0\u44de\0\u4530\0\u023e\0\u023e\0\u4582\0\u023e"+
"\0\u45d4\0\u4626\0\u023e\0\u4678\0\u46ca\0\u023e\0\u471c\0\u023e"+
"\0\u476e\0\u023e\0\u47c0\0\u4812\0\u4864\0\u48b6\0\u4908\0\u495a"+
"\0\u023e\0\u023e\0\u49ac\0\u023e\0\u023e\0\u49fe\0\u023e\0\u023e"+
"\0\u4a50\0\u4aa2\0\u4af4\0\u023e\0\u4b46\0\u4b98\0\u4bea\0\u023e"+
"\0\u023e\0\u4c3c\0\u023e\0\u4c8e\0\u4ce0\0\u4d32\0\u4d84\0\u4dd6"+
"\0\u4e28\0\u023e\0\u4e7a\0\u023e\0\u4ecc\0\u4f1e\0\u4f70\0\u4fc2"+
"\0\u023e\0\u5014\0\u5066\0\u50b8\0\u510a\0\u515c\0\u51ae\0\u5200"+
"\0\u5252\0\u52a4\0\u023e\0\u52f6\0\u023e\0\u023e\0\u023e\0\u023e"+
"\0\u5348\0\u023e\0\u539a\0\u023e\0\u53ec\0\u023e\0\u543e\0\u023e"+
"\0\u5490\0\u023e\0\u54e2\0\u5534\0\u5586\0\u55d8\0\u562a\0\u023e"+
"\0\u567c\0\u023e\0\u023e\0\u56ce\0\u5720\0\u023e";
private static int [] zzUnpackRowMap() {
int [] result = new int[366];
int offset = 0;
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
return result;
}
private static int zzUnpackRowMap(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int high = packed.charAt(i++) << 16;
result[j++] = high | packed.charAt(i++);
}
return j;
}
/**
* The transition table of the DFA
*/
private static final int [] ZZ_TRANS = zzUnpackTrans();
private static final String ZZ_TRANS_PACKED_0 =
"\1\2\3\3\1\2\1\3\1\4\12\2\3\3\1\5"+
"\1\6\1\7\2\10\1\11\1\12\1\2\1\10\1\13"+
"\1\14\1\15\1\3\1\16\1\7\1\10\1\7\1\17"+
"\1\20\1\10\1\21\1\10\1\22\1\23\1\24\1\25"+
"\1\26\1\27\1\30\1\31\1\10\1\32\1\10\1\33"+
"\1\34\1\35\1\36\2\10\1\37\1\40\2\10\1\41"+
"\1\10\1\42\1\43\1\44\1\45\1\46\1\47\1\50"+
"\1\51\1\52\1\53\1\54\1\55\1\56\1\57\1\60"+
"\1\61\1\62\123\0\3\3\1\0\1\3\13\0\3\3"+
"\14\0\1\3\64\0\1\63\2\0\1\64\2\0\1\65"+
"\1\0\1\66\3\0\1\67\1\63\2\0\10\63\1\70"+
"\66\63\24\0\1\71\47\0\1\72\121\0\1\73\53\0"+
"\1\7\13\0\4\7\1\74\2\0\1\75\11\0\1\75"+
"\64\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\23\10\1\0\4\10\50\0\2\76\1\0\1\77"+
"\1\0\2\76\3\0\1\76\1\0\1\76\3\0\1\76"+
"\1\0\23\76\1\0\4\76\21\0\2\100\1\0\27\100"+
"\1\101\1\102\66\100\26\0\3\10\3\0\2\10\3\0"+
"\1\103\4\10\1\0\1\10\1\0\3\10\1\104\17\10"+
"\1\0\4\10\47\0\3\10\3\0\1\10\1\105\3\0"+
"\5\10\1\0\1\10\1\0\2\10\1\106\20\10\1\0"+
"\4\10\47\0\1\7\5\0\1\107\5\0\4\7\1\74"+
"\2\0\1\75\1\110\1\111\7\0\1\75\104\0\1\112"+
"\41\0\1\113\3\0\1\114\101\0\1\115\5\0\1\116"+
"\4\0\1\117\40\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\5\10\1\120\15\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\5\10\1\121\1\10\1\122\13\10\1\0\4\10"+
"\47\0\3\10\3\0\1\10\1\123\3\0\5\10\1\0"+
"\1\10\1\0\4\10\1\124\16\10\1\0\2\10\1\125"+
"\1\10\47\0\3\10\3\0\2\10\3\0\5\10\1\0"+
"\1\10\1\0\5\10\1\126\4\10\1\127\5\10\1\130"+
"\2\10\1\0\4\10\47\0\3\10\3\0\2\10\3\0"+
"\5\10\1\0\1\10\1\0\12\10\1\131\10\10\1\0"+
"\4\10\47\0\3\10\3\0\2\10\3\0\5\10\1\0"+
"\1\10\1\0\2\10\1\132\5\10\1\133\12\10\1\0"+
"\4\10\47\0\3\10\3\0\1\10\1\134\3\0\5\10"+
"\1\0\1\10\1\0\10\10\1\135\12\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\1\136\4\10\1\0"+
"\1\10\1\0\3\10\1\137\12\10\1\140\4\10\1\0"+
"\2\10\1\141\1\10\47\0\3\10\3\0\1\142\1\10"+
"\3\0\1\143\4\10\1\0\1\10\1\0\5\10\1\144"+
"\10\10\1\145\4\10\1\0\4\10\47\0\3\10\3\0"+
"\2\10\3\0\1\146\4\10\1\0\1\10\1\0\15\10"+
"\1\147\5\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\1\150\4\10\1\0\1\10\1\0\2\10\1\151"+
"\5\10\1\152\12\10\1\0\4\10\47\0\3\10\3\0"+
"\2\10\3\0\5\10\1\0\1\10\1\0\14\10\1\153"+
"\6\10\1\0\4\10\47\0\3\10\3\0\2\10\3\0"+
"\5\10\1\0\1\10\1\0\12\10\1\154\10\10\1\0"+
"\4\10\47\0\3\10\3\0\2\10\3\0\5\10\1\0"+
"\1\10\1\0\2\10\1\155\5\10\1\156\12\10\1\0"+
"\4\10\115\0\1\157\5\0\1\160\45\0\3\10\3\0"+
"\2\10\3\0\5\10\1\0\1\10\1\0\20\10\1\161"+
"\2\10\1\0\4\10\115\0\1\162\4\0\1\163\114\0"+
"\1\164\5\0\1\165\113\0\1\166\121\0\1\167\121\0"+
"\1\170\10\0\1\171\110\0\1\172\11\0\1\173\1\174"+
"\106\0\1\175\121\0\1\176\12\0\1\177\1\200\17\0"+
"\1\201\122\0\1\202\2\0\1\203\1\0\1\204\1\0"+
"\1\205\107\0\2\66\2\0\1\66\4\0\1\66\4\0"+
"\1\66\103\0\2\67\2\0\1\67\4\0\1\67\4\0"+
"\1\67\103\0\2\63\2\0\1\63\4\0\1\63\4\0"+
"\1\63\105\0\1\63\23\0\1\63\1\0\1\206\1\207"+
"\2\0\2\63\14\0\1\63\43\0\2\210\1\0\21\210"+
"\1\211\1\212\74\210\26\0\1\213\13\0\1\213\1\0"+
"\2\213\102\0\1\214\13\0\1\214\1\0\2\214\2\0"+
"\1\215\35\0\1\215\41\0\3\76\3\0\2\76\3\0"+
"\5\76\1\0\1\76\1\0\23\76\1\0\4\76\21\0"+
"\2\77\1\0\27\77\1\216\1\217\66\77\2\100\1\0"+
"\27\100\1\220\1\102\66\100\26\0\3\10\3\0\2\10"+
"\3\0\5\10\1\0\1\10\1\0\5\10\1\221\6\10"+
"\1\222\2\10\1\223\3\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\5\10\1\0\1\10\1\0\14\10"+
"\1\224\6\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\5\10\1\0\1\10\1\0\16\10\1\225\4\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\3\10\1\226\4\10\1\227\3\10"+
"\1\230\6\10\1\0\4\10\47\0\1\231\1\0\1\231"+
"\11\0\1\231\1\0\2\231\3\0\2\231\4\0\1\231"+
"\1\0\1\231\1\0\1\231\2\0\1\231\1\0\1\231"+
"\73\0\1\232\2\0\1\232\116\0\1\233\1\0\2\233"+
"\122\0\1\234\147\0\1\235\53\0\3\10\3\0\2\10"+
"\3\0\5\10\1\0\1\10\1\0\12\10\1\236\10\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\12\10\1\237\10\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\10\10\1\240\12\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\5\10\1\0\1\10\1\0\3\10"+
"\1\241\17\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\5\10\1\0\1\10\1\0\5\10\1\242\15\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\14\10\1\243\6\10\1\0\4\10"+
"\47\0\3\10\3\0\1\10\1\244\3\0\5\10\1\0"+
"\1\10\1\0\23\10\1\0\1\10\1\245\2\10\47\0"+
"\3\10\3\0\2\10\3\0\5\10\1\0\1\10\1\0"+
"\3\10\1\246\17\10\1\0\4\10\47\0\3\10\3\0"+
"\2\10\3\0\5\10\1\0\1\10\1\0\5\10\1\247"+
"\15\10\1\0\4\10\47\0\3\10\3\0\2\10\3\0"+
"\5\10\1\0\1\10\1\0\3\10\1\250\1\251\16\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\1\252"+
"\4\10\1\0\1\10\1\0\13\10\1\253\7\10\1\0"+
"\4\10\47\0\3\10\3\0\2\10\3\0\5\10\1\0"+
"\1\10\1\0\4\10\1\254\11\10\1\255\4\10\1\0"+
"\4\10\47\0\3\10\3\0\2\10\3\0\5\10\1\0"+
"\1\10\1\0\1\10\1\256\21\10\1\0\4\10\47\0"+
"\3\10\3\0\2\10\3\0\5\10\1\0\1\10\1\0"+
"\6\10\1\257\14\10\1\0\4\10\47\0\3\10\3\0"+
"\2\10\3\0\5\10\1\0\1\10\1\0\17\10\1\260"+
"\3\10\1\0\1\10\1\261\2\10\47\0\3\10\3\0"+
"\2\10\3\0\5\10\1\0\1\10\1\0\13\10\1\262"+
"\7\10\1\0\1\10\1\263\2\10\47\0\3\10\3\0"+
"\2\10\3\0\5\10\1\0\1\10\1\0\14\10\1\264"+
"\1\10\1\265\4\10\1\0\4\10\47\0\3\10\3\0"+
"\2\10\3\0\5\10\1\0\1\10\1\0\10\10\1\266"+
"\12\10\1\0\4\10\47\0\3\10\3\0\2\10\3\0"+
"\5\10\1\0\1\10\1\0\4\10\1\267\2\10\1\270"+
"\13\10\1\0\4\10\47\0\3\10\3\0\1\10\1\271"+
"\3\0\5\10\1\0\1\10\1\0\23\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\5\10\1\272\15\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\5\10\1\0\1\10\1\0\3\10"+
"\1\273\17\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\5\10\1\0\1\10\1\0\16\10\1\274\4\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\5\10\1\275\15\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\16\10\1\276\4\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\1\277\4\10\1\0\1\10\1\0"+
"\23\10\1\0\4\10\47\0\3\10\3\0\2\10\3\0"+
"\5\10\1\0\1\10\1\0\15\10\1\300\5\10\1\0"+
"\4\10\47\0\3\10\3\0\2\10\3\0\5\10\1\0"+
"\1\10\1\0\16\10\1\301\4\10\1\0\4\10\47\0"+
"\3\10\3\0\2\10\3\0\5\10\1\0\1\10\1\0"+
"\5\10\1\302\15\10\1\0\4\10\47\0\3\10\3\0"+
"\2\10\3\0\5\10\1\0\1\10\1\0\14\10\1\303"+
"\6\10\1\0\4\10\115\0\1\304\121\0\1\305\121\0"+
"\1\306\121\0\1\307\33\0\1\310\121\0\1\311\121\0"+
"\1\312\121\0\1\313\141\0\1\314\1\0\1\314\11\0"+
"\1\314\1\0\2\314\3\0\2\314\4\0\1\314\1\0"+
"\1\314\1\0\1\314\2\0\1\314\1\0\1\314\67\0"+
"\1\315\63\0\2\210\1\0\117\210\1\211\1\210\1\0"+
"\1\210\1\211\1\210\114\211\1\212\1\210\1\0\1\210"+
"\1\212\1\210\114\212\26\0\1\213\13\0\4\213\3\0"+
"\1\75\11\0\1\75\64\0\1\214\13\0\4\214\102\0"+
"\1\214\13\0\1\214\1\0\2\214\54\0\2\77\1\0"+
"\27\77\1\316\1\217\66\77\26\0\3\10\3\0\2\10"+
"\3\0\5\10\1\0\1\10\1\0\12\10\1\317\10\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\2\10\1\320\20\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\12\10\1\321\10\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\1\322\4\10\1\0\1\10\1\0"+
"\23\10\1\0\4\10\47\0\3\10\3\0\2\10\3\0"+
"\5\10\1\0\1\10\1\0\16\10\1\323\4\10\1\0"+
"\4\10\47\0\3\10\3\0\1\10\1\324\3\0\5\10"+
"\1\0\1\10\1\0\23\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\5\10\1\0\1\10\1\0\16\10"+
"\1\325\4\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\1\326\4\10\1\0\1\10\1\0\23\10\1\0"+
"\4\10\47\0\1\231\1\0\1\231\11\0\4\231\1\327"+
"\1\75\1\0\2\231\4\0\1\231\1\75\1\231\1\0"+
"\1\231\2\0\1\231\1\0\1\231\73\0\2\232\1\0"+
"\1\232\116\0\4\233\102\0\3\10\3\0\2\10\3\0"+
"\5\10\1\0\1\10\1\0\10\10\1\330\12\10\1\0"+
"\4\10\47\0\3\10\3\0\2\10\3\0\5\10\1\0"+
"\1\10\1\0\16\10\1\331\4\10\1\0\4\10\47\0"+
"\3\10\3\0\2\10\3\0\5\10\1\0\1\10\1\0"+
"\11\10\1\332\11\10\1\0\4\10\47\0\3\10\3\0"+
"\2\10\3\0\5\10\1\0\1\10\1\0\7\10\1\333"+
"\13\10\1\0\4\10\47\0\3\10\3\0\1\10\1\334"+
"\3\0\5\10\1\0\1\10\1\0\23\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\4\10\1\335\16\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\5\10\1\0\1\10\1\0\12\10"+
"\1\336\10\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\5\10\1\0\1\10\1\0\4\10\1\337\16\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\12\10\1\340\10\10\1\0\4\10"+
"\47\0\3\10\3\0\1\10\1\341\3\0\5\10\1\0"+
"\1\10\1\0\23\10\1\0\4\10\47\0\3\10\3\0"+
"\1\10\1\342\3\0\5\10\1\0\1\10\1\0\23\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\3\10\1\343\1\344\16\10\1\0"+
"\4\10\47\0\3\10\3\0\2\10\3\0\5\10\1\0"+
"\1\10\1\0\7\10\1\345\13\10\1\0\4\10\47\0"+
"\3\10\3\0\2\10\3\0\5\10\1\0\1\10\1\0"+
"\6\10\1\346\14\10\1\0\4\10\47\0\3\10\3\0"+
"\2\10\3\0\5\10\1\0\1\10\1\0\16\10\1\347"+
"\4\10\1\0\4\10\47\0\3\10\3\0\2\10\3\0"+
"\5\10\1\0\1\10\1\0\21\10\1\350\1\10\1\0"+
"\4\10\47\0\3\10\3\0\2\10\3\0\5\10\1\0"+
"\1\10\1\0\4\10\1\351\10\10\1\352\5\10\1\0"+
"\4\10\47\0\3\10\3\0\2\10\3\0\1\353\4\10"+
"\1\0\1\10\1\0\23\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\5\10\1\0\1\10\1\0\23\10"+
"\1\0\1\354\3\10\47\0\3\10\3\0\2\10\3\0"+
"\5\10\1\0\1\10\1\0\2\10\1\355\20\10\1\0"+
"\4\10\47\0\3\10\3\0\2\10\3\0\5\10\1\0"+
"\1\10\1\0\14\10\1\356\6\10\1\0\4\10\47\0"+
"\3\10\3\0\2\10\3\0\5\10\1\0\1\10\1\0"+
"\12\10\1\357\10\10\1\0\4\10\47\0\3\10\3\0"+
"\2\10\3\0\5\10\1\0\1\10\1\0\2\10\1\360"+
"\20\10\1\0\4\10\47\0\3\10\3\0\2\10\3\0"+
"\5\10\1\0\1\10\1\0\13\10\1\361\7\10\1\0"+
"\4\10\47\0\3\10\3\0\2\10\3\0\5\10\1\0"+
"\1\10\1\0\2\10\1\362\14\10\1\363\3\10\1\0"+
"\4\10\47\0\3\10\3\0\2\10\3\0\5\10\1\0"+
"\1\10\1\0\12\10\1\364\10\10\1\0\4\10\47\0"+
"\3\10\3\0\2\10\3\0\5\10\1\0\1\10\1\0"+
"\14\10\1\365\6\10\1\0\4\10\47\0\3\10\3\0"+
"\2\10\3\0\5\10\1\0\1\10\1\0\3\10\1\366"+
"\17\10\1\0\4\10\47\0\3\10\3\0\2\10\3\0"+
"\5\10\1\0\1\10\1\0\21\10\1\367\1\10\1\0"+
"\4\10\47\0\3\10\3\0\2\10\3\0\5\10\1\0"+
"\1\10\1\0\12\10\1\370\10\10\1\0\4\10\47\0"+
"\3\10\3\0\2\10\3\0\5\10\1\0\1\10\1\0"+
"\10\10\1\371\12\10\1\0\4\10\47\0\3\10\3\0"+
"\2\10\3\0\5\10\1\0\1\10\1\0\16\10\1\372"+
"\4\10\1\0\4\10\26\0\1\66\2\0\1\66\115\0"+
"\1\66\10\0\1\66\4\0\1\66\104\0\1\67\2\0"+
"\1\67\4\0\1\67\110\0\1\67\15\0\1\67\125\0"+
"\1\63\1\0\1\63\11\0\1\63\1\0\2\63\3\0"+
"\2\63\4\0\1\63\1\0\1\63\1\0\1\63\2\0"+
"\1\63\1\0\1\63\57\0\1\373\1\0\1\373\11\0"+
"\1\373\1\0\2\373\3\0\2\373\4\0\1\373\1\0"+
"\1\373\1\0\1\373\2\0\1\373\1\0\1\373\57\0"+
"\3\10\3\0\2\10\3\0\5\10\1\0\1\10\1\0"+
"\10\10\1\374\12\10\1\0\4\10\47\0\3\10\3\0"+
"\2\10\3\0\1\375\4\10\1\0\1\10\1\0\23\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\15\10\1\376\5\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\23\10\1\0\1\377\3\10\47\0\3\10\3\0"+
"\2\10\3\0\5\10\1\0\1\10\1\0\3\10\1\u0100"+
"\17\10\1\0\4\10\47\0\3\10\3\0\2\10\3\0"+
"\5\10\1\0\1\10\1\0\14\10\1\u0101\6\10\1\0"+
"\4\10\47\0\3\10\3\0\2\10\3\0\5\10\1\0"+
"\1\10\1\0\16\10\1\u0102\4\10\1\0\4\10\47\0"+
"\1\u0103\1\0\1\u0103\11\0\1\u0103\1\0\2\u0103\3\0"+
"\2\u0103\4\0\1\u0103\1\0\1\u0103\1\0\1\u0103\2\0"+
"\1\u0103\1\0\1\u0103\57\0\3\10\3\0\2\10\3\0"+
"\5\10\1\0\1\10\1\0\21\10\1\u0104\1\10\1\0"+
"\4\10\47\0\3\10\3\0\2\10\3\0\5\10\1\0"+
"\1\10\1\0\3\10\1\u0105\17\10\1\0\4\10\47\0"+
"\3\10\3\0\1\10\1\u0106\3\0\5\10\1\0\1\10"+
"\1\0\23\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\5\10\1\0\1\10\1\0\12\10\1\u0107\10\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\6\10\1\u0108\14\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\6\10\1\u0109\14\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\5\10\1\0\1\10\1\0\10\10"+
"\1\u010a\12\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\5\10\1\0\1\10\1\0\13\10\1\u010b\7\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\5\10\1\u010c\15\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\4\10\1\u010d\16\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\5\10\1\0\1\10\1\0\14\10"+
"\1\u010e\6\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\5\10\1\0\1\10\1\0\4\10\1\u010f\16\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\20\10\1\u0110\2\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\6\10\1\u0111\14\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\5\10\1\0\1\10\1\0\12\10"+
"\1\u0112\10\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\5\10\1\0\1\10\1\0\23\10\1\0\1\10"+
"\1\u0113\2\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\5\10\1\u0114\15\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\6\10\1\u0115\14\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\1\u0116\4\10\1\0\1\10\1\0"+
"\23\10\1\0\4\10\47\0\3\10\3\0\2\10\3\0"+
"\5\10\1\0\1\10\1\0\23\10\1\0\2\10\1\u0117"+
"\1\10\47\0\3\10\3\0\2\10\3\0\5\10\1\0"+
"\1\10\1\0\4\10\1\u0118\16\10\1\0\4\10\47\0"+
"\3\10\3\0\2\10\3\0\5\10\1\0\1\10\1\0"+
"\5\10\1\u0119\15\10\1\0\4\10\47\0\3\10\3\0"+
"\2\10\3\0\5\10\1\0\1\10\1\0\5\10\1\u011a"+
"\15\10\1\0\4\10\47\0\3\10\3\0\2\10\3\0"+
"\5\10\1\0\1\10\1\0\5\10\1\u011b\15\10\1\0"+
"\4\10\47\0\3\10\3\0\2\10\3\0\5\10\1\0"+
"\1\10\1\0\12\10\1\u011c\10\10\1\0\4\10\47\0"+
"\3\10\3\0\2\10\3\0\1\u011d\4\10\1\0\1\10"+
"\1\0\23\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\5\10\1\0\1\10\1\0\12\10\1\u011e\10\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\3\10\1\u011f\17\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\5\10\1\u0120\15\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\5\10\1\0\1\10\1\0\4\10"+
"\1\u0121\16\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\5\10\1\0\1\10\1\0\12\10\1\u0122\10\10"+
"\1\0\4\10\47\0\1\373\1\0\1\373\6\0\1\63"+
"\2\0\1\373\1\0\2\373\3\0\2\373\4\0\1\373"+
"\1\0\1\373\1\0\1\373\2\0\1\373\1\0\1\373"+
"\57\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\6\10\1\u0123\14\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\5\10\1\0\1\10\1\0\14\10"+
"\1\u0124\6\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\1\u0125\4\10\1\0\1\10\1\0\23\10\1\0"+
"\4\10\47\0\3\10\3\0\2\10\3\0\5\10\1\0"+
"\1\10\1\0\7\10\1\u0126\13\10\1\0\4\10\47\0"+
"\3\10\3\0\2\10\3\0\5\10\1\0\1\10\1\0"+
"\10\10\1\u0127\12\10\1\0\4\10\47\0\3\10\3\0"+
"\2\10\3\0\5\10\1\0\1\10\1\0\14\10\1\u0128"+
"\6\10\1\0\4\10\47\0\1\u0103\1\0\1\u0103\11\0"+
"\4\u0103\1\0\1\75\1\0\2\u0103\4\0\1\u0103\1\75"+
"\1\u0103\1\0\1\u0103\2\0\1\u0103\1\0\1\u0103\57\0"+
"\3\10\3\0\2\10\3\0\5\10\1\0\1\10\1\0"+
"\12\10\1\u0129\10\10\1\0\4\10\47\0\3\10\3\0"+
"\2\10\3\0\5\10\1\0\1\10\1\0\12\10\1\u012a"+
"\10\10\1\0\4\10\47\0\3\10\3\0\2\10\3\0"+
"\1\u012b\4\10\1\0\1\10\1\0\23\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\4\10\1\u012c\16\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\5\10\1\0\1\10\1\0\20\10"+
"\1\u012d\2\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\5\10\1\0\1\10\1\0\17\10\1\u012e\3\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\12\10\1\u012f\10\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\1\u0130\4\10\1\0"+
"\1\10\1\0\23\10\1\0\4\10\47\0\3\10\3\0"+
"\2\10\3\0\1\u0131\4\10\1\0\1\10\1\0\23\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\14\10\1\u0132\6\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\2\10\1\u0133\20\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\5\10\1\0\1\10\1\0\17\10"+
"\1\u0134\3\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\5\10\1\0\1\10\1\0\7\10\1\u0135\13\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\10\10\1\u0136\12\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\23\10\1\0\3\10\1\u0137\47\0\3\10\3\0"+
"\2\10\3\0\1\u0138\4\10\1\0\1\10\1\0\23\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\4\10\1\u0139\16\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\15\10\1\u013a\5\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\5\10\1\0\1\10\1\0\12\10"+
"\1\u013b\10\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\5\10\1\0\1\10\1\0\12\10\1\u013c\10\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\14\10\1\u013d\6\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\20\10\1\u013e\2\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\1\u013f\4\10\1\0\1\10\1\0"+
"\23\10\1\0\4\10\47\0\3\10\3\0\2\10\3\0"+
"\5\10\1\0\1\10\1\0\10\10\1\u0140\12\10\1\0"+
"\4\10\47\0\3\10\3\0\2\10\3\0\5\10\1\0"+
"\1\10\1\0\12\10\1\u0141\10\10\1\0\4\10\47\0"+
"\3\10\3\0\2\10\3\0\5\10\1\0\1\10\1\0"+
"\3\10\1\u0142\17\10\1\0\4\10\47\0\3\10\3\0"+
"\2\10\3\0\1\u0143\4\10\1\0\1\10\1\0\23\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\17\10\1\u0144\3\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\16\10\1\u0145\4\10\1\0\4\10\47\0\3\10"+
"\3\0\1\10\1\u0146\3\0\5\10\1\0\1\10\1\0"+
"\23\10\1\0\4\10\47\0\3\10\3\0\2\10\3\0"+
"\5\10\1\0\1\10\1\0\13\10\1\u0147\7\10\1\0"+
"\4\10\47\0\3\10\3\0\2\10\3\0\1\u0148\4\10"+
"\1\0\1\10\1\0\23\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\5\10\1\0\1\10\1\0\12\10"+
"\1\u0149\10\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\5\10\1\0\1\10\1\0\13\10\1\u014a\7\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\12\10\1\u014b\10\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\12\10\1\u014c\10\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\5\10\1\0\1\10\1\0\6\10"+
"\1\u014d\14\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\5\10\1\0\1\10\1\0\16\10\1\u014e\4\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\10\10\1\u014f\12\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\12\10\1\u0150\10\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\5\10\1\0\1\10\1\0\13\10"+
"\1\u0151\7\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\1\u0152\4\10\1\0\1\10\1\0\23\10\1\0"+
"\4\10\47\0\3\10\3\0\2\10\3\0\5\10\1\0"+
"\1\10\1\0\12\10\1\u0153\10\10\1\0\4\10\47\0"+
"\3\10\3\0\2\10\3\0\5\10\1\0\1\10\1\0"+
"\2\10\1\u0154\20\10\1\0\4\10\47\0\3\10\3\0"+
"\2\10\3\0\5\10\1\0\1\10\1\0\12\10\1\u0155"+
"\10\10\1\0\4\10\47\0\3\10\3\0\2\10\3\0"+
"\5\10\1\0\1\10\1\0\12\10\1\u0156\10\10\1\0"+
"\4\10\47\0\3\10\3\0\2\10\3\0\5\10\1\0"+
"\1\10\1\0\22\10\1\u0157\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\5\10\1\0\1\10\1\0\12\10"+
"\1\u0158\10\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\5\10\1\0\1\10\1\0\5\10\1\u0159\15\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\5\10\1\u015a\15\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\4\10\1\u015b\16\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\5\10\1\0\1\10\1\0\12\10"+
"\1\u015c\10\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\5\10\1\0\1\10\1\0\1\10\1\u015d\21\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\17\10\1\u015e\3\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\12\10\1\u015f\10\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\5\10\1\0\1\10\1\0\17\10"+
"\1\u0160\3\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\5\10\1\0\1\10\1\0\6\10\1\u0161\14\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\2\10\1\u0162\20\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\14\10\1\u0163\6\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\5\10\1\0\1\10\1\0\16\10"+
"\1\u0164\4\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\5\10\1\0\1\10\1\0\3\10\1\u0165\17\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\10\10\1\u0166\12\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\5\10\1\0\1\10"+
"\1\0\2\10\1\u0167\20\10\1\0\4\10\47\0\3\10"+
"\3\0\2\10\3\0\5\10\1\0\1\10\1\0\12\10"+
"\1\u0168\10\10\1\0\4\10\47\0\3\10\3\0\2\10"+
"\3\0\5\10\1\0\1\10\1\0\7\10\1\u0169\13\10"+
"\1\0\4\10\47\0\3\10\3\0\2\10\3\0\5\10"+
"\1\0\1\10\1\0\16\10\1\u016a\4\10\1\0\4\10"+
"\47\0\3\10\3\0\2\10\3\0\1\u016b\4\10\1\0"+
"\1\10\1\0\23\10\1\0\4\10\47\0\3\10\3\0"+
"\2\10\3\0\5\10\1\0\1\10\1\0\10\10\1\u016c"+
"\12\10\1\0\4\10\47\0\3\10\3\0\2\10\3\0"+
"\5\10\1\0\1\10\1\0\6\10\1\u016d\14\10\1\0"+
"\4\10\47\0\3\10\3\0\2\10\3\0\5\10\1\0"+
"\1\10\1\0\12\10\1\u016e\10\10\1\0\4\10\21\0";
private static int [] zzUnpackTrans() {
int [] result = new int[22386];
int offset = 0;
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
return result;
}
private static int zzUnpackTrans(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
value--;
do result[j++] = value; while (--count > 0);
}
return j;
}
/* error codes */
private static final int ZZ_UNKNOWN_ERROR = 0;
private static final int ZZ_NO_MATCH = 1;
private static final int ZZ_PUSHBACK_2BIG = 2;
/* error messages for the codes above */
private static final String[] ZZ_ERROR_MSG = {
"Unknown internal scanner error",
"Error: could not match input",
"Error: pushback value was too large"
};
/**
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
*/
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
private static final String ZZ_ATTRIBUTE_PACKED_0 =
"\1\0\1\11\11\1\2\11\34\1\11\11\6\0\1\1"+
"\2\11\2\0\1\1\2\0\1\11\1\0\4\1\3\0"+
"\1\1\4\11\40\1\2\11\1\1\1\11\1\1\1\11"+
"\1\1\6\11\1\1\2\11\1\1\2\11\6\0\5\1"+
"\1\0\1\11\1\0\14\1\2\11\46\1\4\11\6\0"+
"\11\1\1\0\43\1\1\0\163\1";
private static int [] zzUnpackAttribute() {
int [] result = new int[366];
int offset = 0;
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAttribute(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/** the input device */
private java.io.Reader zzReader;
/** the current state of the DFA */
private int zzState;
/** the current lexical state */
private int zzLexicalState = YYINITIAL;
/** this buffer contains the current text to be matched and is
the source of the yytext() string */
private CharSequence zzBuffer = "";
/** the textposition at the last accepting state */
private int zzMarkedPos;
/** the current text position in the buffer */
private int zzCurrentPos;
/** startRead marks the beginning of the yytext() string in the buffer */
private int zzStartRead;
/** endRead marks the last character in the buffer, that has been read
from input */
private int zzEndRead;
/**
* zzAtBOL == true <=> the scanner is currently at the beginning of a line
*/
private boolean zzAtBOL = true;
/** zzAtEOF == true <=> the scanner is at the EOF */
private boolean zzAtEOF;
/** denotes if the user-EOF-code has already been executed */
private boolean zzEOFDone;
/* user code: */
public ZigLangLexer() {
this((java.io.Reader)null);
}
/**
* Creates a new scanner
*
* @param in the java.io.Reader to read input from.
*/
public ZigLangLexer(java.io.Reader in) {
this.zzReader = in;
}
/**
* Unpacks the compressed character translation table.
*
* @param packed the packed character translation table
* @return the unpacked character translation table
*/
private static char [] zzUnpackCMap(String packed) {
int size = 0;
for (int i = 0, length = packed.length(); i < length; i += 2) {
size += packed.charAt(i);
}
char[] map = new char[size];
int i = 0; /* index in packed string */
int j = 0; /* index in unpacked array */
while (i < packed.length()) {
int count = packed.charAt(i++);
char value = packed.charAt(i++);
do map[j++] = value; while (--count > 0);
}
return map;
}
public final int getTokenStart() {
return zzStartRead;
}
public final int getTokenEnd() {
return getTokenStart() + yylength();
}
public void reset(CharSequence buffer, int start, int end, int initialState) {
zzBuffer = buffer;
zzCurrentPos = zzMarkedPos = zzStartRead = start;
zzAtEOF = false;
zzAtBOL = true;
zzEndRead = end;
yybegin(initialState);
}
/**
* Refills the input buffer.
*
* @return {@code false}, iff there was new input.
*
* @exception java.io.IOException if any I/O-Error occurs
*/
private boolean zzRefill() throws java.io.IOException {
return true;
}
/**
* Returns the current lexical state.
*/
public final int yystate() {
return zzLexicalState;
}
/**
* Enters a new lexical state
*
* @param newState the new lexical state
*/
public final void yybegin(int newState) {
zzLexicalState = newState;
}
/**
* Returns the text matched by the current regular expression.
*/
public final CharSequence yytext() {
return zzBuffer.subSequence(zzStartRead, zzMarkedPos);
}
/**
* Returns the character at position {@code pos} from the
* matched text.
*
* It is equivalent to yytext().charAt(pos), but faster
*
* @param pos the position of the character to fetch.
* A value from 0 to yylength()-1.
*
* @return the character at position pos
*/
public final char yycharat(int pos) {
return zzBuffer.charAt(zzStartRead+pos);
}
/**
* Returns the length of the matched text region.
*/
public final int yylength() {
return zzMarkedPos-zzStartRead;
}
/**
* Reports an error that occurred while scanning.
*
* In a wellformed scanner (no or only correct usage of
* yypushback(int) and a match-all fallback rule) this method
* will only be called with things that "Can't Possibly Happen".
* If this method is called, something is seriously wrong
* (e.g. a JFlex bug producing a faulty scanner etc.).
*
* Usual syntax/scanner level error handling should be done
* in error fallback rules.
*
* @param errorCode the code of the errormessage to display
*/
private void zzScanError(int errorCode) {
String message;
try {
message = ZZ_ERROR_MSG[errorCode];
}
catch (ArrayIndexOutOfBoundsException e) {
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
}
throw new Error(message);
}
/**
* Pushes the specified amount of characters back into the input stream.
*
* They will be read again by then next call of the scanning method
*
* @param number the number of characters to be read again.
* This number must not be greater than yylength()!
*/
public void yypushback(int number) {
if ( number > yylength() )
zzScanError(ZZ_PUSHBACK_2BIG);
zzMarkedPos -= number;
}
/**
* Resumes scanning until the next regular expression is matched,
* the end of input is encountered or an I/O-Error occurs.
*
* @return the next token
* @exception java.io.IOException if any I/O-Error occurs
*/
public IElementType advance() throws java.io.IOException {
int zzInput;
int zzAction;
// cached fields:
int zzCurrentPosL;
int zzMarkedPosL;
int zzEndReadL = zzEndRead;
CharSequence zzBufferL = zzBuffer;
int [] zzTransL = ZZ_TRANS;
int [] zzRowMapL = ZZ_ROWMAP;
int [] zzAttrL = ZZ_ATTRIBUTE;
while (true) {
zzMarkedPosL = zzMarkedPos;
zzAction = -1;
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
zzState = ZZ_LEXSTATE[zzLexicalState];
// set up zzAction for empty match case:
int zzAttributes = zzAttrL[zzState];
if ( (zzAttributes & 1) == 1 ) {
zzAction = zzState;
}
zzForAction: {
while (true) {
if (zzCurrentPosL < zzEndReadL) {
zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL/*, zzEndReadL*/);
zzCurrentPosL += Character.charCount(zzInput);
}
else if (zzAtEOF) {
zzInput = YYEOF;
break zzForAction;
}
else {
// store back cached positions
zzCurrentPos = zzCurrentPosL;
zzMarkedPos = zzMarkedPosL;
boolean eof = zzRefill();
// get translated positions and possibly new buffer
zzCurrentPosL = zzCurrentPos;
zzMarkedPosL = zzMarkedPos;
zzBufferL = zzBuffer;
zzEndReadL = zzEndRead;
if (eof) {
zzInput = YYEOF;
break zzForAction;
}
else {
zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL/*, zzEndReadL*/);
zzCurrentPosL += Character.charCount(zzInput);
}
}
int zzNext = zzTransL[ zzRowMapL[zzState] + ZZ_CMAP(zzInput) ];
if (zzNext == -1) break zzForAction;
zzState = zzNext;
zzAttributes = zzAttrL[zzState];
if ( (zzAttributes & 1) == 1 ) {
zzAction = zzState;
zzMarkedPosL = zzCurrentPosL;
if ( (zzAttributes & 8) == 8 ) break zzForAction;
}
}
}
// store back cached position
zzMarkedPos = zzMarkedPosL;
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
return null;
}
else {
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 1:
{ return BAD_CHARACTER;
}
// fall through
case 119: break;
case 2:
{ return WHITE_SPACE;
}
// fall through
case 120: break;
case 3:
{ return SLASH;
}
// fall through
case 121: break;
case 4:
{ return EXCLAMATIONMARK;
}
// fall through
case 122: break;
case 5:
{ return INTEGER;
}
// fall through
case 123: break;
case 6:
{ return ID;
}
// fall through
case 124: break;
case 7:
{ return LBRACE;
}
// fall through
case 125: break;
case 8:
{ return RBRACE;
}
// fall through
case 126: break;
case 9:
{ return DOT;
}
// fall through
case 127: break;
case 10:
{ return MINUS;
}
// fall through
case 128: break;
case 11:
{ return EQUAL;
}
// fall through
case 129: break;
case 12:
{ return LARROW;
}
// fall through
case 130: break;
case 13:
{ return RARROW;
}
// fall through
case 131: break;
case 14:
{ return AMPERSAND;
}
// fall through
case 132: break;
case 15:
{ return CARET;
}
// fall through
case 133: break;
case 16:
{ return PIPE;
}
// fall through
case 134: break;
case 17:
{ return PLUS;
}
// fall through
case 135: break;
case 18:
{ return PERCENT;
}
// fall through
case 136: break;
case 19:
{ return ASTERISK;
}
// fall through
case 137: break;
case 20:
{ return TILDE;
}
// fall through
case 138: break;
case 21:
{ return LBRACKET;
}
// fall through
case 139: break;
case 22:
{ return RBRACKET;
}
// fall through
case 140: break;
case 23:
{ return QUESTIONMARK;
}
// fall through
case 141: break;
case 24:
{ return SEMICOLON;
}
// fall through
case 142: break;
case 25:
{ return LPAREN;
}
// fall through
case 143: break;
case 26:
{ return RPAREN;
}
// fall through
case 144: break;
case 27:
{ return COMMA;
}
// fall through
case 145: break;
case 28:
{ return COLON;
}
// fall through
case 146: break;
case 29:
{
}
// fall through
case 147: break;
case 30:
{ return SLASHEQUAL;
}
// fall through
case 148: break;
case 31:
{ return EXCLAMATIONMARKEQUAL;
}
// fall through
case 149: break;
case 32:
{ return BUILTINIDENTIFIER;
}
// fall through
case 150: break;
case 33:
{ return STRINGLITERALSINGLE;
}
// fall through
case 151: break;
case 34:
{ return DOT2;
}
// fall through
case 152: break;
case 35:
{ return DOTASTERISK;
}
// fall through
case 153: break;
case 36:
{ return DOTQUESTIONMARK;
}
// fall through
case 154: break;
case 37:
{ return MINUSEQUAL;
}
// fall through
case 155: break;
case 38:
{ return MINUSRARROW;
}
// fall through
case 156: break;
case 39:
{ return MINUSPERCENT;
}
// fall through
case 157: break;
case 40:
{ return OR;
}
// fall through
case 158: break;
case 41:
{ return IF;
}
// fall through
case 159: break;
case 42:
{ return FN;
}
// fall through
case 160: break;
case 43:
{ return EQUALEQUAL;
}
// fall through
case 161: break;
case 44:
{ return EQUALRARROW;
}
// fall through
case 162: break;
case 45:
{ return LARROWEQUAL;
}
// fall through
case 163: break;
case 46:
{ return LARROW2;
}
// fall through
case 164: break;
case 47:
{ return RARROWEQUAL;
}
// fall through
case 165: break;
case 48:
{ return RARROW2;
}
// fall through
case 166: break;
case 49:
{ return AMPERSANDEQUAL;
}
// fall through
case 167: break;
case 50:
{ return CARETEQUAL;
}
// fall through
case 168: break;
case 51:
{ return PIPEEQUAL;
}
// fall through
case 169: break;
case 52:
{ return PIPE2;
}
// fall through
case 170: break;
case 53:
{ return PLUSEQUAL;
}
// fall through
case 171: break;
case 54:
{ return PLUS2;
}
// fall through
case 172: break;
case 55:
{ return PLUSPERCENT;
}
// fall through
case 173: break;
case 56:
{ return PERCENTEQUAL;
}
// fall through
case 174: break;
case 57:
{ return ASTERISKEQUAL;
}
// fall through
case 175: break;
case 58:
{ return ASTERISKPERCENT;
}
// fall through
case 176: break;
case 59:
{ return ASTERISK2;
}
// fall through
case 177: break;
case 60:
{ return CHAR_LITERAL;
}
// fall through
case 178: break;
case 61:
{ return COMMENT;
}
// fall through
case 179: break;
case 62:
{ return CONTAINER_DOC;
}
// fall through
case 180: break;
case 63:
{ return FLOAT;
}
// fall through
case 181: break;
case 64:
{ return DOT3;
}
// fall through
case 182: break;
case 65:
{ return MINUSPERCENTEQUAL;
}
// fall through
case 183: break;
case 66:
{ return TRY;
}
// fall through
case 184: break;
case 67:
{ return PUB;
}
// fall through
case 185: break;
case 68:
{ return AND;
}
// fall through
case 186: break;
case 69:
{ return ASM;
}
// fall through
case 187: break;
case 70:
{ return FOR;
}
// fall through
case 188: break;
case 71:
{ return VAR;
}
// fall through
case 189: break;
case 72:
{ return LARROW2EQUAL;
}
// fall through
case 190: break;
case 73:
{ return RARROW2EQUAL;
}
// fall through
case 191: break;
case 74:
{ return PLUSPERCENTEQUAL;
}
// fall through
case 192: break;
case 75:
{ return ASTERISKPERCENTEQUAL;
}
// fall through
case 193: break;
case 76:
{ return NULL;
}
// fall through
case 194: break;
case 77:
{ return TRUE;
}
// fall through
case 195: break;
case 78:
{ return TEST;
}
// fall through
case 196: break;
case 79:
{ return ENUM;
}
// fall through
case 197: break;
case 80:
{ return ELSE;
}
// fall through
case 198: break;
case 81:
{ return UNION;
}
// fall through
case 199: break;
case 82:
{ return BREAK;
}
// fall through
case 200: break;
case 83:
{ return CONST;
}
// fall through
case 201: break;
case 84:
{ return CATCH;
}
// fall through
case 202: break;
case 85:
{ return ASYNC;
}
// fall through
case 203: break;
case 86:
{ return ALIGN;
}
// fall through
case 204: break;
case 87:
{ return AWAIT;
}
// fall through
case 205: break;
case 88:
{ return ERROR;
}
// fall through
case 206: break;
case 89:
{ return FALSE;
}
// fall through
case 207: break;
case 90:
{ return DEFER;
}
// fall through
case 208: break;
case 91:
{ return WHILE;
}
// fall through
case 209: break;
case 92:
{ return ORELSE;
}
// fall through
case 210: break;
case 93:
{ return OPAQUE;
}
// fall through
case 211: break;
case 94:
{ return STRUCT;
}
// fall through
case 212: break;
case 95:
{ return SWITCH;
}
// fall through
case 213: break;
case 96:
{ return RESUME;
}
// fall through
case 214: break;
case 97:
{ return RETURN;
}
// fall through
case 215: break;
case 98:
{ return PACKED;
}
// fall through
case 216: break;
case 99:
{ return EXTERN;
}
// fall through
case 217: break;
case 100:
{ return EXPORT;
}
// fall through
case 218: break;
case 101:
{ return INLINE;
}
// fall through
case 219: break;
case 102:
{ return NOALIAS;
}
// fall through
case 220: break;
case 103:
{ return SUSPEND;
}
// fall through
case 221: break;
case 104:
{ return ANY_TYPE;
}
// fall through
case 222: break;
case 105:
{ return NOINLINE;
}
// fall through
case 223: break;
case 106:
{ return CONTINUE;
}
// fall through
case 224: break;
case 107:
{ return COMPTIME;
}
// fall through
case 225: break;
case 108:
{ return CALLCONV;
}
// fall through
case 226: break;
case 109:
{ return ANYFRAME;
}
// fall through
case 227: break;
case 110:
{ return ERRDEFER;
}
// fall through
case 228: break;
case 111:
{ return VOLATILE;
}
// fall through
case 229: break;
case 112:
{ return UNDEFINED;
}
// fall through
case 230: break;
case 113:
{ return NOSUSPEND;
}
// fall through
case 231: break;
case 114:
{ return ALLOWZERO;
}
// fall through
case 232: break;
case 115:
{ return UNREACHABLE;
}
// fall through
case 233: break;
case 116:
{ return THREAD_LOCAL;
}
// fall through
case 234: break;
case 117:
{ return LINKSECTION;
}
// fall through
case 235: break;
case 118:
{ return USING_NAME_SPACE;
}
// fall through
case 236: break;
default:
zzScanError(ZZ_NO_MATCH);
}
}
}
}
}
| 33.366286
| 88
| 0.497683
|
9b04d36d7c5d2e6ad299490feda9b0982a6e502a
| 816
|
package com.anjlab.eclipse.e4.tapestry5.handlers;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.ui.IWorkbenchWindow;
import com.anjlab.eclipse.tapestry5.TapestryContext;
import com.anjlab.eclipse.tapestry5.views.context.TapestryContextContentProvider;
public final class TapestryContextInformationControl extends AbstractTapestryContextInformation
{
public TapestryContextInformationControl(
final IWorkbenchWindow window,
final TapestryContext tapestryContext)
{
super(window.getShell(), new ContentProviderCreator()
{
@Override
public ITreeContentProvider createContentProvider()
{
return new TapestryContextContentProvider(window, tapestryContext);
}
});
}
}
| 34
| 95
| 0.726716
|
6fed61287428c752d385f777839d59a996840bd2
| 5,276
|
/**
* Copyright © 2016-2018 dujoy.cn
*/
package org.thingsboard.server.dao.tenant;
import com.google.common.util.concurrent.ListenableFuture;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.thingsboard.server.common.data.Tenant;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.page.TextPageData;
import org.thingsboard.server.common.data.page.TextPageLink;
import org.thingsboard.server.dao.asset.AssetService;
import org.thingsboard.server.dao.customer.CustomerService;
import org.thingsboard.server.dao.dashboard.DashboardService;
import org.thingsboard.server.dao.device.DeviceService;
import org.thingsboard.server.dao.entity.AbstractEntityService;
import org.thingsboard.server.dao.exception.DataValidationException;
import org.thingsboard.server.dao.plugin.PluginService;
import org.thingsboard.server.dao.rule.RuleService;
import org.thingsboard.server.dao.service.DataValidator;
import org.thingsboard.server.dao.service.PaginatedRemover;
import org.thingsboard.server.dao.service.Validator;
import org.thingsboard.server.dao.user.UserService;
import org.thingsboard.server.dao.widget.WidgetsBundleService;
import java.util.List;
import static org.thingsboard.server.dao.service.Validator.validateId;
@Service
@Slf4j
public class TenantServiceImpl extends AbstractEntityService implements TenantService {
private static final String DEFAULT_TENANT_REGION = "Global";
public static final String INCORRECT_TENANT_ID = "Incorrect tenantId ";
@Autowired
private TenantDao tenantDao;
@Autowired
private UserService userService;
@Autowired
private CustomerService customerService;
@Autowired
private AssetService assetService;
@Autowired
private DeviceService deviceService;
@Autowired
private WidgetsBundleService widgetsBundleService;
@Autowired
private DashboardService dashboardService;
@Autowired
private RuleService ruleService;
@Autowired
private PluginService pluginService;
@Override
public Tenant findTenantById(TenantId tenantId) {
log.trace("Executing findTenantById [{}]", tenantId);
Validator.validateId(tenantId, INCORRECT_TENANT_ID + tenantId);
return tenantDao.findById(tenantId.getId());
}
@Override
public ListenableFuture<Tenant> findTenantByIdAsync(TenantId tenantId) {
log.trace("Executing TenantIdAsync [{}]", tenantId);
validateId(tenantId, INCORRECT_TENANT_ID + tenantId);
return tenantDao.findByIdAsync(tenantId.getId());
}
@Override
public Tenant saveTenant(Tenant tenant) {
log.trace("Executing saveTenant [{}]", tenant);
tenant.setRegion(DEFAULT_TENANT_REGION);
tenantValidator.validate(tenant);
return tenantDao.save(tenant);
}
@Override
public void deleteTenant(TenantId tenantId) {
log.trace("Executing deleteTenant [{}]", tenantId);
Validator.validateId(tenantId, INCORRECT_TENANT_ID + tenantId);
customerService.deleteCustomersByTenantId(tenantId);
widgetsBundleService.deleteWidgetsBundlesByTenantId(tenantId);
dashboardService.deleteDashboardsByTenantId(tenantId);
assetService.deleteAssetsByTenantId(tenantId);
deviceService.deleteDevicesByTenantId(tenantId);
userService.deleteTenantAdmins(tenantId);
ruleService.deleteRulesByTenantId(tenantId);
pluginService.deletePluginsByTenantId(tenantId);
tenantDao.removeById(tenantId.getId());
deleteEntityRelations(tenantId);
}
@Override
public TextPageData<Tenant> findTenants(TextPageLink pageLink) {
log.trace("Executing findTenants pageLink [{}]", pageLink);
Validator.validatePageLink(pageLink, "Incorrect page link " + pageLink);
List<Tenant> tenants = tenantDao.findTenantsByRegion(DEFAULT_TENANT_REGION, pageLink);
return new TextPageData<>(tenants, pageLink);
}
@Override
public void deleteTenants() {
log.trace("Executing deleteTenants");
tenantsRemover.removeEntities(DEFAULT_TENANT_REGION);
}
private DataValidator<Tenant> tenantValidator =
new DataValidator<Tenant>() {
@Override
protected void validateDataImpl(Tenant tenant) {
if (StringUtils.isEmpty(tenant.getTitle())) {
throw new DataValidationException("Tenant title should be specified!");
}
if (!StringUtils.isEmpty(tenant.getEmail())) {
validateEmail(tenant.getEmail());
}
}
};
private PaginatedRemover<String, Tenant> tenantsRemover =
new PaginatedRemover<String, Tenant>() {
@Override
protected List<Tenant> findEntities(String region, TextPageLink pageLink) {
return tenantDao.findTenantsByRegion(region, pageLink);
}
@Override
protected void removeEntity(Tenant entity) {
deleteTenant(new TenantId(entity.getUuidId()));
}
};
}
| 36.136986
| 95
| 0.723275
|
38599f8dba07fd26114f61acc2221d5690cad14f
| 425
|
package alibaba.inclass.demo5;
/**
* @program: Java workspace
* @description: 创建学生视图类
* @author: Typhoon
* @create: 2020-03-01 09:28
* 谁终将声震人间,必长久深自缄默;谁终将点燃闪电,必长久如云漂泊。
**/
public class StudentView {
public void show(String studentname,String studentrollname){
System.out.println("students:");
System.out.println("name:"+studentname);
System.out.println("roll no:"+studentrollname);
}
}
| 25
| 64
| 0.68
|
dba4e2f61a4e7d7434b997c6c962cc50388b85fb
| 12,623
|
package se7kn8.servercontroller.addon;
import se7kn8.servercontroller.api.gui.fileeditor.FileEditor;
import se7kn8.servercontroller.api.gui.fileeditor.FileEditorCreator;
import se7kn8.servercontroller.api.gui.server.DialogRow;
import se7kn8.servercontroller.api.gui.server.ServerCreator;
import se7kn8.servercontroller.api.gui.tab.TabEntry;
import se7kn8.servercontroller.api.gui.tab.TabHandler;
import se7kn8.servercontroller.api.server.BasicServer;
import se7kn8.servercontroller.api.util.DialogUtil;
import se7kn8.servercontroller.api.util.FileUtil;
import se7kn8.servercontroller.api.util.design.Designs;
import se7kn8.servercontroller.server.ServerManager;
import se7kn8.servercontroller.util.GUIUtil;
import se7kn8.servercontroller.util.I18N;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.NotNull;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.StringProperty;
import javafx.geometry.HPos;
import javafx.geometry.VPos;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Label;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextField;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import java.awt.Desktop;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Consumer;
//TODO don't use static methods
public class AddonUtil {
private static final Logger log = LogManager.getLogger();
public static List<FileEditorCreator> getEditorsForType(Path file, ServerManager manager) {
if (!Files.exists(file) || Files.isDirectory(file)) {
return new ArrayList<>();
}
String filePath = file.toString();
String fileExtension = filePath.substring(filePath.lastIndexOf(".") + 1);
Collection<List<FileEditorCreator>> fileCreators = manager.getRegistryHelper().getFileEditorRegistry().getValues();
List<FileEditorCreator> creatorList = new ArrayList<>();
for (List<FileEditorCreator> creators : fileCreators) {
for (FileEditorCreator creator : creators) {
if (creator.getFileTypes().contains(fileExtension)) {
creatorList.add(creator);
}
}
}
return creatorList;
}
public static void loadFileEditor(String className, TabHandler<TabEntry<?>> serverTabHandler, Path file) {
try {
Class<?> editorClass = Class.forName(className);
Constructor<?> constructor = editorClass.getConstructor();
Object o = constructor.newInstance();
if (o instanceof FileEditor) {
FileEditor editor = (FileEditor) o;
editor.openFile(file);
serverTabHandler.addTab(editor);
}
} catch (ClassNotFoundException | InvocationTargetException | IllegalAccessException | NoSuchMethodException | InstantiationException e) {
log.error("Error while opening file editor ", e);
}
}
public static void openFileEditor(TabHandler<TabEntry<?>> serverTabHandler, Path file, ServerManager manager) {
List<FileEditorCreator> editors = AddonUtil.getEditorsForType(file, manager);
Alert dialog = new Alert(Alert.AlertType.CONFIRMATION, "", ButtonType.OK, ButtonType.CANCEL);
dialog.setHeaderText(I18N.format("dialog_choose_editor_header", file.getFileName().toString()));
Designs.applyCurrentDesign(dialog);
VBox buttons = new VBox();
buttons.setSpacing(20);
ToggleGroup group = new ToggleGroup();
for (FileEditorCreator editor : editors) {
RadioButton button = new RadioButton(editor.getBundleToTranslate().getString(editor.getID()));
button.setToggleGroup(group);
button.setUserData(editor.getFileEditorClass().getName());
buttons.getChildren().add(button);
}
RadioButton openWithSystem = new RadioButton(I18N.translate("context_menu_open_in_system"));
openWithSystem.setUserData("useSystemExplorer");
openWithSystem.setToggleGroup(group);
buttons.getChildren().add(openWithSystem);
group.selectToggle(openWithSystem);
dialog.getDialogPane().setContent(buttons);
Optional<ButtonType> result = dialog.showAndWait();
if (result.isPresent() && result.get() == ButtonType.OK) {
String className = (String) group.getSelectedToggle().getUserData();
if (className.equals("useSystemExplorer")) {
try {
Desktop.getDesktop().open(file.toFile());
} catch (IOException e) {
log.error("Error while opening file", e);
}
} else {
AddonUtil.loadFileEditor(className, serverTabHandler, file);
}
}
}
public static void loadServerCreateDialog(String addonID, String serverCreatorID, BasicServer parent, ServerManager serverManager) {
List<DialogRow> rows = new ArrayList<>();
findServerCreator(serverManager, addonID, serverCreatorID, serverCreator -> {
if (parent != null) {
//Creates row with filled values
createRows(serverCreator, rows, parent.getProperties(), true, serverManager);
} else {
//Creates empty rows
createRows(serverCreator, rows, null, false, serverManager);
}
});
//Opens Dialog
openCreateDialog(addonID, serverCreatorID, serverManager, rows, editedProperties -> {
if (parent == null) {
//Creates new server
findServerCreator(serverManager, addonID, serverCreatorID, serverCreator -> {
try {
serverManager.createServerHandler(editedProperties, serverCreator.getServerClass(), true, addonID, serverCreatorID);
} catch (Exception ex) {
log.error("Could not create the server, because: ", ex);
}
});
} else {
//Re-initialize old one
parent.initialize(editedProperties);
serverManager.getTabHandler().refresh();
serverManager.getTreeHandler().refresh();
}
});
}
public static void findServerCreator(ServerManager manager, String addonID, String id, Consumer<ServerCreator> consumer) {
findServerCreator(manager, addonID, id).ifPresent(consumer);
}
public static Optional<ServerCreator> findServerCreator(ServerManager manager, String addonID, String id) {
return manager.getRegistryHelper()
.getServerCreatorRegistry()
.getEntries(Addons.addonForID(addonID))
.stream()
.filter(serverCreator -> serverCreator.getID().equals(id))
.findFirst();
}
private static void createRows(ServerCreator creator, List<DialogRow> parentRows, Map<String, String> properties, boolean useProperties, ServerManager manager) {
if (creator.getParent() != null) {
String parentAddonID = creator.getParent().split(":")[0];
String parentCreatorID = creator.getParent().split(":")[1];
Optional<ServerCreator> parentServerCreatorOptional = findServerCreator(manager, parentAddonID, parentCreatorID);
if (parentServerCreatorOptional.isPresent()) {
log.info("Found parent '{}:{}' for server '{}'", parentAddonID, parentCreatorID, creator.getID());
createRows(parentServerCreatorOptional.get(), parentRows, properties, useProperties, manager);
} else {
//TODO show error dialog
log.warn("Can't find parent '{}:{} for server '{}'", parentAddonID, parentCreatorID, creator.getID());
}
}
creator.createServerDialogRows(properties, parentRows, useProperties);
}
/**
* Creates an dialog to create Addon-Specified server
*
* @param addonID The addon id
* @param values The rows to be used
* @param serverConsumer The function to create the server
*/
public static void openCreateDialog(@NotNull String addonID, String id, ServerManager manager, @NotNull List<DialogRow> values, @NotNull Consumer<Map<String, String>> serverConsumer) {
Alert dialog = new Alert(Alert.AlertType.NONE);
GridPane root = getDialogLayout(addonID, values, serverConsumer, v -> dialog.close());
dialog.getDialogPane().setContent(root);
dialog.getDialogPane().getButtonTypes().add(ButtonType.CANCEL);
Designs.applyCurrentDesign(dialog);
findServerCreator(manager, addonID, id, serverCreator -> dialog.setTitle(I18N.format("create_server", serverCreator.getID())));
dialog.show();
}
private static GridPane getDialogLayout(String addonID, List<DialogRow> values, Consumer<Map<String, String>> serverConsumer, Consumer<Void> closeCallback) {
Map<String, String> properties = new HashMap<>();
Map<String, DialogRow> rows = new HashMap<>();
Map<String, StringProperty> propertyMap = new HashMap<>();
//put the rows tree in the rows map
values.forEach(row -> rows.put(row.getPropertyName(), row));
//Create layout
GridPane layout = new GridPane();
layout.setMinWidth(1000);
layout.setMinHeight(500);
//Size of the properties
int size = values.size();
//Add rows to layout
for (int i = 0; i < size; i++) {
GUIUtil.addRowConstraints(layout, 10, 30, -1, Priority.SOMETIMES);
}
//Add columns to layout
GUIUtil.addColumnConstraints(layout, 10, 100, -1, Priority.SOMETIMES);
GUIUtil.addColumnConstraints(layout, 10, 100, -1, Priority.SOMETIMES);
GUIUtil.addColumnConstraints(layout, 10, 134, 227, Priority.SOMETIMES);
GUIUtil.addColumnConstraints(layout, 10, 238, 253, Priority.SOMETIMES);
//Add header text
Label header = new Label(I18N.format("create_server", Addons.addonForID(addonID).getAddonInfo().getName()));
header.setFont(new Font(50));
header.setPrefWidth(750);
//header.setPrefHeight(73);
GridPane.setColumnSpan(header, 3);
layout.getChildren().add(header);
//Add addon-specified rows
int lastRow = 0;
for (int i = 0; i < values.size(); i++) {
DialogRow row = values.get(i);
addRow(row, i + 1, layout, propertyMap);
lastRow = i + 1;
}
//Add confirm button
Button confirm = new Button(I18N.translate("dialog_finish"));
confirm.setPrefWidth(100);
confirm.setPrefHeight(50);
confirm.setOnAction(e -> {
//No primitive boolean because it have to be effective-final
BooleanProperty flag = new SimpleBooleanProperty(true);
log.debug("Start property analysis");
propertyMap.forEach((k, v) -> {
DialogRow controlRow = rows.get(k);
String value = v.get();
//Non-Null check
if (controlRow == null) {
throw new IllegalStateException("Row is null");
}
if (value == null) {
value = "";
}
log.info(v);
//Test the values
if (!controlRow.getStringPredicate().test(value)) {
log.warn("Value '{}' do not match!", controlRow.getName());
DialogUtil.showWaringAlert(I18N.translate("dialog_wrong_content"), I18N.format("dialog_wrong_content_desc", controlRow.getName()));
flag.set(false);
return;
}
properties.put(k, value);
});
log.debug("End property analysis");
log.debug("Load server callback");
if (flag.get()) {
System.out.println("test:" + properties);
serverConsumer.accept(properties);
closeCallback.accept(null);
}
log.debug("Server created");
});
GridPane.setColumnIndex(confirm, 3);
GridPane.setRowIndex(confirm, lastRow);
GridPane.setHalignment(confirm, HPos.CENTER);
GridPane.setValignment(confirm, VPos.CENTER);
layout.getChildren().add(confirm);
return layout;
}
private static void addRow(DialogRow dialogRow, int row, GridPane layout, Map<String, StringProperty> properties) {
log.debug("Add row: width:{}, height: {}", dialogRow.getPrefWidth(), dialogRow.getPrefHeight());
Label label = new Label(dialogRow.getName());
label.setFont(new Font(37));
GridPane.setColumnIndex(label, 0);
GridPane.setRowIndex(label, row);
layout.getChildren().add(label);
TextField field = new TextField();
field.setPrefWidth(dialogRow.getPrefWidth());
field.setPrefHeight(dialogRow.getPrefHeight());
field.setPromptText(dialogRow.getPromptText());
field.setText(dialogRow.getDefaultValue());
GridPane.setColumnIndex(field, 1);
GridPane.setRowIndex(field, row);
layout.getChildren().add(field);
properties.put(dialogRow.getPropertyName(), field.textProperty());
if (dialogRow.isUsingFileChooser()) {
Button b = new Button(I18N.format("file_choose"));
b.setPrefWidth(dialogRow.getPrefWidth());
b.setPrefHeight(dialogRow.getPrefHeight());
b.setOnAction(e -> FileUtil.openFileChooser(dialogRow.getFileExtension(), dialogRow.getFileType()).ifPresent(field::setText));
GridPane.setColumnIndex(b, 2);
GridPane.setRowIndex(b, row);
layout.getChildren().add(b);
}
}
}
| 36.377522
| 185
| 0.738969
|
743cf38c60c048c0c15779fb3cfaf852b5e373c0
| 2,533
|
package utils;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.TouchAction;
import io.appium.java_client.android.AndroidElement;
import io.appium.java_client.ios.IOSElement;
import io.appium.java_client.touch.offset.PointOption;
import org.openqa.selenium.Dimension;
import static io.appium.java_client.touch.WaitOptions.waitOptions;
import static java.time.Duration.ofSeconds;
/**
* This class contains custom appium/selenium methods for Webelement
*/
public class AppiumUtils {
public static WaitUtils waitUtils = new WaitUtils();
/**
* This will check whether element is displayed on UI or not
*
* @param element
* @return
*/
public static boolean isElementDisplayed(IOSElement element) {
waitUtils.staticWait(500);
boolean isPresent = false;
try {
element.isDisplayed();
isPresent = true;
} catch (Exception e) {
isPresent = false;
}
return isPresent && element.isDisplayed();
}
/**
* It will scroll to particular element
*
* @param element
* @param driver
*/
public static void scrollToElement(MobileElement element, AppiumDriver driver) {
int i = 0;
System.out.println("scrollToElement: " + element);
Dimension size = driver.manage().window().getSize();
System.out.println("Screen Size: " + size);
int start_Y = (int) (size.getHeight() * 0.80);
int end_Y = (int) (size.getHeight() * 0.20);
System.out.println("Y2:" + start_Y);
System.out.println("Y1:" + end_Y);
int start_end_X = (int) (size.getWidth() * 0.50);
System.out.println("X1/X2:" + start_end_X);
System.out.println(start_Y + " : " + end_Y + " : " + start_end_X);
do {
i++;
System.out.println("Before swipe: " + i);
TouchAction swipe = new TouchAction(driver).press(PointOption.point(200, 500))
.waitAction(waitOptions(ofSeconds(2)))
.moveTo(PointOption.point(200, -100)).release();
swipe.perform();
System.out.println("After swipe: " + i);
} while (!isElementDisplayed((IOSElement) element)); //(i==2);
}
/**
* This method is used to generate 4 digit randomNumber
*
* @return
*/
public static String getRandomNumber() {
return String.valueOf(System.currentTimeMillis() % 10000);
}
}
| 32.474359
| 90
| 0.620213
|
c60037af0ddc907b0b09ca57f64da0b293365941
| 1,301
|
package us.myles.ViaVersion.api.command;
import java.util.List;
public interface ViaVersionCommand {
/**
* Register your own subcommand inside ViaVersion
*
* @param command Your own SubCommand instance to handle it.
* @throws Exception throws an exception when the subcommand already exists or if it's not valid, example: spacee
*/
void registerSubCommand(ViaSubCommand command) throws Exception;
/**
* Check if a subcommand is registered.
*
* @param name Subcommand name
* @return true if it exists
*/
boolean hasSubCommand(String name);
/**
* Get subcommand instance by name
*
* @param name subcommand name
* @return ViaSubCommand instance
*/
ViaSubCommand getSubCommand(String name);
/**
* Executed when the Command sender executes the commands
*
* @param sender Sender object
* @param args arguments provided
* @return was successful
*/
boolean onCommand(ViaCommandSender sender, String[] args);
/**
* Executed when the Command sender tab-completes
*
* @param sender Sender object
* @param args arguments provided
* @return was successful
*/
List<String> onTabComplete(ViaCommandSender sender, String[] args);
}
| 27.104167
| 117
| 0.661799
|
03afb3b30d0ef6aba342873234dcc73c8407a055
| 19,298
|
package org.jetlinks.simulator.mqtt;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.google.common.collect.Maps;
import io.netty.buffer.Unpooled;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.epoll.Epoll;
import io.netty.channel.epoll.EpollEventLoopGroup;
import io.netty.channel.epoll.EpollSocketChannel;
import io.netty.channel.kqueue.KQueue;
import io.netty.channel.kqueue.KQueueEventLoopGroup;
import io.netty.channel.kqueue.KQueueSocketChannel;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.mqtt.MqttConnectReturnCode;
import io.netty.handler.codec.mqtt.MqttVersion;
import io.netty.handler.ssl.SslContext;
import io.netty.handler.ssl.SslContextBuilder;
import io.netty.util.concurrent.Future;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.SneakyThrows;
import org.apache.commons.codec.digest.DigestUtils;
import org.hswebframework.expands.script.engine.DynamicScriptEngine;
import org.hswebframework.expands.script.engine.DynamicScriptEngineFactory;
import org.hswebframework.utils.StringUtils;
import org.jetlinks.mqtt.client.MqttClient;
import org.jetlinks.mqtt.client.MqttClientCallback;
import org.jetlinks.mqtt.client.MqttClientConfig;
import org.jetlinks.mqtt.client.MqttConnectResult;
import org.slf4j.LoggerFactory;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.TrustManagerFactory;
import java.io.FileInputStream;
import java.math.BigDecimal;
import java.net.InetSocketAddress;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.KeyStore;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.LongAdder;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
/**
* @author zhouhao
* @since 1.0.0
*/
public class MQTTSimulator {
transient EventLoopGroup eventLoopGroup;
transient Class channelClass;
@Getter
@Setter
String prefix = "test";
@Getter
@Setter
String address = "127.0.0.1";
@Getter
@Setter
int port = 1883;
@Getter
@Setter
int start = 0;
@Getter
@Setter
int limit = 10000;
//开启事件上报
@Getter
@Setter
boolean enableEvent = false;
//一次事件上报设备最大数量
@Getter
@Setter
int eventLimit = 2000;
//事件上报频率
@Getter
@Setter
int eventRate = 1000;
@Getter
@Setter
String scriptFile = "./scripts/handler.js";
@Getter
@Setter
private String[] binds = null;
@Getter
@Setter
private int bindPortStart = 10000;
@Getter
@Setter
private boolean ssl = false;
@Getter
@Setter
private String p12Path = "./ssl/jetlinks-client.p12";
@Getter
@Setter
private String p12Password = "jetlinks";
@Getter
@Setter
private String cerPath = "./ssl/jetlinks-server.cer";
@Getter
@Setter
private int batchSize = 100;
@Getter
@Setter
private int timeout = 30;
@Getter
@Setter
private int threadSize = Runtime.getRuntime().availableProcessors() * 2;
Map<String, ClientSession> clientMap;
Map<String, MessageHandler> messageHandlerMap = new HashMap<>();
Map<String, MessageHandler> childMessageHandler = new HashMap<>();
BiConsumer<Integer, ClientSession> eventDataSuppliers;
private ScheduledExecutorService executorService;
BiConsumer<Integer, MQTTAuth> authBiConsumer = (index, auth) -> {
//secureId|timestamp
String username = "test|" + System.currentTimeMillis();
//md5(secureId|timestamp|secureKey)
String password = DigestUtils.md5Hex(username + "|" + "test");
auth.setUsername(username);
auth.setPassword(password);
};
public void onAuth(BiConsumer<Integer, MQTTAuth> consumer) {
this.authBiConsumer = consumer;
}
public void runRate(Runnable runnable, long time) {
executorService.scheduleAtFixedRate(runnable, 2000, time, TimeUnit.MILLISECONDS);
}
public void runDelay(Runnable runnable, long time) {
executorService.schedule(runnable, time, TimeUnit.MILLISECONDS);
}
@AllArgsConstructor
@Getter
public class ClientSession {
private MqttClient client;
private MQTTAuth auth;
public void sendMessage(String topic, Object msg) {
String json;
if (msg instanceof String) {
json = (String) msg;
} else {
json = JSON.toJSONString(msg);
}
client.publish(topic, Unpooled.copiedBuffer(json.getBytes()))
.addListener(future -> {
if (!future.isSuccess()) {
System.out.println("发送消息:" + topic + "=>" + json + " 失败:" + future.cause());
}
});
}
public void sendChilDeviceMessage(String topic, String deviceId, Object msg) {
JSONObject json;
if (msg instanceof String) {
json = JSON.parseObject((String) msg);
} else {
json = (JSONObject) JSON.toJSON(msg);
}
json.put("clientId", deviceId);
JSONObject message = new JSONObject();
message.put("topic", topic);
message.put("message", json);
message.put("childDeviceId", deviceId);
client.publish("/child-device-message", Unpooled.copiedBuffer(JSON.toJSONBytes(message)))
.addListener(future -> {
if (!future.isSuccess()) {
System.out.println("发送消息:/child-device-message=>" + message + " 失败:" + future.cause());
} else {
// System.out.println("发送消息:/child-device-message=>" + message);
}
});
}
}
public void init() {
executorService = Executors.newScheduledThreadPool(batchSize);
createMqttJob = new LinkedBlockingQueue<>(batchSize);
if (KQueue.isAvailable()) {
eventLoopGroup = new KQueueEventLoopGroup(threadSize);
channelClass = KQueueSocketChannel.class;
} else if (Epoll.isAvailable()) {
eventLoopGroup = new EpollEventLoopGroup(threadSize);
channelClass = EpollSocketChannel.class;
} else {
eventLoopGroup = new NioEventLoopGroup(threadSize);
channelClass = NioSocketChannel.class;
}
}
public void onEvent(BiConsumer<Integer, ClientSession> clientSessionBiConsumer) {
this.eventDataSuppliers = clientSessionBiConsumer;
}
public void bindHandler(String topic, MessageHandler handler) {
messageHandlerMap.put(topic, handler);
}
public void bindChildHandler(String topic, MessageHandler handler) {
childMessageHandler.put(topic, handler);
}
private SslContext sslContext;
@SneakyThrows
public SslContext getSSLContext() {
if (ssl && sslContext == null) {
Objects.requireNonNull(p12Path, "p12Path不能为空");
Objects.requireNonNull(cerPath, "cerPath不能为空");
KeyStore keyStore = KeyStore.getInstance("PKCS12");
keyStore.load(new FileInputStream(p12Path), p12Password.toCharArray());
KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
CertificateFactory cAf = CertificateFactory.getInstance("X.509");
FileInputStream caIn = new FileInputStream(cerPath);
X509Certificate ca = (X509Certificate) cAf.generateCertificate(caIn);
KeyStore caKs = KeyStore.getInstance("JKS");
caKs.load(null, null);
caKs.setCertificateEntry("ca-certificate", ca);
TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX");
tmf.init(caKs);
keyManagerFactory.init(keyStore, p12Password.toCharArray());
sslContext = SslContextBuilder.forServer(keyManagerFactory)
.trustManager(tmf)
.build();
}
return sslContext;
}
private Consumer<ClientSession> onConnect;
public void onConnect(Consumer<ClientSession> consumer) {
this.onConnect = consumer;
}
public Future<MqttConnectResult> createMqttClient(MQTTAuth auth, InetSocketAddress bind, Consumer<MqttConnectResult> call) throws Exception {
MqttClientConfig clientConfig = new MqttClientConfig();
MqttClient mqttClient = MqttClient.create(clientConfig, (topic, payload) -> {
String data = payload.toString(StandardCharsets.UTF_8);
MessageHandler handler = messageHandlerMap.get(topic);
if (null != handler) {
handler.handle(JSON.parseObject(data), clientMap.get(auth.getClientId()));
} else {
if ("/child-device-message".equals(topic)) {
JSONObject jsonObject = JSON.parseObject(data);
String childTopic = jsonObject.getString("childTopic");
handler = childMessageHandler.get(childTopic);
if (null != handler) {
handler.handle(jsonObject.getJSONObject("childMessage"), clientMap.get(auth.getClientId()));
}
}
}
});
if (ssl) {
//开启双向认证
mqttClient.getClientConfig().setSslEngineConsumer(engine -> {
engine.setUseClientMode(true);
});
}
Runnable initAuth = () -> {
mqttClient.getClientConfig().setClientId(auth.getClientId());
mqttClient.getClientConfig().setUsername(auth.getUsername());
mqttClient.getClientConfig().setPassword(auth.getPassword());
};
mqttClient.getClientConfig().setBindAddress(bind);
mqttClient.setEventLoop(eventLoopGroup);
mqttClient.getClientConfig().setChannelClass(channelClass);
mqttClient.getClientConfig().setProtocolVersion(MqttVersion.MQTT_3_1_1);
mqttClient.getClientConfig().setReconnect(true);
mqttClient.getClientConfig().setRetryInterval(5);
mqttClient.getClientConfig().setTimeoutSeconds(timeout);
mqttClient.getClientConfig().setSslContext(getSSLContext());
initAuth.run();
AtomicLong errorCounter = new AtomicLong();
mqttClient.setCallback(new MqttClientCallback() {
@Override
public void connectionLost(Throwable cause) {
authBiConsumer.accept(auth.getIndex(), auth);
initAuth.run();
if (errorCounter.incrementAndGet() >= 20) {
mqttClient.disconnect();
} else {
System.out.println("客户端" + auth.getClientId() + "连接失败" + (bind == null ? "," : "(本地ip:" + bind + "),") + cause.getClass().getSimpleName() + ":" + cause.getMessage());
}
}
@Override
public void onSuccessfulReconnect() {
ClientSession session = clientMap.get(auth.getClientId());
if (null != session && null != onConnect) {
onConnect.accept(session);
}
}
});
ClientSession session = new ClientSession(mqttClient, auth);
clientMap.put(auth.getClientId(), session);
return mqttClient.connect(auth.getMqttAddress(), auth.getMqttPort())
.addListener(future -> {
MqttConnectResult result = null;
try {
result = (MqttConnectResult) future.get(5, TimeUnit.SECONDS);
if (result.getReturnCode() != MqttConnectReturnCode.CONNECTION_ACCEPTED) {
mqttClient.disconnect();
clientMap.remove(auth.getClientId());
} else {
if (null != onConnect) {
onConnect.accept(session);
}
}
} catch (Exception e) {
e.printStackTrace();
clientMap.remove(auth.getClientId());
} finally {
call.accept(result);
}
});
}
private BlockingQueue<Runnable> createMqttJob;
private void printReport() {
int[] useTime = {5000, 2000, 1000, 500, 200, 100, 10};
Map<Integer, LongAdder> adder = new LinkedHashMap<>(useTime.length);
for (int i : useTime) {
adder.put(i, new LongAdder());
}
long max = 0;
long min = 999999;
long total = 0;
//打印报告
for (ClientSession session : clientMap.values()) {
long use = session.getAuth().getConnectedTime() - session.getAuth().getRequestTime();
max = Math.max(max, use);
min = Math.min(min, use);
total += use;
for (int i1 : useTime) {
if (use >= i1) {
adder.get(i1).increment();
break;
}
}
}
System.out.println();
System.out.println("max : " + max + "ms");
System.out.println("min : " + min + "ms");
System.out.println("avg : " + total / limit + "ms");
System.out.println();
for (Map.Entry<Integer, LongAdder> entry : adder.entrySet()) {
System.out.println("> " + entry.getKey() + "ms : " + entry.getValue() + "("
+ new BigDecimal((entry.getValue().doubleValue() / limit) * 100)
.setScale(2, BigDecimal.ROUND_HALF_UP) + "%)");
}
System.out.println();
}
public void start() throws Exception {
init();
String scriptFileContent = new String(Files.readAllBytes(Paths.get(scriptFile)));
DynamicScriptEngine engine = DynamicScriptEngineFactory.getEngine("js");
engine.compile("handle", scriptFileContent);
Map<String, Object> context = Maps.newHashMap();
context.put("simulator", this);
context.put("logger", LoggerFactory.getLogger("message.handler"));
engine.execute("handle", context).getIfSuccess();
int end = start + limit;
AtomicInteger started = new AtomicInteger();
int queueSizePeekSize = Math.max(4, threadSize - 4);
for (int i = 0; i < queueSizePeekSize; i++) {
executorService.submit(() -> {
while (started.longValue() <= limit) {
try {
Runnable job = createMqttJob.poll();
if (job == null) {
Thread.sleep(100);
} else {
job.run();
}
} catch (Exception ignore) {
}
}
});
}
System.out.println("开始创建连接...");
for (int i = start; i < end; i++) {
MQTTAuth auth = new MQTTAuth();
auth.setMqttAddress(address);
auth.setMqttPort(port);
auth.setIndex(i);
auth.setClientId(prefix + i);
authBiConsumer.accept(i, auth);
createMqttJob.put(() -> {
try {
createMqttClient(auth, createAddress(auth.getIndex()), (result) -> {
auth.setConnectedTime(System.currentTimeMillis());
int current = started.incrementAndGet();
if (current % batchSize == 0 || current == limit) {
System.out.println("create mqtt client: " + current + " ok");
}
if (current == limit) {
printReport();
}
}).await();
} catch (Exception e) {
e.printStackTrace();
}
});
}
if (enableEvent && eventDataSuppliers != null) {
runRate(this::doPushEvent, eventRate);
}
// System.out.println("create mqtt client done :" + len);
}
private Map<String, AtomicInteger> portCounter = new ConcurrentHashMap<>();
public InetSocketAddress createAddress(int index) {
if (binds == null || binds.length == 0) {
return null;
}
//选择网卡
//----------------当前设备索引/(总数/网卡数量)
try {
String host = binds[Math.min(binds.length - 1, index / (limit / binds.length))];
return new InetSocketAddress(host, portCounter
.computeIfAbsent(host, h -> new AtomicInteger(bindPortStart))
.incrementAndGet());
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public void doPushEvent() {
System.out.println("开始上报设备事件");
try {
int clientSize = this.clientMap.size();
List<ClientSession> all = new ArrayList<>(this.clientMap.values());
int eventLimit = Math.min(this.eventLimit, clientSize);
int totalLimit = eventLimit;
Random random = new Random();
while (eventLimit > 0) {
ClientSession session = all.get(random.nextInt(clientSize));
if (session != null) {
eventDataSuppliers.accept(--eventLimit, session);
}
}
System.out.println("成功推送设备事件:" + totalLimit);
} catch (Throwable e) {
e.printStackTrace();
}
}
public static void main(String[] args) throws Exception {
JSONObject jsonObject = new JSONObject();
System.getProperties()
.entrySet()
.stream()
.flatMap(e -> System.getenv().entrySet().stream())
.filter(e -> String.valueOf(e.getKey()).startsWith("mqtt."))
.forEach(e -> jsonObject.put(String.valueOf(e.getKey()).substring(5), e.getValue()));
for (String arg : args) {
String[] split = arg.split("[=]");
jsonObject.put(split[0].startsWith("mqtt.") ? split[0].substring(5) : split[0], split.length == 2 ? split[1] : true);
}
String binds = jsonObject.getString("binds");
if (!StringUtils.isNullOrEmpty(binds)) {
jsonObject.put("binds", binds.split("[,]"));
}
MQTTSimulator simulator = jsonObject.toJavaObject(MQTTSimulator.class);
simulator.clientMap = new ConcurrentHashMap<>(simulator.limit);
System.out.println("使用配置:\n" + JSON.toJSONString(simulator, SerializerFeature.PrettyFormat));
simulator.start();
}
}
| 36.003731
| 186
| 0.582288
|
e2864fce3f4d115b1678e741cde1c9bbd5e3f445
| 368
|
package de.kneissja.katanine.item;
import de.kneissja.katanine.price.Price;
/**
* An item to be sold at the checkout
*/
public interface Item {
/**
* The idenfitier of the item
* @return identifier
*/
ItemIdentifier getIdentifier();
/**
* The price of a single item
* @return price of the item
*/
Price getPrice();
}
| 17.52381
| 40
| 0.619565
|
1b4669ba32bb2ebaf889a58e081d313137488529
| 2,060
|
package org.gruppe2.ui.javafx.menu;
import javafx.fxml.FXML;
import javafx.scene.control.TextField;
import javafx.scene.image.ImageView;
import javafx.scene.layout.Pane;
import javafx.scene.layout.TilePane;
import javafx.scene.layout.VBox;
import org.gruppe2.Main;
import org.gruppe2.Resources;
import org.gruppe2.ui.UIResources;
import org.gruppe2.ui.javafx.Modal;
import org.gruppe2.ui.javafx.PokerApplication;
public class Settings extends VBox {
private static Modal modal = null;
@FXML
TextField nameField;
@FXML
TilePane avatarTiles;
private Pane highlitedPane;
public Settings(){
UIResources.loadFXML(this);
if(Main.getProperty("name") != null)
nameField.setText(Main.getProperty("name"));
getAvatars();
}
public static void show(boolean canClose) {
modal = new Modal(canClose);
modal.setPercentSize(0.5, 0.5);
modal.setContent(new Settings());
modal.setTitle("Settings: Set name and avatar");
modal.show();
}
public void apply(){
if(nameField.getText() != null && !nameField.getText().isEmpty())
Main.setProperty("name" ,nameField.getText());
modal.close();
}
private void getAvatars(){
String[] avatars = Resources.listAvatars();
for(String avatar: avatars){
Pane avatarPane = new Pane();
ImageView imageView = new ImageView(UIResources.getAvatar(avatar));
imageView.preserveRatioProperty().setValue(true);
imageView.fitWidthProperty().bind(PokerApplication.getRoot().widthProperty().multiply(0.05));
if(avatar.equals(Main.getProperty("avatar"))) {
avatarPane.setStyle("-fx-effect: dropshadow(gaussian, #0099ff, 5, 2, 0, 0);");
highlitedPane = avatarPane;
}
avatarPane.setOnMouseClicked(frisk -> {Main.setProperty("avatar",avatar);
flagTile(avatarPane);
});
avatarPane.getChildren().add(imageView);
avatarTiles.getChildren().add(avatarPane);
}
}
private void flagTile(Pane pane){
if(highlitedPane!= null) {
highlitedPane.setStyle("");
}
pane.setStyle("-fx-effect: dropshadow(gaussian, #0099ff, 5, 2, 0, 0);");
highlitedPane = pane;
}
}
| 25.75
| 96
| 0.723301
|
733d5adbd8c3e3ce1ca91c71c3fa31af6cc919fe
| 1,051
|
package com.example.ldjg.pigknowclient.DB;
import org.litepal.crud.DataSupport;
import java.io.Serializable;
/**
* Created by Administrator on 2018/2/5.
*/
public class Media extends DataSupport implements Serializable{
private int id;
private String FilePath;
private int visiable;
private String Date;
private String photoPath;
public String getPhotoPath() {
return photoPath;
}
public void setPhotoPath(String photoPath) {
this.photoPath = photoPath;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getFilePath() {
return FilePath;
}
public void setFilePath(String filePath) {
FilePath = filePath;
}
public int isVisiable() {
return visiable;
}
public void setVisiable(int visiable) {
this.visiable = visiable;
}
public String getDate() {
return Date;
}
public void setDate(String date) {
Date = date;
}
}
| 18.12069
| 63
| 0.620362
|
b56b11c0fbb8e96de297a827fcaca590f367b382
| 2,407
|
package dev.kir.sync.client.render.block.entity;
import dev.kir.sync.Sync;
import dev.kir.sync.api.shell.ShellState;
import dev.kir.sync.block.AbstractShellContainerBlock;
import dev.kir.sync.block.SyncBlocks;
import dev.kir.sync.block.entity.ShellStorageBlockEntity;
import dev.kir.sync.client.model.AbstractShellContainerModel;
import dev.kir.sync.client.model.ShellStorageModel;
import dev.kir.sync.entity.ShellEntity;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.BlockState;
import net.minecraft.block.enums.DoubleBlockHalf;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Direction;
@Environment(EnvType.CLIENT)
public class ShellStorageBlockEntityRenderer extends AbstractShellContainerBlockEntityRenderer<ShellStorageBlockEntity> {
private static final Identifier SHELL_STORAGE_TEXTURE_ID = Sync.locate("textures/block/shell_storage.png");
private static final BlockState DEFAULT_STATE = SyncBlocks.SHELL_STORAGE.getDefaultState().with(AbstractShellContainerBlock.HALF, DoubleBlockHalf.LOWER).with(AbstractShellContainerBlock.FACING, Direction.SOUTH).with(AbstractShellContainerBlock.OPEN, false);
private final ShellStorageModel model;
public ShellStorageBlockEntityRenderer(BlockEntityRendererFactory.Context context) {
super(context);
this.model = new ShellStorageModel();
}
@Override
protected AbstractShellContainerModel getShellContainerModel(ShellStorageBlockEntity blockEntity, BlockState blockState, float tickDelta) {
this.model.ledColor = blockEntity.getIndicatorColor();
this.model.connectorProgress = blockEntity.getConnectorProgress(tickDelta);
return this.model;
}
@Override
protected ShellEntity createEntity(ShellState shellState, ShellStorageBlockEntity blockEntity, float tickDelta) {
ShellEntity entity = shellState.asEntity();
entity.isActive = shellState.getProgress() >= ShellState.PROGRESS_DONE;
entity.pitchProgress = entity.isActive ? blockEntity.getConnectorProgress(tickDelta) : 0;
return entity;
}
@Override
protected BlockState getDefaultState() {
return DEFAULT_STATE;
}
@Override
protected Identifier getTextureId() {
return SHELL_STORAGE_TEXTURE_ID;
}
}
| 42.982143
| 261
| 0.791026
|
c6952aa25759bf2dc8b55665d218c66340c20bdd
| 9,651
|
/*******************************************************************************
* Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* Alexander Nyßen (Research Group Software Construction, RWTH Aachen University) - Contribution for Bugzilla 245182
*
*******************************************************************************/
package org.eclipse.draw2d.geometry;
/**
* Represents a vector within 2-dimensional Euclidean space.
*
* @since 3.6
*/
public class Vector {
/** the X value */
public double x;
/** the Y value */
public double y;
// internal constant used for comparisons.
private static final Vector NULL = new Vector(0, 0);
/**
* Constructs a Vector pointed in the specified direction.
*
* @param x
* X value.
* @param y
* Y value.
*/
public Vector(double x, double y) {
this.x = x;
this.y = y;
}
/**
* Constructs a Vector pointed in the direction specified by a Point.
*
* @param p
* the point
*/
public Vector(PrecisionPoint p) {
x = p.preciseX();
y = p.preciseY();
}
/**
* Constructs a Vector representing the direction and magnitude between to
* provided Points.
*
* @param start
* starting point
* @param end
* End Point
*/
public Vector(PrecisionPoint start, PrecisionPoint end) {
x = end.preciseX() - start.preciseX();
y = end.preciseY() - start.preciseY();
}
/**
* Constructs a Vector representing the difference between two provided
* Vectors.
*
* @param start
* The start Ray
* @param end
* The end Ray
*/
public Vector(Vector start, Vector end) {
x = end.x - start.x;
y = end.y - start.y;
}
/**
* Calculates the magnitude of the cross product of this Vector with
* another. Represents the amount by which two Vectors are directionally
* different. Parallel Vectors return a value of 0.
*
* @param other
* Vector being compared
* @return The dissimilarity
*/
public double getDissimilarity(Vector other) {
return PrecisionGeometry.preciseAbs(getCrossProduct(other));
}
/**
* Calculates whether this Vector and the provided one are parallel to each
* other.
*
* @param other
* The Vector to test for parallelism
* @return true if this Vector and the provided one are parallel, false
* otherwise.
*/
public boolean isParallelTo(Vector other) {
return getDissimilarity(other) == 0;
}
/**
* Calculates the dot product of this Vector with another.
*
* @param other
* the Vector used to calculate the dot product
* @return The dot product
*/
public double getDotProduct(Vector other) {
return PrecisionGeometry.preciseAdd(
PrecisionGeometry.preciseMultiply(x, other.x),
PrecisionGeometry.preciseMultiply(y, other.y));
}
/**
* Calculates the cross product of this Vector with another.
*
* @param other
* the Vector used to calculate the cross product
* @return The cross product.
*/
public double getCrossProduct(Vector other) {
return PrecisionGeometry.preciseSubtract(
PrecisionGeometry.preciseMultiply(x, other.y),
PrecisionGeometry.preciseMultiply(y, other.x));
}
/**
* Creates a new Vector which is the sum of this Vector with another.
*
* @param other
* Vector to be added to this Vector
* @return a new Vector representing the sum
*/
public Vector getAdded(Vector other) {
return new Vector(PrecisionGeometry.preciseAdd(x, other.x),
PrecisionGeometry.preciseAdd(y, other.y));
}
/**
* Creates a new Vector which is the difference of this Vector with the
* provided Vector.
*
* @param other
* Vector to be subtracted from this Vector
* @return a new Vector representing the difference.
*/
public Vector getSubtracted(Vector other) {
return new Vector(PrecisionGeometry.preciseSubtract(x, other.x),
PrecisionGeometry.preciseSubtract(y, other.y));
}
/**
* Returns the angle (in degrees) between this Vector and the provided
* Vector.
*
* @param other
* Vector to calculate the angle.
* @return the angle between the two Vectors in degrees.
*/
public double getAngle(Vector other) {
double cosAlpha = PrecisionGeometry.preciseDivide(
getDotProduct(other),
(PrecisionGeometry.preciseMultiply(getLength(),
other.getLength())));
// compensate rounding effects that may occur
if (cosAlpha > 1) {
cosAlpha = 1;
} else if (cosAlpha < -1) {
cosAlpha = -1;
}
return Math.toDegrees(Math.acos(cosAlpha));
}
/**
* Creates a new Vector which represents the average of this Vector with
* another.
*
* @param other
* Vector to calculate the average.
* @return a new Vector
*/
public Vector getAveraged(Vector other) {
return new Vector(PrecisionGeometry.preciseDivide(
PrecisionGeometry.preciseAdd(x, other.x), 2),
PrecisionGeometry.preciseDivide(
PrecisionGeometry.preciseAdd(y, other.y), 2));
}
/**
* Creates a new Vector which represents this Vector multiplied by the
* provided scalar factor.
*
* @param factor
* Value providing the amount to scale.
* @return a new Vector
*/
public Vector getMultiplied(double factor) {
return new Vector(PrecisionGeometry.preciseMultiply(x, factor),
PrecisionGeometry.preciseMultiply(y, factor));
}
/**
* Creates a new Vector which represents this Vector divided by the provided
* scalar factor.
*
* @param factor
* Value providing the amount to scale.
* @return a new Vector
*/
public Vector getDivided(double factor) {
return new Vector(PrecisionGeometry.preciseDivide(x, factor),
PrecisionGeometry.preciseDivide(y, factor));
}
/**
* Returns the orthogonal complement of this Vector, which is defined to be
* (-y, x).
*
* @return the orthogonal complement of this Vector
*/
public Vector getOrthogonalComplement() {
return new Vector(PrecisionGeometry.preciseNegate(y), x);
}
/**
* Returns the length of this Vector.
*
* @return Length of this Vector
*/
public double getLength() {
return Math.sqrt(getDotProduct(this));
}
/**
* Calculates the similarity of this Vector with another. Similarity is
* defined as the absolute value of the dotProduct(). Orthogonal vectors
* return a value of 0.
*
* @param other
* Vector being tested for similarity
* @return the Similarity
* @see #getDissimilarity(Vector)
*/
public double getSimilarity(Vector other) {
return PrecisionGeometry.preciseAbs(getDotProduct(other));
}
/**
* Calculates whether this Vector and the provided one are orthogonal to
* each other.
*
* @param other
* Vector being tested for orthogonality
* @return true, if this Vector and the provide one are orthogonal, false
* otherwise
*/
public boolean isOrthogonalTo(Vector other) {
return getSimilarity(other) == 0;
}
/**
* Checks whether this vector has a horizontal component.
*
* @return true if x != 0, false otherwise.
*/
public boolean isHorizontal() {
return x != 0;
}
/**
* Checks whether this vector has a vertical component.
*
* @return true if y != 0, false otherwise.
*/
public boolean isVertical() {
return y != 0;
}
/**
* Checks whether this vector equals (0,0);
*
* @return true if x == 0 and y == 0.
*/
public boolean isNull() {
return equals(NULL);
}
/**
* Returns a point representation of this Vector.
*
* @return a PrecisionPoint representation
*/
public PrecisionPoint toPoint() {
return new PrecisionPoint(x, y);
}
/**
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "(" + x + "," + y + ")";//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
}
/**
* @see java.lang.Object#equals(Object)
*/
@Override
public boolean equals(Object obj) {
if (obj == this)
return true;
if (obj instanceof Vector) {
Vector r = (Vector) obj;
return x == r.x && y == r.y;
}
return false;
}
/**
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
return (int) x + (int) y;
}
}
| 28.808955
| 120
| 0.574034
|
be6bb31d2c31cadd10a2cbca5cd6fdfbcbcb2f4d
| 2,356
|
package org.metaborg.sdf2table.deepconflicts;
import java.io.Serializable;
import java.util.Map;
public final class Context implements Serializable {
private static final long serialVersionUID = -4581589940398341265L;
// label of the production causing the conflict
private final int context;
private final ContextType type;
private final ContextPosition position;
private final long contextBitmap;
public Context(int context, ContextType type, ContextPosition position, final Map<Integer, Integer> leftmostContextsMapping, final Map<Integer, Integer> rightmostContextsMapping) {
this.context = context;
this.type = type;
this.position = position;
if (position == ContextPosition.LEFTMOST && leftmostContextsMapping.containsKey(context)) {
contextBitmap = 1L << leftmostContextsMapping.get(context);
} else if (position == ContextPosition.RIGHTMOST && rightmostContextsMapping.containsKey(context)) {
int offset = leftmostContextsMapping.keySet().size();
contextBitmap = 1L << (rightmostContextsMapping.get(context) + offset);
} else {
contextBitmap = 0L;
}
}
@Override
public String toString() {
return "" + context;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + context;
result = prime * result + ((position == null) ? 0 : position.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if(this == obj)
return true;
if(obj == null)
return false;
if(getClass() != obj.getClass())
return false;
Context other = (Context) obj;
if(context != other.context)
return false;
if(position != other.position)
return false;
if(type != other.type)
return false;
return true;
}
public ContextType getType() {
return type;
}
public ContextPosition getPosition() {
return position;
}
public int getContext() {
return context;
}
public long getContextBitmap() {
return contextBitmap;
}
}
| 29.08642
| 184
| 0.617148
|
4b96d1baae160ff438db394877fa299435f6e619
| 410
|
package com.github.akarazhev.jacademy.jprog.oop.abstraction;
public class TestAbstraction {
public static void main(String[] args) {
int min = Math.min(15, 18); //find min of two numbers
double square = Math.pow(2, 2); //calculate the power of a number
System.out.println("The min of 15 & 18 is: " + min);
System.out.println("The square of 2 is: " + square);
}
}
| 31.538462
| 73
| 0.634146
|
ddbdcc67ac5fb357403fc084bd539cbd9ba85624
| 894
|
package com.mpobjects.bdparsii;
import java.math.MathContext;
import org.junit.Assert;
import org.junit.Test;
import com.mpobjects.bdparsii.eval.Expression;
import com.mpobjects.bdparsii.eval.Parser;
import com.mpobjects.bdparsii.eval.Scope;
import com.mpobjects.bdparsii.eval.Variable;
/**
* Test the expression from the performance test, just to be sure it works.
*/
public class PerfTestExprTest {
@Test
public void testExpression() throws Exception {
Scope scope = new Scope();
scope.setMathContext(MathContext.UNLIMITED);
Variable var = scope.create("x");
Expression expr = Parser.parse("2 + (7 - 5) * 3.14159 * x^(12-10) + sin(-3.141)", scope);
Assert.assertNotNull(expr);
for (int x = 0; x < 1_000_000; ++x) {
var.setValue(x);
expr.evaluate();
}
}
}
| 28.83871
| 98
| 0.630872
|
2f84fe8f76d459f037cefb95ffa53c1c3e477b53
| 257
|
package com.dragovorn.courier.util;
import java.io.InputStream;
public class FileUtil {
public static InputStream getResource(String path) {
return FileUtil.class.getResourceAsStream((path.startsWith("/") ? "" : "/") + path);
}
}
| 25.7
| 93
| 0.669261
|
42fe151a156303bcf3c7eb9af8150ee7225403f1
| 220
|
package ferry.booking.timetable;
public class TimeTableEntry {
public int id;
public int timeTableId;
public int originId;
public int destinationId;
public long time;
public long journeyTime;
}
| 18.333333
| 32
| 0.718182
|
7773b048ceae3249f753a5bf94bee65c4e6543f3
| 3,120
|
package data.model;
import acq.IParagraph;
import data.Database;
public class DataParagraph implements IParagraph {
/**
* ID
*/
private int id;
/**
* Numbber of the paragraph
*/
private int number;
/**
* Title of paragraph
*/
private String title;
/**
* Description of Paragraph
*/
private String description;
/**
* No-Args
*/
public DataParagraph() {
}
/**
* Constructor for dataparagraph
*
* @param number
* @param title
* @param description
*/
public DataParagraph(int number, String title, String description) {
this.number = number;
this.title = title;
this.description = description;
}
/**
* Get id
*
* @return id
*/
public int getID() {
return this.id;
}
/**
* Get number
*
* @return number
*/
@Override
public int getNumber() {
return this.number;
}
/**
* Get title
*
* @return title
*/
@Override
public String getTitle() {
return this.title;
}
/**
* Get Description
*
* @return description
*/
@Override
public String getDescription() {
return this.description;
}
/**
* Set ID
*
* @param id
*/
public void setID(int id) {
this.id = id;
}
/**
* Set number
*
* @param number
*/
@Override
public void setNumber(int number) {
this.number = number;
}
/**
* Set title
*
* @param title
*/
@Override
public void setTitle(String title) {
this.title = title;
}
/**
* Set description
*
* @param description
*/
@Override
public void setDescription(String description) {
this.description = description;
}
/**
* Find paragraph in Database
*
* @param id
* @return paragraph
*/
public static DataParagraph find(int id) {
DataParagraph paragraph = new DataParagraph();
Database.getInstance().query(Database.compose(
"SELECT id, number, title, description",
"FROM paragraphs",
"WHERE id = " + id
),
rs -> {
paragraph.setID(rs.getInt(1));
paragraph.setNumber(rs.getInt(2));
paragraph.setTitle(rs.getString(3));
paragraph.setDescription(rs.getString(4));
}
);
return paragraph;
}
/**
* Save paragraphs to database
*/
public void save() {
String query = null;
if (getID() == 0) {
String[] values = {"" + getNumber(), getTitle(), getDescription()};
query = Database.compose(
"INSERT INTO paragraphs (number, title, description)",
"VALUES('" + String.join("','", values) + "')",
"RETURNING id"
);
} else {
query = Database.compose(
"UPDATE paragraphs SET",
"number = " + getNumber() + ",",
"title = '" + getTitle() + "',",
"description = '" + getDescription() + "'",
"WHERE id = " + getID()
);
}
Database.getInstance().query(query, rs -> {
if (id == 0) {
id = rs.getInt(1);
}
});
}
}
| 17.52809
| 73
| 0.531731
|
945bc2655cf286665f2d2f2284bbb3b1d9a88144
| 5,381
|
/*
* Copyright 2018 cxx
*
* 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 cc.colorcat.adapter;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
/**
* Author: cxx
* Date: 2020-04-27
* GitHub: https://github.com/ccolorcat
*/
public abstract class GroupRvAdapter extends RvAdapter implements GroupableRvAdapter<RvHolder, RvHolder> {
private final GroupRvAdapterDelegate<GroupRvAdapter> mDelegate = new GroupRvAdapterDelegate<>(this);
@Override
public final int getItemViewType(int position) {
return mDelegate.getItemViewType(position);
}
@Override
public final int getItemCount() {
return mDelegate.getItemCount();
}
@Override
public final long getItemId(int position) {
return mDelegate.getItemId(position);
}
@Override
public long getGroupId(int groupPosition) {
return RecyclerView.NO_ID;
}
@Override
public long getGroupItemId(int groupPosition, int groupItemPosition) {
return RecyclerView.NO_ID;
}
@Override
protected final void bindView(@NonNull RvHolder holder, int position) {
mDelegate.bindView(holder, position);
}
@Override
public final void notifyGroupChanged(int groupPosition) {
mDelegate.notifyGroupChanged(groupPosition);
}
@Override
public final void notifyGroupRangeChanged(int groupPositionStart, int groupCount) {
mDelegate.notifyGroupRangeChanged(groupPositionStart, groupCount);
}
@Override
public final void notifyGroupInserted(int groupPosition) {
mDelegate.notifyGroupInserted(groupPosition);
}
@Override
public final void notifyGroupRangeInserted(int groupPositionStart, int groupCount) {
mDelegate.notifyGroupRangeInserted(groupPositionStart, groupCount);
}
@Override
public final void notifyGroupAppended() {
mDelegate.notifyGroupAppended();
}
@Override
public final void notifyGroupRangeAppended(int groupCount) {
mDelegate.notifyGroupRangeAppended(groupCount);
}
@Override
public final void notifyGroupRemoved(int groupPosition, int groupItemCount) {
mDelegate.notifyGroupRemoved(groupPosition, groupItemCount);
}
@Override
public final void notifyGroupRangeRemoved(int groupPositionStart, int itemCount) {
mDelegate.notifyGroupRangeRemoved(groupPositionStart, itemCount);
}
@Override
public final void notifyGroupItemChanged(int groupPosition, int groupItemPosition) {
mDelegate.notifyGroupItemChanged(groupPosition, groupItemPosition);
}
@Override
public final void notifyGroupItemRangeChanged(int groupPosition, int groupItemPositionStart, int groupItemCount) {
mDelegate.notifyGroupItemRangeChanged(groupPosition, groupItemPositionStart, groupItemCount);
}
@Override
public final void notifyGroupItemInserted(int groupPosition, int groupItemPosition) {
mDelegate.notifyGroupItemInserted(groupPosition, groupItemPosition);
}
@Override
public final void notifyGroupItemRangeInserted(int groupPosition, int groupItemPositionStart, int groupItemCount) {
mDelegate.notifyGroupItemRangeInserted(groupPosition, groupItemPositionStart, groupItemCount);
}
@Override
public final void notifyGroupItemAppended(int groupPosition) {
mDelegate.notifyGroupItemAppended(groupPosition);
}
@Override
public final void notifyGroupItemRangeAppended(int groupPosition, int groupItemCount) {
mDelegate.notifyGroupItemRangeAppended(groupPosition, groupItemCount);
}
@Override
public final void notifyGroupItemRemoved(int groupPosition, int groupItemPosition) {
mDelegate.notifyGroupItemRemoved(groupPosition, groupItemPosition);
}
@Override
public final void notifyGroupItemRangeRemoved(int groupPosition, int groupItemPositionStart, int groupItemCount) {
mDelegate.notifyGroupItemRangeRemoved(groupPosition, groupItemPositionStart, groupItemCount);
}
@Override
public final void notifyGroupItemMoved(int fromGroupPosition, int fromGroupItemPosition, int toGroupPosition, int toGroupItemPosition) {
mDelegate.notifyGroupItemMoved(fromGroupPosition, fromGroupItemPosition, toGroupPosition, toGroupItemPosition);
}
public final boolean isGroup(int position) {
return mDelegate.isGroup(position);
}
public final int[] calculateGroupItemPosition(int position) {
return mDelegate.calculateGroupItemPosition(position);
}
public final int calculateSize(int groupCount) {
return mDelegate.calculateSize(groupCount);
}
public final int calculateSize(int groupPositionStart, int groupCount) {
return mDelegate.calculateSize(groupPositionStart, groupCount);
}
}
| 33.42236
| 140
| 0.744657
|
75921043dfa7ab4ffac512ca9f07ed768b0055fe
| 437
|
package br.com.zupacademy.alison.casadocodigo.pais;
import br.com.zupacademy.alison.casadocodigo.compartilhado.anotacoes.CampoUnico;
import javax.validation.constraints.NotBlank;
public class PaisRequest {
@NotBlank
@CampoUnico(fieldName = "nome", domainClass = Pais.class)
private String nome;
public String getNome() {
return nome;
}
public Pais toModel() {
return new Pais(nome);
}
}
| 20.809524
| 80
| 0.704805
|
8ef943dfc5b58b37d3dcf34f46e9e7629dcacd77
| 1,725
|
package net.mostlyoriginal.game.system.view;
import com.artemis.annotations.Wire;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.utils.Json;
import net.mostlyoriginal.api.manager.AbstractAssetSystem;
import net.mostlyoriginal.game.component.SpriteData;
import net.mostlyoriginal.game.system.render.SpriteLibrary;
/**
* @author Daan van Yperen
*/
@Wire
public class FeatureScreenAssetSystem extends AbstractAssetSystem {
public static final int LOGO_WIDTH = 276;
private SpriteLibrary spriteLibrary;
public static final int LOGO_HEIGHT = 109;
public static final int FEATURE_WIDTH = 21;
public static final int FEATURE_HEIGHT = 21;
public static final int BACKGROUND_WIDTH = 125;
public static final int BACKGROUND_HEIGHT = 58;
public FeatureScreenAssetSystem() {
super("tileset.png");
}
@Override
protected void initialize() {
super.initialize();
loadSprites();
}
@Override
public Animation get(String identifier) {
return super.get(identifier);
}
private void loadSprites() {
final Json json = new Json();
spriteLibrary = json.fromJson(SpriteLibrary.class, Gdx.files.internal("sprites.json"));
for (SpriteData sprite : spriteLibrary.sprites) {
Animation animation = add(sprite.id, sprite.x, sprite.y, sprite.width, sprite.height, sprite.countX, sprite.countY, this.tileset, sprite.milliseconds * 0.001f);
if (!sprite.repeat) {
animation.setPlayMode(Animation.PlayMode.NORMAL);
} else animation.setPlayMode(Animation.PlayMode.LOOP);
}
}
}
| 31.944444
| 172
| 0.706667
|
f9d35ac283aec6a7a2866060c3e3aa8f94140c16
| 1,672
|
package cn.iocoder.springcloud.labx03.feigndemo.provider.controller;
import cn.iocoder.springcloud.labx03.feigndemo.provider.api.ProviderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class ProviderController implements ProviderService {
private Logger logger = LoggerFactory.getLogger(ProviderController.class);
@Value("${server.port}")
private Integer serverPort;
@Override
@GetMapping("/echo")
public String echo(String name) {
// 模拟执行 100ms 时长。方便后续我们测试请求超时
try {
Thread.sleep(100L);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
// 记录被调用的日志
logger.info("[echo][被调用啦 name({})]", name);
return serverPort + "-provider:" + name;
}
@Override
@GetMapping("/echoTimeout")
public String echoTimeout(String name) {
try {
Thread.sleep(2100L);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
// 记录被调用的日志
logger.info("[echoTimeout][被调用啦 name({})]", name);
return serverPort + "-provider:" + name;
}
// @GetMapping("/echo")
// public String echo(String name) throws InterruptedException {
// // 模拟执行 100ms 时长。方便后续我们测试请求超时
// Thread.sleep(100L);
//
// // 记录被调用的日志
// logger.info("[echo][被调用啦 name({})]", name);
//
// return serverPort + "-provider:" + name;
// }
}
| 27.866667
| 78
| 0.64055
|
1c10be8425d9f1b4df61e43f64157435a5a7b38d
| 506
|
package cn.torna.tornaexample.controller.product.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author liujie
*/
@ApiModel(value = "问卷的问题及选项")
@Data
public class SurveyQuestionOptions {
@ApiModelProperty(value="问题")
private SurveyQuestion question;
@ApiModelProperty(value="问题所有的可选项")
private List<SurveyOption> options;
@ApiModelProperty(value="当前用户输入的文本答案/只有填空题才有")
private String optionText;
}
| 20.24
| 52
| 0.784585
|
0d0162b23f9dccc255ad56c1cadffbb1818e2e4d
| 505
|
package com.theplatform.server.repositories;
import com.theplatform.server.models.Role;
import com.theplatform.server.models.User;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface UserRepository extends CrudRepository<User, Long> {
User findByUsername(String username);
User findByEmail(String email);
User findByPasswordResetCode(String code);
};
| 33.666667
| 68
| 0.823762
|
e57ce109402a816710308e1852c4dbdce90aeb94
| 677
|
package com.ini.mac.vo;
/**
* Created by ou on 2018/4/15/015.
*/
public class MeAndCatSaveVo {
private String myBehavior;
private String catBehavior;
private int attitude;
public String getMyBehavior() {
return myBehavior;
}
public void setMyBehavior(String myBehavior) {
this.myBehavior = myBehavior;
}
public String getCatBehavior() {
return catBehavior;
}
public void setCatBehavior(String catBehavior) {
this.catBehavior = catBehavior;
}
public int getAttitude() {
return attitude;
}
public void setAttitude(int attitude) {
this.attitude = attitude;
}
}
| 18.297297
| 52
| 0.636632
|
6da441d0aafaa4d08841580c72f17be912a61bc5
| 608
|
package com.baeldung.service.locator;
/**
* Created by Gebruiker on 4/20/2018.
*/
public class ServiceLocator {
private static Cache cache;
static {
cache = new Cache();
}
public static MessagingService getService(String serviceName){
MessagingService service = cache.getService(serviceName);
if(service != null){
return service;
}
InitialContext context = new InitialContext();
MessagingService service1 = (MessagingService)context.lookup(serviceName);
cache.addService(service1);
return service1;
}
}
| 21.714286
| 82
| 0.649671
|
071f94b4b0e3d55f469d512a8da556a985f8c58b
| 1,503
|
package atonkish.quartzelv.mixin;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.World;
import atonkish.quartzelv.QuartzElevatorMod;
import atonkish.quartzelv.utils.MixinUtil;
@Mixin(LivingEntity.class)
public abstract class LivingEntityMixin extends Entity {
public LivingEntityMixin(EntityType<?> type, World world) {
super(type, world);
}
@Inject(at = @At("HEAD"), method = "jump", cancellable = true)
private void jump(CallbackInfo info) {
if (!QuartzElevatorMod.CONFIG.isPlayerOnly || this.getClass().equals(ServerPlayerEntity.class)) {
// `isPlayerOnly`: false -> all entities can teleport
// `isPlayerOnly`: true -> only player entities can teleport
MixinUtil.teleportUp(world, getBlockPos(), getBoundingBox(), (Double y) -> {
if (world instanceof ServerWorld) {
refreshPositionAfterTeleport(getX(), y, getZ());
} else {
teleport(getX(), y, getZ());
}
return (Void) null;
});
}
}
}
| 37.575
| 105
| 0.680639
|
46a764077f5ad3723a83df42b1088284f0ee8b39
| 1,783
|
package com.ricelink.cas.managed.mapper.model;
import java.util.Date;
import javax.persistence.*;
@Table(name = "login_logout_log")
public class LoginLogoutLog {
@Id
@Column(name = "ID")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* login 登陆,logout 登出
*/
@Column(name = "TYPE")
private String type;
@Column(name = "USER_NAME")
private String userName;
@Column(name = "SERVICE_ID")
private String serviceId;
@Column(name = "CREATE_DATE")
private Date createDate;
/**
* @return ID
*/
public Integer getId() {
return id;
}
/**
* @param id
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取login 登陆,logout 登出
*
* @return TYPE - login 登陆,logout 登出
*/
public String getType() {
return type;
}
/**
* 设置login 登陆,logout 登出
*
* @param type login 登陆,logout 登出
*/
public void setType(String type) {
this.type = type;
}
/**
* @return USER_NAME
*/
public String getUserName() {
return userName;
}
/**
* @param userName
*/
public void setUserName(String userName) {
this.userName = userName;
}
/**
* @return SERVICE_ID
*/
public String getServiceId() {
return serviceId;
}
/**
* @param serviceId
*/
public void setServiceId(String serviceId) {
this.serviceId = serviceId;
}
/**
* @return CREATE_DATE
*/
public Date getCreateDate() {
return createDate;
}
/**
* @param createDate
*/
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
}
| 17.653465
| 55
| 0.547953
|
84fac591a328cfa4945e06d829cbc4ed4fd71346
| 208
|
package hello;
import java.util.List;
public interface GameService {
List<Game> getAllGames();
Game getGameById(int GameId);
List<GameDisplayData> getAllGamesDisplay();
public int addGame(Game game);
}
| 18.909091
| 44
| 0.769231
|
e38d8b0bba69b4d3322afa23a06bed8e271d1714
| 10,967
|
package com.squarespace.cldrengine.locale;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.squarespace.cldrengine.api.LanguageTag;
import com.squarespace.cldrengine.api.Pair;
import com.squarespace.cldrengine.internal.LocaleExternalData;
import com.squarespace.cldrengine.utils.StringUtils;
public class LocaleResolver {
private static final LanguageTag UND = new LanguageTag();
// Markers that let us quickly determine that a given FastTag field is undefined,
// while still having the ability to call equals() and hashCode() on it.
private static final Integer LANGUAGE = 0;
private static final Integer SCRIPT = 1;
private static final Integer REGION = 2;
private static Map<FastTag, FastTag> LIKELY_SUBTAGS_MAP = loadLikelySubtags();
private static Map<String, List<Pair<FastTag, FastTag>>> LANGUAGE_ALIAS_MAP = loadLanguageAliases();
// Field flags for match order
private static int F_LANGUAGE = 1;
private static int F_SCRIPT = 2;
private static int F_REGION = 4;
// Order to match subtags for "add likely subtags" process
private static int[] MATCH_ORDER = new int[] {
F_LANGUAGE | F_SCRIPT | F_REGION,
F_LANGUAGE | F_REGION,
F_LANGUAGE | F_SCRIPT,
F_LANGUAGE,
F_SCRIPT
};
/**
* Substitute all relevant language and region aliases, and then add likely subtags.
*/
public static LanguageTag resolve(String str) {
LanguageTag tag = LanguageTagParser.parse(str);
return resolve(tag);
}
/**
* Substitute all relevant language and region aliases, and then add likely subtags.
*/
public static LanguageTag resolve(LanguageTag tag) {
FastTag fast = new FastTag(tag);
substituteLanguageAliases(fast);
substituteRegionAliases(fast);
addLikelySubtags(fast);
return returnTag(tag, fast);
}
/**
* Add any missing subtags using the likely subtags mapping. For example, this would convert "en" to "en-Latn-US".
*/
public static LanguageTag addLikelySubtags(String str) {
LanguageTag tag = LanguageTagParser.parse(str);
return addLikelySubtags(tag);
}
/**
* Add any missing subtags using the likely subtags mapping. For example, this would convert "en" to "en-Latn-US".
*/
public static LanguageTag addLikelySubtags(LanguageTag tag) {
FastTag fast = new FastTag(tag);
addLikelySubtags(fast);
return returnTag(tag, fast);
}
/**
* Remove any subtags that would be added by addLikelySubtags(). For example, this would convert "en-Latn-US" to "en".
*/
public static LanguageTag removeLikelySubtags(String str) {
LanguageTag tag = LanguageTagParser.parse(str);
return removeLikelySubtags(tag);
}
/**
* Remove any subtags that would be added by addLikelySubtags(). For example, this would convert "en-Latn-US" to "en".
*/
public static LanguageTag removeLikelySubtags(LanguageTag tag) {
FastTag max = new FastTag(tag);
if (max.language == LANGUAGE || max.script == SCRIPT || max.region == REGION) {
addLikelySubtags(max);
}
FastTag tmp = new FastTag(UND);
// Using "en-Latn-US" as an example...
// 1. Match "en-Zzzz-ZZ"
tmp.language = max.language;
FastTag match = new FastTag(tmp);
addLikelySubtags(match);
if (max.equals(match)) {
return returnTag(tag, tmp);
}
// 2. Match "en-Zzzz-US"
tmp.region = max.region;
match = new FastTag(tmp);
addLikelySubtags(match);
if (max.equals(match)) {
tmp.language = max.language;
return returnTag(tag, tmp);
}
// 3. Match "en-Latn-ZZ"
tmp.region = REGION;
tmp.script = max.script;
match = new FastTag(tmp);
addLikelySubtags(match);
if (max.equals(match)) {
return returnTag(tag, tmp);
}
// 4. Nothing matched, so return a copy of the original tag.
return returnTag(tag, max);
}
/**
* Add any missing subtags using the likely subtags mapping. For example, this would convert "en" to "en-Latn-US".
*/
private static void addLikelySubtags(FastTag fast) {
FastTag tmp = new FastTag(fast);
for (int i = 0; i < MATCH_ORDER.length; i++) {
int flags = MATCH_ORDER[i];
tmp.setFields(fast, flags);
FastTag match = LIKELY_SUBTAGS_MAP.get(tmp);
if (match != null) {
if (fast.language == LANGUAGE) {
fast.language = match.language;
}
if (fast.script == SCRIPT) {
fast.script = match.script;
}
if (fast.region == REGION) {
fast.region = match.region;
}
break;
}
}
}
/**
* Return a new language tag that combines the core fields of the fast tag, with the variant, extensions, and private
* use field of the original.
*/
private static LanguageTag returnTag(LanguageTag orig, FastTag fast) {
return new LanguageTag(
fast.language == LANGUAGE ? null : (String)fast.language,
fast.script == SCRIPT ? null : (String)fast.script,
fast.region == REGION ? null : (String)fast.region,
orig.variant(),
orig.extensions(),
orig.privateUse(),
orig.extlangs());
}
/**
* Lookup any aliases that match this tag, and replace any undefined subtags.
*/
private static void substituteLanguageAliases(FastTag dst) {
List<Pair<FastTag, FastTag>> aliases = LANGUAGE_ALIAS_MAP.get(dst.language);
if (aliases == null) {
return;
}
for (int i = 0; i < aliases.size(); i++) {
Pair<FastTag, FastTag> alias = aliases.get(i);
FastTag type = alias._1;
FastTag repl = alias._2;
boolean exact = type.language.equals(repl.language)
&& type.script.equals(repl.script)
&& type.region.equals(repl.region);
if ((type.script == SCRIPT && type.region == REGION) || exact) {
dst.language = repl.language;
if (dst.script == SCRIPT) {
dst.script = repl.script;
}
if (dst.region == REGION) {
dst.region = repl.region;
}
break;
}
}
}
/**
* Replace the tag's region if it has a preferred value.
*/
private static void substituteRegionAliases(FastTag dst) {
if (dst.region != REGION) {
List<String> regions = Utils.REGION_ALIAS_MAP.get(dst.region);
if (regions != null) {
// TODO: we currently use only the first region. See note in Typescript
// cldr-engine project.
dst.region = regions.get(0);
}
}
}
private static FastTag parseFastTag(String str) {
List<String> p = StringUtils.split(str, '-');
String language = p.get(0);
String script = "1";
String region = "2";
if (p.size() > 1) {
String e = p.get(1);
if (!StringUtils.isEmpty(e)) {
script = e;
}
}
if (p.size() > 2) {
String e = p.get(2);
if (!StringUtils.isEmpty(e)) {
region = e;
}
}
return new FastTag(language, script, region);
}
/**
* Holds core fields of a language tag for faster manipulation.
*/
static class FastTag {
Object language;
Object script;
Object region;
FastTag(LanguageTag tag) {
this.language = tag.hasLanguage() ? tag.language() : LANGUAGE;
this.script = tag.hasScript() ? tag.script() : SCRIPT;
this.region = tag.hasRegion() ? tag.region() : REGION;
// If an extlang subtag exists, replace the language subtag with the first
// extlang value.
List<String> extlangs = tag.extlangs();
if (!extlangs.isEmpty()) {
this.language = extlangs.get(0);
}
}
FastTag(String language, String script, String region) {
this.language = language.equals("0") ? LANGUAGE : language;
this.script = script.equals("1") ? SCRIPT : script;
this.region = region.equals("2") ? REGION : region;
}
FastTag(FastTag tag) {
this.language = tag.language;
this.script = tag.script;
this.region = tag.region;
}
void setFields(FastTag src, int flags) {
this.language = (flags & F_LANGUAGE) == 0 ? LANGUAGE : src.language;
this.script = (flags & F_SCRIPT) == 0 ? SCRIPT : src.script;
this.region = (flags & F_REGION) == 0 ? REGION : src.region;
}
@Override
public boolean equals(Object other) {
if (other instanceof FastTag) {
FastTag o = (FastTag)other;
return this.language.equals(o.language)
&& this.script.equals(o.script)
&& this.region.equals(o.region);
}
return false;
}
@Override
public int hashCode() {
int result = 1;
result = 31 * result + this.language.hashCode();
result = 31 * result + this.script.hashCode();
result = 31 * result + this.region.hashCode();
return result;
}
@Override
public String toString() {
return "FastTag(" + this.language + ", " + this.script + ", " + this.region + ")";
}
}
private static Map<FastTag, FastTag> loadLikelySubtags() {
Map<FastTag, FastTag> map = new HashMap<>();
JsonObject root = JsonParser.parseString(LocaleExternalData.LIKELYSUBTAGS).getAsJsonObject();
JsonArray scriptnames = root.get("_").getAsJsonArray();
for (String language : root.keySet()) {
if (language.equals("_")) {
continue;
}
JsonObject scripts = root.get(language).getAsJsonObject();
for (String script : scripts.keySet()) {
JsonObject regions = scripts.get(script).getAsJsonObject();
for (String region : regions.keySet()) {
String raw = regions.get(region).getAsString();
List<String> parts = StringUtils.split(raw, '-');
String l = parts.get(0);
String s = parts.get(1);
String r = parts.get(2);
if (l.isEmpty()) {
l = language;
}
if (r.isEmpty()) {
r = region;
}
if (!s.isEmpty()) {
s = scriptnames.get(Integer.parseInt(s, 10)).getAsString();
}
FastTag key = new FastTag(language, script, region);
FastTag val = new FastTag(l, s, r);
map.put(key, val);
}
}
}
return map;
}
private static Map<String, List<Pair<FastTag, FastTag>>> loadLanguageAliases() {
Map<String, List<Pair<FastTag, FastTag>>> map = new HashMap<>();
for (String row : LocaleExternalData.LANGUAGEALIASRAW.split("\\|")) {
String[] parts = row.split(":");
FastTag type = parseFastTag(parts[0]);
FastTag repl = parseFastTag(parts[1]);
String language = type.language.toString();
List<Pair<FastTag, FastTag>> pairs = map.get(language);
if (pairs == null) {
pairs = new ArrayList<>();
map.put(language, pairs);
}
pairs.add(Pair.of(type, repl));
}
return map;
}
}
| 31.067989
| 120
| 0.623598
|
8df7ad8969dcba4d34660dd8f623842cf7d85002
| 306
|
package egger.software.ah_generics;
public class Box {
private Object content;
public Box(Object content) {
this.content = content;
}
public Object getContent() {
return content;
}
public void setContent(Object content) {
this.content = content;
}
}
| 17
| 44
| 0.624183
|
6ee1394aaa0214a0a9de43ff397d9af347cc87bb
| 10,850
|
/*
* 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.ranger.view;
/**
* Logging table for all DB create and update queries
*
*/
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.ranger.common.RangerConstants;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.map.annotate.JsonSerialize;
@JsonAutoDetect(getterVisibility=Visibility.NONE, setterVisibility=Visibility.NONE, fieldVisibility=Visibility.ANY)
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL )
@JsonIgnoreProperties(ignoreUnknown=true)
@XmlRootElement
public class VXTrxLog extends VXDataObject implements java.io.Serializable {
private static final long serialVersionUID = 1L;
/**
* Name of the class to which the object id belongs to
* This attribute is of type enum CommonEnums::ClassTypes
*/
protected int objectClassType = RangerConstants.CLASS_TYPE_NONE;
/**
* Id of the object to which this notes refers to
*/
protected Long objectId;
/**
* Object Id of the parent object
*/
protected Long parentObjectId;
/**
* Object Class Type of the parent object
*/
protected int parentObjectClassType;
/**
* Name of the parent object name that was changed
*/
protected String parentObjectName;
/**
* Name of the object name that was changed
*/
protected String objectName;
/**
* Name of the attribute that was changed
*/
protected String attributeName;
/**
* Previous value
*/
protected String previousValue;
/**
* New value
*/
protected String newValue;
/**
* Transaction id
*/
protected String transactionId;
/**
* Action of the transaction
*/
protected String action;
/**
* Session Id
*/
protected String sessionId;
/**
* Request Id
*/
protected String requestId;
/**
* Session Type
*/
protected String sessionType;
/**
* Default constructor. This will set all the attributes to default value.
*/
public VXTrxLog ( ) {
objectClassType = RangerConstants.CLASS_TYPE_NONE;
}
/**
* This method sets the value to the member attribute <b>objectClassType</b>.
* You cannot set null to the attribute.
* @param objectClassType Value to set member attribute <b>objectClassType</b>
*/
public void setObjectClassType( int objectClassType ) {
this.objectClassType = objectClassType;
}
/**
* Returns the value for the member attribute <b>objectClassType</b>
* @return int - value of member attribute <b>objectClassType</b>.
*/
public int getObjectClassType( ) {
return this.objectClassType;
}
/**
* This method sets the value to the member attribute <b>objectId</b>.
* You cannot set null to the attribute.
* @param objectId Value to set member attribute <b>objectId</b>
*/
public void setObjectId( Long objectId ) {
this.objectId = objectId;
}
/**
* Returns the value for the member attribute <b>objectId</b>
* @return Long - value of member attribute <b>objectId</b>.
*/
public Long getObjectId( ) {
return this.objectId;
}
/**
* This method sets the value to the member attribute <b>parentObjectId</b>.
* You cannot set null to the attribute.
* @param parentObjectId Value to set member attribute <b>parentObjectId</b>
*/
public void setParentObjectId( Long parentObjectId ) {
this.parentObjectId = parentObjectId;
}
/**
* Returns the value for the member attribute <b>parentObjectId</b>
* @return Long - value of member attribute <b>parentObjectId</b>.
*/
public Long getParentObjectId( ) {
return this.parentObjectId;
}
/**
* This method sets the value to the member attribute <b>parentObjectClassType</b>.
* You cannot set null to the attribute.
* @param parentObjectClassType Value to set member attribute <b>parentObjectClassType</b>
*/
public void setParentObjectClassType( int parentObjectClassType ) {
this.parentObjectClassType = parentObjectClassType;
}
/**
* Returns the value for the member attribute <b>parentObjectClassType</b>
* @return int - value of member attribute <b>parentObjectClassType</b>.
*/
public int getParentObjectClassType( ) {
return this.parentObjectClassType;
}
/**
* This method sets the value to the member attribute <b>parentObjectName</b>.
* You cannot set null to the attribute.
* @param parentObjectName Value to set member attribute <b>parentObjectName</b>
*/
public void setParentObjectName( String parentObjectName ) {
this.parentObjectName = parentObjectName;
}
/**
* Returns the value for the member attribute <b>parentObjectName</b>
* @return String - value of member attribute <b>parentObjectName</b>.
*/
public String getParentObjectName( ) {
return this.parentObjectName;
}
/**
* This method sets the value to the member attribute <b>objectName</b>.
* You cannot set null to the attribute.
* @param objectName Value to set member attribute <b>objectName</b>
*/
public void setObjectName( String objectName ) {
this.objectName = objectName;
}
/**
* Returns the value for the member attribute <b>objectName</b>
* @return String - value of member attribute <b>objectName</b>.
*/
public String getObjectName( ) {
return this.objectName;
}
/**
* This method sets the value to the member attribute <b>attributeName</b>.
* You cannot set null to the attribute.
* @param attributeName Value to set member attribute <b>attributeName</b>
*/
public void setAttributeName( String attributeName ) {
this.attributeName = attributeName;
}
/**
* Returns the value for the member attribute <b>attributeName</b>
* @return String - value of member attribute <b>attributeName</b>.
*/
public String getAttributeName( ) {
return this.attributeName;
}
/**
* This method sets the value to the member attribute <b>previousValue</b>.
* You cannot set null to the attribute.
* @param previousValue Value to set member attribute <b>previousValue</b>
*/
public void setPreviousValue( String previousValue ) {
this.previousValue = previousValue;
}
/**
* Returns the value for the member attribute <b>previousValue</b>
* @return String - value of member attribute <b>previousValue</b>.
*/
public String getPreviousValue( ) {
return this.previousValue;
}
/**
* This method sets the value to the member attribute <b>newValue</b>.
* You cannot set null to the attribute.
* @param newValue Value to set member attribute <b>newValue</b>
*/
public void setNewValue( String newValue ) {
this.newValue = newValue;
}
/**
* Returns the value for the member attribute <b>newValue</b>
* @return String - value of member attribute <b>newValue</b>.
*/
public String getNewValue( ) {
return this.newValue;
}
/**
* This method sets the value to the member attribute <b>transactionId</b>.
* You cannot set null to the attribute.
* @param transactionId Value to set member attribute <b>transactionId</b>
*/
public void setTransactionId( String transactionId ) {
this.transactionId = transactionId;
}
/**
* Returns the value for the member attribute <b>transactionId</b>
* @return String - value of member attribute <b>transactionId</b>.
*/
public String getTransactionId( ) {
return this.transactionId;
}
/**
* This method sets the value to the member attribute <b>action</b>.
* You cannot set null to the attribute.
* @param action Value to set member attribute <b>action</b>
*/
public void setAction( String action ) {
this.action = action;
}
/**
* Returns the value for the member attribute <b>action</b>
* @return String - value of member attribute <b>action</b>.
*/
public String getAction( ) {
return this.action;
}
/**
* This method sets the value to the member attribute <b>sessionId</b>.
* You cannot set null to the attribute.
* @param sessionId Value to set member attribute <b>sessionId</b>
*/
public void setSessionId( String sessionId ) {
this.sessionId = sessionId;
}
/**
* Returns the value for the member attribute <b>sessionId</b>
* @return String - value of member attribute <b>sessionId</b>.
*/
public String getSessionId( ) {
return this.sessionId;
}
/**
* This method sets the value to the member attribute <b>requestId</b>.
* You cannot set null to the attribute.
* @param requestId Value to set member attribute <b>requestId</b>
*/
public void setRequestId( String requestId ) {
this.requestId = requestId;
}
/**
* Returns the value for the member attribute <b>requestId</b>
* @return String - value of member attribute <b>requestId</b>.
*/
public String getRequestId( ) {
return this.requestId;
}
/**
* This method sets the value to the member attribute <b>sessionType</b>.
* You cannot set null to the attribute.
* @param sessionType Value to set member attribute <b>sessionType</b>
*/
public void setSessionType( String sessionType ) {
this.sessionType = sessionType;
}
/**
* Returns the value for the member attribute <b>sessionType</b>
* @return String - value of member attribute <b>sessionType</b>.
*/
public String getSessionType( ) {
return this.sessionType;
}
/**
* This return the bean content in string format
* @return formatedStr
*/
public String toString( ) {
String str = "VXTrxLog={";
str += super.toString();
str += "objectClassType={" + objectClassType + "} ";
str += "objectId={" + objectId + "} ";
str += "parentObjectId={" + parentObjectId + "} ";
str += "parentObjectClassType={" + parentObjectClassType + "} ";
str += "parentObjectName={" + parentObjectName + "} ";
str += "objectName={" + objectName + "} ";
str += "attributeName={" + attributeName + "} ";
str += "previousValue={" + previousValue + "} ";
str += "newValue={" + newValue + "} ";
str += "transactionId={" + transactionId + "} ";
str += "action={" + action + "} ";
str += "sessionId={" + sessionId + "} ";
str += "requestId={" + requestId + "} ";
str += "sessionType={" + sessionType + "} ";
str += "}";
return str;
}
}
| 29.245283
| 115
| 0.703779
|
30972736ede50fec239547ee35fa457f52343db1
| 400
|
package org.planeswalker.base;
/**
* 页面枚举类
* @author Planeswalker23
* @date Created in 2020/3/3
*/
public enum Templates {
/**
* 登录页面
*/
LOGIN("login"),
/**
* 错误页面
*/
ERROR("error");
/**
* 模板名称
*/
private String name;
Templates(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
| 12.903226
| 30
| 0.495
|
e3b5ca06f49fe9b3af6064026240ff447d94d096
| 1,581
|
package me.limeglass.khoryl.elements.block.banner;
import org.bukkit.block.Banner;
import org.bukkit.event.Event;
import org.eclipse.jdt.annotation.Nullable;
import ch.njol.skript.Skript;
import ch.njol.skript.classes.Changer.ChangeMode;
import ch.njol.skript.doc.Description;
import ch.njol.skript.doc.Name;
import ch.njol.skript.doc.Since;
import ch.njol.skript.util.Color;
import ch.njol.skript.util.SkriptColor;
import ch.njol.skript.util.Version;
import ch.njol.util.coll.CollectionUtils;
import me.limeglass.khoryl.lang.BlockStatePropertyExpression;
@Name("Banner base Color")
@Description("Get the base color of a banner.")
@Since("1.0.3")
public class ExprBannerBaseColour extends BlockStatePropertyExpression<Banner, Color> {
static {
if (!Skript.getMinecraftVersion().isSmallerThan(new Version(1, 8)))
register(ExprBannerBaseColour.class, Color.class, "[banner] base colo[u]r", "blocks");
}
@Override
@Nullable
protected Color grab(Banner banner) {
return SkriptColor.fromDyeColor(banner.getBaseColor());
}
@Override
protected String getPropertyName() {
return "base colour";
}
@Nullable
@Override
public Class<?>[] acceptChange(ChangeMode mode) {
if (mode == ChangeMode.SET)
return CollectionUtils.array(SkriptColor.class);
return null;
}
@Override
public void change(Event event, @Nullable Object[] delta, ChangeMode mode) {
if (delta[0] == null)
return;
SkriptColor colour = (SkriptColor) delta[0];
for (Banner banner : getBlockStates(event)) {
banner.setBaseColor(colour.asDyeColor());
banner.update();
}
}
}
| 26.79661
| 89
| 0.753321
|
10e19d2698b9714157cfbfdba10da76f65a92dc1
| 4,770
|
/**
* Copyright 2014-2020 [fisco-dev]
*
* <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.fisco.bcos.sdk.utils;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import org.fisco.bcos.sdk.utils.exceptions.DecoderException;
import org.fisco.bcos.sdk.utils.exceptions.EncoderException;
/** Utility class for converting hex data to bytes and back again. */
public class Hex {
private static final HexEncoder encoder = new HexEncoder();
public static String toHexString(byte[] data) {
return toHexString(data, 0, data.length);
}
public static String toHexString(byte[] data, int off, int length) {
byte[] encoded = encode(data, off, length);
return StringUtils.fromByteArray(encoded);
}
/**
* encode the input data producing a Hex encoded byte array.
*
* @param data the input data
* @return a byte array containing the Hex encoded data.
*/
public static byte[] encode(byte[] data) {
return encode(data, 0, data.length);
}
/**
* encode the input data producing a Hex encoded byte array.
*
* @param data the input byte array
* @param off the offset of the data to be converted
* @param length the length of the data to be converted
* @return a byte array containing the Hex encoded data.
*/
public static byte[] encode(byte[] data, int off, int length) {
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
try {
encoder.encode(data, off, length, bOut);
} catch (Exception e) {
throw new EncoderException("exception encoding Hex string: " + e.getMessage(), e);
}
return bOut.toByteArray();
}
/**
* Hex encode the byte data writing it to the given output stream.
*
* @param data the byte array
* @param out the output stream
* @throws IOException the I/O exception
* @return the number of bytes produced.
*/
public static int encode(byte[] data, OutputStream out) throws IOException {
return encoder.encode(data, 0, data.length, out);
}
/**
* Hex encode the byte data writing it to the given output stream.
*
* @param data the byte array
* @param off the offset of the data to be converted
* @param length the length of the data to be converted
* @param out the output stream
* @throws IOException the I/O exception
* @return the number of bytes produced.
*/
public static int encode(byte[] data, int off, int length, OutputStream out)
throws IOException {
return encoder.encode(data, off, length, out);
}
/**
* decode the Hex encoded input data. It is assumed the input data is valid.
*
* @param data the input byte array
* @return a byte array representing the decoded data.
*/
public static byte[] decode(byte[] data) {
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
try {
encoder.decode(data, 0, data.length, bOut);
} catch (Exception e) {
throw new DecoderException("exception decoding Hex data: " + e.getMessage(), e);
}
return bOut.toByteArray();
}
/**
* decode the Hex encoded String data - whitespace will be ignored.
*
* @param data the input byte array
* @return a byte array representing the decoded data.
*/
public static byte[] decode(String data) {
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
try {
encoder.decode(data, bOut);
} catch (Exception e) {
throw new DecoderException("exception decoding Hex string: " + e.getMessage(), e);
}
return bOut.toByteArray();
}
/**
* decode the Hex encoded String data writing it to the given output stream, whitespace
* characters will be ignored.
*
* @param data the input byte array
* @param out the output stream
* @throws IOException the I/O exception
* @return the number of bytes produced.
*/
public static int decode(String data, OutputStream out) throws IOException {
return encoder.decode(data, out);
}
}
| 33.829787
| 99
| 0.649686
|
4654d0d490dfe9f8b5939337a5a69a0231a162f4
| 1,432
|
package uk.ac.nott.cs.g53dia.library;
/**
* Action which delivers water from the tanker to a station.
*
* @author Julian Zappala
*/
/*
* Copyright (c) 2011 Julian Zappala (jxz@cs.nott.ac.uk)
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
public class DeliverWaterAction implements Action {
Task task;
public DeliverWaterAction(Task t) {
task = t;
}
public void execute(Environment env, Tanker tank)
throws ActionFailedException
{
if (task.isComplete()) {
throw new ActionFailedException("DeliverWater: Task already complete");
}
if (!(tank.getPosition().equals(task.getStationPosition()))) {
throw new ActionFailedException("DeliverWater: Not at Station");
}
if (tank.waterLevel <= 0) {
throw new ActionFailedException("DeliverWater: Not Enough Water");
}
if (tank.waterLevel >= task.getRequired()) {
tank.waterLevel -= task.getRequired();
task.supply(task.getRequired());
}
else {
task.supply(tank.waterLevel);
tank.waterLevel = 0;
}
if (task.isComplete()) {
tank.incCompleted();
tank.waterDelivered+=task.demand;
}
}
public String toString() {
return "DeliverWater";
}
}
| 23.866667
| 78
| 0.60405
|
315430bfa1e85ea1f51a12d6aa444987c6afc8e9
| 1,100
|
package com.peony.core.control.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 定时更新器。
* <p>
* 添加此注解的方法将在每隔一段时间被调用一次。提供了两种调用策略,一种是每隔一个固定
* 的时间执行一次,一种是通过一个<tt>CronExpression</tt>表达式来定义执行的时间。
* <p>
* 对应的方法满足:1、一个<code>int</code>参数,代表与上一次执行的时间间隔。2、返回值
* 为void。比如:
* <pre>
* public void updatable(int cycle){...}
* </pre>
* <p>
* <strong>该注解对应方法由系统加载,必须在{@link Service}中声明</strong>
*
* @author zhengyuzhen
* @see com.peony.core.control.update.UpdateService
* @see Service
* @since 1.0
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Updatable {
/**
* 启动是否执行一次,在<tt>cycle</tt>生效时生效
*/
boolean doOnStart() default false;
/**
* 更新周期,毫秒计。该参数与<tt>cronExpression</tt>至少要设置一个
*/
int cycle() default -1;
/**
* cronExpression表达式。
* 该参数与<tt>cycle</tt>至少要设置一个。如果设置了该参数,<tt>cycle</tt>不再生效,
* <tt>doOnStart</tt>也不再生效
*/
String cronExpression() default "";
}
| 22.44898
| 61
| 0.675455
|
648825b76f4f21cb65eed04fa45ec254b5063047
| 5,647
|
/*
* XML Type: CT_DPt
* Namespace: http://schemas.openxmlformats.org/drawingml/2006/chart
* Java type: org.openxmlformats.schemas.drawingml.x2006.chart.CTDPt
*
* Automatically generated - do not modify.
*/
package org.openxmlformats.schemas.drawingml.x2006.chart;
import org.apache.xmlbeans.impl.schema.ElementFactory;
import org.apache.xmlbeans.impl.schema.AbstractDocumentFactory;
import org.apache.xmlbeans.impl.schema.DocumentFactory;
import org.apache.xmlbeans.impl.schema.SimpleTypeFactory;
/**
* An XML CT_DPt(@http://schemas.openxmlformats.org/drawingml/2006/chart).
*
* This is a complex type.
*/
public interface CTDPt extends org.apache.xmlbeans.XmlObject {
DocumentFactory<org.openxmlformats.schemas.drawingml.x2006.chart.CTDPt> Factory = new DocumentFactory<>(org.apache.poi.schemas.ooxml.system.ooxml.TypeSystemHolder.typeSystem, "ctdpt255etype");
org.apache.xmlbeans.SchemaType type = Factory.getType();
/**
* Gets the "idx" element
*/
org.openxmlformats.schemas.drawingml.x2006.chart.CTUnsignedInt getIdx();
/**
* Sets the "idx" element
*/
void setIdx(org.openxmlformats.schemas.drawingml.x2006.chart.CTUnsignedInt idx);
/**
* Appends and returns a new empty "idx" element
*/
org.openxmlformats.schemas.drawingml.x2006.chart.CTUnsignedInt addNewIdx();
/**
* Gets the "invertIfNegative" element
*/
org.openxmlformats.schemas.drawingml.x2006.chart.CTBoolean getInvertIfNegative();
/**
* True if has "invertIfNegative" element
*/
boolean isSetInvertIfNegative();
/**
* Sets the "invertIfNegative" element
*/
void setInvertIfNegative(org.openxmlformats.schemas.drawingml.x2006.chart.CTBoolean invertIfNegative);
/**
* Appends and returns a new empty "invertIfNegative" element
*/
org.openxmlformats.schemas.drawingml.x2006.chart.CTBoolean addNewInvertIfNegative();
/**
* Unsets the "invertIfNegative" element
*/
void unsetInvertIfNegative();
/**
* Gets the "marker" element
*/
org.openxmlformats.schemas.drawingml.x2006.chart.CTMarker getMarker();
/**
* True if has "marker" element
*/
boolean isSetMarker();
/**
* Sets the "marker" element
*/
void setMarker(org.openxmlformats.schemas.drawingml.x2006.chart.CTMarker marker);
/**
* Appends and returns a new empty "marker" element
*/
org.openxmlformats.schemas.drawingml.x2006.chart.CTMarker addNewMarker();
/**
* Unsets the "marker" element
*/
void unsetMarker();
/**
* Gets the "bubble3D" element
*/
org.openxmlformats.schemas.drawingml.x2006.chart.CTBoolean getBubble3D();
/**
* True if has "bubble3D" element
*/
boolean isSetBubble3D();
/**
* Sets the "bubble3D" element
*/
void setBubble3D(org.openxmlformats.schemas.drawingml.x2006.chart.CTBoolean bubble3D);
/**
* Appends and returns a new empty "bubble3D" element
*/
org.openxmlformats.schemas.drawingml.x2006.chart.CTBoolean addNewBubble3D();
/**
* Unsets the "bubble3D" element
*/
void unsetBubble3D();
/**
* Gets the "explosion" element
*/
org.openxmlformats.schemas.drawingml.x2006.chart.CTUnsignedInt getExplosion();
/**
* True if has "explosion" element
*/
boolean isSetExplosion();
/**
* Sets the "explosion" element
*/
void setExplosion(org.openxmlformats.schemas.drawingml.x2006.chart.CTUnsignedInt explosion);
/**
* Appends and returns a new empty "explosion" element
*/
org.openxmlformats.schemas.drawingml.x2006.chart.CTUnsignedInt addNewExplosion();
/**
* Unsets the "explosion" element
*/
void unsetExplosion();
/**
* Gets the "spPr" element
*/
org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties getSpPr();
/**
* True if has "spPr" element
*/
boolean isSetSpPr();
/**
* Sets the "spPr" element
*/
void setSpPr(org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties spPr);
/**
* Appends and returns a new empty "spPr" element
*/
org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties addNewSpPr();
/**
* Unsets the "spPr" element
*/
void unsetSpPr();
/**
* Gets the "pictureOptions" element
*/
org.openxmlformats.schemas.drawingml.x2006.chart.CTPictureOptions getPictureOptions();
/**
* True if has "pictureOptions" element
*/
boolean isSetPictureOptions();
/**
* Sets the "pictureOptions" element
*/
void setPictureOptions(org.openxmlformats.schemas.drawingml.x2006.chart.CTPictureOptions pictureOptions);
/**
* Appends and returns a new empty "pictureOptions" element
*/
org.openxmlformats.schemas.drawingml.x2006.chart.CTPictureOptions addNewPictureOptions();
/**
* Unsets the "pictureOptions" element
*/
void unsetPictureOptions();
/**
* Gets the "extLst" element
*/
org.openxmlformats.schemas.drawingml.x2006.chart.CTExtensionList getExtLst();
/**
* True if has "extLst" element
*/
boolean isSetExtLst();
/**
* Sets the "extLst" element
*/
void setExtLst(org.openxmlformats.schemas.drawingml.x2006.chart.CTExtensionList extLst);
/**
* Appends and returns a new empty "extLst" element
*/
org.openxmlformats.schemas.drawingml.x2006.chart.CTExtensionList addNewExtLst();
/**
* Unsets the "extLst" element
*/
void unsetExtLst();
}
| 26.143519
| 196
| 0.668142
|
4b65f393a1470b6e2f0599a34033e37801195399
| 2,475
|
/*
* Copyright (c) 2017 Carbon Security Ltd. <opensource@carbonsecurity.co.uk>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
package com.enterprisepasswordsafe.ui.web.servlets;
import com.enterprisepasswordsafe.database.HierarchyNode;
import com.enterprisepasswordsafe.database.HierarchyNodeDAO;
import com.enterprisepasswordsafe.database.User;
import com.enterprisepasswordsafe.ui.web.utils.SecurityUtils;
import com.enterprisepasswordsafe.ui.web.utils.ServletUtils;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet to alter the event email settings.
*/
public final class ViewPersonalFolder extends HttpServlet {
@Override
protected void doGet(final HttpServletRequest request, final HttpServletResponse response)
throws ServletException {
try {
User thisUser = SecurityUtils.getRemoteUser(request);
HierarchyNodeDAO hnDAO = HierarchyNodeDAO.getInstance();
HierarchyNode node = hnDAO.getPersonalNodeForUser(thisUser);
if( node == null ) {
node = hnDAO.create(thisUser.getId(), null, HierarchyNode.USER_CONTAINER_NODE);
}
ServletUtils.getInstance().setCurrentNodeId(request, node.getNodeId());
request.setAttribute("objects", hnDAO.getAllChildrenObjects(node, thisUser, null));
request.getRequestDispatcher("/system/view_personal.jsp").forward(request, response);
} catch(Exception ex) {
throw new ServletException("Your personal passwords are not available at the current time", ex);
}
}
@Override
public String getServletInfo() {
return "Servlet to take the user to their personal passwords page.";
}
}
| 40.57377
| 102
| 0.757172
|
4c85752d2c894ae98a66be207c009e9079435363
| 1,542
|
/*
* FXGL - JavaFX Game Library. The MIT License (MIT).
* Copyright (c) AlmasB (almaslvl@gmail.com).
* See LICENSE for details.
*/
/**
* Created at 7:23:39 AM Jan 20, 2011
*/
package com.almasb.fxgl.physics.box2d.dynamics.joints;
import com.almasb.fxgl.core.math.Vec2;
import com.almasb.fxgl.physics.box2d.dynamics.Body;
import com.almasb.fxgl.physics.box2d.dynamics.World;
/**
* Friction joint definition.
*
* @author Daniel Murphy
*/
public class FrictionJointDef extends JointDef<FrictionJoint> {
/**
* The local anchor point relative to bodyA's origin.
*/
public final Vec2 localAnchorA;
/**
* The local anchor point relative to bodyB's origin.
*/
public final Vec2 localAnchorB;
/**
* The maximum friction force in N.
*/
public float maxForce;
/**
* The maximum friction torque in N-m.
*/
public float maxTorque;
public FrictionJointDef() {
localAnchorA = new Vec2();
localAnchorB = new Vec2();
maxForce = 0f;
maxTorque = 0f;
}
/**
* Initialize the bodies, anchors, axis, and reference angle using the world anchor and world
* axis.
*/
public void initialize(Body bA, Body bB, Vec2 anchor) {
setBodyA(bA);
setBodyB(bB);
bA.getLocalPointToOut(anchor, localAnchorA);
bB.getLocalPointToOut(anchor, localAnchorB);
}
@Override
protected FrictionJoint createJoint(World world) {
return new FrictionJoint(world.getPool(), this);
}
}
| 23.363636
| 97
| 0.641375
|
b7fa3dfbb2122da9f8cf3547a85dc51f43a73a85
| 666
|
/*
* 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 vetor01;
/**
*
* @author User
*/
public class Vetor01 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int n[] = {3,5,7,4,8};
System.out.println("O total de posições do vetor N é " +n.length);
for (int c = 0; c<=4; c++){ // c<5 = c < n.lenght
System.out.println("Na posição " + c + " o valor é " + n[c]);
}
}
}
| 24.666667
| 79
| 0.573574
|
e63b957f272504bd3d27245100c0b948a95552e4
| 1,652
|
/*
* This file is generated by jOOQ.
*/
package jooq;
import javax.annotation.Generated;
import jooq.tables.Posts;
import jooq.tables.records.PostsRecord;
import org.jooq.UniqueKey;
import org.jooq.impl.Internal;
/**
* A class modelling foreign key relationships and constraints of tables of
* the <code>public</code> schema.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.11.11"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class Keys {
// -------------------------------------------------------------------------
// IDENTITY definitions
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
// UNIQUE and PRIMARY KEY definitions
// -------------------------------------------------------------------------
public static final UniqueKey<PostsRecord> POSTS_PKEY = UniqueKeys0.POSTS_PKEY;
// -------------------------------------------------------------------------
// FOREIGN KEY definitions
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
// [#1459] distribute members to avoid static initialisers > 64kb
// -------------------------------------------------------------------------
private static class UniqueKeys0 {
public static final UniqueKey<PostsRecord> POSTS_PKEY = Internal.createUniqueKey(Posts.POSTS, "posts_pkey", Posts.POSTS.ID);
}
}
| 30.592593
| 132
| 0.424334
|
3f038fbddfc79da668c23f09a69ceafb2d2b11dc
| 1,848
|
package toybox.functional.throwing.functions;
import toybox.functional.throwing.AbstractChainer;
import java.util.function.Function;
public class FunctionChainer<T, R> extends AbstractChainer<Function<T, R>, ThrowingFunction<T, R>, FunctionChainer<T, R>> implements ThrowingFunction<T, R> {
public FunctionChainer(ThrowingFunction<T, R> function) {
super(function);
}
@Override
public R doApply(T t) throws Throwable {
return function.doApply(t);
}
@Override
public FunctionChainer<T, R> orTryWith(ThrowingFunction<T, R> other) {
final ThrowingFunction<T, R> f = t -> {
try {
return function.doApply(t);
} catch (Error | RuntimeException e) {
throw e;
} catch (Throwable e) {
return other.doApply(t);
}
};
return new FunctionChainer<>(f);
}
public FunctionChainer<T, R> orElseReturn(R value) {
final ThrowingFunction<T, R> func = t -> {
try {
return function.doApply(t);
} catch (Error | RuntimeException e) {
throw e;
} catch (Throwable e) {
return value;
}
};
return new FunctionChainer<>(func);
}
public FunctionChainer<T, R> elseThrow(Function<Throwable, ? extends Throwable> generator) {
final ThrowingFunction<T, R> func = t -> {
try {
return function.doApply(t);
} catch (Error | RuntimeException e) {
throw e;
} catch (Throwable e) {
throw generator.apply(e);
}
};
return new FunctionChainer<>(func);
}
@Override
public FunctionChainer<T, R> fallbackTo(Function<T, R> other) {
final ThrowingFunction<T, R> func = t -> {
try {
return function.doApply(t);
} catch (Error | RuntimeException e) {
throw e;
} catch (Throwable e) {
return other.apply(t);
}
};
return new FunctionChainer<>(func);
}
}
| 23.692308
| 158
| 0.633117
|
893c8fa7b9779a7ffb414699ae59ed1280167716
| 4,901
|
package com.stats.disease.healthstats;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
public class PreviousCasesActivity extends Activity {
Context context;
ListView previousCasesList;
LinearLayout listProgressBar;
LinearLayout caseParent;
TextView caseIdText;
TextView caseAgeGroupText;
TextView caseGenderText;
TextView caseLocalityText;
TextView caseDateText;
TextView caseDiseaseText;
AdapterView.OnItemClickListener listViewItemClickListener;
private class UserCaseGetter extends ServerConnector{
@Override
protected void onPreExecute() {
listProgressBar.setVisibility(View.VISIBLE);
}
@Override
protected void onPostExecute(String s) {
if (s.equalsIgnoreCase("false")){
Toast.makeText(context,"No cases reported yet",Toast.LENGTH_SHORT).show();
listProgressBar.setVisibility(View.GONE);
previousCasesList.setVisibility(View.GONE);
return;
}
String[] caseIds = s.split(" ");
for (int i=0;i<caseIds.length;i++)
caseIds[i] = "Case ID: " + caseIds[i];
ArrayAdapter listViewAdapter = new ArrayAdapter<>(context, R.layout.list_previous_cases, caseIds);
previousCasesList.setAdapter(listViewAdapter);
listProgressBar.setVisibility(View.GONE);
previousCasesList.setVisibility(View.VISIBLE);
}
}
private class CaseGetter extends ServerConnector{
@Override
protected void onPreExecute() {
listProgressBar.setVisibility(View.VISIBLE);
previousCasesList.setVisibility(View.GONE);
}
@Override
protected void onPostExecute(String s) {
String[] caseParams = s.split(" ");
caseIdText.setText(caseParams[0]);
caseAgeGroupText.setText(caseParams[1]);
caseGenderText.setText(caseParams[2]);
caseLocalityText.setText(caseParams[3]);
caseDateText.setText(caseParams[4]);
caseDiseaseText.setText(caseParams[5]);
caseParent.setVisibility(View.VISIBLE);
listProgressBar.setVisibility(View.GONE);
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_previous_cases);
context = this;
initializeLayout();
initializeListView();
populateListView();
}
void initializeLayout(){
previousCasesList = (ListView)findViewById(R.id.previous_cases_list);
listProgressBar = (LinearLayout)findViewById(R.id.list_progress_bar_parent);
caseParent = (LinearLayout)findViewById(R.id.single_case_parent);
caseIdText = (TextView)findViewById(R.id.single_case_id);
caseAgeGroupText = (TextView)findViewById(R.id.single_case_age_group);
caseGenderText = (TextView)findViewById(R.id.single_case_gender);
caseLocalityText = (TextView)findViewById(R.id.single_case_locality);
caseDateText = (TextView)findViewById(R.id.single_case_date);
caseDiseaseText = (TextView)findViewById(R.id.single_case_disease);
}
void initializeListView(){
listViewItemClickListener = new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
TextView clickedItem = (TextView)view.findViewById(R.id.case_id_list);
CaseGetter currentCaseGetter = new CaseGetter();
String queryString = Constants.GET_CASE_QUERY + " " + clickedItem.getText().toString().substring(9);
currentCaseGetter.execute(Constants.SERVER_URL_STRING, queryString);
}
};
previousCasesList.setOnItemClickListener(listViewItemClickListener);
}
void populateListView(){
UserCaseGetter allCurrentUserCases = new UserCaseGetter();
String queryString = Constants.GET_ALL_CASES_FROM_USER_QUERY + " " + Utils.getUserId(context);
allCurrentUserCases.execute(Constants.SERVER_URL_STRING, queryString);
}
@Override
public void onBackPressed() {
if (previousCasesList.getVisibility()==View.VISIBLE)
super.onBackPressed();
else {
caseParent.setVisibility(View.GONE);
previousCasesList.setVisibility(View.VISIBLE);
}
}
}
| 33.340136
| 116
| 0.673332
|
f829d601956a8082c57f83e7d4cb97d5dac94590
| 3,034
|
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*
*/
package com.microsoft.azure.management.mediaservices.v2019_05_01_preview.implementation;
import com.microsoft.azure.arm.model.implementation.WrapperImpl;
import com.microsoft.azure.management.mediaservices.v2019_05_01_preview.AccountFilters;
import rx.Completable;
import rx.Observable;
import rx.functions.Func1;
import com.microsoft.azure.Page;
import com.microsoft.azure.management.mediaservices.v2019_05_01_preview.AccountFilter;
class AccountFiltersImpl extends WrapperImpl<AccountFiltersInner> implements AccountFilters {
private final MediaManager manager;
AccountFiltersImpl(MediaManager manager) {
super(manager.inner().accountFilters());
this.manager = manager;
}
public MediaManager manager() {
return this.manager;
}
@Override
public AccountFilterImpl define(String name) {
return wrapModel(name);
}
private AccountFilterImpl wrapModel(AccountFilterInner inner) {
return new AccountFilterImpl(inner, manager());
}
private AccountFilterImpl wrapModel(String name) {
return new AccountFilterImpl(name, this.manager());
}
@Override
public Observable<AccountFilter> listAsync(final String resourceGroupName, final String accountName) {
AccountFiltersInner client = this.inner();
return client.listAsync(resourceGroupName, accountName)
.flatMapIterable(new Func1<Page<AccountFilterInner>, Iterable<AccountFilterInner>>() {
@Override
public Iterable<AccountFilterInner> call(Page<AccountFilterInner> page) {
return page.items();
}
})
.map(new Func1<AccountFilterInner, AccountFilter>() {
@Override
public AccountFilter call(AccountFilterInner inner) {
return wrapModel(inner);
}
});
}
@Override
public Observable<AccountFilter> getAsync(String resourceGroupName, String accountName, String filterName) {
AccountFiltersInner client = this.inner();
return client.getAsync(resourceGroupName, accountName, filterName)
.flatMap(new Func1<AccountFilterInner, Observable<AccountFilter>>() {
@Override
public Observable<AccountFilter> call(AccountFilterInner inner) {
if (inner == null) {
return Observable.empty();
} else {
return Observable.just((AccountFilter)wrapModel(inner));
}
}
});
}
@Override
public Completable deleteAsync(String resourceGroupName, String accountName, String filterName) {
AccountFiltersInner client = this.inner();
return client.deleteAsync(resourceGroupName, accountName, filterName).toCompletable();
}
}
| 35.27907
| 112
| 0.686223
|
bc44171ad67a506f50881c05fe7a1622c47e902e
| 2,968
|
/*
* Project Seele Workflow
* Author : Rinka
* Date : 2020/1/4
*/
package org.yurily.seele.server.engine.resourcing.participant;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.*;
import org.yurily.seele.server.engine.resourcing.context.RSContext;
import org.yurily.seele.server.engine.resourcing.queue.WorkQueueContainer;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Class : ParticipantContext
* Usage :
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class ParticipantContext extends RSContext {
public static final String DESC_NAME = "name";
public static final String DESC_SKILL = "skill";
public static final String DESC_REST_ENTRY = "rest_entry";
public static final String DESC_REST_URI = "rest_uri";
@JsonIgnore
@Getter
@Setter(value = AccessLevel.PRIVATE)
private AtomicInteger handlingWorkitemCount = new AtomicInteger(0);
@JsonIgnore
@Getter
@Setter(value = AccessLevel.PRIVATE)
private AtomicInteger handledWorkitemCount = new AtomicInteger(0);
@JsonIgnore
@Getter
@Setter(value = AccessLevel.PRIVATE)
private WorkQueueContainer queueContainer;
private String namespace;
/**
* Participant global id.
*/
private String participantId;
/**
* User-friendly resource name.
*/
private String displayName;
/**
* What skills does this participant has.
*/
private Set<String> skill = new HashSet<>();
/**
* Type of the resource.
*/
private ParticipantType type;
/**
* Type of communication protocol.
*/
private ParticipantCommunicationType communicationType;
/**
* A descriptor guides where RS to find this resource.
* Agent - usually a hostname with port
* Human - maybe a string describe his position in organization
* SubProcess - process global id
*/
private String entry;
/**
* An optional descriptor for `entry` field.
*/
private String uri;
/**
* Is this resource able to handle reentrant workitem.
*/
private ParticipantReentrantType reentrantType;
/**
* Last heartbeat package from participant
*/
private Object lastBeat;
/**
* Last heartbeat package server ts
*/
private Long lastBeatTimestamp;
/**
* Add a collection of skill to this participant.
*
* @param skills a List contains skill descriptors
*/
public void addSkills(Collection<String> skills) {
this.skill.addAll(skills);
}
public void addSkill(String skill) {
this.skill.add(skill);
}
public ParticipantContext(String namespace, String participantId) {
this.namespace = namespace;
this.participantId = participantId;
this.queueContainer = new WorkQueueContainer(this.namespace, this.participantId);
}
}
| 24.733333
| 89
| 0.680256
|
0b56fecfadeff10124868c768363407a50ad0acf
| 1,648
|
package com.wfm.platform.service;
import com.wfm.platform.entities.*;
import com.wfm.platform.vo.ConnectParam;
import java.util.List;
import java.util.Map;
/**
* @author Weifengming
* @description 数据库元信息查询服务
* @date 2020/2/29
*/
public interface DatabaseService {
/**
* 通用查询方法
*
* @param connParam 连接参数
* @param sql 要查询的sql语句
* @param params 查询条件数组
* @return
*/
List<Map<String, String>> query(ConnectParam connParam, String sql, String[] params);
/**
* 查询表集合
*
* @param connParam 连接参数
* @return
*/
List<Table> getTables(ConnectParam connParam);
/**
* 查询表的字段集
*
* @param connParam 连接参数
* @param tableName
* @return
*/
List<Column> getColumns(ConnectParam connParam, String tableName);
/**
* 查询主键集
*
* @param connParam 连接参数
* @param tableName
* @return
*/
List<PrimaryKey> getPrimaryKeys(ConnectParam connParam, String tableName);
/**
* 查询外键集
*
* @param connParam 连接参数
* @param tableName
* @return
*/
List<ForeignKey> getForeignKeys(ConnectParam connParam, String tableName);
/**
* 查询索引集
*
* @param connParam 连接参数
* @return
*/
List<Index> getIndexes(ConnectParam connParam, String tableName);
/**
* 查询触发器集
*
* @param connParam 连接参数
* @param tableName
* @return
*/
List<Trigger> getTriggers(ConnectParam connParam, String tableName);
/**
* 测试数据库是否可以连接
*
* @param connParam
* @return
*/
boolean canConnect(ConnectParam connParam);
}
| 19.162791
| 89
| 0.589806
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.