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
9202e23ab37162b890f59373ebfe2a428e7e9551
2,769
package uk.co.idv.method.entities.otp.policy.delivery.phone; import org.junit.jupiter.api.Test; import java.time.Duration; import java.time.Instant; import java.util.Optional; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; class SimSwapConfigTest { @Test void shouldReturnAcceptableResults() { AcceptableSimSwapStatuses acceptableResults = mock(AcceptableSimSwapStatuses.class); SimSwapConfig config = SimSwapConfig.builder() .acceptableStatuses(acceptableResults) .build(); assertThat(config.getAcceptableStatuses()).isEqualTo(acceptableResults); } @Test void shouldReturnTimeout() { Duration timeout = Duration.ofSeconds(30); SimSwapConfig config = SimSwapConfig.builder() .timeout(timeout) .build(); assertThat(config.getTimeout()).isEqualTo(timeout); } @Test void shouldReturnMinDaysSinceSwapIfConfigured() { long days = 5; SimSwapConfig config = SimSwapConfig.builder() .minDaysSinceSwap(days) .build(); assertThat(config.getMinDaysSinceSwap()).contains(days); } @Test void shouldReturnEmptyIfMinDaysSinceSwapNotConfigured() { SimSwapConfig config = SimSwapConfig.builder() .build(); assertThat(config.getMinDaysSinceSwap()).isEmpty(); } @Test void shouldCalculateCutoffIfMinDaysSinceSimSwapConfigured() { Instant now = Instant.parse("2020-08-31T12:00:00.000Z"); long days = 5; SimSwapConfig config = SimSwapConfig.builder() .minDaysSinceSwap(days) .build(); Optional<Instant> cutoff = config.calculateCutoff(now); assertThat(cutoff).contains(now.minus(Duration.ofDays(days))); } @Test void shouldReturnEmptyCutoffIfMinDaysSinceSimSwapNotConfigured() { Instant now = Instant.parse("2020-08-31T12:00:00.000Z"); SimSwapConfig config = SimSwapConfig.builder() .build(); Optional<Instant> cutoff = config.calculateCutoff(now); assertThat(cutoff).isEmpty(); } @Test void shouldReturnResultAcceptable() { String result = "my-result"; AcceptableSimSwapStatuses acceptableResults = mock(AcceptableSimSwapStatuses.class); given(acceptableResults.isAcceptable(result)).willReturn(true); SimSwapConfig config = SimSwapConfig.builder() .acceptableStatuses(acceptableResults) .build(); boolean acceptable = config.isAcceptable(result); assertThat(acceptable).isTrue(); } }
29.147368
92
0.660527
c3f34c86ee3be27ed82629f2c27968c0cd5c2591
626
package site.morn.boot.message; import org.springframework.util.concurrent.ListenableFuture; import site.morn.task.ListenableFutureDispatcher; /** * 消息发送操作 * * @author timely-rain * @since 1.2.1, 2020/4/10 */ public interface BroadcastMessageSendingOperations { /** * 异步发送消息 * * @param message 消息 * @return 发送结果 */ default ListenableFuture<MessageResult> asyncSend(BroadcastMessage<?> message) { return ListenableFutureDispatcher.submit(() -> syncSend(message)); } /** * 同步发送消息 * * @param message 消息 * @return 发送结果 */ MessageResult syncSend(BroadcastMessage<?> message); }
19.5625
82
0.693291
ed40a9a6c51661ad91412eaed0bb584402bb09e7
1,292
package us.ihmc.communication.remote; import java.math.BigInteger; import java.util.Random; import us.ihmc.communication.streamingData.StreamingDataConsumer; abstract class AbstractStringPacketCommunicationTester extends CommsTester<StringPacket> { public AbstractStringPacketCommunicationTester(int numberOfPackets, long maxPacketWaitTimeMillis) { super(new StringPacketStreamingDataConsumer(), new StringPacketGenerator(), numberOfPackets, maxPacketWaitTimeMillis); } private static class StringPacketStreamingDataConsumer extends StreamingDataConsumerForTesting<StringPacket> implements StreamingDataConsumer { public StringPacketStreamingDataConsumer() { super(StringPacket.getSerialVersionUID(), StringPacket.class); } } private static class StringPacketGenerator implements PacketGeneratorForTests<StringPacket> { // unseeded random intended here. It shouldn't matter, because any type of packet should be sent over and there are no epsilons involved private Random random = new Random(); private final int numBits = 80; public StringPacket generatePacket() { String contents = new BigInteger(numBits, random).toString(); return new StringPacket(contents); } } }
33.128205
144
0.764706
6789d214a7829aa5f6dcc71e2831904477a6d7b3
2,032
/* * 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.sis.internal.storage.io; import java.util.function.UnaryOperator; import org.apache.sis.setup.OptionKey; import org.apache.sis.storage.StorageConnector; /** * {@link StorageConnector} options not part of public API. * Some of those options may move to public API in the future if useful. * * @author Martin Desruisseaux (Geomatys) * @version 1.2 * * @param <T> the type of option values. * * @since 1.2 * @module */ public final class InternalOptionKey<T> extends OptionKey<T> { /** * For cross-version compatibility. */ private static final long serialVersionUID = 1786137598411493790L; /** * Wraps readable or writable channels on creation. Wrappers can be used for example * in order to listen to read events or for transforming bytes on the fly. */ @SuppressWarnings("unchecked") public static final InternalOptionKey<UnaryOperator<ChannelFactory>> CHANNEL_FACTORY_WRAPPER = (InternalOptionKey) new InternalOptionKey<>("READ_CHANNEL_WRAPPER", UnaryOperator.class); /** * Creates a new key of the given name. */ public InternalOptionKey(final String name, final Class<T> type) { super(name, type); } }
35.649123
101
0.724409
7fd71d3b49cce45da0cacb14e673740f1bc08166
7,773
/*****************************************************************************/ /* Software Testing Automation Framework (STAF) */ /* (C) Copyright IBM Corp. 2002 */ /* */ /* This software is licensed under the Eclipse Public License (EPL) V1.0. */ /*****************************************************************************/ package com.ibm.staf.service.stax; import java.util.Iterator; import java.util.List; public class STAXIterateAction extends STAXActionDefaultImpl { static final int INIT = 0; static final int CALLING_ACTIONS = 1; static final int COMPLETE = 2; static final String INIT_STRING = "INIT"; static final String CALLING_ACTIONS_STRING = "CALLING_ACTIONS"; static final String COMPLETE_STRING = "COMPLETE"; static final String STATE_UNKNOWN_STRING = "UNKNOWN"; public STAXIterateAction() { /* Do Nothing */ } public STAXIterateAction(String itemvar, String in, String indexvar, STAXAction action) { fItemvar = itemvar; fIn = in; fIndexvar = indexvar; fAction = action; } public void setItemVar(String itemvar) { fItemvar = itemvar; } public void setIn(String in) { fIn = in; } public void setIndexVar(String indexvar) { fIndexvar = indexvar; } public void setIterateAction(STAXAction action) { fAction = action; } public String getStateAsString() { switch (fState) { case INIT: return INIT_STRING; case CALLING_ACTIONS: return CALLING_ACTIONS_STRING; case COMPLETE: return COMPLETE_STRING; default: return STATE_UNKNOWN_STRING; } } public String getXMLInfo() { if (fIndexvar.equals("")) return "<iterate var=\"" + fItemvar + "\" in=\"" + fIn + "\">"; else return "<iterate var=\"" + fItemvar + "\" in=\"" + fIn + "\" indexvar=\"" + fIndexvar + "\">"; } // Used to generate the Call Stack information for this element public String getInfo() { // Format: // <currIndex>/<listSize> [<varValue>] <list> // // where: // <currIndex> is the index of the entry in the list currently // being processed // <listSize> is the size of the list (or 0 if not available yet) // <varValue> is the evaluated entry in the list currently // being processed (or blank if not available) // <list> is the unevaluated list value // // The total length of the message is limited to 40 characters. // If it exceeds 40 characters, "..." is appended. String info = fCurrListIndex + "/" + fListSize; if (fList != null) { // Make sure don't get a NullPointerException on fList // or a IndexOutOfBounds Exception on the index value int index = fCurrListIndex - 1; if ((index >= 0) && (index < fListSize)) info += " " + fList.get(index); } info += " " + fIn; if (info.length() > 40) info = info.substring(0, 40) + "..."; return info; } public String getDetails() { return "State:" + getStateAsString() + ";CurrListIndex:" + fCurrListIndex + ";ListSize:" + fListSize + ";Itemvar:" + fItemvar + ";In:" + fIn + ";Indexvar:" + fIndexvar + ";Action:" + fAction + ";List:" + fList; } public void execute(STAXThread thread) { String evalElem = getElement(); String evalAttr = "in"; try { if (fState == INIT) { // Create a list/tuple in Jython from fIn and then extract // the Python tuple or array into a Java List. fList = thread.pyListEval(fIn); fListSize = fList.size(); if (fListSize == 0) { // Nothing in list, so done; raise a signal. fState = COMPLETE; thread.popAction(); setElementInfo(new STAXElementInfo(evalElem, evalAttr)); thread.setSignalMsgVar( "STAXEmptyListMsg", STAXUtil.formatErrorMessage(this)); thread.raiseSignal("STAXEmptyList"); } fState = CALLING_ACTIONS; } else if (fState == CALLING_ACTIONS) { if (fListSize > fCurrListIndex) { // Assign indexvar Jython variable, if provided if (fIndexvar != null && !fIndexvar.equals("")) { evalAttr = "indexvar"; thread.pySetVar( fIndexvar, new Integer(fCurrListIndex)); } // Assign itemvar Jython variable evalAttr = "var"; Object itemValue = (Object)fList.get(fCurrListIndex++); thread.pySetVar(fItemvar, itemValue); thread.pushAction(fAction.cloneAction()); } else { fState = COMPLETE; thread.popAction(); } } } catch (STAXPythonEvaluationException e) { fState = COMPLETE; thread.popAction(); setElementInfo(new STAXElementInfo(evalElem, evalAttr)); thread.setSignalMsgVar( "STAXPythonEvalMsg", STAXUtil.formatErrorMessage(this), e); thread.raiseSignal("STAXPythonEvaluationError"); } } public void handleCondition(STAXThread thread, STAXCondition cond) { if (!(cond instanceof STAXContinueCondition)) { fState = COMPLETE; thread.popAction(); } // Remove any break or continue conditions from the condition stack // that the iterate action handles. This way, there won't be any // "dangling" break or continue conditions hanging around if a // terminate block condition is added to the condition stack. thread.visitConditions(new STAXVisitor() { public void visit(Object o, Iterator iter) { if ((o instanceof STAXBreakCondition) || (o instanceof STAXContinueCondition)) { iter.remove(); } } }); } public STAXAction cloneAction() { STAXIterateAction clone = new STAXIterateAction(); clone.setElement(getElement()); clone.setLineNumberMap(getLineNumberMap()); clone.setXmlFile(getXmlFile()); clone.setXmlMachine(getXmlMachine()); clone.fItemvar = fItemvar; clone.fIn = fIn; clone.fIndexvar = fIndexvar; clone.fAction = fAction; return clone; } private int fState = INIT; private int fCurrListIndex = 0; private List fList = null; private int fListSize = 0; private String fItemvar = new String(); private String fIn = new String(); private String fIndexvar = new String(); private STAXAction fAction = null; }
31.469636
79
0.500322
68f77d00f45c8fc97081e703d696727cb8d3f81a
152
package nxt.server.resource; import nxt.shared.json.JSONObject; public interface ResourceListener { public void stateChanged(JSONObject state); }
15.2
44
0.796053
c9756d017642786c74ddfa789986155449e086a8
2,705
package com.commercetools.api.models.shipping_method; import java.time.*; import java.util.*; import java.util.function.Function; import javax.validation.Valid; import javax.validation.constraints.NotNull; import com.commercetools.api.models.common.TypedMoney; import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.annotation.*; import io.vrap.rmf.base.client.utils.Generated; @Generated(value = "io.vrap.rmf.codegen.rendring.CoreCodeGenerator", comments = "https://github.com/vrapio/rmf-codegen") @JsonDeserialize(as = ShippingRateImpl.class) public interface ShippingRate { @NotNull @Valid @JsonProperty("price") public TypedMoney getPrice(); /** * <p>The shipping is free if the order total (the sum of line item prices) exceeds the <code>freeAbove</code> value. * Note: <code>freeAbove</code> applies before any Cart or Product discounts, and can cause discounts to apply in invalid scenarios. * Use a Cart Discount to set the shipping price to 0 to avoid providing free shipping in invalid discount scenarios.</p> */ @Valid @JsonProperty("freeAbove") public TypedMoney getFreeAbove(); /** * <p>Only appears in response to requests for shipping methods by cart or location to mark this shipping rate as one that matches the cart or location.</p> */ @JsonProperty("isMatching") public Boolean getIsMatching(); /** * <p>A list of shipping rate price tiers.</p> */ @NotNull @Valid @JsonProperty("tiers") public List<ShippingRatePriceTier> getTiers(); public void setPrice(final TypedMoney price); public void setFreeAbove(final TypedMoney freeAbove); public void setIsMatching(final Boolean isMatching); @JsonIgnore public void setTiers(final ShippingRatePriceTier... tiers); public void setTiers(final List<ShippingRatePriceTier> tiers); public static ShippingRate of() { return new ShippingRateImpl(); } public static ShippingRate of(final ShippingRate template) { ShippingRateImpl instance = new ShippingRateImpl(); instance.setPrice(template.getPrice()); instance.setFreeAbove(template.getFreeAbove()); instance.setIsMatching(template.getIsMatching()); instance.setTiers(template.getTiers()); return instance; } public static ShippingRateBuilder builder() { return ShippingRateBuilder.of(); } public static ShippingRateBuilder builder(final ShippingRate template) { return ShippingRateBuilder.of(template); } default <T> T withShippingRate(Function<ShippingRate, T> helper) { return helper.apply(this); } }
31.453488
160
0.715712
b9dc8d2cb247280bf297b6bc496e1c7bde2bfcfc
1,330
package tane.mahuta.buildtools.release; import lombok.*; import tane.mahuta.buildtools.dependency.Artifact; import tane.mahuta.buildtools.dependency.DependencyContainer; import tane.mahuta.buildtools.dependency.GAVCDescriptor; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.io.File; import java.util.Set; /** * Default implementation of {@link ArtifactRelease}. * * @author christian.heike@icloud.com * Created on 24.06.17. */ @RequiredArgsConstructor(access = AccessLevel.PROTECTED) @Builder @EqualsAndHashCode(callSuper = false) @ToString(callSuper = true) public class DefaultArtifactRelease extends AbstractArtifactRelease { @Getter(onMethod = @__({@Nonnull, @Override})) @NonNull private final GAVCDescriptor descriptor; @Getter(onMethod = @__({@Nullable, @Override})) private final File localFile; @Getter(onMethod = @__({@Nonnull, @Override})) @NonNull private final File projectDir; @NonNull @Getter(onMethod = @__({@Nonnull, @Override})) private final Set<? extends Artifact> classpathDependencies; @NonNull @Getter(onMethod = @__({@Nonnull, @Override})) private final Set<? extends DependencyContainer> dependencyContainers; @Getter(onMethod = @__(@Override)) private final boolean internalArtifact; }
28.297872
74
0.73985
ff41fe87531c2273f18f44a12e5ae456509aa348
17,539
package SceneManagers; import KIClasses.Easy; import KIClasses.Hard; import KIClasses.Medium; import KIClasses.Ultra; import javafx.event.*; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.input.MouseEvent; import javafx.scene.media.Media; import javafx.scene.media.MediaPlayer; import javafx.scene.text.Text; import javafx.stage.Stage; import sample.Color; import sample.Difficulty; import sample.Main; import sample.State; import java.io.IOException; import java.util.HashMap; import java.util.Random; public class Game { public Difficulty difficulty; public Game(Stage stage){ buildDifMenu(stage); } public void buildDifMenu(Stage stage){ Parent root = null; try { root = FXMLLoader.load(getClass().getResource("Scenes/dif_menu.fxml")); } catch (IOException e) { e.printStackTrace(); } stage.setScene(new Scene(root, 900, 500)); Button back = (Button) stage.getScene().lookup("#bck"); back.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { new Menu(stage); } }); Button easy = (Button) stage.getScene().lookup("#easy"); easy.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { difficulty = Difficulty.EASY; if(new Random().nextInt(200) > 100){ Main.waiting = true; } buildInGame(stage); } }); Button medium = (Button) stage.getScene().lookup("#medium"); medium.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { difficulty = Difficulty.MEDIUM; if(new Random().nextInt(200) > 100){ Main.waiting = true; } buildInGame(stage); } }); Button hard = (Button) stage.getScene().lookup("#hard"); hard.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { difficulty = Difficulty.HARD; Hard.intialize(); if(new Random().nextInt(200) > 100){ Main.waiting = true; } buildInGame(stage); } }); Button ultra = (Button) stage.getScene().lookup("#ultra"); ultra.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { difficulty = Difficulty.ULTRA; Ultra.intialize(); if(new Random().nextInt(200) > 100){ Main.waiting = true; } buildInGame(stage); } }); } public void buildInGame(Stage stage){ Main.playSoundtrack("InGame"); Main.places.clear(); Main.freelist.clear(); Main.places.put("btn_1_1", Color.NEUTRAL); Main.freelist.add("btn_1_1"); Main.places.put("btn_1_2", Color.NEUTRAL); Main.freelist.add("btn_1_2"); Main.places.put("btn_1_3", Color.NEUTRAL); Main.freelist.add("btn_1_3"); Main.places.put("btn_2_1", Color.NEUTRAL); Main.freelist.add("btn_2_1"); Main.places.put("btn_2_2", Color.NEUTRAL); Main.freelist.add("btn_2_2"); Main.places.put("btn_2_3", Color.NEUTRAL); Main.freelist.add("btn_2_3"); Main.places.put("btn_3_1", Color.NEUTRAL); Main.freelist.add("btn_3_1"); Main.places.put("btn_3_2", Color.NEUTRAL); Main.freelist.add("btn_3_2"); Main.places.put("btn_3_3", Color.NEUTRAL); Main.freelist.add("btn_3_3"); Parent root = null; try { root = FXMLLoader.load(getClass().getResource("Scenes/sample.fxml")); } catch (IOException e) { e.printStackTrace(); } stage.setScene(new Scene(root, 900, 500)); Button back = (Button) stage.getScene().lookup("#bck"); back.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { if(Main.state == State.AFTER){ Main.state = State.MENU; Main.waiting = false; new Menu(stage); } } }); stage.getScene().setEventDispatcher(new EventDispatcher() { @Override public Event dispatchEvent(Event event, EventDispatchChain tail) { if(event instanceof MouseEvent){ MouseEvent event1 = (MouseEvent) event; if(event1.isPrimaryButtonDown()){ if(event.getTarget().getClass().equals(Button.class)) { if(Main.state == State.INGAME) { Button btn = (Button) event.getTarget(); if (!btn.isDisabled() && !Main.waiting && Main.freelist.contains(btn.getId())) { Main.waiting = true; btn.setOpacity(0.5); btn.setStyle("-fx-background-color: #3de23d"); Main.places.put(btn.getId(), Color.GREEN); if (Main.freelist.contains(btn.getId())) { Main.freelist.remove(btn.getId()); } checkForWin(stage); } } } } } return null; } }); if(Main.waiting){ launchKI(stage, true); } } private void checkForWin(Stage stage){ if(Main.freelist.size() > 0){ if(checkPositions(Color.RED, Main.places, "btn_1_1", "btn_1_2", "btn_1_3") || checkPositions(Color.RED, Main.places, "btn_2_1", "btn_2_2", "btn_2_3") || checkPositions(Color.RED, Main.places, "btn_3_1", "btn_3_2", "btn_3_3")){ Main.state = State.AFTER; Text text = (Text) stage.getScene().lookup("#winner_na"); text.setText("You Lose!"); stage.getScene().lookup("#winner_na").setVisible(true); stage.getScene().lookup("#bck").setVisible(true); fetchWin(stage, Color.RED); }else if(checkPositions(Color.RED, Main.places, "btn_1_1", "btn_2_1", "btn_3_1") || checkPositions(Color.RED, Main.places, "btn_1_2", "btn_2_2", "btn_3_2") || checkPositions(Color.RED, Main.places, "btn_1_3", "btn_2_3", "btn_3_3")){ Main.state = State.AFTER; Text text = (Text) stage.getScene().lookup("#winner_na"); text.setText("You Lose!"); stage.getScene().lookup("#winner_na").setVisible(true); stage.getScene().lookup("#bck").setVisible(true); fetchWin(stage, Color.RED); }else if(checkPositions(Color.RED, Main.places, "btn_1_1", "btn_2_2", "btn_3_3") || checkPositions(Color.RED, Main.places, "btn_1_3", "btn_2_2", "btn_3_1")){ Main.state = State.AFTER; Text text = (Text) stage.getScene().lookup("#winner_na"); text.setText("You Lose!"); stage.getScene().lookup("#winner_na").setVisible(true); stage.getScene().lookup("#bck").setVisible(true); fetchWin(stage, Color.RED); } // GREEN else if(checkPositions(Color.GREEN, Main.places, "btn_1_1", "btn_1_2", "btn_1_3") || checkPositions(Color.GREEN, Main.places, "btn_2_1", "btn_2_2", "btn_2_3") || checkPositions(Color.GREEN, Main.places, "btn_3_1", "btn_3_2", "btn_3_3")){ Main.state = State.AFTER; Text text = (Text) stage.getScene().lookup("#winner_na"); text.setText("You Win!"); stage.getScene().lookup("#winner_na").setVisible(true); stage.getScene().lookup("#bck").setVisible(true); fetchWin(stage, Color.GREEN); }else if(checkPositions(Color.GREEN, Main.places, "btn_1_1", "btn_2_1", "btn_3_1") || checkPositions(Color.GREEN, Main.places, "btn_1_2", "btn_2_2", "btn_3_2") || checkPositions(Color.GREEN, Main.places, "btn_1_3", "btn_2_3", "btn_3_3")){ Main.state = State.AFTER; Text text = (Text) stage.getScene().lookup("#winner_na"); text.setText("You Win!"); stage.getScene().lookup("#winner_na").setVisible(true); stage.getScene().lookup("#bck").setVisible(true); fetchWin(stage, Color.GREEN); }else if(checkPositions(Color.GREEN, Main.places, "btn_1_1", "btn_2_2", "btn_3_3") || checkPositions(Color.GREEN, Main.places, "btn_1_3", "btn_2_2", "btn_3_1")){ Main.state = State.AFTER; Text text = (Text) stage.getScene().lookup("#winner_na"); text.setText("You Win!"); stage.getScene().lookup("#winner_na").setVisible(true); stage.getScene().lookup("#bck").setVisible(true); fetchWin(stage, Color.GREEN); }else{ launchKI(stage, false); if(checkPositions(Color.RED, Main.places, "btn_1_1", "btn_1_2", "btn_1_3") || checkPositions(Color.RED, Main.places, "btn_2_1", "btn_2_2", "btn_2_3") || checkPositions(Color.RED, Main.places, "btn_3_1", "btn_3_2", "btn_3_3")){ Main.state = State.AFTER; Text text = (Text) stage.getScene().lookup("#winner_na"); text.setText("You Lose!"); stage.getScene().lookup("#winner_na").setVisible(true); stage.getScene().lookup("#bck").setVisible(true); fetchWin(stage, Color.RED); }else if(checkPositions(Color.RED, Main.places, "btn_1_1", "btn_2_1", "btn_3_1") || checkPositions(Color.RED, Main.places, "btn_1_2", "btn_2_2", "btn_3_2") || checkPositions(Color.RED, Main.places, "btn_1_3", "btn_2_3", "btn_3_3")){ Main.state = State.AFTER; Text text = (Text) stage.getScene().lookup("#winner_na"); text.setText("You Lose!"); stage.getScene().lookup("#winner_na").setVisible(true); stage.getScene().lookup("#bck").setVisible(true); fetchWin(stage, Color.RED); }else if(checkPositions(Color.RED, Main.places, "btn_1_1", "btn_2_2", "btn_3_3") || checkPositions(Color.RED, Main.places, "btn_1_3", "btn_2_2", "btn_3_1")){ Main.state = State.AFTER; Text text = (Text) stage.getScene().lookup("#winner_na"); text.setText("You Lose!"); stage.getScene().lookup("#winner_na").setVisible(true); stage.getScene().lookup("#bck").setVisible(true); fetchWin(stage, Color.RED); }else if(!(Main.freelist.size() > 0)){ Main.state = State.AFTER; Text text = (Text) stage.getScene().lookup("#winner_na"); text.setText("Draw!"); stage.getScene().lookup("#winner_na").setVisible(true); stage.getScene().lookup("#bck").setVisible(true); fetchWin(stage, Color.NEUTRAL); } } }else{ if(checkPositions(Color.RED, Main.places, "btn_1_1", "btn_1_2", "btn_1_3") || checkPositions(Color.RED, Main.places, "btn_2_1", "btn_2_2", "btn_2_3") || checkPositions(Color.RED, Main.places, "btn_3_1", "btn_3_2", "btn_3_3")){ Main.state = State.AFTER; Text text = (Text) stage.getScene().lookup("#winner_na"); text.setText("You Lose!"); stage.getScene().lookup("#winner_na").setVisible(true); stage.getScene().lookup("#bck").setVisible(true); fetchWin(stage, Color.RED); }else if(checkPositions(Color.RED, Main.places, "btn_1_1", "btn_2_1", "btn_3_1") || checkPositions(Color.RED, Main.places, "btn_1_2", "btn_2_2", "btn_3_2") || checkPositions(Color.RED, Main.places, "btn_1_3", "btn_2_3", "btn_3_3")){ Main.state = State.AFTER; Text text = (Text) stage.getScene().lookup("#winner_na"); text.setText("You Lose!"); stage.getScene().lookup("#winner_na").setVisible(true); stage.getScene().lookup("#bck").setVisible(true); fetchWin(stage, Color.RED); }else if(checkPositions(Color.RED, Main.places, "btn_1_1", "btn_2_2", "btn_3_3") || checkPositions(Color.RED, Main.places, "btn_1_3", "btn_2_2", "btn_3_1")){ Main.state = State.AFTER; Text text = (Text) stage.getScene().lookup("#winner_na"); text.setText("You Lose!"); stage.getScene().lookup("#winner_na").setVisible(true); stage.getScene().lookup("#bck").setVisible(true); fetchWin(stage, Color.RED); } // GREEN else if(checkPositions(Color.GREEN, Main.places, "btn_1_1", "btn_1_2", "btn_1_3") || checkPositions(Color.GREEN, Main.places, "btn_2_1", "btn_2_2", "btn_2_3") || checkPositions(Color.GREEN, Main.places, "btn_3_1", "btn_3_2", "btn_3_3")){ Main.state = State.AFTER; Text text = (Text) stage.getScene().lookup("#winner_na"); text.setText("You Win!"); stage.getScene().lookup("#winner_na").setVisible(true); stage.getScene().lookup("#bck").setVisible(true); fetchWin(stage, Color.GREEN); }else if(checkPositions(Color.GREEN, Main.places, "btn_1_1", "btn_2_1", "btn_3_1") || checkPositions(Color.GREEN, Main.places, "btn_1_2", "btn_2_2", "btn_3_2") || checkPositions(Color.GREEN, Main.places, "btn_1_3", "btn_2_3", "btn_3_3")){ Main.state = State.AFTER; Text text = (Text) stage.getScene().lookup("#winner_na"); text.setText("You Win!"); stage.getScene().lookup("#winner_na").setVisible(true); stage.getScene().lookup("#bck").setVisible(true); fetchWin(stage, Color.GREEN); }else if(checkPositions(Color.GREEN, Main.places, "btn_1_1", "btn_2_2", "btn_3_3") || checkPositions(Color.GREEN, Main.places, "btn_1_3", "btn_2_2", "btn_3_1")){ Main.state = State.AFTER; Text text = (Text) stage.getScene().lookup("#winner_na"); text.setText("You Win!"); stage.getScene().lookup("#winner_na").setVisible(true); stage.getScene().lookup("#bck").setVisible(true); fetchWin(stage, Color.GREEN); }else{ Main.state = State.AFTER; Text text = (Text) stage.getScene().lookup("#winner_na"); text.setText("Draw!"); stage.getScene().lookup("#winner_na").setVisible(true); stage.getScene().lookup("#bck").setVisible(true); fetchWin(stage, Color.NEUTRAL); } } } private void fetchWin(Stage stage, Color winner){ stage.getScene().setEventDispatcher(null); Button back = (Button) stage.getScene().lookup("#bck"); back.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { Main.state = State.MENU; new Menu(stage); } }); } private void launchKI(Stage stage, boolean begin){ if(difficulty == Difficulty.EASY){ Easy.choosePlace(stage, Main.freelist, Main.places, begin); }else if(difficulty == Difficulty.MEDIUM){ Medium.choosePlace(stage, Main.freelist, Main.places, begin); }else if(difficulty == Difficulty.HARD){ Hard.choosePlace(stage, Main.freelist, Main.places, begin); }else if(difficulty == Difficulty.ULTRA){ Ultra.choosePlace(stage, Main.places, begin); } } private boolean checkPositions(Color color, HashMap<String, Color> places, String pos1, String pos2, String pos3){ if(places.get(pos1) == places.get(pos2)){ if(places.get(pos1) == places.get(pos3)){ if(places.get(pos2) == places.get(pos3)){ if(places.get(pos1) != Color.NEUTRAL && places.get(pos2) != Color.NEUTRAL && places.get(pos3) != Color.NEUTRAL){ if(places.get(pos1).equals(color) && places.get(pos2).equals(color) && places.get(pos3).equals(color)){ return true; }else{ return false; } }else{ return false; } }else{ return false; } }else{ return false; } }else{ return false; } } }
48.450276
250
0.539769
fbe995135259aa530aebe000db9c1ca0bd3b0e82
5,633
package ebon.uis; import ebon.uis.screens.*; import flounder.devices.*; import flounder.fonts.*; import flounder.framework.*; import flounder.guis.*; import flounder.resources.*; import flounder.textures.*; import flounder.visual.*; import java.util.*; public class MenuStart extends GuiComponent { private MasterMenu superMenu; private MasterSlider masterSlider; private GuiTexture[] slideshow; private GuiTexture slideoverlay; private SlideDriver slideshowDriver; private static final float SLIDESHOW_ASPECT = 1600.0f / 1200.0f; private static final float SLIDE_SPEED = 4.75f; private Text titleText; private ScreenPlay screenPlay; private ScreenOptions screenOptions; private ScreenAbout screenAbout; private ScreenMods screenMods; protected MenuStart(MasterMenu superMenu, MasterSlider masterSlider) { this.superMenu = superMenu; this.masterSlider = masterSlider; this.screenPlay = new ScreenPlay(masterSlider); this.screenOptions = new ScreenOptions(masterSlider); this.screenAbout = new ScreenAbout(masterSlider); this.screenMods = new ScreenMods(masterSlider); titleText = Text.newText(FlounderDisplay.getTitle()).setFontSize(MasterSlider.MAIN_TITLE_FONT_SIZE).create(); titleText.setColour(MasterSlider.TEXT_COLOUR); titleText.setBorderColour(MasterSlider.TEXT_COLOUR.r, MasterSlider.TEXT_COLOUR.g, MasterSlider.TEXT_COLOUR.b); titleText.setGlowing(new SinWaveDriver(0.075f, 0.100f, 2.320f)); addText(titleText, MasterSlider.BUTTONS_X_MAGIN_LEFT, -0.23f, 1.0f); float currentY = 1.0f + MasterSlider.BUTTONS_Y_SEPARATION; createQuitButton(GuiAlign.LEFT, currentY -= MasterSlider.BUTTONS_Y_SEPARATION); currentY -= MasterSlider.BUTTONS_Y_SEPARATION * MasterSlider.BUTTONS_Y_SEPARATION; createModsButton(GuiAlign.LEFT, currentY -= MasterSlider.BUTTONS_Y_SEPARATION); createAboutButton(GuiAlign.LEFT, currentY -= MasterSlider.BUTTONS_Y_SEPARATION); createOptionsButton(GuiAlign.LEFT, currentY -= MasterSlider.BUTTONS_Y_SEPARATION); createPlayButton(GuiAlign.LEFT, currentY -= MasterSlider.BUTTONS_Y_SEPARATION); super.show(false); } private void createPlayButton(GuiAlign guiAlign, float yPos) { // GuiCheckbox checkbox = MasterSlider.createCheckbox("Testing", GuiAlign.LEFT, yPos - MasterSlider.BUTTONS_Y_SEPARATION, false, this); GuiTextButton button = MasterSlider.createButton("Play", guiAlign, yPos, this); button.addLeftListener(() -> masterSlider.setNewSecondaryScreen(screenPlay, true)); button.addRightListener(null); } private void createOptionsButton(GuiAlign guiAlign, float yPos) { GuiTextButton button = MasterSlider.createButton("Options", guiAlign, yPos, this); button.addLeftListener(() -> masterSlider.setNewSecondaryScreen(screenOptions, true)); button.addRightListener(null); } private void createAboutButton(GuiAlign guiAlign, float yPos) { GuiTextButton button = MasterSlider.createButton("About", guiAlign, yPos, this); button.addLeftListener(() -> masterSlider.setNewSecondaryScreen(screenAbout, true)); button.addRightListener(null); } private void createModsButton(GuiAlign guiAlign, float yPos) { GuiTextButton button = MasterSlider.createButton("Mods", guiAlign, yPos, this); button.addLeftListener(() -> masterSlider.setNewSecondaryScreen(screenMods, true)); button.addRightListener(null); } private void createQuitButton(GuiAlign guiAlign, float yPos) { GuiTextButton button = MasterSlider.createButton("Quit", guiAlign, yPos, this); button.addLeftListener(FlounderFramework::requestClose); button.addRightListener(null); } @Override protected void updateSelf() { titleText.setColour(GuiTextButton.HOVER_COLOUR); titleText.setBorderColour(GuiTextButton.HOVER_COLOUR); if (slideshow == null && isShown()) { slideshow = new GuiTexture[]{ new GuiTexture(Texture.newTexture(new MyFile(MyFile.RES_FOLDER, "slideshow", "example1.png")).create()), new GuiTexture(Texture.newTexture(new MyFile(MyFile.RES_FOLDER, "slideshow", "example2.png")).create()), new GuiTexture(Texture.newTexture(new MyFile(MyFile.RES_FOLDER, "slideshow", "example3.png")).create()), new GuiTexture(Texture.newTexture(new MyFile(MyFile.RES_FOLDER, "slideshow", "example4.png")).create()), new GuiTexture(Texture.newTexture(new MyFile(MyFile.RES_FOLDER, "slideshow", "example5.png")).create()) }; slideoverlay = new GuiTexture(Texture.newTexture(new MyFile(MyFile.RES_FOLDER, "slideshow", "overlay.png")).nearestFiltering().create()); slideshowDriver = new SlideDriver(slideshow.length - 1.0f, 0.0f, slideshow.length * SLIDE_SPEED); } float progression = slideshowDriver.update(FlounderFramework.getDelta()); if (progression >= slideshow.length - 1.0f) { slideshowDriver = new SlideDriver(slideshow.length - 1.0f, 0.0f, slideshow.length * SLIDE_SPEED); } else if (progression == 0.0f) { slideshowDriver = new SlideDriver(0.0f, slideshow.length - 1.0f, slideshow.length * SLIDE_SPEED); } float currentTextureX = progression; if (isShown()) { for (GuiTexture slide : slideshow) { slide.setPosition(currentTextureX, 0.5f, SLIDESHOW_ASPECT, 1.0f); slide.update(); currentTextureX -= SLIDESHOW_ASPECT; } } slideoverlay.setPosition(FlounderDisplay.getAspectRatio() / 2.0f, 0.5f, FlounderDisplay.getAspectRatio(), 1.0f); slideoverlay.update(); } public MasterMenu getSuperMenu() { return superMenu; } @Override protected void getGuiTextures(List<GuiTexture> guiTextures) { if (isShown()) { for (int i = 0; i < slideshow.length; i++) { guiTextures.add(slideshow[i]); } guiTextures.add(slideoverlay); } } }
39.391608
140
0.766199
9b391bc2c9a4ed17cc3269f2222ba2a4dc585ee9
6,047
package cz.jiripinkas.jsitemapgenerator.generator; import cz.jiripinkas.jsitemapgenerator.AbstractSitemapGenerator; import cz.jiripinkas.jsitemapgenerator.Image; import cz.jiripinkas.jsitemapgenerator.UrlUtil; import cz.jiripinkas.jsitemapgenerator.WebPage; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; public class SitemapGenerator extends AbstractSitemapGenerator<SitemapGenerator> { public enum AdditionalNamespace { IMAGE, XHTML } /** * This constructor is public, because sometimes somebody wants SitemapGenerator to be * a Spring bean and Spring wants to create a proxy which requires public constructor. * But you shouldn't call this constructor on your own, use {@link SitemapGenerator#of(String)} instead. * @param baseUrl Base URL */ public SitemapGenerator(String baseUrl) { super(baseUrl); } /** * Construct additional namespaces string * * @param additionalNamespaceList * @return */ private String constructAdditionalNamespacesString(List<AdditionalNamespace> additionalNamespaceList) { String result = ""; if (additionalNamespaceList.contains(AdditionalNamespace.IMAGE)) { result += " xmlns:image=\"http://www.google.com/schemas/sitemap-image/1.1\" "; } if (additionalNamespaceList.contains(AdditionalNamespace.XHTML)) { result += " xmlns:xhtml=\"http://www.w3.org/1999/xhtml\" "; } return result; } /** * Helper method to create an instance of SitemapGenerator * * @param baseUrl Base URL * @return Instance of SitemapGenerator */ public static SitemapGenerator of(String baseUrl) { return new SitemapGenerator(baseUrl); } /** * Construct sitemap into array of Strings. The URLs will be ordered using * priority in descending order (URLs with higher priority will be at the * top). * * @return sitemap */ @Override public String[] toStringArray() { // auto-detect additional namespaces List<AdditionalNamespace> additionalNamespaces = new ArrayList<>(); boolean hasImages = urls.values().stream() .anyMatch(webPage -> webPage.getImages() != null); if (hasImages) { additionalNamespaces.add(AdditionalNamespace.IMAGE); } boolean hasAlternateNames = urls.values().stream() .anyMatch(webPage -> webPage.getAlternateNames() != null); if (hasAlternateNames) { additionalNamespaces.add(AdditionalNamespace.XHTML); } List<String> out = new ArrayList<>(); out.add("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); out.add("<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"" + constructAdditionalNamespacesString(additionalNamespaces) + ">\n"); List<WebPage> values = new ArrayList<>(urls.values()); Collections.sort(values); for (WebPage webPage : values) { out.add("<url>\n"); out.add(constructUrl(webPage)); if (webPage.getImages() != null) { for (Image image : webPage.getImages()) { out.add(constructImage(image)); } } out.add("</url>\n"); } out.add("</urlset>"); return out.toArray(new String[]{}); } protected String constructImage(Image image) { StringBuilder out = new StringBuilder(); out.append("<image:image>\n"); if (image.getLoc() != null) { out.append("<image:loc>"); out.append(getAbsoluteUrl(image.getLoc())); out.append("</image:loc>\n"); } if (image.getCaption() != null) { out.append("<image:caption>"); out.append(UrlUtil.escapeXmlSpecialCharacters(image.getCaption())); out.append("</image:caption>\n"); } if (image.getGeoLocation() != null) { out.append("<image:geo_location>"); out.append(UrlUtil.escapeXmlSpecialCharacters(image.getGeoLocation())); out.append("</image:geo_location>\n"); } if (image.getTitle() != null) { out.append("<image:title>"); out.append(UrlUtil.escapeXmlSpecialCharacters(image.getTitle())); out.append("</image:title>\n"); } if (image.getLicense() != null) { out.append("<image:license>"); out.append(UrlUtil.escapeXmlSpecialCharacters(image.getLicense())); out.append("</image:license>\n"); } out.append("</image:image>\n"); return out.toString(); } protected String constructUrl(WebPage webPage) { StringBuilder out = new StringBuilder(); out.append("<loc>"); out.append(getAbsoluteUrl(webPage.constructName())); out.append("</loc>\n"); if (webPage.getAlternateNames() != null) { for (Map.Entry<String, String> entry : webPage.getAlternateNames().entrySet()) { out.append("<xhtml:link rel=\"alternate\" hreflang=\""); out.append(UrlUtil.escapeXmlSpecialCharacters(entry.getKey())); out.append("\" href=\""); out.append(getAbsoluteUrl(entry.getValue())); out.append("\"/>\n"); } } if (webPage.getLastMod() != null) { out.append("<lastmod>"); out.append(dateFormat.format(webPage.getLastMod())); out.append("</lastmod>\n"); } if (webPage.getChangeFreq() != null) { out.append("<changefreq>"); out.append(webPage.getChangeFreq()); out.append("</changefreq>\n"); } if (webPage.getPriority() != null) { out.append("<priority>"); out.append(webPage.getPriority()); out.append("</priority>\n"); } return out.toString(); } }
37.32716
149
0.593517
823bb9912470e9959f52bfb708022ddc165c66fc
8,489
package com.lekapin.flutrans.flutrans; import android.content.Context; import android.util.Log; import androidx.annotation.NonNull; import com.google.gson.JsonObject; import com.midtrans.sdk.corekit.callback.TransactionFinishedCallback; import com.midtrans.sdk.corekit.core.MidtransSDK; import com.midtrans.sdk.corekit.core.PaymentMethod; import com.midtrans.sdk.corekit.core.TransactionRequest; import com.midtrans.sdk.corekit.core.UIKitCustomSetting; import com.midtrans.sdk.corekit.core.themes.CustomColorTheme; import com.midtrans.sdk.corekit.models.BillingAddress; import com.midtrans.sdk.corekit.models.CustomerDetails; import com.midtrans.sdk.corekit.models.ItemDetails; import com.midtrans.sdk.corekit.models.ShippingAddress; import com.midtrans.sdk.corekit.models.snap.CreditCard; import com.midtrans.sdk.corekit.models.snap.TransactionResult; import com.midtrans.sdk.uikit.SdkUIFlowBuilder; import org.json.JSONArray; import org.json.JSONObject; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.MethodChannel.MethodCallHandler; import io.flutter.plugin.common.MethodChannel.Result; import io.flutter.plugin.common.PluginRegistry.Registrar; import io.flutter.embedding.engine.plugins.activity.ActivityAware; import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding; import android.app.Activity; import io.flutter.embedding.engine.plugins.FlutterPlugin; /** FlutransPlugin */ public class FlutransPlugin implements FlutterPlugin, ActivityAware, MethodCallHandler, TransactionFinishedCallback { static final String TAG = "FlutransPlugin"; private MethodChannel channel; private Context context; private Activity activity; private BinaryMessenger messenger; private Result flutterResult; public BinaryMessenger getMessenger() { return messenger; } public static void registerWith(@NonNull Registrar registrar) { final FlutransPlugin instance = new FlutransPlugin(); instance.context = registrar.context(); instance.messenger = registrar.messenger(); register(instance); } private static void register(FlutransPlugin plugin) { final MethodChannel methodChannel = new MethodChannel(plugin.getMessenger(), "flutrans"); plugin.channel = methodChannel; methodChannel.setMethodCallHandler(plugin); } @Override public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) { this.context = binding.getApplicationContext(); this.messenger = binding.getBinaryMessenger(); } @Override public void onAttachedToActivity(@NonNull ActivityPluginBinding binding) { this.activity = binding.getActivity(); register(this); } @Override public void onDetachedFromActivity() {} @Override public void onDetachedFromActivityForConfigChanges() { onDetachedFromActivity(); } @Override public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBinding binding) { onAttachedToActivity(binding); } @Override public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) { this.channel.setMethodCallHandler(null); } @Override public void onMethodCall(MethodCall call, Result result) { flutterResult = result; if(call.method.equals("init")) { initMidtransSdk((String)call.argument("client_key").toString(), call.argument("base_url").toString()); result.success(null); } else if(call.method.equals("payment")) { String str = call.arguments(); payment(str); } else { result.notImplemented(); } } private void initMidtransSdk(String client_key, String base_url) { SdkUIFlowBuilder.init() .setClientKey(client_key) // client_key is mandatory .setContext(context) // context is mandatory .setTransactionFinishedCallback(this) // set transaction finish callback (sdk callback) .setMerchantBaseUrl(base_url) //set merchant url .enableLog(true) // enable sdk log .buildSDK(); } void payment(String str) { try { Log.d(TAG, str); JSONObject json = new JSONObject(str); TransactionRequest transactionRequest = new TransactionRequest(json.getString("order_id"), json.getInt("total")); ArrayList<ItemDetails> itemList = new ArrayList<>(); JSONArray arr = json.getJSONArray("items"); for(int i = 0; i < arr.length(); i++) { JSONObject obj = arr.getJSONObject(i); ItemDetails item = new ItemDetails(obj.getString("id"), obj.getInt("price"), obj.getInt("quantity"), obj.getString("name")); itemList.add(item); } if (!json.isNull("customer")) { JSONObject cJson = json.getJSONObject("customer"); CustomerDetails cus = new CustomerDetails(); cus.setFirstName(cJson.getString("first_name")); cus.setLastName(cJson.getString("last_name")); cus.setEmail(cJson.getString("email")); cus.setPhone(cJson.getString("phone")); if (!json.isNull("address")) { JSONObject address = json.getJSONObject("address"); String firstName = address.getString("first_name"); String lastName = address.getString("last_name"); String phone = address.getString("phone"); String address1 = address.getString("address1"); String city = address.getString("city"); String zip = address.getString("zip"); String countryCode = address.getString("country_code"); BillingAddress billingAddress = new BillingAddress(); billingAddress.setFirstName(firstName); billingAddress.setLastName(lastName); billingAddress.setPhone(phone); billingAddress.setAddress(address1); billingAddress.setCity(city); billingAddress.setPostalCode(zip); billingAddress.setCountryCode(countryCode); ShippingAddress shippingAddress = new ShippingAddress(); shippingAddress.setFirstName(firstName); shippingAddress.setLastName(lastName); shippingAddress.setPhone(phone); shippingAddress.setAddress(address1); shippingAddress.setCity(city); shippingAddress.setPostalCode(zip); shippingAddress.setCountryCode(countryCode); cus.setBillingAddress(billingAddress); cus.setShippingAddress(shippingAddress); } transactionRequest.setCustomerDetails(cus); } if(json.has("custom_field_1")) transactionRequest.setCustomField1(json.getString("custom_field_1")); if(json.has("custom_field_2")) transactionRequest.setCustomField2(json.getString("custom_field_2")); if(json.has("custom_field_3")) transactionRequest.setCustomField3(json.getString("custom_field_3")); transactionRequest.setItemDetails(itemList); CreditCard creditCardOptions = new CreditCard(); creditCardOptions.setSaveCard(true); transactionRequest.setCreditCard(creditCardOptions); UIKitCustomSetting setting = MidtransSDK.getInstance().getUIKitCustomSetting(); setting.setSkipCustomerDetailsPages(true); MidtransSDK.getInstance().setUIKitCustomSetting(setting); MidtransSDK.getInstance().setTransactionRequest(transactionRequest); if (activity != null) { Log.d(TAG, "START WITH ACTIVITY"); MidtransSDK.getInstance().startPaymentUiFlow(activity); } else { Log.d(TAG, "START WITH CONTEXT"); MidtransSDK.getInstance().startPaymentUiFlow(context); } } catch(Exception e) { Log.d(TAG, "ERROR " + e.getMessage()); } } @Override public void onTransactionFinished(TransactionResult transactionResult) { Map<String, Object> content = new HashMap<>(); content.put("transactionCanceled", transactionResult.isTransactionCanceled()); content.put("status", transactionResult.getStatus()); content.put("source", transactionResult.getSource()); content.put("statusMessage", transactionResult.getStatusMessage()); if(transactionResult.getResponse() != null) content.put("response", transactionResult.getResponse().toString()); else content.put("response", null); channel.invokeMethod("onTransactionFinished", content); flutterResult.success(null); } }
37.561947
132
0.720697
73a9b2aeee1b22d13e68b28a2bf5bd99e98f2456
473
package org.firstinspires.ftc.teamcode.LearnJavaForFTC.Chpt5; import com.qualcomm.robotcore.eventloop.opmode.OpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; //@TeleOp public class ClassMemberOpMode extends OpMode { boolean initDone; @Override public void init() { telemetry.addData("Init Done", initDone); initDone = true; } @Override public void loop() { telemetry.addData("init Done", initDone); } }
22.52381
61
0.697674
9254af81435b28bc12e6f535e06cc522e69adfbc
2,071
package ch.haclyon.driveimageview; import android.graphics.Bitmap; /** * This is the model for the DriveImageView which includes the the main-text, the folder-text and the image for the ImageView. * * @author Yannick Signer * @since 1.0.0 */ public class DriveImageModel { private String mainTitle; private String folderTitle; private int drawable = R.drawable.placeholder; // TODO set placeholder as default private Bitmap imageBitmap; private boolean isDrawable = true; public DriveImageModel() { // nothing to do } /** * The main constructor of the model. * * @param mainTitle the bigger title (main-text) on the bottom of the figure. * @param folderTitle the smaller title under the divider on the top of the figure. * @param drawable the image as drawable. */ public DriveImageModel(String mainTitle, String folderTitle, int drawable) { this.mainTitle = mainTitle; this.folderTitle = folderTitle; if (drawable != 0) { this.drawable = drawable; } else { this.drawable = R.drawable.placeholder; } this.isDrawable = true; } public String getMainTitle() { return mainTitle; } public void setMainTitle(String mainTitle) { this.mainTitle = mainTitle; } public String getFolderTitle() { return folderTitle; } public void setFolderTitle(String folderTitle) { this.folderTitle = folderTitle; } public int getDrawable() { return drawable; } public void setDrawable(int drawable) { this.drawable = drawable; isDrawable = true; } public Bitmap getImageBitmap() { return imageBitmap; } public void setImageBitmap(Bitmap imageBitmap) { this.imageBitmap = imageBitmap; isDrawable = false; } public boolean isDrawable() { return isDrawable; } public void setIsDrawable(boolean isDrawable) { this.isDrawable = isDrawable; } }
24.081395
126
0.637373
bfe598973776cf2c4071e42c9badf3aea9f72502
2,015
/* * <author>Han He</author> * <email>me@hankcs.com</email> * <create-date>2018-06-22 3:15 PM</create-date> * * <copyright file="DemoPerceptronCWS.java"> * Copyright (c) 2018, Han He. All Rights Reserved, http://www.hankcs.com/ * This source is subject to Han He. Please contact Han He for more information. * </copyright> */ package com.hankcs.book.ch05; import com.hankcs.hanlp.corpus.MSR; import com.hankcs.hanlp.model.perceptron.CWSTrainer; import com.hankcs.hanlp.model.perceptron.PerceptronLexicalAnalyzer; import com.hankcs.hanlp.model.perceptron.model.LinearModel; import com.hankcs.hanlp.seg.Segment; import com.hankcs.hanlp.seg.common.CWSEvaluator; import java.io.IOException; /** * 《自然语言处理入门》5.6 基于结构化感知机的中文分词 * 配套书籍:http://nlp.hankcs.com/book.php * 讨论答疑:https://bbs.hankcs.com/ * * @author hankcs * @see <a href="http://nlp.hankcs.com/book.php">《自然语言处理入门》</a> * @see <a href="https://bbs.hankcs.com/">讨论答疑</a> */ public class EvaluatePerceptronCWS { public static Segment trainStructuredPerceptron() throws IOException { LinearModel model = new CWSTrainer().train(MSR.TRAIN_PATH, MSR.TRAIN_PATH, MSR.MODEL_PATH, 0., 10, 8).getModel(); return new PerceptronLexicalAnalyzer(model).enableCustomDictionary(false); } public static Segment trainAveragedPerceptron() throws IOException { // 线程数为1时自动用平均感知机算法 LinearModel model = new CWSTrainer().train(MSR.TRAIN_PATH, MSR.TRAIN_PATH, MSR.MODEL_PATH, 0., 10, 1).getModel(); return new PerceptronLexicalAnalyzer(model).enableCustomDictionary(false); } public static void main(String[] args) throws IOException { System.out.println("结构化感知机"); System.out.println(CWSEvaluator.evaluate(trainStructuredPerceptron(), MSR.TEST_PATH, MSR.OUTPUT_PATH, MSR.GOLD_PATH, MSR.TRAIN_WORDS)); System.out.println("平均感知机"); System.out.println(CWSEvaluator.evaluate(trainAveragedPerceptron(), MSR.TEST_PATH, MSR.OUTPUT_PATH, MSR.GOLD_PATH, MSR.TRAIN_WORDS)); } }
40.3
143
0.728536
c7dedffe488e0f57b2abf56d204d9f8f85b4cb0a
209
package com.zlinks.common.mapper; /** * Copyright (C), 2017-2018, BBG * FileName: BaseSelectMapper * Author: zhangjh * Date: 2018/6/8 16:01 * Description: */ public interface BaseSelectMapper { }
17.416667
35
0.679426
e221522bb30ceeb16560535e3455b7f9183a0fce
319
package com.validator.warden.enums; import com.validator.warden.annotation.Matcher; import lombok.Data; import lombok.experimental.Accessors; /** * @author DandyLuo */ @Data @Accessors(chain = true) public class ChildDataEntity extends DataEntity { @Matcher(value = {"a", "b"}) private String nameChild; }
18.764706
49
0.736677
8f60bc5032269bab7186e3af3647247a6165b25f
990
package me.caprei.crazyctf.game; import java.util.HashSet; import java.util.Set; import org.bukkit.entity.Player; public class PlayerManager { private static PlayerManager playerManager = new PlayerManager(); private Set<GamePlayer> players = new HashSet<>(); private PlayerManager(){} public static PlayerManager getPlayerManager(){ return playerManager; } public void addPlayer(GamePlayer player){ players.add(player); } public void removePlayer(Player player){ for(GamePlayer gamePlayer:players){ if(gamePlayer.getPlayer().equals(player)){ players.remove(gamePlayer); } } } public void removePlayer(GamePlayer player){ players.remove(player); } public Set<GamePlayer> getPlayers(){ return players; } public GamePlayer getGamePlayer(Player player){ for(GamePlayer gamePlayer:players){ if(gamePlayer.getPlayer().equals(player)){ return gamePlayer; } } return null; } }
20.625
67
0.694949
02a523bcd90dca253bcd9e668a7b2fdf62ad808a
1,777
package com.trigyn.jws.webstarter.controller; import java.util.HashMap; import java.util.Map; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import com.trigyn.jws.templating.service.MenuService; import com.trigyn.jws.usermanagement.security.config.UserInformation; @RestController @RequestMapping("/cf") public class JwsWelcomeController { @Autowired private MenuService menuService = null; @Autowired private ServletContext servletContext = null; @GetMapping() @ResponseBody public void welcome(HttpServletResponse httpServletResponse) throws Exception { httpServletResponse.sendRedirect(servletContext.getContextPath() + "/cf/home"); } @GetMapping("/welcome") @ResponseBody public String welcomeUser(Map<String, Object> model) throws Exception { Map<String, Object> mapDetails = new HashMap<>(); String name = SecurityContextHolder.getContext().getAuthentication().getName(); if (name != null && !name.equalsIgnoreCase("anonymousUser")) { UserInformation userDetails = (UserInformation) SecurityContextHolder.getContext().getAuthentication() .getPrincipal(); mapDetails.put("loggedInUser", Boolean.TRUE); mapDetails.put("userName", userDetails.getFullName()); } else { mapDetails.put("loggedInUser", Boolean.FALSE); } return menuService.getTemplateWithSiteLayout("jws-welcome", mapDetails); } }
32.309091
105
0.794035
cfbbf2826a004d1a0f27def0e6ad74ff30901e4b
1,266
/* * Copyright (c) MIT License * 2020, Markus Walder (https://github.com/M4rukku) */ package org.marukku.ukkonenscs.actrie; import java.util.Objects; /** * A way to report matches found in a string. It defines where and which word was matched. * * @author Markus Walder * @since 26.12.2020, Sa. */ public class Match { public String word; public int startPosition; public int endPosition; /** * Creates a new Match Object based on Parameters. * * @param word the String matched * @param startPosition the position where the word occurred in the text * @param endPosition where the word ends in the text */ public Match(String word, int startPosition, int endPosition) { this.word = word; this.startPosition = startPosition; this.endPosition = endPosition; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Match match = (Match) o; return startPosition == match.startPosition && endPosition == match.endPosition && word.equals(match.word); } @Override public int hashCode() { return Objects.hash(word, startPosition, endPosition); } }
23.444444
90
0.650869
739b3bb39066938cbd09583db4045a6f2ed3e636
874
package deltix.qsrv.hf.tickdb.util; import deltix.qsrv.hf.tickdb.pub.TickCursor; import java.io.IOException; /** * */ public class ReaderImpl implements Reader { private TickCursor cursor; private long endTime; public ReaderImpl(final TickCursor cursor, final long endTime) { if (cursor == null) throw new IllegalArgumentException("TickCursor is null"); this.cursor = cursor; this.endTime = endTime; } @Override public boolean next() { boolean has_next = cursor.next(); if (has_next && cursor.getMessage().getTimeStampMs() > endTime) return false; return has_next; } @Override public Object getMessage() { return cursor.getMessage(); } @Override public void close() throws IOException { cursor.close(); } }
20.809524
71
0.616705
5b3d8babd44052b09715f0b76ebc66072e04160b
4,364
package com.qh.basic.service.impl; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.qh.common.core.enums.CodeEnum; import com.qh.common.core.exception.BizException; import com.qh.common.core.utils.http.DateUtil; import com.qh.common.security.utils.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.qh.common.core.utils.StringUtils; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.qh.basic.mapper.ScEpidemicDailyMapper; import com.qh.basic.api.domain.ScEpidemicDaily; import com.qh.basic.service.IScEpidemicDailyService; import java.text.ParseException; import java.util.List; /** * 疫情日报Service业务层处理 * * @author huangdaoquan * @date 2021-01-19 */ @Service public class ScEpidemicDailyServiceImpl extends ServiceImpl<ScEpidemicDailyMapper, ScEpidemicDaily> implements IScEpidemicDailyService { @Autowired ScEpidemicDailyMapper epidemicDailyMapper; /** * 分页查询疫情日报集合 * * @param page 分页信息 * @param scEpidemicDaily 操作疫情日报对象 * @return 操作疫情日报集合 */ @Override public IPage<ScEpidemicDaily> selectScEpidemicDailyListByPage(IPage<ScEpidemicDaily> page, ScEpidemicDaily scEpidemicDaily) { try { //创建时间入参 时间转换为时间戳 if(StringUtils.isNotBlank(scEpidemicDaily.getBeginTime()) ) { scEpidemicDaily.setBeginTime(DateUtil.dateToStamp(scEpidemicDaily.getBeginTime()+" 00:00:00")); } if(StringUtils.isNotBlank(scEpidemicDaily.getEndTime()) ) { scEpidemicDaily.setEndTime(DateUtil.dateToStamp(scEpidemicDaily.getEndTime()+" 23:59:59")); } scEpidemicDaily.setOrgId(SecurityUtils.getOrgId()); return this.page(page, getQuery(scEpidemicDaily)); }catch (ParseException ex){ throw new BizException(CodeEnum.SQL_ORDER_BY_INVALID); } } /** * 查询疫情日报集合 * * @param scEpidemicDaily 操作疫情日报对象 * @return 操作疫情日报集合 */ @Override public List<ScEpidemicDaily> selectScEpidemicDailyList(ScEpidemicDaily scEpidemicDaily) { try { //创建时间入参 时间转换为时间戳 if(StringUtils.isNotBlank(scEpidemicDaily.getBeginTime()) ) { scEpidemicDaily.setBeginTime(DateUtil.dateToStamp(scEpidemicDaily.getBeginTime()+" 00:00:00")); } if(StringUtils.isNotBlank(scEpidemicDaily.getEndTime()) ) { scEpidemicDaily.setEndTime(DateUtil.dateToStamp(scEpidemicDaily.getEndTime()+" 23:59:59")); } scEpidemicDaily.setOrgId(SecurityUtils.getOrgId()); return this.list(getQuery(scEpidemicDaily)); }catch (ParseException ex){ throw new BizException(CodeEnum.SQL_ORDER_BY_INVALID); } } /** * 查询疫情日报参数拼接 */ private QueryWrapper<ScEpidemicDaily> getQuery(ScEpidemicDaily scEpidemicDaily) { QueryWrapper<ScEpidemicDaily> queryWrapper = new QueryWrapper<>(); queryWrapper.between(StringUtils.isNotBlank(scEpidemicDaily.getBeginTime())&& StringUtils.isNotBlank(scEpidemicDaily.getEndTime()) ,"create_date",scEpidemicDaily.getBeginTime(),scEpidemicDaily.getEndTime()); queryWrapper.eq(StringUtils.isNotBlank(scEpidemicDaily.getOrgId()), "org_id", scEpidemicDaily.getOrgId()); queryWrapper.eq(StringUtils.isNotBlank(scEpidemicDaily.getPublisherId()), "publisher_id", scEpidemicDaily.getPublisherId()); queryWrapper.like(StringUtils.isNotBlank(scEpidemicDaily.getPublisherName()), "publisher_name", scEpidemicDaily.getPublisherName()); queryWrapper.eq(scEpidemicDaily.getStateMark() != null, "state_mark", scEpidemicDaily.getStateMark()); queryWrapper.eq(StringUtils.isNotBlank(scEpidemicDaily.getOrgId()), "org_id", scEpidemicDaily.getOrgId()); queryWrapper.like(StringUtils.isNotBlank(scEpidemicDaily.getOrgName()), "org_name", scEpidemicDaily.getOrgName()); // 默认排序主键Id赋值 queryWrapper.orderByDesc("create_date"); return queryWrapper; } /** * 根据所有学校批量 创建生成当天的疫情日报 * @return */ @Override public int batchTodayAddByOrg(){ return epidemicDailyMapper.batchTodayAddByOrg(); } }
41.169811
140
0.708524
fcafa334154d6df362eaff6da57b3d39e02fc2a3
9,600
/** */ package de.uni_hildesheim.sse.ivml.impl; import de.uni_hildesheim.sse.ivml.Expression; import de.uni_hildesheim.sse.ivml.IfExpression; import de.uni_hildesheim.sse.ivml.IvmlPackage; import de.uni_hildesheim.sse.ivml.OptBlockExpression; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>If Expression</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link de.uni_hildesheim.sse.ivml.impl.IfExpressionImpl#getIfEx <em>If Ex</em>}</li> * <li>{@link de.uni_hildesheim.sse.ivml.impl.IfExpressionImpl#getThenEx <em>Then Ex</em>}</li> * <li>{@link de.uni_hildesheim.sse.ivml.impl.IfExpressionImpl#getElseEx <em>Else Ex</em>}</li> * </ul> * * @generated */ public class IfExpressionImpl extends MinimalEObjectImpl.Container implements IfExpression { /** * The cached value of the '{@link #getIfEx() <em>If Ex</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getIfEx() * @generated * @ordered */ protected Expression ifEx; /** * The cached value of the '{@link #getThenEx() <em>Then Ex</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getThenEx() * @generated * @ordered */ protected OptBlockExpression thenEx; /** * The cached value of the '{@link #getElseEx() <em>Else Ex</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getElseEx() * @generated * @ordered */ protected OptBlockExpression elseEx; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected IfExpressionImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return IvmlPackage.Literals.IF_EXPRESSION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Expression getIfEx() { return ifEx; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetIfEx(Expression newIfEx, NotificationChain msgs) { Expression oldIfEx = ifEx; ifEx = newIfEx; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, IvmlPackage.IF_EXPRESSION__IF_EX, oldIfEx, newIfEx); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void setIfEx(Expression newIfEx) { if (newIfEx != ifEx) { NotificationChain msgs = null; if (ifEx != null) msgs = ((InternalEObject)ifEx).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - IvmlPackage.IF_EXPRESSION__IF_EX, null, msgs); if (newIfEx != null) msgs = ((InternalEObject)newIfEx).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - IvmlPackage.IF_EXPRESSION__IF_EX, null, msgs); msgs = basicSetIfEx(newIfEx, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, IvmlPackage.IF_EXPRESSION__IF_EX, newIfEx, newIfEx)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public OptBlockExpression getThenEx() { return thenEx; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetThenEx(OptBlockExpression newThenEx, NotificationChain msgs) { OptBlockExpression oldThenEx = thenEx; thenEx = newThenEx; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, IvmlPackage.IF_EXPRESSION__THEN_EX, oldThenEx, newThenEx); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void setThenEx(OptBlockExpression newThenEx) { if (newThenEx != thenEx) { NotificationChain msgs = null; if (thenEx != null) msgs = ((InternalEObject)thenEx).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - IvmlPackage.IF_EXPRESSION__THEN_EX, null, msgs); if (newThenEx != null) msgs = ((InternalEObject)newThenEx).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - IvmlPackage.IF_EXPRESSION__THEN_EX, null, msgs); msgs = basicSetThenEx(newThenEx, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, IvmlPackage.IF_EXPRESSION__THEN_EX, newThenEx, newThenEx)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public OptBlockExpression getElseEx() { return elseEx; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetElseEx(OptBlockExpression newElseEx, NotificationChain msgs) { OptBlockExpression oldElseEx = elseEx; elseEx = newElseEx; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, IvmlPackage.IF_EXPRESSION__ELSE_EX, oldElseEx, newElseEx); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void setElseEx(OptBlockExpression newElseEx) { if (newElseEx != elseEx) { NotificationChain msgs = null; if (elseEx != null) msgs = ((InternalEObject)elseEx).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - IvmlPackage.IF_EXPRESSION__ELSE_EX, null, msgs); if (newElseEx != null) msgs = ((InternalEObject)newElseEx).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - IvmlPackage.IF_EXPRESSION__ELSE_EX, null, msgs); msgs = basicSetElseEx(newElseEx, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, IvmlPackage.IF_EXPRESSION__ELSE_EX, newElseEx, newElseEx)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case IvmlPackage.IF_EXPRESSION__IF_EX: return basicSetIfEx(null, msgs); case IvmlPackage.IF_EXPRESSION__THEN_EX: return basicSetThenEx(null, msgs); case IvmlPackage.IF_EXPRESSION__ELSE_EX: return basicSetElseEx(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case IvmlPackage.IF_EXPRESSION__IF_EX: return getIfEx(); case IvmlPackage.IF_EXPRESSION__THEN_EX: return getThenEx(); case IvmlPackage.IF_EXPRESSION__ELSE_EX: return getElseEx(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case IvmlPackage.IF_EXPRESSION__IF_EX: setIfEx((Expression)newValue); return; case IvmlPackage.IF_EXPRESSION__THEN_EX: setThenEx((OptBlockExpression)newValue); return; case IvmlPackage.IF_EXPRESSION__ELSE_EX: setElseEx((OptBlockExpression)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case IvmlPackage.IF_EXPRESSION__IF_EX: setIfEx((Expression)null); return; case IvmlPackage.IF_EXPRESSION__THEN_EX: setThenEx((OptBlockExpression)null); return; case IvmlPackage.IF_EXPRESSION__ELSE_EX: setElseEx((OptBlockExpression)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case IvmlPackage.IF_EXPRESSION__IF_EX: return ifEx != null; case IvmlPackage.IF_EXPRESSION__THEN_EX: return thenEx != null; case IvmlPackage.IF_EXPRESSION__ELSE_EX: return elseEx != null; } return super.eIsSet(featureID); } } //IfExpressionImpl
27.906977
144
0.620833
28ab7849c353a7d768b240c6b2cc059fe38ae705
3,045
package com.tronipm.festivaldeinvernodegaranhuns_fig.activities; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import android.widget.Toast; import com.tronipm.festivaldeinvernodegaranhuns_fig.R; import com.tronipm.festivaldeinvernodegaranhuns_fig.entidades.Dia; import com.tronipm.festivaldeinvernodegaranhuns_fig.entidades.Palco; import java.util.ArrayList; /** * Created by Mateus on 19/07/2017. * For project FestivaldeInvernodeGaranhuns-FIG. <https://github.com/TroniPM/AppFig> * Contact: <paulomatew@gmail.com> */ public class PalcoActivity extends AppCompatActivity { private ListviewAdapterDia novoadapter; private ArrayList<Dia> arrayDias = null; private ListView novoListview; public static Palco palco = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_palco); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); try { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); setTitle(palco.nome.replace("Palco ", "")); } catch (Exception e) { } /*FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab_dia); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Compartilhar dia", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } });*/ novoListview = (ListView) findViewById(R.id.listviewitem); if (arrayDias == null) { arrayDias = palco.arrayDias; } novoadapter = new ListviewAdapterDia(this, arrayDias); novoListview.setAdapter(novoadapter); novoListview.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { //Toast.makeText(PalcoActivity.this, "Clicou no " + i, Toast.LENGTH_SHORT).show(); DiaActivity.dia = arrayDias.get(i); DiaActivity.palco = palco; Intent novaintent = new Intent(PalcoActivity.this, DiaActivity.class); PalcoActivity.this.startActivity(novaintent); } }); } /*@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.act_main, menu); return true; }*/ }
35.406977
98
0.682759
bd795d79fafe277d7e2666cd558f2a511ad56fe9
623
package com.patternity.annotation.designpattern; import java.lang.annotation.Documented; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Marks the instance as following the Builder pattern to helps construct other * instances "products" step by step. * * @see <a href="http://en.wikipedia.org/wiki/Builder_pattern">Builder Pattern * (Wikipedia)</a> * * @author Cyrille.Martraire */ @Retention(RetentionPolicy.CLASS) @Inherited @Documented public @interface Builder { Class<?>[] value() default {}; }
25.958333
80
0.725522
7ee6d54fb95f4fe1b06b2e472990ee6e154c4a12
13,108
/* * Copyright 2017 Matthew Tamlin * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.matthewtamlin.mixtape.library_tests.data.mixtape_header; import com.matthewtamlin.mixtape.library.base_mvp.BaseDataSource; import com.matthewtamlin.mixtape.library.data.LibraryItem; import com.matthewtamlin.mixtape.library.mixtape_header.DirectHeaderPresenter; import com.matthewtamlin.mixtape.library.mixtape_header.HeaderView; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import static org.mockito.Matchers.anyBoolean; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; /** * Unit tests for the {@link DirectHeaderPresenter} class. */ @SuppressWarnings("unchecked") // Warning caused by mocks, but it isn't a problem @RunWith(JUnit4.class) public class TestDirectHeaderPresenter { /** * The presenter under test. */ private DirectHeaderPresenter<LibraryItem, BaseDataSource<LibraryItem>, HeaderView> presenter; /** * Initialises the testing objects and assigns them to member variables. */ @Before public void setup() { presenter = new DirectHeaderPresenter<>(); } /** * Test to verify that the {@link DirectHeaderPresenter#setDataSource(BaseDataSource)} method * functions correctly when the presenter does not have a view. The test will only pass if the * presenter is registered and unregisters for callbacks, and if the correct calls are made to * load data. */ @Test public void testSetDataSource_withoutView() { final BaseDataSource<LibraryItem> dataSource1 = mock(BaseDataSource.class); final BaseDataSource<LibraryItem> dataSource2 = mock(BaseDataSource.class); presenter.setDataSource(dataSource1); verify(dataSource1).registerDataReplacedListener(presenter); verify(dataSource1).registerDataModifiedListener(presenter); verify(dataSource1).registerLongOperationListener(presenter); verify(dataSource1).loadData(anyBoolean(), eq(presenter)); presenter.setDataSource(dataSource2); verify(dataSource1).unregisterDataReplacedListener(presenter); verify(dataSource1).unregisterDataModifiedListener(presenter); verify(dataSource1).unregisterLongOperationListener(presenter); verify(dataSource2).registerDataReplacedListener(presenter); verify(dataSource2).registerLongOperationListener(presenter); verify(dataSource2).registerDataModifiedListener(presenter); verify(dataSource1).loadData(anyBoolean(), eq(presenter)); presenter.setDataSource(null); verify(dataSource2).unregisterDataReplacedListener(presenter); verify(dataSource2).unregisterDataModifiedListener(presenter); verify(dataSource2).unregisterLongOperationListener(presenter); } /** * Test to verify that the {@link DirectHeaderPresenter#setDataSource(BaseDataSource)} method * functions correctly when the presenter has a view. The test will only pass if the view is * updated with the new data when the data source is changed. */ @Test public void testSetDataSource_withView() { final HeaderView view = mock(HeaderView.class); presenter.setView(view); final LibraryItem data1 = mock(LibraryItem.class); final BaseDataSource<LibraryItem> dataSource1 = new SettableBaseDataSource(data1); final LibraryItem data2 = mock(LibraryItem.class); final BaseDataSource<LibraryItem> dataSource2 = new SettableBaseDataSource(data2); presenter.setDataSource(dataSource1); verify(view).setItem(data1); presenter.setDataSource(dataSource2); verify(view, atLeastOnce()).setItem(data2); presenter.setDataSource(null); verify(view).setItem(null); } /** * Test to verify that the {@link DirectHeaderPresenter#setView(HeaderView)} method functions * correctly when the presenter does not have a data source. The test will only pass if all * methods exit normally. */ @Test public void testSetView_withoutDataSource() { final HeaderView view1 = mock(HeaderView.class); final HeaderView view2 = mock(HeaderView.class); presenter.setView(view1); presenter.setView(view2); presenter.setView(null); } /** * Test to verify that the {@link DirectHeaderPresenter#setView(HeaderView)} method functions * correctly when the presenter has a data source. The test will only pass if the presenter * registers/unregisters itself with the views and loads data into the views. */ @Test public void testSetView_withDataSource() { final LibraryItem data = mock(LibraryItem.class); final BaseDataSource<LibraryItem> dataSource = new SettableBaseDataSource(data); presenter.setDataSource(dataSource); final HeaderView view1 = mock(HeaderView.class); final HeaderView view2 = mock(HeaderView.class); presenter.setView(view1); verify(view1).setItem(data); presenter.setView(view2); verify(view1).setItem(null); verify(view2).setItem(data); presenter.setView(null); verify(view2).setItem(null); } /** * Test to verify that the {@link DirectHeaderPresenter} class functions correctly when the data * source delivers a data loaded callback and there is no view. The test will only pass if all * methods exit normally. */ @Test public void testOnDataLoaded_withoutView() { final LibraryItem data = mock(LibraryItem.class); final BaseDataSource<LibraryItem> dataSource = new SettableBaseDataSource(data); presenter.setDataSource(dataSource); presenter.onDataLoaded(dataSource, data); } /** * Test to verify that the {@link DirectHeaderPresenter} class functions correctly when the data * source delivers a data loaded callback and there is a view. The test will only pass if the * data in the view is updated. */ @Test public void testOnDataLoaded_withView() { final LibraryItem data = mock(LibraryItem.class); final BaseDataSource<LibraryItem> dataSource = new SettableBaseDataSource(data); presenter.setDataSource(dataSource); final HeaderView view = mock(HeaderView.class); presenter.setView(view); verify(view, times(1)).setItem(data); presenter.onDataLoaded(dataSource, data); verify(view, times(2)).setItem(data); } /** * Test to verify that the {@link DirectHeaderPresenter} class functions correctly when the data * source delivers a data load failed callback and there is no view. The test will only pass if * all methods exit normally. */ @Test public void testOnLoadDataFailed_withoutView() { final LibraryItem data = mock(LibraryItem.class); final BaseDataSource<LibraryItem> dataSource = new SettableBaseDataSource(data); presenter.setDataSource(dataSource); presenter.onLoadDataFailed(dataSource); } /** * Test to verify that the {@link DirectHeaderPresenter} class functions correctly when the data * source delivers a data load failed callback and there is a view. The test will only pass if * the view is updated to display no data. */ @Test public void testOnLoadDataFailed_withView() { final LibraryItem data = mock(LibraryItem.class); final BaseDataSource<LibraryItem> dataSource = new SettableBaseDataSource(data); presenter.setDataSource(dataSource); final HeaderView view = mock(HeaderView.class); presenter.setView(view); verify(view, never()).setItem(null); presenter.onLoadDataFailed(dataSource); verify(view, times(1)).setItem(null); } /** * Test to verify that the {@link DirectHeaderPresenter} class functions correctly when the data * source delivers a data replaced callback and there is no view. The test will only pass if all * methods exit normally. */ @Test public void testOnDataReplaced_withoutView() { final LibraryItem data = mock(LibraryItem.class); final BaseDataSource<LibraryItem> dataSource = new SettableBaseDataSource(data); presenter.setDataSource(dataSource); presenter.onDataReplaced(dataSource, mock(LibraryItem.class), mock(LibraryItem.class)); } /** * Test to verify that the {@link DirectHeaderPresenter} functions correctly when the data * source delivers a data replaced callback and there is a view. The test will only pass if the * view updated to display the new data. */ @Test public void testOnDataReplaced_withView() { final LibraryItem originalData = mock(LibraryItem.class); final SettableBaseDataSource dataSource = new SettableBaseDataSource(originalData); presenter.setDataSource(dataSource); final HeaderView view = mock(HeaderView.class); presenter.setView(view); final LibraryItem newData = mock(LibraryItem.class); dataSource.setData(newData); presenter.onDataReplaced(dataSource, originalData, newData); verify(view, atLeastOnce()).setItem(newData); } /** * Test to verify that the {@link DirectHeaderPresenter} functions correctly when the data * source delivers a data modified callback and there is no view. The test will only pass if all * methods exit normally. */ @Test public void testOnDataModified_withoutView() { final LibraryItem data = mock(LibraryItem.class); final BaseDataSource<LibraryItem> dataSource = new SettableBaseDataSource(data); presenter.setDataSource(dataSource); presenter.onDataModified(dataSource, data); } /** * Test to verify that the {@link DirectHeaderPresenter} functions correctly when the data * source delivers a data modified callback and there is a view. The test will only pass if the * view is notified of the event. */ @Test public void testOnDataModified_withHeaderView() { final LibraryItem data = mock(LibraryItem.class); final BaseDataSource<LibraryItem> dataSource = new SettableBaseDataSource(data); presenter.setDataSource(dataSource); final HeaderView view = mock(HeaderView.class); presenter.setView(view); verify(view, never()).notifyItemChanged(); presenter.onDataModified(dataSource, data); verify(view, times(1)).notifyItemChanged(); } /** * Test to verify that the {@link DirectHeaderPresenter} functions correctly when the data * source delivers a long operation started callback and there is no view. The test will only * pass if all methods exit normally. */ @Test public void testOnLongOperationStarted_withoutView() { final LibraryItem data = mock(LibraryItem.class); final BaseDataSource<LibraryItem> dataSource = new SettableBaseDataSource(data); presenter.setDataSource(dataSource); presenter.onLongOperationStarted(dataSource); } /** * Test to verify that the {@link DirectHeaderPresenter} functions correctly when the data * source delivers a long operation started callback and there is a view. The test will only * pass if all methods exit normally. */ @Test public void testOnLongOperationStarted_withView() { final LibraryItem data = mock(LibraryItem.class); final BaseDataSource<LibraryItem> dataSource = new SettableBaseDataSource(data); presenter.setDataSource(dataSource); final HeaderView view = mock(HeaderView.class); presenter.setView(view); presenter.onLongOperationStarted(dataSource); } /** * Test to verify that the {@link DirectHeaderPresenter} functions correctly when the data * source delivers a long operation finished callback and there is no view. The test will only * pass if all methods exit normally. */ @Test public void testOnLongOperationFinished_withoutView() { final LibraryItem data = mock(LibraryItem.class); final BaseDataSource<LibraryItem> dataSource = new SettableBaseDataSource(data); presenter.setDataSource(dataSource); presenter.onLongOperationFinished(dataSource); } /** * Test to verify that the {@link DirectHeaderPresenter} functions correctly when the data * source delivers a long operation finished callback and there is a view. The test will only * pass if all methods exit normally. */ @Test public void testOnLongOperationFinished_withView() { final LibraryItem data = mock(LibraryItem.class); final BaseDataSource<LibraryItem> dataSource = new SettableBaseDataSource(data); presenter.setDataSource(dataSource); final HeaderView view = mock(HeaderView.class); presenter.setView(view); presenter.onLongOperationFinished(dataSource); } }
35.716621
98
0.750381
c3909b0d4378d383c41eb8f1c2e0ddcec4ad4dd8
1,948
package org.anddev.andengine.entity.shape.modifier; import org.anddev.andengine.entity.shape.IShape; import org.anddev.andengine.util.modifier.ParallelModifier; /** * @author Nicolas Gramlich * @since 12:40:31 - 03.09.2010 */ public class ParallelShapeModifier extends ParallelModifier<IShape> implements IShapeModifier { // =========================================================== // Constants // =========================================================== // =========================================================== // Fields // =========================================================== // =========================================================== // Constructors // =========================================================== public ParallelShapeModifier(final IShapeModifier... pShapeModifiers) throws IllegalArgumentException { super(pShapeModifiers); } public ParallelShapeModifier(final IShapeModifierListener pShapeModifierListener, final IShapeModifier... pShapeModifiers) throws IllegalArgumentException { super(pShapeModifierListener, pShapeModifiers); } protected ParallelShapeModifier(final ParallelShapeModifier pParallelShapeModifier) { super(pParallelShapeModifier); } @Override public ParallelShapeModifier clone() { return new ParallelShapeModifier(this); } // =========================================================== // Getter & Setter // =========================================================== // =========================================================== // Methods for/from SuperClass/Interfaces // =========================================================== // =========================================================== // Methods // =========================================================== // =========================================================== // Inner and Anonymous Classes // =========================================================== }
34.785714
157
0.430185
af8f678defab7028fcf62c4a9ad6c994372a6d84
335
package repositories; import com.google.inject.ImplementedBy; import models.KeyValue; import java.util.List; @ImplementedBy(JPAKeyValueRepository.class) public interface KeyValueRepository { KeyValue get(long id); KeyValue add(KeyValue stepStatus); List<KeyValue> list(); void addAll(List<KeyValue> keyValues); }
18.611111
43
0.764179
6448bb616e0b9972e0086809bc8c25462d872701
683
package com.owdp.dbutil.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * <pre> * 自动注入Dao * 在Service中使用Dao,可以用这样的形式: * public class XXService { * {@code @Dao} * private XXDao xxDao; * * {@code @Cacheable(value = "xxx",key = "xxx")} * public List&lt;XX&gt; listAll(){ * xxDao.listAll(); * } * } * * 在调用 * XXService xxService = DbUtils.getServiceImpl(XXService.class); * 后,xxDao会被自动赋值 * * </pre> */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface Dao { }
20.088235
67
0.654466
50a4e14bde7f5762a9764a7f3b5cb4604af6c1b5
12,890
/** * Copyright Notice * * This is a work of the U.S. Government and is not subject to copyright * protection in the United States. Foreign copyrights may apply. * * 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 gov.va.isaac.gui; import gov.va.isaac.AppContext; import gov.va.isaac.ExtendedAppContext; import gov.va.isaac.RuntimeGlobals; import gov.va.isaac.gui.util.FxUtils; import gov.va.isaac.gui.util.ToolTipDefaultsFixer; import gov.va.isaac.interfaces.gui.ApplicationMenus; import gov.va.isaac.interfaces.gui.MenuItemI; import gov.va.isaac.interfaces.gui.views.DockedViewI; import gov.va.isaac.interfaces.gui.views.IsaacViewWithMenusI; import gov.va.isaac.interfaces.utility.ServicesToPreloadI; import java.util.Comparator; import java.util.Hashtable; import java.util.TreeSet; import java.util.concurrent.atomic.AtomicLong; import java.util.function.Consumer; import javafx.beans.InvalidationListener; import javafx.beans.Observable; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Orientation; import javafx.geometry.Pos; import javafx.scene.control.Button; import javafx.scene.control.CheckMenuItem; import javafx.scene.control.Label; import javafx.scene.control.Menu; import javafx.scene.control.MenuBar; import javafx.scene.control.MenuItem; import javafx.scene.control.SplitPane; import javafx.scene.image.ImageView; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.BorderPane; import javax.inject.Inject; import org.glassfish.hk2.api.IterableProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Controller class for {@link App}. * * @author ocarlsen * @author <a href="mailto:daniel.armbrust.list@gmail.com">Dan Armbrust</a> */ public class AppController { private static final Logger LOG = LoggerFactory.getLogger(AppController.class); private BorderPane root_; private SplitPane mainSplitPane; private MenuBar menuBar; private BorderPane loadWait; private boolean preloadExecuted = false; @Inject private IterableProvider<IsaacViewWithMenusI> moduleViews_; @Inject private IterableProvider<DockedViewI> dockedViews_; @Inject private IterableProvider<ServicesToPreloadI> preloadRequested_; //Just a hashed view of all of the menus (including nested menus) private final Hashtable<String, Menu> allMenus_ = new Hashtable<>(); public AppController() { AppContext.getServiceLocator().inject(this); ToolTipDefaultsFixer.setTooltipTimers(100, 20000, 200); root_ = new BorderPane(); mainSplitPane = new SplitPane(); mainSplitPane.setDividerPositions(0.60); mainSplitPane.setOrientation(Orientation.HORIZONTAL); mainSplitPane.getStyleClass().add("hashedBackground"); root_.setCenter(mainSplitPane); root_.setMaxHeight(Double.MAX_VALUE); root_.setMaxWidth(Double.MAX_VALUE); loadWait = new BorderPane(); loadWait.setCenter(LightWeightDialogs.buildLoadingDialog()); mainSplitPane.getItems().add(loadWait); mainSplitPane.setMaxWidth(Double.MAX_VALUE); mainSplitPane.setMaxHeight(Double.MAX_VALUE); menuBar = new MenuBar(); for (ApplicationMenus menu : ApplicationMenus.values()) { Menu m = new Menu(menu.getMenuName()); m.setId(menu.getMenuId()); if (!menu.getAlwaysAvailable()) { m.setDisable(true); } m.setMnemonicParsing(false); menuBar.getMenus().add(m); //index these for ease in adding module menus allMenus_.put(m.getId(), m); } root_.setTop(menuBar); //Sort them... TreeSet<MenuItemI> menusToAdd = new TreeSet<>(); for (IsaacViewWithMenusI view : moduleViews_) { for (MenuItemI menuItem : view.getMenuBarMenus()) { menusToAdd.add(menuItem); } } for (final MenuItemI menuItemsToCreate : menusToAdd) { Menu parentMenu = allMenus_.get(menuItemsToCreate.getParentMenuId()); if (parentMenu == null) { LOG.error("Cannot add module menu '" + menuItemsToCreate.getMenuId() + "' because the specified parent menu doesn't exist"); } else { MenuItem menuItem = new MenuItem(); menuItem.setId(menuItemsToCreate.getMenuId()); menuItem.setText(menuItemsToCreate.getMenuName()); menuItem.setMnemonicParsing(menuItemsToCreate.enableMnemonicParsing()); menuItem.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent arg0) { menuItemsToCreate.handleMenuSelection(root_.getScene().getWindow()); } }); if (menuItemsToCreate.getImage() != null) { menuItem.setGraphic(new ImageView(menuItemsToCreate.getImage())); } if (menuItemsToCreate.getDisableBinding() != null) { menuItem.disableProperty().bind(menuItemsToCreate.getDisableBinding()); } parentMenu.getItems().add(menuItem); //TODO fix this sorting API stuff... supposed to be sorted by the menu order in the menu API - but was never finished... see other TODO below. parentMenu.getItems().sort(new Comparator<MenuItem>() { @Override public int compare(MenuItem o1, MenuItem o2) { return o1.getText().compareTo(o2.getText()); } }); } } LOG.debug("Menus configured"); for (final DockedViewI dv : dockedViews_) { try { Menu parentMenu = allMenus_.get(dv.getMenuBarMenuToShowView().getParentMenuId()); if (parentMenu == null) { LOG.error("Cannot add module menu '" + dv.getMenuBarMenuToShowView().getMenuId() + "' because the specified parent menu doesn't exist"); } else { final BorderPane bp = buildPanelForView(dv); //TODO this isn't honoring sort order... need to sort all of the menus from the DockedViewI at once.... final CheckMenuItem mi = new CheckMenuItem(); mi.setText(dv.getMenuBarMenuToShowView().getMenuName()); mi.setId(dv.getMenuBarMenuToShowView().getMenuId()); mi.setMnemonicParsing(dv.getMenuBarMenuToShowView().enableMnemonicParsing()); mi.selectedProperty().addListener(new InvalidationListener() { @Override public void invalidated(Observable observable) { //This is a convenience call... not expected to actually show the view. dv.getMenuBarMenuToShowView().handleMenuSelection(root_.getScene().getWindow()); if (mi.isSelected() && !mainSplitPane.getItems().contains(bp)) { mainSplitPane.getItems().add(bp); } else if (!mi.isSelected() && mainSplitPane.getItems().contains(bp)) { hidePanelView(bp); } } }); if (dv.getMenuBarMenuToShowView().getImage() != null) { mi.setGraphic(new ImageView(dv.getMenuBarMenuToShowView().getImage())); } mi.selectedProperty().bindBidirectional(bp.visibleProperty()); parentMenu.getItems().add(mi); } } catch (Exception e) { LOG.error("Unexpected error configuring DockedViewI " + (dv == null ? "?" : dv.getViewTitle()), e); } } LOG.debug("Docked Views configured"); } public BorderPane getRoot() { return root_; } protected void finishInit() { // Make sure in application thread. FxUtils.checkFxUserThread(); //Kick off other preloads for (ServicesToPreloadI service : preloadRequested_) { LOG.debug("Preloading {}", service); service.loadRequested(); } preloadExecuted = true; LOG.debug("Preloads complete"); loadWait.getChildren().clear(); AtomicLong loginFailCount = new AtomicLong(0); loadWait.setCenter(LightWeightDialogs.buildLoginDialog(new Consumer<Boolean>() { @Override public void accept(Boolean t) { if (!t) { if (loginFailCount.incrementAndGet() > 3) { ((App)ExtendedAppContext.getMainApplicationWindow()).shutdown(); } } else { mainSplitPane.getItems().remove(loadWait); loadWait = null; // Enable the menus. for (Menu menu : menuBar.getMenus()) { menu.setDisable(false); } } } })); BorderPane.setAlignment(loadWait.getCenter(), Pos.CENTER); } private BorderPane buildPanelForView(DockedViewI dockedView) { final BorderPane bp = new BorderPane(); bp.setVisible(false); AnchorPane ap = new AnchorPane(); ap.getStyleClass().add("headerBackground"); Label l = new Label(dockedView.getViewTitle()); l.getStyleClass().add("titleLabel"); AnchorPane.setLeftAnchor(l, 5.0); AnchorPane.setTopAnchor(l, 2.0); ap.getChildren().add(l); Button b = new Button(); b.setMnemonicParsing(false); b.setStyle("-fx-cursor:hand"); b.getStyleClass().add("tab-close-button"); b.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent arg0) { hidePanelView(bp); } }); AnchorPane.setTopAnchor(b, 0.0); AnchorPane.setRightAnchor(b, 5.0); ap.getChildren().add(b); bp.setTop(ap); Label placeholder = new Label(""); bp.setCenter(placeholder); //Delay this, so we don't force the init of all of these panels up front bp.visibleProperty().addListener((change) -> { if (bp.isVisible() && bp.getCenter() == placeholder) { bp.setCenter(dockedView.getView()); } }); return bp; } private void hidePanelView(BorderPane bp) { bp.setVisible(false); mainSplitPane.getItems().remove(bp); } public void ensureDockedViewIsVisible(DockedViewI view) { Menu parentMenu = allMenus_.get(view.getMenuBarMenuToShowView().getParentMenuId()); String id = view.getMenuBarMenuToShowView().getMenuId(); for (MenuItem menu : parentMenu.getItems()) { if (menu.getId().equals(id)) { CheckMenuItem cmi = (CheckMenuItem)menu; cmi.selectedProperty().set(true); break; } } } protected void shutdown() { AppContext.getService(RuntimeGlobals.class).shutdown(); if (preloadExecuted) { //notify anything that was preloaded for (ServicesToPreloadI service : preloadRequested_) { LOG.debug("Shutdown notify {}", service); service.shutdown(); } } } }
36.619318
158
0.574011
4c49697fd64e0d755fd3466e6048e05faf9dee08
390
package cn.ruleengine.web.vo.system.log; import lombok.Data; /** * 〈一句话功能简述〉<br> * 〈〉 * * @author dingqianwen * @date 2021/3/2 * @since 1.0.0 */ @Data public class ListLogRequest { private String tag; /** * 精确 */ private String requestId; /** * 模糊 */ private String requestUrl; /** * 模糊 */ private String username; }
11.142857
40
0.538462
32f8593ab5f60d8cd0c4a71c1e9e2689768c7342
126
package jif.types; /** A representation of any unknown class parameter. */ public interface UnknownParam extends Param { }
18
53
0.753968
ba69a13309251d8381f8756599d082215ed2f526
103
package org.simple.coollection.matcher; public interface Matcher { boolean match(Object value); }
12.875
39
0.76699
e3211a9ce8253205a93d4ad2a77b0b6b5335f551
3,361
package software.amazon.ec2.transitgatewaymulticastdomain.workflow.update; import software.amazon.ec2.transitgatewaymulticastdomain.CallbackContext; import software.amazon.ec2.transitgatewaymulticastdomain.ResourceModel; import software.amazon.ec2.transitgatewaymulticastdomain.workflow.ExceptionMapper; import software.amazon.ec2.transitgatewaymulticastdomain.workflow.TagUtils; import software.amazon.ec2.transitgatewaymulticastdomain.workflow.read.Read; import org.apache.commons.collections.CollectionUtils; import software.amazon.awssdk.services.ec2.Ec2Client; import software.amazon.awssdk.services.ec2.model.DeleteTagsRequest; import software.amazon.awssdk.services.ec2.model.DeleteTagsResponse; import software.amazon.awssdk.services.ec2.model.Tag; import software.amazon.cloudformation.proxy.*; import java.util.List; public class DeleteTags { AmazonWebServicesClientProxy proxy; ResourceHandlerRequest<ResourceModel> request; CallbackContext callbackContext; ProxyClient<Ec2Client> client; Logger logger; public DeleteTags( AmazonWebServicesClientProxy proxy, ResourceHandlerRequest<ResourceModel> request, CallbackContext callbackContext, ProxyClient<Ec2Client> client, Logger logger ) { this.proxy = proxy; this.request = request; this.callbackContext = callbackContext; this.client = client; this.logger = logger; } public ProgressEvent<ResourceModel, CallbackContext> run(ProgressEvent<ResourceModel, CallbackContext> progress) { return this.proxy.initiate(this.getClass().getSimpleName(), this.client, progress.getResourceModel(), progress.getCallbackContext()) .translateToServiceRequest(this::translateModelToRequest) .makeServiceCall(this::makeServiceCall) .handleError(this::handleError) .progress(); } private DeleteTagsRequest translateModelToRequest(ResourceModel model) { List<Tag> tags = this.tagsToDelete(model); return DeleteTagsRequest.builder() .resources(model.getTransitGatewayMulticastDomainId()) .tags(tags) .build(); } private DeleteTagsResponse makeServiceCall(DeleteTagsRequest request, ProxyClient<Ec2Client> client) { if(CollectionUtils.isEmpty(request.tags())) { return DeleteTagsResponse.builder().build(); } else { return proxy.injectCredentialsAndInvokeV2(request, client.client()::deleteTags); } } private List<Tag> tagsToDelete(ResourceModel model) { final List<software.amazon.ec2.transitgatewaymulticastdomain.Tag> prevTags = new Read(this.proxy, this.request, this.callbackContext, this.client, this.logger).simpleRequest(model).getTags(); List<software.amazon.ec2.transitgatewaymulticastdomain.Tag> currTags = TagUtils.mergeResourceModelAndStackTags(model.getTags(), this.request.getDesiredResourceTags()); return TagUtils.difference(prevTags, currTags); } private ProgressEvent<ResourceModel, CallbackContext> handleError(DeleteTagsRequest awsRequest, Exception exception, ProxyClient<Ec2Client> client, ResourceModel model, CallbackContext context) { return ProgressEvent.defaultFailureHandler(exception, ExceptionMapper.mapToHandlerErrorCode(exception)); } }
46.680556
200
0.75662
8082197dae7efd42f838465881d5d8d691b825bf
3,825
/* jcifs smb client library in Java * Copyright (C) 2003 "Michael B. Allen" <jcifs at samba dot org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package jcifs.internal.smb1.com; import jcifs.Configuration; import jcifs.internal.smb1.ServerMessageBlock; import jcifs.internal.util.SMBUtil; /** * */ public class SmbComWrite extends ServerMessageBlock { private int fid, count, offset, remaining, off; private byte[] b; /** * * @param config */ public SmbComWrite ( Configuration config ) { super(config, SMB_COM_WRITE); } /** * * @param config * @param fid * @param offset * @param remaining * @param b * @param off * @param len */ public SmbComWrite ( Configuration config, int fid, int offset, int remaining, byte[] b, int off, int len ) { super(config, SMB_COM_WRITE); this.fid = fid; this.count = len; this.offset = offset; this.remaining = remaining; this.b = b; this.off = off; } /** * * @param fid * @param offset * @param remaining * @param b * @param off * @param len */ public final void setParam ( int fid, long offset, int remaining, byte[] b, int off, int len ) { this.fid = fid; this.offset = (int) ( offset & 0xFFFFFFFFL ); this.remaining = remaining; this.b = b; this.off = off; this.count = len; this.digest = null; /* * otherwise recycled commands * like writeandx will choke if session * closes in between */ } @Override protected int writeParameterWordsWireFormat ( byte[] dst, int dstIndex ) { int start = dstIndex; SMBUtil.writeInt2(this.fid, dst, dstIndex); dstIndex += 2; SMBUtil.writeInt2(this.count, dst, dstIndex); dstIndex += 2; SMBUtil.writeInt4(this.offset, dst, dstIndex); dstIndex += 4; SMBUtil.writeInt2(this.remaining, dst, dstIndex); dstIndex += 2; return dstIndex - start; } @Override protected int writeBytesWireFormat ( byte[] dst, int dstIndex ) { int start = dstIndex; dst[ dstIndex++ ] = (byte) 0x01; /* BufferFormat */ SMBUtil.writeInt2(this.count, dst, dstIndex); /* DataLength? */ dstIndex += 2; System.arraycopy(this.b, this.off, dst, dstIndex, this.count); dstIndex += this.count; return dstIndex - start; } @Override protected int readParameterWordsWireFormat ( byte[] buffer, int bufferIndex ) { return 0; } @Override protected int readBytesWireFormat ( byte[] buffer, int bufferIndex ) { return 0; } @Override public String toString () { return new String( "SmbComWrite[" + super.toString() + ",fid=" + this.fid + ",count=" + this.count + ",offset=" + this.offset + ",remaining=" + this.remaining + "]"); } }
27.321429
134
0.59268
b1edbc2ec745f492214fe59aeb5b3de0d9c0e76a
838
package com.zfwhub.word.endpoint; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.zfwhub.word.dto.BaseResponse; import com.zfwhub.word.dto.SentenceAddDto; import com.zfwhub.word.service.SentenceService; @RestController public class SentenceController { @Autowired private SentenceService sentenceService; @RequestMapping(value="/sentences", method=RequestMethod.POST) public BaseResponse add(@RequestBody SentenceAddDto sentenceAddDto) { sentenceService.add(sentenceAddDto); return new BaseResponse(true); } }
32.230769
73
0.795943
14bafdaf4b80640592f2a9f237550bdbc7fae87d
2,577
/* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.android.exoplayer2.source; import androidx.annotation.Nullable; import com.google.android.exoplayer2.source.MediaSource.MediaPeriodId; import java.io.IOException; /** * A {@link MediaSourceEventListener} allowing selective overrides. All methods are implemented as * no-ops. */ public abstract class DefaultMediaSourceEventListener implements MediaSourceEventListener { @Override public void onMediaPeriodCreated(int windowIndex, MediaPeriodId mediaPeriodId) { // Do nothing. } @Override public void onMediaPeriodReleased(int windowIndex, MediaPeriodId mediaPeriodId) { // Do nothing. } @Override public void onLoadStarted( int windowIndex, @Nullable MediaPeriodId mediaPeriodId, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData) { // Do nothing. } @Override public void onLoadCompleted( int windowIndex, @Nullable MediaPeriodId mediaPeriodId, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData) { // Do nothing. } @Override public void onLoadCanceled( int windowIndex, @Nullable MediaPeriodId mediaPeriodId, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData) { // Do nothing. } @Override public void onLoadError( int windowIndex, @Nullable MediaPeriodId mediaPeriodId, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData, IOException error, boolean wasCanceled) { // Do nothing. } @Override public void onReadingStarted(int windowIndex, MediaPeriodId mediaPeriodId) { // Do nothing. } @Override public void onUpstreamDiscarded( int windowIndex, @Nullable MediaPeriodId mediaPeriodId, MediaLoadData mediaLoadData) { // Do nothing. } @Override public void onDownstreamFormatChanged( int windowIndex, @Nullable MediaPeriodId mediaPeriodId, MediaLoadData mediaLoadData) { // Do nothing. } }
27.709677
98
0.730307
7fe6b2c6c1ad3969882d8d063b92f2d8f15532bf
1,303
package ru.job4j.pool.threadpoolversion2; public class TestThreadpoolWorker { public static void main(String[] args) { ThreadPoolWorker threadpool = ThreadPoolWorker.getInstance(); int runnableCount = 10; Runnable r; for (int i = 0; i < runnableCount; i++) { r = new SimpleTask(i); threadpool.work(r); } threadpool.shutdown(); } } // Задача класса для выполнения class SimpleTask implements Runnable { //у каждой задачи будет id private int id; SimpleTask(int id) { this.id = id; } @Override public void run() { System.out.println("Executing " + this.toString() + " inside : " + Thread.currentThread().getName()); //Иммитируем работу for (int i = 0; i < 50; i++) { try { Thread.sleep(100); } catch (InterruptedException e) { // System.out.println("----- " + Thread.currentThread().getName() + " " + e.getMessage()); Thread.currentThread().interrupt(); //для правильной обработки перевыставим флаг } } System.out.println(this.toString() + " end.."); } @Override public String toString() { return "Task{id=" + id + '}'; } }
27.723404
105
0.547966
af1c2e7a2af882c5c64d67ea5d674b0d52a4d901
917
package com.trackorjargh.javarepository; import java.util.List; import javax.transaction.Transactional; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import com.trackorjargh.javaclass.CommentFilm; import com.trackorjargh.javaclass.Film; public interface CommentFilmRepository extends JpaRepository<CommentFilm, Long>{ List<CommentFilm> findByFilm(Film film); List<CommentFilm> findByFilmOrderByIdAsc(Film film); @Modifying @Transactional @Query(value = "DELETE FROM COMMENT_FILM WHERE USER_ID = ?1", nativeQuery = true) void removeCommentsFilmsByUserId(long id); @Modifying @Transactional @Query(value = "DELETE FROM COMMENT_FILM WHERE FILM_ID = ?1", nativeQuery = true) void removeCommentsFilmssByFilmId(long id); CommentFilm findById(Long id); }
31.62069
82
0.792803
355e1a2dcb2020f07c81220e51cf789b93958dcb
808
package org.wfrobotics.reuse.commands.debug; import org.wfrobotics.reuse.commands.config.ResetPose; import org.wfrobotics.reuse.commands.drive.DriveOff; import org.wfrobotics.reuse.commands.drive.DrivePath; import org.wfrobotics.reuse.config.PathContainer; import edu.wpi.first.wpilibj.command.CommandGroup; /** Use to rapidly test path by putting on a teleop button */ public class TeleopPath extends CommandGroup { public TeleopPath(PathContainer path) { this(path, 15.0); } /** Add a timeout to keep your path from ramming anything accidently */ public TeleopPath(PathContainer path, double timeout) { addSequential(new ResetPose(path)); addSequential(new DrivePath(path), timeout); addSequential(new DriveOff()); // Observe robot state } }
32.32
75
0.737624
9448a8650c6cf2b8c50244980eb466cd9685f03a
606
package com.zx2n19.photosite.dao; import com.zx2n19.photosite.pojo.Liked; import com.zx2n19.photosite.pojo.Photo; import com.zx2n19.photosite.pojo.User; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; public interface LikedDAO extends JpaRepository<Liked, Integer> { Page<Liked> findByUser(User user, Pageable pageable); Liked getByUserAndPhoto(User user, Photo photo); List<Liked> findLikedByPhoto(Photo photo); List<Liked> findLikedByUser(User user); }
31.894737
65
0.79703
6b8e3beb46dee504dd309422c70b0bd7dc9630bd
802
import java.util.Arrays; import java.util.Scanner; public class MostFrequentNumber { public static void main(String[] args) { int[] numbers = Arrays.stream(new Scanner(System.in).nextLine().split(" ")) .mapToInt(Integer::parseInt) .toArray(); int mostFrequent = numbers[0]; int maxCount = 1; for (int i = 0; i < numbers.length - 1; i++) { int counter = 1; for (int j = i + 1; j < numbers.length; j++) { if (numbers[i] == numbers[j]) { counter++; } } if (counter > maxCount) { maxCount = counter; mostFrequent = numbers[i]; } } System.out.println(mostFrequent); } }
26.733333
83
0.476309
bc724ca67ec9bf81e8507fc52ce7943c99a07c23
7,874
//Created by MyEclipse Struts // XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_3.9.210/xslt/JavaClass.xsl package za.ac.unisa.lms.tools.satbook.forms; import java.util.ArrayList; import java.util.Vector; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionMapping; import org.apache.struts.validator.ValidatorForm; /** * MyEclipse Struts * Creation date: 09-11-2006 * * XDoclet definition: * @struts:form name="satbookDailyForm" */ public class SatbookDailyForm extends ValidatorForm { // --------------------------------------------------------- Instance Variables private String userPermission; /** booking property */ private Vector booking = new Vector(); private ArrayList bookingList = new ArrayList(); private ArrayList venueList = new ArrayList(); private String selectedBooking; private String bkngHeading; private String userName; /** viewDate property */ private String viewDate; private String institution; /** For booking report */ private ArrayList reportTypeList = new ArrayList(); private String selectedReportType; private String fromDate; private String fromDateDD; private String fromDateMM; private String fromDateYYYY; private String toDate; private String toDateDD; private String toDateMM; private String toDateYYYY; private ArrayList subName; private String weekDay; private boolean bookingDisable; private boolean deleteDisable; private String rebroadDate; private String rebroadDay; private String rebroadMonth; private String rebroadYear; private ArrayList possibleReports; private String selectedReport; //setting the system id "1" for sat_book & for "2" for venue booking private String systemID; private final String satbook="1"; public String getSatbook() { return satbook; } private final String venbook="2"; public String getVenbook() { return venbook; } // --------------------------------------------------------- Methods public String getSystemID() { return systemID; } public void setSystemID(String systemID) { this.systemID = systemID; } public String getRebroadDate() { return rebroadDate; } public void setRebroadDate(String rebroadDate) { this.rebroadDate = rebroadDate; } public String getRebroadDay() { return rebroadDay; } public void setRebroadDay(String rebroadDay) { this.rebroadDay = rebroadDay; } public String getRebroadMonth() { return rebroadMonth; } public void setRebroadMonth(String rebroadMonth) { this.rebroadMonth = rebroadMonth; } public String getRebroadYear() { return rebroadYear; } public void setRebroadYear(String rebroadYear) { this.rebroadYear = rebroadYear; } public String getWeekDay() { return weekDay; } public void setWeekDay(String weekDay) { this.weekDay = weekDay; } /** * Method reset * @param mapping * @param request */ public void reset(ActionMapping mapping, HttpServletRequest request) { // TODO Auto-generated method stub } /** * Returns the booking. * @return Vector */ public Vector getBooking() { return booking; } /** * Set the booking. * @param booking The booking to set */ public void setBooking(Vector booking) { this.booking = booking; } /** * Returns the bookingList. * @return ArrayList */ public ArrayList getBookingList() { return bookingList; } /** * Set the bookingList. * @param bookingList The bookingList to set */ public void setBookingList(ArrayList bookingList) { this.bookingList = bookingList; } /** * Returns the viewDate. * @return String */ public String getViewDate() { return viewDate; } /** * Set the viewDate. * @param viewDate The viewDate to set */ public void setViewDate(String viewDate) { this.viewDate = viewDate; } public String getSelectedBooking() { return selectedBooking; } public void setSelectedBooking(String selectedBooking) { this.selectedBooking = selectedBooking; } public String getUserPermission() { return userPermission; } public void setUserPermission(String userPermission) { this.userPermission = userPermission; } public String getInstitution() { return institution; } public void setInstitution(String institution) { this.institution = institution; } public ArrayList getReportTypeList() { reportTypeList = new ArrayList(); reportTypeList.add(new org.apache.struts.util.LabelValueBean("..","0")); reportTypeList.add(new org.apache.struts.util.LabelValueBean("Confirmed","Y")); reportTypeList.add(new org.apache.struts.util.LabelValueBean("Not Confirmed","N")); reportTypeList.add(new org.apache.struts.util.LabelValueBean("Both","B")); return reportTypeList; } public void setReportTypeList(ArrayList reportTypeList) { this.reportTypeList = reportTypeList; } public String getSelectedReportType() { return selectedReportType; } public void setSelectedReportType(String selectedReportType) { this.selectedReportType = selectedReportType; } public String getFromDate() { return fromDate; } public void setFromDate(String fromDate) { this.fromDate = fromDate; } public String getFromDateDD() { return fromDateDD; } public void setFromDateDD(String fromDateDD) { this.fromDateDD = fromDateDD; } public String getFromDateMM() { return fromDateMM; } public void setFromDateMM(String fromDateMM) { this.fromDateMM = fromDateMM; } public String getFromDateYYYY() { return fromDateYYYY; } public void setFromDateYYYY(String fromDateYYYY) { this.fromDateYYYY = fromDateYYYY; } public String getToDate() { return toDate; } public void setToDate(String toDate) { this.toDate = toDate; } public String getToDateDD() { return toDateDD; } public void setToDateDD(String toDateDD) { this.toDateDD = toDateDD; } public String getToDateMM() { return toDateMM; } public void setToDateMM(String toDateMM) { this.toDateMM = toDateMM; } public String getToDateYYYY() { return toDateYYYY; } public void setToDateYYYY(String toDateYYYY) { this.toDateYYYY = toDateYYYY; } public String getBkngHeading() { return bkngHeading; } public void setBkngHeading(String bkngHeading) { this.bkngHeading = bkngHeading; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public ArrayList getSubName() { return subName; } public void setSubName(ArrayList subName) { this.subName = subName; } public boolean getBookingDisable() { return bookingDisable; } public void setBookingDisable(boolean bookingDisable) { this.bookingDisable = bookingDisable; } public boolean getdeleteDisable() { return deleteDisable; } public void setDeleteDisable(boolean deleteDisable) { this.deleteDisable = deleteDisable; } public ArrayList getPossibleReports() { possibleReports = new ArrayList(); possibleReports.add(new org.apache.struts.util.LabelValueBean("Choose a report..","0")); possibleReports.add(new org.apache.struts.util.LabelValueBean("Detailed Report","DetailedReport")); possibleReports.add(new org.apache.struts.util.LabelValueBean("Hours per month and venue Report","HoursReport")); possibleReports.add(new org.apache.struts.util.LabelValueBean("Days per month and venue Report","DaysReport")); return possibleReports; } public void setPossibleReports(ArrayList possibleReports) { this.possibleReports = possibleReports; } public String getSelectedReport() { return selectedReport; } public void setSelectedReport(String selectedReport) { this.selectedReport = selectedReport; } public ArrayList getVenueList() { return venueList; } public void setVenueList(ArrayList venueList) { this.venueList = venueList; } }
20.885942
115
0.730505
d80394fff4cbcfee7ddc57f05e7ce34d1682b1ec
2,982
package me.ziim.ziimhud.modules.Armour; import me.ziim.ziimhud.Ziimhud; import me.ziim.ziimhud.gui.AbstractWidget; import me.ziim.ziimhud.gui.Vector2D; import me.ziim.ziimhud.utils.ColorHelper; import me.ziim.ziimhud.utils.ItemHelper; import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; import net.minecraft.text.LiteralText; import net.minecraft.util.Identifier; import java.awt.*; import java.util.Collections; import java.util.List; public class Armour extends AbstractWidget { private final Identifier Id = new Identifier("ziimhud", "armour"); public Armour(int width, int height) { super(width, height); } @Override public Identifier getID() { return Id; } @Override protected void renderWidget(MatrixStack matrices) { matrices.push(); matrices.scale(getStorage().scale, getStorage().scale, 1); Vector2D pos = getScaledPos(); DrawableHelper.fill(matrices, pos.getX(), pos.getY(), pos.getX() + width + 1, pos.getY() + height + 1, color.getPacked()); ColorHelper borderColor = new ColorHelper(55, 55, 55, 255); //Horizontal DrawableHelper.fill(matrices, pos.getX(), pos.getY(), pos.getX() + width, pos.getY() + 1, borderColor.getPacked()); DrawableHelper.fill(matrices, pos.getX(), pos.getY() + height, pos.getX() + width, pos.getY() + height + 1, borderColor.getPacked()); //Vertical DrawableHelper.fill(matrices, pos.getX() - 1, pos.getY(), pos.getX(), pos.getY() + height + 1, borderColor.getPacked()); DrawableHelper.fill(matrices, pos.getX() + width, pos.getY() + height + 1, pos.getX() + width + 1, pos.getY(), borderColor.getPacked()); matrices.pop(); } @Override public void render(MatrixStack matrices) { List<ItemStack> equiped = ItemHelper.getEquiped(client); Collections.reverse(equiped); Vector2D pos = getScaledPos(); int x = pos.getX(); matrices.push(); matrices.scale(getStorage().scale, getStorage().scale, 1); for (ItemStack stack : equiped) { ItemHelper.drawItem(matrices, client, stack, (int) (x / getStorage().scale), (int) (pos.getY() / getStorage().scale), true); x += 15; } width = Math.abs(pos.getX() - x); matrices.pop(); } @Override public LiteralText getData() { return null; } @Override public LiteralText getText() { return null; } @Override public Storage getStorage() { return Ziimhud.storage.armourStorage; } public static class Storage extends AbstractStorage { public Storage() { x = 0.56f; y = 0.92f; scale = 1f; enabled = true; textColor = new ColorHelper(255, 255, 255, 255); dataColor = new ColorHelper(Color.white); } } }
33.133333
144
0.63112
845f130b4c72be1694dec928aa1c25d106d45974
1,713
//package org.apache.calcite.adapter.hustle; // //import org.json.simple.JSONArray; //import org.json.simple.JSONObject; //import org.json.simple.parser.JSONParser; //import org.json.simple.parser.ParseException; // //import java.io.FileReader; //import java.io.IOException; //import java.io.Reader; //import java.util.Iterator; // // //import java.net.*; // //public class TestJson { // public static void main(String[] args){ // JSONParser parser = new JSONParser(); // // try (Reader reader = new FileReader("/Users/chronis/code/hustle/catalog.json")) { // JSONObject jsonCatalog = (JSONObject) parser.parse(reader); // // JSONArray jsonTables = (JSONArray) jsonCatalog.get("tables"); // Iterator<JSONObject> tablesIterator = jsonTables.iterator(); // while (tablesIterator.hasNext()) { // JSONObject jsonTable = tablesIterator.next(); // String tableName = (String) jsonTable.get("name"); // System.out.println(tableName); // JSONArray jsonColumns = (JSONArray) jsonTable.get("columns"); // Iterator<JSONObject> columnsIterator = jsonColumns.iterator(); // while (columnsIterator.hasNext()) { // JSONObject jsonColumn = columnsIterator.next(); // System.out.print(jsonColumn.get("name")+" - "); // System.out.println(jsonColumn.get("column_type")); // } // System.out.println(); // } // } catch (IOException e) { // e.printStackTrace(); // } catch (ParseException e) { // e.printStackTrace(); // } // // } //} //
36.446809
91
0.58202
5cb2dac7c785f92a5912fa4c5ee6b5de73282708
438
package cn.ittiger.library.base; import android.content.Context; import android.support.v4.app.Fragment; import android.support.v7.app.AppCompatActivity; /** * @author: ylhu * @time: 17-9-1 */ public class BaseFragment extends Fragment { protected AppCompatActivity mActivity; @Override public void onAttach(Context context) { super.onAttach(context); mActivity = (AppCompatActivity) context; } }
19.043478
48
0.714612
65e5813b280025c061adbafbc2e9441d46e107ad
2,651
/* * Copyright 2018 The StartupOS 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.startupos.common.tests; import com.google.startupos.common.CommonModule; import com.google.startupos.common.FileUtils; import com.google.startupos.common.Protos.TextDiff; import com.google.startupos.common.TextDifferencer; import com.google.startupos.common.flags.Flag; import com.google.startupos.common.flags.FlagDesc; import com.google.startupos.common.flags.Flags; import com.google.startupos.common.repo.GitRepo; import dagger.Component; import java.io.IOException; import javax.inject.Inject; import javax.inject.Singleton; /** A tool for testing TextDifferencer. */ @Singleton public class TextDifferencerTool { @FlagDesc(name = "left_file", description = "Left file", required = true) public static Flag<String> leftFile = Flag.create(""); @FlagDesc(name = "right_file", description = "Right file", required = true) public static Flag<String> rightFile = Flag.create(""); @FlagDesc(name = "print_output", description = "Print TextDiff output", required = false) public static Flag<Boolean> printOutput = Flag.create(false); private FileUtils fileUtils; private TextDifferencer textDifferencer; @Inject TextDifferencerTool(FileUtils fileUtils, TextDifferencer textDifferencer) { this.fileUtils = fileUtils; this.textDifferencer = textDifferencer; } void run() throws IOException { String leftFileContents = fileUtils.readFile(leftFile.get()); String rightFileContents = fileUtils.readFile(rightFile.get()); String diffString = GitRepo.getTextDiff(leftFile.get(), rightFile.get()); TextDiff textDiff = textDifferencer.getTextDiff(leftFileContents, rightFileContents, diffString); if (printOutput.get()) { System.out.println(textDiff); } } @Singleton @Component(modules = CommonModule.class) interface ToolComponent { TextDifferencerTool getTool(); } public static void main(String[] args) throws IOException { Flags.parseCurrentPackage(args); DaggerTextDifferencerTool_ToolComponent.create().getTool().run(); } }
34.881579
91
0.755187
d728ff1f4971a81a342816ae6aa305858611c9a2
551
package com.smartweather.android.gson; import com.google.gson.annotations.SerializedName; /** * @version 1 * @anthor cyuan * @dsc daily forecast * @updateAuthor $Author * @updateDsc ${TOOD} */ public class Forecast { public String date; @SerializedName("tmp") public Temperature temperature; @SerializedName("cond") public More more; public class Temperature{ public String max; public String min; } public class More{ @SerializedName("txt_d") public String info; } }
16.205882
50
0.647913
3d380b6789dc6f6ea81293fbe1aec9948b270ba1
1,237
package com.commercetools.api.models.type; import java.time.*; import java.util.*; import java.util.function.Function; import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.annotation.*; import io.vrap.rmf.base.client.utils.Generated; @Generated(value = "io.vrap.rmf.codegen.rendring.CoreCodeGenerator", comments = "https://github.com/vrapio/rmf-codegen") @JsonDeserialize(as = CustomFieldStringTypeImpl.class) public interface CustomFieldStringType extends FieldType { String STRING = "String"; public static CustomFieldStringType of() { return new CustomFieldStringTypeImpl(); } public static CustomFieldStringType of(final CustomFieldStringType template) { CustomFieldStringTypeImpl instance = new CustomFieldStringTypeImpl(); return instance; } public static CustomFieldStringTypeBuilder builder() { return CustomFieldStringTypeBuilder.of(); } public static CustomFieldStringTypeBuilder builder(final CustomFieldStringType template) { return CustomFieldStringTypeBuilder.of(template); } default <T> T withCustomFieldStringType(Function<CustomFieldStringType, T> helper) { return helper.apply(this); } }
30.925
120
0.754244
fee52d9da50431c6cff0124d53b62d31f43343a9
1,524
package zatribune.spring.itextvelocity.controllers; import javassist.NotFoundException; import lombok.extern.slf4j.Slf4j; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.HttpMediaTypeNotAcceptableException; import org.springframework.web.bind.annotation.*; import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.server.UnsupportedMediaTypeStatusException; import zatribune.spring.itextvelocity.dto.PdfRequest; import zatribune.spring.itextvelocity.services.HtmlToPdfService; import javax.servlet.http.HttpServletRequest; import java.util.List; @Slf4j @RequestMapping("/report") @RestController public class ReportingController { private final HtmlToPdfService service; public ReportingController(HtmlToPdfService service) { this.service = service; } @PostMapping(value = "/pdf", produces = {MediaType.APPLICATION_PDF_VALUE, MediaType.TEXT_PLAIN_VALUE}) public ResponseEntity<?> generateReport(@RequestBody PdfRequest pdfRequest, @RequestHeader("Accept") MediaType accept) throws NotFoundException, HttpMediaTypeNotAcceptableException { List<MediaType> supportedMediaTypes = List.of(MediaType.APPLICATION_PDF, MediaType.TEXT_PLAIN); if (supportedMediaTypes.contains(accept)) return service.generate(pdfRequest,accept); else { throw new HttpMediaTypeNotAcceptableException(supportedMediaTypes); } } }
34.636364
122
0.790026
e361d670df8b092a7971f7dcd0568c7024ea66c5
2,013
package com.ppcxy.jdbc.page.util; import com.google.common.collect.Maps; import org.apache.commons.lang3.StringUtils; import java.util.Map; import java.util.Map.Entry; /** * jdbc 分页条件编译. * * @author weep */ public class JdbcSeachFilter { public enum Operator { EQ, NE, LIKE, GT, LT, GTE, LTE, IN } public String fieldName; public Object value; public Operator operator; public JdbcSeachFilter(String fieldName, Operator operator, Object value) { this.fieldName = fieldName; this.value = value; this.operator = operator; } /** * searchParams中key的格式为OPERATOR_FIELDNAME */ public static Map<String, JdbcSeachFilter> parse(Map<String, Object> searchParams) { Map<String, JdbcSeachFilter> filters = Maps.newHashMap(); for (Entry<String, Object> entry : searchParams.entrySet()) { // 过滤掉空值 String key = entry.getKey(); Object value = entry.getValue(); if (StringUtils.isBlank((String) value)) { continue; } // 拆分operator与filedAttribute String[] names = StringUtils.split(key, "_"); if (names.length < 2) { throw new IllegalArgumentException(key + " is not a valid search filter name"); } String filedName = null; Operator operator = null; if (names.length == 2) { filedName = names[0]; operator = Operator.valueOf(names[1].toUpperCase()); } else { filedName = key.substring(0, key.lastIndexOf("_")); operator = Operator.valueOf(key.substring(key.lastIndexOf("_") + 1).toUpperCase()); } // 创建searchFilter JdbcSeachFilter filter = new JdbcSeachFilter(filedName, operator, value); filters.put(key, filter); } return filters; } }
30.044776
99
0.562842
4a30ed0d42fafea88a9b03906dba17e963feea0c
619
package laughinglen.domain.testing; import laughinglen.domain.Repository; import laughinglen.domain.store.Cache; import laughinglen.domain.store.SnapshotPolicy; import laughinglen.domain.store.Store; public class TestRepository extends Repository<TestRoot, TestId> { public TestRepository(final Store store, final Cache<TestRoot, TestId> cache) { this(store, cache, SnapshotPolicy.never()); } public TestRepository(final Store store, final Cache<TestRoot, TestId> cache, final SnapshotPolicy policy) { super(store, cache, policy); } @Override protected TestRoot instance() { return new TestRoot(); } }
28.136364
109
0.783522
e42ae7074a2e8796df2dccf47ecccb033499cbd1
2,745
/* * Copyright 2015-present Open Networking Foundation * * 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.onosproject.provider.nil; import static com.google.common.base.Preconditions.checkArgument; /** * Spine-leaf topology with hosts at the leaf devices. */ public class SpineLeafTopologySimulator extends TopologySimulator { private static final int DEFAULT_SPINE_COUNT = 2; private static final int DEFAULT_LEAF_COUNT = 2; private static final int DEFAULT_HOST_PER_LEAF = 2; private int spineCount = DEFAULT_SPINE_COUNT; private int leafCount = DEFAULT_LEAF_COUNT; private int hostPerLeaf = DEFAULT_HOST_PER_LEAF; @Override protected void processTopoShape(String shape) { super.processTopoShape(shape); // topology shape: spineleaf,[spine count],[leaf count],[host per leaf] if (topoShape.length > 1) { spineCount = Integer.parseInt(topoShape[1]); } if (topoShape.length > 2) { leafCount = Integer.parseInt(topoShape[2]); } if (topoShape.length > 3) { hostPerLeaf = Integer.parseInt(topoShape[3]); } } @Override public void setUpTopology() { checkArgument(spineCount > 0, "There must be at least one spine"); checkArgument(leafCount > 0, "There must be at least one leaf"); deviceCount = spineCount + leafCount; hostCount = hostPerLeaf; log.info("Setup Spine-Leaf topology with {} spine(s), {} leaf(s), and {} host per leaf", spineCount, leafCount, hostPerLeaf); super.setUpTopology(); } @Override protected void createLinks() { for (int spineIndex = 0; spineIndex < spineCount; spineIndex++) { for (int leafIndex = spineCount; leafIndex < spineCount + leafCount; leafIndex++) { // Nth port of spine connect to Nth leaf, vice versa createLink(spineIndex, leafIndex, leafIndex - spineCount + 1, spineIndex + 1); } } } @Override protected void createHosts() { for (int i = spineCount; i < spineCount + leafCount; i++) { createHosts(deviceIds.get(i), spineCount); } } }
34.3125
96
0.658652
c90752907747bc87641f42218e54be77276c1247
821
package cc.xpcas.nettysocks.upstream; import cc.xpcas.nettysocks.config.Address; import io.netty.channel.ChannelPipeline; import io.netty.channel.socket.SocketChannel; import io.netty.handler.proxy.Socks5ProxyHandler; import java.net.InetSocketAddress; import java.net.SocketAddress; /** * @author xp */ public class Socks5Upstream extends Upstream<SocketChannel> { public Socks5Upstream(final Address address) { setAddress(address); } @Override public void initChannel(SocketChannel channel) { ChannelPipeline pipeline = channel.pipeline(); Address upstreamAddress = getAddress(); SocketAddress address = new InetSocketAddress(upstreamAddress.getHost(), upstreamAddress.getPort()); pipeline.addFirst(HANDLER_NAME, new Socks5ProxyHandler(address)); } }
28.310345
108
0.751523
ae09cb9541e76acc673ec4275df7fe050f994be1
2,981
/* * Created on 27/10/2005 * */ package proverinterface; import logicalSystems.c1.C1RuleStructures; import logicalSystems.c1.C1SignatureFactory; import logicalSystems.classicalLogic.ClassicalRuleStructures; import logicalSystems.classicalLogic.ClassicalSignatureFactory; import logicalSystems.mCi.MCIRuleStructures; import logicalSystems.mbc.MBCRuleStructures; import logicalSystems.mbc.MBCSignatureFactory; import main.exceptions.KEMSException; import main.newstrategy.cpl.simple.configurable.ConfigurableClassicalRuleStructures; import rules.structures.RulesStructure; /** * Class that builds RulesStructure objects. * * @author Adolfo Gustavo Serra Seca Neto * */ public class RuleStructureFactory { public static final String MBC = "mbc".toUpperCase(); public static final String MCI = "mci".toUpperCase(); public static final String C1 = "C1".toUpperCase(); public static final String CPL_NORMAL_BX = "cpl_normal_bx".toUpperCase(); public static final String CPL_CONFIGURABLE = "cpl_configurable".toUpperCase(); // public static final String CPL_OLD = "cpl_old".toUpperCase(); public static RulesStructure createRulesStructure(String rulesStructureName) { RulesStructure rulesStructure; if (rulesStructureName.equals(C1)){ rulesStructure = new C1RuleStructures(C1SignatureFactory.getInstance() .getMainSignature()).getRuleStructure(); } else if (rulesStructureName.equals(MCI)) { rulesStructure = new MCIRuleStructures(MBCSignatureFactory.getInstance() .getMainSignature()).getRuleStructure(); } else { if (rulesStructureName.equals(MBC)) { rulesStructure = new MBCRuleStructures(MBCSignatureFactory.getInstance() .getMainSignature()).getRuleStructure(); } else { if (rulesStructureName.equals(CPL_NORMAL_BX)) { rulesStructure = new ClassicalRuleStructures(ClassicalSignatureFactory .getInstance().getNormalBXSignature()).getRuleStructure(); // } else if (rulesStructureName.equals(CPL_OLD)) { // rulesStructure = // ClassicalRuleStructures.KESubstitionRulesWithBiimplicationAndXor // .getRuleStructureOld(); } else if (rulesStructureName.equals(CPL_CONFIGURABLE)) { rulesStructure = new ConfigurableClassicalRuleStructures( ClassicalSignatureFactory.getInstance().getNormalBXSignature()) .getRuleStructure(); } else { throw new KEMSException("No rules structure configured for " + rulesStructureName + " !"); } } } return rulesStructure; } }
39.223684
101
0.643744
4f483d2bc447f073c3a3962cca5234b743e290e5
1,091
/* Generated By:JJTree: Do not edit this line. ASTPropertyValueReference.java Version 4.3 */ /* * JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=, * NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package org.dojo.jsl.parser.ast; import org.w3c.dom.Document; import org.w3c.dom.Element; public class ASTPropertyValueReference extends SimpleNode { public ASTPropertyValueReference(int id) { super(id); } public ASTPropertyValueReference(LARAEcmaScript p, int id) { super(p, id); } @Override public Object organize(Object obj) { return ((SimpleNode) children[0]).organize(obj); } @Override public void toXML(Document doc, Element parent) { ((SimpleNode) children[0]).toXML(doc, parent); } @Override public String toSource(int indentation) { return indent(indentation) + "[" + ((SimpleNode) children[0]).toSource(0) + "]"; } } /* * JavaCC - OriginalChecksum=a9e3d25c9236ea41f6a673f87a9ca4a5 (do not edit this * line) */
27.275
114
0.696609
933fc7e45300c81b0e64105486ce010389a7dba9
4,268
package com.nemchina.explorer.web; import java.io.IOException; import java.io.PrintWriter; import java.text.DecimalFormat; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.nemchina.explorer.http.Account; import com.nemchina.explorer.http.Block; import com.nemchina.explorer.util.CommonUtil; import net.sf.json.JSONArray; import net.sf.json.JSONObject; /** * @Description: Load Block Servlet * @author lu * @date 2016年7月30日 */ @WebServlet("/blockList") public class BlockListServlet extends HttpServlet { private static final int LISTAMOUNT = 10; private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int page = CommonUtil.getPageParamFromRequest(request, "page"); JSONArray outputBlockListJson = new JSONArray(); response.setContentType("application/json"); response.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); try{ //get current height from NIS int height = Block.chainHeight(); if(height<=0){ out.print(outputBlockListJson); return; } height = height - (10+LISTAMOUNT*(page-1)); if(height<1){ height = 1; } //query blocks JSONArray dataArray = Block.localChainBlocksAfter(height); if(dataArray.size()==0){ out.print(outputBlockListJson); return; } JSONObject data = null; JSONObject block = null; JSONObject outputBlockJSON = null; JSONArray txes = null; JSONObject tx = null; DecimalFormat decimalFormat = new DecimalFormat("0.##"); for(int i=dataArray.size()-1;i>=0;i--){ //validate block data data = dataArray.getJSONObject(i); if(data==null){ continue; } if(!data.containsKey("block")){ continue; } block = data.getJSONObject("block"); if(block==null){ continue; } //count tx amount and tx fees int txAmount = 0; double txFee = 0; txes = new JSONArray(); if(data.containsKey("txes")){ txes = data.getJSONArray("txes"); for(int j=0;j<txes.size();j++){ if(txes.get(j)==null || !txes.getJSONObject(j).containsKey("tx")){ continue; } tx = txes.getJSONObject(j).getJSONObject("tx"); if(!tx.containsKey("fee")){ continue; } txFee += CommonUtil.jsonLong(tx, "fee"); tx.put("signerAccount", Account.getAccountAddressFromPublicKey(CommonUtil.jsonString(tx, "signer"))); tx.put("amount", decimalFormat.format(CommonUtil.jsonLong(tx, "amount")/1000000)); tx.put("fee", decimalFormat.format(CommonUtil.jsonLong(tx, "fee")/1000000)); tx.put("height", CommonUtil.jsonInt(block, "height")); tx.put("signature", CommonUtil.jsonString(tx, "signature")); if(CommonUtil.jsonInt(tx, "type")==2049){ tx.put("recipient", Account.getAccountAddressFromPublicKey(CommonUtil.jsonString(tx, "remoteAccount"))); } txAmount++; } } //get harvester account String harvester = ""; if(block.containsKey("signer")){ harvester = Account.getAccountAddressFromPublicKey(CommonUtil.jsonString(block, "signer")); } outputBlockJSON = new JSONObject(); outputBlockJSON.put("hash", CommonUtil.jsonString(data, "hash")); outputBlockJSON.put("height", CommonUtil.jsonInt(block, "height")); outputBlockJSON.put("timeStamp", CommonUtil.jsonInt(block, "timeStamp")); outputBlockJSON.put("txAmount", txAmount); outputBlockJSON.put("txFee", decimalFormat.format(txFee/1000000)); outputBlockJSON.put("harvester", harvester); outputBlockJSON.put("txes", txes); outputBlockListJson.add(outputBlockJSON); if(i<=10-LISTAMOUNT){ break; } } } catch (Exception ex) { ex.printStackTrace(); } out.print(outputBlockListJson); return; } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }
32.830769
120
0.673618
ffa6ff2fbd36e31a7c48a4a8083a6182e4132b95
1,264
package com.scd.code4.seqstr; /** * brute force 模式匹配算法 * @author James Chen * @date 10/10/19 */ public class BruteForceStr { public static int indexOfBf(String mainStr, String matchStr, int start) { if (mainStr == null || mainStr.length() == 0) { throw new RuntimeException("main str is empty"); } if (matchStr == null || matchStr.length() == 0) { throw new RuntimeException("match str is empty"); } int mainLen = mainStr.length(); int matchLen = matchStr.length(); if (matchLen > mainLen) { throw new RuntimeException("match str len > main str len"); } if (start < 0 || start > mainLen - 1) { throw new RuntimeException("start location error"); } int i = start,j = 0; char[] mainCharArr = mainStr.toCharArray(); char[] matchCharArr = matchStr.toCharArray(); while ((i < mainLen) && (j < matchLen)) { if (mainCharArr[i] == matchCharArr[j]) { i++; j++; } else { i = i - j + 1; j = 0; } } if (j == matchLen) { return i - matchLen; } return -1; } }
29.395349
77
0.496044
1ce6d0099f4be17c8010b73974d851c22a661d5c
5,971
/* Copyright 2002-2014 CS Systèmes d'Information * Licensed to CS Systèmes d'Information (CS) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * CS 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.orekit.frames; import java.io.Serializable; import org.apache.commons.math3.geometry.euclidean.threed.Rotation; import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; import org.apache.commons.math3.util.FastMath; import org.orekit.errors.OrekitException; import org.orekit.time.AbsoluteDate; import org.orekit.time.TimeFunction; /** Celestial Intermediate Reference Frame 2000. * <p>This provider includes precession effects according to either the IAU 2006 precession * (also known as Nicole Capitaines's P03 precession theory) and IAU 2000A_R06 nutation * for IERS 2010 conventions or the IAU 2000A precession-nutation model for IERS 2003 * conventions. These models replaced the older IAU-76 precession (Lieske) and IAU-80 * theory of nutation (Wahr) which were used in the classical equinox-based paradigm. * It <strong>must</strong> be used with the Earth Rotation Angle (REA) defined by * Capitaine's model and <strong>not</strong> IAU-82 sidereal * time which is consistent with the older models only.</p> * <p>Its parent frame is the GCRF frame.<p> */ class CIRFProvider implements TransformProvider { /** Serializable UID. */ private static final long serialVersionUID = 20130806L; /** Function computing CIP/CIO components. */ private final transient TimeFunction<double[]> xysPxy2Function; /** EOP history. */ private final EOPHistory eopHistory; /** Simple constructor. * @param eopHistory EOP history * @exception OrekitException if the nutation model data embedded in the * library cannot be read. * @see Frame */ public CIRFProvider(final EOPHistory eopHistory) throws OrekitException { // load the nutation model xysPxy2Function = eopHistory.getConventions().getXYSpXY2Function(); // store correction to the model this.eopHistory = eopHistory; } /** Get the EOP history. * @return EOP history */ EOPHistory getEOPHistory() { return eopHistory; } /** Get the transform from GCRF to CIRF2000 at the specified date. * <p>The transform considers the nutation and precession effects from IERS data.</p> * @param date new value of the date * @return transform at the specified date * @exception OrekitException if the nutation model data embedded in the * library cannot be read */ public Transform getTransform(final AbsoluteDate date) throws OrekitException { final double[] xys = xysPxy2Function.value(date); final double[] dxdy = eopHistory.getNonRotatinOriginNutationCorrection(date); // position of the Celestial Intermediate Pole (CIP) final double xCurrent = xys[0] + dxdy[0]; final double yCurrent = xys[1] + dxdy[1]; // position of the Celestial Intermediate Origin (CIO) final double sCurrent = xys[2] - xCurrent * yCurrent / 2; // set up the bias, precession and nutation rotation final double x2Py2 = xCurrent * xCurrent + yCurrent * yCurrent; final double zP1 = 1 + FastMath.sqrt(1 - x2Py2); final double r = FastMath.sqrt(x2Py2); final double sPe2 = 0.5 * (sCurrent + FastMath.atan2(yCurrent, xCurrent)); final double cos = FastMath.cos(sPe2); final double sin = FastMath.sin(sPe2); final double xPr = xCurrent + r; final double xPrCos = xPr * cos; final double xPrSin = xPr * sin; final double yCos = yCurrent * cos; final double ySin = yCurrent * sin; final Rotation bpn = new Rotation(zP1 * (xPrCos + ySin), -r * (yCos + xPrSin), r * (xPrCos - ySin), zP1 * (yCos - xPrSin), true); return new Transform(date, bpn, Vector3D.ZERO); } /** Replace the instance with a data transfer object for serialization. * <p> * This intermediate class serializes only the frame key. * </p> * @return data transfer object that will be serialized */ private Object writeReplace() { return new DataTransferObject(eopHistory); } /** Internal class used only for serialization. */ private static class DataTransferObject implements Serializable { /** Serializable UID. */ private static final long serialVersionUID = 20131209L; /** EOP history. */ private final EOPHistory eopHistory; /** Simple constructor. * @param eopHistory EOP history */ public DataTransferObject(final EOPHistory eopHistory) { this.eopHistory = eopHistory; } /** Replace the deserialized data transfer object with a {@link CIRFProvider}. * @return replacement {@link CIRFProvider} */ private Object readResolve() { try { // retrieve a managed frame return new CIRFProvider(eopHistory); } catch (OrekitException oe) { throw OrekitException.createInternalError(oe); } } } }
38.772727
91
0.669067
0f64b757077a7b1d1f893ad3c16a51ab40d28a83
1,040
package navy.otter.nonaturalspawn.command; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.command.TabCompleter; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class NoNaturalSpawnCommandTabCompleter implements TabCompleter { @Override public @Nullable List<String> onTabComplete(@NotNull CommandSender player, @NotNull Command command, @NotNull String s, @NotNull String[] args) { ArrayList<String> list = new ArrayList<>(); if (!(player instanceof Player)) { return new ArrayList<>(); } if (args.length <= 1) { if (player.hasPermission("nonaturalspawn.list")) { list.add("list"); return list .stream() .filter((string) -> string.startsWith(args[0])) .collect(Collectors.toList()); } } return new ArrayList<>(); } }
28.108108
76
0.693269
93a7dee2791f9269bd016c131cf8c629c56f2d1d
927
package io.github.blobanium.mineclubexpanded.housing; import io.github.blobanium.mineclubexpanded.util.discord.DiscordRP; import net.minecraft.client.MinecraftClient; public class HousingRichPresenceListener { public static String lastChatField; public static void sendHousingPresence(){ String message = lastChatField; if(message.startsWith("/home")) { String finalMessage = message.replaceAll("/home", ""); if(finalMessage.equals("")){ DiscordRP.updateStatus("Currently In " + MinecraftClient.getInstance().getSession().getUsername() + "'s Home", "Playing On Mineclub"); }else { DiscordRP.updateStatus("Currently In " + finalMessage + "'s Home", "Playing On Mineclub"); } } else { DiscordRP.updateStatus("Currently In Housing", "Playing On Mineclub"); } lastChatField = ""; } }
38.625
150
0.648328
1a922124da900613ed25289a448ac6caaaba7ed7
1,534
/* * Copyright (c) 1995-1998 Sun Microsystems, Inc. All Rights Reserved. * * Permission to use, copy, modify, and distribute this software * and its documentation for NON-COMMERCIAL purposes and without * fee is hereby granted provided that this copyright notice * appears in all copies. Please refer to the file "copyright.html" * for further important copyright and licensing information. * * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. */ import java.lang.reflect.*; import java.awt.*; class SampleConstructor { public static void main(String[] args) { Rectangle r = new Rectangle(); showConstructors(r); } static void showConstructors(Object o) { Class c = o.getClass(); Constructor[] theConstructors = c.getConstructors(); for (int i = 0; i < theConstructors.length; i++) { System.out.print("( "); Class[] parameterTypes = theConstructors[i].getParameterTypes(); for (int k = 0; k < parameterTypes.length; k ++) { String parameterString = parameterTypes[k].getName(); System.out.print(parameterString + " "); } System.out.println(")"); } } }
36.52381
73
0.685137
5309cb748567bb0ce44bcfa4e5b14600f72a4845
9,426
package com.example.mike.testinstagramlogin; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.TextView; import com.android.volley.toolbox.Volley; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.net.URLDecoder; import java.util.LinkedHashMap; import java.util.Map; import javax.xml.parsers.ParserConfigurationException; import org.json.JSONObject; import org.json.JSONTokener; import org.xml.sax.SAXException; public class RedirectedActivity extends AppCompatActivity { private static final String TAG = "RedirectedActivity"; private static String mAccessToken; private TextView userInfo; public class Hello2 { public boolean BooleanFunction(int i) { return i == 100; } Hello2() { System.out.println("This is a second test"); } public void TestFunction2() { System.out.println("Hello world2"); } } public class Hello { public int TestFunction10(int i) { int i2 = 255; return i > 0 ? 0 : i > i2 ? i2 : i; } public void TestFunction3(int i) { for (int i2 = 0; i2 < 10; i2++) { int i3 = 1; if (i == i3) { i = i3; } } } public int TestFunction4(int i) { int i2 = 1; return i == i2 ? i2 : i == 0 ? 2 : 3; } public void TestFunction6(int i) { Object obj = 1; } public int TestFunction8() { return 1; } public void nothingFunction() { } Hello() { System.out.println("This is a test"); } public void TestFunction1(int i, int i2) { int i3 = 1; if (i == i3 && i2 == 0 && i == i3 && i2 != i3) { System.out.println("Woohoo"); } if (i == i3 || i2 == i3) { System.out.println("Wow"); } if (i == 0 && i2 == i3) { System.out.println("Hello"); } } public void TestFunction5(int i) { Hello2 hello2 = new Hello2(); if (i == 1) { boolean BooleanFunction = hello2.BooleanFunction(i); } } public boolean TestFunction7(String str) { return "Hello World".equals(str) && "Hi World".equals(str); } public void TestFunction9(int i) { Hello2 hello2 = new Hello2(); if (i == 1) { boolean BooleanFunction = hello2.BooleanFunction(i); } } } protected void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.activity_redirected); this.userInfo = (TextView) findViewById(R.id.UserInfo); try { requestAccessToken(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (SAXException e2) { e2.printStackTrace(); } catch (ParserConfigurationException e3) { e3.printStackTrace(); } catch (IOException e4) { e4.printStackTrace(); } } private void requestAccessToken() throws IOException, ParserConfigurationException, SAXException { URL url = new URL(getIntent().getDataString()); final String clientID = AuthConfiguration.getInstance(this).getClientID(); final String clientSecret = AuthConfiguration.getInstance(this).getClientSecret(); final String grantType = AuthConfiguration.getInstance(this).getGrantType(); final String redirectURI = AuthConfiguration.getInstance(this).getRedirectURI(); final String str = (String) splitQuery(url).get("code"); final String accessTokenURI = AuthConfiguration.getInstance(this).getAccessTokenURI(); if (!(clientID == null || clientSecret == null || grantType == null || redirectURI == null)) { Log.i("RedirectedActivity", "Hello this is a test"); } new Thread() { public void run() { Log.i("RedirectedActivity", "Getting access token"); try { URL url = new URL(accessTokenURI); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("Opening Token URL "); stringBuilder.append(url.toString()); Log.i("RedirectedActivity", stringBuilder.toString()); HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection(); httpURLConnection.setRequestMethod("POST"); boolean z = true; httpURLConnection.setDoInput(z); httpURLConnection.setDoOutput(z); OutputStreamWriter outputStreamWriter = new OutputStreamWriter(httpURLConnection.getOutputStream()); stringBuilder = new StringBuilder(); stringBuilder.append("client_id="); stringBuilder.append(clientID); stringBuilder.append("&client_secret="); stringBuilder.append(clientSecret); stringBuilder.append("&grant_type="); stringBuilder.append(grantType); stringBuilder.append("&redirect_uri="); stringBuilder.append(redirectURI); stringBuilder.append("&code="); stringBuilder.append(str); outputStreamWriter.write(stringBuilder.toString()); outputStreamWriter.flush(); String access$000 = RedirectedActivity.this.streamToString(httpURLConnection.getInputStream()); stringBuilder = new StringBuilder(); stringBuilder.append("response "); stringBuilder.append(access$000); Log.i("RedirectedActivity", stringBuilder.toString()); RedirectedActivity.mAccessToken = ((JSONObject) new JSONTokener(access$000).nextValue()).getString("access_token"); StringBuilder stringBuilder2 = new StringBuilder(); stringBuilder2.append("Got access token: "); stringBuilder2.append(RedirectedActivity.mAccessToken); Log.i("RedirectedActivity", stringBuilder2.toString()); } catch (Exception e) { e.printStackTrace(); } } }.start(); } private Map<String, String> splitQuery(URL url) throws UnsupportedEncodingException { Map<String, String> linkedHashMap = new LinkedHashMap(); String[] split = url.getQuery().split("&"); int i = 0; int length = split.length; for (int i2 = i; i2 < length; i2++) { String str = split[i2]; int indexOf = str.indexOf("="); linkedHashMap.put(URLDecoder.decode(str.substring(i, indexOf), "UTF-8"), URLDecoder.decode(str.substring(indexOf + 1), "UTF-8")); } return linkedHashMap; } public void getSelfInformation(View view) throws ParserConfigurationException, SAXException, IOException { Volley.newRequestQueue(this); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(AuthConfiguration.getInstance(this).getSelfInformationURI()); stringBuilder.append("?access_token="); stringBuilder.append(mAccessToken); final String stringBuilder2 = stringBuilder.toString(); System.out.println(stringBuilder2); new Thread() { public void run() { Log.i("RedirectedActivity", "Getting self information"); try { HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(stringBuilder2).openConnection(); httpURLConnection.setRequestMethod("GET"); httpURLConnection.setDoInput(true); RedirectedActivity.this.userInfo.setText(RedirectedActivity.this.streamToString(httpURLConnection.getInputStream())); } catch (Exception e) { e.printStackTrace(); } } }.start(); } private String streamToString(InputStream inputStream) throws IOException { String str = ""; if (inputStream == null) { return str; } StringBuilder stringBuilder = new StringBuilder(); try { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); while (true) { String readLine = bufferedReader.readLine(); if (readLine == null) { break; } stringBuilder.append(readLine); } bufferedReader.close(); return stringBuilder.toString(); } finally { inputStream.close(); } } }
38.790123
141
0.572247
a7db5002ba434cb834bcc10f674521110a3a0efe
340
package jp.yoshikipom.runlogapi.domain.model; import java.time.LocalDate; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Data @Builder @NoArgsConstructor @AllArgsConstructor public class Record { private LocalDate date; private float distance; private String memo; }
17.894737
45
0.811765
15430f7b8fe9f5f4b589b8b53ec0eb5230c7ac8c
54,746
package cn.org.hentai.dns.entity; import java.util.ArrayList; import java.util.List; public class RuleExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; private Integer limit; private Integer offset; public RuleExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public RuleExample orderBy(String orderByClause) { this.setOrderByClause(orderByClause); return this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public RuleExample orderBy(String ... orderByClauses) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < orderByClauses.length; i++) { sb.append(orderByClauses[i]); if (i < orderByClauses.length - 1) { sb.append(" , "); } } this.setOrderByClause(sb.toString()); return this; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(this); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } public void setLimit(Integer limit) { this.limit = limit; } public Integer getLimit() { return limit; } public void setOffset(Integer offset) { this.offset = offset; } public Integer getOffset() { return offset; } public void setPageInfo(Integer currentPage, Integer pageSize) { if(pageSize<1) throw new IllegalArgumentException("页大小不能小于1!"); this.limit=pageSize; if(currentPage<1) throw new IllegalArgumentException("页数不能小于1!"); this.offset=(currentPage-1)*pageSize; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public static Criteria newAndCreateCriteria() { RuleExample example = new RuleExample(); return example.createCriteria(); } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this; } public Criteria andIdIsNotNull() { addCriterion("id is not null"); return (Criteria) this; } public Criteria andIdEqualTo(Long value) { addCriterion("id =", value, "id"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andIdEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("id = ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIdNotEqualTo(Long value) { addCriterion("id <>", value, "id"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andIdNotEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("id <> ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIdGreaterThan(Long value) { addCriterion("id >", value, "id"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andIdGreaterThanColumn(Rule.Column column) { addCriterion(new StringBuilder("id > ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIdGreaterThanOrEqualTo(Long value) { addCriterion("id >=", value, "id"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andIdGreaterThanOrEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("id >= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIdLessThan(Long value) { addCriterion("id <", value, "id"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andIdLessThanColumn(Rule.Column column) { addCriterion(new StringBuilder("id < ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIdLessThanOrEqualTo(Long value) { addCriterion("id <=", value, "id"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andIdLessThanOrEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("id <= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIdIn(List<Long> values) { addCriterion("id in", values, "id"); return (Criteria) this; } public Criteria andIdNotIn(List<Long> values) { addCriterion("id not in", values, "id"); return (Criteria) this; } public Criteria andIdBetween(Long value1, Long value2) { addCriterion("id between", value1, value2, "id"); return (Criteria) this; } public Criteria andIdNotBetween(Long value1, Long value2) { addCriterion("id not between", value1, value2, "id"); return (Criteria) this; } public Criteria andIpFromIsNull() { addCriterion("ipFrom is null"); return (Criteria) this; } public Criteria andIpFromIsNotNull() { addCriterion("ipFrom is not null"); return (Criteria) this; } public Criteria andIpFromEqualTo(Long value) { addCriterion("ipFrom =", value, "ipFrom"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andIpFromEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("ipFrom = ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIpFromNotEqualTo(Long value) { addCriterion("ipFrom <>", value, "ipFrom"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andIpFromNotEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("ipFrom <> ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIpFromGreaterThan(Long value) { addCriterion("ipFrom >", value, "ipFrom"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andIpFromGreaterThanColumn(Rule.Column column) { addCriterion(new StringBuilder("ipFrom > ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIpFromGreaterThanOrEqualTo(Long value) { addCriterion("ipFrom >=", value, "ipFrom"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andIpFromGreaterThanOrEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("ipFrom >= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIpFromLessThan(Long value) { addCriterion("ipFrom <", value, "ipFrom"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andIpFromLessThanColumn(Rule.Column column) { addCriterion(new StringBuilder("ipFrom < ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIpFromLessThanOrEqualTo(Long value) { addCriterion("ipFrom <=", value, "ipFrom"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andIpFromLessThanOrEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("ipFrom <= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIpFromIn(List<Long> values) { addCriterion("ipFrom in", values, "ipFrom"); return (Criteria) this; } public Criteria andIpFromNotIn(List<Long> values) { addCriterion("ipFrom not in", values, "ipFrom"); return (Criteria) this; } public Criteria andIpFromBetween(Long value1, Long value2) { addCriterion("ipFrom between", value1, value2, "ipFrom"); return (Criteria) this; } public Criteria andIpFromNotBetween(Long value1, Long value2) { addCriterion("ipFrom not between", value1, value2, "ipFrom"); return (Criteria) this; } public Criteria andIpToIsNull() { addCriterion("ipTo is null"); return (Criteria) this; } public Criteria andIpToIsNotNull() { addCriterion("ipTo is not null"); return (Criteria) this; } public Criteria andIpToEqualTo(Long value) { addCriterion("ipTo =", value, "ipTo"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andIpToEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("ipTo = ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIpToNotEqualTo(Long value) { addCriterion("ipTo <>", value, "ipTo"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andIpToNotEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("ipTo <> ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIpToGreaterThan(Long value) { addCriterion("ipTo >", value, "ipTo"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andIpToGreaterThanColumn(Rule.Column column) { addCriterion(new StringBuilder("ipTo > ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIpToGreaterThanOrEqualTo(Long value) { addCriterion("ipTo >=", value, "ipTo"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andIpToGreaterThanOrEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("ipTo >= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIpToLessThan(Long value) { addCriterion("ipTo <", value, "ipTo"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andIpToLessThanColumn(Rule.Column column) { addCriterion(new StringBuilder("ipTo < ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIpToLessThanOrEqualTo(Long value) { addCriterion("ipTo <=", value, "ipTo"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andIpToLessThanOrEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("ipTo <= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andIpToIn(List<Long> values) { addCriterion("ipTo in", values, "ipTo"); return (Criteria) this; } public Criteria andIpToNotIn(List<Long> values) { addCriterion("ipTo not in", values, "ipTo"); return (Criteria) this; } public Criteria andIpToBetween(Long value1, Long value2) { addCriterion("ipTo between", value1, value2, "ipTo"); return (Criteria) this; } public Criteria andIpToNotBetween(Long value1, Long value2) { addCriterion("ipTo not between", value1, value2, "ipTo"); return (Criteria) this; } public Criteria andTimeFromIsNull() { addCriterion("timeFrom is null"); return (Criteria) this; } public Criteria andTimeFromIsNotNull() { addCriterion("timeFrom is not null"); return (Criteria) this; } public Criteria andTimeFromEqualTo(Integer value) { addCriterion("timeFrom =", value, "timeFrom"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andTimeFromEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("timeFrom = ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andTimeFromNotEqualTo(Integer value) { addCriterion("timeFrom <>", value, "timeFrom"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andTimeFromNotEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("timeFrom <> ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andTimeFromGreaterThan(Integer value) { addCriterion("timeFrom >", value, "timeFrom"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andTimeFromGreaterThanColumn(Rule.Column column) { addCriterion(new StringBuilder("timeFrom > ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andTimeFromGreaterThanOrEqualTo(Integer value) { addCriterion("timeFrom >=", value, "timeFrom"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andTimeFromGreaterThanOrEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("timeFrom >= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andTimeFromLessThan(Integer value) { addCriterion("timeFrom <", value, "timeFrom"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andTimeFromLessThanColumn(Rule.Column column) { addCriterion(new StringBuilder("timeFrom < ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andTimeFromLessThanOrEqualTo(Integer value) { addCriterion("timeFrom <=", value, "timeFrom"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andTimeFromLessThanOrEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("timeFrom <= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andTimeFromIn(List<Integer> values) { addCriterion("timeFrom in", values, "timeFrom"); return (Criteria) this; } public Criteria andTimeFromNotIn(List<Integer> values) { addCriterion("timeFrom not in", values, "timeFrom"); return (Criteria) this; } public Criteria andTimeFromBetween(Integer value1, Integer value2) { addCriterion("timeFrom between", value1, value2, "timeFrom"); return (Criteria) this; } public Criteria andTimeFromNotBetween(Integer value1, Integer value2) { addCriterion("timeFrom not between", value1, value2, "timeFrom"); return (Criteria) this; } public Criteria andTimetoIsNull() { addCriterion("timeto is null"); return (Criteria) this; } public Criteria andTimetoIsNotNull() { addCriterion("timeto is not null"); return (Criteria) this; } public Criteria andTimetoEqualTo(Integer value) { addCriterion("timeto =", value, "timeto"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andTimetoEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("timeto = ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andTimetoNotEqualTo(Integer value) { addCriterion("timeto <>", value, "timeto"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andTimetoNotEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("timeto <> ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andTimetoGreaterThan(Integer value) { addCriterion("timeto >", value, "timeto"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andTimetoGreaterThanColumn(Rule.Column column) { addCriterion(new StringBuilder("timeto > ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andTimetoGreaterThanOrEqualTo(Integer value) { addCriterion("timeto >=", value, "timeto"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andTimetoGreaterThanOrEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("timeto >= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andTimetoLessThan(Integer value) { addCriterion("timeto <", value, "timeto"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andTimetoLessThanColumn(Rule.Column column) { addCriterion(new StringBuilder("timeto < ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andTimetoLessThanOrEqualTo(Integer value) { addCriterion("timeto <=", value, "timeto"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andTimetoLessThanOrEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("timeto <= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andTimetoIn(List<Integer> values) { addCriterion("timeto in", values, "timeto"); return (Criteria) this; } public Criteria andTimetoNotIn(List<Integer> values) { addCriterion("timeto not in", values, "timeto"); return (Criteria) this; } public Criteria andTimetoBetween(Integer value1, Integer value2) { addCriterion("timeto between", value1, value2, "timeto"); return (Criteria) this; } public Criteria andTimetoNotBetween(Integer value1, Integer value2) { addCriterion("timeto not between", value1, value2, "timeto"); return (Criteria) this; } public Criteria andMatchModeIsNull() { addCriterion("matchMode is null"); return (Criteria) this; } public Criteria andMatchModeIsNotNull() { addCriterion("matchMode is not null"); return (Criteria) this; } public Criteria andMatchModeEqualTo(String value) { addCriterion("matchMode =", value, "matchMode"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andMatchModeEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("matchMode = ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andMatchModeNotEqualTo(String value) { addCriterion("matchMode <>", value, "matchMode"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andMatchModeNotEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("matchMode <> ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andMatchModeGreaterThan(String value) { addCriterion("matchMode >", value, "matchMode"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andMatchModeGreaterThanColumn(Rule.Column column) { addCriterion(new StringBuilder("matchMode > ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andMatchModeGreaterThanOrEqualTo(String value) { addCriterion("matchMode >=", value, "matchMode"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andMatchModeGreaterThanOrEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("matchMode >= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andMatchModeLessThan(String value) { addCriterion("matchMode <", value, "matchMode"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andMatchModeLessThanColumn(Rule.Column column) { addCriterion(new StringBuilder("matchMode < ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andMatchModeLessThanOrEqualTo(String value) { addCriterion("matchMode <=", value, "matchMode"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andMatchModeLessThanOrEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("matchMode <= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andMatchModeLike(String value) { addCriterion("matchMode like", value, "matchMode"); return (Criteria) this; } public Criteria andMatchModeNotLike(String value) { addCriterion("matchMode not like", value, "matchMode"); return (Criteria) this; } public Criteria andMatchModeIn(List<String> values) { addCriterion("matchMode in", values, "matchMode"); return (Criteria) this; } public Criteria andMatchModeNotIn(List<String> values) { addCriterion("matchMode not in", values, "matchMode"); return (Criteria) this; } public Criteria andMatchModeBetween(String value1, String value2) { addCriterion("matchMode between", value1, value2, "matchMode"); return (Criteria) this; } public Criteria andMatchModeNotBetween(String value1, String value2) { addCriterion("matchMode not between", value1, value2, "matchMode"); return (Criteria) this; } public Criteria andNameIsNull() { addCriterion("`name` is null"); return (Criteria) this; } public Criteria andNameIsNotNull() { addCriterion("`name` is not null"); return (Criteria) this; } public Criteria andNameEqualTo(String value) { addCriterion("`name` =", value, "name"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andNameEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("`name` = ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andNameNotEqualTo(String value) { addCriterion("`name` <>", value, "name"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andNameNotEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("`name` <> ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andNameGreaterThan(String value) { addCriterion("`name` >", value, "name"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andNameGreaterThanColumn(Rule.Column column) { addCriterion(new StringBuilder("`name` > ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andNameGreaterThanOrEqualTo(String value) { addCriterion("`name` >=", value, "name"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andNameGreaterThanOrEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("`name` >= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andNameLessThan(String value) { addCriterion("`name` <", value, "name"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andNameLessThanColumn(Rule.Column column) { addCriterion(new StringBuilder("`name` < ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andNameLessThanOrEqualTo(String value) { addCriterion("`name` <=", value, "name"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andNameLessThanOrEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("`name` <= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andNameLike(String value) { addCriterion("`name` like", value, "name"); return (Criteria) this; } public Criteria andNameNotLike(String value) { addCriterion("`name` not like", value, "name"); return (Criteria) this; } public Criteria andNameIn(List<String> values) { addCriterion("`name` in", values, "name"); return (Criteria) this; } public Criteria andNameNotIn(List<String> values) { addCriterion("`name` not in", values, "name"); return (Criteria) this; } public Criteria andNameBetween(String value1, String value2) { addCriterion("`name` between", value1, value2, "name"); return (Criteria) this; } public Criteria andNameNotBetween(String value1, String value2) { addCriterion("`name` not between", value1, value2, "name"); return (Criteria) this; } public Criteria andPriorityIsNull() { addCriterion("priority is null"); return (Criteria) this; } public Criteria andPriorityIsNotNull() { addCriterion("priority is not null"); return (Criteria) this; } public Criteria andPriorityEqualTo(Integer value) { addCriterion("priority =", value, "priority"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andPriorityEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("priority = ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andPriorityNotEqualTo(Integer value) { addCriterion("priority <>", value, "priority"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andPriorityNotEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("priority <> ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andPriorityGreaterThan(Integer value) { addCriterion("priority >", value, "priority"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andPriorityGreaterThanColumn(Rule.Column column) { addCriterion(new StringBuilder("priority > ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andPriorityGreaterThanOrEqualTo(Integer value) { addCriterion("priority >=", value, "priority"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andPriorityGreaterThanOrEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("priority >= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andPriorityLessThan(Integer value) { addCriterion("priority <", value, "priority"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andPriorityLessThanColumn(Rule.Column column) { addCriterion(new StringBuilder("priority < ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andPriorityLessThanOrEqualTo(Integer value) { addCriterion("priority <=", value, "priority"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andPriorityLessThanOrEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("priority <= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andPriorityIn(List<Integer> values) { addCriterion("priority in", values, "priority"); return (Criteria) this; } public Criteria andPriorityNotIn(List<Integer> values) { addCriterion("priority not in", values, "priority"); return (Criteria) this; } public Criteria andPriorityBetween(Integer value1, Integer value2) { addCriterion("priority between", value1, value2, "priority"); return (Criteria) this; } public Criteria andPriorityNotBetween(Integer value1, Integer value2) { addCriterion("priority not between", value1, value2, "priority"); return (Criteria) this; } public Criteria andEnabledIsNull() { addCriterion("enabled is null"); return (Criteria) this; } public Criteria andEnabledIsNotNull() { addCriterion("enabled is not null"); return (Criteria) this; } public Criteria andEnabledEqualTo(Boolean value) { addCriterion("enabled =", value, "enabled"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andEnabledEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("enabled = ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andEnabledNotEqualTo(Boolean value) { addCriterion("enabled <>", value, "enabled"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andEnabledNotEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("enabled <> ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andEnabledGreaterThan(Boolean value) { addCriterion("enabled >", value, "enabled"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andEnabledGreaterThanColumn(Rule.Column column) { addCriterion(new StringBuilder("enabled > ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andEnabledGreaterThanOrEqualTo(Boolean value) { addCriterion("enabled >=", value, "enabled"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andEnabledGreaterThanOrEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("enabled >= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andEnabledLessThan(Boolean value) { addCriterion("enabled <", value, "enabled"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andEnabledLessThanColumn(Rule.Column column) { addCriterion(new StringBuilder("enabled < ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andEnabledLessThanOrEqualTo(Boolean value) { addCriterion("enabled <=", value, "enabled"); return (Criteria) this; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andEnabledLessThanOrEqualToColumn(Rule.Column column) { addCriterion(new StringBuilder("enabled <= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } public Criteria andEnabledIn(List<Boolean> values) { addCriterion("enabled in", values, "enabled"); return (Criteria) this; } public Criteria andEnabledNotIn(List<Boolean> values) { addCriterion("enabled not in", values, "enabled"); return (Criteria) this; } public Criteria andEnabledBetween(Boolean value1, Boolean value2) { addCriterion("enabled between", value1, value2, "enabled"); return (Criteria) this; } public Criteria andEnabledNotBetween(Boolean value1, Boolean value2) { addCriterion("enabled not between", value1, value2, "enabled"); return (Criteria) this; } public Criteria andMatchModeLikeInsensitive(String value) { addCriterion("upper(matchMode) like", value.toUpperCase(), "matchMode"); return (Criteria) this; } public Criteria andNameLikeInsensitive(String value) { addCriterion("upper(`name`) like", value.toUpperCase(), "name"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { /** * This field was generated by MyBatis Generator. * This field corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ private RuleExample example; /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ protected Criteria(RuleExample example) { super(); this.example = example; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public RuleExample example() { return this.example; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public Criteria andIf(boolean ifAdd, ICriteriaAdd add) { if (ifAdd) { add.add(this); } return this; } /** * This interface was generated by MyBatis Generator. * This interface corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ public interface ICriteriaAdd { /** * This method was generated by MyBatis Generator. * This method corresponds to the database table dns-cheater..rule * * @mbg.generated * @project https://github.com/itfsw/mybatis-generator-plugin */ Criteria add(Criteria add); } } public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
35.388494
110
0.591404
83f18f98c1e892a8c1db937e3b3cad6687ad9138
460
package cn.waggag.travle.dao; import cn.waggag.travle.domain.Route; import java.util.List; public interface RouteDao { /** * 根据cid查询总记录数 */ public int findTotalCount(int cid, String rname); /** * 根据cid,start,pageSize查询当前页的数据集合 */ public List<Route> findByPage(int cid, int start, int pageSize, String rname); /** * 根据rid查询route对象 * @param rid * @return Route对象 */ Route findOne(int rid); }
18.4
82
0.628261
2409ee5e8b781fcfc9be909f6c0b98433d46a090
615
package com.wiblog.core.event; import com.wiblog.core.entity.Comment; import org.springframework.context.ApplicationEvent; /** * 评论事件 * @author pwm * @date 2021/1/4 */ public class CommentEvent extends ApplicationEvent { private Comment comment; public CommentEvent(Object source,Comment comment) { super(source); this.comment = comment; } @Override public Object getSource() { return super.getSource(); } public Comment getComment() { return comment; } public void setComment(Comment comment) { this.comment = comment; } }
18.636364
56
0.656911
f4b2f9de318ab2089fecbe979e79619352191302
677
package xyz.rensaa.providerservice.dto; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import org.immutables.value.Value; import java.util.List; import java.util.Optional; @Value.Immutable @JsonSerialize(as = ImmutableTreatmentProviderMessage.class) @JsonDeserialize(as = ImmutableTreatmentProviderMessage.class) public interface TreatmentProviderMessage { @JsonProperty("address") String address(); @JsonProperty("trustedBy") Optional<List<String>> trustees(); @JsonProperty("isTrusted") Optional<Boolean> isTrusted(); }
27.08
65
0.810931
b7a4b5e52f1dcdfb403adb72fe4ac448458f3d1d
2,281
package com.hbm.handler; import com.hbm.items.weapon.ItemMissile; import com.hbm.items.weapon.ItemMissile.PartType; import io.netty.buffer.ByteBuf; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class MissileStruct { public ItemMissile warhead; public ItemMissile fuselage; public ItemMissile fins; public ItemMissile thruster; public MissileStruct() { } public MissileStruct(ItemStack w, ItemStack f, ItemStack s, ItemStack t) { if(w != null && w.getItem() instanceof ItemMissile) warhead = (ItemMissile) w.getItem(); if(f != null && f.getItem() instanceof ItemMissile) fuselage = (ItemMissile) f.getItem(); if(s != null && s.getItem() instanceof ItemMissile) fins = (ItemMissile) s.getItem(); if(t != null && t.getItem() instanceof ItemMissile) thruster = (ItemMissile) t.getItem(); } public MissileStruct(Item w, Item f, Item s, Item t) { if(w instanceof ItemMissile) warhead = (ItemMissile) w; if(f instanceof ItemMissile) fuselage = (ItemMissile) f; if(s instanceof ItemMissile) fins = (ItemMissile) s; if(t instanceof ItemMissile) thruster = (ItemMissile) t; } public void writeToByteBuffer(ByteBuf buf) { if(warhead != null && warhead.type == PartType.WARHEAD) buf.writeInt(Item.getIdFromItem(warhead)); else buf.writeInt(0); if(fuselage != null && fuselage.type == PartType.FUSELAGE) buf.writeInt(Item.getIdFromItem(fuselage)); else buf.writeInt(0); if(fins != null && fins.type == PartType.FINS) buf.writeInt(Item.getIdFromItem(fins)); else buf.writeInt(0); if(thruster != null && thruster.type == PartType.THRUSTER) buf.writeInt(Item.getIdFromItem(thruster)); else buf.writeInt(0); } public static MissileStruct readFromByteBuffer(ByteBuf buf) { MissileStruct multipart = new MissileStruct(); int w = buf.readInt(); int f = buf.readInt(); int s = buf.readInt(); int t = buf.readInt(); if(w != 0) multipart.warhead = (ItemMissile) Item.getItemById(w); if(f != 0) multipart.fuselage = (ItemMissile) Item.getItemById(f); if(s != 0) multipart.fins = (ItemMissile) Item.getItemById(s); if(t != 0) multipart.thruster = (ItemMissile) Item.getItemById(t); return multipart; } }
24.793478
75
0.690487
acf96cce0bd70b5e26f24b000c3840cacbef6dc7
703
package com.ub.paritycollector.service.parity; import com.ub.paritycollector.service.parity.impl.BinanceParityCollector; import com.ub.paritycollector.service.parity.impl.BtcTurkParityCollector; /** * Factory Method */ class ParityCollectorFactory { static ParityCollector getInstanceOf(Class<? extends ParityCollector> parityCollectorClass) { if (parityCollectorClass == BinanceParityCollector.class) { return BinanceParityCollector.getInstance(); } else if (parityCollectorClass == BtcTurkParityCollector.class) { return BtcTurkParityCollector.getInstance(); } else { throw new UnsupportedOperationException(); } } }
29.291667
97
0.728307
7d6d443278f771ece91d802641328712d885d6fc
166
public class TestLogicalOr { public static void main(String[] args) { int x = 20; System.out.println(!(x == 20 || args[0].length() > 5)); } }
23.714286
63
0.548193
447f380044ccf9a8235cb0e4602e7951438e410e
5,283
/** * Copyright (c) 2020 dingqianwen (761945125@qq.com) * <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 cn.ruleengine.client; import javax.annotation.Resource; import cn.ruleengine.client.exception.ValidException; import cn.ruleengine.client.fegin.RuleInterface; import cn.ruleengine.client.model.RuleModel; import cn.ruleengine.client.param.BatchParam; import cn.ruleengine.client.param.ExecuteParam; import cn.ruleengine.client.param.IsExistsParam; import cn.ruleengine.client.result.BatchOutPut; import cn.ruleengine.client.result.ExecuteRuleResult; import cn.ruleengine.client.result.OutPut; import cn.ruleengine.client.exception.ExecuteException; import cn.ruleengine.client.model.ElementField; import cn.ruleengine.client.result.IsExistsResult; import lombok.Data; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.springframework.lang.NonNull; import org.springframework.util.StringUtils; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.*; /** * 〈一句话功能简述〉<br> * 〈〉 * * @author 丁乾文 * @create 2020/12/6 * @since 1.0.0 */ @Slf4j @Data public class RuleEngineClient { @Resource private RuleEngineProperties ruleEngineProperties; @Resource private RuleInterface ruleInterface; public RuleEngineClient() { } /** * 调用规则引擎中的规则 * * @param ruleCode 规则code * @param input 规则参数 * @return 规则结果 */ public OutPut execute(@NonNull String ruleCode, @NonNull Map<String, Object> input) { Objects.requireNonNull(ruleCode); Objects.requireNonNull(input); ExecuteParam executeParam = new ExecuteParam(); executeParam.setRuleCode(ruleCode); executeParam.setWorkspaceCode(this.ruleEngineProperties.getWorkspaceCode()); executeParam.setAccessKeyId(this.ruleEngineProperties.getAccessKeyId()); executeParam.setAccessKeySecret(this.ruleEngineProperties.getAccessKeySecret()); executeParam.setParam(input); log.info("rule execute param is {}", executeParam); ExecuteRuleResult result = this.ruleInterface.execute(executeParam); log.info("rule execute result is " + result); if (!result.isSuccess()) { throw new ExecuteException(result.getMessage()); } return result.getData(); } /** * 根据规则模型解析调用引擎中的规则 * * @param model 规则调用模型 * @return 规则结果 * @see RuleModel */ @SneakyThrows public OutPut execute(@NonNull Object model) { Objects.requireNonNull(model); if (!model.getClass().isAnnotationPresent(RuleModel.class)) { throw new ValidException("{}找不到RuleModel注解", model.getClass()); } RuleModel ruleModel = model.getClass().getAnnotation(RuleModel.class); String ruleCode = ruleModel.ruleCode(); if (StringUtils.isEmpty(ruleCode)) { ruleCode = model.getClass().getSimpleName(); } Map<String, Object> input = new HashMap<>(); Field[] fields = model.getClass().getDeclaredFields(); for (Field field : fields) { if (!Modifier.isPublic(field.getModifiers())) { field.setAccessible(true); } String elementCode = field.getName(); if (field.isAnnotationPresent(ElementField.class)) { ElementField elementField = field.getAnnotation(ElementField.class); String code = elementField.code(); if (!StringUtils.isEmpty(code)) { elementCode = code; } } Object value = field.get(model); input.put(elementCode, value); } return this.execute(ruleCode, input); } /** * 引擎中是否存在此规则 * * @param ruleCode 规则code * @return true 存在 */ public boolean isExists(String ruleCode) { if (StringUtils.isEmpty(ruleCode)) { return false; } IsExistsParam existsParam = new IsExistsParam(); existsParam.setRuleCode(ruleCode); existsParam.setWorkspaceCode(this.ruleEngineProperties.getWorkspaceCode()); existsParam.setAccessKeyId(this.ruleEngineProperties.getAccessKeyId()); existsParam.setAccessKeySecret(this.ruleEngineProperties.getAccessKeySecret()); log.info("rule isExists param is {}", existsParam); IsExistsResult isExistsResult = this.ruleInterface.isExists(existsParam); log.info("rule isExists result is " + isExistsResult); return isExistsResult.getData(); } /** * 批量执行规则 * * @param batchParam 批量参数 * @return list */ public List<BatchOutPut> batchExecute(BatchParam batchParam) { return null; } }
33.226415
89
0.672345
3107140850ef8adc56b48075237c0008e743d0f4
273
package se.devscout.scoutapi.auth; public enum Role { limited_user(-1), user(0), moderator(10), administrator(20); private int level; Role(int level) { this.level = level; } public int getLevel() { return level; } }
13.65
34
0.571429
1c5a3e10195be84d8f623db8effb6122492fb445
1,658
/* * Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.hazelcast.core; /** * <p>Implementations of this interface select members * that are capable of executing a special kind of task.<br/> * The {@link #select(Member)} method is called for every available * member in the cluster and it is up to the implementation to decide * if the member is going to be used or not.</p> * <p>For example, a basic implementation could select members on the * existence of a special attribute in the members, like the following * example:<br/> * <pre>public class MyMemberSelector implements MemberSelector { * public boolean select(Member member) { * return Boolean.TRUE.equals(member.getAttribute("my.special.executor")); * } * }</pre> * </p> */ public interface MemberSelector { /** * Decides if the given member will be part of an operation or not. * * @param member the member instance to decide upon * @return true if the member should take part in the operation, false otherwise */ boolean select(Member member); }
36.043478
84
0.714717
0ea30536a57f181d5001f6b2a5cfc7f6e8c3658d
234
/** * Author: Bob Chen */ package com.jcommerce.gwt.client.validator; public interface IValidator { /** * @return error message, null if no error */ String validate(Object value); boolean allowEmpty(); }
15.6
47
0.632479
346044159cb5a6f14733ce3c0191bcada2fe9334
2,820
package net.menthor.common.ontouml2graph; public class GraphAlgo { public static void fundamentalCycles(int n, int m, int nodei[], int nodej[], int fundcycle[][]) { int i,j,k,nodeu,nodev,components,numcycles,root,index,edges; int low,len,up,node1,node2,node3; int endnode[] = new int[m+1]; int firstedges[] = new int[n+1]; int nextnode[] = new int[n+1]; int pointer[] = new int[n+1]; int currentcycle[] = new int[n+1]; boolean join; // set up the forward star representation of the graph k = 0; for (i=1; i<=n-1; i++) { firstedges[i] = k + 1; for (j=1; j<=m; j++) { nodeu = nodei[j]; nodev = nodej[j]; if ((nodeu == i) && (nodeu < nodev)) { k++; endnode[k] = nodev; } else { if ((nodev == i) && (nodev < nodeu)) { k ++; endnode[k] = nodeu; } } } } firstedges[n] = m + 1; for (i=1; i<=n; i++) nextnode[i] = 0; components = 0; numcycles = 0; for (root=1; root<=n; root++) if (nextnode[root] == 0) { components++; nextnode[root] = -1; index = 1; pointer[1] = root; edges = 2; do { node3 = pointer[index]; index--; nextnode[node3] = -nextnode[node3]; for (node2=1; node2<=n; node2++) { join = false; if (node2 != node3) { if (node2 < node3) { nodeu = node2; nodev = node3; } else { nodeu = node3; nodev = node2; } low = firstedges[nodeu]; up = firstedges[nodeu + 1]; if (up > low) { up--; for (k=low; k<=up; k++) if (endnode[k] == nodev) { join = true; break; } } } if (join) { node1 = nextnode[node2]; if (node1 == 0) { nextnode[node2] = -node3; index++; pointer[index] = node2; } else { if (node1 < 0) { //generate the next cycle numcycles++; len = 3; node1 = -node1; currentcycle[1] = node1; currentcycle[2] = node2; currentcycle[3] = node3; i = node3; while (true) { j = nextnode[i]; if (j == node1) break; len++; currentcycle[len] = j; i = j; } //store the current fundamental cycle fundcycle[numcycles][0] = len; for (i=1; i<=len; i++) fundcycle[numcycles][i] = currentcycle[i]; } } } } edges++; } while ((edges <= n) && (index > 0)); nextnode[root] = 0; node3 = pointer[1]; nextnode[node3] = Math.abs(nextnode[node3]); } fundcycle[0][0] = numcycles; fundcycle[0][1] = components; } }
24.310345
97
0.458865
438346b16a30dc51381f48b35e64994b74a9850d
5,210
/* Copyright (c) since 2015, Tel Aviv University and Software Modeling Lab All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Tel Aviv University and Software Modeling Lab nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Tel Aviv University and Software Modeling Lab BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package tau.smlab.syntech.counterstrategy.repair; /** * Use a queue to find repairs in BFS style (similar to Alur's algorithm) * * @author Shalom * */ import java.util.ArrayList; import java.util.List; import tau.smlab.syntech.checks.CouldAsmHelp; import tau.smlab.syntech.counterstrategy.model.JusticeViolationGraph; import tau.smlab.syntech.gameinput.model.GameInput; import tau.smlab.syntech.games.rabin.RabinGame; import tau.smlab.syntech.jtlv.Env; import tau.smlab.syntech.repair.BasicAssumption; import tau.smlab.syntech.repair.RepairCore; public class BFSModelRepair extends ModelRepair { public BFSModelRepair(GameInput gameInput, int alpha, boolean merge, boolean edgeData, boolean repairCore) { super(gameInput, alpha, merge, edgeData, repairCore); } @Override protected void applySearch() { List<BasicAssumption> currAdditions = null; List<List<BasicAssumption>> queue = new ArrayList<List<BasicAssumption>>(); queue.add(new ArrayList<BasicAssumption>()); while (!queue.isEmpty()) { currAdditions = queue.remove(0); createModelWithAdditions(currAdditions); if (CouldAsmHelp.couldAsmHelp(gm)) { // abandon paths with inconsistent spec RabinGame rg = new RabinGame(gm); if (!rg.checkRealizability()) { rg.free(); int depth = currAdditions.size(); if (withRepairCore) { // it may be the case that not all the additions are needed. // compute a core of the additional assumptions computeGameModel(); RepairCore coreFinder = new RepairCore(gm); currAdditions = coreFinder.minimize(currAdditions); } long time = System.currentTimeMillis() - startTime; recordRepair(currAdditions, time, depth); //success runtimes.add(time); if (results.size() == 1) { timeToFirstRepair = System.currentTimeMillis() - startTime; minDepth = depth; } maxDepth = java.lang.Math.max(depth, maxDepth); if (enough()) return; } else if (alpha ==-1 || currAdditions.size() < alpha) { //go deeper only for smaller than max depth JusticeViolationGraph csg = computeCS(gm, rg); List<BasicAssumption> extraction = assumptionFinderOneLevel(csg); csg.freeJVGraph(csg.getNodes(), csg.getEdges()); // the variable has to be deleted from the Env without resetting the old Env or we would lose all bdds Env.deleteVar(JusticeViolationGraph.ASSUMPTION_RANK); for (BasicAssumption ext : extraction) { // BehaviorInfo nextAss = ext.translateToBehavior(); // first check if the assumption is helpful. The code is nasty, look for alternatives // currModel.addEnvBehaviorInfo(nextAss); // SupportMethods.buildEnv(currModel, currModel.getEnvBehaviorInfo()); // boolean res = false; // if (SupportMethods.isRealizable(currModel)) { // SupportMethods.computeAndSetGurCore(currModel); // we need a new core to check helpfulness // res = true; // } // if (!res && SupportMethods.removeIfUnhelpful(currModel, nextAss)) { // we don't care about removing when it's helpful because we don't use the model anymore // unhelpful++; // if (resultingAssumptions.size() + unhelpful == enough) { // foundEnough = true; // } // } else { List<BasicAssumption> withExt = new ArrayList<BasicAssumption>(currAdditions); try { assertTrue("Could not add an assumption to the list", withExt.add(ext)); } catch (Exception e) { e.printStackTrace(); } queue.add(withExt); } } } gm.free(); } } }
41.023622
164
0.717466
bcef31e0aaadaa538234116589b4e4f36f2469b2
1,341
package com.ruoyi.dealpay.mapper; import com.ruoyi.dealpay.domain.DealpayWithdrawalEntity; import java.util.List; /** * 卡商出款记录表Mapper接口 * * @author kiwi * @date 2020-04-03 */ public interface DealpayWithdrawalEntityMapper { /** * 查询卡商出款记录表 * * @param id 卡商出款记录表ID * @return 卡商出款记录表 */ public DealpayWithdrawalEntity selectDealpayWithdrawalEntityById(Long id); /** * 查询卡商出款记录表列表 * * @param dealpayWithdrawalEntity 卡商出款记录表 * @return 卡商出款记录表集合 */ public List<DealpayWithdrawalEntity> selectDealpayWithdrawalEntityList(DealpayWithdrawalEntity dealpayWithdrawalEntity); /** * 新增卡商出款记录表 * * @param dealpayWithdrawalEntity 卡商出款记录表 * @return 结果 */ public int insertDealpayWithdrawalEntity(DealpayWithdrawalEntity dealpayWithdrawalEntity); /** * 修改卡商出款记录表 * * @param dealpayWithdrawalEntity 卡商出款记录表 * @return 结果 */ public int updateDealpayWithdrawalEntity(DealpayWithdrawalEntity dealpayWithdrawalEntity); /** * 删除卡商出款记录表 * * @param id 卡商出款记录表ID * @return 结果 */ public int deleteDealpayWithdrawalEntityById(Long id); /** * 批量删除卡商出款记录表 * * @param ids 需要删除的数据ID * @return 结果 */ public int deleteDealpayWithdrawalEntityByIds(String[] ids); }
21.629032
124
0.668904
c91a8ac5c3e011ac92d2351b8ba87217d1812d31
393
public class HashTable { public class HashEntry { private String key; private int value; public HashEntry(String key,int value) { this.key = key; this.value = Math.abs(value); } private String getKey() { return key; } private int getValue() { return value; } } }
14.555556
48
0.486005
8e961c0e0a9d6688f6b3143e0adc1b44178c1fef
1,626
/* * Copyright 2019 Scott Logic Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.scottlogic.datahelix.generator.core.generation.fieldvaluesources; import com.scottlogic.datahelix.generator.common.RandomNumberGenerator; import java.util.Set; import java.util.stream.Stream; public class BooleanFieldValueSource implements FieldValueSource<Boolean> { private final Set<Boolean> blacklist; public BooleanFieldValueSource(Set<Boolean> blacklist) { this.blacklist = blacklist; } @Override public Stream<Boolean> generateAllValues() { return Stream.of(true, false).filter(this::notInBlacklist); } @Override public Stream<Boolean> generateInterestingValues() { return generateAllValues(); } @Override public Stream<Boolean> generateRandomValues(RandomNumberGenerator randomNumberGenerator) { return Stream.generate(() -> randomNumberGenerator.nextInt() % 2 == 0).filter(this::notInBlacklist); } private boolean notInBlacklist(Boolean b) { return blacklist.stream().noneMatch(x -> x.equals(b)); } }
31.882353
108
0.731857
4cb1b9de95655c36d8281a55e0ec5ce77cd84498
218
package pattern.facade.section5; /** * @author cbf4Life cbf4life@126.com * I'm glad to share my knowledge with you all. */ public class ClassC { public void doSomethingC() { //业务逻辑 } }
16.769231
48
0.610092
8bedd1f242abbf16a5b9610530dcb0c0cf814ecd
2,475
package cn.ac.dicp.group1809.utilities.mzIdentML_reader.io.input; import cn.ac.dicp.group1809.utilities.mzIdentML_reader.model.PeptideHypothesis; import cn.ac.dicp.group1809.utilities.mzIdentML_reader.model.SpectrumIdentificationItemRef; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * @author ZhengFang 2018/9/20 * @since V1.0 */ public class PeptideHypothesisReader { private static Logger logger = LoggerFactory.getLogger(PeptideHypothesisReader.class); public static PeptideHypothesis read(XMLStreamReader reader) throws XMLStreamException { String name = reader.getLocalName(); PeptideHypothesis peptideHypothesis = new PeptideHypothesis(); Map<String, String> attributes = AttributeReader.getAttributes(reader); for (String attributeName : attributes.keySet()) { String attributeValue = attributes.get(attributeName); switch (attributeName) { case "peptideEvidence_ref": peptideHypothesis.setPeptideEvidence_ref(attributeValue); break; default: logger.error("Invalid attribute name in PeptideHypothesis section: " + attributeName); throw new IllegalArgumentException("Invalid attribute name in PeptideHypothesis section: " + attributeName); } } List<SpectrumIdentificationItemRef> spectrumIdentificationItemRefs = new ArrayList<>(); String localName; loop: while (reader.hasNext()) { int next = reader.next(); switch (next) { case XMLStreamReader.START_ELEMENT: localName = reader.getLocalName(); switch (localName) { case "SpectrumIdentificationItemRef": SpectrumIdentificationItemRef spectrumIdentificationItemRef = SpectrumIdentificationItemRefReader.read(reader); spectrumIdentificationItemRefs.add(spectrumIdentificationItemRef); break; default: logger.error("Invalid local name in PeptideHypothesis section: " + localName); throw new IllegalArgumentException("Invalid local name in PeptideHypothesis section: " + localName); } break; case XMLStreamConstants.END_ELEMENT: localName = reader.getLocalName(); if (name.equals(localName)) { break loop; } } } peptideHypothesis.setSpectrumIdentificationItemRef(spectrumIdentificationItemRefs); return peptideHypothesis; } }
36.397059
118
0.767273
4f51dc81a40708ca0d8e40032fe92fb306220311
8,645
/* * Copyright (c) 2010-2012, Bruce Schubert. <bruce@emxsys.com> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * - Neither the name of Bruce Schubert, Emxsys nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.emxsys.gis.api; import static com.emxsys.gis.api.GisType.*; import com.emxsys.visad.GeneralUnit; import com.emxsys.visad.RealXmlAdapter; import com.emxsys.visad.Reals; import java.rmi.RemoteException; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.openide.util.Exceptions; import visad.CommonUnit; import visad.Real; import visad.RealTuple; import visad.VisADException; /** * The BasicTerrain is a concrete implementation of the Terrain interface. * * @author Bruce Schubert <bruce@emxsys.com> */ @XmlRootElement(name = "terrain") @XmlType(propOrder = {"aspect", "slope", "elevation"}) public class BasicTerrain implements Terrain { public static final BasicTerrain INVALID_TERRAIN = new BasicTerrain(); public static final int ASPECT_INDEX = 0; public static final int SLOPE_INDEX = 1; public static final int ELEVATION_INDEX = 2; private Real aspect; private Real slope; private Real elevation; /** * Construct a TerrainTuple object from doubles. * @param aspect [degrees] * @param slope [degrees] * @param elevation [meters] */ public BasicTerrain(double aspect, double slope, double elevation) { this(new Real(ASPECT, aspect), new Real(SLOPE, slope), new Real(ELEVATION, elevation)); } /** * Construct a TerrainTuple object from Reals. Guarrantees that input parameter values are * converted to the member's defined RealTypes. * @param aspect must be compatible with GisType.ASPECT * @param slope must be compatible with GisType.SLOPE * @param elevation must be compatible with GisType.ELEVATION */ public BasicTerrain(Real aspect, Real slope, Real elevation) { this.aspect = Reals.convertTo(ASPECT, aspect); this.slope = Reals.convertTo(SLOPE, slope); this.elevation = Reals.convertTo(ELEVATION, elevation); } /** * Construct a TerrainTuple object from a RealTuple (as returned from a FlatField). * @param tuple [aspect,slope,elevation] * @throws visad.VisADException * @throws java.rmi.RemoteException */ public BasicTerrain(RealTuple tuple) throws VisADException, RemoteException { if (tuple.getType() != TERRAIN) { throw new IllegalArgumentException("TerrainTuple constructor cannot accept " + tuple.getType() + " types."); } this.aspect = (Real) tuple.getComponent(ASPECT_INDEX); this.slope = (Real) tuple.getComponent(SLOPE_INDEX); this.elevation = (Real) tuple.getComponent(ELEVATION_INDEX); } /** * Construct a TerrainTuple object with "missing" values. Used for "Invalid" objects. */ public BasicTerrain() { this.aspect = new Real(ASPECT); this.slope = new Real(SLOPE); this.elevation = new Real(ELEVATION); } /** * * @return A TERRAIN RealTuple. */ public RealTuple getTuple() { try { return new RealTuple(TERRAIN, new Real[]{aspect, slope, elevation}, null); } catch (VisADException | RemoteException ex) { Exceptions.printStackTrace(ex); return new RealTuple(TERRAIN); } } /** * Aspect is direction that non-flat terrain faces. It is the down-slope direction relative to * true north. * @return [degrees] */ @XmlElement @XmlJavaTypeAdapter(RealXmlAdapter.class) @Override public Real getAspect() { return this.aspect; } public void setAspect(Real aspect) { this.aspect = aspect; } /** * Slope is the steepness of the terrain. Zero slope is horizontal, 90 degrees is vertical. * @return [degrees] */ @XmlElement @XmlJavaTypeAdapter(RealXmlAdapter.class) @Override public Real getSlope() { return this.slope; } public void setSlope(Real slope) { this.slope = slope; } /** * Elevation is the height of the terrain. * @return [meters] */ @XmlElement @XmlJavaTypeAdapter(RealXmlAdapter.class) @Override public Real getElevation() { return this.elevation; } public void setElevation(Real elevation) { this.elevation = elevation; } /** * Is missing any data elements? * @return is missing */ public boolean isMissing() { return aspect.isMissing() || slope.isMissing() || elevation.isMissing(); } /** * Indicates if this Tuple is identical to an object. * @param obj The object. * @return true if and only if the object is a Tuple and both Tuple-s have identical component * sequences. */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof BasicTerrain)) { return false; } BasicTerrain that = (BasicTerrain) obj; return this.aspect.equals(that.aspect) && this.slope.equals(that.slope) && this.elevation.equals(that.elevation); } /** * @return The hash code of this object. */ @Override public int hashCode() { return aspect.hashCode() | slope.hashCode() & elevation.hashCode(); } /** * Aspect, slope, terrain values in a string. * @return string of me */ @Override public String toString() { return getAspect().toValueString() + ", " + getSlope().toValueString() + ", " + getElevation().toValueString(); } @Override public double getAspectDegrees() { return aspect.getValue(); } @Override public CardinalPoint8 getAspectCardinalPoint8() { return CardinalPoint8.fromDegrees(getAspectDegrees()); } @Override public double getSlopeDegrees() { return slope.getValue(); } @Override public double getSlopePercent() { long slopePct = 0; if (getSlopeDegrees() < 90) { try { slopePct = Math.round(Math.tan(slope.getValue(CommonUnit.radian)) * 100); } catch (VisADException ex) { Exceptions.printStackTrace(ex); } } return slopePct; } @Override public double getElevationMeters() { return elevation.getValue(); } @Override public double getElevationFeet() { try { return elevation.getValue(GeneralUnit.foot); } catch (VisADException ex) { Exceptions.printStackTrace(ex); return Double.NaN; } } }
32.746212
121
0.634239
e3ba8a6ac5e3f3bc6528713a01bbdb8ba6142445
1,149
/** * */ package GUI.GridControl; import java.util.Map; import Cell.Simulation; import GUI.ConfigurationException; import Main.XMLReader; /** * * @author Sally Al * */ public class SpecificIntialStates extends GridInitialization { @Override public Simulation[][] createSimulationArray(XMLReader xmlReader) { int rows = xmlReader.getMyRows(); int columns = xmlReader.getMyColumns(); String simulationName = xmlReader.getMySimulation(); String[][] arrayFromXml = new String[rows][columns]; arrayFromXml = xmlReader.getMyInitialConfiguration(); Simulation[][] cellArray = new Simulation[rows][columns]; for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { PossibleSpecificStates possibleStates = new PossibleSpecificStates(); Map<String, Simulation> map = possibleStates.createGOlStates(); Simulation simulation = map.get(simulationName); simulation.setMyLocation(new int[] { i, j }); try { simulation.setMyState(arrayFromXml[i][j]); } catch (ConfigurationException e) { e.printStackTrace(); } cellArray[i][j] = simulation; } } return cellArray; } }
22.529412
73
0.694517
2f38000660795b88dde16214a552ac486facb237
5,212
/** * Copyright 2012 Kamran Zafar * * 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.kamranzafar.jtar; import java.io.FilterInputStream; import java.io.IOException; import java.io.InputStream; /** * @author Kamran Zafar * */ public class TarInputStream extends FilterInputStream { private static final int SKIP_BUFFER_SIZE = 2048; private TarEntry currentEntry; private long currentFileSize; private long bytesRead; private boolean defaultSkip = false; public TarInputStream(InputStream in) { super(in); currentFileSize = 0; bytesRead = 0; } @Override public boolean markSupported() { return false; } /** * Not supported * */ @Override public synchronized void mark(int readlimit) { } /** * Not supported * */ @Override public synchronized void reset() throws IOException { throw new IOException("mark/reset not supported"); } /** * Read a byte * * @see java.io.FilterInputStream#read() */ @Override public int read() throws IOException { byte[] buf = new byte[1]; int res = this.read(buf, 0, 1); if (res != -1) { return 0xFF & buf[0]; } return res; } /** * Checks if the bytes being read exceed the entry size and adjusts the byte * array length. Updates the byte counters * * * @see java.io.FilterInputStream#read(byte[], int, int) */ @Override public int read(byte[] b, int off, int len) throws IOException { if (currentEntry != null) { if (currentFileSize == currentEntry.getSize()) { return -1; } else if ((currentEntry.getSize() - currentFileSize) < len) { len = (int) (currentEntry.getSize() - currentFileSize); } } int br = super.read(b, off, len); if (br != -1) { if (currentEntry != null) { currentFileSize += br; } bytesRead += br; } return br; } /** * Returns the next entry in the tar file * * @return TarEntry * @throws IOException */ public TarEntry getNextEntry() throws IOException { closeCurrentEntry(); byte[] header = new byte[TarConstants.HEADER_BLOCK]; byte[] theader = new byte[TarConstants.HEADER_BLOCK]; int tr = 0; // Read full header while (tr < TarConstants.HEADER_BLOCK) { int res = read(theader, 0, TarConstants.HEADER_BLOCK - tr); if (res < 0) { break; } System.arraycopy(theader, 0, header, tr, res); tr += res; } // Check if record is null boolean eof = true; for (byte b : header) { if (b != 0) { eof = false; break; } } if (!eof) { currentEntry = new TarEntry(header); } return currentEntry; } /** * Closes the current tar entry * * @throws IOException */ protected void closeCurrentEntry() throws IOException { if (currentEntry != null) { if (currentEntry.getSize() > currentFileSize) { // Not fully read, skip rest of the bytes long bs = 0; while (bs < currentEntry.getSize() - currentFileSize) { long res = skip(currentEntry.getSize() - currentFileSize - bs); if (res == 0 && currentEntry.getSize() - currentFileSize > 0) { // I suspect file corruption throw new IOException("Possible tar file corruption"); } bs += res; } } currentEntry = null; currentFileSize = 0L; skipPad(); } } /** * Skips the pad at the end of each tar entry file content * * @throws IOException */ protected void skipPad() throws IOException { if (bytesRead > 0) { int extra = (int) (bytesRead % TarConstants.DATA_BLOCK); if (extra > 0) { long bs = 0; while (bs < TarConstants.DATA_BLOCK - extra) { long res = skip(TarConstants.DATA_BLOCK - extra - bs); bs += res; } } } } /** * Skips 'n' bytes on the InputStream<br> * Overrides default implementation of skip * */ @Override public long skip(long n) throws IOException { if (defaultSkip) { // use skip method of parent stream // may not work if skip not implemented by parent long bs = super.skip(n); bytesRead += bs; return bs; } if (n <= 0) { return 0; } long left = n; byte[] sBuff = new byte[SKIP_BUFFER_SIZE]; while (left > 0) { int res = read(sBuff, 0, (int) (left < SKIP_BUFFER_SIZE ? left : SKIP_BUFFER_SIZE)); if (res < 0) { break; } left -= res; } return n - left; } public boolean isDefaultSkip() { return defaultSkip; } public void setDefaultSkip(boolean defaultSkip) { this.defaultSkip = defaultSkip; } }
21.53719
88
0.611857
35ff6ad0b14f08fe6436b562deab89c0579bf611
71,309
package us.ihmc.euclid.referenceFrame.interfaces; import us.ihmc.euclid.geometry.interfaces.BoundingBox3DReadOnly; import us.ihmc.euclid.geometry.interfaces.Line3DReadOnly; import us.ihmc.euclid.geometry.interfaces.LineSegment3DReadOnly; import us.ihmc.euclid.referenceFrame.exceptions.ReferenceFrameMismatchException; import us.ihmc.euclid.tuple3D.interfaces.Point3DBasics; import us.ihmc.euclid.tuple3D.interfaces.Point3DReadOnly; import us.ihmc.euclid.tuple3D.interfaces.Vector3DReadOnly; /** * Read-only interface for a 3D axis-aligned bounding box expressed in a given reference frame. */ public interface FrameBoundingBox3DReadOnly extends BoundingBox3DReadOnly, ReferenceFrameHolder { /** {@inheritDoc} */ @Override FramePoint3DReadOnly getMinPoint(); /** {@inheritDoc} */ @Override FramePoint3DReadOnly getMaxPoint(); /** * Calculates the coordinate of the center of this bounding box and stores it in the given * {@code centerToPack}. * * @param centerToPack point 3D in which the center of this bounding box is stored. Modified. * @throws RuntimeException if this bounding box is improper according to * {@link #checkBounds()}. * @throws ReferenceFrameMismatchException if the argument is not expressed in the same reference * frame as {@code this}. */ default void getCenterPoint(FixedFramePoint3DBasics centerToPack) { checkReferenceFrameMatch(centerToPack); BoundingBox3DReadOnly.super.getCenterPoint(centerToPack); } /** * Calculates the coordinate of the center of this bounding box and stores it in the given * {@code centerToPack}. * * @param centerToPack point 3D in which the center of this bounding box is stored. Modified. * @throws RuntimeException if this bounding box is improper according to {@link #checkBounds()}. */ default void getCenterPoint(FramePoint3DBasics centerToPack) { centerToPack.setReferenceFrame(getReferenceFrame()); BoundingBox3DReadOnly.super.getCenterPoint(centerToPack); } /** * Performs a linear interpolation between this bounding box minimum and maximum coordinates using * independent parameters {@code xParameter}, {@code yParameter}, and {@code zParameter} for the * x-axis, y-axis, and z-axis respectively. The result is stored in {@code pointToPack}. * <p> * <ul> * <li>{@code (xParameter == 0)} results in: {@code (pointToPack.getX() == this.getMinX())}. * <li>{@code (xParameter == 1)} results in: {@code (pointToPack.getX() == this.getMaxX())}. * <li>{@code (yParameter == 0)} results in: {@code (pointToPack.getY() == this.getMinY())}. * <li>{@code (yParameter == 1)} results in: {@code (pointToPack.getY() == this.getMaxY())}. * <li>{@code (zParameter == 0)} results in: {@code (pointToPack.getZ() == this.getMinZ())}. * <li>{@code (zParameter == 1)} results in: {@code (pointToPack.getZ() == this.getMaxZ())}. * </ul> * </p> * * @param xParameter the parameter to use for the interpolation along the x-axis. * @param yParameter the parameter to use for the interpolation along the y-axis. * @param zParameter the parameter to use for the interpolation along the z-axis. * @param pointToPack the point 3D in which the result is stored. Modified. * @throws RuntimeException if this bounding box is improper according to * {@link #checkBounds()}. * @throws ReferenceFrameMismatchException if the argument is not expressed in the same reference * frame as {@code this}. */ default void getPointGivenParameters(double xParameter, double yParameter, double zParameter, FixedFramePoint3DBasics pointToPack) { checkReferenceFrameMatch(pointToPack); BoundingBox3DReadOnly.super.getPointGivenParameters(xParameter, yParameter, zParameter, pointToPack); } /** * Performs a linear interpolation between this bounding box minimum and maximum coordinates using * independent parameters {@code xParameter}, {@code yParameter}, and {@code zParameter} for the * x-axis, y-axis, and z-axis respectively. The result is stored in {@code pointToPack}. * <p> * <ul> * <li>{@code (xParameter == 0)} results in: {@code (pointToPack.getX() == this.getMinX())}. * <li>{@code (xParameter == 1)} results in: {@code (pointToPack.getX() == this.getMaxX())}. * <li>{@code (yParameter == 0)} results in: {@code (pointToPack.getY() == this.getMinY())}. * <li>{@code (yParameter == 1)} results in: {@code (pointToPack.getY() == this.getMaxY())}. * <li>{@code (zParameter == 0)} results in: {@code (pointToPack.getZ() == this.getMinZ())}. * <li>{@code (zParameter == 1)} results in: {@code (pointToPack.getZ() == this.getMaxZ())}. * </ul> * </p> * * @param xParameter the parameter to use for the interpolation along the x-axis. * @param yParameter the parameter to use for the interpolation along the y-axis. * @param zParameter the parameter to use for the interpolation along the z-axis. * @param pointToPack the point 3D in which the result is stored. Modified. * @throws RuntimeException if this bounding box is improper according to {@link #checkBounds()}. */ default void getPointGivenParameters(double xParameter, double yParameter, double zParameter, FramePoint3DBasics pointToPack) { pointToPack.setReferenceFrame(getReferenceFrame()); BoundingBox3DReadOnly.super.getPointGivenParameters(xParameter, yParameter, zParameter, pointToPack); } /** * Tests if the {@code query} is located inside this bounding box. * <p> * The query is considered to be outside if located exactly on an edge of this bounding box. * </p> * * @param query the query to test if it is located inside this bounding box. Not modified. * @return {@code true} if the query is inside, {@code false} if outside or located on an edge of * this bounding box. * @throws ReferenceFrameMismatchException if the argument is not expressed in the same reference * frame as {@code this}. */ default boolean isInsideExclusive(FramePoint3DReadOnly query) { checkReferenceFrameMatch(query); return BoundingBox3DReadOnly.super.isInsideExclusive(query); } /** * Tests if the {@code query} is located inside this bounding box. * <p> * The query is considered to be inside if located exactly on an edge of this bounding box. * </p> * * @param query the query to test if it is located inside this bounding box. Not modified. * @return {@code true} if the query is inside or located on an edge of this bounding box, * {@code false} if outside. * @throws ReferenceFrameMismatchException if the argument is not expressed in the same reference * frame as {@code this}. */ default boolean isInsideInclusive(FramePoint3DReadOnly query) { checkReferenceFrameMatch(query); return BoundingBox3DReadOnly.super.isInsideInclusive(query); } /** * Tests if the {@code query} is located inside this bounding box given the tolerance * {@code epsilon}. * <p> * <ul> * <li>if {@code epsilon == 0}, this method is equivalent to * {@link #isInsideExclusive(FramePoint3DReadOnly)}. * <li>if {@code epsilon > 0}, the size of this bounding box is scaled up by shifting the edges of * {@code epsilon} toward the outside. * <li>if {@code epsilon > 0}, the size of this bounding box is scaled down by shifting the edges of * {@code epsilon} toward the inside. * </ul> * </p> * * @param query the query to test if it is located inside this bounding box. Not modified. * @param epsilon the tolerance to use for this test. * @return {@code true} if the query is considered to be inside the bounding box, {@code false} * otherwise. * @throws ReferenceFrameMismatchException if the argument is not expressed in the same reference * frame as {@code this}. */ default boolean isInsideEpsilon(FramePoint3DReadOnly query, double epsilon) { checkReferenceFrameMatch(query); return BoundingBox3DReadOnly.super.isInsideEpsilon(query, epsilon); } /** * Tests if the {@code query} is located inside the projection onto the XY-plane of this bounding * box. * <p> * The query is considered to be outside if located exactly on an edge of this bounding box. * </p> * * @param query the query to test if it is located inside this bounding box. Not modified. * @return {@code true} if the query is inside, {@code false} if outside or located on an edge of * this bounding box. * @throws ReferenceFrameMismatchException if the argument is not expressed in the same reference * frame as {@code this}. */ default boolean isXYInsideExclusive(FramePoint2DReadOnly query) { checkReferenceFrameMatch(query); return BoundingBox3DReadOnly.super.isXYInsideExclusive(query); } /** * Tests if the {@code query} is located inside the projection onto the XY-plane of this bounding * box. * <p> * The query is considered to be inside if located exactly on an edge of this bounding box. * </p> * * @param query the query to test if it is located inside this bounding box. Not modified. * @return {@code true} if the query is inside or located on an edge of this bounding box, * {@code false} if outside. * @throws ReferenceFrameMismatchException if the argument is not expressed in the same reference * frame as {@code this}. */ default boolean isXYInsideInclusive(FramePoint2DReadOnly query) { checkReferenceFrameMatch(query); return BoundingBox3DReadOnly.super.isXYInsideInclusive(query); } /** * * Tests if the {@code query} is located inside the projection onto the XY-plane of this bounding * box given the tolerance {@code epsilon}. * <p> * <ul> * <li>if {@code epsilon == 0}, this method is equivalent to * {@link #isXYInsideInclusive(FramePoint2DReadOnly)}. * <li>if {@code epsilon > 0}, the size of this bounding box is scaled up by shifting the edges of * {@code epsilon} toward the outside. * <li>if {@code epsilon > 0}, the size of this bounding box is scaled down by shifting the edges of * {@code epsilon} toward the inside. * </ul> * </p> * * @param query the query to test if it is located inside this bounding box. Not modified. * @param epsilon the tolerance to use for this test. * @return {@code true} if the query is considered to be inside the bounding box, {@code false} * otherwise. * @throws ReferenceFrameMismatchException if the argument is not expressed in the same reference * frame as {@code this}. */ default boolean isXYInsideEpsilon(FramePoint2DReadOnly query, double epsilon) { checkReferenceFrameMatch(query); return BoundingBox3DReadOnly.super.isXYInsideEpsilon(query, epsilon); } /** * Tests if this bounding box and {@code other} intersects. * <p> * The two bounding boxes are considered to not be intersecting if they share a corner, an edge, or * a face. * </p> * * @param other the other bounding box to test if it is intersecting with this bounding box. Not * Modified. * @return {@code true} if the two bounding boxes intersect, {@code false} otherwise. * @throws ReferenceFrameMismatchException if the argument is not expressed in the same reference * frame as {@code this}. */ default boolean intersectsExclusive(FrameBoundingBox3DReadOnly other) { checkReferenceFrameMatch(other); return BoundingBox3DReadOnly.super.intersectsExclusive(other); } /** * Tests if this bounding box and {@code other} intersects. * <p> * The two bounding boxes are considered to be intersecting if they share a corner, an edge, or a * face. * </p> * * @param other the other bounding box to test if it is intersecting with this bounding box. Not * Modified. * @return {@code true} if the two bounding boxes intersect, {@code false} otherwise. * @throws ReferenceFrameMismatchException if the argument is not expressed in the same reference * frame as {@code this}. */ default boolean intersectsInclusive(FrameBoundingBox3DReadOnly other) { checkReferenceFrameMatch(other); return BoundingBox3DReadOnly.super.intersectsInclusive(other); } /** * Tests if this bounding box and {@code other} intersects. * <p> * <ul> * <li>if {@code epsilon == 0}, this method is equivalent to * {@link #intersectsExclusive(FrameBoundingBox3DReadOnly)}. * <li>if {@code epsilon > 0}, the size of this bounding box is scaled up by shifting the faces of * {@code epsilon} toward the outside. * <li>if {@code epsilon < 0}, the size of this bounding box is scaled down by shifting the faces of * {@code epsilon} toward the inside. * </ul> * </p> * * @param other the other bounding box to test if it is intersecting with this bounding box. Not * Modified. * @param epsilon the tolerance to use in this test. * @return {@code true} if the two bounding boxes intersect, {@code false} otherwise. * @throws ReferenceFrameMismatchException if the argument is not expressed in the same reference * frame as {@code this}. */ default boolean intersectsEpsilon(FrameBoundingBox3DReadOnly other, double epsilon) { checkReferenceFrameMatch(other); return BoundingBox3DReadOnly.super.intersectsEpsilon(other, epsilon); } /** * Tests if this bounding box and {@code other} intersects. * <p> * The two bounding boxes are considered to not be intersecting if they share a corner or an edge. * </p> * <p> * This method is equivalent to projecting this bounding box onto the XY-plane before performing the * test. * </p> * * @param other the other bounding box to test if it is intersecting with this bounding box. Not * Modified. * @return {@code true} if the two bounding boxes intersect, {@code false} otherwise. * @throws ReferenceFrameMismatchException if the argument is not expressed in the same reference * frame as {@code this}. */ default boolean intersectsExclusiveInXYPlane(FrameBoundingBox2DReadOnly other) { checkReferenceFrameMatch(other); return BoundingBox3DReadOnly.super.intersectsExclusiveInXYPlane(other); } /** * Tests if this bounding box and {@code other} intersects. * <p> * The two bounding boxes are considered to be intersecting if they share a corner or an edge. * </p> * <p> * This method is equivalent to projecting this bounding box onto the XY-plane before performing the * test. * </p> * * @param other the other bounding box to test if it is intersecting with this bounding box. Not * Modified. * @return {@code true} if the two bounding boxes intersect, {@code false} otherwise. * @throws ReferenceFrameMismatchException if the argument is not expressed in the same reference * frame as {@code this}. */ default boolean intersectsInclusiveInXYPlane(FrameBoundingBox2DReadOnly other) { checkReferenceFrameMatch(other); return BoundingBox3DReadOnly.super.intersectsInclusiveInXYPlane(other); } /** * Tests if this bounding box and {@code other} intersects. * <p> * <ul> * <li>if {@code epsilon == 0}, this method is equivalent to * {@link #intersectsExclusiveInXYPlane(FrameBoundingBox2DReadOnly)}. * <li>if {@code epsilon > 0}, the size of this bounding box is scaled up by shifting the edges of * {@code epsilon} toward the outside. * <li>if {@code epsilon > 0}, the size of this bounding box is scaled down by shifting the edges of * {@code epsilon} toward the inside. * </ul> * </p> * <p> * This method is equivalent to projecting this bounding box onto the XY-plane before performing the * test. * </p> * * @param other the other bounding box to test if it is intersecting with this bounding box. Not * Modified. * @param epsilon the tolerance to use in this test. * @return {@code true} if the two bounding boxes intersect, {@code false} otherwise. * @throws ReferenceFrameMismatchException if the argument is not expressed in the same reference * frame as {@code this}. */ default boolean intersectsEpsilonInXYPlane(FrameBoundingBox2DReadOnly other, double epsilon) { checkReferenceFrameMatch(other); return BoundingBox3DReadOnly.super.intersectsEpsilonInXYPlane(other, epsilon); } /** * Tests if this the given line 3D intersects this bounding box. * * @param line3D the query. Not modified. * @return {@code true} if the line and this bounding box intersect, {@code false} otherwise. * @throws ReferenceFrameMismatchException if the argument is not expressed in the same reference * frame as {@code this}. */ default boolean doesIntersectWithLine3D(FrameLine3DReadOnly line3D) { checkReferenceFrameMatch(line3D); return BoundingBox3DReadOnly.super.doesIntersectWithLine3D(line3D); } /** * Tests if this the given line 3D intersects this bounding box. * * @param pointOnLine a point located on the infinitely long line. Not modified. * @param lineDirection the line direction. Not modified. * @return {@code true} if the line and this bounding box intersect, {@code false} otherwise. * @throws ReferenceFrameMismatchException if any of the arguments is not expressed in the same * reference frame as {@code this}. */ default boolean doesIntersectWithLine3D(FramePoint3DReadOnly pointOnLine, FrameVector3DReadOnly lineDirection) { checkReferenceFrameMatch(pointOnLine, lineDirection); return BoundingBox3DReadOnly.super.doesIntersectWithLine3D(pointOnLine, lineDirection); } /** * Tests if this the given line segment 3D intersects this bounding box. * * @param lineSegment3D the query. Not modified. * @return {@code true} if the line segment and this bounding box intersect, {@code false} * @throws ReferenceFrameMismatchException if the argument is not expressed in the same reference * frame as {@code this}. otherwise. */ default boolean doesIntersectWithLineSegment3D(FrameLineSegment3DReadOnly lineSegment3D) { checkReferenceFrameMatch(lineSegment3D); return BoundingBox3DReadOnly.super.doesIntersectWithLineSegment3D(lineSegment3D); } /** * Tests if this the given line segment 3D intersects this bounding box. * * @param lineSegmentStart first endpoint of the line segment. Not modified. * @param lineSegmentEnd second endpoint of the line segment. Not modified. * @return {@code true} if the line segment and this bounding box intersect, {@code false} * otherwise. * @throws ReferenceFrameMismatchException if any of the arguments is not expressed in the same * reference frame as {@code this}. */ default boolean doesIntersectWithLineSegment3D(FramePoint3DReadOnly lineSegmentStart, FramePoint3DReadOnly lineSegmentEnd) { checkReferenceFrameMatch(lineSegmentStart, lineSegmentEnd); return BoundingBox3DReadOnly.super.doesIntersectWithLineSegment3D(lineSegmentStart, lineSegmentEnd); } /** * Tests if this the given ray 3D intersects this bounding box. * * @param rayOrigin the origin of the ray. Not modified. * @param rayDirection the ray direction. Not modified. * @return {@code true} if the ray and this bounding box intersect, {@code false} otherwise. * @throws ReferenceFrameMismatchException if any of the arguments is not expressed in the same * reference frame as {@code this}. */ default boolean doesIntersectWithRay3D(FramePoint3DReadOnly rayOrigin, FrameVector3DReadOnly rayDirection) { checkReferenceFrameMatch(rayOrigin, rayDirection); return BoundingBox3DReadOnly.super.doesIntersectWithRay3D(rayOrigin, rayDirection); } /** * Computes the coordinates of the two intersections between a line and this bounding box. * <p> * In the case the line and the bounding box do not intersect, this method returns {@code 0} and * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} remains unmodified. * </p> * * @param line3D the query. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the line and this bounding box. It is either equal to * 0 or 2. * @throws ReferenceFrameMismatchException if the frame argument is not expressed in the same * reference frame as {@code this}. */ default int intersectionWithLine3D(FrameLine3DReadOnly line3D, Point3DBasics firstIntersectionToPack, Point3DBasics secondIntersectionToPack) { checkReferenceFrameMatch(line3D); return BoundingBox3DReadOnly.super.intersectionWithLine3D(line3D, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a line and this bounding box. * <p> * In the case the line and the bounding box do not intersect, this method returns {@code 0} and * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} remains unmodified. * </p> * * @param line3D the query. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the line and this bounding box. It is either equal to * 0 or 2. * @throws ReferenceFrameMismatchException if any of the frame arguments is not expressed in the * same reference frame as {@code this}. */ default int intersectionWithLine3D(Line3DReadOnly line3D, FixedFramePoint3DBasics firstIntersectionToPack, FixedFramePoint3DBasics secondIntersectionToPack) { if (firstIntersectionToPack != null) checkReferenceFrameMatch(firstIntersectionToPack); if (secondIntersectionToPack != null) checkReferenceFrameMatch(secondIntersectionToPack); return BoundingBox3DReadOnly.super.intersectionWithLine3D(line3D, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a line and this bounding box. * <p> * In the case the line and the bounding box do not intersect, this method returns {@code 0} and * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} remains unmodified. * </p> * * @param line3D the query. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the line and this bounding box. It is either equal to * 0 or 2. */ default int intersectionWithLine3D(Line3DReadOnly line3D, FramePoint3DBasics firstIntersectionToPack, FramePoint3DBasics secondIntersectionToPack) { if (firstIntersectionToPack != null) firstIntersectionToPack.setReferenceFrame(getReferenceFrame()); if (secondIntersectionToPack != null) secondIntersectionToPack.setReferenceFrame(getReferenceFrame()); return BoundingBox3DReadOnly.super.intersectionWithLine3D(line3D, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a line and this bounding box. * <p> * In the case the line and the bounding box do not intersect, this method returns {@code 0} and * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} remains unmodified. * </p> * * @param line3D the query. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the line and this bounding box. It is either equal to * 0 or 2. * @throws ReferenceFrameMismatchException if any of the arguments is not expressed in the same * reference frame as {@code this}. */ default int intersectionWithLine3D(FrameLine3DReadOnly line3D, FixedFramePoint3DBasics firstIntersectionToPack, FixedFramePoint3DBasics secondIntersectionToPack) { checkReferenceFrameMatch(line3D); if (firstIntersectionToPack != null) checkReferenceFrameMatch(firstIntersectionToPack); if (secondIntersectionToPack != null) checkReferenceFrameMatch(secondIntersectionToPack); return BoundingBox3DReadOnly.super.intersectionWithLine3D(line3D, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a line and this bounding box. * <p> * In the case the line and the bounding box do not intersect, this method returns {@code 0} and * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} remains unmodified. * </p> * * @param line3D the query. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the line and this bounding box. It is either equal to * 0 or 2. * @throws ReferenceFrameMismatchException if {@code line3D} is not expressed in the same reference * frame as {@code this}. */ default int intersectionWithLine3D(FrameLine3DReadOnly line3D, FramePoint3DBasics firstIntersectionToPack, FramePoint3DBasics secondIntersectionToPack) { checkReferenceFrameMatch(line3D); if (firstIntersectionToPack != null) firstIntersectionToPack.setReferenceFrame(getReferenceFrame()); if (secondIntersectionToPack != null) secondIntersectionToPack.setReferenceFrame(getReferenceFrame()); return BoundingBox3DReadOnly.super.intersectionWithLine3D(line3D, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a line and this bounding box. * <p> * In the case the line and the bounding box do not intersect, this method returns {@code 0} and * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} remains unmodified. * </p> * * @param pointOnLine a point located on the infinitely long line. Not modified. * @param lineDirection the line direction. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the line and this bounding box. It is either equal to * 0 or 2. * @throws ReferenceFrameMismatchException if any of the frame arguments is not expressed in the * same reference frame as {@code this}. */ default int intersectionWithLine3D(FramePoint3DReadOnly pointOnLine, FrameVector3DReadOnly lineDirection, Point3DBasics firstIntersectionToPack, Point3DBasics secondIntersectionToPack) { checkReferenceFrameMatch(pointOnLine, lineDirection); return BoundingBox3DReadOnly.super.intersectionWithLine3D(pointOnLine, lineDirection, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a line and this bounding box. * <p> * In the case the line and the bounding box do not intersect, this method returns {@code 0} and * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} remains unmodified. * </p> * * @param pointOnLine a point located on the infinitely long line. Not modified. * @param lineDirection the line direction. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the line and this bounding box. It is either equal to * 0 or 2. * @throws ReferenceFrameMismatchException if any of the frame arguments is not expressed in the * same reference frame as {@code this}. */ default int intersectionWithLine3D(Point3DReadOnly pointOnLine, Vector3DReadOnly lineDirection, FixedFramePoint3DBasics firstIntersectionToPack, FixedFramePoint3DBasics secondIntersectionToPack) { if (firstIntersectionToPack != null) checkReferenceFrameMatch(firstIntersectionToPack); if (secondIntersectionToPack != null) checkReferenceFrameMatch(secondIntersectionToPack); return BoundingBox3DReadOnly.super.intersectionWithLine3D(pointOnLine, lineDirection, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a line and this bounding box. * <p> * In the case the line and the bounding box do not intersect, this method returns {@code 0} and * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} remains unmodified. * </p> * * @param pointOnLine a point located on the infinitely long line. Not modified. * @param lineDirection the line direction. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the line and this bounding box. It is either equal to * 0 or 2. */ default int intersectionWithLine3D(Point3DReadOnly pointOnLine, Vector3DReadOnly lineDirection, FramePoint3DBasics firstIntersectionToPack, FramePoint3DBasics secondIntersectionToPack) { if (firstIntersectionToPack != null) firstIntersectionToPack.setReferenceFrame(getReferenceFrame()); if (secondIntersectionToPack != null) secondIntersectionToPack.setReferenceFrame(getReferenceFrame()); return BoundingBox3DReadOnly.super.intersectionWithLine3D(pointOnLine, lineDirection, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a line and this bounding box. * <p> * In the case the line and the bounding box do not intersect, this method returns {@code 0} and * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} remains unmodified. * </p> * * @param pointOnLine a point located on the infinitely long line. Not modified. * @param lineDirection the line direction. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the line and this bounding box. It is either equal to * 0 or 2. * @throws ReferenceFrameMismatchException if any of the arguments is not expressed in the same * reference frame as {@code this}. */ default int intersectionWithLine3D(FramePoint3DReadOnly pointOnLine, FrameVector3DReadOnly lineDirection, FixedFramePoint3DBasics firstIntersectionToPack, FixedFramePoint3DBasics secondIntersectionToPack) { checkReferenceFrameMatch(pointOnLine, lineDirection); if (firstIntersectionToPack != null) checkReferenceFrameMatch(firstIntersectionToPack); if (secondIntersectionToPack != null) checkReferenceFrameMatch(secondIntersectionToPack); return BoundingBox3DReadOnly.super.intersectionWithLine3D(pointOnLine, lineDirection, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a line and this bounding box. * <p> * In the case the line and the bounding box do not intersect, this method returns {@code 0} and * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} remains unmodified. * </p> * * @param pointOnLine a point located on the infinitely long line. Not modified. * @param lineDirection the line direction. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the line and this bounding box. It is either equal to * 0 or 2. * @throws ReferenceFrameMismatchException if any of the frame arguments is not expressed in the * same reference frame as {@code this}. * @throws ReferenceFrameMismatchException if either {@code pointOnLine} or {@code lineDirection} is * not expressed in the same reference frame as * {@code this}. */ default int intersectionWithLine3D(FramePoint3DReadOnly pointOnLine, FrameVector3DReadOnly lineDirection, FramePoint3DBasics firstIntersectionToPack, FramePoint3DBasics secondIntersectionToPack) { checkReferenceFrameMatch(pointOnLine, lineDirection); if (firstIntersectionToPack != null) firstIntersectionToPack.setReferenceFrame(getReferenceFrame()); if (secondIntersectionToPack != null) secondIntersectionToPack.setReferenceFrame(getReferenceFrame()); return BoundingBox3DReadOnly.super.intersectionWithLine3D(pointOnLine, lineDirection, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a line segment and this bounding box. * <p> * Intersection(s) between the line segment and this bounding box can only exist between the * endpoints of the line segment. * </p> * <p> * In the case the line segment and this bounding box do not intersect, this method returns * {@code 0} and {@code firstIntersectionToPack} and {@code secondIntersectionToPack} remains * unmodified. * </p> * <p> * In the case only one intersection exists between the line segment and the bounding box, * {@code firstIntersectionToPack} will contain the coordinate of the intersection and * {@code secondIntersectionToPack} will be set to contain only {@link Double#NaN}. * </p> * * @param lineSegment3D the query. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the line segment and this bounding box. It is either * equal to 0, 1, or 2. * @throws ReferenceFrameMismatchException if the frame argument is not expressed in the same * reference frame as {@code this}. */ default int intersectionWithLineSegment3D(FrameLineSegment3DReadOnly lineSegment3D, Point3DBasics firstIntersectionToPack, Point3DBasics secondIntersectionToPack) { checkReferenceFrameMatch(lineSegment3D); return BoundingBox3DReadOnly.super.intersectionWithLineSegment3D(lineSegment3D, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a line segment and this bounding box. * <p> * Intersection(s) between the line segment and this bounding box can only exist between the * endpoints of the line segment. * </p> * <p> * In the case the line segment and this bounding box do not intersect, this method returns * {@code 0} and {@code firstIntersectionToPack} and {@code secondIntersectionToPack} remains * unmodified. * </p> * <p> * In the case only one intersection exists between the line segment and the bounding box, * {@code firstIntersectionToPack} will contain the coordinate of the intersection and * {@code secondIntersectionToPack} will be set to contain only {@link Double#NaN}. * </p> * * @param lineSegment3D the query. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the line segment and this bounding box. It is either * equal to 0, 1, or 2. * @throws ReferenceFrameMismatchException if any of the frame arguments is not expressed in the * same reference frame as {@code this}. */ default int intersectionWithLineSegment3D(LineSegment3DReadOnly lineSegment3D, FixedFramePoint3DBasics firstIntersectionToPack, FixedFramePoint3DBasics secondIntersectionToPack) { if (firstIntersectionToPack != null) checkReferenceFrameMatch(firstIntersectionToPack); if (secondIntersectionToPack != null) checkReferenceFrameMatch(secondIntersectionToPack); return BoundingBox3DReadOnly.super.intersectionWithLineSegment3D(lineSegment3D, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a line segment and this bounding box. * <p> * Intersection(s) between the line segment and this bounding box can only exist between the * endpoints of the line segment. * </p> * <p> * In the case the line segment and this bounding box do not intersect, this method returns * {@code 0} and {@code firstIntersectionToPack} and {@code secondIntersectionToPack} remains * unmodified. * </p> * <p> * In the case only one intersection exists between the line segment and the bounding box, * {@code firstIntersectionToPack} will contain the coordinate of the intersection and * {@code secondIntersectionToPack} will be set to contain only {@link Double#NaN}. * </p> * * @param lineSegment3D the query. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the line segment and this bounding box. It is either * equal to 0, 1, or 2. */ default int intersectionWithLineSegment3D(LineSegment3DReadOnly lineSegment3D, FramePoint3DBasics firstIntersectionToPack, FramePoint3DBasics secondIntersectionToPack) { if (firstIntersectionToPack != null) firstIntersectionToPack.setReferenceFrame(getReferenceFrame()); if (secondIntersectionToPack != null) secondIntersectionToPack.setReferenceFrame(getReferenceFrame()); return BoundingBox3DReadOnly.super.intersectionWithLineSegment3D(lineSegment3D, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a line segment and this bounding box. * <p> * Intersection(s) between the line segment and this bounding box can only exist between the * endpoints of the line segment. * </p> * <p> * In the case the line segment and this bounding box do not intersect, this method returns * {@code 0} and {@code firstIntersectionToPack} and {@code secondIntersectionToPack} remains * unmodified. * </p> * <p> * In the case only one intersection exists between the line segment and the bounding box, * {@code firstIntersectionToPack} will contain the coordinate of the intersection and * {@code secondIntersectionToPack} will be set to contain only {@link Double#NaN}. * </p> * * @param lineSegment3D the query. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the line segment and this bounding box. It is either * equal to 0, 1, or 2. * @throws ReferenceFrameMismatchException if any of the arguments is not expressed in the same * reference frame as {@code this}. */ default int intersectionWithLineSegment3D(FrameLineSegment3DReadOnly lineSegment3D, FixedFramePoint3DBasics firstIntersectionToPack, FixedFramePoint3DBasics secondIntersectionToPack) { checkReferenceFrameMatch(lineSegment3D); if (firstIntersectionToPack != null) checkReferenceFrameMatch(firstIntersectionToPack); if (secondIntersectionToPack != null) checkReferenceFrameMatch(secondIntersectionToPack); return BoundingBox3DReadOnly.super.intersectionWithLineSegment3D(lineSegment3D, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a line segment and this bounding box. * <p> * Intersection(s) between the line segment and this bounding box can only exist between the * endpoints of the line segment. * </p> * <p> * In the case the line segment and this bounding box do not intersect, this method returns * {@code 0} and {@code firstIntersectionToPack} and {@code secondIntersectionToPack} remains * unmodified. * </p> * <p> * In the case only one intersection exists between the line segment and the bounding box, * {@code firstIntersectionToPack} will contain the coordinate of the intersection and * {@code secondIntersectionToPack} will be set to contain only {@link Double#NaN}. * </p> * * @param lineSegment3D the query. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the line segment and this bounding box. It is either * equal to 0, 1, or 2. * @throws ReferenceFrameMismatchException if {@code lineSegment3D} is not expressed in the same * reference frame as {@code this}. */ default int intersectionWithLineSegment3D(FrameLineSegment3DReadOnly lineSegment3D, FramePoint3DBasics firstIntersectionToPack, FramePoint3DBasics secondIntersectionToPack) { checkReferenceFrameMatch(lineSegment3D); if (firstIntersectionToPack != null) firstIntersectionToPack.setReferenceFrame(getReferenceFrame()); if (secondIntersectionToPack != null) secondIntersectionToPack.setReferenceFrame(getReferenceFrame()); return BoundingBox3DReadOnly.super.intersectionWithLineSegment3D(lineSegment3D, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a line segment and this bounding box. * <p> * Intersection(s) between the line segment and this bounding box can only exist between the * endpoints of the line segment. * </p> * <p> * In the case the line segment and this bounding box do not intersect, this method returns * {@code 0} and {@code firstIntersectionToPack} and {@code secondIntersectionToPack} are set to * {@link Double#NaN}. * </p> * <p> * In the case only one intersection exists between the line segment and the bounding box, * {@code firstIntersectionToPack} will contain the coordinate of the intersection and * {@code secondIntersectionToPack} will be set to contain only {@link Double#NaN}. * </p> * * @param lineSegmentStart the first endpoint of the line segment. Not modified. * @param lineSegmentEnd the second endpoint of the line segment. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the line segment and this bounding box. It is either * equal to 0, 1, or 2. * @throws ReferenceFrameMismatchException if any of the frame arguments is not expressed in the * same reference frame as {@code this}. */ default int intersectionWithLineSegment3D(FramePoint3DReadOnly lineSegmentStart, FramePoint3DReadOnly lineSegmentEnd, Point3DBasics firstIntersectionToPack, Point3DBasics secondIntersectionToPack) { checkReferenceFrameMatch(lineSegmentStart, lineSegmentEnd); return BoundingBox3DReadOnly.super.intersectionWithLineSegment3D(lineSegmentStart, lineSegmentEnd, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a line segment and this bounding box. * <p> * Intersection(s) between the line segment and this bounding box can only exist between the * endpoints of the line segment. * </p> * <p> * In the case the line segment and this bounding box do not intersect, this method returns * {@code 0} and {@code firstIntersectionToPack} and {@code secondIntersectionToPack} are set to * {@link Double#NaN}. * </p> * <p> * In the case only one intersection exists between the line segment and the bounding box, * {@code firstIntersectionToPack} will contain the coordinate of the intersection and * {@code secondIntersectionToPack} will be set to contain only {@link Double#NaN}. * </p> * * @param lineSegmentStart the first endpoint of the line segment. Not modified. * @param lineSegmentEnd the second endpoint of the line segment. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the line segment and this bounding box. It is either * equal to 0, 1, or 2. * @throws ReferenceFrameMismatchException if any of the frame arguments is not expressed in the * same reference frame as {@code this}. */ default int intersectionWithLineSegment3D(Point3DReadOnly lineSegmentStart, Point3DReadOnly lineSegmentEnd, FixedFramePoint3DBasics firstIntersectionToPack, FixedFramePoint3DBasics secondIntersectionToPack) { if (firstIntersectionToPack != null) checkReferenceFrameMatch(firstIntersectionToPack); if (secondIntersectionToPack != null) checkReferenceFrameMatch(secondIntersectionToPack); return BoundingBox3DReadOnly.super.intersectionWithLineSegment3D(lineSegmentStart, lineSegmentEnd, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a line segment and this bounding box. * <p> * Intersection(s) between the line segment and this bounding box can only exist between the * endpoints of the line segment. * </p> * <p> * In the case the line segment and this bounding box do not intersect, this method returns * {@code 0} and {@code firstIntersectionToPack} and {@code secondIntersectionToPack} are set to * {@link Double#NaN}. * </p> * <p> * In the case only one intersection exists between the line segment and the bounding box, * {@code firstIntersectionToPack} will contain the coordinate of the intersection and * {@code secondIntersectionToPack} will be set to contain only {@link Double#NaN}. * </p> * * @param lineSegmentStart the first endpoint of the line segment. Not modified. * @param lineSegmentEnd the second endpoint of the line segment. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the line segment and this bounding box. It is either * equal to 0, 1, or 2. */ default int intersectionWithLineSegment3D(Point3DReadOnly lineSegmentStart, Point3DReadOnly lineSegmentEnd, FramePoint3DBasics firstIntersectionToPack, FramePoint3DBasics secondIntersectionToPack) { if (firstIntersectionToPack != null) firstIntersectionToPack.setReferenceFrame(getReferenceFrame()); if (secondIntersectionToPack != null) secondIntersectionToPack.setReferenceFrame(getReferenceFrame()); return BoundingBox3DReadOnly.super.intersectionWithLineSegment3D(lineSegmentStart, lineSegmentEnd, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a line segment and this bounding box. * <p> * Intersection(s) between the line segment and this bounding box can only exist between the * endpoints of the line segment. * </p> * <p> * In the case the line segment and this bounding box do not intersect, this method returns * {@code 0} and {@code firstIntersectionToPack} and {@code secondIntersectionToPack} are set to * {@link Double#NaN}. * </p> * <p> * In the case only one intersection exists between the line segment and the bounding box, * {@code firstIntersectionToPack} will contain the coordinate of the intersection and * {@code secondIntersectionToPack} will be set to contain only {@link Double#NaN}. * </p> * * @param lineSegmentStart the first endpoint of the line segment. Not modified. * @param lineSegmentEnd the second endpoint of the line segment. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the line segment and this bounding box. It is either * equal to 0, 1, or 2. * @throws ReferenceFrameMismatchException if any of the arguments is not expressed in the same * reference frame as {@code this}. */ default int intersectionWithLineSegment3D(FramePoint3DReadOnly lineSegmentStart, FramePoint3DReadOnly lineSegmentEnd, FixedFramePoint3DBasics firstIntersectionToPack, FixedFramePoint3DBasics secondIntersectionToPack) { checkReferenceFrameMatch(lineSegmentStart, lineSegmentEnd); if (firstIntersectionToPack != null) checkReferenceFrameMatch(firstIntersectionToPack); if (secondIntersectionToPack != null) checkReferenceFrameMatch(secondIntersectionToPack); return BoundingBox3DReadOnly.super.intersectionWithLineSegment3D(lineSegmentStart, lineSegmentEnd, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a line segment and this bounding box. * <p> * Intersection(s) between the line segment and this bounding box can only exist between the * endpoints of the line segment. * </p> * <p> * In the case the line segment and this bounding box do not intersect, this method returns * {@code 0} and {@code firstIntersectionToPack} and {@code secondIntersectionToPack} are set to * {@link Double#NaN}. * </p> * <p> * In the case only one intersection exists between the line segment and the bounding box, * {@code firstIntersectionToPack} will contain the coordinate of the intersection and * {@code secondIntersectionToPack} will be set to contain only {@link Double#NaN}. * </p> * * @param lineSegmentStart the first endpoint of the line segment. Not modified. * @param lineSegmentEnd the second endpoint of the line segment. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the line segment and this bounding box. It is either * equal to 0, 1, or 2. * @throws ReferenceFrameMismatchException if either {@code lineSegmentStart} or * {@code lineSegmentEnd} is not expressed in the same * reference frame as {@code this}. */ default int intersectionWithLineSegment3D(FramePoint3DReadOnly lineSegmentStart, FramePoint3DReadOnly lineSegmentEnd, FramePoint3DBasics firstIntersectionToPack, FramePoint3DBasics secondIntersectionToPack) { checkReferenceFrameMatch(lineSegmentStart, lineSegmentEnd); if (firstIntersectionToPack != null) firstIntersectionToPack.setReferenceFrame(getReferenceFrame()); if (secondIntersectionToPack != null) secondIntersectionToPack.setReferenceFrame(getReferenceFrame()); return BoundingBox3DReadOnly.super.intersectionWithLineSegment3D(lineSegmentStart, lineSegmentEnd, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a ray and this bounding box. * <p> * Intersection(s) between the ray and the bounding box cannot exist before the origin of the ray. * </p> * </p> * In the case the ray and this bounding box do not intersect, this method returns {@code 0} and * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} are set to * {@link Double#NaN}. * </p> * <p> * In the case only one intersection exists between the ray and this bounding box, * {@code firstIntersectionToPack} will contain the coordinate of the intersection and * {@code secondIntersectionToPack} will be set to contain only {@link Double#NaN}. * </p> * * @param rayOrigin the coordinate of the ray origin. Not modified. * @param rayDirection the direction of the ray. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the ray and this bounding box. It is either equal to * 0, 1, or 2. * @throws ReferenceFrameMismatchException if any of the frame arguments is not expressed in the * same reference frame as {@code this}. */ default int intersectionWithRay3D(FramePoint3DReadOnly rayOrigin, FrameVector3DReadOnly rayDirection, Point3DBasics firstIntersectionToPack, Point3DBasics secondIntersectionToPack) { checkReferenceFrameMatch(rayOrigin, rayDirection); return BoundingBox3DReadOnly.super.intersectionWithRay3D(rayOrigin, rayDirection, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a ray and this bounding box. * <p> * Intersection(s) between the ray and the bounding box cannot exist before the origin of the ray. * </p> * </p> * In the case the ray and this bounding box do not intersect, this method returns {@code 0} and * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} are set to * {@link Double#NaN}. * </p> * <p> * In the case only one intersection exists between the ray and this bounding box, * {@code firstIntersectionToPack} will contain the coordinate of the intersection and * {@code secondIntersectionToPack} will be set to contain only {@link Double#NaN}. * </p> * * @param rayOrigin the coordinate of the ray origin. Not modified. * @param rayDirection the direction of the ray. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the ray and this bounding box. It is either equal to * 0, 1, or 2. * @throws ReferenceFrameMismatchException if any of the frame arguments is not expressed in the * same reference frame as {@code this}. */ default int intersectionWithRay3D(Point3DReadOnly rayOrigin, Vector3DReadOnly rayDirection, FixedFramePoint3DBasics firstIntersectionToPack, FixedFramePoint3DBasics secondIntersectionToPack) { if (firstIntersectionToPack != null) checkReferenceFrameMatch(firstIntersectionToPack); if (secondIntersectionToPack != null) checkReferenceFrameMatch(secondIntersectionToPack); return BoundingBox3DReadOnly.super.intersectionWithRay3D(rayOrigin, rayDirection, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a ray and this bounding box. * <p> * Intersection(s) between the ray and the bounding box cannot exist before the origin of the ray. * </p> * </p> * In the case the ray and this bounding box do not intersect, this method returns {@code 0} and * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} are set to * {@link Double#NaN}. * </p> * <p> * In the case only one intersection exists between the ray and this bounding box, * {@code firstIntersectionToPack} will contain the coordinate of the intersection and * {@code secondIntersectionToPack} will be set to contain only {@link Double#NaN}. * </p> * * @param rayOrigin the coordinate of the ray origin. Not modified. * @param rayDirection the direction of the ray. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the ray and this bounding box. It is either equal to * 0, 1, or 2. */ default int intersectionWithRay3D(Point3DReadOnly rayOrigin, Vector3DReadOnly rayDirection, FramePoint3DBasics firstIntersectionToPack, FramePoint3DBasics secondIntersectionToPack) { if (firstIntersectionToPack != null) firstIntersectionToPack.setReferenceFrame(getReferenceFrame()); if (secondIntersectionToPack != null) secondIntersectionToPack.setReferenceFrame(getReferenceFrame()); return BoundingBox3DReadOnly.super.intersectionWithRay3D(rayOrigin, rayDirection, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a ray and this bounding box. * <p> * Intersection(s) between the ray and the bounding box cannot exist before the origin of the ray. * </p> * </p> * In the case the ray and this bounding box do not intersect, this method returns {@code 0} and * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} are set to * {@link Double#NaN}. * </p> * <p> * In the case only one intersection exists between the ray and this bounding box, * {@code firstIntersectionToPack} will contain the coordinate of the intersection and * {@code secondIntersectionToPack} will be set to contain only {@link Double#NaN}. * </p> * * @param rayOrigin the coordinate of the ray origin. Not modified. * @param rayDirection the direction of the ray. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the ray and this bounding box. It is either equal to * 0, 1, or 2. * @throws ReferenceFrameMismatchException if any of the arguments is not expressed in the same * reference frame as {@code this}. */ default int intersectionWithRay3D(FramePoint3DReadOnly rayOrigin, FrameVector3DReadOnly rayDirection, FixedFramePoint3DBasics firstIntersectionToPack, FixedFramePoint3DBasics secondIntersectionToPack) { checkReferenceFrameMatch(rayOrigin, rayDirection); if (firstIntersectionToPack != null) checkReferenceFrameMatch(firstIntersectionToPack); if (secondIntersectionToPack != null) checkReferenceFrameMatch(secondIntersectionToPack); return BoundingBox3DReadOnly.super.intersectionWithRay3D(rayOrigin, rayDirection, firstIntersectionToPack, secondIntersectionToPack); } /** * Computes the coordinates of the two intersections between a ray and this bounding box. * <p> * Intersection(s) between the ray and the bounding box cannot exist before the origin of the ray. * </p> * </p> * In the case the ray and this bounding box do not intersect, this method returns {@code 0} and * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} are set to * {@link Double#NaN}. * </p> * <p> * In the case only one intersection exists between the ray and this bounding box, * {@code firstIntersectionToPack} will contain the coordinate of the intersection and * {@code secondIntersectionToPack} will be set to contain only {@link Double#NaN}. * </p> * * @param rayOrigin the coordinate of the ray origin. Not modified. * @param rayDirection the direction of the ray. Not modified. * @param firstIntersectionToPack the coordinate of the first intersection. Can be {@code null}. * Modified. * @param secondIntersectionToPack the coordinate of the second intersection. Can be {@code null}. * Modified. * @return the number of intersections between the ray and this bounding box. It is either equal to * 0, 1, or 2. * @throws ReferenceFrameMismatchException if either {@code rayOrigin} or {@code rayDirection} is * not expressed in the same reference frame as * {@code this}. */ default int intersectionWithRay3D(FramePoint3DReadOnly rayOrigin, FrameVector3DReadOnly rayDirection, FramePoint3DBasics firstIntersectionToPack, FramePoint3DBasics secondIntersectionToPack) { checkReferenceFrameMatch(rayOrigin, rayDirection); if (firstIntersectionToPack != null) firstIntersectionToPack.setReferenceFrame(getReferenceFrame()); if (secondIntersectionToPack != null) secondIntersectionToPack.setReferenceFrame(getReferenceFrame()); return BoundingBox3DReadOnly.super.intersectionWithRay3D(rayOrigin, rayDirection, firstIntersectionToPack, secondIntersectionToPack); } /** * Tests on a per-component basis on the minimum and maximum coordinates if this bounding box is * equal to {@code other} with the tolerance {@code epsilon}. * <p> * If the two bounding boxes have different frames, this method returns {@code false}. * </p> * * @param other the query. Not modified. * @param epsilon the tolerance to use. * @return {@code true} if the two bounding boxes are equal and are expressed in the same reference * frame, {@code false} otherwise. */ default boolean epsilonEquals(FrameBoundingBox3DReadOnly other, double epsilon) { if (getReferenceFrame() != other.getReferenceFrame()) return false; else return BoundingBox3DReadOnly.super.epsilonEquals(other, epsilon); } /** * Compares {@code this} to {@code other} to determine if the two bounding boxes are geometrically * similar, i.e. the distance between their min and max points is less than or equal to * {@code epsilon}. * * @param other the bounding box to compare to. Not modified. * @param epsilon the tolerance of the comparison. * @return {@code true} if the two bounding boxes represent the same geometry, {@code false} * otherwise. * @throws ReferenceFrameMismatchException if {@code this} and {@code other} are not expressed in * the same reference frame. */ default boolean geometricallyEquals(FrameBoundingBox3DReadOnly other, double epsilon) { checkReferenceFrameMatch(other); return BoundingBox3DReadOnly.super.geometricallyEquals(other, epsilon); } /** * Tests on a per component basis, if this bounding box 3D is exactly equal to {@code other}. * <p> * If the two bounding boxes have different frames, this method returns {@code false}. * </p> * * @param other the other bounding box 3D to compare against this. Not modified. * @return {@code true} if the two bounding boxes are exactly equal component-wise and are expressed * in the same reference frame, {@code false} otherwise. */ default boolean equals(FrameBoundingBox3DReadOnly other) { if (other == this) return true; else if (other == null || getReferenceFrame() != other.getReferenceFrame()) return false; else return getMinPoint().equals(other.getMinPoint()) && getMaxPoint().equals(other.getMaxPoint()); } }
53.656132
159
0.671879
6253eaf281b7cd4df71d196736109667025111c1
156
package com.microsoft.android.ast; public interface HasJavadocComment { String getJavadocComment(); void setJavadocComment(String javaDocComment); }
22.285714
50
0.801282
3481e3e3334825a3a8d85624380cf3a103757576
4,318
package ic2.api.item; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; /** Allows for charging, discharging and using electric items (IElectricItem). * * The charge or remaining capacity of an item can be determined by calling charge/discharge with * ignoreTransferLimit and simulate set to true. */ public final class ElectricItem { /** IElectricItemManager to use for interacting with IElectricItem ItemStacks. * * This manager will act as a gateway and delegate the tasks to the final implementation * (rawManager or a custom one) as necessary. */ public static IElectricItemManager manager; /** Standard IElectricItemManager implementation, only call it directly from another * IElectricItemManager. Use manager instead. */ public static IElectricItemManager rawManager; /** Charge an item with a specified amount of energy * * @param itemStack electric item's stack * @param amount amount of energy to charge in EU * @param tier tier of the charging device, has to be at least as high as the item to charge * @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit() * @param simulate don't actually change the item, just determine the return value * @return Energy transferred into the electric item * * @deprecated use manager.charge() instead */ @Deprecated public static int charge(ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate) { return manager.charge(itemStack, amount, tier, ignoreTransferLimit, simulate); } /** Discharge an item by a specified amount of energy * * @param itemStack electric item's stack * @param amount amount of energy to charge in EU * @param tier tier of the discharging device, has to be at least as high as the item to * discharge * @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit() * @param simulate don't actually discharge the item, just determine the return value * @return Energy retrieved from the electric item * * @deprecated use manager.discharge() instead */ @Deprecated public static int discharge(ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate) { return manager.discharge(itemStack, amount, tier, ignoreTransferLimit, simulate); } /** Determine if the specified electric item has at least a specific amount of EU. This is * supposed to be used in the item code during operation, for example if you want to implement * your own electric item. BatPacks are not taken into account. * * @param itemStack electric item's stack * @param amount minimum amount of energy required * @return true if there's enough energy * * @deprecated use manager.canUse() instead */ @Deprecated public static boolean canUse(ItemStack itemStack, int amount) { return manager.canUse(itemStack, amount); } /** Try to retrieve a specific amount of energy from an Item, and if applicable, a BatPack. This * is supposed to be used in the item code during operation, for example if you want to * implement your own electric item. * * @param itemStack electric item's stack * @param amount amount of energy to discharge in EU * @param player player holding the item * @return true if the operation succeeded * * @deprecated use manager.use() instead */ @Deprecated public static boolean use(ItemStack itemStack, int amount, EntityPlayer player) { return manager.use(itemStack, amount, player); } /** Charge an item from the BatPack a player is wearing. This is supposed to be used in the item * code during operation, for example if you want to implement your own electric item. use() * already contains this functionality. * * @param itemStack electric item's stack * @param player player holding the item * * @deprecated use manager.chargeFromArmor() instead */ @Deprecated public static void chargeFromArmor(ItemStack itemStack, EntityPlayer player) { manager.chargeFromArmor(itemStack, player); } }
43.18
121
0.709819
72d277aea737823ceccc5f45fbb5a0497fdd62af
1,179
package ch.sebug.controlrouteoptimizer.controllers; import org.ocpsoft.rewrite.annotation.Join; import org.ocpsoft.rewrite.annotation.RequestAction; import org.ocpsoft.rewrite.el.ELBeanName; import org.ocpsoft.rewrite.faces.annotation.Deferred; import org.ocpsoft.rewrite.faces.annotation.IgnorePostback; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import ch.sebug.controlrouteoptimizer.models.Shelter; import ch.sebug.controlrouteoptimizer.repositories.ShelterRepository; import java.util.List; @Scope(value = "session") @Component(value = "shelterList") @ELBeanName(value = "shelterList") @Join(path = "/shelterList", to="/shelter-list.jsf") public class ShelterListController { private final ShelterRepository shelterRepository; public ShelterListController(ShelterRepository shelterRepository) { this.shelterRepository = shelterRepository; } private List<Shelter> shelters; @Deferred @RequestAction @IgnorePostback public void loadData() { shelters = shelterRepository.findAll(); } public List<Shelter> getShelters() { return shelters; } }
28.756098
71
0.773537
c687710dc26c7ccd0448776316c0b0aff350ad7f
8,285
package com.pvsagar.smartlockscreen.applogic_objects.environment_variables; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.util.Log; import com.google.android.gms.location.Geofence; import com.pvsagar.smartlockscreen.R; import com.pvsagar.smartlockscreen.baseclasses.EnvironmentVariable; import com.pvsagar.smartlockscreen.environmentdb.EnvironmentDatabaseContract.GeoFenceEntry; import java.util.ArrayList; import java.util.List; /** * Created by aravind on 8/8/14. * Class for storing Geofences. A geofence is basically a latitude and longitude along with a radius, * ie it defines a circular area on the earth's surface */ public class LocationEnvironmentVariable extends EnvironmentVariable { private static String LOG_TAG = LocationEnvironmentVariable.class.getSimpleName(); private static final int NUMBER_OF_FLOAT_VALUES = 3; private static final int NUMBER_OF_STRING_VALUES = 1; //double value indices private static final int INDEX_LATITUDE = 0; private static final int INDEX_LONGITUDE = 1; private static final int INDEX_RADIUS = 2; //String value indices private static final int INDEX_LOCATION_NAME = 0; public LocationEnvironmentVariable(){ super(TYPE_LOCATION, NUMBER_OF_FLOAT_VALUES, NUMBER_OF_STRING_VALUES); } public LocationEnvironmentVariable (double latitude, double longitude, int radius, String locationName){ super(TYPE_LOCATION, new double[]{latitude,longitude,radius}, new String[]{locationName}); } @Override public boolean isStringValuesSupported() { return true; } @Override public boolean isFloatValuesSupported() { return true; } public double getLatitude(){ try { return getFloatValue(INDEX_LATITUDE); } catch (Exception e){ Log.e(LOG_TAG, "Internal application error, please file a bug report to developer." + e.getMessage()); return (double) 0.0; //Should think of a better way, though it should never come to this. } } public double getLongitude(){ try { return getFloatValue(INDEX_LONGITUDE); } catch (Exception e){ Log.e(LOG_TAG, "Internal application error, please file a bug report to developer." + e.getMessage()); return 0.0; //Should think of a better way, though it should never come to this. } } public int getRadius(){ try { return (int) getFloatValue(INDEX_RADIUS); } catch (Exception e){ Log.e(LOG_TAG, "Internal application error, please file a bug report to developer." + e.getMessage()); return 0; //Should think of a better way, though it should never come to this. } } public String getLocationName(){ try { return getStringValue(INDEX_LOCATION_NAME); } catch (Exception e){ Log.e(LOG_TAG, "Internal application error, please file a bug report to developer." + e.getMessage()); return null; } } public void setLatitude(double latitude){ setFloatValue(latitude, INDEX_LATITUDE); } public void setLongitude(double longitude){ setFloatValue(longitude, INDEX_LONGITUDE); } public void setRadius(int radius){ setFloatValue(radius, INDEX_RADIUS); } public void setLocationName(String locationName){ setStringValue(locationName, INDEX_RADIUS); } /** * Get geofences stored in the database * @param context Activity/Service context * @return list of geofences stored */ public static List<EnvironmentVariable> getLocationEnvironmentVariables (Context context){ Cursor cursor = context.getContentResolver().query( GeoFenceEntry.CONTENT_URI, null, null, null, null); List<EnvironmentVariable> returnValues = getLocationEnvironmentVariablesFromCursor(cursor); cursor.close(); return returnValues; } /** * Get android geofence objects corresponding to the geofences stored in db. * @param context Activity/Service context * @return Geofence objects as defined in Google Play Services */ public static List<Geofence> getAndroidGeofences(Context context) { Cursor cursor = context.getContentResolver().query(GeoFenceEntry.CONTENT_URI, null, null, null, null); ArrayList<Geofence> geofences = new ArrayList<Geofence>(); for(cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()){ geofences.add((new Geofence.Builder()).setCircularRegion( cursor.getDouble(cursor.getColumnIndex(GeoFenceEntry.COLUMN_COORD_LAT)), cursor.getDouble(cursor.getColumnIndex(GeoFenceEntry.COLUMN_COORD_LONG)), (float) cursor.getDouble(cursor.getColumnIndex(GeoFenceEntry.COLUMN_RADIUS))). setTransitionTypes( Geofence.GEOFENCE_TRANSITION_ENTER | Geofence.GEOFENCE_TRANSITION_EXIT). setExpirationDuration(Geofence.NEVER_EXPIRE). setNotificationResponsiveness(R.integer.geofence_notification_responsiveness). setRequestId(cursor.getString(cursor.getColumnIndex(GeoFenceEntry._ID))). build()); } return geofences; } @Override public ContentValues getContentValues() { ContentValues locationValues = new ContentValues(); locationValues.put(GeoFenceEntry.COLUMN_COORD_LAT, getLatitude()); locationValues.put(GeoFenceEntry.COLUMN_COORD_LONG, getLongitude()); locationValues.put(GeoFenceEntry.COLUMN_RADIUS, getRadius()); locationValues.put(GeoFenceEntry.COLUMN_LOCATION_NAME, getLocationName()); return locationValues; } /** * Convert a Geofence object into LocationEnvironmentVariable object * @param context Activity/Service context * @param geofence instance to be converted * @return instance of LocationEnvironmentVariable */ public static LocationEnvironmentVariable getLocationEnvironmentVariableFromAndroidGeofence (Context context, Geofence geofence){ Cursor locationCursor = context.getContentResolver().query(GeoFenceEntry. buildGeofenceUriWithId(Long.parseLong(geofence.getRequestId())), null, null, null, null); List<EnvironmentVariable> locationVariables = getLocationEnvironmentVariablesFromCursor( locationCursor); locationCursor.close(); if(locationVariables == null || locationVariables.isEmpty()){ Log.e(LOG_TAG, "Invalid geofence passed. Id not found in database: " + geofence.getRequestId()); return null; } return (LocationEnvironmentVariable) locationVariables.get(0); } /** * Takes in a cursor and returns list of LocationEnvironmentVariables from it * @param cursor should contain values from geofences table * @return List of LocationEnvironmentVariable from cursor */ public static List<EnvironmentVariable> getLocationEnvironmentVariablesFromCursor (Cursor cursor){ ArrayList<EnvironmentVariable> locationEnvironmentVariables = new ArrayList<EnvironmentVariable>(); for(cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()){ LocationEnvironmentVariable variable = new LocationEnvironmentVariable( cursor.getDouble(cursor.getColumnIndex(GeoFenceEntry.COLUMN_COORD_LAT)), cursor.getDouble(cursor.getColumnIndex(GeoFenceEntry.COLUMN_COORD_LONG)), (int) cursor.getDouble(cursor.getColumnIndex(GeoFenceEntry.COLUMN_RADIUS)), cursor.getString(cursor.getColumnIndex(GeoFenceEntry.COLUMN_LOCATION_NAME)) ); variable.id = cursor.getLong(cursor.getColumnIndex(GeoFenceEntry._ID)); locationEnvironmentVariables.add(variable); } return locationEnvironmentVariables; } }
41.425
108
0.678093
57426b6fcd4127aa723f20671f71c01ac4a990aa
610
package com.elena.habitTracker.areas.activities.services; import com.elena.habitTracker.areas.activities.entities.Activity; import com.elena.habitTracker.areas.activities.models.binding.ActivityAddBindingModel; import com.elena.habitTracker.areas.activities.models.view.ActivitiesPageViewModel; import com.elena.habitTracker.areas.users.entities.User; import org.springframework.data.domain.Pageable; public interface ActivityService { ActivitiesPageViewModel getAllActivitiesOrderedByDateDesc(User user, Pageable pageable); Activity saveActivity(ActivityAddBindingModel activityAddBindingModel); }
43.571429
92
0.859016
595678f470916389dcac193bd70d532a840066be
3,672
package org.rcsb.cif.api.generated; import org.rcsb.cif.model.*; import javax.annotation.Generated; import java.util.Map; /** * This category contains details for the ligation-based cloning steps used in * the overall protein production process. * _pdbx_entity_src_gen_clone_ligation.clone_step_id in this category * must point at a defined _pdbx_entity_src_gen_clone.step_id. The details in * PDBX_ENTITY_SRC_GEN_CLONE_LIGATION extend the details in PDBX_ENTITY_SRC_GEN_CLONE * to cover ligation dependent cloning steps. */ @Generated("org.rcsb.cif.generator.SchemaGenerator") public class PdbxEntitySrcGenCloneLigation extends BaseCategory { public PdbxEntitySrcGenCloneLigation(String name, Map<String, Column> columns) { super(name, columns); } public PdbxEntitySrcGenCloneLigation(String name, int rowCount, Object[] encodedColumns) { super(name, rowCount, encodedColumns); } public PdbxEntitySrcGenCloneLigation(String name) { super(name); } /** * This item is a pointer to _pdbx_entity_src_gen_clone.entry_id in the * PDBX_ENTITY_SRC_GEN_CLONE category. * @return StrColumn */ public StrColumn getEntryId() { return (StrColumn) (isText ? textFields.computeIfAbsent("entry_id", StrColumn::new) : getBinaryColumn("entry_id")); } /** * This item is a pointer to _pdbx_entity_src_gen_clone.entity_id in the * PDBX_ENTITY_SRC_GEN_CLONE category. * @return StrColumn */ public StrColumn getEntityId() { return (StrColumn) (isText ? textFields.computeIfAbsent("entity_id", StrColumn::new) : getBinaryColumn("entity_id")); } /** * This item is a pointer to _pdbx_entity_src_gen_clone.step_id in the * PDBX_ENTITY_SRC_GEN_CLONE category. * @return IntColumn */ public IntColumn getStepId() { return (IntColumn) (isText ? textFields.computeIfAbsent("step_id", IntColumn::new) : getBinaryColumn("step_id")); } /** * The names of the enzymes used to cleave the vector. In addition an enzyme * used to blunt the cut ends, etc., should be named here. * @return StrColumn */ public StrColumn getCleavageEnzymes() { return (StrColumn) (isText ? textFields.computeIfAbsent("cleavage_enzymes", StrColumn::new) : getBinaryColumn("cleavage_enzymes")); } /** * The names of the enzymes used to ligate the gene into the cleaved vector. * @return StrColumn */ public StrColumn getLigationEnzymes() { return (StrColumn) (isText ? textFields.computeIfAbsent("ligation_enzymes", StrColumn::new) : getBinaryColumn("ligation_enzymes")); } /** * The temperature at which the ligation experiment was performed, in degrees * celsius. * @return FloatColumn */ public FloatColumn getTemperature() { return (FloatColumn) (isText ? textFields.computeIfAbsent("temperature", FloatColumn::new) : getBinaryColumn("temperature")); } /** * The duration of the ligation reaction in minutes. * @return IntColumn */ public IntColumn getTime() { return (IntColumn) (isText ? textFields.computeIfAbsent("time", IntColumn::new) : getBinaryColumn("time")); } /** * Any details to be associated with this ligation step, e.g. the protocol. * @return StrColumn */ public StrColumn getDetails() { return (StrColumn) (isText ? textFields.computeIfAbsent("details", StrColumn::new) : getBinaryColumn("details")); } }
34.317757
101
0.672113
a20f96c7f9cfe7212937387033bdb9a8b245136c
4,656
package com.microsoft.azure.documentdb.changefeedprocessor.services; import com.microsoft.azure.documentdb.DocumentClientException; import com.microsoft.azure.documentdb.changefeedprocessor.CheckpointFrequency; import com.microsoft.azure.documentdb.changefeedprocessor.CheckpointStats; import com.microsoft.azure.documentdb.changefeedprocessor.internal.ICheckpointManager; import com.microsoft.azure.documentdb.changefeedprocessor.internal.ILeaseManager; import com.microsoft.azure.documentdb.changefeedprocessor.internal.documentleasestore.DocumentServiceLease; import java.time.Instant; import java.util.logging.Logger; public class CheckpointServices { private CheckpointFrequency checkpointOptions; private ICheckpointManager checkpointManager; private ILeaseManager leaseManager; private Logger logger = Logger.getLogger(CheckpointServices.class.getName()); public CheckpointServices(ILeaseManager leaseManager, CheckpointFrequency checkpointOptions){ this.leaseManager = leaseManager; this.checkpointManager = (ICheckpointManager)leaseManager; this.checkpointOptions = checkpointOptions; } public String getCheckpointData(String partitionId) throws DocumentClientException { String data = getCheckpoint(partitionId); if (data == null) data = ""; logger.info(String.format("Retrieving Checkpoint partitionId: %s, data: %s",partitionId,data)); return data; } public void setCheckpointData(String partitionId, String data) throws DocumentClientException { logger.info(String.format("Saving Checkpoint partitionId: %s, data: %s",partitionId,data)); DocumentServiceLease lease = null; try { lease = (DocumentServiceLease)leaseManager.getLease(partitionId).call(); } catch (Exception e) { e.printStackTrace(); } String continuation = data; checkpoint(lease, continuation); } String getCheckpoint(String partitionId) throws DocumentClientException { DocumentServiceLease lease = null; try { lease = (DocumentServiceLease) this.leaseManager.getLease(partitionId).call(); } catch (Exception e) { logger.severe(String.format("Error!! %s", e.getMessage())); e.printStackTrace(); } return lease.getContinuationToken(); } public void checkpoint(DocumentServiceLease lease, String continuation) { if ((lease == null)) throw new AssertionError(); if ((continuation == null || continuation == "")) throw new AssertionError(); DocumentServiceLease result = null; try { result = (DocumentServiceLease) this.checkpointManager.checkpoint(lease, continuation, lease.getSequenceNumber() + 1); if(result.getConcurrencyToken() == continuation ) logger.info(String.format("Checkpoint: partition %s, continuation token '%s' was not updated!", lease.getPartitionId(), continuation)); else logger.info(String.format("Checkpoint: partition %s, new continuation '%s'", lease.getPartitionId(), continuation)); } catch (Exception ex) { logger.severe(String.format("Partition %s: failed to checkpoint due to unexpected error: $s", lease.getPartitionId(), ex.getMessage())); throw ex; } } public boolean isCheckpointNeeded(DocumentServiceLease lease, CheckpointStats checkpointStats) { CheckpointFrequency options = this.checkpointOptions; assert (lease != null); assert (checkpointStats != null); if (checkpointStats.getProcessedDocCount() == 0) { return false; } boolean isCheckpointNeeded = true; boolean hasProcessedDocumentCount = options.getProcessedDocumentCount().isPresent(); boolean hasTimeInterval = options.getTimeInterval().isPresent(); if (options != null && (hasProcessedDocumentCount || hasTimeInterval)) { // Note: if either condition is satisfied, we checkpoint. isCheckpointNeeded = false; if (hasProcessedDocumentCount) { isCheckpointNeeded = (checkpointStats.getProcessedDocCount() >= options.getProcessedDocumentCount().get()); } if (hasTimeInterval) { isCheckpointNeeded = isCheckpointNeeded || (Instant.now().getEpochSecond() - checkpointStats.getLastCheckpointTime().getEpochSecond()) >= options.getTimeInterval().get(); } } return isCheckpointNeeded; } }
42.327273
151
0.684923
28941f1a6441b521a01f1138b4ae6800db0babba
3,356
package com.dianping.cat.consumer.dependency.model.entity; import static com.dianping.cat.consumer.dependency.model.Constants.ATTR_DOMAIN; import static com.dianping.cat.consumer.dependency.model.Constants.ENTITY_DEPENDENCY_REPORT; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; import com.dianping.cat.consumer.dependency.model.BaseEntity; import com.dianping.cat.consumer.dependency.model.IVisitor; public class DependencyReport extends BaseEntity<DependencyReport> { private String m_domain; private java.util.Date m_startTime; private java.util.Date m_endTime; private Map<Integer, Segment> m_segments = new LinkedHashMap<Integer, Segment>(); private Set<String> m_domainNames = new LinkedHashSet<String>(); public DependencyReport() { } public DependencyReport(String domain) { m_domain = domain; } @Override public void accept(IVisitor visitor) { visitor.visitDependencyReport(this); } public DependencyReport addDomainName(String domainName) { m_domainNames.add(domainName); return this; } public DependencyReport addSegment(Segment segment) { m_segments.put(segment.getId(), segment); return this; } @Override public boolean equals(Object obj) { if (obj instanceof DependencyReport) { DependencyReport _o = (DependencyReport) obj; if (!equals(getDomain(), _o.getDomain())) { return false; } return true; } return false; } public Segment findSegment(Integer id) { return m_segments.get(id); } public Segment findOrCreateSegment(Integer id) { Segment segment = m_segments.get(id); if (segment == null) { synchronized (m_segments) { segment = m_segments.get(id); if (segment == null) { segment = new Segment(id); m_segments.put(id, segment); } } } return segment; } public String getDomain() { return m_domain; } public Set<String> getDomainNames() { return m_domainNames; } public java.util.Date getEndTime() { return m_endTime; } public Map<Integer, Segment> getSegments() { return m_segments; } public java.util.Date getStartTime() { return m_startTime; } @Override public int hashCode() { int hash = 0; hash = hash * 31 + (m_domain == null ? 0 : m_domain.hashCode()); return hash; } @Override public void mergeAttributes(DependencyReport other) { assertAttributeEquals(other, ENTITY_DEPENDENCY_REPORT, ATTR_DOMAIN, m_domain, other.getDomain()); if (other.getStartTime() != null) { m_startTime = other.getStartTime(); } if (other.getEndTime() != null) { m_endTime = other.getEndTime(); } } public Segment removeSegment(Integer id) { return m_segments.remove(id); } public DependencyReport setDomain(String domain) { m_domain = domain; return this; } public DependencyReport setEndTime(java.util.Date endTime) { m_endTime = endTime; return this; } public DependencyReport setStartTime(java.util.Date startTime) { m_startTime = startTime; return this; } }
23.144828
103
0.65584
93e72bfa99f28068e475e2e20c96f995fa758c29
557
package com.google.android.gms.common.server.response; import com.google.android.gms.common.server.response.FastParser; import java.io.BufferedReader; import java.io.IOException; import java.math.BigInteger; /* compiled from: com.google.android.gms:play-services-base@@17.3.0 */ final class zaf implements FastParser.zaa<BigInteger> { zaf() { } public final /* synthetic */ Object zaa(FastParser fastParser, BufferedReader bufferedReader) throws FastParser.ParseException, IOException { return fastParser.zaf(bufferedReader); } }
32.764706
145
0.763016
ded966e76008f1f612529211616671e61c871daa
673
package org.xfh.web.controller.common; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.RestController; import org.xfh.web.controller.BaseMallFrontController; /** * 封装可以被前端缓存的数据. * * @author cys * */ @RestController public class WebCacheController extends BaseMallFrontController{ static final Logger logger = LoggerFactory.getLogger(WebCacheController.class); // @RequestMapping("/common/getProductPageData") // public void getProductPageData(IndexSearchForm form) throws Exception { // // PageHolder<ProductVo> page = productService.getProductPage(form); // // DWebUtils.ajaxSucc(page); // } }
23.206897
83
0.77266
351555b5042629cdb966ff983f5ceea869fb4ffa
3,725
package com.dextrous.hack.boardme.activity; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.Spinner; import android.widget.TextView; import com.dextrous.hack.boardme.R; import com.dextrous.hack.boardme.adapter.RouteLocationArrayAdapter; import com.dextrous.hack.boardme.callback.BoardRouteResponseCallback; import com.dextrous.hack.boardme.constant.BoardMeConstants; import com.dextrous.hack.boardme.model.BoardMeLocation; import com.dextrous.hack.boardme.model.RouteLocation; import com.dextrous.hack.boardme.model.User; import com.dextrous.hack.boardme.response.BoardRouteResponse; import com.dextrous.hack.boardme.service.BoardMeAPIService; import com.dextrous.hack.boardme.util.AndroidUtil; import com.dextrous.hack.boardme.wrapper.RetrofitWrapper; import java.util.ArrayList; import retrofit2.Call; import static com.dextrous.hack.boardme.constant.BoardMeConstants.USER_AUTH_KEY_PREFERENCE_KEY; public class BoardMeActivity extends AppCompatActivity { String TAG = BoardMeActivity.class.getName(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_board_me); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); String BASE_URL = getResources().getString(R.string.base_api_url); Log.d(TAG, "BASE_URL="+ BASE_URL); BoardMeAPIService apiService = RetrofitWrapper.build(BASE_URL); Intent intent = getIntent(); Object temp = intent.getSerializableExtra(BoardMeConstants.INTENT_PARAM_CURRENT_USER_LOCATION_KEY); BoardMeLocation userLocation = temp != null ? (BoardMeLocation)temp : null; String beaconId = intent.getStringExtra(BoardMeConstants.INTENT_PARAM_NEAREST_BEACON_ID_KEY); // API call 2 User userAuthObject = AndroidUtil.getPreferenceAsObject(getApplicationContext(), USER_AUTH_KEY_PREFERENCE_KEY, User.class); Log.d(TAG, "User auth=" + userAuthObject); Log.d(TAG, "userLocation=" + userLocation); if(userAuthObject != null && userLocation != null) { Call<BoardRouteResponse> boardMeCall = apiService.getBoardingRouteData(beaconId, String.valueOf(userAuthObject.getId()), String.valueOf(userLocation.getLatitude()), String.valueOf(userLocation.getLongitude())); TextView currentRouteText = (TextView) findViewById(R.id.currentRouteValueLabel); TextView currentStopText = (TextView) findViewById(R.id.currentStopValueLabel); Spinner destinationsSpinner = (Spinner) findViewById(R.id.destinationsSpinnerInput); Button payNowButton = (Button) findViewById(R.id.payButton); ArrayAdapter<RouteLocation> routeLocationsArrayAdapter = new RouteLocationArrayAdapter(getApplicationContext(), new ArrayList<RouteLocation>()); routeLocationsArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); destinationsSpinner.setAdapter(routeLocationsArrayAdapter); boardMeCall.enqueue(new BoardRouteResponseCallback(this, destinationsSpinner, currentRouteText, currentStopText, routeLocationsArrayAdapter, payNowButton)); } getSupportActionBar().setDisplayHomeAsUpEnabled(true); } }
48.376623
131
0.728859
6153be08f4844c0097368157e12c83b2c7095e28
3,184
/* * 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.flink.table.runtime.util; import org.apache.flink.core.memory.MemorySegment; import org.apache.flink.runtime.memory.MemoryAllocationException; import org.apache.flink.runtime.memory.MemoryManager; import java.io.Closeable; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * {@link MemorySegmentPool} that lazy allocate memory pages from {@link MemoryManager}. */ public class LazyMemorySegmentPool implements MemorySegmentPool, Closeable { private static final long PER_REQUEST_MEMORY_SIZE = 16 * 1024 * 1024; private final Object owner; private final MemoryManager memoryManager; private final ArrayList<MemorySegment> cachePages; private final int maxPages; private final int perRequestPages; private int pageUsage; public LazyMemorySegmentPool(Object owner, MemoryManager memoryManager, int maxPages) { this.owner = owner; this.memoryManager = memoryManager; this.cachePages = new ArrayList<>(); this.maxPages = maxPages; this.pageUsage = 0; this.perRequestPages = Math.max(1, (int) (PER_REQUEST_MEMORY_SIZE / memoryManager.getPageSize())); } @Override public int pageSize() { return this.memoryManager.getPageSize(); } @Override public void returnAll(List<MemorySegment> memory) { this.pageUsage -= memory.size(); if (this.pageUsage < 0) { throw new RuntimeException("Return too more memories."); } this.cachePages.addAll(memory); } public void returnPage(MemorySegment segment) { returnAll(Collections.singletonList(segment)); } @Override public MemorySegment nextSegment() { int freePages = freePages(); if (freePages == 0) { return null; } if (this.cachePages.isEmpty()) { int numPages = Math.min(freePages, this.perRequestPages); try { this.memoryManager.allocatePages(owner, this.cachePages, numPages); } catch (MemoryAllocationException e) { throw new RuntimeException(e); } } this.pageUsage++; return this.cachePages.remove(this.cachePages.size() - 1); } @Override public int freePages() { return this.maxPages - this.pageUsage; } @Override public void close() { if (this.pageUsage != 0) { throw new RuntimeException( "Should return all used memory before clean, page used: " + pageUsage); } cleanCache(); } public void cleanCache() { this.memoryManager.release(this.cachePages); } }
29.211009
100
0.743405
b0c29d3995f0c50c76099790e973184a7b6be9e1
3,989
package pt.ulisboa.tecnico.softeng.broker.services.remote.dataobjects; import com.fasterxml.jackson.annotation.JsonFormat; import org.joda.time.LocalDate; import pt.ulisboa.tecnico.softeng.broker.domain.Adventure; public class RestRoomBookingData { private String reference; private String cancellation; private String hotelName; private String hotelCode; private String roomNumber; private String bookRoom; @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") private LocalDate arrival; @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") private LocalDate departure; @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") private LocalDate cancellationDate; private long price; private String paymentReference; private String invoiceReference; private String buyerNif; private String buyerIban; private String adventureId; public RestRoomBookingData() { } public RestRoomBookingData(Adventure.BookRoom single, LocalDate arrival, LocalDate departure, String nifAsBuyer, String iban, String adventureId) { this.bookRoom = single.toString(); this.arrival = arrival; this.departure = departure; this.buyerNif = nifAsBuyer; this.buyerIban = iban; this.adventureId = adventureId; } public String getReference() { return this.reference; } public void setReference(String reference) { this.reference = reference; } public String getCancellation() { return this.cancellation; } public void setCancellation(String cancellation) { this.cancellation = cancellation; } public String getHotelName() { return this.hotelName; } public void setHotelName(String hotelName) { this.hotelName = hotelName; } public String getHotelCode() { return this.hotelCode; } public void setHotelCode(String hotelCode) { this.hotelCode = hotelCode; } public String getRoomNumber() { return this.roomNumber; } public void setRoomNumber(String roomNumber) { this.roomNumber = roomNumber; } public String getBookRoom() { return this.bookRoom; } public void setBookRoom(String bookRoom) { this.bookRoom = bookRoom; } public LocalDate getArrival() { return this.arrival; } public void setArrival(LocalDate arrival) { this.arrival = arrival; } public LocalDate getDeparture() { return this.departure; } public void setDeparture(LocalDate departure) { this.departure = departure; } public LocalDate getCancellationDate() { return this.cancellationDate; } public void setCancellationDate(LocalDate cancellationDate) { this.cancellationDate = cancellationDate; } public long getPrice() { return this.price; } public void setPrice(long price) { this.price = price; } public String getPaymentReference() { return this.paymentReference; } public void setPaymentReference(String reference) { this.paymentReference = reference; } public String getInvoiceReference() { return this.invoiceReference; } public void setInvoiceReference(String invoiceReference) { this.invoiceReference = invoiceReference; } public String getBuyerNif() { return this.buyerNif; } public void setBuyerNif(String buyerNif) { this.buyerNif = buyerNif; } public String getBuyerIban() { return this.buyerIban; } public void setBuyerIban(String buyerIban) { this.buyerIban = buyerIban; } public String getAdventureId() { return this.adventureId; } public void setAdventureId(String adventureId) { this.adventureId = adventureId; } }
24.623457
129
0.663324
82dea7f9fd5e93e47ff179bea232c83f426d6d15
248
package io.github.nhwalker.jsonup.convert; /** * Both a {@link ToJsonConverter} and a {@link FromJsonConverter} * * @param <T> the type to convert */ public interface FullJsonConverter<T> extends ToJsonConverter<T>, FromJsonConverter<T> { }
22.545455
88
0.729839