blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
1333a231c0745af47ed9f0fd1718b8abe29c8ab8
88f6153744b05e57627a843b57b835bb566ab6ce
/src/com/email/models/Folder.java
275b85197714966c0ffc2d4157f2d87bf6d2522d
[]
no_license
guichengwu/WebJamesEmail
1b15b1ce055397e3491feab9f13b65988effba02
ad4c37daa88c47ffaeeef9fe8d8c64689f244592
refs/heads/master
2021-01-19T07:55:03.062298
2015-04-05T13:45:24
2015-04-05T13:45:24
33,371,389
0
0
null
null
null
null
UTF-8
Java
false
false
635
java
package com.email.models; public class Folder { private int folderId; private int userId; private String folderName; public Folder() {} public Folder(int userId, String folderName) { this.userId = userId; this.folderName = folderName; } public int getFolderId() { return folderId; } public void setFolderId(int folderId) { this.folderId = folderId; } public int getUserId() { return userId; } public void setUserId(int userId) { this.userId = userId; } public String getFolderName() { return folderName; } public void setFolderName(String folderName) { this.folderName = folderName; } }
b2169dc4dce3916ddbd166253bcbd872d21b466d
13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3
/crash-reproduction-new-fitness/results/MOCKITO-16b-1-27-Single_Objective_GGA-WeightedSum-BasicBlockCoverage-opt/org/mockito/exceptions/Reporter_ESTest.java
68921a74ed01eb97c29eee5ac9b78d4d228a645f
[ "MIT", "CC-BY-4.0" ]
permissive
STAMP-project/Botsing-basic-block-coverage-application
6c1095c6be945adc0be2b63bbec44f0014972793
80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da
refs/heads/master
2022-07-28T23:05:55.253779
2022-04-20T13:54:11
2022-04-20T13:54:11
285,771,370
0
0
null
null
null
null
UTF-8
Java
false
false
733
java
/* * This file was automatically generated by EvoSuite * Tue Oct 26 23:06:51 UTC 2021 */ package org.mockito.exceptions; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.runtime.EvoAssertions.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; import org.mockito.exceptions.Reporter; @RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true) public class Reporter_ESTest extends Reporter_ESTest_scaffolding { @Test(timeout = 4000) public void test0() throws Throwable { Reporter reporter0 = new Reporter(); // Undeclared exception! reporter0.missingMethodInvocation(); } }
d1585a8da2db51c0847d337f8f9b2ddafd2bf6d9
feb7d897d34f72b603a7eb662f73815028082c0d
/DrawHeliMapWithForApp.java
bfb2998538588769b190c0da74c50dfe4c262cb4
[]
no_license
taranudan/DrawHeliMapWithForApp
781a1b0433ae7b2c045d50cac1c163524605aba5
15fd626772b13e6874c52de643379753e5363f4f
refs/heads/main
2023-07-09T00:42:08.244409
2021-07-29T15:46:26
2021-07-29T15:46:26
390,769,138
0
0
null
null
null
null
UTF-8
Java
false
false
801
java
public class DrawHeliMapWithForApp { public static void main(String[] args) { //Constant final int SCALE = 10; //Variables int hX = 5; int hY = 4; //Map for (int y = 1; y <= SCALE; y++) { System.out.printf("%2d. ", y); for(int x = 1; x <= SCALE; x++) { if (x == 1 || y == 1 || x == SCALE || y == SCALE) { System.out.print("# "); } //Helicopter position else if (x == hX && y == hY) { System.out.print("H "); } // The region marked with x else if ((x >= hX - 1 && x <= hX + 1 && y >= hY - 1 && y <= hY + 1) || (((x == hX - 2) || (x == hX + 2)) && y == hY)) { System.out.print("x "); } else { System.out.print(" "); } } System.out.println(); } } }
478aa626045a18cdedc6c2d66525b8bc6486200d
383d0548a82c87e4ec298c9fb94d818e3e7cd6e4
/nifty-controls-illarion/src/main/java/org/illarion/nifty/controls/dialog/crafting/DialogCraftingControl.java
402682f927f1b06a27d8827366ee5c5f13bf384d
[]
no_license
KayMD/Illarion-Java
120bc978b9f4a33f440bc58356e36c9deac881dc
bf704e528d543d3029b07e2888f98b6b32915fb8
refs/heads/master
2021-01-18T00:10:06.888376
2015-02-06T23:14:25
2015-02-06T23:14:25
25,314,417
0
0
null
null
null
null
UTF-8
Java
false
false
24,881
java
/* * This file is part of the Illarion project. * * Copyright © 2014 - Illarion e.V. * * Illarion is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Illarion is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ package org.illarion.nifty.controls.dialog.crafting; import de.lessvoid.nifty.Nifty; import de.lessvoid.nifty.builder.ImageBuilder; import de.lessvoid.nifty.builder.PanelBuilder; import de.lessvoid.nifty.controls.*; import de.lessvoid.nifty.controls.label.builder.LabelBuilder; import de.lessvoid.nifty.controls.textfield.filter.input.TextFieldInputCharFilter; import de.lessvoid.nifty.controls.textfield.format.TextFieldDisplayFormat; import de.lessvoid.nifty.controls.window.WindowControl; import de.lessvoid.nifty.effects.Effect; import de.lessvoid.nifty.effects.EffectEventId; import de.lessvoid.nifty.elements.Element; import de.lessvoid.nifty.elements.events.NiftyMouseMovedEvent; import de.lessvoid.nifty.elements.render.ImageRenderer; import de.lessvoid.nifty.elements.render.TextRenderer; import de.lessvoid.nifty.input.NiftyInputEvent; import de.lessvoid.nifty.layout.align.HorizontalAlign; import de.lessvoid.nifty.render.NiftyImage; import de.lessvoid.nifty.screen.Screen; import de.lessvoid.nifty.tools.SizeValue; import illarion.common.types.ItemCount; import org.bushe.swing.event.EventTopicSubscriber; import org.illarion.nifty.controls.*; import org.illarion.nifty.effects.DoubleEffect; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.security.InvalidParameterException; import java.text.DecimalFormat; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * This is the main control class for message dialogs. * * @author Martin Karing &lt;[email protected]&gt; * @deprecated Use {@link DialogCrafting} to access the dialog */ @Deprecated public class DialogCraftingControl extends WindowControl implements DialogCrafting, EventTopicSubscriber<ButtonClickedEvent> { /** * The size of the slot to show the ingredient in pixels. */ private static final int INGREDIENT_IMAGE_SIZE = 32; /** * This subscriber is used to keep track on clicks on the "craft" button in the crafting dialog. */ private final class CraftButtonClickedEventSubscriber implements EventTopicSubscriber<ButtonClickedEvent> { @Override public void onEvent(String topic, ButtonClickedEvent data) { CraftingItemEntry selectedItem = getSelectedCraftingItem(); if (selectedItem == null) { return; } niftyInstance.publishEvent(getId(), new DialogCraftingCraftEvent(dialogId, selectedItem, getAmount())); } } /** * This subscriber is used to keep track on clicks on the "close" button in the crafting dialog. */ private final class CloseButtonClickedEventSubscriber implements EventTopicSubscriber<ButtonClickedEvent> { @Override public void onEvent(String topic, ButtonClickedEvent data) { closeWindow(); niftyInstance.publishEvent(getId(), new DialogCraftingCloseEvent(dialogId)); } } private final class SelectCraftItemEventSubscriber implements EventTopicSubscriber<TreeItemSelectionChangedEvent<ListEntry>> { @Override public void onEvent(String topic, @Nonnull TreeItemSelectionChangedEvent<ListEntry> data) { List<TreeItem<ListEntry>> selection = data.getSelection(); if (selection.isEmpty()) { return; } TreeItem<ListEntry> selectedTreeEntry = selection.get(0); CraftingTreeItem selectedEntry = selectedTreeEntry.getValue().entry; if (selectedEntry instanceof CraftingItemEntry) { setSelectedItem((CraftingItemEntry) selectedEntry); } else { setSelectedItem(null); } } } private final class MouseOverItemEventSubscriber implements EventTopicSubscriber<NiftyMouseMovedEvent> { @Override public void onEvent(String topic, NiftyMouseMovedEvent data) { CraftingItemEntry selectedItem = getSelectedCraftingItem(); if (selectedItem == null) { return; } niftyInstance.publishEvent(getId(), new DialogCraftingLookAtItemEvent(dialogId, selectedItem)); } } private final class MouseOverIngredientItemEventSubscriber implements EventTopicSubscriber<NiftyMouseMovedEvent> { @Override public void onEvent(@Nonnull String topic, NiftyMouseMovedEvent data) { CraftingItemEntry selectedItem = getSelectedCraftingItem(); if (selectedItem == null) { return; } Matcher matcher = INGREDIENT_INDEX_PATTERN.matcher(topic); if (!matcher.find()) { return; } int ingredientId = Integer.parseInt(matcher.group(1)); niftyInstance.publishEvent(getId(), new DialogCraftingLookAtIngredientItemEvent(dialogId, selectedItem, ingredientId)); } } private final class IncreaseAmountButtonEventSubscriber implements EventTopicSubscriber<ButtonClickedEvent> { @Override public void onEvent(String topic, ButtonClickedEvent data) { getAmountTextField().setText(Integer.toString(getAmount() + 1)); } } private final class DecreaseAmountButtonEventSubscriber implements EventTopicSubscriber<ButtonClickedEvent> { @Override public void onEvent(String topic, ButtonClickedEvent data) { int newAmount = getAmount() - 1; if (newAmount <= 1) { getAmountTextField().setText(""); } else { getAmountTextField().setText(Integer.toString(newAmount)); } } } private static final Pattern INGREDIENT_INDEX_PATTERN = Pattern.compile("#ingredient(\\d+)"); /** * The instance of the Nifty-GUI that is parent to this control. */ private Nifty niftyInstance; /** * The screen that displays this control. */ private Screen currentScreen; /** * The ID of this dialog. */ private int dialogId; /** * The root node of the tree that displays all the crafting items. */ private TreeItem<ListEntry> treeRootNode; @Nonnull private final CraftButtonClickedEventSubscriber craftButtonEventHandler; @Nonnull private final CloseButtonClickedEventSubscriber closeButtonEventHandler; @Nonnull private final SelectCraftItemEventSubscriber listSelectionChangedEventHandler; @Nonnull private final MouseOverItemEventSubscriber mouseOverItemEventHandler; @Nonnull private final MouseOverIngredientItemEventSubscriber mouseOverIngredientEventHandler; @Nonnull private final IncreaseAmountButtonEventSubscriber increaseAmountButtonEventHandler; @Nonnull private final DecreaseAmountButtonEventSubscriber decreaseAmountButtonEventHandler; @Nonnull private final DecimalFormat timeFormat; public DialogCraftingControl() { craftButtonEventHandler = new CraftButtonClickedEventSubscriber(); closeButtonEventHandler = new CloseButtonClickedEventSubscriber(); listSelectionChangedEventHandler = new SelectCraftItemEventSubscriber(); mouseOverItemEventHandler = new MouseOverItemEventSubscriber(); mouseOverIngredientEventHandler = new MouseOverIngredientItemEventSubscriber(); increaseAmountButtonEventHandler = new IncreaseAmountButtonEventSubscriber(); decreaseAmountButtonEventHandler = new DecreaseAmountButtonEventSubscriber(); treeRootNode = new TreeItem<ListEntry>(); timeFormat = new DecimalFormat("#0.0"); } @Override public void bind( @Nonnull Nifty nifty, @Nonnull Screen screen, @Nonnull Element element, @Nonnull Parameters parameter) { super.bind(nifty, screen, element, parameter); niftyInstance = nifty; currentScreen = screen; dialogId = Integer.parseInt(parameter.getWithDefault("dialogId", "-1")); nifty.subscribeAnnotations(this); getAmountTextField().enableInputFilter(new TextFieldInputCharFilter() { @Override public boolean acceptInput(int index, char newChar) { if (!Character.isDigit(newChar)) { return false; } String currentText = getAmountTextField().getRealText(); StringBuilder buffer = new StringBuilder(currentText); buffer.insert(index, newChar); int value = Integer.parseInt(buffer.toString()); return value > 0; } }); getAmountTextField().setFormat(new TextFieldDisplayFormat() { @Nonnull @Override public CharSequence getDisplaySequence( @Nonnull CharSequence original, int start, int end) { if (original.length() == 0) { return Integer.toString(1); } return original.subSequence(start, end); } }); } @Override public void onStartScreen() { super.onStartScreen(); Element element = getElement(); Element parent = element.getParent(); int x = (parent.getWidth() - element.getWidth()) / 2; int y = (parent.getHeight() - element.getHeight()) / 2; element.setConstraintX(new SizeValue(Integer.toString(x) + "px")); element.setConstraintY(new SizeValue(Integer.toString(y) + "px")); parent.layoutElements(); niftyInstance.subscribe(currentScreen, getContent().findElementById("#craftButton").getId(), ButtonClickedEvent.class, craftButtonEventHandler); niftyInstance.subscribe(currentScreen, getContent().findElementById("#cancelButton").getId(), ButtonClickedEvent.class, closeButtonEventHandler); niftyInstance.subscribe(currentScreen, getContent().findElementById("#buttonAmountUp").getId(), ButtonClickedEvent.class, increaseAmountButtonEventHandler); niftyInstance.subscribe(currentScreen, getContent().findElementById("#buttonAmountDown").getId(), ButtonClickedEvent.class, decreaseAmountButtonEventHandler); niftyInstance.subscribe(currentScreen, getItemList().getElement().getId(), ListBoxSelectionChangedEvent.class, listSelectionChangedEventHandler); niftyInstance.subscribe(currentScreen, getContent().findElementById("#selectedItemInfos").getId(), NiftyMouseMovedEvent.class, mouseOverItemEventHandler); } @Override public void onEvent(String topic, ButtonClickedEvent data) { niftyInstance.publishEvent(getId(), new DialogMessageConfirmedEvent(dialogId)); closeWindow(); } @Nullable @Override public CraftingItemEntry getSelectedCraftingItem() { List<TreeItem<ListEntry>> selection = getItemList().getSelection(); if (selection.isEmpty()) { return null; } CraftingTreeItem treeItem = selection.get(0).getValue().entry; if (treeItem instanceof CraftingItemEntry) { return (CraftingItemEntry) treeItem; } return null; } /** * Remove everything from the current item list. */ @Override public void clearItemList() { treeRootNode = new TreeItem<ListEntry>(); getItemList().setTree(treeRootNode); } /** * Select a item by the item index of the entry. */ @Override public void selectItemByItemIndex(int index) { TreeItem<ListEntry> selectedEntry = null; for (TreeItem<ListEntry> categoryTreeItem : treeRootNode) { for (TreeItem<ListEntry> itemTreeItem : categoryTreeItem) { CraftingItemEntry currentItem = (CraftingItemEntry) itemTreeItem.getValue().entry; if (currentItem.getItemIndex() == index) { selectedEntry = itemTreeItem; break; } } if (selectedEntry != null) { break; } } if (selectedEntry == null) { setSelectedItem(null); return; } if (selectedEntry.getParentItem() != null) { selectedEntry.getParentItem().setExpanded(true); } updateTree(selectedEntry); setSelectedItem((CraftingItemEntry) selectedEntry.getValue().entry); } private void updateTree(@Nullable TreeItem<ListEntry> selectedItem) { TreeBox<ListEntry> tree = getItemList(); tree.setTree(treeRootNode); if (selectedItem != null) { tree.selectItem(selectedItem); } } @Nonnull @Override public Element getCraftingItemDisplay() { return getElement().findElementById("#selectedItemInfos"); } @Nonnull @Override public Element getIngredientItemDisplay(int index) { Element ingredientsPanel = getElement().findElementById("#ingredients"); return ingredientsPanel.findElementById("#ingredient" + Integer.toString(index)); } /** * Get the text field that takes care for showing the amount of items that get produced at once. * * @return the amount textfield */ @Nullable public TextField getAmountTextField() { return getElement().findNiftyControl("#amountInput", TextField.class); } @Override public int getAmount() { return Integer.parseInt(getAmountTextField().getDisplayedText()); } @Override public void setAmount(int amount) { if (amount <= 1) { getAmountTextField().setText(""); } else { getAmountTextField().setText(Integer.toString(amount)); } } private static final class ListEntry { private final CraftingTreeItem entry; ListEntry(CraftingTreeItem entry) { this.entry = entry; } @Override @Nonnull public String toString() { return entry.getTreeLabel(); } } private static void applyImage(@Nonnull Element element, @Nonnull NiftyImage image, int maxSize) { int width = image.getWidth(); int height = image.getHeight(); if (width > maxSize) { height *= width / maxSize; width = maxSize; } if (height > maxSize) { width *= height / maxSize; height = maxSize; } SizeValue widthSize = SizeValue.px(width); SizeValue heightSize = SizeValue.px(height); element.getRenderer(ImageRenderer.class).setImage(image); element.setConstraintHeight(heightSize); element.setConstraintWidth(widthSize); } @Override public void startProgress(double seconds) { Element progressBar = getContent().findElementById("#progress"); progressBar.getNiftyControl(Progress.class).setProgress(0.f); List<Effect> effects = progressBar.getEffects(EffectEventId.onCustom, DoubleEffect.class); if (effects.isEmpty()) { return; } Effect effect = effects.get(0); effect.getParameters().setProperty("length", Integer.toString((int) (seconds * 1000.0))); effect.updateParameters(); progressBar.startEffect(EffectEventId.onCustom, null, "automaticProgress"); } @Override public void setDialogId(int id) { dialogId = id; } @Override public int getDialogId() { return dialogId; } /** * Show the details of one item in the details part of the crafting window. * * @param selectedEntry the entry that is supposed to be displayed in detail */ private void setSelectedItem(@Nullable CraftingItemEntry selectedEntry) { if (selectedEntry == null) { Element image = getContent().findElementById("#selectedItemImage"); image.getRenderer(ImageRenderer.class).setImage(null); Label imageAmount = getContent().findNiftyControl("#selectedItemAmount", Label.class); imageAmount.getElement().hide(); Element ingredientsPanel = getContent().findElementById("#ingredients"); int index = 0; while (deleteIngredientImage(ingredientsPanel, index)) { index++; } return; } Element image = getContent().findElementById("#selectedItemImage"); applyImage(image, selectedEntry.getImage(), 56); Label imageAmount = getContent().findNiftyControl("#selectedItemAmount", Label.class); if (ItemCount.isGreaterOne(selectedEntry.getBuildStackSize())) { Element imageAmountElement = imageAmount.getElement(); TextRenderer textRenderer = imageAmountElement.getRenderer(TextRenderer.class); textRenderer.setText(Integer.toString(selectedEntry.getBuildStackSize().getValue())); imageAmountElement.setConstraintWidth(SizeValue.px(textRenderer.getTextWidth())); imageAmountElement.setConstraintHorizontalAlign(HorizontalAlign.right); imageAmountElement.show(); } else { imageAmount.getElement().hide(); } Element title = getContent().findElementById("#selectedItemName"); title.getRenderer(TextRenderer.class).setText(selectedEntry.getName()); Element productionTime = getContent().findElementById("#productionTime"); productionTime.getRenderer(TextRenderer.class).setText( "${illarion-dialog-crafting-bundle.craftTime}: " + timeFormat.format(selectedEntry.getCraftTime()) + "s"); Element ingredientsPanel = getContent().findElementById("#ingredients"); int ingredientsAmount = selectedEntry.getIngredientCount(); Element currentPanel = null; for (int i = 0; i < ingredientsAmount; i++) { if ((i % 10) == 0) { currentPanel = getIngredientPanel(ingredientsPanel, i / 10); } assert currentPanel != null; Element currentImage = getIngredientImage(ingredientsPanel.getId(), currentPanel, i % 10); applyImage(currentImage.getChildren().get(0), selectedEntry.getIngredientImage(i), INGREDIENT_IMAGE_SIZE); showIngredientAmount(currentImage, selectedEntry.getIngredientAmount(i)); } int index = ingredientsAmount; while (deleteIngredientImage(ingredientsPanel, index)) { index++; } int panelIndex = (ingredientsAmount / 10) + 1; while (deleteIngredientPanel(ingredientsPanel, panelIndex)) { panelIndex++; } getElement().getParent().layoutElements(); } private boolean deleteIngredientPanel(@Nonnull Element ingredientsPanel, int index) { List<Element> elements = ingredientsPanel.getChildren(); if ((elements.size() - 1) >= index) { niftyInstance.removeElement(currentScreen, elements.get(index)); return true; } return false; } @Nonnull private Element getIngredientPanel(@Nonnull Element ingredientsPanel, int index) { List<Element> elements = ingredientsPanel.getChildren(); if ((elements.size() - 1) >= index) { return elements.get(index); } if (elements.size() < index) { throw new InvalidParameterException("Index out of valid range"); } PanelBuilder builder = new PanelBuilder(); builder.childLayoutHorizontal(); builder.width("450px"); builder.height(SizeValue.px(INGREDIENT_IMAGE_SIZE + 10).toString()); return builder.build(niftyInstance, currentScreen, ingredientsPanel); } private boolean deleteIngredientImage(@Nonnull Element ingredientsPanel, int index) { Element image = ingredientsPanel.findElementById("#ingredient" + Integer.toString(index)); if (image == null) { return false; } niftyInstance.unsubscribe(image.getId(), mouseOverIngredientEventHandler); niftyInstance.removeElement(currentScreen, image); return true; } @Nonnull private Element getIngredientImage(String parentId, @Nonnull Element parentPanel, int index) { List<Element> elements = parentPanel.getChildren(); if ((elements.size() - 1) >= index) { return elements.get(index); } if (elements.size() < index) { throw new InvalidParameterException("Index out of valid range"); } PanelBuilder panelBuilder = new PanelBuilder(parentId + "#ingredient" + Integer.toString(index)); panelBuilder.margin("1px"); panelBuilder.childLayoutCenter(); panelBuilder.width(SizeValue.px(INGREDIENT_IMAGE_SIZE + 8).toString()); panelBuilder.height(SizeValue.px(INGREDIENT_IMAGE_SIZE + 8).toString()); panelBuilder.style("nifty-panel-item"); panelBuilder.visibleToMouse(); ImageBuilder builder = new ImageBuilder(); panelBuilder.image(builder); Element ingredientObject = panelBuilder.build(niftyInstance, currentScreen, parentPanel); niftyInstance.subscribe(currentScreen, ingredientObject.getId(), NiftyMouseMovedEvent.class, mouseOverIngredientEventHandler); return ingredientObject; } @Override public boolean inputEvent(@Nonnull NiftyInputEvent inputEvent) { super.inputEvent(inputEvent); return true; } private void showIngredientAmount(@Nonnull Element ingredientElement, @Nonnull ItemCount count) { List<Element> elements = ingredientElement.getChildren(); if ((elements.size() > 2) || (elements.size() < 1)) { throw new InvalidParameterException("Something is wrong, parent element appears to be wrong."); } if (ItemCount.isGreaterOne(count)) { if (elements.size() == 2) { Label countLabel = elements.get(1).getNiftyControl(Label.class); countLabel.setText(Integer.toString(count.getValue())); } else { LabelBuilder labelBuilder = new LabelBuilder(); labelBuilder.text(Integer.toString(count.getValue())); labelBuilder.alignRight(); labelBuilder.valignBottom(); labelBuilder.marginBottom("4px"); labelBuilder.marginRight("4px"); labelBuilder.color("#ff0f"); labelBuilder.backgroundColor("#bb15"); labelBuilder.visibleToMouse(false); labelBuilder.build(niftyInstance, currentScreen, ingredientElement); } } else { if (elements.size() == 2) { niftyInstance.removeElement(currentScreen, elements.get(1)); } } } @Nonnull @SuppressWarnings("unchecked") private TreeBox<ListEntry> getItemList() { return getContent().findNiftyControl("#craftItemList", TreeBox.class); } @Override public void addCraftingItems(@Nonnull CraftingCategoryEntry... entries) { TreeBox<DialogCraftingControl.ListEntry> list = getItemList(); for (CraftingCategoryEntry entry : entries) { TreeItem<ListEntry> categoryItem = new TreeItem<ListEntry>(new ListEntry(entry)); for (CraftingItemEntry itemEntry : entry.getChildren()) { categoryItem.addTreeItem(new TreeItem<ListEntry>(new ListEntry(itemEntry))); } treeRootNode.addTreeItem(categoryItem); } list.setTree(treeRootNode); } @Override public void setProgress(float progress) { Element progressBar = getContent().findElementById("#progress"); progressBar.stopEffect(EffectEventId.onCustom); progressBar.getNiftyControl(Progress.class).setProgress(progress); } }
739bacee01b897660f66b6ebf23e4de4556b6227
74b460e67d96f420de0a9eab763bf1b0969d1aa3
/src/main/java/com/intellij/debugger/streams/trace/impl/interpret/OptionalTraceInterpreter.java
22f80fe555cb06bca23025decfa5bfefeadfc17d
[ "Apache-2.0" ]
permissive
bibaev/stream-debugger-plugin
aed15d0c64fd188c71361cfd71cef455aa6d779c
1e4184d83eb0bbc99e878fccb59236937d50c7a1
refs/heads/master
2021-03-22T02:56:04.819954
2018-01-11T12:50:46
2018-01-11T12:50:46
80,594,815
8
5
Apache-2.0
2018-01-11T12:50:46
2017-02-01T06:19:05
Java
UTF-8
Java
false
false
3,605
java
/* * Copyright 2000-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.debugger.streams.trace.impl.interpret; import com.intellij.debugger.streams.trace.CallTraceInterpreter; import com.intellij.debugger.streams.trace.TraceElement; import com.intellij.debugger.streams.trace.TraceInfo; import com.intellij.debugger.streams.trace.impl.TraceElementImpl; import com.intellij.debugger.streams.trace.impl.interpret.ex.UnexpectedValueException; import com.intellij.debugger.streams.trace.impl.interpret.ex.UnexpectedValueTypeException; import com.intellij.debugger.streams.wrapper.StreamCall; import com.sun.jdi.ArrayReference; import com.sun.jdi.BooleanValue; import com.sun.jdi.Value; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.Map; /** * @author Vitaliy.Bibaev */ public class OptionalTraceInterpreter implements CallTraceInterpreter { private final CallTraceInterpreter myPeekResolver = new SimplePeekCallTraceInterpreter(); @NotNull @Override public TraceInfo resolve(@NotNull StreamCall call, @NotNull Value value) { if (value instanceof ArrayReference) { final Value peeksResult = ((ArrayReference)value).getValue(0); final TraceInfo peekInfo = myPeekResolver.resolve(call, peeksResult); final Map<Integer, TraceElement> before = peekInfo.getValuesOrderBefore(); final Value optionalTrace = ((ArrayReference)value).getValue(1); final Value optionalValue = getOptionalValue(optionalTrace); if (optionalValue == null) { return new ValuesOrderInfo(call, before, Collections.emptyMap()); } final TraceElementImpl element = new TraceElementImpl(Integer.MAX_VALUE - 1, optionalValue); return new ValuesOrderInfo(call, before, Collections.singletonMap(element.getTime(), element)); } throw new UnexpectedValueException("trace termination with optional result must be an array value"); } @Nullable private static Value getOptionalValue(@NotNull Value optionalTrace) { if (!(optionalTrace instanceof ArrayReference)) { throw new UnexpectedValueTypeException("optional trace must be an array value"); } final ArrayReference trace = (ArrayReference)optionalTrace; if (!optionalIsPresent(trace)) { return null; } final Value value = trace.getValue(1); if (value instanceof ArrayReference) { return ((ArrayReference)value).getValue(0); } throw new UnexpectedValueTypeException("unexpected format for an optional value"); } private static boolean optionalIsPresent(@NotNull ArrayReference optionalTrace) { final Value isPresentFlag = optionalTrace.getValue(0); if (isPresentFlag instanceof ArrayReference) { final Value isPresentValue = ((ArrayReference)isPresentFlag).getValue(0); if (isPresentValue instanceof BooleanValue) { return ((BooleanValue)isPresentValue).value(); } } throw new UnexpectedValueTypeException("unexpected format for optional isPresent value"); } }
16a663f639193d9abcaf3b7915075e80a3584b3b
670da1ba25c83a8cb11b554416650f05f0a1a835
/app/src/main/java/com/example/kuybeer26092016/lionmonitoringdemo/activitys/HistoryActivity.java
55e7c21bca0349e18b03c719776583887ab3dbf6
[]
no_license
13dec2537/LionMonitoringDemo
67f0a22a31cd65c454007c98d5219738da67142f
997fe5d2a0dbae40df03c318995143147f1423dd
refs/heads/master
2021-01-12T15:59:02.052510
2016-11-02T12:13:09
2016-11-02T12:13:09
69,327,103
0
0
null
null
null
null
UTF-8
Java
false
false
7,814
java
package com.example.kuybeer26092016.lionmonitoringdemo.activitys; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Typeface; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.View; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import com.example.kuybeer26092016.lionmonitoringdemo.R; import com.example.kuybeer26092016.lionmonitoringdemo.adapters.AdapterHistory; import com.example.kuybeer26092016.lionmonitoringdemo.manager.ManagerRetrofit; import com.example.kuybeer26092016.lionmonitoringdemo.models.Mis_history; import com.squareup.picasso.MemoryPolicy; import com.squareup.picasso.NetworkPolicy; import com.squareup.picasso.Picasso; import java.util.List; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class HistoryActivity extends AppCompatActivity { private SharedPreferences spApp_Gone; private SharedPreferences.Editor editor_App_Gone; private static SharedPreferences sp; private static SharedPreferences.Editor editor; private static final String IMAGEURL = "http://www.thaidate4u.com/service/json/img/"; private Toolbar toolbar; private RecyclerView mRecyclerView; private ManagerRetrofit mManeger; private AdapterHistory mAdapter; private Thread thread; /************** Global *****************************/ private ProgressBar progressBar; private String mMo_id, mMc_name, mMc_id, mMin, mMax, mPram,mAnim; private TextView mProcessname,mParametername,mStandardvalue,mHeadername; private ImageView mImageToobar; /************** Global *****************************/ @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_history); setIntents(); setAnimation(); setSharedPreferences(); } private void setAnimation() { this.overridePendingTransition(R.anim.anim_silde_out_left,R.anim.anim_silde_out_left); if(mAnim.equals("1")){ this.overridePendingTransition(R.anim.anim_silde_out_left,R.anim.anim_silde_out_left); }else if(mAnim.equals("2")){ this.overridePendingTransition(R.anim.anim_silde_in_left,R.anim.anim_silde_in_left); } } private void setIntents() { mAnim = getIntent().getExtras().getString("Ianim",""); Intent call = getIntent(); if(call != null){ mMc_name = call.getStringExtra("mc_name"); mMc_id = call.getStringExtra("mc_id"); mPram = call.getStringExtra("mo_pram"); mMin = call.getStringExtra("mo_min"); mMax= call.getStringExtra("mo_max"); } } private void setSharedPreferences() { spApp_Gone = getSharedPreferences("App_Gone", Context.MODE_PRIVATE); editor_App_Gone = spApp_Gone.edit(); sp = getSharedPreferences("DataAccount",Context.MODE_PRIVATE); editor = sp.edit(); } @Override public void onStart() { super.onStart(); editor_App_Gone.putString("History_Gone" , "0"); editor_App_Gone.commit(); setToolbar(); setUsingClass(); setFindbyid(); setRecyclerView(); setXML(); /************** put Data to XML *****************************/ thread = new Thread() { @Override public void run() { try { while(true) { CallData(); sleep(5000); } } catch (InterruptedException e) { e.printStackTrace(); } } }; thread.start(); } private void setXML() { mHeadername.setText(mMc_name.toUpperCase()); mProcessname.setText(mMc_name.toUpperCase()); mParametername.setText(mPram.toUpperCase()); mStandardvalue.setText(mMin+mMax); Picasso.with(this).load(IMAGEURL + mMc_id + ".jpg") .memoryPolicy(MemoryPolicy.NO_CACHE) .networkPolicy(NetworkPolicy.NO_CACHE) .resize(128, 128) .centerCrop() .into(mImageToobar); } private void setRecyclerView() { mRecyclerView.setHasFixedSize(true); mRecyclerView.setRecycledViewPool(new RecyclerView.RecycledViewPool()); mRecyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); mRecyclerView.setAdapter(mAdapter); } private void setUsingClass() { mManeger = new ManagerRetrofit(); mAdapter = new AdapterHistory(); } private void setToolbar() { toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle(mMc_name); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(HistoryActivity.this,DescripActivity.class); i.putExtra("mc_name",mMc_name); i.putExtra("mc_id",mMc_id); i.putExtra("Ianim","2"); startActivity(i); finish(); } }); } private void setFindbyid() { progressBar = (ProgressBar) findViewById(R.id.progressBar); mHeadername = (TextView)findViewById(R.id.XML_Headername); mProcessname = (TextView) findViewById(R.id.XML_Processname); mParametername = (TextView)findViewById(R.id.XML_Parametername); mStandardvalue = (TextView)findViewById(R.id.XML_Standardvalue); mImageToobar = (ImageView) findViewById(R.id.imageToobar); mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView); } @Override public void onBackPressed() { super.onBackPressed(); thread.interrupt(); Intent i = new Intent(HistoryActivity.this,DescripActivity.class); i.putExtra("Ianim","2"); i.putExtra("mc_name",mMc_name); i.putExtra("mc_id",mMc_id); editor.putBoolean("Runanim",true); editor.commit(); startActivity(i); finish(); } private void CallData() { Call<List<Mis_history>> call = mManeger.getmService().Callback_History(mPram); call.enqueue(new Callback<List<Mis_history>>() { @Override public void onResponse(Call<List<Mis_history>> call, Response<List<Mis_history>> response) { if (response.isSuccessful()) { progressBar.setVisibility(View.GONE); List<Mis_history> Listhistory = response.body(); mAdapter.addList(Listhistory); if(Listhistory.size() == 0){ mRecyclerView.setBackgroundResource(R.drawable.notthingfound); } } } @Override public void onFailure(Call<List<Mis_history>> call, Throwable t) { } }); } @Override protected void onStop() { super.onStop(); thread.interrupt(); editor_App_Gone.putString("History_Gone" , "1"); editor_App_Gone.commit(); } @Override protected void onResume() { super.onResume(); setIntents(); } }
b6a2d2be4ca0db2fa7848fb0ddf95b266315a78c
b78567357a72f0c9d8478c2598c0dc99f11713ed
/src/com/ithoughts/twentyonedays/EditListActivity.java
abbed6c0dcc2a46f46eb98505242b3faac999be8
[]
no_license
joelewis/21days
79993a6af117cf06e71357a32d63139c384f4f4b
f47fc698037004507192ea313f5fc610242aa5b5
refs/heads/master
2021-01-23T11:49:30.178123
2013-12-03T19:06:25
2013-12-03T19:06:25
11,198,181
1
1
null
null
null
null
UTF-8
Java
false
false
8,495
java
package com.ithoughts.twentyonedays; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import com.ithoughts.twentyonedays.LaunchActivity.AddTask; import com.ithoughts.twentyonedays.LaunchActivity.UpdateTask; import android.app.ActionBar; import android.app.Activity; import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app.NavUtils; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.AdapterView.OnItemClickListener; public class EditListActivity extends Activity { DataShop datashop; Context context = this; ListView listView; int id; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit_list); // Show the Up button in the action bar. setupActionBar(); ActionBar actionBar = getActionBar(); actionBar.setTitle("Edit Activity"); actionBar.setSubtitle("Touch activity to edit"); id = getIntent().getExtras().getInt("id"); new QueryDb().execute(); } /** * Set up the {@link android.app.ActionBar}. */ private void setupActionBar() { getActionBar().setDisplayHomeAsUpEnabled(true); } class QueryDb extends AsyncTask<Void, Void, Void> { ArrayList<TaskPlus> tasks = new ArrayList<TaskPlus>(); @Override protected Void doInBackground(Void... objects) { datashop = new DataShop(context); datashop.open(); tasks = datashop.get_all_tasks(); datashop.close(); return null; } @Override protected void onPostExecute(final Void unused){ //update UI with my objects updateUi(tasks); } } public void updateUi(ArrayList<TaskPlus> tasks) { ListView lv = (ListView) findViewById(R.id.task_list); listView = lv; ArrayAdapter<TaskPlus> adapter = new ArrayAdapter<TaskPlus>(this, android.R.layout.simple_list_item_1, tasks); lv.setAdapter(adapter); lv.setOnItemClickListener(new OnItemClickListener() { //lv.setOnItemClickListener(new OnItemClickListener() { // public boolean onGroupClick(ExpandableListView arg0, View arg1, int arg2, long arg3) { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ArrayAdapter<TaskPlus> adapter1 = (ArrayAdapter<TaskPlus>) listView.getAdapter(); TaskPlus task = (TaskPlus) parent.getAdapter().getItem(position); int itemid = task.id; System.out.println("id: " + itemid); Intent inten1=new Intent(getBaseContext(), EditActivity.class); inten1.putExtra("id", itemid); startActivityForResult(inten1, 1); } }); } protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 1) { if(resultCode == RESULT_OK){ System.out.println("back to caller..."); int id = data.getExtras().getInt("id"); long alarmTime = (data.getIntExtra("alarm-hour", 9) * 100) + data.getIntExtra("alarm-minute", 30); long initdate = Calendar.getInstance().getTimeInMillis(); Calendar cal_now = Calendar.getInstance(); long ms = data.getExtras().getLong("mss"); cal_now.setTimeInMillis(ms); Calendar cal_alarm = Calendar.getInstance(); cal_alarm.set(Calendar.HOUR_OF_DAY, cal_now.get(Calendar.HOUR_OF_DAY)); cal_alarm.set(Calendar.MINUTE, cal_now.get(Calendar.MINUTE)); scheduleAlarmReceiver(cal_alarm, id); new UpdateTask().execute(id, initdate, data.getStringExtra("name"), data.getBooleanArrayExtra("days"), ms); } if (resultCode == RESULT_CANCELED) { //Write your code if there's no result } } if (requestCode == 2) { if(resultCode == RESULT_OK){ } if (resultCode == RESULT_CANCELED) { //Write your code if there's no result } } }//onActivityResult class UpdateTask extends AsyncTask<Object, Void, Void> { TaskPlus task1; @Override protected Void doInBackground(Object... objects) { datashop = new DataShop(context); datashop.open(); //tasks = datashop.get_all_tasks(); //datashop.close(); /* int id = (Integer) objects[0]; long[] ids = new long[1]; ids[0] = id; datashop.deleteMultipleTasks(ids); datashop.deleteNotify(ids); datashop.deleteTaskDays(ids); String name = (String) objects[2]; boolean[] days = (boolean[]) objects[3]; long initdate = (Long) objects[1]; //long alarmTime = (Long) objects[0]; */ int id = (Integer) objects[0]; String taskName = (String) objects[2]; long alarmTime = (Long) objects[4]; boolean[] days = (boolean[]) objects[3]; long initdate = (Long) objects[1]; System.out.println("alarmTime" + alarmTime); for(int i=0; i<days.length; i++) { System.out.println("day[i]" + days[i]); } datashop.update_task(taskName, alarmTime, initdate, days, id); //Log.i("async", "name: " + name+" itemlength: " + days.length); //task1 = task; return null; } @Override protected void onPostExecute(final Void unused){ //update UI with my objects //updateUi(tasks); ListView lv = (ListView) findViewById(R.id.task_list); ArrayAdapter<TaskPlus> adapter = (ArrayAdapter<TaskPlus> )lv.getAdapter(); //adapter.add(task1); adapter.notifyDataSetChanged(); } } public void scheduleAlarmReceiver(Calendar cal_alarm, int id) { AlarmManager alarmMgr = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE); PendingIntent pendingIntent = PendingIntent.getBroadcast(this, id, new Intent(this, HabitatorAlarmReceiver.class).putExtra("id", id), PendingIntent.FLAG_CANCEL_CURRENT); Date dat = new Date();//initializes to now //Calendar cal_alarm = Calendar.getInstance(); Calendar cal_now = Calendar.getInstance(); cal_now.setTime(dat); //cal_alarm.setTime(dat); //cal_alarm.setTimeZone(TimeZone.getTimeZone("GMT")); //cal_alarm.set(Calendar.HOUR_OF_DAY,);//set the alarm time //cal_alarm.set(Calendar.MINUTE, Constants.minutes); //cal_alarm.set(Calendar.SECOND, Constants.seconds); if(cal_alarm.before(cal_now)){//if its in the past increment cal_alarm.add(Calendar.DATE,1); Log.i("","cal_alarm is in past"); } alarmMgr.setRepeating(AlarmManager.RTC_WAKEUP, cal_alarm.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pendingIntent); Log.i("alarm", "alarm set@ "+ "now hour|day: "+ cal_now.get(Calendar.HOUR_OF_DAY)+"|"+ cal_now.get(Calendar.DATE) + "alarm hour|min|date: "+ cal_alarm.get(Calendar.HOUR_OF_DAY) +"|"+cal_alarm.get(Calendar.MINUTE) +"|"+cal_alarm.get(Calendar.DATE) ); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.edit_list, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } }
072abcc72172e5c589aef4b7f5535f533667896d
fc59aeeb55577739535facc80a2b2c62a4fc9d2c
/src/main/java/jdk/com/sun/corba/se/spi/activation/InvalidORBidHelper.java
215445ef2814db799029a85a9981bcb7576dc60f
[]
no_license
goubo/javaDemo
8dc1037b824ce71fab4b246fc437fa8aaa66b859
35234d9a2b410e17f1672c0b05d2f370b85f806a
refs/heads/main
2023-03-12T08:27:41.194350
2021-02-24T02:08:14
2021-02-24T02:08:14
340,292,219
1
0
null
null
null
null
UTF-8
Java
false
false
2,296
java
package com.sun.corba.se.spi.activation; /** * com/sun/corba/se/spi/activation/InvalidORBidHelper.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from /jenkins/workspace/8-2-build-macosx-x86_64/jdk8u271/605/corba/src/share/classes/com/sun/corba/se/spi/activation/activation.idl * Wednesday, September 16, 2020 4:54:59 PM GMT */ abstract public class InvalidORBidHelper { private static String _id = "IDL:activation/InvalidORBid:1.0"; public static void insert (org.omg.CORBA.Any a, com.sun.corba.se.spi.activation.InvalidORBid that) { org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); a.type (type ()); write (out, that); a.read_value (out.create_input_stream (), type ()); } public static com.sun.corba.se.spi.activation.InvalidORBid extract (org.omg.CORBA.Any a) { return read (a.create_input_stream ()); } private static org.omg.CORBA.TypeCode __typeCode = null; private static boolean __active = false; synchronized public static org.omg.CORBA.TypeCode type () { if (__typeCode == null) { synchronized (org.omg.CORBA.TypeCode.class) { if (__typeCode == null) { if (__active) { return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); } __active = true; org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [0]; org.omg.CORBA.TypeCode _tcOf_members0 = null; __typeCode = org.omg.CORBA.ORB.init ().create_exception_tc (com.sun.corba.se.spi.activation.InvalidORBidHelper.id (), "InvalidORBid", _members0); __active = false; } } } return __typeCode; } public static String id () { return _id; } public static com.sun.corba.se.spi.activation.InvalidORBid read (org.omg.CORBA.portable.InputStream istream) { com.sun.corba.se.spi.activation.InvalidORBid value = new com.sun.corba.se.spi.activation.InvalidORBid (); // read and discard the repository ID istream.read_string (); return value; } public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.corba.se.spi.activation.InvalidORBid value) { // write the repository ID ostream.write_string (id ()); } }
b98d894f39622384544f1b30100bbf215b1912dd
689b0ce864edb4126a848279f8af27d73bdc8723
/src/test/java/com/wrike/WrikeIndexPage.java
db698c4fcc09eb4cdb663c4c46622f95f9fc5c00
[]
no_license
BorisPetrianik/test-site
1d1e39bf4ccf21f5b345b8b7d7960125b8985562
6e7720b80a19eb3cecfba88ca514ad581e14908d
refs/heads/master
2021-07-08T13:11:27.613980
2019-09-13T12:42:54
2019-09-13T12:42:54
201,132,295
0
0
null
null
null
null
UTF-8
Java
false
false
1,274
java
package com.wrike; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; public class WrikeIndexPage { private WebElement content; private boolean isMobile = true; public WrikeIndexPage(WebDriver driver) { driver.get("https://wrike.com"); this.content = driver.findElement(By.xpath("/html")); if (driver.manage().window().getSize().width > 1023) { this.isMobile = false; } } public WrikeGetStartedPage getStarted() { String xPathSelector = isMobile ? "/html/body/div[1]/header/div[2]/div[5]/nav/div/button" : "/html/body/div[1]/header/div[3]/div[2]/div/div/div[2]/div/form/button"; if (isMobile) { content.findElement(By.xpath("/html/body/div[1]/header/div[2]/div[1]/span")).click(); } // Revamp required // Advice further improvement try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } WebElement getStartedButton = content.findElement(By.xpath(xPathSelector)); getStartedButton.click(); return new WrikeGetStartedPage(content.findElement(By.xpath("//*[@id=\"modal-pro\"]/form"))); } }
966e5a4fe195af2265d5f2c9918f752bd20deaa8
1833be0ae3281e18bfca09fa146f47d57c29a3cf
/dangyeol/src/main/java/com/test/dangyel/dto/testController.java
79406e48372cd3c02b31b598d511552bce83a7c1
[]
no_license
dangyeol/dangyeol
09681ea7c6b829f7264650f2bd56ff960e6bad67
69ef5f108b07594c67029582b771b4f3e8f6f3bb
refs/heads/master
2021-01-20T17:21:36.419375
2017-05-26T09:44:56
2017-05-26T09:44:56
89,780,776
0
0
null
null
null
null
ISO-8859-7
Java
false
false
1,674
java
package com.test.dangyel.dto; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.MongoTemplate; public class testController { private MongoTemplate mongoTemplate; public testController() { String mongoContextPath = "mongoContext.xml"; AbstractApplicationContext ctx = new ClassPathXmlApplicationContext(mongoContextPath); mongoTemplate = (MongoTemplate) ctx.getBean("mongoTemplate"); } // public static void main(String[] args) { // testController mongoTest = new testController(); // System.out.println(mongoTest.mongoTemplate); // mongoTest.insertTestData(); // } private void insertTestData() { MongoTestVO testVO = new MongoTestVO(); testVO.setName("?‘˜λ¦?!!"); testVO.setAddress("κ³ κΈΈ?™ μ§? 1?–΅?…„? „ ?–΄?”˜κ°?..."); // testVO?— ?žˆ?Š” ?‚΄?š©?„ "person" Collection?— ?„£κ² λ‹€. mongoTemplate.insert(testVO, "person"); } private class MongoTestVO { // λ°˜λ“œ?‹œ id annotation?΄ λΆ™μ? id λ³??ˆ˜κ°? ?•„?š”! @Id private String id; private String name; private String address; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } } }
757d5de82a1be4e372e37904bb08b2e650a8c3c3
1eba8baf46122e5d7f7e0687bb243f4c782ec6b2
/Fonts/src/com/fonts/awesomefont/AwesomeFontUtil.java
1dfdfc9653a6c4c9928293a9f768c004f9b22116
[]
no_license
umarmansuri/imt-android
1bd312f29a0f692ce93da723f7a5db38d7749915
4af234accd5d92d1e4daba17d7b3b12daa070da9
refs/heads/master
2016-09-06T04:01:45.939883
2013-06-26T22:55:32
2013-06-26T22:55:32
41,660,773
0
0
null
null
null
null
UTF-8
Java
false
false
363
java
package com.fonts.awesomefont; import android.content.Context; import android.graphics.Typeface; public class AwesomeFontUtil { private static Typeface font; public static Typeface getFont(Context context) { if(font == null) { font = Typeface.createFromAsset(context.getAssets(), "fontawesome-webfont.ttf"); } return font; } }
46c93c992b7d4be708b7895a330e0f0b69293b1a
068370a87a0000415904039f34eda1a6099db098
/WS_adam/src/com/deimos/adam/AdamServer.java
a7fe71fa126a580ba4ea2435f1d95f4f8349e1b6
[]
no_license
crueda/WS_ADAM
0bf7f5f7bab020656033ddf071c6dafdbb5e020a
0bef0abb096ab146ed9c78a1a1c7c72ff94a5ebd
refs/heads/master
2016-09-10T18:49:45.982924
2013-03-15T12:02:34
2013-03-15T12:02:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,486
java
package com.deimos.adam; import javax.xml.ws.Endpoint; import com.deimos.adam.ws.RouteWS; import com.deimos.adam.ws.UserWS; /** * * @author CARM */ public class AdamServer { private static RouteWS routeWS = null; private static UserWS userWS = null; private static Endpoint endpointRoute = null; public static void main(String[] args) { routeWS = new RouteWS(); userWS = new UserWS(); startWebServices(); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { stopWebServices(); } }); } private static void startWebServices(){ System.out.println("Iniciando servicios de ruteo..."); startRouteWS(); System.out.println("Iniciando servicios del usuario..."); startUserWS(); //System.out.println("Iniciando servicios de informacion..."); //startInfoWS(); System.out.println("Servicios iniciados en puerto 5000"); } private static void startRouteWS(){ String webServLocalHostConfig="http://172.26.0.217:5000/routeWS"; endpointRoute = Endpoint.publish(webServLocalHostConfig, routeWS); } private static void startUserWS(){ String webServLocalHostConfig="http://172.26.0.217:5000/userWS"; endpointRoute = Endpoint.publish(webServLocalHostConfig, userWS); } private static void stopWebServices(){ System.out.println("Parando Servicios"); stopRouteWS(); System.out.println("Servicios detenidos"); } private static void stopRouteWS(){ endpointRoute.stop(); } }
6e5bc457ba7cc7abbba1e7b5aa3a06c278318a84
917e09c5d7ae77473832f0cc7872edff372fb3ec
/DualCamera21/libusbcamera/src/main/java/com/serenegiant/usbcamera/AbstractUVCCameraHandler.java
0318a0b09ed3e8fe6b8e87dbeb10a801d60f6111
[]
no_license
stephenshizl/UvcCamera-1
0ad67b78dcf701a41c9d72933d5bae08a4fcce85
3771a01ca6eac3e2276db408a6401f44c83265eb
refs/heads/master
2020-04-05T20:07:05.730279
2018-06-08T03:44:06
2018-06-08T03:44:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
18,448
java
/* * UVCCamera * library and sample to access to UVC web camera on non-rooted Android device * * Copyright (c) 2014-2017 saki [email protected] * * 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. * * All files in the folder are under this Apache License, Version 2.0. * Files in the libjpeg-turbo, libusb, libuvc, rapidjson folder * may have a different license, see the respective files. */ package com.serenegiant.usbcamera; import android.annotation.TargetApi; import android.app.Activity; import android.graphics.SurfaceTexture; import android.hardware.usb.UsbDevice; import android.media.MediaScannerConnection; import android.os.Build; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.util.Log; import android.view.Surface; import android.view.SurfaceHolder; import com.serenegiant.usb.IFrameCallback; import com.serenegiant.usb.Size; import com.serenegiant.usb.USBMonitor; import com.serenegiant.usb.UVCCamera; import com.serenegiant.widget.CameraViewInterface; import java.lang.ref.WeakReference; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.nio.ByteBuffer; import java.util.List; import java.util.Set; import java.util.concurrent.CopyOnWriteArraySet; public abstract class AbstractUVCCameraHandler extends Handler { private static final boolean DEBUG = true; // TODO set false on release private static final String TAG = "AbsUVCCameraHandler"; public interface CameraCallback { public void onOpen(); public void onClose(); public void onStartPreview(); public void onStopPreview(); public void onStartRecording(); public void onStopRecording(); public void onError(final Exception e); } public OnPreViewResultListener mPreviewListener; public interface OnPreViewResultListener{ void onPreviewResult(byte[] data); } private static final int MSG_OPEN = 0; private static final int MSG_CLOSE = 1; private static final int MSG_PREVIEW_START = 2; private static final int MSG_PREVIEW_STOP = 3; private static final int MSG_CAPTURE_STILL = 4; private static final int MSG_CAPTURE_START = 5; private static final int MSG_CAPTURE_STOP = 6; private static final int MSG_MEDIA_UPDATE = 7; private static final int MSG_RELEASE = 9; private final WeakReference<CameraThread> mWeakThread; private volatile boolean mReleased; protected AbstractUVCCameraHandler(final CameraThread thread) { mWeakThread = new WeakReference<CameraThread>(thread); } public int getWidth() { final CameraThread thread = mWeakThread.get(); return thread != null ? thread.getWidth() : 0; } public int getHeight() { final CameraThread thread = mWeakThread.get(); return thread != null ? thread.getHeight() : 0; } public boolean isOpened() { final CameraThread thread = mWeakThread.get(); return thread != null && thread.isCameraOpened(); } public boolean isPreviewing() { final CameraThread thread = mWeakThread.get(); return thread != null && thread.isPreviewing(); } public boolean isRecording() { final CameraThread thread = mWeakThread.get(); return thread != null && thread.isRecording(); } public boolean isEqual(final UsbDevice device) { final CameraThread thread = mWeakThread.get(); return (thread != null) && thread.isEqual(device); } protected boolean isCameraThread() { final CameraThread thread = mWeakThread.get(); return thread != null && (thread.getId() == Thread.currentThread().getId()); } protected boolean isReleased() { final CameraThread thread = mWeakThread.get(); return mReleased || (thread == null); } protected void checkReleased() { if (isReleased()) { throw new IllegalStateException("already released"); } } public void open(final USBMonitor.UsbControlBlock ctrlBlock) { checkReleased(); sendMessage(obtainMessage(MSG_OPEN, ctrlBlock)); } public void close() { if (DEBUG) Log.v(TAG, "close:"); if (isOpened()) { stopPreview(); sendEmptyMessage(MSG_CLOSE); } if (DEBUG) Log.v(TAG, "close:finished"); } // 切换分辨率 public void resize(final int width, final int height) { checkReleased(); throw new UnsupportedOperationException("does not support now"); } // 开启Camera预览 public void startPreview(final Object surface) { checkReleased(); if (!((surface instanceof SurfaceHolder) || (surface instanceof Surface) || (surface instanceof SurfaceTexture))) { throw new IllegalArgumentException("surface should be one of SurfaceHolder, Surface or SurfaceTexture: "+surface); } sendMessage(obtainMessage(MSG_PREVIEW_START, surface)); } public void setOnPreViewResultListener(OnPreViewResultListener listener) { mPreviewListener = listener; } // 关闭Camera预览 public void stopPreview() { if (DEBUG) Log.v(TAG, "stopPreview:"); removeMessages(MSG_PREVIEW_START); if (isPreviewing()) { final CameraThread thread = mWeakThread.get(); if (thread == null) return; synchronized (thread.mSync) { sendEmptyMessage(MSG_PREVIEW_STOP); if (!isCameraThread()) { // wait for actually preview stopped to avoid releasing Surface/SurfaceTexture // while preview is still running. // therefore this method will take a time to execute try { thread.mSync.wait(); } catch (final InterruptedException e) { } } } } if (DEBUG) Log.v(TAG, "stopPreview:finished"); } public List<Size> getSupportedPreviewSizes(){ return mWeakThread.get().getSupportedSizes(); } public void release() { mReleased = true; close(); sendEmptyMessage(MSG_RELEASE); } // 对外注册监听事件 public void addCallback(final CameraCallback callback) { checkReleased(); if (!mReleased && (callback != null)) { final CameraThread thread = mWeakThread.get(); if (thread != null) { thread.mCallbacks.add(callback); } } } public void removeCallback(final CameraCallback callback) { if (callback != null) { final CameraThread thread = mWeakThread.get(); if (thread != null) { thread.mCallbacks.remove(callback); } } } protected void updateMedia(final String path) { sendMessage(obtainMessage(MSG_MEDIA_UPDATE, path)); } public boolean checkSupportFlag(final long flag) { checkReleased(); final CameraThread thread = mWeakThread.get(); return thread != null && thread.mUVCCamera != null && thread.mUVCCamera.checkSupportFlag(flag); } public int getValue(final int flag) { checkReleased(); final CameraThread thread = mWeakThread.get(); final UVCCamera camera = thread != null ? thread.mUVCCamera : null; if (camera != null) { if (flag == UVCCamera.PU_BRIGHTNESS) { return camera.getBrightness(); } else if (flag == UVCCamera.PU_CONTRAST) { return camera.getContrast(); } } throw new IllegalStateException(); } public int setValue(final int flag, final int value) { checkReleased(); final CameraThread thread = mWeakThread.get(); final UVCCamera camera = thread != null ? thread.mUVCCamera : null; if (camera != null) { if (flag == UVCCamera.PU_BRIGHTNESS) { camera.setBrightness(value); return camera.getBrightness(); } else if (flag == UVCCamera.PU_CONTRAST) { camera.setContrast(value); return camera.getContrast(); } } throw new IllegalStateException(); } public int resetValue(final int flag) { checkReleased(); final CameraThread thread = mWeakThread.get(); final UVCCamera camera = thread != null ? thread.mUVCCamera : null; if (camera != null) { if (flag == UVCCamera.PU_BRIGHTNESS) { camera.resetBrightness(); return camera.getBrightness(); } else if (flag == UVCCamera.PU_CONTRAST) { camera.resetContrast(); return camera.getContrast(); } } throw new IllegalStateException(); } @Override public void handleMessage(final Message msg) { final CameraThread thread = mWeakThread.get(); if (thread == null) return; switch (msg.what) { case MSG_OPEN: thread.handleOpen((USBMonitor.UsbControlBlock)msg.obj); break; case MSG_CLOSE: thread.handleClose(); break; case MSG_PREVIEW_START: thread.handleStartPreview(msg.obj); break; case MSG_PREVIEW_STOP: thread.handleStopPreview(); break; case MSG_CAPTURE_STILL: case MSG_CAPTURE_START: case MSG_CAPTURE_STOP: case MSG_MEDIA_UPDATE: break; case MSG_RELEASE: thread.handleRelease(); break; default: throw new RuntimeException("unsupported message:what=" + msg.what); } } public static final class CameraThread extends Thread { private static final String TAG_THREAD = "CameraThread"; private final Object mSync = new Object(); private final Class<? extends AbstractUVCCameraHandler> mHandlerClass; private final WeakReference<Activity> mWeakParent; private final WeakReference<CameraViewInterface> mWeakCameraView; private final int mEncoderType; private final Set<CameraCallback> mCallbacks = new CopyOnWriteArraySet<CameraCallback>(); private int mWidth, mHeight, mPreviewMode; private float mBandwidthFactor; private boolean mIsPreviewing; private AbstractUVCCameraHandler mHandler; // 处理与Camera相关的逻辑,比如获取byte数据流等 private UVCCamera mUVCCamera; /** 构造方法 * * clazz 继承于AbstractUVCCameraHandler * parent Activity子类 * cameraView 用于捕获静止图像 * encoderType 0表示使用MediaSurfaceEncoder;1表示使用MediaVideoEncoder, 2表示使用MediaVideoBufferEncoder * width 分辨率的宽 * height 分辨率的高 * format 颜色格式,0为FRAME_FORMAT_YUYV;1为FRAME_FORMAT_MJPEG * bandwidthFactor */ CameraThread(final Class<? extends AbstractUVCCameraHandler> clazz, final Activity parent, final CameraViewInterface cameraView, final int encoderType, final int width, final int height, final int format, final float bandwidthFactor) { super("CameraThread"); mHandlerClass = clazz; mEncoderType = encoderType; mWidth = width; mHeight = height; mPreviewMode = format; mBandwidthFactor = bandwidthFactor; mWeakParent = new WeakReference<>(parent); mWeakCameraView = new WeakReference<>(cameraView); } @Override protected void finalize() throws Throwable { Log.i(TAG, "CameraThread#finalize"); super.finalize(); } public AbstractUVCCameraHandler getHandler() { if (DEBUG) Log.v(TAG_THREAD, "getHandler:"); synchronized (mSync) { if (mHandler == null) try { mSync.wait(); } catch (final InterruptedException e) { } } return mHandler; } public int getWidth() { synchronized (mSync) { return mWidth; } } public int getHeight() { synchronized (mSync) { return mHeight; } } public boolean isCameraOpened() { synchronized (mSync) { return mUVCCamera != null; } } public boolean isPreviewing() { synchronized (mSync) { return mUVCCamera != null && mIsPreviewing; } } public boolean isRecording() { return false; } public boolean isEqual(final UsbDevice device) { return (mUVCCamera != null) && (mUVCCamera.getDevice() != null) && mUVCCamera.getDevice().equals(device); } public void handleOpen(final USBMonitor.UsbControlBlock ctrlBlock) { if (DEBUG) Log.v(TAG_THREAD, "handleOpen:"); handleClose(); try { final UVCCamera camera = new UVCCamera(); camera.open(ctrlBlock); synchronized (mSync) { mUVCCamera = camera; } callOnOpen(); } catch (final Exception e) { callOnError(e); } if (DEBUG) Log.i(TAG, "supportedSize:" + (mUVCCamera != null ? mUVCCamera.getSupportedSize() : null)); } public void handleClose() { if (DEBUG) Log.v(TAG_THREAD, "handleClose:"); final UVCCamera camera; synchronized (mSync) { camera = mUVCCamera; mUVCCamera = null; } if (camera != null) { camera.stopPreview(); camera.destroy(); callOnClose(); } } public void handleStartPreview(final Object surface) { if (DEBUG) Log.v(TAG_THREAD, "handleStartPreview:"); if ((mUVCCamera == null) || mIsPreviewing) return; try { mUVCCamera.setPreviewSize(mWidth, mHeight, 1, 31, mPreviewMode, mBandwidthFactor); // 获取USB Camera预览数据,使用NV21颜色会失真 // mUVCCamera.setFrameCallback(mIFrameCallback, UVCCamera.PIXEL_FORMAT_NV21); Log.e("DDDD","==x==="+mIFrameCallback+"mUVCCamera="+mUVCCamera); mUVCCamera.setFrameCallback(mIFrameCallback, UVCCamera.PIXEL_FORMAT_YUV420SP); } catch (final IllegalArgumentException e) { try { // fallback to YUV mode mUVCCamera.setPreviewSize(mWidth, mHeight, 1, 31, UVCCamera.DEFAULT_PREVIEW_MODE, mBandwidthFactor); } catch (final IllegalArgumentException e1) { callOnError(e1); return; } } if (surface instanceof SurfaceHolder) { mUVCCamera.setPreviewDisplay((SurfaceHolder)surface); } if (surface instanceof Surface) { mUVCCamera.setPreviewDisplay((Surface)surface); } else { mUVCCamera.setPreviewTexture((SurfaceTexture)surface); } mUVCCamera.startPreview(); mUVCCamera.updateCameraParams(); synchronized (mSync) { mIsPreviewing = true; } callOnStartPreview(); } public void handleStopPreview() { if (DEBUG) Log.v(TAG_THREAD, "handleStopPreview:"); if (mIsPreviewing) { if (mUVCCamera != null) { mUVCCamera.stopPreview(); mUVCCamera.setFrameCallback(null, 0); } synchronized (mSync) { mIsPreviewing = false; mSync.notifyAll(); } callOnStopPreview(); } if (DEBUG) Log.v(TAG_THREAD, "handleStopPreview:finished"); } private final IFrameCallback mIFrameCallback = new IFrameCallback() { @Override public void onFrame(final ByteBuffer frame) { int len = frame.capacity(); final byte[] yuv = new byte[len]; frame.get(yuv); // nv21 yuv data callback if(mHandler.mPreviewListener != null) { mHandler.mPreviewListener.onPreviewResult(yuv); } } }; @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public void handleUpdateMedia(final String path) { if (DEBUG) Log.v(TAG_THREAD, "handleUpdateMedia:path=" + path); final Activity parent = mWeakParent.get(); final boolean released = (mHandler == null) || mHandler.mReleased; if (parent != null && parent.getApplicationContext() != null) { try { if (DEBUG) Log.i(TAG, "MediaScannerConnection#scanFile"); MediaScannerConnection.scanFile(parent.getApplicationContext(), new String[]{ path }, null, null); } catch (final Exception e) { Log.e(TAG, "handleUpdateMedia:", e); } if (released || parent.isDestroyed()) handleRelease(); } else { Log.w(TAG, "MainActivity already destroyed"); // give up to add this movie to MediaStore now. // Seeing this movie on Gallery app etc. will take a lot of time. handleRelease(); } } public void handleRelease() { handleClose(); mCallbacks.clear(); mHandler.mReleased = true; Looper.myLooper().quit(); if (DEBUG) Log.v(TAG_THREAD, "handleRelease:finished"); } // �Զ��Խ� public void handleCameraFoucs() { if (DEBUG) Log.v(TAG_THREAD, "handleStartPreview:"); if ((mUVCCamera == null) || !mIsPreviewing) return; mUVCCamera.setAutoFocus(true); } public List<Size> getSupportedSizes() { if ((mUVCCamera == null) || !mIsPreviewing) return null; return mUVCCamera.getSupportedSizeList(); } @Override public void run() { Looper.prepare(); AbstractUVCCameraHandler handler = null; try { final Constructor<? extends AbstractUVCCameraHandler> constructor = mHandlerClass.getDeclaredConstructor(CameraThread.class); handler = constructor.newInstance(this); } catch (final NoSuchMethodException e) { Log.w(TAG, e); } catch (final IllegalAccessException e) { Log.w(TAG, e); } catch (final InstantiationException e) { Log.w(TAG, e); } catch (final InvocationTargetException e) { Log.w(TAG, e); } if (handler != null) { synchronized (mSync) { mHandler = handler; mSync.notifyAll(); } Looper.loop(); if (mHandler != null) { mHandler.mReleased = true; } } mCallbacks.clear(); synchronized (mSync) { mHandler = null; mSync.notifyAll(); } } private void callOnOpen() { for (final CameraCallback callback: mCallbacks) { try { callback.onOpen(); } catch (final Exception e) { mCallbacks.remove(callback); Log.w(TAG, e); } } } private void callOnClose() { for (final CameraCallback callback: mCallbacks) { try { callback.onClose(); } catch (final Exception e) { mCallbacks.remove(callback); Log.w(TAG, e); } } } private void callOnStartPreview() { for (final CameraCallback callback: mCallbacks) { try { callback.onStartPreview(); } catch (final Exception e) { mCallbacks.remove(callback); Log.w(TAG, e); } } } private void callOnStopPreview() { for (final CameraCallback callback: mCallbacks) { try { callback.onStopPreview(); } catch (final Exception e) { mCallbacks.remove(callback); Log.w(TAG, e); } } } private void callOnStartRecording() { for (final CameraCallback callback: mCallbacks) { try { callback.onStartRecording(); } catch (final Exception e) { mCallbacks.remove(callback); Log.w(TAG, e); } } } private void callOnStopRecording() { for (final CameraCallback callback: mCallbacks) { try { callback.onStopRecording(); } catch (final Exception e) { mCallbacks.remove(callback); Log.w(TAG, e); } } } private void callOnError(final Exception e) { for (final CameraCallback callback: mCallbacks) { try { callback.onError(e); } catch (final Exception e1) { mCallbacks.remove(callback); Log.w(TAG, e); } } } } }
0ec352caba050263b7603a141a49966fd77b92b0
cfe7d471a902b98263b9ef4fbc179b472501aa48
/task13/task1324/Solution.java
531c4219c41bb376e77f6e6fc2d4d4e1c8dbf314
[]
no_license
alekseykravtchuk/Javarush-task
3d8b4868356726290917574730a9a88dc753af64
915db88c81e6029ed7f3b6f813b05b777da1c139
refs/heads/master
2020-04-27T08:55:52.756009
2019-05-13T19:17:58
2019-05-13T19:17:58
174,192,354
2
0
null
2019-05-13T19:17:59
2019-03-06T17:46:03
Java
UTF-8
Java
false
false
529
java
package com.javarush.task.task13.task1324; import java.awt.*; /* Один метод в классе */ public class Solution { public static void main(String[] args) throws Exception { } public interface Animal { default Color getColor(){ return null; } default Integer getAge(){ int age = 0; return age; } } public static class Fox implements Animal { public String getName() { return "Fox"; } } }
3f7ce9d94cf00cdeba5c0e43f11024f176e3b7c3
790ff637d1d4dca295c24df792ba4be35d6f14d2
/src/main/java/home/Task4/CircleFactory.java
cefe04ab0c2fc9aa21587513139bf436871a1592
[]
no_license
dkorolyuk/helloworld
efab0fd05b1ca8a16323374e803b98c1dc4c5472
944ee1af9c26841ab96013fe072982cadaaad680
refs/heads/master
2021-04-30T12:49:18.909759
2018-04-04T13:25:12
2018-04-04T13:25:12
121,282,708
0
1
null
2018-03-04T21:31:20
2018-02-12T18:07:29
Java
UTF-8
Java
false
false
325
java
package home.Task4; public class CircleFactory extends ShapeFactory { private int getRadius() { System.out.println("Введите радиус"); return scan.nextInt(); } @Override public Circle getShape(){ int radius = getRadius(); return new Circle(radius); } }
c48d5a1e25eb02564a32dff43ef3f99258e72053
2ed70fd979f9a55496f8ea4d11f7acc84f684580
/feign-demo/src/test/java/com/rh/project/feigndemo/FeignDemoApplicationTests.java
63be9e3e31bb0a07ab60428911af179053a6b715
[]
no_license
Ruh15/examples
278311898f9fee2321752e0cd343dac19883938a
bcd502e74ae4017d31478c2f7845796bf51ce4a5
refs/heads/master
2022-12-23T08:00:22.041744
2021-02-23T00:50:08
2021-02-23T00:50:08
156,630,932
0
1
null
2022-12-16T03:10:19
2018-11-08T01:15:25
Java
UTF-8
Java
false
false
353
java
package com.rh.project.feigndemo; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class FeignDemoApplicationTests { @Test public void contextLoads() { } }
22afbcd618ff8e8b3fac067a9b8f355431b22415
2cd76b118aa3e0e5073b2c8f4ef0eccca2d31fbe
/tts/AudioPlayer.java
f9f6e46604061c8c9af628df9075f9ab0890af38
[]
no_license
babaoye/speechSchedulerProgram
c4d6147e2d1966cf5e9eed31ed21245ff217b6d6
7d989f0af0aaaeadee3ff25b398867a1dfcadf5b
refs/heads/master
2020-08-06T04:08:15.709031
2019-10-04T14:05:16
2019-10-04T14:05:16
212,827,036
0
1
null
null
null
null
UTF-8
Java
false
false
8,042
java
package tts; import java.io.File; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.DataLine; import javax.sound.sampled.FloatControl; import javax.sound.sampled.LineListener; import javax.sound.sampled.SourceDataLine; import javax.sound.sampled.UnsupportedAudioFileException; import marytts.util.data.audio.MonoAudioInputStream; import marytts.util.data.audio.StereoAudioInputStream; /** * A single Thread Audio Player Once used it has to be initialised again * * @author GOXR3PLUS * */ public class AudioPlayer extends Thread { public static final int MONO = 0; public static final int STEREO = 3; public static final int LEFT_ONLY = 1; public static final int RIGHT_ONLY = 2; private AudioInputStream ais; private LineListener lineListener; private SourceDataLine line; private int outputMode; private Status status = Status.WAITING; private boolean exitRequested = false; private float gain = 1.0f; /** * The status of the player * * @author GOXR3PLUS * */ public enum Status { /** * */ WAITING, /** * */ PLAYING; } /** * AudioPlayer which can be used if audio stream is to be set separately, * using setAudio(). * */ public AudioPlayer() { } /** * @param audioFile * @throws IOException * @throws UnsupportedAudioFileException */ public AudioPlayer(File audioFile) throws IOException, UnsupportedAudioFileException { this.ais = AudioSystem.getAudioInputStream(audioFile); } /** * @param ais */ public AudioPlayer(AudioInputStream ais) { this.ais = ais; } /** * @param audioFile * @param lineListener * @throws IOException * @throws UnsupportedAudioFileException */ public AudioPlayer(File audioFile, LineListener lineListener) throws IOException, UnsupportedAudioFileException { this.ais = AudioSystem.getAudioInputStream(audioFile); this.lineListener = lineListener; } /** * @param ais * @param lineListener */ public AudioPlayer(AudioInputStream ais, LineListener lineListener) { this.ais = ais; this.lineListener = lineListener; } /** * @param audioFile * @param line * @param lineListener * @throws IOException * @throws UnsupportedAudioFileException */ public AudioPlayer(File audioFile, SourceDataLine line, LineListener lineListener) throws IOException, UnsupportedAudioFileException { this.ais = AudioSystem.getAudioInputStream(audioFile); this.line = line; this.lineListener = lineListener; } /** * @param ais * @param line * @param lineListener */ public AudioPlayer(AudioInputStream ais, SourceDataLine line, LineListener lineListener) { this.ais = ais; this.line = line; this.lineListener = lineListener; } /** * * @param audioFile * audiofile * @param line * line * @param lineListener * lineListener * @param outputMode * if MONO, force output to be mono; if STEREO, force output to * be STEREO; if LEFT_ONLY, play a mono signal over the left * channel of a stereo output, or mute the right channel of a * stereo signal; if RIGHT_ONLY, do the same with the right * output channel. * @throws IOException * IOException * @throws UnsupportedAudioFileException * UnsupportedAudioFileException */ public AudioPlayer(File audioFile, SourceDataLine line, LineListener lineListener, int outputMode) throws IOException, UnsupportedAudioFileException { this.ais = AudioSystem.getAudioInputStream(audioFile); this.line = line; this.lineListener = lineListener; this.outputMode = outputMode; } /** * * @param ais * ais * @param line * line * @param lineListener * lineListener * @param outputMode * if MONO, force output to be mono; if STEREO, force output to * be STEREO; if LEFT_ONLY, play a mono signal over the left * channel of a stereo output, or mute the right channel of a * stereo signal; if RIGHT_ONLY, do the same with the right * output channel. */ public AudioPlayer(AudioInputStream ais, SourceDataLine line, LineListener lineListener, int outputMode) { this.ais = ais; this.line = line; this.lineListener = lineListener; this.outputMode = outputMode; } /** * @param audio */ public void setAudio(AudioInputStream audio) { if (status == Status.PLAYING) { throw new IllegalStateException("Cannot set audio while playing"); } this.ais = audio; } /** * Cancel the AudioPlayer which will cause the Thread to exit */ public void cancel() { if (line != null) { line.stop(); } exitRequested = true; } /** * @return The SourceDataLine */ public SourceDataLine getLine() { return line; } /** * Returns the GainValue */ public float getGainValue() { return gain; } /** * Sets Gain value. Line should be opened before calling this method. Linear * scale 0.0 <--> 1.0 Threshold Coef. : 1/2 to avoid saturation. * * @param fGain */ public void setGain(float fGain) { // if (line != null) // System.out.println(((FloatControl) // line.getControl(FloatControl.Type.MASTER_GAIN)).getValue()) // Set the value gain = fGain; // Better type if (line != null && line.isControlSupported(FloatControl.Type.MASTER_GAIN)) ((FloatControl) line.getControl(FloatControl.Type.MASTER_GAIN)) .setValue((float) (20 * Math.log10(fGain <= 0.0 ? 0.0000 : fGain))); // OR (Math.log(fGain == 0.0 ? 0.0000 : fGain) / Math.log(10.0)) // if (line != null) // System.out.println(((FloatControl) // line.getControl(FloatControl.Type.MASTER_GAIN)).getValue()) } @Override public void run() { status = Status.PLAYING; AudioFormat audioFormat = ais.getFormat(); if (audioFormat.getChannels() == 1) { if (outputMode != 0) { ais = new StereoAudioInputStream(ais, outputMode); audioFormat = ais.getFormat(); } } else { assert audioFormat.getChannels() == 2 : "Unexpected number of channels: " + audioFormat.getChannels(); if (outputMode == 0) { ais = new MonoAudioInputStream(ais); } else if (outputMode == 1 || outputMode == 2) { ais = new StereoAudioInputStream(ais, outputMode); } else { assert outputMode == 3 : "Unexpected output mode: " + outputMode; } } DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat); try { if (line == null) { boolean bIsSupportedDirectly = AudioSystem.isLineSupported(info); if (!bIsSupportedDirectly) { AudioFormat sourceFormat = audioFormat; AudioFormat targetFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, sourceFormat.getSampleRate(), sourceFormat.getSampleSizeInBits(), sourceFormat.getChannels(), sourceFormat.getChannels() * (sourceFormat.getSampleSizeInBits() / 8), sourceFormat.getSampleRate(), sourceFormat.isBigEndian()); ais = AudioSystem.getAudioInputStream(targetFormat, ais); audioFormat = ais.getFormat(); } info = new DataLine.Info(SourceDataLine.class, audioFormat); line = (SourceDataLine) AudioSystem.getLine(info); } if (lineListener != null) { line.addLineListener(lineListener); } line.open(audioFormat); } catch (Exception ex) { Logger.getLogger(getClass().getName()).log(Level.WARNING, null, ex); return; } line.start(); setGain(getGainValue()); int nRead = 0; byte[] abData = new byte[65532]; while ((nRead != -1) && (!exitRequested)) { try { nRead = ais.read(abData, 0, abData.length); } catch (IOException ex) { Logger.getLogger(getClass().getName()).log(Level.WARNING, null, ex); } if (nRead >= 0) { line.write(abData, 0, nRead); } } if (!exitRequested) { line.drain(); } line.close(); } }
9c0c100db9d0d6845acb641d2882eb1c1642cb87
f2408edc3ab5668dd0d90a7ee4eeb48ee424c3c1
/hw6/server/ChessServiceImpl.java
1ff03870ffbd0c236b6d9012de7b8a32306a0061
[]
no_license
lizhihan-amzn/social-multiplayer-games
21dd87a8522a8edfc007bde242e754f85e835bd2
82b1cc36f7fb5bc5597917e5bf82b3839d934297
refs/heads/master
2023-08-05T11:03:38.790508
2013-04-21T14:47:43
2013-04-21T14:47:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,490
java
package org.zhihanli.hw6.server; import java.text.DateFormat; import java.util.HashMap; import java.util.Date; import java.util.LinkedList; import java.util.List; import org.shared.chess.*; import org.zhihanli.hw6.client.ChessService; import org.zhihanli.hw6.client.MoveSerializer; import org.zhihanli.hw8.GamePeriodData; import org.zhihanli.hw2.StateChangerImpl; import com.google.appengine.api.channel.ChannelMessage; import com.google.appengine.api.channel.ChannelService; import com.google.appengine.api.channel.ChannelServiceFactory; import com.google.appengine.api.users.User; import com.google.appengine.api.users.UserService; import com.google.appengine.api.users.UserServiceFactory; import com.google.gwt.user.client.Timer; import com.google.gwt.user.server.rpc.RemoteServiceServlet; import com.googlecode.objectify.ObjectifyService; public class ChessServiceImpl extends RemoteServiceServlet implements ChessService { /** * */ private static final long serialVersionUID = 1L; // private static LinkedList<Player> players = new LinkedList<Player>(); private static HashMap<String, String> email_token = new HashMap<String, String>(); private static HashMap<String, String> email_name = new HashMap<String, String>(); private static LinkedList<String> waitingPlayers = new LinkedList<String>(); // private static HashSet<String> waitingPlayers=new HashSet<String>(); // private static LinkedList<PlayerPair> PlayerPairs = new // LinkedList<PlayerPair>(); private static ChannelService channelService = ChannelServiceFactory .getChannelService(); StateChangerImpl stateChanger = new StateChangerImpl(); // private Date today=new Date(); static { waitingPlayers = new LinkedList<String>(); // register entity ObjectifyService.register(Match.class); ObjectifyService.register(PlayerEntity.class); ObjectifyService.register(WaitingPlayers.class); ObjectifyService.register(GamePeriodData.class); } @Override /** * login method, create player on server, return token for channel communication */ public String login() { UserService userService = UserServiceFactory.getUserService(); User user = userService.getCurrentUser(); if (user == null) return null; String name = user.getNickname(); String email = user.getEmail(); String token = channelService.createChannel(email); // Player newPlayer = new Player(email, token); // newPlayer.setName(name); // if (!players.contains(newPlayer)) { // players.add(newPlayer); // } email_token.put(email, token); email_name.put(email, name); updateNewPlayerEntity(email, name); String rankAndRD = DataOperation.getRankAndRD(email); String rank = "1500"; String RD = "350"; if (rankAndRD != null) { rank = rankAndRD.split(" ")[0]; RD = rankAndRD.split(" ")[1]; } return name + " " + email + " " + token + " " + rank + " " + RD; } @Override public List<String> requestMatchList(String userid) { return DataOperation.getMatchStringList(userid); } private void updateNewPlayerEntity(String email, String name) { // DataOperation.savePlayer(new Player(userid,)) PlayerEntity p = DataOperation.getPlayer(email); Date date = new Date(); DateFormat dtf = DateFormat.getDateInstance(); String formatedDate = dtf.format(date); if (p != null) { p.name = name; if (p.gamePeriodData == null || !p.gamePeriodData.getDate().equals(formatedDate)) { p.gamePeriodData = new GamePeriodData(formatedDate); } DataOperation.savePlayer(p); } else { PlayerEntity playerEnt = new PlayerEntity(email, name); playerEnt.gamePeriodData = new GamePeriodData(formatedDate); DataOperation.savePlayer(playerEnt); } } @Override public boolean autoMatch(String email) { // return true; return matchOnDataStore(email); } private boolean match(String email) { String player; if (waitingPlayers == null) waitingPlayers = new LinkedList<String>(); if (waitingPlayers.isEmpty()) { waitingPlayers.add(email); // DataOperation.addWaitingPlayer(System.currentTimeMillis(), // email); return false; } else { player = waitingPlayers.pollFirst(); if (player == null) return false; if (player.equals(email)) { waitingPlayers.add(player); if (waitingPlayers.size() == 1) { return false; } else { player = waitingPlayers.pollFirst(); if (player == null) return false; } } } if (player.equals(email)) return false; Long matchId = createNewMatch(player, email); channelService.sendMessage(new ChannelMessage(player, "RB " + email + " " + matchId)); channelService.sendMessage(new ChannelMessage(email, "RW " + player + " " + matchId)); return true; } private boolean matchOnDataStore(String email) { if (email == null) return false; DataOperation.addWaitingPlayer(email); // String opp=null; String opp = DataOperation.getOpponent(email); if (opp == null) return false; DataOperation.delWaitingPlayer(email, opp); Long matchId = createNewMatch(opp, email); channelService.sendMessage(new ChannelMessage(opp, "RB " + email + " " + matchId)); channelService.sendMessage(new ChannelMessage(email, "RW " + opp + " " + matchId)); return true; } @Override public boolean sendMove(String move, String userid) { if (move == null) return false; String moveToSend = move.split("#")[0]; String matchId = move.split("#")[1]; // get state and turn String stateNturn = DataOperation .getStateAndTurnAndPlayerInfoWithMatchId(new Long(matchId)); String state = stateNturn.split("##")[0]; String turn = stateNturn.split("##")[1]; // change state State s = StateSerializer.deserialize(state); Move m = MoveSerializer.stringToMove(move); stateChanger.makeMove(s, m); // change turn String players = DataOperation.getPlayersInfoWithMatchId(new Long( matchId)); String p1Email = players.split("##")[0]; String p2Email = players.split("##")[1]; turn = turn.equals(p1Email) ? p2Email : p1Email; dispatchMove(moveToSend, turn); // update info DataOperation.updateMatch(new Long(matchId), StateSerializer .serialize(s), turn, s.getGameResult() == null ? null : s .getGameResult().toString()); // TODO: update ranking // if game ends, add opponent RD, r, and s if (s.getGameResult() != null) { Date currentDate = new Date(); String currentDateString = DataOperation.dateToString(currentDate); Color winner = s.getGameResult().getWinner(); String myEmail = turn.equals(p1Email) ? p2Email : p1Email; String myRankAndRD = DataOperation.getRankAndRD(myEmail); String myRankString = myRankAndRD.split(" ")[0]; int myRank = Integer.valueOf(myRankString); String myRDString = myRankAndRD.split(" ")[1]; int myRD = Integer.valueOf(myRDString); // double myS=winnerEmail.equals(myEmail)?1.0: double myS; String oppRankAndRD = DataOperation.getRankAndRD(turn); String oppRankString = oppRankAndRD.split(" ")[0]; String oppRDString = oppRankAndRD.split(" ")[1]; int oppRank = Integer.valueOf(oppRankString); int oppRD = Integer.valueOf(oppRDString); double oppS; if (winner == null) { myS = 0.5; oppS = 0.5; } else { String winnerEmail = winner == Color.WHITE ? p2Email : p1Email; if (winnerEmail.equals(myEmail)) { myS = 1.0; oppS = 0; } else { myS = 0; oppS = 1.0; } } String rankAndRD = DataOperation.updateGamePeriodData(turn, currentDateString, myRD, (double) myRank, oppS); channelService.sendMessage(new ChannelMessage(turn, "rank#" + rankAndRD)); rankAndRD = DataOperation.updateGamePeriodData(myEmail, currentDateString, oppRD, (double) oppRank, myS); channelService.sendMessage(new ChannelMessage(myEmail, "rank#" + rankAndRD)); // } return true; } public boolean dispatchMove(String move, String userid) { // find the correct client to send to move through channel // Player targetPlayer = null; // for (PlayerPair pair : PlayerPairs) { // targetPlayer = pair.getAnotherPlayer(userid); // if (targetPlayer != null) { // break; // } // } // if (targetPlayer == null) // return false; // found target player, send the move through channelService.sendMessage(new ChannelMessage(userid, "M" + move)); return true; } private Long createNewMatch(String p1Email, String p2Email) { // String matchId = Integer.toString(count++); Long matchId = System.currentTimeMillis(); State newState = new State(); String state = StateSerializer.serialize(newState); // String newMatch = matchId + " " + p1Email + " " + p2Email + " " // + p2Email + " " + "Ongoing "+(new Date()).toString(); DataOperation.newMatchTransaction(matchId, p1Email, p2Email, state, p2Email, null, new Date()); channelService.sendMessage(new ChannelMessage(p1Email, "NM")); channelService.sendMessage(new ChannelMessage(p2Email, "NM")); return matchId; } @Override public void sendNewMatch(String p1Email, String p2Email) { createNewMatch(p1Email, p2Email); } @Override public String getStateAndTurnAndPlayerInfoWithMatchId(Long matchId) { return DataOperation.getStateAndTurnAndPlayerInfoWithMatchId(matchId); } @Override public void deleteMatchFromPlayer(String email, Long matchId) { DataOperation.deleteMatchFromPlayer(email, matchId); } @Override public String getWaitingList() { return waitingPlayers.toString(); } }
f7e95f80ac4ab649c14863133e4b98b913e9baaf
d5c5cfe894ae5833918bd396c5bd01fc8a1a8ffa
/bump-fitlibrary-eclipse-workspace/fitlibrary-2.0-from-Zip/src/fitlibrary/dynamicVariable/VariableResolver.java
946e0e17a9d6ec1fc640dad534bdb80ac327dc02
[]
no_license
afamee/DbFit-deps
80db2fc3919c30b900c01012788d293ea5e1c07c
2610dfc6f4573e3eda3a8c68369d23b4571547da
refs/heads/master
2020-04-02T18:28:37.519147
2015-07-11T13:55:42
2015-07-11T13:55:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
329
java
/* * Copyright (c) 2010 Rick Mugridge, www.RimuResearch.com * Released under the terms of the GNU General Public License version 2 or later. */ package fitlibrary.dynamicVariable; import fitlibrary.table.Tables; import fitlibrary.utility.Pair; public interface VariableResolver { Pair<String,Tables> resolve(String key); }
10a8bd83b58bb005ec5ef4df174f555b9b5ff66f
a7667b6267041dfe584e5b962ba91e7f2cd5272b
/src/main/java/net/minecraft/network/Packet.java
29ed4b104425dfece60488443fb1c0cff9783704
[ "MIT" ]
permissive
8osm/AtomMC
79925dd6bc3123e494f0671ddaf33caa318ea427
9ca248a2e870b3058e90679253d25fdb5b75f41c
refs/heads/master
2020-06-29T14:08:11.184503
2019-08-05T00:44:42
2019-08-05T00:44:42
200,557,840
0
0
MIT
2019-08-05T00:52:31
2019-08-05T00:52:31
null
UTF-8
Java
false
false
273
java
package net.minecraft.network; import java.io.IOException; public interface Packet<T extends INetHandler> { void readPacketData(PacketBuffer buf) throws IOException; void writePacketData(PacketBuffer buf) throws IOException; void processPacket(T handler); }
96a1e673465f884c9b8c453256f8907baa692cbc
e1b2608c9e8841fd0e4e771604ee1403c039f89c
/modue-app/app/src/main/java/com/kren/jpms/app/spring/AppConfig.java
a529e17060205cd338a08a816475e0fa1931f955
[]
no_license
krenMaksim/jpms
3c31e4b58ffd03bbf02851afada4bf9aa5c82b22
395944473964a8b823234d24d082ab8a2dee7d17
refs/heads/master
2022-07-05T00:54:34.009599
2020-05-25T04:49:00
2020-05-25T04:49:00
254,554,299
0
0
null
null
null
null
UTF-8
Java
false
false
273
java
package com.kren.jpms.app.spring; import com.kren.jpms.service.spring.ServiceConfig; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @Configuration @Import(ServiceConfig.class) public class AppConfig { }
f36a751f8b33c7a4737e83c8d0d9becf2c2b6515
3c3972a9608065cce9af5032e748c4bf1270fdd4
/java/com/plane/plane/GameActivity.java
661e76124e6a5c1fcca07c07b1dc6e866d7fe8d4
[]
no_license
ytyz1307zzh/Plane-Fighting
b1bfafb5df8427ce58bf296307599ba98039515f
1900dd71d65553e1b0e980a00c2b13dd6e9b18e0
refs/heads/master
2020-03-18T19:24:34.670797
2019-10-27T14:51:14
2019-10-27T14:51:14
135,152,535
0
0
null
null
null
null
UTF-8
Java
false
false
1,911
java
package com.plane.plane; import android.app.Activity; import android.os.Bundle; import com.plane.plane.game.GameView; /** * Created by 俊 on 2018/5/22. */ public class GameActivity extends Activity { private GameView gameView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_game); gameView = (GameView)findViewById(R.id.gameView); //0:combatAircraft //1:explosion //2:yellowBullet //3:blueBullet //4:smallEnemyPlane //5:middleEnemyPlane //6:bigEnemyPlane //7:bombAward //8:bulletAward //9:pause1 //10:pause2 //11:bomb //12:smallexplosion //13:middle //14:big //15:player int[] bitmapIds = { R.drawable.plane, R.drawable.explosion, R.drawable.yellow_bullet, R.drawable.blue_bullet, R.drawable.small, R.drawable.middle, R.drawable.big, R.drawable.bomb_award, R.drawable.bullet_award, R.drawable.pause1, R.drawable.pause2, R.drawable.bomb, R.drawable.smallfoe_seq, R.drawable.middlefoe_seq, R.drawable.bigfoe_seq, R.drawable.play_seq }; gameView.start(bitmapIds); } @Override protected void onPause() { super.onPause(); if(gameView != null){ gameView.setGamePause(); } } @Override protected void onDestroy() { super.onDestroy(); if(gameView != null){ gameView.destroy(); } gameView = null; } }
e18826e923756ff88cbb9cf9be1afe843f278de2
7dc9622dd18814420c902b24c00905426fc9fdde
/drw/somethinelse.java
2c8738bdb8c865ab969b5ace46bb5805befcc202
[]
no_license
aaronbae/leetcode
8ad620dd12998d7a750173752f348ca6ac7819d4
4cdcb4f31f2b7c02e43a0757e04a9709cc6ede5d
refs/heads/master
2022-12-18T22:34:59.071961
2020-09-18T23:46:55
2020-09-18T23:46:55
276,296,573
0
0
null
null
null
null
UTF-8
Java
false
false
680
java
// you can also use imports, for example: import java.util.*; // you can write to stdout for debugging purposes, e.g. // System.out.println("this is a debug message"); class Solution { public int recurse(Tree current, int prevMax){ if(current == null){ return 0; } int result = 0; if(prevMax <= current.x){ result += 1; } result += recurse(current.l, Math.max(prevMax, current.x)); result += recurse(current.r, Math.max(prevMax, current.x)); return result; } public int solution(Tree T) { // write your code in Java SE 8 return recurse(T, -100000); } }
95b9c38d82463f0339e539b5eca03cef6417106b
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/25/25_36a032d2498bd0a949c54a7ddd6da8ecb92e633b/TCPio/25_36a032d2498bd0a949c54a7ddd6da8ecb92e633b_TCPio_t.java
63e856496e3973c61f9541f28c6ca132c760e025
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
3,547
java
/** * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE * Version 2, December 2004 * * Copyright (C) sponge * Planet Earth * Everyone is permitted to copy and distribute verbatim or modified * copies of this license document, and changing it is allowed as long * as the name is changed. * * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE * TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION * * 0. You just DO WHAT THE FUCK YOU WANT TO. * * See... * * http://sam.zoy.org/wtfpl/ * and * http://en.wikipedia.org/wiki/WTFPL * * ...for any additional details and liscense questions. */ package net.i2p.BOB; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.concurrent.atomic.AtomicBoolean; /** * Shove data from one stream to the other. * * @author sponge */ public class TCPio implements Runnable { private InputStream Ain; private OutputStream Aout; private AtomicBoolean lives; /** * Constructor * * @param Ain InputStream * @param Aout OutputStream * * param database */ TCPio(InputStream Ain, OutputStream Aout, AtomicBoolean lives) { this.Ain = Ain; this.Aout = Aout; this.lives = lives; } /** * Copy from source to destination... * and yes, we are totally OK to block here on writes, * The OS has buffers, and I intend to use them. * We send an interrupt signal to the threadgroup to * unwedge any pending writes. * */ public void run() { /* * NOTE: * The write method of OutputStream calls the write method of * one argument on each of the bytes to be written out. * Subclasses are encouraged to override this method and provide * a more efficient implementation. * * So, is this really a performance problem? * Should we expand to several bytes? * I don't believe there would be any gain, since read method * has the same reccomendations. If anyone has a better way to * do this, I'm interested in performance improvements. * * --Sponge * * Tested with 128 bytes, and there was no performance gain. * 8192 bytes did lower load average across many connections. * Should I raise it higer? The correct thing to do would be to * override... perhaps use NTCP, but I2P's streaming lib lacks * anything NTCP compatable. * * --Sponge */ int b; byte a[] = new byte[8192]; try { try { while (lives.get()) { b = Ain.read(a, 0, 8192); if (b > 0) { Aout.write(a, 0, b); } else if (b == 0) { // Will this die? We'll see. while(Ain.available() == 0) { Thread.sleep(20); } // Thread.yield(); // this should act like a mini sleep. // if (Ain.available() == 0) { // Thread.sleep(10); // } } else { /* according to the specs: * * The total number of bytes read into the buffer, * or -1 if there is no more data because the end of * the stream has been reached. * */ // System.out.println("TCPio: End Of Stream"); break; } } } catch (Exception e) { } // System.out.println("TCPio: Leaving."); } finally { // Eject!!! Eject!!! //System.out.println("TCPio: Caught an exception " + e); try { Ain.close(); } catch (IOException ex) { } try { Aout.close(); } catch (IOException ex) { } return; } } }
905d71d42c3930ea10b2526411e7c79f7c5c028a
f984f3663f927f7f35c93e6b4bf3a394bf5e146f
/littlethings-conversation-api/src/main/java/xyz.auriium.littlethings.conversation/applicant/CaWith.java
edf9157d206a7d46e0ed26ea969a2a426a1e5f4d
[]
no_license
auriium/LittleThings
73cc2a1a324da3177dc584f4d7b9c4ee6451d927
00a8e8e2695bc22cf91004aebfc4b62fa9e4f6fc
refs/heads/master
2023-08-06T09:14:25.240472
2021-10-08T22:46:31
2021-10-08T22:46:31
383,290,874
0
0
null
2021-10-01T05:45:49
2021-07-05T23:59:27
Java
UTF-8
Java
false
false
792
java
package xyz.auriium.littlethings.conversation.applicant; import xyz.auriium.littlethings.conversation.ConversationApplicant; import xyz.auriium.littlethings.conversation.ConversationDirective; import xyz.auriium.littlethings.conversation.RemapFunction; import java.util.List; public class CaWith implements ConversationApplicant { private final ConversationDirective directive; private final List<RemapFunction> remappings; public CaWith(ConversationDirective directive, List<RemapFunction> remappings) { this.directive = directive; this.remappings = remappings; } @Override public ConversationDirective directive() { return directive; } @Override public List<RemapFunction> remappings() { return remappings; } }
df20d04615f52c96e344ca61f692e66520dd9800
7890873b732492ae2d8abd8f8c02e2ffd2decd46
/netty-chat/src/main/java/com/charjay/chat/protocol/IMDecoder.java
9c608976d38cc84a463b07d9017c153f20467d35
[]
no_license
svcgv/LearnJavaIo
54da6b148d5099daadc5b86f3c825fd47b8012a4
ff6a8843503b8785a8865b97221bd2ac93a8a711
refs/heads/master
2020-04-22T16:48:17.465342
2019-02-13T14:34:36
2019-02-13T14:34:36
170,520,443
0
0
null
null
null
null
UTF-8
Java
false
false
2,392
java
package com.charjay.chat.protocol; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.ByteToMessageDecoder; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.msgpack.MessagePack; import org.msgpack.MessageTypeException; /** * 自定义IM协议的编码器 */ public class IMDecoder extends ByteToMessageDecoder { //解析IM写一下请求内容的正则 private Pattern pattern = Pattern.compile("^\\[(.*)\\](\\s\\-\\s(.*))?"); @Override protected void decode(ChannelHandlerContext ctx, ByteBuf in,List<Object> out) throws Exception { try{ //先获取可读字节数 final int length = in.readableBytes(); final byte[] array = new byte[length]; String content = new String(array,in.readerIndex(),length); //空消息不解析 if(!(null == content || "".equals(content.trim()))){ if(!IMP.isIMP(content)){ ctx.channel().pipeline().remove(this); return; } } in.getBytes(in.readerIndex(), array, 0, length); out.add(new MessagePack().read(array,IMMessage.class)); in.clear(); }catch(MessageTypeException e){ ctx.channel().pipeline().remove(this); } } /** * 字符串解析成自定义即时通信协议 * @param msg * @return */ public IMMessage decode(String msg){ if(null == msg || "".equals(msg.trim())){ return null; } try{ Matcher m = pattern.matcher(msg); String header = ""; String content = ""; if(m.matches()){ header = m.group(1); content = m.group(3); } String [] heards = header.split("\\]\\["); long time = 0; try{ time = Long.parseLong(heards[1]); } catch(Exception e){} String nickName = heards[2]; //昵称最多十个字 nickName = nickName.length() < 10 ? nickName : nickName.substring(0, 9); if(msg.startsWith("[" + IMP.LOGIN.getName() + "]")){ return new IMMessage(heards[0],time,nickName); }else if(msg.startsWith("[" + IMP.CHAT.getName() + "]")){ return new IMMessage(heards[0],time,nickName,content); }else if(msg.startsWith("[" + IMP.FLOWER.getName() + "]")){ return new IMMessage(heards[0],time,nickName); }else{ return null; } }catch(Exception e){ e.printStackTrace(); return null; } } }
d104c2ce99aff0160547e881b860da1b096662b1
065926e599d28e87144060f675a6e3132d697171
/CustomCalendar/app/src/test/java/com/maxovch/customcalendar/ExampleUnitTest.java
f59994146fe1082530355cb01b20999c5c900427
[]
no_license
Alcatraz7676/Mospoliteh-labs
d6658a4d5fec1fa42a271dc3df6b3393ee2a1415
b5818e405ccdb741c22aef1eb7715cb4ba264701
refs/heads/master
2021-09-02T03:55:31.933678
2017-12-30T04:58:05
2017-12-30T04:58:05
104,569,357
0
0
null
null
null
null
UTF-8
Java
false
false
404
java
package com.maxovch.customcalendar; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
24d57f69559ac6ac9f94587a5a671d37a50e6e33
96663812e800a7a92b66092825920fbcb7ca92ef
/src/FlappyBird/WindowForFlappyBird.java
65f51c7bdb55a57bfa7cac308ce219b85cb7de3a
[]
no_license
Krasav4k1/myGame
fe688de9551e57cec37d10e3946e00e35b0db5b8
49cdfcb7e4e37a238a10b32649df2ec299b1e463
refs/heads/master
2016-08-12T19:09:25.249198
2016-03-07T13:58:34
2016-03-07T13:58:34
53,161,511
1
0
null
2016-03-07T13:58:35
2016-03-04T19:50:30
Java
UTF-8
Java
false
false
423
java
package FlappyBird; import javax.swing.*; public class WindowForFlappyBird extends JFrame{ WindowForFlappyBird(){ super("Flappy Bird"); GamePanel panel = new GamePanel(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(GamePanel.wigth,GamePanel.heigth); setLocationRelativeTo(null); setContentPane(panel); panel.start(); setVisible(true); } }
[ "Andrii Blyzniuk" ]
Andrii Blyzniuk
4acf1bfdbec3b25ff9bc1c48a609884b582d4d7e
9a6ff59085000029f252fae079ce167545f5c421
/src/main/java/org/launchcode/models/Language.java
277e77033da8dc5998b77f4791261aeabb6ee79a
[]
no_license
KevinStock/hello-spring
4f2ac1822db245506016f1ff5d9f222282c9cdbc
cb81b2187d7cdba1f4539daddf6d20a485360c10
refs/heads/master
2020-12-24T11:53:36.269010
2016-11-06T18:05:09
2016-11-06T18:05:09
73,008,831
0
0
null
null
null
null
UTF-8
Java
false
false
313
java
package org.launchcode.models; public class Language { private String name; private String greeting; public Language(String name, String greeting) { this.name = name; this.greeting = greeting; } public String getName() { return name; } public String getGreeting() { return greeting; } }
0c5ba1775a4a16a8dfea42820ca71f47bdf10a52
208ac6bb8a2f9b78c6afa15d255814200733de59
/SW_Expert Academy/swea_2068.java
b63fd7366696ce71d1624360c0fa6fba59b02484
[]
no_license
yagee97/algorithm
2832e976b13df6a431c1a02aab400a943b099bd0
f40918e810fee1d5f78894461e9b5c4b9cf61fe2
refs/heads/master
2021-06-05T12:27:43.911932
2020-07-25T14:19:48
2020-07-25T14:19:48
140,398,432
0
1
null
null
null
null
UTF-8
Java
false
false
424
java
//2068. 최대수 구하기 package Swea; import java.util.Scanner; public class swea_2068 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int tc = 1; tc <= t; tc++) { int maxEle = 0; for (int i = 0; i < 10; i++) { int input = sc.nextInt(); if (maxEle < input) maxEle = input; } System.out.println("#" + tc +" "+maxEle); } } }
19477fd8f930f313977cb61a392c3f01d7d778c5
7e17bb086050da97753e3dfc014162f8b9707606
/project/guntiproject/src/guntiproject/ViewStockUsage.java
ee1c884502eeeb6861a2a5f1787e8a49afaf6122
[]
no_license
pravalikagunti/DatabaseProject
5777f548941095092dd3d7fda4b095e57d3f6d1c
72958b2168c5afdfa5319fe0b9254ea8fcf8da90
refs/heads/master
2021-04-26T23:17:36.219671
2018-03-05T19:08:36
2018-03-05T19:08:36
123,964,838
0
0
null
null
null
null
UTF-8
Java
false
false
16,815
java
/* * Gunti database project */ package guntiproject; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.Vector; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; public class ViewStockUsage extends javax.swing.JFrame { DefaultTableModel df; /** * Creates new form ViewStockUsage */ public ViewStockUsage() { initComponents(); view(); } public void view() { try { Connection con = connectio.cone(); String mm=""; String id=""; PreparedStatement ps=con.prepareStatement("select (STOCK_NAME),STOCK_NAME from STOCKNAME GROUP BY STOCK_NAME"); ResultSet rs=ps.executeQuery(); //jComboBox1.removeAllItems(); //jComboBox1.addItem("select"); while(rs.next()) { mm=rs.getString(2); jComboBox1.addItem(mm); } } catch(Exception e) { e.printStackTrace(); } } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jComboBox1 = new javax.swing.JComboBox(); jScrollPane2 = new javax.swing.JScrollPane(); jTable2 = new javax.swing.JTable(); jTextField1 = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jDateChooser1 = new com.toedter.calendar.JDateChooser(); jDateChooser2 = new com.toedter.calendar.JDateChooser(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jButton3 = new javax.swing.JButton(); jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null}, {null, null, null, null}, {null, null, null, null}, {null, null, null, null} }, new String [] { "Title 1", "Title 2", "Title 3", "Title 4" } )); jScrollPane1.setViewportView(jTable1); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setFont(new java.awt.Font("Segoe UI Semibold", 1, 36)); // NOI18N jLabel1.setText("VIEW STOCK USAGE"); jLabel2.setFont(new java.awt.Font("Segoe UI Semilight", 1, 24)); // NOI18N jLabel2.setText("FROM DATE"); jTable2.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "STOCK_ID", "STOCK_QUANTITY_USAGE", "DATE", "DESCRIPTION" } )); jScrollPane2.setViewportView(jTable2); jTextField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField1ActionPerformed(evt); } }); jButton1.setText("UPDATE"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setText("DELETE"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jLabel3.setFont(new java.awt.Font("Segoe UI Semilight", 1, 24)); // NOI18N jLabel3.setText("TO DATE"); jLabel4.setFont(new java.awt.Font("Segoe UI Semilight", 1, 24)); // NOI18N jLabel4.setText("STOCK NAME"); jButton3.setText("VIEW"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(33, 33, 33) .addComponent(jLabel2) .addGap(18, 18, 18) .addComponent(jDateChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel3) .addGap(18, 18, 18) .addComponent(jDateChooser2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(132, 132, 132)) .addGroup(layout.createSequentialGroup() .addGap(149, 149, 149) .addComponent(jLabel1) .addContainerGap()) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addGap(114, 114, 114) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 144, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addGap(124, 124, 124) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(45, 45, 45) .addComponent(jButton1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton2))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 80, Short.MAX_VALUE) .addComponent(jButton3) .addGap(44, 44, 44)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(133, 133, 133) .addComponent(jLabel4) .addContainerGap(464, Short.MAX_VALUE))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(51, 51, 51) .addComponent(jLabel1) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jDateChooser2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3)) .addGap(32, 32, 32) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton3))) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jDateChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2))) .addGap(34, 34, 34) .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(60, 60, 60) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(198, Short.MAX_VALUE)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(183, 183, 183) .addComponent(jLabel4) .addContainerGap(434, Short.MAX_VALUE))) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField1ActionPerformed private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed if(df!=null&&df.getRowCount()!=0){ int co=df.getRowCount(); for(int i=0;i<co;i++) df.removeRow(0); } boolean f1=false,f2=false; // TODO add your handling code here: if(jDateChooser1.getDate()==null) JOptionPane.showMessageDialog(rootPane, "From Date should not be Empty"); else f1=true; if(jDateChooser2.getDate()==null) JOptionPane.showMessageDialog(rootPane, "To Date should not be Empty"); else f2=true; java.util.Date d = jDateChooser1.getDate(); java.sql.Date d1=new java.sql.Date(d.getTime()); java.util.Date d2 = jDateChooser2.getDate(); java.sql.Date d3=new java.sql.Date(d2.getTime()); try { Connection con = connectio.cone(); String ob=(String)jComboBox1.getSelectedItem(); PreparedStatement ps1=con.prepareStatement("select * from STOCK_USAGE where STOCK_NAME=? AND STOCK_USAGE_DATE between ? and ?"); df=(DefaultTableModel) jTable2.getModel(); // tm = (DefaultTableModel) jTable1.getModel(); ps1.setString(1, ob); ps1.setDate(2, d1); ps1.setDate(3, d3); ResultSet rs=ps1.executeQuery(); while(rs.next()) { System.out.println("ii"); Vector v = new Vector(); v.add(rs.getString(1)); v.add(rs.getInt(3)); v.add(rs.getDate(4)); v.add(rs.getString(5)); df.addRow(v); } } catch(Exception e) { e.printStackTrace(); } }//GEN-LAST:event_jButton3ActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed int rowno =jTable2.getSelectedRow(); System.out.println(rowno); int colno = jTable2.getSelectedColumn(); System.out.println(colno); String unc=jTable2.getColumnName(colno); System.out.println(unc); String unp=jTable2.getColumnName(0); System.out.println(unp); String ps= (String)jTable2.getValueAt(rowno, 0); System.out.println(ps); String us= (String)jTextField1.getText(); System.out.println(ps); if(rowno==1){ try { Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","ramamurthi","ramamurthi"); PreparedStatement ps1=con.prepareStatement("update STOCK_USAGE set "+unc+" = ? where "+unp+" =? "); ps1.setString(1, us); ps1.setString(2, ps); ps1.executeUpdate(); int k=ps1.executeUpdate(); if(k>0) { df.setValueAt(us, rowno, colno); JOptionPane.showMessageDialog(rootPane, "sucessfully done"); jTextField1.setText(""); } } catch(Exception e) { e.printStackTrace(); } } else { JOptionPane.showMessageDialog(rootPane," dont update"); } // TODO add your handling code here: }//GEN-LAST:event_jButton1ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed int i=jTable2.getSelectedRow(); String id=(String)df.getValueAt(i, 0); try { Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con= DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","ramamurthi","ramamurthi"); PreparedStatement ps1=con.prepareStatement("delete STOCK_USAGE where STOCK_ID='"+id+"' "); int d=ps1.executeUpdate(); if(d>0) { JOptionPane.showMessageDialog(rootPane, "Deleted Successfully"); df.removeRow(i); } } catch(Exception e) { e.printStackTrace(); } // TODO add your handling code here: }//GEN-LAST:event_jButton2ActionPerformed public static void main(String args[]) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(ViewStockUsage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(ViewStockUsage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(ViewStockUsage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(ViewStockUsage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* * Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new ViewStockUsage().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JComboBox jComboBox1; private com.toedter.calendar.JDateChooser jDateChooser1; private com.toedter.calendar.JDateChooser jDateChooser2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JTable jTable1; private javax.swing.JTable jTable2; private javax.swing.JTextField jTextField1; // End of variables declaration//GEN-END:variables }
b708596cfc4235491121cfe643786a995b997c6c
43da78b54b722f0e89aa893f6a56eae95c2a3112
/instances/src/main/java/com/github/tonivade/purefun/instances/EIOInstances.java
3c4599f39ab4e38a28bb19f61d4d0b527671c0c0
[ "MIT" ]
permissive
FuncGuy/purefun
5287977439e2712d9df05683444162f44a8c5f3c
0505e58d03b301f1c4449602ff77ba88fef13d3f
refs/heads/master
2021-01-01T12:09:27.625175
2020-02-06T20:21:56
2020-02-06T20:21:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,780
java
/* * Copyright (c) 2018-2020, Antonio Gabriel Muñoz Conejo <antoniogmc at gmail dot com> * Distributed under the terms of the MIT License */ package com.github.tonivade.purefun.instances; import com.github.tonivade.purefun.Consumer1; import com.github.tonivade.purefun.Function1; import com.github.tonivade.purefun.Higher1; import com.github.tonivade.purefun.Higher2; import com.github.tonivade.purefun.Instance; import com.github.tonivade.purefun.Producer; import com.github.tonivade.purefun.Unit; import com.github.tonivade.purefun.effect.UIO; import com.github.tonivade.purefun.typeclasses.Applicative; import com.github.tonivade.purefun.typeclasses.Bracket; import com.github.tonivade.purefun.typeclasses.Defer; import com.github.tonivade.purefun.typeclasses.Functor; import com.github.tonivade.purefun.typeclasses.Monad; import com.github.tonivade.purefun.typeclasses.MonadDefer; import com.github.tonivade.purefun.typeclasses.MonadError; import com.github.tonivade.purefun.typeclasses.MonadThrow; import com.github.tonivade.purefun.typeclasses.Reference; import com.github.tonivade.purefun.effect.EIO; import java.time.Duration; public interface EIOInstances { static <E> Functor<Higher1<EIO.µ, E>> functor() { return EIOFunctor.instance(); } static <E> Applicative<Higher1<EIO.µ, E>> applicative() { return EIOApplicative.instance(); } static <E> Monad<Higher1<EIO.µ, E>> monad() { return EIOMonad.instance(); } static <E> MonadError<Higher1<EIO.µ, E>, E> monadError() { return EIOMonadError.instance(); } static MonadThrow<Higher1<EIO.µ, Throwable>> monadThrow() { return EIOMonadThrow.instance(); } static MonadDefer<Higher1<EIO.µ, Throwable>> monadDefer() { return EIOMonadDefer.instance(); } static <A> Reference<Higher1<EIO.µ, Throwable>, A> ref(A value) { return Reference.of(monadDefer(), value); } } @Instance interface EIOFunctor<E> extends Functor<Higher1<EIO.µ, E>> { @Override default <A, B> Higher2<EIO.µ, E, B> map(Higher1<Higher1<EIO.µ, E>, A> value, Function1<A, B> map) { return EIO.narrowK(value).map(map).kind2(); } } interface EIOPure<E> extends Applicative<Higher1<EIO.µ, E>> { @Override default <A> Higher2<EIO.µ, E, A> pure(A value) { return EIO.<E, A>pure(value).kind2(); } } @Instance interface EIOApplicative<E> extends EIOPure<E> { @Override default <A, B> Higher2<EIO.µ, E, B> ap(Higher1<Higher1<EIO.µ, E>, A> value, Higher1<Higher1<EIO.µ, E>, Function1<A, B>> apply) { return EIO.narrowK(apply).flatMap(map -> EIO.narrowK(value).map(map)).kind2(); } } @Instance interface EIOMonad<E> extends EIOPure<E>, Monad<Higher1<EIO.µ, E>> { @Override default <A, B> Higher2<EIO.µ, E, B> flatMap(Higher1<Higher1<EIO.µ, E>, A> value, Function1<A, ? extends Higher1<Higher1<EIO.µ, E>, B>> map) { return EIO.narrowK(value).flatMap(map.andThen(EIO::narrowK)).kind2(); } } @Instance interface EIOMonadError<E> extends EIOMonad<E>, MonadError<Higher1<EIO.µ, E>, E> { @Override default <A> Higher2<EIO.µ, E, A> raiseError(E error) { return EIO.<E, A>raiseError(error).kind2(); } @Override default <A> Higher2<EIO.µ, E, A> handleErrorWith(Higher1<Higher1<EIO.µ, E>, A> value, Function1<E, ? extends Higher1<Higher1<EIO.µ, E>, A>> handler) { // XXX: java8 fails to infer types, I have to do this in steps Function1<E, EIO<E, A>> mapError = handler.andThen(EIO::narrowK); Function1<A, EIO<E, A>> map = EIO::pure; EIO<E, A> eio = EIO.narrowK(value); return eio.foldM(mapError, map).kind2(); } } @Instance interface EIOMonadThrow extends EIOMonadError<Throwable>, MonadThrow<Higher1<EIO.µ, Throwable>> { } interface EIODefer extends Defer<Higher1<EIO.µ, Throwable>> { @Override default <A> Higher2<EIO.µ, Throwable, A> defer(Producer<Higher1<Higher1<EIO.µ, Throwable>, A>> defer) { return EIO.defer(() -> defer.map(EIO::narrowK).get()).kind2(); } } interface EIOBracket extends Bracket<Higher1<EIO.µ, Throwable>> { @Override default <A, B> Higher2<EIO.µ, Throwable, B> bracket(Higher1<Higher1<EIO.µ, Throwable>, A> acquire, Function1<A, ? extends Higher1<Higher1<EIO.µ, Throwable>, B>> use, Consumer1<A> release) { return EIO.bracket(acquire.fix1(EIO::narrowK), use.andThen(EIO::narrowK), release).kind2(); } } @Instance interface EIOMonadDefer extends MonadDefer<Higher1<EIO.µ, Throwable>>, EIOMonadThrow, EIODefer, EIOBracket { @Override default Higher2<EIO.µ, Throwable, Unit> sleep(Duration duration) { return UIO.sleep(duration).<Throwable>toEIO().kind2(); } }
b2518f6d8a7c720cffe85d3d6971fd3c8008b78a
fdfa7fec9a1876f6af1f697daaca64cb86c943d4
/chapter_001/src/test/java/ru/job4j/HelloWorld/CalculateTest.java
2371d9b636dca421351e0621c2220727904cf8dd
[ "Apache-2.0" ]
permissive
Apeksi1990/asemenov
a574875606a9e4a6e0167426f03b765c931c8f96
853db63344f499d816e7d30598ca638792fdc401
refs/heads/master
2020-06-13T05:36:30.235847
2017-10-01T14:59:50
2017-10-01T14:59:50
75,487,184
1
0
null
null
null
null
UTF-8
Java
false
false
703
java
package ru.job4j.HelloWorld; import org.junit.Test; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertThat; /** * Class CalculateTest решение задачи части 001 урока1. * @author asemenov * @since 1 */ public class CalculateTest { /** *Метод для тестирования. */ @Test public void whenAddOneToOneThenTwo() { ByteArrayOutputStream out = new ByteArrayOutputStream(); System.setOut(new PrintStream(out)); Calculate.main(null); assertThat(out.toString(), is("Hello World" + System.getProperty("line.separator"))); } }
b64720e80e0237133d6eaf6a17363ddf39c968d2
147104b284683b9285db49e719144479aef35300
/findbugsTestCases/src/java/sfBugs/Bug2382279.java
2639ee349c6b5af3796c9def8dddbe9c15fb681f
[]
no_license
gleclaire/findbugs-2.0.2
b092cc5efbb443df7f8fe944375f10744c00f495
e8ebba0e775bed94940ac8a581ccc0a4fbb23db7
refs/heads/master
2021-01-01T19:28:46.435973
2013-01-29T23:52:19
2013-01-29T23:52:19
7,505,038
3
2
null
2016-03-03T12:06:57
2013-01-08T16:34:14
Java
UTF-8
Java
false
false
2,081
java
/* **************************************** * $Id$ * SF bug 2382279: * OBL and ORD false positives on java.sql.Statement.close() * * JVM: 1.5.0_16 (OS X, PPC) * FBv: 1.3.7-dev-20081212 * * Test case based on example code from bug report * **************************************** */ package sfBugs; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import edu.umd.cs.findbugs.annotations.DesireNoWarning; import edu.umd.cs.findbugs.annotations.ExpectWarning; import edu.umd.cs.findbugs.annotations.NoWarning; public class Bug2382279 { private Connection con; public Bug2382279(Connection newCon) { con = newCon; } /* ******************** * Behavior at filing: OBL and ODR false positives The ResultSet object * returned by execute() has a method by which the statement that produced * it can be retrieved, and so the statement does not need to be closed in * this method. As such, no warnings should be thrown. * * warnings thrown => M B ODR_OPEN_DATABASE_RESOURCE ODR: * sfBugs.Bug2382279.execute(String) \ may fail to close Statement At * Bug2382279.java:[line 47] * * M X OBL_UNSATISFIED_OBLIGATION OBL: Method \ * sfBugs.Bug2382279.execute(String) may fail to clean up stream or \ * resource of type java.sql.Statement Obligation to clean up resource \ * created at Bug2382279.java:[line 47] is not discharged * * ******************** */ @DesireNoWarning("ODR") @NoWarning("OBL_UNSATISFIED_OBLIGATION") @ExpectWarning("OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE") public ResultSet execute(String query) throws SQLException { // test code adapted from bug report ResultSet rs; try { Statement statement = con.createStatement(); rs = statement.executeQuery(query); return rs; } catch (SQLException sqle) { System.out.println("Couldn't execute statement"); } return null; } }
47be8199d24da67ef00503191b5153830eb84cc2
c8aefd1403b1e9a0646de1a49d9e7bee71533a2a
/app/src/main/java/com/kaiueo/atss/GetSummaryFromUrl_interface.java
44169997c55055d5bc5d65814a7e5e4d4a6d2c64
[]
no_license
kaiueo/ATSSAND
cead2e4be1dfa4a758acdab80b2efaeedc765917
a53821bc6232008d495cf93f8c8f7a09c6db33f5
refs/heads/master
2021-04-28T14:32:13.926394
2018-03-29T11:31:44
2018-03-29T11:31:44
121,967,260
0
0
null
null
null
null
UTF-8
Java
false
false
433
java
package com.kaiueo.atss; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.Field; import retrofit2.http.FormUrlEncoded; import retrofit2.http.Header; import retrofit2.http.POST; /** * Created by zhangke on 18/02/2018. */ public interface GetSummaryFromUrl_interface { @POST("api/v1/summary/") Call<SummarizedArticle> getCall(@Header("Authorization") String auth, @Body PostSummayFromUrl post); }
26f46e9f9cd743c0a78537b3ae940bb5db702bf9
fbfb5b64695f1c0aaf8a0eb01cef0f51963c7130
/src/pl/MechanicX/service/UserCarService.java
140b151f3aff2d3c7a696cad0cc24122c9ff0c76
[]
no_license
cwiaralol/Projekt
fb28ae67a545fd0144771ce375d83909a5f93781
ac54d2fbece8c9f9292d828e40829e608ffaa9f6
refs/heads/master
2022-09-03T07:51:20.865846
2020-05-29T11:49:05
2020-05-29T11:49:05
267,838,120
0
0
null
null
null
null
UTF-8
Java
false
false
1,820
java
package pl.MechanicX.service; import java.util.List; import pl.MechanicX.beans.User_Car; import pl.MechanicX.dao.UserCarDAO; import pl.MechanicX.dao.DAOFactory; public class UserCarService { private static UserCarService instance; private UserCarService(){} public static UserCarService getInstance(){ if(instance == null){ instance = new UserCarService(); } return instance; } public void addUserCar(int userId, String car_brand, String car_model, String car_registration) { User_Car user_Car = new User_Car(); user_Car.setUserId(userId); user_Car.setCar_brand(car_brand); user_Car.setCar_model(car_model); user_Car.setCar_registration(car_registration); GetDao().create(user_Car); } public User_Car getUserCarById(int UserCarId) { return GetDao().read(UserCarId); } public void updateUserCar(int UserCarId, String car_brand, String car_model, String car_registration) { User_Car user_Car = GetDao().read(UserCarId); if(!car_brand.isEmpty() && !car_brand.equals(user_Car.getCar_brand())) { user_Car.setCar_brand(car_brand); } if((car_model != null) && !car_model.equals(user_Car.getCar_model())){ user_Car.setCar_model(car_model); } if(!car_registration.isEmpty() && !car_registration.equals(user_Car.getCar_registration())) { user_Car.setCar_registration(car_registration); } GetDao().update(user_Car); } public void deleteUserCar(int UserCarId) { GetDao().delete(UserCarId); } public List<User_Car> getAllUserCars(){ return GetDao().getAll(); } public User_Car getUserCarByUserId(int userId) { return GetDao().getByUserId(userId); } private UserCarDAO GetDao() { DAOFactory factory = DAOFactory.getDAOFactory(); return factory.getBillingInfoDAO(); } }
2d97836d6750ff7f7ede07645b76310e27487a4e
340e096d233f8e4ec5927a039822f76b5111728f
/api/src/main/java/marquez/db/MapperUtils.java
b70c7650b7386cd7c392f70dc261b8ff806d8f33
[ "Apache-2.0" ]
permissive
pratikmallya/marquez
b785da64900b0e33d9ab5d0e6220a6e9c741ee41
66715e8bf0764908e133805d28206107c37c6963
refs/heads/main
2023-03-16T01:22:31.802279
2021-03-09T01:48:34
2021-03-09T01:48:34
346,081,728
1
0
Apache-2.0
2021-03-09T17:04:43
2021-03-09T17:04:42
null
UTF-8
Java
false
false
601
java
package marquez.db; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.util.HashSet; import java.util.Set; import lombok.extern.slf4j.Slf4j; @Slf4j public class MapperUtils { public static Set<String> getColumnNames(ResultSetMetaData metaData) { try { Set<String> columns = new HashSet<>(); for (int i = 1; i <= metaData.getColumnCount(); i++) { columns.add(metaData.getColumnName(i)); } return columns; } catch (SQLException e) { log.error("Unable to get column names", e); throw new RuntimeException(e); } } }
31c250496b3fbdf4fdd43acacd705413503473b8
145565c3d7bcad765d49422b57e3647f5aa22c5e
/src/OopLecture/UserTools.java
3713fb1ebb62bc9b6f5e6ce06634eca069d264d0
[]
no_license
Santamaria-Alex/codeup-java-exercises
406d8e6343f1f2533fac9b8663022d20b0c700e9
5448c0a92458a1ab47f4805e4c910c446861e2af
refs/heads/main
2023-05-21T19:58:36.432465
2021-06-13T04:21:17
2021-06-13T04:21:17
369,643,562
0
0
null
null
null
null
UTF-8
Java
false
false
497
java
package OopLecture; import java.util.Scanner; public class UserTools { public static Scanner scanner = new Scanner(System.in); public static void logIn(User u){ System.out.println("Please enter your password: "); String userPassword = scanner.nextLine(); if (userPassword.equals(u.password)){ System.out.println("you have successfully logged in."); } else { System.out.println("That password is incorrect."); } } }
17c759feb6e755453c8a585d76db0cd4c9636b6d
69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e
/methods/Method_43397.java
d0e28482d4eb0c3232f7739be348ddb579229b13
[]
no_license
P79N6A/icse_20_user_study
5b9c42c6384502fdc9588430899f257761f1f506
8a3676bc96059ea2c4f6d209016f5088a5628f3c
refs/heads/master
2020-06-24T08:25:22.606717
2019-07-25T15:31:16
2019-07-25T15:31:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
454
java
/** * ?????????? * @param currencyPairs * @throws IOException */ public BitZSymbolList getSymbolList(CurrencyPair... currencyPairs) throws IOException { List<String> symbolList=new ArrayList<>(currencyPairs.length); Arrays.stream(currencyPairs).forEach(currencyPair -> symbolList.add(BitZUtils.toPairString(currencyPair))); String symbols=symbolList.stream().collect(Collectors.joining(",")); return bitz.getSymbolList(symbols).getData(); }
7d2127f8d6ddbccac939aee1ec07b99d308f3c8b
06c0f862c2e6e24b722aab51603fc47a6bf4f2eb
/petclinic-app/src/main/java/io/thundra/petclinicapp/vet/Vet.java
896379a3acd12b07afd7c82904f6411d402f4676
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
permissive
mariswa/thundra-sidekick-petclinic-demo
f8e6d0011e1da397e93233b3ab2c2e99b95e44a9
3e1332f2b389d54683e7230eb26076319c984db5
refs/heads/master
2023-05-02T18:24:19.377869
2021-05-04T13:43:41
2021-05-04T13:43:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,391
java
/* * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * 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 io.thundra.petclinicapp.vet; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.Table; import javax.xml.bind.annotation.XmlElement; import io.thundra.petclinicapp.model.Person; import org.springframework.beans.support.MutableSortDefinition; import org.springframework.beans.support.PropertyComparator; /** * Simple JavaBean domain object representing a veterinarian. * * @author Ken Krebs * @author Juergen Hoeller * @author Sam Brannen * @author Arjen Poutsma */ @Entity @Table(name = "vets") public class Vet extends Person { @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "vet_specialties", joinColumns = @JoinColumn(name = "vet_id"), inverseJoinColumns = @JoinColumn(name = "specialty_id")) private Set<Specialty> specialties; protected Set<Specialty> getSpecialtiesInternal() { if (this.specialties == null) { this.specialties = new HashSet<>(); } return this.specialties; } protected void setSpecialtiesInternal(Set<Specialty> specialties) { this.specialties = specialties; } @XmlElement public List<Specialty> getSpecialties() { List<Specialty> sortedSpecs = new ArrayList<>(getSpecialtiesInternal()); PropertyComparator.sort(sortedSpecs, new MutableSortDefinition("name", true, true)); return Collections.unmodifiableList(sortedSpecs); } public int getNrOfSpecialties() { return getSpecialtiesInternal().size(); } public void addSpecialty(Specialty specialty) { getSpecialtiesInternal().add(specialty); } }
92b0dc9e2d20169321735be6bd844b41e0077ef2
a96a0dfcb78c74bf55c87f9666741483d1571a0f
/src/main/java/com/yoda/portal/content/data/HomeInfo.java
591d93e64c77968d8a9fab1dfc863cdc0b2f4621
[]
no_license
askaralim/device-centre
398b9fa9e658bc4a1318f77304042fc78ced2f9f
b93ccceb40dff8bb0575f992e87a40059d128b69
refs/heads/master
2020-04-06T17:59:17.520529
2018-11-29T02:48:55
2018-11-29T02:48:55
157,680,692
0
0
null
null
null
null
UTF-8
Java
false
false
989
java
package com.yoda.portal.content.data; import java.util.List; import com.yoda.homepage.model.HomePage; import com.yoda.kernal.model.Pagination; public class HomeInfo extends DataInfo { List<DataInfo> homePageDatas; DataInfo homePageFeatureData; String pageTitle; Pagination<HomePage> page; public Pagination<HomePage> getPage() { return page; } public void setPage(Pagination<HomePage> page) { this.page = page; } public String getPageTitle() { return pageTitle; } public void setPageTitle(String pageTitle) { this.pageTitle = pageTitle; } public List<DataInfo> getHomePageDatas() { return homePageDatas; } public void setHomePageDatas(List<DataInfo> homePageDatas) { this.homePageDatas = homePageDatas; } public DataInfo getHomePageFeatureData() { return homePageFeatureData; } public void setHomePageFeatureData(DataInfo homePageFeatureData) { this.homePageFeatureData = homePageFeatureData; } }
d2ae003e75064de30725c24a0eea5c3e98baa2e3
395e397c5203400517c787de087ed6864c7fe343
/src/modifiers/Simple.java
00fc323e75cbcf11a9495f58fe74983ef6148364
[]
no_license
nilimapradipm/javaproject
7deae726341bcc04e3d9d4d6074b9a9fe49d0ef8
5d6dce771c950d0fef5bc8f72ed04d34b46a47b5
refs/heads/master
2023-08-02T07:07:41.411544
2021-10-03T12:51:47
2021-10-03T12:51:47
413,063,659
0
0
null
null
null
null
UTF-8
Java
false
false
509
java
package modifiers; class A{ //int data=40; //void msg(){System.out.println("Hello java");} //private int data=40; //private void msg(){System.out.println("Hello java"); public int data=40; public void msg(){System.out.println("Hello java");} } public class Simple{ public static void main(String args[]){ A obj=new A(); System.out.println(obj.data);//Compile Time Error ​ obj.msg();//Compile Time Error ​ } }
97cd1008301addba8841931e7508687fdb788e15
0523e3ed8fe3d87c97c71b105813eb623f50a4e3
/src/main/java/com/ciisa/controller/EspecialidadController.java
4ea7056d46fbb620eb038ffb83c62b9ac696dafa
[]
no_license
dev-miguel-resources/clase5-springboot
0687f585748c37938c13f24f0abe50ad57a9c242
c740e9c0e0aef6ab7900fa69693552abd7fd8bcb
refs/heads/master
2020-09-08T02:01:53.729391
2019-11-11T12:52:29
2019-11-11T12:52:29
220,979,531
0
1
null
null
null
null
UTF-8
Java
false
false
3,598
java
package com.ciisa.controller; import java.net.URI; import java.util.List; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.hateoas.Resource; import org.springframework.hateoas.mvc.ControllerLinkBuilder; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; import com.ciisa.exception.ModeloNotFoundException; import com.ciisa.model.Especialidad; import com.ciisa.service.IEspecialidadService; import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn; @RestController @RequestMapping("/especialidades") public class EspecialidadController { @Autowired private IEspecialidadService service; @GetMapping public ResponseEntity<List<Especialidad>> listar(){ List<Especialidad> lista = service.listar(); return new ResponseEntity<List<Especialidad>>(lista, HttpStatus.OK); } @GetMapping("/{id}") public ResponseEntity<Especialidad> listarPorId(@PathVariable("id") Integer id){ Especialidad obj = service.leerPorId(id); if(obj.getIdEspecialidad() == null) { throw new ModeloNotFoundException("ID NO ENCONTRADO " + id); } return new ResponseEntity<Especialidad>(obj, HttpStatus.OK); } /*@GetMapping("/{id}") public Resource<Especialidad> listarPorId(@PathVariable("id") Integer id){ Especialidad obj = service.leerPorId(id); if(obj.getIdEspecialidad() == null) { throw new ModeloNotFoundException("ID NO ENCONTRADO " + id); } //localhost:8080/especialidads/{id} Resource<Especialidad> recurso = new Resource<Especialidad>(obj); ControllerLinkBuilder linkTo = linkTo(methodOn(this.getClass()).listarPorId(id)); recurso.add(linkTo.withRel("especialidad-resource")); return recurso; }*/ /*@PostMapping public ResponseEntity<Especialidad> registrar(@Valid @RequestBody Especialidad especialidad) { Especialidad obj = service.registrar(especialidad); return new ResponseEntity<Especialidad>(obj, HttpStatus.CREATED); }*/ @PostMapping public ResponseEntity<Object> registrar(@Valid @RequestBody Especialidad especialidad) { Especialidad obj = service.registrar(especialidad); //especialidads/4 URI location = ServletUriComponentsBuilder.fromCurrentRequest().path("/{id}").buildAndExpand(especialidad.getIdEspecialidad()).toUri(); return ResponseEntity.created(location).build(); } @PutMapping public ResponseEntity<Especialidad> modificar(@Valid @RequestBody Especialidad especialidad) { Especialidad obj = service.modificar(especialidad); return new ResponseEntity<Especialidad>(obj, HttpStatus.OK); } @DeleteMapping("/{id}") public ResponseEntity<Object> eliminar(@PathVariable("id") Integer id){ Especialidad obj = service.leerPorId(id); if(obj.getIdEspecialidad() == null) { throw new ModeloNotFoundException("ID NO ENCONTRADO " + id); } service.eliminar(id); return new ResponseEntity<Object>(HttpStatus.OK); } }
ec710029040e9b7af9dcdbbe91d074391750deab
01cef2298308cae637d22c3cde92bc21a4ed040b
/src/main/java/org/cn/socket/core/SocketServer.java
69fa67f901c4189e09c015552fb2685fbd037f8d
[]
no_license
findById/proxy
a80c69df320a2207f9d3dfb2252d0fe57f0bba3d
b75531ac8880ee0922cc540297c602a0e38cbbf9
refs/heads/master
2021-01-21T14:04:58.802484
2016-04-26T09:58:07
2016-04-26T09:58:07
39,049,136
0
0
null
null
null
null
UTF-8
Java
false
false
3,981
java
package org.cn.socket.core; import java.io.IOException; import java.net.InetSocketAddress; import java.nio.ByteBuffer; import java.nio.channels.AsynchronousChannelGroup; import java.nio.channels.AsynchronousServerSocketChannel; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import org.apache.commons.pool.impl.GenericObjectPool; import org.cn.socket.SocketConfig; public final class SocketServer { private AsynchronousChannelGroup workerGroup = null; private AsynchronousServerSocketChannel serverSocket = null; private ExecutorService channelWorkers; private ExecutorService processWorkers; private SocketConfig serverConfig = new SocketConfig(); private SocketAcceptHandler socketAcceptHandler = null; private SocketReadHandler socketReadHandler = new SocketReadHandler(); private GenericObjectPool<ByteBuffer> byteBufferPool = null; private long timeout; private String name; public void startup() { try { int port = serverConfig.getInteger("server.socket.port", 80); int backlog = serverConfig.getInteger("server.socket.backlog", 100); this.timeout = serverConfig.getInteger("server.socket.timeout", 0); this.name = serverConfig.getString("server.name", "unknown-name"); int threadPoolSize = serverConfig.getInteger("server.process.workers", 0); int buffer = serverConfig.getInteger("server.channel.buffer", 8192); boolean direct = serverConfig.getBoolean("server.channel.direct", false); int maxActive = serverConfig.getInteger("server.channel.maxActive", 100); int maxWait = serverConfig.getInteger("server.channel.maxWait", 1000); System.out.println("server.bindPort " + port); System.out.println("server.backlog " + backlog); System.out.println("server.timeout " + timeout + " ms."); System.out.println("server.name " + this.name); System.out.println("server.worker.threads " + threadPoolSize); GenericObjectPool.Config poolConfig = new GenericObjectPool.Config(); poolConfig.maxActive = maxActive; poolConfig.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_FAIL; poolConfig.maxWait = maxWait; // poolConfig.minIdle = minIdle // poolConfig.maxIdle = maxIdle poolConfig.testOnBorrow = false; poolConfig.testOnReturn = false; poolConfig.timeBetweenEvictionRunsMillis = 900000; poolConfig.minEvictableIdleTimeMillis = 6; poolConfig.testWhileIdle = false; byteBufferPool = new GenericObjectPool<ByteBuffer>(new ByteBufferFactory(direct, buffer), poolConfig); int availableProcessors = Runtime.getRuntime().availableProcessors() + 1; channelWorkers = Executors.newFixedThreadPool(availableProcessors, new ProcessorThreadFactory()); if (threadPoolSize > 0) { processWorkers = Executors.newFixedThreadPool(threadPoolSize); } else { processWorkers = Executors.newCachedThreadPool(); } workerGroup = AsynchronousChannelGroup.withCachedThreadPool(channelWorkers, 1); serverSocket = AsynchronousServerSocketChannel.open(workerGroup); serverSocket.bind(new InetSocketAddress(port), backlog); socketAcceptHandler = new SocketAcceptHandler(this); this.accept(); } catch (Exception e) { e.printStackTrace(); } } public void accept() { serverSocket.accept(null, socketAcceptHandler); } public void execute(Runnable session) { processWorkers.submit(session); } public void shutdown() throws IOException { this.channelWorkers.shutdown(); this.processWorkers.shutdown(); this.serverSocket.close(); this.workerGroup.shutdown(); System.out.println("service shutdown completed"); } public long getTimeout() { return timeout; } public String getName() { return name; } public ByteBuffer borrowObject() throws Exception { return byteBufferPool.borrowObject(); } public void returnObject(ByteBuffer buffer) throws Exception { byteBufferPool.returnObject(buffer); } public SocketReadHandler getSocketReadHandler() { return socketReadHandler; } }
5fc11cb064d4563be6f27f9311f0a66124e27e29
4db2a7c65611c7a140b3f84ca218cedd1126ac2b
/src/main/java/co/com/prueba_tecnica/util/Constantes.java
ac71e947ddb8f3c9902c9bdff81285661559eb14
[]
no_license
eidisoviedo/PrecioPaquetesSofka
009e4bf11cdadf47e33bb9308980921ecc15bd99
03252d35dcdbbf83675ed23dcb7bcac8ed4e20a2
refs/heads/master
2022-12-16T21:17:20.491487
2020-09-04T21:32:42
2020-09-04T21:32:42
292,950,325
0
0
null
null
null
null
UTF-8
Java
false
false
863
java
package co.com.prueba_tecnica.util; public class Constantes { public static final String INFO_DESPEDIDA = "Hasta luego"; public static final String INFO_TRANSACCION_EXITOSA = "Paquete registrado exitosamente"; public static final String INFO_CAPACIDAD_ALCANZADA = "Capacidad de carga máxima alcanzada"; public static final String INFO_INGRESE_PESO = "Ingrese el peso del paquete"; public static final String ERROR_OPCION_INVALIDA = "Debe ingresar una opción válida"; public static final String ERROR_CAPACIDAD_ALCANZADA = "Peso de paquete no válido, los paquetes deben estar entre 0-500 kg"; public static final String ERROR_INGRESO_PESO = "Debe ingresara el peso del paquete entre 0-500 kg"; public static final String TITULO_POP_ERROR = "Error"; public static final String TITULO_POP_INFORMACION = "Información"; private Constantes() {} }
43c4e71dc2f6fef7b91659e863d6468faa8f2eba
cc57be84a678de6661a122c95226bc7b3845b388
/src/main/java/com/nextech/erp/model/Status.java
2faedf07238d3bf25aa3ae79fca67741e4c84aac
[]
no_license
renatoapcosta/Erp_project
5cd4a6f43d2877e53fc3e144321170d6bc00a945
0e071ecd487081454fefdd2075871d7e586c6a54
refs/heads/master
2021-01-19T17:25:54.702365
2017-02-18T14:32:39
2017-02-18T14:32:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,643
java
package com.nextech.erp.model; import java.io.Serializable; import javax.persistence.*; import javax.validation.constraints.Size; import org.hibernate.validator.constraints.NotBlank; import com.fasterxml.jackson.annotation.JsonIgnore; import java.sql.Timestamp; import java.util.List; /** * The persistent class for the status database table. * */ @Entity @NamedQuery(name="Status.findAll", query="SELECT s FROM Status s") public class Status implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private long id; @Column(name="created_by") private int createdBy; @Column(name="created_date") private Timestamp createdDate; @NotBlank(message="{description should not be blank}") @Size(min = 4, max = 255, message = "{description sholud be greater than 4 or less than 255 characters}") private String description; private boolean isactive; @NotBlank(message="{name should not be blank}") @Size(min = 2, max = 255, message = "{description sholud be greater than 2 or less than 255 characters}") private String name; @NotBlank(message="{type should not be blank}") @Size(min = 2, max = 255, message = "{type sholud be greater than 2 or less than 255 characters}") private String type; @Column(name="updated_by") private int updatedBy; @Column(name="updated_date") private Timestamp updatedDate; //bi-directional many-to-one association to Productinventoryhistory @JsonIgnore @OneToMany(fetch = FetchType.LAZY, mappedBy = "status", cascade = CascadeType.ALL) private List<Productinventoryhistory> productinventoryhistories; //bi-directional many-to-one association to Productorder @JsonIgnore @OneToMany(fetch = FetchType.LAZY, mappedBy = "status", cascade = CascadeType.ALL) private List<Productorder> productorders; //bi-directional many-to-one association to Rawmaterialinventoryhistory @JsonIgnore @OneToMany(fetch = FetchType.LAZY, mappedBy = "status", cascade = CascadeType.ALL) private List<Rawmaterialinventoryhistory> rawmaterialinventoryhistories; //bi-directional many-to-one association to Rawmaterialorder @JsonIgnore @OneToMany(fetch = FetchType.LAZY, mappedBy = "status", cascade = CascadeType.ALL) private List<Rawmaterialorder> rawmaterialorders; public Status() { } public Status(int id) { this.id=id; } public long getId() { return this.id; } public void setId(long id) { this.id = id; } public int getCreatedBy() { return this.createdBy; } public void setCreatedBy(int createdBy) { this.createdBy = createdBy; } public Timestamp getCreatedDate() { return this.createdDate; } public void setCreatedDate(Timestamp createdDate) { this.createdDate = createdDate; } public String getDescription() { return this.description; } public void setDescription(String description) { this.description = description; } public boolean getIsactive() { return this.isactive; } public void setIsactive(boolean isactive) { this.isactive = isactive; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public String getType() { return this.type; } public void setType(String type) { this.type = type; } public int getUpdatedBy() { return this.updatedBy; } public void setUpdatedBy(int updatedBy) { this.updatedBy = updatedBy; } public Timestamp getUpdatedDate() { return this.updatedDate; } public void setUpdatedDate(Timestamp updatedDate) { this.updatedDate = updatedDate; } public List<Productinventoryhistory> getProductinventoryhistories() { return this.productinventoryhistories; } public void setProductinventoryhistories(List<Productinventoryhistory> productinventoryhistories) { this.productinventoryhistories = productinventoryhistories; } public Productinventoryhistory addProductinventoryhistory(Productinventoryhistory productinventoryhistory) { getProductinventoryhistories().add(productinventoryhistory); productinventoryhistory.setStatus(this); return productinventoryhistory; } public Productinventoryhistory removeProductinventoryhistory(Productinventoryhistory productinventoryhistory) { getProductinventoryhistories().remove(productinventoryhistory); productinventoryhistory.setStatus(null); return productinventoryhistory; } public List<Productorder> getProductorders() { return this.productorders; } public void setProductorders(List<Productorder> productorders) { this.productorders = productorders; } public Productorder addProductorder(Productorder productorder) { getProductorders().add(productorder); productorder.setStatus(this); return productorder; } public Productorder removeProductorder(Productorder productorder) { getProductorders().remove(productorder); productorder.setStatus(null); return productorder; } public List<Rawmaterialinventoryhistory> getRawmaterialinventoryhistories() { return this.rawmaterialinventoryhistories; } public void setRawmaterialinventoryhistories(List<Rawmaterialinventoryhistory> rawmaterialinventoryhistories) { this.rawmaterialinventoryhistories = rawmaterialinventoryhistories; } public Rawmaterialinventoryhistory addRawmaterialinventoryhistory(Rawmaterialinventoryhistory rawmaterialinventoryhistory) { getRawmaterialinventoryhistories().add(rawmaterialinventoryhistory); rawmaterialinventoryhistory.setStatus(this); return rawmaterialinventoryhistory; } public Rawmaterialinventoryhistory removeRawmaterialinventoryhistory(Rawmaterialinventoryhistory rawmaterialinventoryhistory) { getRawmaterialinventoryhistories().remove(rawmaterialinventoryhistory); rawmaterialinventoryhistory.setStatus(null); return rawmaterialinventoryhistory; } public List<Rawmaterialorder> getRawmaterialorders() { return this.rawmaterialorders; } public void setRawmaterialorders(List<Rawmaterialorder> rawmaterialorders) { this.rawmaterialorders = rawmaterialorders; } public Rawmaterialorder addRawmaterialorder(Rawmaterialorder rawmaterialorder) { getRawmaterialorders().add(rawmaterialorder); rawmaterialorder.setStatus(this); return rawmaterialorder; } public Rawmaterialorder removeRawmaterialorder(Rawmaterialorder rawmaterialorder) { getRawmaterialorders().remove(rawmaterialorder); rawmaterialorder.setStatus(null); return rawmaterialorder; } }
8a3275ea1ca05a0116a5292fdcef4e0be648a9aa
491f39db6b557dd845236b9d5375030047a09dea
/src/main/java/com/hirak/ecommerce/app/dto/OrderFormDto.java
80187f90b45bd1230874dcd06f3a436c358a3f35
[]
no_license
hirakm53/ecommerce-app
4a5741daa42d5d4f9a47aa6fac0cfe3516ebaa15
f7d417ed0cc51a5a4ec0eb3a3293543eb557c004
refs/heads/master
2022-07-05T20:15:09.702608
2020-05-14T06:16:59
2020-05-14T06:16:59
263,563,021
0
0
null
2020-05-14T06:17:01
2020-05-13T07:56:23
null
UTF-8
Java
false
false
548
java
package com.hirak.ecommerce.app.dto; import java.io.Serializable; import java.util.List; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; /** * @author hirak_mahanta * */ @Getter @Setter @NoArgsConstructor @AllArgsConstructor @ToString public class OrderFormDto implements Serializable { /** * */ private static final long serialVersionUID = -7420354906366213071L; private List<OrderProductDto> orderProductDtoList; private String emailId; }
62d03b7d56fe1868838f6ee1a278bed8d97add39
514821b7aee885cd3e05211598ef152e09b22e61
/app/src/main/java/com/lai/mtc/MTC.java
67af68ba118cfe4d05c46bc2ef9d1fba7cae3ae7
[ "Apache-2.0" ]
permissive
WarrenLin/Comic-MTC
667e6fec19acc05d4e21a8352bdce1a2f54beb0a
05fe07169cd8f984916e1b3a28db6f4bbc847991
refs/heads/master
2021-04-09T11:17:37.149698
2018-03-15T09:10:13
2018-03-15T09:10:13
125,485,019
1
0
null
2018-03-16T08:15:00
2018-03-16T08:14:59
null
UTF-8
Java
false
false
1,345
java
package com.lai.mtc; import android.app.Activity; import android.app.Application; import com.lai.mtc.dao.bean.MyObjectBox; import com.lai.mtc.di.component.DaggerAppComponent; import com.lai.mtc.mvp.http.RetrofitHelper; import javax.inject.Inject; import dagger.android.AndroidInjector; import dagger.android.DispatchingAndroidInjector; import dagger.android.HasActivityInjector; import io.objectbox.BoxStore; /** * @author Lai * @time 2017/12/12 16:21 * @describe describe */ public class MTC extends Application implements HasActivityInjector { public static MTC getApp() { return mMTC; } public static MTC mMTC; private static BoxStore boxStore; @Inject DispatchingAndroidInjector<Activity> dispatchingActivityInjector; public static BoxStore getBoxStore() { return boxStore; } public static void setBoxStore(BoxStore boxStore) { MTC.boxStore = boxStore; } @Override public void onCreate() { super.onCreate(); mMTC = this; setBoxStore(MyObjectBox.builder().androidContext(this).build()); DaggerAppComponent.builder().application(this).baseUrl(RetrofitHelper.BASE_URL).build().inject(this); } @Override public AndroidInjector<Activity> activityInjector() { return dispatchingActivityInjector; } }
a025dad7a0ea5f590dad16445ad76459a01b4f95
2d746a29a2e6833b8f6e7d62b2c1d716fd08085d
/FilaLista/app/src/main/java/com/desarrollodeaplicaciones/filalista/Fuze.java
d4c73a8d9b3a1807a26df0c17eb450ee009f6d68
[]
no_license
Irbing5070/AplicacionInterfaz
859b49d24d71853ec8622fce98b94823456c5938
339b592de4d74ddd720105d7d6029852f291e286
refs/heads/master
2021-01-20T11:56:52.140921
2017-02-21T05:41:40
2017-02-21T05:41:40
82,640,055
0
0
null
null
null
null
UTF-8
Java
false
false
804
java
package com.desarrollodeaplicaciones.filalista; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; /** * Created by Irbing on 15/02/2017. */ public class Fuze extends AppCompatActivity { Button btnBack; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fuze); btnBack=(Button)findViewById(R.id.volver); btnBack.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { Intent next = new Intent(Fuze.this, MainActivity.class); startActivity(next); } }); } }
65b29fe6d6d719ffa529dc2e4ad4c7a183619a51
f52981eb9dd91030872b2b99c694ca73fb2b46a8
/Source/Plugins/Core/com.equella.core/src/com/tle/freetext/IndexedItemFactory.java
cbad1823cca68d2a114d112423203eff4b1f6af7
[ "BSD-3-Clause", "LGPL-2.0-or-later", "LGPL-2.1-only", "LicenseRef-scancode-jdom", "GPL-1.0-or-later", "ICU", "CDDL-1.0", "LGPL-3.0-only", "LicenseRef-scancode-other-permissive", "CPL-1.0", "MIT", "GPL-2.0-only", "Apache-2.0", "NetCDF", "Apache-1.1", "EPL-1.0", "Classpath-exception-2.0", "CDDL-1.1", "LicenseRef-scancode-freemarker" ]
permissive
phette23/Equella
baa41291b91d666bf169bf888ad7e9f0b0db9fdb
56c0d63cc1701a8a53434858a79d258605834e07
refs/heads/master
2020-04-19T20:55:13.609264
2019-01-29T03:27:40
2019-01-29T22:31:24
168,427,559
0
0
Apache-2.0
2019-01-30T22:49:08
2019-01-30T22:49:08
null
UTF-8
Java
false
false
843
java
/* * Copyright 2017 Apereo * * 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.tle.freetext; import com.tle.beans.Institution; import com.tle.beans.item.ItemIdKey; import com.tle.core.guice.BindFactory; @BindFactory public interface IndexedItemFactory { IndexedItem create(ItemIdKey key, Institution institution); }
5d0a34bbdd12aae0883c593fbaa23c717a4b0569
173e8b54facc664fd5f5c11bd5a8d63a8efa25ed
/app/src/main/java/xyz/iiemyewrs/www/technica/activities/Events.java
f2e1fd821fddcddfacf739ac21f2a99565729bf4
[]
no_license
rohittayal595/TerraTechnica
e3a202fdd9b56ec54913df549da3a163034227c7
3d1461a44dffd41957be72aa7c82cba11a67422e
refs/heads/master
2021-01-20T10:56:29.085157
2016-04-01T12:47:25
2016-04-01T12:47:25
55,229,545
1
1
null
null
null
null
UTF-8
Java
false
false
16,092
java
package xyz.iiemyewrs.www.technica.activities; import android.content.Intent; import android.support.design.widget.TabLayout; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v4.app.DialogFragment; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.lang.reflect.Field; import xyz.iiemyewrs.www.technica.R; import xyz.iiemyewrs.www.technica.adapters.EventsListAdapter; import xyz.iiemyewrs.www.technica.adapters.NotificationListAdapter; import xyz.iiemyewrs.www.technica.appConfig.Constants; import xyz.iiemyewrs.www.technica.fragments.DialougeBox; import xyz.iiemyewrs.www.technica.helper.ParseJson; import xyz.iiemyewrs.www.technica.helper.SQLiteHandler; public class Events extends AppCompatActivity { /** * The {@link android.support.v4.view.PagerAdapter} that will provide * fragments for each of the sections. We use a * {@link FragmentPagerAdapter} derivative, which will keep every * loaded fragment in memory. If this becomes too memory intensive, it * may be best to switch to a * {@link android.support.v4.app.FragmentStatePagerAdapter}. */ private SectionsPagerAdapter mSectionsPagerAdapter; /** * The {@link ViewPager} that will host the section contents. */ private ViewPager mViewPager; SQLiteHandler db; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_events); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); sendRequest(); // Create the adapter that will return a fragment for each of the three // primary sections of the activity. mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.container); mViewPager.setAdapter(mSectionsPagerAdapter); TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(mViewPager); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_events, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_refresh) { sendRequest(); return true; } else if (item.getItemId() == android.R.id.home) { onBackPressed(); return true; } return super.onOptionsItemSelected(item); } public void sendRequest() { StringRequest stringRequest = new StringRequest(Constants.URL_EVENTS, new Response.Listener<String>() { @Override public void onResponse(String response) { Log.e("JSON RESPONSE:", response); try { JSONObject jsonObject = new JSONObject(response); JSONArray result = jsonObject.getJSONArray("result"); String[] ids = new String[result.length()]; String[] eventName = new String[result.length()]; String[] eventDay = new String[result.length()]; String[] eventVenue = new String[result.length()]; String[] eventTime = new String[result.length()]; String[] eventDisc = new String[result.length()]; for (int i = 0; i < result.length(); i++) { JSONObject jo = result.getJSONObject(i); ids[i] = jo.getString("_ID"); eventName[i] = jo.getString("event_name"); eventDay[i] = jo.getString("day"); eventVenue[i] = jo.getString("venue"); eventTime[i] = jo.getString("time"); eventDisc[i] = jo.getString("disc"); } db = new SQLiteHandler(getApplicationContext()); db.addEventsToDatabase(ids, eventName, eventDay, eventVenue, eventTime, eventDisc); mViewPager.setAdapter(mSectionsPagerAdapter); Toast.makeText(Events.this,"List Updated",Toast.LENGTH_LONG).show(); } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.e("VOLLEY ERROR:", error.toString()); Toast.makeText(Events.this, "Server not reachable", Toast.LENGTH_LONG).show(); } }); RequestQueue requestQueue = Volley.newRequestQueue(this); requestQueue.add(stringRequest); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { /** * The fragment argument representing the section number for this * fragment. */ private static final String ARG_SECTION_NUMBER = "section_number"; public PlaceholderFragment() { } /** * Returns a new instance of this fragment for the given section * number. */ public static PlaceholderFragment newInstance(int sectionNumber) { PlaceholderFragment fragment = new PlaceholderFragment(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); fragment.setArguments(args); return fragment; } @Override public void onDetach() { super.onDetach(); RequestQueue requestQueue = Volley.newRequestQueue(getActivity()); requestQueue.cancelAll(new RequestQueue.RequestFilter(){ @Override public boolean apply(Request<?> request) { return true; } }); try { Field chileFragmentManager= Fragment.class.getDeclaredField("mChildFragmentManager"); chileFragmentManager.setAccessible(true); chileFragmentManager.set(this,null); }catch (NoSuchFieldException e){ throw new RuntimeException(e); }catch (IllegalAccessException e){ throw new RuntimeException(e); } } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_events, container, false); SQLiteHandler db; ListView mListView = (ListView) rootView.findViewById(R.id.events_list_view); View emptyView=rootView.findViewById(R.id.listview_events_empty); mListView.setEmptyView(emptyView); db = new SQLiteHandler(getActivity().getApplicationContext()); Object[] obj = db.getEventsDataFromDatabase(); final Object[] obj1=(Object[])obj[0]; final Object[] obj2=(Object[])obj[1]; final Object[] obj3=(Object[])obj[2]; final Object[] obj4=(Object[])obj[3]; final Object[] obj5=(Object[])obj[4]; final Object[] obj6=(Object[])obj[5]; EventsListAdapter cl; if(getArguments().getInt(ARG_SECTION_NUMBER)==1) { cl = new EventsListAdapter(getActivity(), (String[])obj1[0],(String[])obj1[1],(String[])obj1[2]); mListView.setAdapter(cl); mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { DialogFragment newFragment = new DialougeBox(); Bundle args = new Bundle(); args.putString("name", ((String[]) obj1[0])[position]); args.putString("disc", ((String[]) obj1[3])[position]); newFragment.setArguments(args); newFragment.show(getActivity().getSupportFragmentManager(), "EVENT_DISC"); } }); }else if(getArguments().getInt(ARG_SECTION_NUMBER)==2){ cl = new EventsListAdapter(getActivity(), (String[])obj2[0],(String[])obj2[1],(String[])obj2[2]); mListView.setAdapter(cl); mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { DialogFragment newFragment = new DialougeBox(); Bundle args = new Bundle(); args.putString("name", ((String[]) obj2[0])[position]); args.putString("disc", ((String[]) obj2[3])[position]); newFragment.setArguments(args); newFragment.show(getActivity().getSupportFragmentManager(), "EVENT_DISC"); } }); }else if(getArguments().getInt(ARG_SECTION_NUMBER)==3){ cl = new EventsListAdapter(getActivity(), (String[])obj3[0],(String[])obj3[1],(String[])obj3[2]); mListView.setAdapter(cl); mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { DialogFragment newFragment = new DialougeBox(); Bundle args = new Bundle(); args.putString("name", ((String[]) obj3[0])[position]); args.putString("disc", ((String[]) obj3[3])[position]); newFragment.setArguments(args); newFragment.show(getActivity().getSupportFragmentManager(), "EVENT_DISC"); } }); }else if(getArguments().getInt(ARG_SECTION_NUMBER)==4){ cl = new EventsListAdapter(getActivity(), (String[])obj4[0],(String[])obj4[1],(String[])obj4[2]); mListView.setAdapter(cl); mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { DialogFragment newFragment = new DialougeBox(); Bundle args = new Bundle(); args.putString("name", ((String[]) obj4[0])[position]); args.putString("disc", ((String[]) obj4[3])[position]); newFragment.setArguments(args); newFragment.show(getActivity().getSupportFragmentManager(), "EVENT_DISC"); } }); }else if(getArguments().getInt(ARG_SECTION_NUMBER)==5){ cl = new EventsListAdapter(getActivity(), (String[])obj5[0],(String[])obj5[1],(String[])obj5[2]); mListView.setAdapter(cl); mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { DialogFragment newFragment = new DialougeBox(); Bundle args = new Bundle(); args.putString("name", ((String[]) obj5[0])[position]); args.putString("disc", ((String[]) obj5[3])[position]); newFragment.setArguments(args); newFragment.show(getActivity().getSupportFragmentManager(), "EVENT_DISC"); } }); }else if(getArguments().getInt(ARG_SECTION_NUMBER)==6){ cl = new EventsListAdapter(getActivity(), (String[])obj6[0],(String[])obj6[1],(String[])obj6[2]); mListView.setAdapter(cl); mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { DialogFragment newFragment = new DialougeBox(); Bundle args = new Bundle(); args.putString("name", ((String[]) obj6[0])[position]); args.putString("disc", ((String[]) obj6[3])[position]); newFragment.setArguments(args); newFragment.show(getActivity().getSupportFragmentManager(), "EVENT_DISC"); } }); } return rootView; } } /** * A {@link FragmentPagerAdapter} that returns a fragment corresponding to * one of the sections/tabs/pages. */ public class SectionsPagerAdapter extends FragmentPagerAdapter { public SectionsPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { // getItem is called to instantiate the fragment for the given page. // Return a PlaceholderFragment (defined as a static inner class below). return PlaceholderFragment.newInstance(position + 1); } @Override public int getCount() { return 6; } @Override public CharSequence getPageTitle(int position) { switch (position) { case 0: return "Codeconnect"; case 1: return "INnoVITE"; case 2: return "Botmania"; case 3: return "Paradox"; case 4: return "Workshops"; case 5: return "Misc"; } return null; } } }
dcd14d87668a5841ecf12fc4de6c190cb4698a57
5675fa422cdc15704cd08cfc8b40bcb50530c882
/src/main/java/com/lcf/model/Categories.java
1c19348463b8929a072750567a157cfc26e2c7d6
[]
no_license
liujianview/myBlog
7b05b5cf9a3e9cb5d21c53a3a0dcf5b81104632b
ccb247daa1d0e373f6e04942546b25fb042762bc
refs/heads/master
2023-03-14T22:37:14.005692
2021-03-26T02:49:57
2021-03-26T02:49:57
331,816,935
10
1
null
null
null
null
UTF-8
Java
false
false
220
java
package com.lcf.model; import lombok.Data; /** * @author: liuchuanfeng * @Date: 2020/7/17 20:49 * Describe: 文章分类 */ @Data public class Categories { private int id; private String categoryName; }
98df53132b7a02fadb03964b0e01c489809e2176
d19584bbb38d095f9c6fd400435b306aea5037b7
/src/main/java/com/admission/dao/StudentEnquiryRepository.java
3e860553778c1e1b37c2759283e9809cf726f355
[]
no_license
Anu421/Teamproject2
7ab84834c151f97af69021d0c8de38cbaf2543eb
7d162bf5e3954ef59b2dd2b3957a6df2b562f237
refs/heads/master
2023-05-04T13:46:21.873795
2021-05-28T05:47:32
2021-05-28T05:47:32
371,590,211
0
0
null
null
null
null
UTF-8
Java
false
false
470
java
package com.admission.dao; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; import com.admission.model.StudentEnquiry; /** * @author ${Vijay Gupta} * * Aug 25, 2017 */ @Repository public interface StudentEnquiryRepository extends JpaRepository<StudentEnquiry, Integer>{ public List<StudentEnquiry> findByUid(String i); }
93dfba5d1a9f377e4103cf1f49b3f647ce23f07b
f0feba498c295e7675ef94438fa22fd26264c385
/analysis/src/com/ls/common/User.java
17a7574446ddd25d571db07a47b22fcd60373a2e
[]
no_license
Neil-123-aaa/trifle
e4df9b7a35efd5b76314d490072605b6f1c189e6
cf2cb2a9d7afd47ac436fcf96c7e6fa6debcf75e
refs/heads/main
2023-06-04T10:12:22.990681
2021-07-02T16:38:11
2021-07-02T16:38:11
382,400,846
0
0
null
2021-07-02T16:18:20
2021-07-02T16:18:19
null
UTF-8
Java
false
false
1,146
java
package com.ls.common; public class User { public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public int getTel() { return tel; } public void setTel(int tel) { this.tel = tel; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } private int id; @Override public String toString() { return "User{" + "id=" + id + ", name='" + name + '\'' + ", password='" + password + '\'' + ", tel=" + tel + ", category='" + category + '\'' + '}'; } private String name; private String password; private int tel; private String category; }
[ "" ]
f8b0655971da77032bcdfea9bcacad93e1923c0b
e8efa92f57bb5cffddf627123924f7a22f5a34ae
/src/projetoed/menus/MenuPrincipal.java
1daf68e486588d3bffd6e0ec6e26adca35b7063f
[]
no_license
AnBruLuMaMi/projeto-ed
686ce9de73dc01713ab039a50412e2b9934099a9
85953d3b7600d0a8e16273c1e1c6ba4d695f055b
refs/heads/main
2023-05-12T22:14:34.547580
2021-06-02T01:10:11
2021-06-02T01:10:11
373,001,207
0
0
null
null
null
null
UTF-8
Java
false
false
1,533
java
package projetoed.menus; import projetoed.menus.interfaces.IMenu; public class MenuPrincipal extends Menu { public MenuPrincipal() { super("Estruturas de Dados", false, "Encerrar"); opcoes.add(new OpcaoMenu(1, "TAD-Lista Arranjo", "", () -> exibirMenuOpcao(1))); opcoes.add(new OpcaoMenu(2, "TAD-Pilha", "", () -> exibirMenuOpcao(2))); opcoes.add(new OpcaoMenu(3, "TAD-Fila", "", () -> exibirMenuOpcao(3))); opcoes.add(new OpcaoMenu(4, "TAD-Lista de Nodos", "", () -> exibirMenuOpcao(4))); opcoes.add(new OpcaoMenu(5, "TAD-Árvore Genérica", "", () -> exibirMenuOpcao(5))); opcoes.add(new OpcaoMenu(6, "TAD-Árvore Binária", "", () -> exibirMenuOpcao(6))); opcoes.add(new OpcaoMenu(7, "TAD-Fila de Prioridade", "", () -> exibirMenuOpcao(7))); opcoes.add(new OpcaoMenu(8, "TAD-Mapa", "", () -> exibirMenuOpcao(8))); opcoes.add(new OpcaoMenu(9, "TAD-Dicionário", "", () -> exibirMenuOpcao(9))); opcoes.add(new OpcaoMenu(10, "TAD-Mapa Ordenado – ABB", "", () -> exibirMenuOpcao(10))); opcoes.add(new OpcaoMenu(11, "TAD-Mapa Ordenado – AVL", "", () -> exibirMenuOpcao(11))); opcoes.add(new OpcaoMenu(12, "TAD-Grafos", "", () -> exibirMenuOpcao(12))); mensagensInputOpcao.add("Selecione o número correspondente da estrutura que deseja testar: "); } void exibirMenuOpcao(int opcao) { IMenu menuOpcao = MenuFactory.create(opcao); menuOpcao.exibir(); } }
d3df4bfe047d3988ff4252f4509a500945baa9c5
ed019fb45159d3b043547d5e019f0252d889466f
/友寻/android/iyouxun/src/com/iyouxun/data/beans/NewsAuthInfoBean.java
77a08fb220331ce5f3ee732684c10423cb3fd9e7
[]
no_license
chao2android/iOSProjects
601ed216d28b076bab40e16491131f7e2df35941
9adf136126e4b7b8e1729aeb0188855ea28f52ac
refs/heads/master
2021-01-20T15:42:29.510229
2015-12-29T04:50:23
2015-12-29T04:50:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
580
java
package com.iyouxun.data.beans; import java.io.Serializable; import java.util.ArrayList; /** * 动态查看权限信息 * * @ClassName: NewsAuthInfoBean * @author likai * @date 2015-3-7 上午10:50:49 * */ public class NewsAuthInfoBean implements Serializable { /** * @Fields serialVersionUID : TODO */ private static final long serialVersionUID = -3079024092083290748L; /** 权限类型(1:所有,2:指定分组) */ public int lookAuthType = 1; /** 查看权限 */ public ArrayList<String> lookAuth = new ArrayList<String>(); }
cf774d5c1e539993ee7081658b2519403f6fbf04
805cfdcbb01b5eef63975f99f737515e5f90500b
/app/src/main/java/com/fortunekidew/pewaad/activities/settings/NotificationsSettingsActivity.java
42725904fa3c70f440727d880619dca71c154305
[]
no_license
brianmwadime/Pewaa-Android
6d1cd6df49ce275136ed82e326bdb1aa9687e733
e793143e7b06473e86cfd22772b6c2cd32e455f6
refs/heads/master
2020-02-13T17:46:12.912616
2017-10-20T13:19:36
2017-10-20T13:19:36
70,031,998
1
0
null
null
null
null
UTF-8
Java
false
false
6,608
java
package com.fortunekidew.pewaad.activities.settings; import android.graphics.Color; import android.media.Ringtone; import android.media.RingtoneManager; import android.net.Uri; import android.os.Bundle; import android.preference.ListPreference; import android.preference.PreferenceActivity; import android.preference.RingtonePreference; import android.support.v7.widget.Toolbar; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.MenuItem; import android.widget.LinearLayout; import com.fortunekidew.pewaad.R; /** * Created by Brian Mwakima on 12/25/16. * * @Email : [email protected] * @Author : https://twitter.com/brianmwadime */ public class NotificationsSettingsActivity extends PreferenceActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.notifications_settings); LinearLayout root = (LinearLayout) findViewById(android.R.id.list).getParent().getParent().getParent(); Toolbar toolbar = (Toolbar) LayoutInflater.from(this).inflate(R.layout.app_bar, root, false); root.addView(toolbar, 0); toolbar.setNavigationIcon(R.drawable.ic_arrow_back_24dp); toolbar.setNavigationOnClickListener(v -> onBackPressed()); toolbar.setTitle(R.string.notifications); toolbar.setTitleTextColor(Color.WHITE); setupMessageRingTone(); setupMessageLight(); } private void setupMessageGroupLight() { ListPreference lightPreferenceMessage = (ListPreference) findPreference(getString(R.string.key_message_group_notifications_settings_light)); String lightNameSummary = PreferenceSettingsManager.getDefault_message_group_notifications_settings_light(this); switch (lightNameSummary) { case "#03A9F4": lightPreferenceMessage.setSummary("Blue"); break; case "#ffffff": lightPreferenceMessage.setSummary("White"); break; case "#f11409": lightPreferenceMessage.setSummary("Red"); break; case "#EEFF41": lightPreferenceMessage.setSummary("Yellow"); break; case "#0EC654": lightPreferenceMessage.setSummary("Green"); break; case "#00FFFF": lightPreferenceMessage.setSummary("Cyan"); break; case "#0A7E8C": lightPreferenceMessage.setSummary("Metalic"); break; } lightPreferenceMessage.setDefaultValue(lightNameSummary); lightPreferenceMessage.setOnPreferenceChangeListener((preference, o) -> { String stringValue = o.toString(); ListPreference listPreference = (ListPreference) preference; int index = listPreference.findIndexOfValue(stringValue); preference.setSummary(index >= 0 ? listPreference.getEntries()[index] : null); preference.setDefaultValue(stringValue); return true; }); } private void setupMessageLight() { ListPreference lightPreferenceMessage = (ListPreference) findPreference(getString(R.string.key_message_notifications_settings_light)); String lightNameSummary = PreferenceSettingsManager.getDefault_message_notifications_settings_light(this); switch (lightNameSummary) { case "#03A9F4": lightPreferenceMessage.setSummary("Blue"); break; case "#ffffff": lightPreferenceMessage.setSummary("White"); break; case "#f11409": lightPreferenceMessage.setSummary("Red"); break; case "#EEFF41": lightPreferenceMessage.setSummary("Yellow"); break; case "#0EC654": lightPreferenceMessage.setSummary("Green"); break; case "#00FFFF": lightPreferenceMessage.setSummary("Cyan"); break; case "#0A7E8C": lightPreferenceMessage.setSummary("Metalic"); break; } lightPreferenceMessage.setDefaultValue(lightNameSummary); lightPreferenceMessage.setOnPreferenceChangeListener((preference, o) -> { String stringValue = o.toString(); ListPreference listPreference = (ListPreference) preference; int index = listPreference.findIndexOfValue(stringValue); preference.setSummary(index >= 0 ? listPreference.getEntries()[index] : null); preference.setDefaultValue(stringValue); return true; }); } private void setupMessageRingTone() { RingtonePreference ringtonePreferenceMessage = (RingtonePreference) findPreference(getString(R.string.key_message_notifications_settings_tone)); Ringtone userRingtoneDefault = RingtoneManager.getRingtone(ringtonePreferenceMessage.getContext(), PreferenceSettingsManager.getDefault_message_notifications_settings_tone(this)); ringtonePreferenceMessage.setSummary(userRingtoneDefault.getTitle(this)); ringtonePreferenceMessage.setDefaultValue(userRingtoneDefault); ringtonePreferenceMessage.setOnPreferenceChangeListener((preference, o) -> { String stringValue = o.toString(); if (TextUtils.isEmpty(stringValue)) { preference.setSummary(R.string.message_notifications_settings_tone_silent); } else { Ringtone ringtone = RingtoneManager.getRingtone(preference.getContext(), Uri.parse(stringValue)); if (ringtone == null) { preference.setSummary(null); } else { String name = ringtone.getTitle(preference.getContext()); preference.setSummary(name); } preference.setDefaultValue(Uri.parse(stringValue)); } return true; }); } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { overridePendingTransition(R.anim.push_up_in, R.anim.push_up_out); finish(); } return super.onOptionsItemSelected(item); } @Override public void onBackPressed() { super.onBackPressed(); overridePendingTransition(R.anim.push_up_in, R.anim.push_up_out); finish(); } }
2cf441fb737ac4d1db5f6eb9989a0d58f885f18d
1074c97cdd65d38c8c6ec73bfa40fb9303337468
/rda0105-agl-aus-java-a43926f304e3/xms-delivery/src/main/java/com/gms/delivery/dhl/xmlpi/datatype/error/response/ExportDeclaration.java
9cefcf64d1dd82cb74d498213c5c1a4c8c297f49
[]
no_license
gahlawat4u/repoName
0361859254766c371068e31ff7be94025c3e5ca8
523cf7d30018b7783e90db98e386245edad34cae
refs/heads/master
2020-05-17T01:26:00.968575
2019-04-29T06:11:52
2019-04-29T06:11:52
183,420,568
0
0
null
null
null
null
UTF-8
Java
false
false
10,004
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2016.01.18 at 08:12:03 PM ICT // package com.gms.delivery.dhl.xmlpi.datatype.error.response; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; import java.util.ArrayList; import java.util.List; /** * <p>Java class for ExportDeclaration complex type. * <p> * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;complexType name="ExportDeclaration"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="InterConsignee" minOccurs="0"> * &lt;simpleType> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"> * &lt;maxLength value="70"/> * &lt;minLength value="0"/> * &lt;/restriction> * &lt;/simpleType> * &lt;/element> * &lt;element name="IsPartiesRelation" type="{http://www.dhl.com/datatypes}YesNo" minOccurs="0"/> * &lt;element name="ECCN" minOccurs="0"> * &lt;simpleType> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"> * &lt;minLength value="0"/> * &lt;maxLength value="11"/> * &lt;/restriction> * &lt;/simpleType> * &lt;/element> * &lt;element name="SignatureName" type="{http://www.dhl.com/datatypes}SignatureName" minOccurs="0"/> * &lt;element name="SignatureTitle" type="{http://www.dhl.com/datatypes}SignatureTitle" minOccurs="0"/> * &lt;element name="ExportReason" type="{http://www.dhl.com/datatypes}ExportReason" minOccurs="0"/> * &lt;element name="ExportReasonCode" type="{http://www.dhl.com/datatypes}ExportReasonCode" minOccurs="0"/> * &lt;element name="SedNumber" type="{http://www.dhl.com/datatypes}SEDNumber" minOccurs="0"/> * &lt;element name="SedNumberType" type="{http://www.dhl.com/datatypes}SEDNumberType" minOccurs="0"/> * &lt;element name="MxStateCode" minOccurs="0"> * &lt;simpleType> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"> * &lt;minLength value="0"/> * &lt;maxLength value="2"/> * &lt;/restriction> * &lt;/simpleType> * &lt;/element> * &lt;element name="ExportLineItem" type="{http://www.dhl.com/datatypes}ExportLineItem" maxOccurs="unbounded"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ExportDeclaration", propOrder = { "interConsignee", "isPartiesRelation", "eccn", "signatureName", "signatureTitle", "exportReason", "exportReasonCode", "sedNumber", "sedNumberType", "mxStateCode", "exportLineItem" }) public class ExportDeclaration { @XmlElement(name = "InterConsignee") protected String interConsignee; @XmlElement(name = "IsPartiesRelation") protected YesNo isPartiesRelation; @XmlElement(name = "ECCN") protected String eccn; @XmlElement(name = "SignatureName") protected String signatureName; @XmlElement(name = "SignatureTitle") protected String signatureTitle; @XmlElement(name = "ExportReason") protected String exportReason; @XmlElement(name = "ExportReasonCode") protected ExportReasonCode exportReasonCode; @XmlElement(name = "SedNumber") protected SEDNumber sedNumber; @XmlElement(name = "SedNumberType") protected SEDNumberType sedNumberType; @XmlElement(name = "MxStateCode") protected String mxStateCode; @XmlElement(name = "ExportLineItem", required = true) protected List<ExportLineItem> exportLineItem; /** * Gets the value of the interConsignee property. * * @return possible object is * {@link String } */ public String getInterConsignee() { return interConsignee; } /** * Sets the value of the interConsignee property. * * @param value allowed object is * {@link String } */ public void setInterConsignee(String value) { this.interConsignee = value; } /** * Gets the value of the isPartiesRelation property. * * @return possible object is * {@link YesNo } */ public YesNo getIsPartiesRelation() { return isPartiesRelation; } /** * Sets the value of the isPartiesRelation property. * * @param value allowed object is * {@link YesNo } */ public void setIsPartiesRelation(YesNo value) { this.isPartiesRelation = value; } /** * Gets the value of the eccn property. * * @return possible object is * {@link String } */ public String getECCN() { return eccn; } /** * Sets the value of the eccn property. * * @param value allowed object is * {@link String } */ public void setECCN(String value) { this.eccn = value; } /** * Gets the value of the signatureName property. * * @return possible object is * {@link String } */ public String getSignatureName() { return signatureName; } /** * Sets the value of the signatureName property. * * @param value allowed object is * {@link String } */ public void setSignatureName(String value) { this.signatureName = value; } /** * Gets the value of the signatureTitle property. * * @return possible object is * {@link String } */ public String getSignatureTitle() { return signatureTitle; } /** * Sets the value of the signatureTitle property. * * @param value allowed object is * {@link String } */ public void setSignatureTitle(String value) { this.signatureTitle = value; } /** * Gets the value of the exportReason property. * * @return possible object is * {@link String } */ public String getExportReason() { return exportReason; } /** * Sets the value of the exportReason property. * * @param value allowed object is * {@link String } */ public void setExportReason(String value) { this.exportReason = value; } /** * Gets the value of the exportReasonCode property. * * @return possible object is * {@link ExportReasonCode } */ public ExportReasonCode getExportReasonCode() { return exportReasonCode; } /** * Sets the value of the exportReasonCode property. * * @param value allowed object is * {@link ExportReasonCode } */ public void setExportReasonCode(ExportReasonCode value) { this.exportReasonCode = value; } /** * Gets the value of the sedNumber property. * * @return possible object is * {@link SEDNumber } */ public SEDNumber getSedNumber() { return sedNumber; } /** * Sets the value of the sedNumber property. * * @param value allowed object is * {@link SEDNumber } */ public void setSedNumber(SEDNumber value) { this.sedNumber = value; } /** * Gets the value of the sedNumberType property. * * @return possible object is * {@link SEDNumberType } */ public SEDNumberType getSedNumberType() { return sedNumberType; } /** * Sets the value of the sedNumberType property. * * @param value allowed object is * {@link SEDNumberType } */ public void setSedNumberType(SEDNumberType value) { this.sedNumberType = value; } /** * Gets the value of the mxStateCode property. * * @return possible object is * {@link String } */ public String getMxStateCode() { return mxStateCode; } /** * Sets the value of the mxStateCode property. * * @param value allowed object is * {@link String } */ public void setMxStateCode(String value) { this.mxStateCode = value; } /** * Gets the value of the exportLineItem property. * <p> * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the exportLineItem property. * <p> * <p> * For example, to add a new item, do as follows: * <pre> * getExportLineItem().add(newItem); * </pre> * <p> * <p> * <p> * Objects of the following type(s) are allowed in the list * {@link ExportLineItem } */ public List<ExportLineItem> getExportLineItem() { if (exportLineItem == null) { exportLineItem = new ArrayList<ExportLineItem>(); } return this.exportLineItem; } }
364f2d1988a4748e8070dd54c5e5bfe2a80dffeb
985ec86b2e44a636424979e49b03a1d3b4c2db83
/src/main/java/com/company/springdemo/test/algorithm/MergeTwoSortedLists.java
2b3006bf6b8430bea9027107beb2ff0541016c5b
[]
no_license
repacker/springdemo
b5b4385b4d00dfa5fd43c4858160f12636fb6fb7
f5a4dac90f8f183eaa149e04d07b723faf8fd05d
refs/heads/master
2022-07-11T10:36:31.025018
2020-12-07T07:25:37
2020-12-07T07:25:37
131,399,920
2
1
null
2022-06-17T01:58:49
2018-04-28T10:27:45
Java
UTF-8
Java
false
false
1,383
java
package com.company.springdemo.test.algorithm; /** * @Auther: whs * @Date: 2019/2/18 11:36 * @Description: 合并两个排好序的链表 * 每次比较两个链表的头结点,将较小结点放到新的链表,最后将新链表指向剩余的链表 */ public class MergeTwoSortedLists { public ListNode mergeTwoLists(ListNode l1, ListNode l2) { ListNode head = new ListNode(0); ListNode lastNode = head; while (l1 != null && l2 != null) { if (l1.currentVal < l2.currentVal) { lastNode.next = l1; l1 = l1.next; } else { lastNode.next = l2; l2 = l2.next; } lastNode = lastNode.next; } if (l1 == null) { lastNode.next = l2; } if (l2 == null) { lastNode.next = l1; } return head.next; } public static class ListNode { /** * 当前值 */ int currentVal; /** * 下一个节点 */ ListNode next; ListNode(int val) { currentVal = val; } @Override public String toString() { return "ListNode{" + "currentVal=" + currentVal + ", next=" + next + '}'; } } }
c3b491e428390bfd0578072e8ecd2ce52a0603d4
654fb9b784ca4057462cbd9c81d3ad4b02113842
/src/test/java/nl/hu/tho6/persistence/connection/ConnectionFactoryTest.java
8bf2a8023cfab0dd94fe31a9f7c150774ff5aaab
[]
no_license
Jfeurich/codereview
127186decb95258675dec9c8f98aca04530f63db
1a44058d27d34a8d6dfb78725f443742a10888bc
refs/heads/master
2020-04-10T21:29:38.560052
2016-03-09T09:45:45
2016-03-09T09:45:45
52,348,575
0
0
null
null
null
null
UTF-8
Java
false
false
977
java
package nl.hu.tho6.persistence.connection; import org.junit.Test; import org.junit.Before; import org.junit.After; import java.sql.Connection; /** * ConnectionFactory Tester. * * @author <Authors name> * @since <pre>Jan 23, 2015</pre> * @version 1.0 */ public class ConnectionFactoryTest { @Before public void before() throws Exception { } @After public void after() throws Exception { } /** * * Method: createConnection() * */ @Test public void testCreateConnection() throws Exception { try{ Connection con = ConnectionFactory.getConnection(); boolean bool = con.isValid(10); } catch(Exception se){ se.printStackTrace(); } } /** * * Method: getConnection() * */ @Test public void testGetConnection() throws Exception { try{ Connection con = ConnectionFactory.getConnection(); boolean bool = con.isValid(10); } catch(Exception se){ se.printStackTrace(); } } }
5f5e6663e2da00aa319894685842a3ef19661cbc
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/13/13_4f460e91791b71a01bca23c643dcf12129e60170/Config/13_4f460e91791b71a01bca23c643dcf12129e60170_Config_t.java
357061809776bb063dd422a8804b465089063007
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
1,943
java
package Identitaet; public class Config { /** * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * TODO: EDIT THIS TO SET CORRECT LOCATIONS WHEN FILES NOT FOUND * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ // private static final String PROJECT_HOME = // "C:\\Users\\Umbriel\\workspace\\Identitaet\\"; private static final String PROJECT_HOME = "/home/elresidente/Develop/Repository/Identitaet/"; /* ########################################################### */ // public static final String IMAGES_LOCATION = PROJECT_HOME // + "resources\\images\\"; public static final String IMAGES_LOCATION = PROJECT_HOME + "resources/images/"; /* ########################################################### */ // public static final String CL_LOCATION = PROJECT_HOME + // "resources\\cl\\"; public static final String CL_LOCATION = PROJECT_HOME + "resources/cl/"; /* ########################################################### */ // Color Mode Constants public static final int COLOR_FULL = 200; public static final int COLOR_WHITE_ON_BLACK = 201; public static final int COLOR_WHITE_ON_WHITE = 202; public static final int COLOR_WHITE_ON_GREY = 203; public static final int COLOR_DUST = 204; public static final int COLOR_MODE = COLOR_FULL; /* ########################################################### */ // ParticleConstants public final static int NUM_PARTICLES = 1024 * 396; public static final int POINTSIZE = 3; public static final int TIME_CHAOS = 400; public static final int TIME_SWARMING = 1000; public static final int TIME_BEING = 150; public static final int TIME_EXPANDING = 60; public static final int TIME_DESINTEGRATING = 800; public static final int TIME_FLOOR = 600; }
83bce545abea45dbf9b7e8071cf0a17ad291de05
7d141df9522db7451b58f5476a5358041fc62ea9
/Java Module/Java/CoreJava/Demo_Lesson3/src/com/igate/ln4/demos/BoxMain.java
25ae52616afe5c916d7350d4564e67080342c15d
[]
no_license
gowtham789/IGATE_J2EE
c6a2947ad6e0a42f88efe457c6f657da41a4a83c
248b6dedafd6a6a0f649c790bdbd5a2aec46a0c7
refs/heads/master
2020-04-21T20:32:33.096040
2019-02-09T09:02:41
2019-02-09T09:02:41
169,848,370
0
0
null
null
null
null
UTF-8
Java
false
false
300
java
package com.igate.ln4.demos; public class BoxMain { public static void main(String[] args) { Box b1; b1=new Box();//Default constructor is called System.out.println("B1 = "+b1.calculate()); Box b2; b2=new Box(7,5,10);//Param const System.out.println("B2 = "+b2.calculate()); } }
a8c70f5bec5ed596e56793f8a0e569c0eb36ff1e
d9f65159d571d94de5f4ee5f80a4b350b7caa88d
/E-commerce/PracticeWebServices/src/main/java/com/example/PracticeWebServices/controllers/AddressController.java
62dbc286cd3ff12bb54d178e0d3b61afa4198368
[]
no_license
yousefokasha61/E-commerce
7ffe1cbdcddf57762f8c04231a4f8489ce1265f7
11c2bf51e744d8629716dc921ecfe6a6f6f9398a
refs/heads/master
2022-04-18T12:19:24.756084
2020-04-17T20:47:27
2020-04-17T20:47:27
249,040,783
0
0
null
2020-04-17T20:47:28
2020-03-21T18:54:07
Java
UTF-8
Java
false
false
1,169
java
package com.example.PracticeWebServices.controllers; import com.example.PracticeWebServices.domain.Address; import com.example.PracticeWebServices.service.AddressService; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController @RequestMapping(AddressController.BASE_URL) public class AddressController { public static final String BASE_URL="/address"; private final AddressService addressService; public AddressController(AddressService addressService) { this.addressService = addressService; } @GetMapping("fk/{id}") public Address getAddressByUserId(@PathVariable Integer id){ return addressService.findByUser_Id(id); } @GetMapping("/{id}") public Address getAddressById(@PathVariable Integer id){ return addressService.findAddressById(id); } @GetMapping() public List<Address> getAllAddresses(){ return addressService.findAllAddresses(); } }
b2c8016f4b136fc1db0709e5f3924a9bca6b27a4
37719514c5925b214e209093f57b7671cdc61760
/src/test/java/com/testangularjhipster/app/web/rest/UserResourceIntTest.java
7b8caa9d9321d278cac7ca9cd1b5e81d3a631b06
[]
no_license
eternels1/projet-front-angularFirmwareManagement
9f1ad9c11bf4bc7475cab7d75625474008f5b8e4
d9d98d37fa3966ddc105c0bbda3fba1af72f21df
refs/heads/master
2020-03-19T03:08:54.910572
2018-06-06T11:20:41
2018-06-06T11:20:41
135,699,871
0
0
null
null
null
null
UTF-8
Java
false
false
26,785
java
package com.testangularjhipster.app.web.rest; import com.testangularjhipster.app.ReferenceTestAngularJhipsterApp; import com.testangularjhipster.app.config.CacheConfiguration; import com.testangularjhipster.app.domain.Authority; import com.testangularjhipster.app.domain.User; import com.testangularjhipster.app.repository.UserRepository; import com.testangularjhipster.app.security.AuthoritiesConstants; import com.testangularjhipster.app.service.MailService; import com.testangularjhipster.app.service.UserService; import com.testangularjhipster.app.service.dto.UserDTO; import com.testangularjhipster.app.service.mapper.UserMapper; import com.testangularjhipster.app.web.rest.errors.ExceptionTranslator; import com.testangularjhipster.app.web.rest.vm.ManagedUserVM; import org.apache.commons.lang3.RandomStringUtils; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.MockitoAnnotations; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.cache.CacheManager; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.transaction.annotation.Transactional; import javax.persistence.EntityManager; import java.time.Instant; import java.util.*; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; /** * Test class for the UserResource REST controller. * * @see UserResource */ @RunWith(SpringRunner.class) @SpringBootTest(classes = ReferenceTestAngularJhipsterApp.class) public class UserResourceIntTest { private static final String DEFAULT_LOGIN = "johndoe"; private static final String UPDATED_LOGIN = "jhipster"; private static final Long DEFAULT_ID = 1L; private static final String DEFAULT_PASSWORD = "passjohndoe"; private static final String UPDATED_PASSWORD = "passjhipster"; private static final String DEFAULT_EMAIL = "johndoe@localhost"; private static final String UPDATED_EMAIL = "jhipster@localhost"; private static final String DEFAULT_FIRSTNAME = "john"; private static final String UPDATED_FIRSTNAME = "jhipsterFirstName"; private static final String DEFAULT_LASTNAME = "doe"; private static final String UPDATED_LASTNAME = "jhipsterLastName"; private static final String DEFAULT_IMAGEURL = "http://placehold.it/50x50"; private static final String UPDATED_IMAGEURL = "http://placehold.it/40x40"; private static final String DEFAULT_LANGKEY = "en"; private static final String UPDATED_LANGKEY = "fr"; @Autowired private UserRepository userRepository; @Autowired private MailService mailService; @Autowired private UserService userService; @Autowired private UserMapper userMapper; @Autowired private MappingJackson2HttpMessageConverter jacksonMessageConverter; @Autowired private PageableHandlerMethodArgumentResolver pageableArgumentResolver; @Autowired private ExceptionTranslator exceptionTranslator; @Autowired private EntityManager em; @Autowired private CacheManager cacheManager; private MockMvc restUserMockMvc; private User user; @Before public void setup() { MockitoAnnotations.initMocks(this); cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).clear(); cacheManager.getCache(UserRepository.USERS_BY_EMAIL_CACHE).clear(); UserResource userResource = new UserResource(userRepository, userService, mailService); this.restUserMockMvc = MockMvcBuilders.standaloneSetup(userResource) .setCustomArgumentResolvers(pageableArgumentResolver) .setControllerAdvice(exceptionTranslator) .setMessageConverters(jacksonMessageConverter) .build(); } /** * Create a User. * * This is a static method, as tests for other entities might also need it, * if they test an entity which has a required relationship to the User entity. */ public static User createEntity(EntityManager em) { User user = new User(); user.setLogin(DEFAULT_LOGIN + RandomStringUtils.randomAlphabetic(5)); user.setPassword(RandomStringUtils.random(60)); user.setActivated(true); user.setEmail(RandomStringUtils.randomAlphabetic(5) + DEFAULT_EMAIL); user.setFirstName(DEFAULT_FIRSTNAME); user.setLastName(DEFAULT_LASTNAME); user.setImageUrl(DEFAULT_IMAGEURL); user.setLangKey(DEFAULT_LANGKEY); return user; } @Before public void initTest() { user = createEntity(em); user.setLogin(DEFAULT_LOGIN); user.setEmail(DEFAULT_EMAIL); } @Test @Transactional public void createUser() throws Exception { int databaseSizeBeforeCreate = userRepository.findAll().size(); // Create the User ManagedUserVM managedUserVM = new ManagedUserVM(); managedUserVM.setLogin(DEFAULT_LOGIN); managedUserVM.setPassword(DEFAULT_PASSWORD); managedUserVM.setFirstName(DEFAULT_FIRSTNAME); managedUserVM.setLastName(DEFAULT_LASTNAME); managedUserVM.setEmail(DEFAULT_EMAIL); managedUserVM.setActivated(true); managedUserVM.setImageUrl(DEFAULT_IMAGEURL); managedUserVM.setLangKey(DEFAULT_LANGKEY); managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); restUserMockMvc.perform(post("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isCreated()); // Validate the User in the database List<User> userList = userRepository.findAll(); assertThat(userList).hasSize(databaseSizeBeforeCreate + 1); User testUser = userList.get(userList.size() - 1); assertThat(testUser.getLogin()).isEqualTo(DEFAULT_LOGIN); assertThat(testUser.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME); assertThat(testUser.getLastName()).isEqualTo(DEFAULT_LASTNAME); assertThat(testUser.getEmail()).isEqualTo(DEFAULT_EMAIL); assertThat(testUser.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL); assertThat(testUser.getLangKey()).isEqualTo(DEFAULT_LANGKEY); } @Test @Transactional public void createUserWithExistingId() throws Exception { int databaseSizeBeforeCreate = userRepository.findAll().size(); ManagedUserVM managedUserVM = new ManagedUserVM(); managedUserVM.setId(1L); managedUserVM.setLogin(DEFAULT_LOGIN); managedUserVM.setPassword(DEFAULT_PASSWORD); managedUserVM.setFirstName(DEFAULT_FIRSTNAME); managedUserVM.setLastName(DEFAULT_LASTNAME); managedUserVM.setEmail(DEFAULT_EMAIL); managedUserVM.setActivated(true); managedUserVM.setImageUrl(DEFAULT_IMAGEURL); managedUserVM.setLangKey(DEFAULT_LANGKEY); managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); // An entity with an existing ID cannot be created, so this API call must fail restUserMockMvc.perform(post("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isBadRequest()); // Validate the User in the database List<User> userList = userRepository.findAll(); assertThat(userList).hasSize(databaseSizeBeforeCreate); } @Test @Transactional public void createUserWithExistingLogin() throws Exception { // Initialize the database userRepository.saveAndFlush(user); int databaseSizeBeforeCreate = userRepository.findAll().size(); ManagedUserVM managedUserVM = new ManagedUserVM(); managedUserVM.setLogin(DEFAULT_LOGIN);// this login should already be used managedUserVM.setPassword(DEFAULT_PASSWORD); managedUserVM.setFirstName(DEFAULT_FIRSTNAME); managedUserVM.setLastName(DEFAULT_LASTNAME); managedUserVM.setEmail("anothermail@localhost"); managedUserVM.setActivated(true); managedUserVM.setImageUrl(DEFAULT_IMAGEURL); managedUserVM.setLangKey(DEFAULT_LANGKEY); managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); // Create the User restUserMockMvc.perform(post("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isBadRequest()); // Validate the User in the database List<User> userList = userRepository.findAll(); assertThat(userList).hasSize(databaseSizeBeforeCreate); } @Test @Transactional public void createUserWithExistingEmail() throws Exception { // Initialize the database userRepository.saveAndFlush(user); int databaseSizeBeforeCreate = userRepository.findAll().size(); ManagedUserVM managedUserVM = new ManagedUserVM(); managedUserVM.setLogin("anotherlogin"); managedUserVM.setPassword(DEFAULT_PASSWORD); managedUserVM.setFirstName(DEFAULT_FIRSTNAME); managedUserVM.setLastName(DEFAULT_LASTNAME); managedUserVM.setEmail(DEFAULT_EMAIL);// this email should already be used managedUserVM.setActivated(true); managedUserVM.setImageUrl(DEFAULT_IMAGEURL); managedUserVM.setLangKey(DEFAULT_LANGKEY); managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); // Create the User restUserMockMvc.perform(post("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isBadRequest()); // Validate the User in the database List<User> userList = userRepository.findAll(); assertThat(userList).hasSize(databaseSizeBeforeCreate); } @Test @Transactional public void getAllUsers() throws Exception { // Initialize the database userRepository.saveAndFlush(user); // Get all the users restUserMockMvc.perform(get("/api/users?sort=id,desc") .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.[*].login").value(hasItem(DEFAULT_LOGIN))) .andExpect(jsonPath("$.[*].firstName").value(hasItem(DEFAULT_FIRSTNAME))) .andExpect(jsonPath("$.[*].lastName").value(hasItem(DEFAULT_LASTNAME))) .andExpect(jsonPath("$.[*].email").value(hasItem(DEFAULT_EMAIL))) .andExpect(jsonPath("$.[*].imageUrl").value(hasItem(DEFAULT_IMAGEURL))) .andExpect(jsonPath("$.[*].langKey").value(hasItem(DEFAULT_LANGKEY))); } @Test @Transactional public void getUser() throws Exception { // Initialize the database userRepository.saveAndFlush(user); assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNull(); // Get the user restUserMockMvc.perform(get("/api/users/{login}", user.getLogin())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.login").value(user.getLogin())) .andExpect(jsonPath("$.firstName").value(DEFAULT_FIRSTNAME)) .andExpect(jsonPath("$.lastName").value(DEFAULT_LASTNAME)) .andExpect(jsonPath("$.email").value(DEFAULT_EMAIL)) .andExpect(jsonPath("$.imageUrl").value(DEFAULT_IMAGEURL)) .andExpect(jsonPath("$.langKey").value(DEFAULT_LANGKEY)); assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNotNull(); } @Test @Transactional public void getNonExistingUser() throws Exception { restUserMockMvc.perform(get("/api/users/unknown")) .andExpect(status().isNotFound()); } @Test @Transactional public void updateUser() throws Exception { // Initialize the database userRepository.saveAndFlush(user); int databaseSizeBeforeUpdate = userRepository.findAll().size(); // Update the user User updatedUser = userRepository.findOne(user.getId()); ManagedUserVM managedUserVM = new ManagedUserVM(); managedUserVM.setId(updatedUser.getId()); managedUserVM.setLogin(updatedUser.getLogin()); managedUserVM.setPassword(UPDATED_PASSWORD); managedUserVM.setFirstName(UPDATED_FIRSTNAME); managedUserVM.setLastName(UPDATED_LASTNAME); managedUserVM.setEmail(UPDATED_EMAIL); managedUserVM.setActivated(updatedUser.getActivated()); managedUserVM.setImageUrl(UPDATED_IMAGEURL); managedUserVM.setLangKey(UPDATED_LANGKEY); managedUserVM.setCreatedBy(updatedUser.getCreatedBy()); managedUserVM.setCreatedDate(updatedUser.getCreatedDate()); managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy()); managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate()); managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); restUserMockMvc.perform(put("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isOk()); // Validate the User in the database List<User> userList = userRepository.findAll(); assertThat(userList).hasSize(databaseSizeBeforeUpdate); User testUser = userList.get(userList.size() - 1); assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME); assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME); assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL); assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL); assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY); } @Test @Transactional public void updateUserLogin() throws Exception { // Initialize the database userRepository.saveAndFlush(user); int databaseSizeBeforeUpdate = userRepository.findAll().size(); // Update the user User updatedUser = userRepository.findOne(user.getId()); ManagedUserVM managedUserVM = new ManagedUserVM(); managedUserVM.setId(updatedUser.getId()); managedUserVM.setLogin(UPDATED_LOGIN); managedUserVM.setPassword(UPDATED_PASSWORD); managedUserVM.setFirstName(UPDATED_FIRSTNAME); managedUserVM.setLastName(UPDATED_LASTNAME); managedUserVM.setEmail(UPDATED_EMAIL); managedUserVM.setActivated(updatedUser.getActivated()); managedUserVM.setImageUrl(UPDATED_IMAGEURL); managedUserVM.setLangKey(UPDATED_LANGKEY); managedUserVM.setCreatedBy(updatedUser.getCreatedBy()); managedUserVM.setCreatedDate(updatedUser.getCreatedDate()); managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy()); managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate()); managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); restUserMockMvc.perform(put("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isOk()); // Validate the User in the database List<User> userList = userRepository.findAll(); assertThat(userList).hasSize(databaseSizeBeforeUpdate); User testUser = userList.get(userList.size() - 1); assertThat(testUser.getLogin()).isEqualTo(UPDATED_LOGIN); assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME); assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME); assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL); assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL); assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY); } @Test @Transactional public void updateUserExistingEmail() throws Exception { // Initialize the database with 2 users userRepository.saveAndFlush(user); User anotherUser = new User(); anotherUser.setLogin("jhipster"); anotherUser.setPassword(RandomStringUtils.random(60)); anotherUser.setActivated(true); anotherUser.setEmail("jhipster@localhost"); anotherUser.setFirstName("java"); anotherUser.setLastName("hipster"); anotherUser.setImageUrl(""); anotherUser.setLangKey("en"); userRepository.saveAndFlush(anotherUser); // Update the user User updatedUser = userRepository.findOne(user.getId()); ManagedUserVM managedUserVM = new ManagedUserVM(); managedUserVM.setId(updatedUser.getId()); managedUserVM.setLogin(updatedUser.getLogin()); managedUserVM.setPassword(updatedUser.getPassword()); managedUserVM.setFirstName(updatedUser.getFirstName()); managedUserVM.setLastName(updatedUser.getLastName()); managedUserVM.setEmail("jhipster@localhost");// this email should already be used by anotherUser managedUserVM.setActivated(updatedUser.getActivated()); managedUserVM.setImageUrl(updatedUser.getImageUrl()); managedUserVM.setLangKey(updatedUser.getLangKey()); managedUserVM.setCreatedBy(updatedUser.getCreatedBy()); managedUserVM.setCreatedDate(updatedUser.getCreatedDate()); managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy()); managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate()); managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); restUserMockMvc.perform(put("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isBadRequest()); } @Test @Transactional public void updateUserExistingLogin() throws Exception { // Initialize the database userRepository.saveAndFlush(user); User anotherUser = new User(); anotherUser.setLogin("jhipster"); anotherUser.setPassword(RandomStringUtils.random(60)); anotherUser.setActivated(true); anotherUser.setEmail("jhipster@localhost"); anotherUser.setFirstName("java"); anotherUser.setLastName("hipster"); anotherUser.setImageUrl(""); anotherUser.setLangKey("en"); userRepository.saveAndFlush(anotherUser); // Update the user User updatedUser = userRepository.findOne(user.getId()); ManagedUserVM managedUserVM = new ManagedUserVM(); managedUserVM.setId(updatedUser.getId()); managedUserVM.setLogin("jhipster");// this login should already be used by anotherUser managedUserVM.setPassword(updatedUser.getPassword()); managedUserVM.setFirstName(updatedUser.getFirstName()); managedUserVM.setLastName(updatedUser.getLastName()); managedUserVM.setEmail(updatedUser.getEmail()); managedUserVM.setActivated(updatedUser.getActivated()); managedUserVM.setImageUrl(updatedUser.getImageUrl()); managedUserVM.setLangKey(updatedUser.getLangKey()); managedUserVM.setCreatedBy(updatedUser.getCreatedBy()); managedUserVM.setCreatedDate(updatedUser.getCreatedDate()); managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy()); managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate()); managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); restUserMockMvc.perform(put("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isBadRequest()); } @Test @Transactional public void deleteUser() throws Exception { // Initialize the database userRepository.saveAndFlush(user); int databaseSizeBeforeDelete = userRepository.findAll().size(); // Delete the user restUserMockMvc.perform(delete("/api/users/{login}", user.getLogin()) .accept(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNull(); // Validate the database is empty List<User> userList = userRepository.findAll(); assertThat(userList).hasSize(databaseSizeBeforeDelete - 1); } @Test @Transactional public void getAllAuthorities() throws Exception { restUserMockMvc.perform(get("/api/users/authorities") .accept(TestUtil.APPLICATION_JSON_UTF8) .contentType(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$").isArray()) .andExpect(jsonPath("$").value(containsInAnyOrder(AuthoritiesConstants.USER, AuthoritiesConstants.ADMIN))); } @Test @Transactional public void testUserEquals() throws Exception { TestUtil.equalsVerifier(User.class); User user1 = new User(); user1.setId(1L); User user2 = new User(); user2.setId(user1.getId()); assertThat(user1).isEqualTo(user2); user2.setId(2L); assertThat(user1).isNotEqualTo(user2); user1.setId(null); assertThat(user1).isNotEqualTo(user2); } @Test public void testUserFromId() { assertThat(userMapper.userFromId(DEFAULT_ID).getId()).isEqualTo(DEFAULT_ID); assertThat(userMapper.userFromId(null)).isNull(); } @Test public void testUserDTOtoUser() { UserDTO userDTO = new UserDTO(); userDTO.setId(DEFAULT_ID); userDTO.setLogin(DEFAULT_LOGIN); userDTO.setFirstName(DEFAULT_FIRSTNAME); userDTO.setLastName(DEFAULT_LASTNAME); userDTO.setEmail(DEFAULT_EMAIL); userDTO.setActivated(true); userDTO.setImageUrl(DEFAULT_IMAGEURL); userDTO.setLangKey(DEFAULT_LANGKEY); userDTO.setCreatedBy(DEFAULT_LOGIN); userDTO.setLastModifiedBy(DEFAULT_LOGIN); userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); User user = userMapper.userDTOToUser(userDTO); assertThat(user.getId()).isEqualTo(DEFAULT_ID); assertThat(user.getLogin()).isEqualTo(DEFAULT_LOGIN); assertThat(user.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME); assertThat(user.getLastName()).isEqualTo(DEFAULT_LASTNAME); assertThat(user.getEmail()).isEqualTo(DEFAULT_EMAIL); assertThat(user.getActivated()).isEqualTo(true); assertThat(user.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL); assertThat(user.getLangKey()).isEqualTo(DEFAULT_LANGKEY); assertThat(user.getCreatedBy()).isNull(); assertThat(user.getCreatedDate()).isNotNull(); assertThat(user.getLastModifiedBy()).isNull(); assertThat(user.getLastModifiedDate()).isNotNull(); assertThat(user.getAuthorities()).extracting("name").containsExactly(AuthoritiesConstants.USER); } @Test public void testUserToUserDTO() { user.setId(DEFAULT_ID); user.setCreatedBy(DEFAULT_LOGIN); user.setCreatedDate(Instant.now()); user.setLastModifiedBy(DEFAULT_LOGIN); user.setLastModifiedDate(Instant.now()); Set<Authority> authorities = new HashSet<>(); Authority authority = new Authority(); authority.setName(AuthoritiesConstants.USER); authorities.add(authority); user.setAuthorities(authorities); UserDTO userDTO = userMapper.userToUserDTO(user); assertThat(userDTO.getId()).isEqualTo(DEFAULT_ID); assertThat(userDTO.getLogin()).isEqualTo(DEFAULT_LOGIN); assertThat(userDTO.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME); assertThat(userDTO.getLastName()).isEqualTo(DEFAULT_LASTNAME); assertThat(userDTO.getEmail()).isEqualTo(DEFAULT_EMAIL); assertThat(userDTO.isActivated()).isEqualTo(true); assertThat(userDTO.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL); assertThat(userDTO.getLangKey()).isEqualTo(DEFAULT_LANGKEY); assertThat(userDTO.getCreatedBy()).isEqualTo(DEFAULT_LOGIN); assertThat(userDTO.getCreatedDate()).isEqualTo(user.getCreatedDate()); assertThat(userDTO.getLastModifiedBy()).isEqualTo(DEFAULT_LOGIN); assertThat(userDTO.getLastModifiedDate()).isEqualTo(user.getLastModifiedDate()); assertThat(userDTO.getAuthorities()).containsExactly(AuthoritiesConstants.USER); assertThat(userDTO.toString()).isNotNull(); } @Test public void testAuthorityEquals() throws Exception { Authority authorityA = new Authority(); assertThat(authorityA).isEqualTo(authorityA); assertThat(authorityA).isNotEqualTo(null); assertThat(authorityA).isNotEqualTo(new Object()); assertThat(authorityA.hashCode()).isEqualTo(0); assertThat(authorityA.toString()).isNotNull(); Authority authorityB = new Authority(); assertThat(authorityA).isEqualTo(authorityB); authorityB.setName(AuthoritiesConstants.ADMIN); assertThat(authorityA).isNotEqualTo(authorityB); authorityA.setName(AuthoritiesConstants.USER); assertThat(authorityA).isNotEqualTo(authorityB); authorityB.setName(AuthoritiesConstants.USER); assertThat(authorityA).isEqualTo(authorityB); assertThat(authorityA.hashCode()).isEqualTo(authorityB.hashCode()); } }
89b69d7957d762cdaf5841212d9e44869e6a01dd
945d959d49279b4ac5ab69ae66d42bdf4b5a58d0
/riptide-logbook/src/main/java/org/zalando/riptide/logbook/LogbookPlugin.java
c090acc0f938c2bbc76ed4e5eb584c3b91c8df02
[ "MIT" ]
permissive
jrehwaldt/riptide
6404368c193a2e9fa380d4c38f8f486204b69d5e
e79a64372255f6711cb84754078a05b7da4b69da
refs/heads/master
2020-07-23T01:10:47.726421
2019-09-09T08:39:53
2019-09-09T08:39:53
207,395,712
0
0
MIT
2019-09-09T20:11:31
2019-09-09T20:11:30
null
UTF-8
Java
false
false
2,248
java
package org.zalando.riptide.logbook; import lombok.AllArgsConstructor; import org.apiguardian.api.API; import org.springframework.http.HttpOutputMessage; import org.zalando.logbook.Logbook; import org.zalando.logbook.Logbook.RequestWritingStage; import org.zalando.logbook.Logbook.ResponseProcessingStage; import org.zalando.riptide.Plugin; import org.zalando.riptide.RequestArguments; import org.zalando.riptide.RequestArguments.Entity; import org.zalando.riptide.RequestExecution; import java.io.IOException; import java.util.concurrent.CompletableFuture; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Consumer; import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.zalando.fauxpas.FauxPas.throwingConsumer; @API(status = EXPERIMENTAL) @AllArgsConstructor public final class LogbookPlugin implements Plugin { private final Logbook logbook; @Override public RequestExecution aroundNetwork(final RequestExecution execution) { return arguments -> { // TODO is there a better way?! final AtomicReference<ResponseProcessingStage> stage = new AtomicReference<>(); final CompletableFuture<RemoteResponse> future = execution .execute(arguments.withEntity(new LogbookEntity(arguments, stage::set))) .thenApply(RemoteResponse::new); future.thenAccept(throwingConsumer(response -> stage.get().process(response).write())); return future.thenApply(RemoteResponse::asClientHttpResponse); }; } @AllArgsConstructor private class LogbookEntity implements Entity { private final RequestArguments arguments; private final Consumer<ResponseProcessingStage> next; @Override public void writeTo(final HttpOutputMessage message) throws IOException { final LocalRequest request = new LocalRequest(arguments); final RequestWritingStage writing = logbook.process(request); request.writeTo(message); next.accept(writing.write()); } @Override public boolean isEmpty() { return arguments.getEntity().isEmpty(); } } }
e57a0472c6bab163813483010f43c20adf1edc07
2a4ca87ac5271118b2ae77c3c849eebf6f01ba7f
/app/src/main/java/com/example/matchesapp/ui/send/SendViewModel.java
c2b9694986857c90a39fb5558f799087a9dfefe7
[]
no_license
Vasantikaradage/MatchesApp
daa075142cf630dbe39f39956d040a3cc9be009c
6fd98decc757897ec733a0ab7026e3637fe8ce9c
refs/heads/master
2022-12-05T01:12:53.093953
2020-08-24T17:09:24
2020-08-24T17:09:24
289,989,135
0
0
null
null
null
null
UTF-8
Java
false
false
445
java
package com.example.matchesapp.ui.send; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.ViewModel; public class SendViewModel extends ViewModel { private MutableLiveData<String> mText; public SendViewModel() { mText = new MutableLiveData<>(); mText.setValue("This is send fragment"); } public LiveData<String> getText() { return mText; } }
10ef3d1c9d8999a7b31bf5faeac7c489b7cf576c
bf0b206648bc423a7090824a824276ec89fdfa58
/firstProject/src/control/WhileExe.java
c2978baf15326fb44ce1b90cdc2887bce61bb1ac
[]
no_license
PGParkJeonguk/first-project
2a84272ac940c6bee1f834a2e4e119d3a5dae4cb
fd985e61c64105337e4d080c1216ed3008ce5466
refs/heads/master
2023-08-10T16:39:21.617267
2021-09-16T14:32:08
2021-09-16T14:32:08
406,186,118
0
0
null
null
null
null
UHC
Java
false
false
871
java
package control; public class WhileExe { public static void main(String[] args) { // while 구문을 사용해서 1 ~ 10까지 출력 int i = 0; while(i <= 10) { System.out.println(i); i++; } System.out.println("==============끝1"); //while 구문을 사용해서 10까지 짝수 출력 int i2 = 2; while(i2 <=10) { System.out.println(i2); i2 += 2; } System.out.println("==============끝2"); //while 구문을 사용해서 10까지 홀수 출력 int i3 = 1; while(i3 <=10) { System.out.println(i3); i3 += 2; } System.out.println("==============끝3"); //while 구문을 사용해서 1~10까지 모든 더한 값 int i4 =0; int sum = 0; while(i4 <=10) { sum = sum + i4; i4++; } System.out.println(sum); System.out.println("==============끝4"); } }
[ "USER@DESKTOP-2MISF3S" ]
USER@DESKTOP-2MISF3S
d754a86f1281a2b147f2048b9b3e211e063d800e
8d099cc4d029b515cb3871cd3c0ca79d777d1290
/src/main/java/com/eomcs/basic/ex02/Exam0310.java
2c29e10a83e6bac5e670aff0d8eb22904fed71ae
[]
no_license
dong3512/bitcamp-study
0623a96a40b3deb71dbb683dcae69ee01b44a52e
66d32dc2ea5d4f53bf9c792289c71d7709c5f546
refs/heads/main
2023-04-27T05:30:28.828597
2021-05-20T08:48:04
2021-05-20T08:48:04
326,534,763
0
0
null
null
null
null
UTF-8
Java
false
false
1,070
java
// java.util.Date 클래스 - 생성자 활용 package com.eomcs.basic.ex02; import java.util.Date; public class Exam0310 { public static void main(String[] args) { // Date() 기본 생성자 Date d1 = new Date(); // 현재 시간을 저장한다. System.out.println(d1); // Date(long) : 1970-01-01 00:00:00 부터 지금까지 경과된 밀리초 Date d2 = new Date(1000); System.out.println(d2); Date d3 = new Date(System.currentTimeMillis()); System.out.println(d3); <<<<<<< HEAD Date d4 = new Date(119, 0, 15); ======= Date d4 = new Date(121, 0, 15); >>>>>>> 5215881aba7260f9ada34bd7e8e91b6648c42cb7 System.out.println(d4); // java.sql.Date java.sql.Date d5 = new java.sql.Date(System.currentTimeMillis()); System.out.println(d5); // 간접적으로 객체를 생성하기 <<<<<<< HEAD java.sql.Date d6 = java.sql.Date.valueOf("2019-1-16"); ======= java.sql.Date d6 = java.sql.Date.valueOf("2021-2-4"); >>>>>>> 5215881aba7260f9ada34bd7e8e91b6648c42cb7 System.out.println(d6); } }
5313e80a9af6ccc4a6109dde6f9e600bc7bd9f38
c5c52e6e24ceac0de6fbea9967a6087e3273ff1b
/Board/src/main/java/com/multicampus/biz/board/BoardDAO.java
db670bee44c9723ec6475bda574fd3c3bf3908e6
[]
no_license
ddasix/eGov
e6a935b659ee85b4dc068dbdece87953b335fda0
ff07926955c661e51572e11618980230365eb18e
refs/heads/master
2020-04-06T04:44:05.663388
2017-02-24T07:14:46
2017-02-24T07:14:46
82,897,471
0
0
null
null
null
null
UTF-8
Java
false
false
369
java
package com.multicampus.biz.board; import java.util.List; import com.multicampus.biz.board.vo.BoardVO; public interface BoardDAO { public void addBoard(BoardVO vo); public void updateBoard(BoardVO vo); public void deleteBoard(BoardVO vo); public BoardVO getBoard(BoardVO vo); public List<BoardVO> getBoardList(BoardVO vo); }
bb44888ed007808236c4203d079ebcf399deda05
3afb8d20a32801534aeb9c85eb304f993616a443
/src/main/java/com/owl/service/IQuartzService.java
c42ea5349b3551b3128f28cc0bc698301023f0e6
[]
no_license
liuaolwz/quartz-demo
4ef38a02ae0522d2e4778b38cfca5332f890bbd3
67728d13066858feccdb890eccdb4725fbf41dc1
refs/heads/master
2021-07-14T23:05:02.565497
2017-10-20T09:20:15
2017-10-20T09:20:15
107,572,599
0
0
null
null
null
null
UTF-8
Java
false
false
2,300
java
package com.owl.service; import com.owl.api.request.RegistRequest; import com.owl.domain.TaskInfo; import org.quartz.SchedulerException; import org.quartz.Trigger; import org.quartz.TriggerKey; import org.quartz.impl.jdbcjobstore.TriggerStatus; import java.util.List; /** * quartz service interface * Created by liuao on 2017/10/20. */ public interface IQuartzService { /** * add a new task * @param request task info * @throws SchedulerException */ void addTask(RegistRequest request) throws SchedulerException; /** * remove a given task * @param triggerKey given task key * @throws SchedulerException */ void removeTask(TriggerKey triggerKey) throws SchedulerException; /** * pause a given task * @param triggerKey given task key * @throws SchedulerException */ void pauseTask(TriggerKey triggerKey) throws SchedulerException; /** * pause all given tasks * @param triggerKeys * @throws SchedulerException */ void pauseTasks(List<TriggerKey> triggerKeys) throws SchedulerException; /** * pause all tasks * @throws SchedulerException */ void pauseAll() throws SchedulerException; /** * resume a given task * @param triggerKey * @throws SchedulerException */ void resumeTask(TriggerKey triggerKey) throws SchedulerException; /** * resume given tasks * @param triggerKeys * @throws SchedulerException */ void resumeTasks(List<TriggerKey> triggerKeys) throws SchedulerException; /** * resume all tasks * @throws SchedulerException */ void resumeAll() throws SchedulerException; /** * get task status * @param triggerKey * @return task execute status * @throws SchedulerException */ TriggerStatus getTriggerState(TriggerKey triggerKey) throws SchedulerException; /** * git all task info * @throws SchedulerException */ List<TaskInfo> listTasks() throws SchedulerException; /** * manual execute a given task * @param triggerKey * @throws SchedulerException */ void manualExecuteTask(TriggerKey triggerKey) throws SchedulerException; void updateTask(RegistRequest request,TriggerKey triggerKey) throws SchedulerException; }
bbf7fe83b8bb580ca4dcb90ba90fc824cef2e85e
571f6f651896e9e22bb7754a20b9df5aec4ea4dc
/src/test/java/com/trng/cucks/api/ReportGenerator.java
41d45137a5e11a2021bd2c6584e068d20639b8d7
[]
no_license
kumbhapr/cucks-report
9015f7fb7500cdb78feb8056ae82b71b78b1915a
e82e9176cea6b509b100c219673fbb4f17ab394b
refs/heads/master
2021-01-07T20:01:16.862535
2020-02-20T09:56:09
2020-02-20T09:56:09
241,806,560
0
1
null
2020-10-13T19:41:05
2020-02-20T06:03:35
Java
UTF-8
Java
false
false
1,510
java
package com.trng.cucks.api; import java.io.File; import java.util.ArrayList; import java.util.Collections; import java.util.List; import net.masterthought.cucumber.Configuration; import net.masterthought.cucumber.ReportBuilder; import net.masterthought.cucumber.Reportable; import net.masterthought.cucumber.json.support.Status; import net.masterthought.cucumber.presentation.PresentationMode; public class ReportGenerator { public static void main(String[] args) { // TODO Auto-generated method stub generateReport(); } static void generateReport() { File reportOutputDirectory = new File("/home/cloud-ops/prasad/cucks-api/target/pretty-report"); List<String> jsonFiles = new ArrayList<>(); jsonFiles.add("/home/cloud-ops/prasad/cucks-api/target/cucumber-report/cucumber.json"); String buildNumber = "1"; String projectName = "cucks-api"; Configuration configuration = new Configuration(reportOutputDirectory, projectName); // do not make scenario failed when step has status SKIPPED // configuration.setNotFailingStatuses(Collections.singleton(Status.SKIPPED)); configuration.setBuildNumber(buildNumber); // addidtional metadata presented on main page configuration.addClassifications("Platform", "Linux"); configuration.addClassifications("API", "ReqResp-User"); configuration.addClassifications("Branch", "release/1.0"); ReportBuilder reportBuilder = new ReportBuilder(jsonFiles, configuration); Reportable result = reportBuilder.generateReports(); } }
176bfff02483de0f4b8f831fd5cc464e248b5813
0af8b92686a58eb0b64e319b22411432aca7a8f3
/single-large-project/src/main/java/org/gradle/test/performancenull_367/Productionnull_36635.java
75984c917833ff55941142cf8e6110397d0f476a
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
588
java
package org.gradle.test.performancenull_367; public class Productionnull_36635 { private final String property; public Productionnull_36635(String param) { this.property = param; } public String getProperty() { return property; } private String prop0; public String getProp0() { return prop0; } public void setProp0(String value) { prop0 = value; } private String prop1; public String getProp1() { return prop1; } public void setProp1(String value) { prop1 = value; } }
735bd1b3f239b4c7a573a17f979a8d6dbbf60712
a4d98b1a5840b3c46be03d6a8a6bd76e2a92c390
/src/main/java/ma/emsi/devoir/ecommerce/EcommerceApplication.java
3f3c3cf3b96787f62b2c37678afb29211ad6230b
[]
no_license
Mercies/eCommerce_project
75f5ddd4442d12b009200e46875e3e59637f250b
db36381da6a81e7648139a93047ac2da334c6efc
refs/heads/master
2023-02-15T04:53:24.934044
2021-01-10T17:41:26
2021-01-10T17:41:26
328,441,949
0
0
null
null
null
null
UTF-8
Java
false
false
1,043
java
package ma.emsi.devoir.ecommerce; import java.util.ArrayList; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.ApplicationContext; import ma.emsi.devoir.ecommerce.domaine.ArticleVO; import ma.emsi.devoir.ecommerce.service.IArticleService; @SpringBootApplication public class EcommerceApplication { public static void main(String[] args) { ApplicationContext applicationContext = SpringApplication.run(EcommerceApplication.class, args); IArticleService iArticleService= applicationContext.getBean(IArticleService.class); ArticleVO articleVO= ArticleVO.builder().reference("TestReference8").price(10).designation("TestDesignation8").build(); articleVO.setId(1l); iArticleService.saveOrUpdate(articleVO); ArrayList<ArticleVO> artList = (ArrayList<ArticleVO>) iArticleService.findAll(); artList.forEach(art -> System.err.println("Ref: "+art.getReference()+" Price: "+art.getPrice()+" Design: "+art.getDesignation())); } }
3cba0b83a051a17763cc48fe484664d43132423f
4d4e8f439efc461e4a89ce3a73097390b48e5dc8
/2er-version-springSOAPProducing/src/main/java/io/spring/ex4/webservice/package-info.java
db75e55984531a7fe978f95cdb0d5c53449e92f7
[]
no_license
lanaflonform/spring
fad0fb9e9a262206d1dc0b7dc32af8211e34c761
d06b15918e95cdd173491ca33a54381e532a1fc3
refs/heads/master
2021-04-13T20:30:50.757731
2020-03-20T18:53:08
2020-03-20T18:53:08
249,185,954
0
1
null
2020-03-22T13:10:43
2020-03-22T13:10:42
null
UTF-8
Java
false
false
520
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2020.03.10 at 03:49:34 PM CET // @javax.xml.bind.annotation.XmlSchema(namespace = "http://spring.io/ex4/webservice", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package io.spring.ex4.webservice;
91ce28f83e5f72564a8780452aef6dde73e7d417
fb3457c3039fafa6f4b8c2a75af502af456b41bd
/bansystem-bukkit/src/main/java/ch/dkrieger/bansystem/bukkit/event/BukkitNetworkPlayerReportsAcceptEvent.java
a670cceaa99b3f96829a2a9d943e5fa2d0ee18af
[ "Apache-2.0" ]
permissive
craftermc-net/DKBans
6c8535cea146a40632d191be5f4ed2432045b925
5c2a2701d0bf13891a8220d908dc70d8d7221337
refs/heads/master
2023-05-10T22:07:28.099242
2023-05-04T13:18:13
2023-05-04T13:18:13
585,097,586
0
0
Apache-2.0
2023-01-04T10:06:55
2023-01-04T10:06:54
null
UTF-8
Java
false
false
1,299
java
/* * (C) Copyright 2018 The DKBans Project (Davide Wietlisbach) * * @author Davide Wietlisbach * @since 30.12.18 14:39 * @Website https://github.com/DevKrieger/DKBans * * The DKBans Project is 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 ch.dkrieger.bansystem.bukkit.event; import ch.dkrieger.bansystem.lib.report.Report; import java.util.List; import java.util.UUID; public class BukkitNetworkPlayerReportsAcceptEvent extends BukkitDKBansNetworkPlayerEvent { private final List<Report> reports; public BukkitNetworkPlayerReportsAcceptEvent(UUID uuid, long timeStamp, boolean onThisServer, List<Report> reports) { super(uuid, timeStamp,onThisServer); this.reports = reports; } public List<Report> getReport() { return reports; } }
4c7d4d5907260cc325baa45a4b2ad45982ecf19f
16bd3ab03a5c5066aba0ee5939a359b49d3a62d4
/furpnt/src/main/java/com/navi/furpnt/dao/CategoryDaoImpl.java
5ffbb0ed6a4a695197f238f359fe1956634fbc8e
[]
no_license
naveenakumari/pretty
69a4179eb4625438c5c4e82d816bc6d5fd84da80
838c94c4c2a4c3bd7915bc16bf8c2fbc96f25d2b
refs/heads/master
2020-07-15T08:43:44.913274
2016-09-26T15:50:50
2016-09-26T15:50:50
67,035,046
0
0
null
null
null
null
UTF-8
Java
false
false
817
java
package com.navi.furpnt.dao; import java.util.List; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.criterion.Restrictions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.navi.furpnt.model.Item; @Repository public class CategoryDaoImpl implements CategoryDao { @Autowired SessionFactory sessionFactroy; @Override public List<Item> getProductByCategory(String category) { Session session=sessionFactroy.getCurrentSession(); Transaction transaction=session.beginTransaction(); List<Item> list=session.createCriteria(Item.class) .add(Restrictions.like("category",category)).list(); return list; } }
ae1ac38ca2d383f19846b45684f9b41b68b34982
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/32/32_910e60b1f437a42e2fa240462a0cc8695d4c5d5b/JdbcConer/32_910e60b1f437a42e2fa240462a0cc8695d4c5d5b_JdbcConer_s.java
928fe55f0cdec0632d0c2342323d6858fcb90a31
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
8,847
java
package uk.ac.starlink.ttools.cone; import java.sql.Connection; import java.sql.SQLException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.logging.Logger; import uk.ac.starlink.table.StarTable; import uk.ac.starlink.task.BooleanParameter; import uk.ac.starlink.task.ChoiceParameter; import uk.ac.starlink.task.Environment; import uk.ac.starlink.task.Parameter; import uk.ac.starlink.task.ParameterValueException; import uk.ac.starlink.task.TaskException; import uk.ac.starlink.ttools.task.ConnectionParameter; /** * Coner implementation which works by performing SELECT statements over a * JDBC database connection. * * @author Mark Taylor * @since 15 Aug 2007 */ public class JdbcConer implements Coner { private final ConnectionParameter connParam_; private final Parameter dbtableParam_; private final Parameter dbraParam_; private final Parameter dbdecParam_; private final Parameter dbtileParam_; private final TilingParameter tilingParam_; private final Parameter colsParam_; private final Parameter whereParam_; private final ChoiceParameter dbunitParam_; private final BooleanParameter prepareParam_; private static final Logger logger_ = Logger.getLogger( "uk.ac.starlink.ttools.cone" ); /** * Constructor. */ public JdbcConer() { String sys = getSkySystem(); sys = ( sys == null ) ? "" : ( sys + " " ); connParam_ = new ConnectionParameter( "db" ); dbtableParam_ = new Parameter( "dbtable" ); dbtableParam_.setUsage( "<table-name>" ); dbtableParam_.setPrompt( "Name of table in database" ); dbtableParam_.setDescription( new String[] { "<p>The name of the table in the SQL database which provides", "the remote data.", "</p>", } ); dbraParam_ = new Parameter( "dbra" ); dbraParam_.setUsage( "<sql-col>" ); dbraParam_.setPrompt( "Name of right ascension column in database" ); dbraParam_.setDescription( new String[] { "<p>The name of a column in the SQL database table", "<code>" + dbtableParam_.getName() + "</code>", "which gives the " + sys + "right ascension in degrees.", "</p>", } ); dbdecParam_ = new Parameter( "dbdec" ); dbdecParam_.setUsage( "<sql-col>" ); dbdecParam_.setPrompt( "Name of declination column in database" ); dbdecParam_.setDescription( new String[] { "<p>The name of a column in the SQL database table", "<code>" + dbtableParam_.getName() + "</code>", "which gives the " + sys + "declination in degrees.", "</p>", } ); dbunitParam_ = new ChoiceParameter( "dbunit" ); dbunitParam_.addOption( AngleUnits.DEGREES, "deg" ); dbunitParam_.addOption( AngleUnits.RADIANS, "rad" ); dbunitParam_.setDefault( "deg" ); dbunitParam_.setPrompt( "Units of ra/dec values in database" ); dbunitParam_.setDescription( new String[] { "<p>Units of the right ascension and declination columns", "identified in the database table.", "May be either deg[rees] (the default) or rad[ians].", "</p>", } ); tilingParam_ = new TilingParameter( "tiling" ); dbtileParam_ = new Parameter( "dbtile" ); dbtileParam_.setUsage( "<sql-col>" ); dbtileParam_.setNullPermitted( true ); dbtileParam_.setPrompt( "Name of tiling column in database" ); dbtileParam_.setDescription( new String[] { "<p>The name of a column in the SQL database table", "<code>" + dbtableParam_.getName() + "</code>", "which contains a sky tiling pixel index.", "The tiling scheme is given by the " + tilingParam_.getName(), "parameter.", "Use of a tiling column is optional, but if present", "(and if the column is indexed in the database table)", "it may serve to speed up searches.", "Set to null if the database table contains no tiling column", "or if you do not wish to use one.", "</p>", } ); colsParam_ = new Parameter( "selectcols" ); colsParam_.setUsage( "<sql-cols>" ); colsParam_.setPrompt( "Database columns to select" ); colsParam_.setDescription( new String[] { "<p>An SQL expression for the list of columns to be selected", "from the table in the database.", "A value of \"<code>*</code>\" retrieves all columns.", "</p>", } ); colsParam_.setDefault( "*" ); whereParam_ = new Parameter( "where" ); whereParam_.setUsage( "<sql-condition>" ); whereParam_.setPrompt( "Additional WHERE restriction on selection" ); whereParam_.setNullPermitted( true ); whereParam_.setDescription( new String[] { "<p>An SQL expression further limiting the rows to be selected", "from the database. This will be combined with the constraints", "on position implied by the cone search centres and radii.", "The value of this parameter should just be a condition,", "it should not contain the <code>WHERE</code> keyword.", "A null value indicates no additional criteria.", "</p>", } ); prepareParam_ = new BooleanParameter( "preparesql" ); prepareParam_.setPrompt( "Use JDBC PreparedStatements?" ); prepareParam_.setDescription( new String[] { "<p>If true, the JDBC connection will use", "<code>PreparedStatement</code>s for the SQL SELECTs", "otherwise it will use simple <code>Statement</code>s.", "This is a tuning parameter and affects only performance.", "On some database/driver combinations it's a lot faster set", "false (the default); on others it may be faster, who knows?", "</p>", } ); prepareParam_.setDefault( "false" ); } /** * Returns the empty string. No particular coordinate system is * mandated by this object. */ public String getSkySystem() { return ""; } public Parameter[] getParameters() { List pList = new ArrayList(); pList.add( connParam_ ); pList.addAll( Arrays.asList( connParam_.getAssociatedParameters() ) ); pList.add( dbtableParam_ ); pList.add( dbraParam_ ); pList.add( dbdecParam_ ); pList.add( dbunitParam_ ); pList.add( tilingParam_ ); pList.add( dbtileParam_ ); pList.add( colsParam_ ); pList.add( whereParam_ ); pList.add( prepareParam_ ); return (Parameter[]) pList.toArray( new Parameter[ 0 ] ); } public void configureParams( Environment env, Parameter srParam ) { } public boolean useDistanceFilter( Environment env ) { return true; } public ConeSearcher createSearcher( Environment env, boolean bestOnly ) throws TaskException { final Connection connection = connParam_.connectionValue( env ); String table = dbtableParam_.stringValue( env ); String raCol = dbraParam_.stringValue( env ); String decCol = dbdecParam_.stringValue( env ); String tileCol = dbtileParam_.stringValue( env ); SkyTiling tiling = tileCol == null ? null : tilingParam_.tilingValue( env ); AngleUnits units = (AngleUnits) dbunitParam_.objectValue( env ); String cols = colsParam_.stringValue( env ); String where = whereParam_.stringValue( env ); boolean prepareSql = prepareParam_.booleanValue( env ); if ( where != null && where.toLowerCase().trim().startsWith( "where" ) ) { String msg = "Omit <code>WHERE</code> keyword from " + "<code>" + whereParam_.getName() + "</code> parameter"; throw new ParameterValueException( whereParam_, msg ); } try { return new JdbcConeSearcher( connection, table, raCol, decCol, units, tileCol, tiling, cols, where, bestOnly, prepareSql, true ); } catch ( SQLException e ) { throw new TaskException( "Error preparing SQL statement: " + e.getMessage(), e ); } } }
5824c548d53dfdd216869e2b0a775be46160829c
18618473781c61496563069175cb1b734e024ff0
/q-store/src/main/java/q/dao/page/GroupJoinCategoryPage.java
aba89f847e96b2b8d46863f8c9743273908c3252
[]
no_license
ssyangy/q
a8d0821e440671b09ea3f0764d39f5e38af0d895
0341902727f05152721b24e4309ae297518a3b19
refs/heads/master
2021-03-12T22:20:23.269137
2011-06-24T01:54:37
2011-06-24T01:54:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,983
java
/** * */ package q.dao.page; import java.util.List; /** * @author seanlinwang at gmail dot com * @date May 16, 2011 * */ public class GroupJoinCategoryPage extends Page { private static final long serialVersionUID = 8186458581959280224L; private List<Long> categoryIds; private Long categoryId; private Integer newStatus; private Integer oldStatus; private Integer status; private Long groupId; private Long id; /** * @param categoryIds * the catIds to set */ public void setCategoryIds(List<Long> categoryIds) { this.categoryIds = categoryIds; } /** * @return the catIds */ public List<Long> getCategoryIds() { return categoryIds; } /** * @param newStatus * the newStatus to set */ public void setNewStatus(Integer newStatus) { this.newStatus = newStatus; } /** * @return the newStatus */ public Integer getNewStatus() { return newStatus; } /** * @param oldStatus * the oldStatus to set */ public void setOldStatus(Integer oldStatus) { this.oldStatus = oldStatus; } /** * @return the oldStatus */ public Integer getOldStatus() { return oldStatus; } /** * @param id * the id to set */ public void setId(Long id) { this.id = id; } /** * @return the id */ public Long getId() { return id; } /** * @param status the status to set */ public void setStatus(Integer status) { this.status = status; } /** * @return the status */ public Integer getStatus() { return status; } /** * @param groupId the groupId to set */ public void setGroupId(Long groupId) { this.groupId = groupId; } /** * @return the groupId */ public Long getGroupId() { return groupId; } /** * @param categoryId the categoryId to set */ public void setCategoryId(Long categoryId) { this.categoryId = categoryId; } /** * @return the categoryId */ public Long getCategoryId() { return categoryId; } }
5f88a90cf454597d32101fe41a0f0d80e21cf20b
88f4bc3e21fb3e0ba8189b99fdd18a475cbeebc8
/E-Farming/src/java/mypackage/ProductServlet.java
62d2721dfd128977568a759c17e60a856a9f1111
[]
no_license
JenishMor/E-farming
7fdbd7c6806f7f5fef2e6a19d83be5264aad3465
3682bfe8440305d466f63962ffb184ade492236a
refs/heads/main
2022-12-09T17:42:20.590633
2022-12-03T04:28:17
2022-12-03T04:28:17
487,707,860
2
1
null
null
null
null
UTF-8
Java
false
false
1,907
java
package mypackage; import java.io.IOException; import java.io.PrintWriter; import java.sql.PreparedStatement; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.sql.*; /** * * @author ASUS */ public class ProductServlet extends HttpServlet { protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType("text/html;charset=UTF-8"); PrintWriter out = res.getWriter(); Connection con = null; PreparedStatement stmt = null; String url = "jdbc:mysql://127.0.0.1:3306/register"; String user = "mydb"; String pw = "mydb"; String pname = req.getParameter("name"); String price = req.getParameter("price"); String phone = req.getParameter("phone"); String email = req.getParameter("email"); String add = req.getParameter("address"); try { // out.println(pname + "<br>"); // out.println(price + "<br>"); // out.println(phone + "<br>"); // out.println(email + "<br>"); // out.println(add + "<br>"); Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection(url, user, pw); String query = "insert into product values(?,?,?,?,?)"; stmt = con.prepareStatement(query); stmt.setString(1, pname); stmt.setString(2, price); stmt.setString(3, phone); stmt.setString(4, email); stmt.setString(5, add); stmt.executeUpdate(); res.sendRedirect("thanks.jsp"); } catch (Exception e) { out.println("Error: " + e); } } }
6cacbdad02e1333303250eee85193924f4341264
7ace4a94316e13245aee24787409467e5349d4ea
/config/src/main/java/com/mnomoko/app/repository/CustomerRepository.java
b6b0813ed67194629716093558fdb7d5a395e24e
[]
no_license
mnomoko/candy-shop
bdcf33caa6d06002dc8de0b2b20f10d1885c75e1
d31f9c2bf564b20c8c0853b2bea40c8323adbe4f
refs/heads/master
2022-12-12T03:22:58.884770
2019-11-23T21:05:28
2019-11-23T21:05:28
214,896,553
0
0
null
null
null
null
UTF-8
Java
false
false
335
java
package com.mnomoko.app.repository; import com.mnomoko.app.model.Customer; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import javax.transaction.Transactional; @Repository @Transactional public interface CustomerRepository extends JpaRepository<Customer, Long> { }
f23bc61748aa2fb84097a39ec5f30aeac8f3c421
16d5e88ffe2bcf3268c5133084be1877de8b4bb3
/Panabee-Backend/src/main/java/com/niit/PanabeeBackend/dao/UserDao.java
d2cd12c3acbf9466356ffb886dfc453a54cb136a
[]
no_license
Arijit07/PanabeeBackend
51b77ad9eeefb7c1a1188d97d002c11c91651f84
3c9c91155880f8aebb32a3a7d89ad27d61a07f20
refs/heads/master
2020-04-26T16:50:24.536358
2019-03-04T07:25:45
2019-03-04T07:25:45
173,693,740
0
0
null
null
null
null
UTF-8
Java
false
false
404
java
package com.niit.PanabeeBackend.dao; import java.util.List; import com.niit.PanabeeBackend.model.Users; public interface UserDao { public boolean saveUser(Users user); public boolean updateUser(Users user); public boolean deleteUser(Users user); public List<Users> getAllUser(); public Users UserAuthentication(String userId, String userPassword); public Users getUserByUserId(String id); }
[ "=" ]
=
b15cd0c878ffc053abff9c1ab76441f4af3cec8b
a9477fb97d4debe1099b915c995810a147057469
/src/dto/SheduleDTO.java
3cd4927997ae809e42c72cc3aa14d1f0766e696c
[]
no_license
Isurumayanga97/DoctorChanneling
598d5be43cea9844142788e0f9cfa4d7db34f59f
6a4903463a1fe01cc4146997e49c7211a919d795
refs/heads/master
2020-06-05T03:15:54.068025
2019-06-17T07:25:01
2019-06-17T07:25:01
192,294,450
0
0
null
null
null
null
UTF-8
Java
false
false
3,254
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package dto; /** * * @author User */ public class SheduleDTO { private String DoctId; private String DoctName; private String ShedMon; private String ShedTue; private String ShedWed; private String ShedThu; private String ShedFri; private String ShedSat; private String ShedSun; public SheduleDTO() { } public SheduleDTO(String DoctId, String DoctName, String ShedMon, String ShedTue, String ShedWed, String ShedThu, String ShedFri, String ShedSat, String ShedSun) { this.DoctId = DoctId; this.DoctName = DoctName; this.ShedMon = ShedMon; this.ShedTue = ShedTue; this.ShedWed = ShedWed; this.ShedThu = ShedThu; this.ShedFri = ShedFri; this.ShedSat = ShedSat; this.ShedSun = ShedSun; } /** * @return the DoctId */ public String getDoctId() { return DoctId; } /** * @param DoctId the DoctId to set */ public void setDoctId(String DoctId) { this.DoctId = DoctId; } /** * @return the DoctName */ public String getDoctName() { return DoctName; } /** * @param DoctName the DoctName to set */ public void setDoctName(String DoctName) { this.DoctName = DoctName; } /** * @return the ShedMon */ public String getShedMon() { return ShedMon; } /** * @param ShedMon the ShedMon to set */ public void setShedMon(String ShedMon) { this.ShedMon = ShedMon; } /** * @return the ShedTue */ public String getShedTue() { return ShedTue; } /** * @param ShedTue the ShedTue to set */ public void setShedTue(String ShedTue) { this.ShedTue = ShedTue; } /** * @return the ShedWed */ public String getShedWed() { return ShedWed; } /** * @param ShedWed the ShedWed to set */ public void setShedWed(String ShedWed) { this.ShedWed = ShedWed; } /** * @return the ShedThu */ public String getShedThu() { return ShedThu; } /** * @param ShedThu the ShedThu to set */ public void setShedThu(String ShedThu) { this.ShedThu = ShedThu; } /** * @return the ShedFri */ public String getShedFri() { return ShedFri; } /** * @param ShedFri the ShedFri to set */ public void setShedFri(String ShedFri) { this.ShedFri = ShedFri; } /** * @return the ShedSat */ public String getShedSat() { return ShedSat; } /** * @param ShedSat the ShedSat to set */ public void setShedSat(String ShedSat) { this.ShedSat = ShedSat; } /** * @return the ShedSun */ public String getShedSun() { return ShedSun; } /** * @param ShedSun the ShedSun to set */ public void setShedSun(String ShedSun) { this.ShedSun = ShedSun; } }
5c6f3fbe614630979ea1489a80a009b98327fe93
5faabc8bf7fa0df1e33c73e593e04e5bf5c0e079
/Java-Learning/First JDBC use/src/model/StringArithmetic.java
2c93e70346be59edc7f7b20ec31f0fc272941af8
[]
no_license
gmarczyk/Old-stuff
6fc4cd2df3528d13db007894e0f68b121c77e6ca
6293c52eb595f450d7ec940381d665809eb3d1cf
refs/heads/master
2020-03-17T01:09:52.240840
2018-05-12T13:36:16
2018-05-12T13:36:16
133,142,364
0
0
null
null
null
null
UTF-8
Java
false
false
27,120
java
package pl.polsl.java.marczyk.model; import java.util.ArrayList; /** * Provides chosen basic and advanced arithmetical functions performed on * numerical values represented by String type. * * @author Marczyk Grzegorz * @version 1.0.3 */ public class StringArithmetic { public StringArithmetic() { } /** * Function performs algorithm of fast modular exponentiation given by * formula: ((a^p) mod m) on unsigned numeric only values represented as * Strings. * * @param a in the formula: ((a^p) mod m) * @param p in the formula: ((a^p) mod m) * @param m in the formula: ((a^p) mod m) * @return result of the algorithm * @throws ValueOutOfRequiredIntervalException function takes the throws * from this.multiplying, this.moduloOperation, this.square. */ public String fastModularExponentiation(String a, String p, String m) throws ValueOutOfRequiredIntervalException { String binaryP = this.decToBin(p); String algorithmResult; String algorithmVariable; algorithmResult = "1"; algorithmVariable = this.moduloOperation(a, m); for (int i = binaryP.length() - 1; i >= 0; i--) { if (Character.getNumericValue(binaryP.charAt(i)) == 1) { algorithmResult = this.multiplying(algorithmResult, algorithmVariable); algorithmResult = this.moduloOperation(algorithmResult, m); algorithmVariable = this.square(algorithmVariable); algorithmVariable = this.moduloOperation(algorithmVariable, m); } else { algorithmVariable = this.square(algorithmVariable); algorithmVariable = this.moduloOperation(algorithmVariable, m); } } return algorithmResult; } /** * Function deletes insignificant zeros in String. Simply deletes all the * zeros if found any non-zero character. IMPORTANT: It handles characters * that are not digits! * * @param inputString value to perform action on. * @return string without insignificant zeros. If input was empty, returns * empty, as returns input value if no insignificant zeros were found. Input * value = 0 also is returned as "0". */ public String deleteInsignificantZeros(String inputString) { int j = 0; boolean justZeros = false; boolean foundFirstSignificantNum = false; while (!foundFirstSignificantNum && j < inputString.length()) { if (Character.getNumericValue(inputString.charAt(j)) != 0) { foundFirstSignificantNum = true; } else { j++; justZeros = true; } } if (foundFirstSignificantNum == true) { return inputString.substring(j); } else { if (justZeros == true) { return "0"; } return inputString; } } /** * Function compares two strings which should represent unsigned numeric * value. IMPORTANT: Function can compare two empty values as a 0. * * @param firstString value that is compared to the other one. Should be * string that represents a numerical unsigned value. Cannot contain * characters other than digits. * @param secondString value that the first one is compared to. Requirements * are the same as in the firstString. * @return returns 0 if strings are equal numeric in value, 1 if the * firstString is greater than the secondString, -1 if the firstString is * lower than the secondString. * @throws ValueOutOfRequiredIntervalException when any of input parameters * are not pure numerical chains of characters. Somewhere in the String a * non-digit character exists. */ public int compareValues(String firstString, String secondString) throws ValueOutOfRequiredIntervalException { firstString = this.deleteInsignificantZeros(firstString); secondString = this.deleteInsignificantZeros(secondString); if ("".equals(firstString)) { firstString = "0"; } if ("".equals(secondString)) { secondString = "0"; } int firstLength = firstString.length(); int secondLength = secondString.length(); for (int i = 0; i < firstLength; i++) { int tmp = Character.getNumericValue(firstString.charAt(i)); if (tmp < 0 || tmp > 9) { throw new ValueOutOfRequiredIntervalException("String contains a value which is not a digit"); } } for (int i = 0; i < secondLength; i++) { int tmp = Character.getNumericValue(secondString.charAt(i)); if (tmp < 0 || tmp > 9) { throw new ValueOutOfRequiredIntervalException("String contains a value which is not a digit"); } } // Strings same size, if there is anyhigher number in firstString on index i, then firstString is greater if (firstLength == secondLength) { boolean foundResult = false; int i = 0; int resultSetter = 0; while (!foundResult && i < firstLength) { // same size strings, doesnt matter which size is taken int first = Character.getNumericValue(firstString.charAt(i)); int second = Character.getNumericValue(secondString.charAt(i)); if (first > second || first < second) { foundResult = true; resultSetter = first - second; } else { i++; } } if (foundResult) { if (resultSetter < 0) { return -1; } else { return 1; } } else { return 0; } } else if (firstLength > secondLength) { return 1; } else { return -1; } } /** * Function performs basic written method of adding on two unsigned values * represented as String. * * @param firstNum first number of operation represented as String. Should * consist of digit-characters only. * @param secondNum second number of operation represented as String.Should * consist of digit-characters only. * @return result of adding as a String. If input parameter is empty, it is * treated as a 0. * @throws ValueOutOfRequiredIntervalException when any of input parameters * are not pure numerical chains of characters. Somewhere in the String a * non-digit character exists. * */ public String writtenAdding(String firstNum, String secondNum) throws ValueOutOfRequiredIntervalException { /* Each char of string is put into array. It makes the alghoritm easier to implement. */ ArrayList<Integer> arrayFirstNum = new ArrayList<>(); ArrayList<Integer> arraySecondNum = new ArrayList<>(); ArrayList<Integer> arrayResult = new ArrayList<>(); for (int i = 0; i < firstNum.length(); i++) { int tmp = Character.getNumericValue(firstNum.charAt(i)); if (tmp < 0 || tmp > 9) { throw new ValueOutOfRequiredIntervalException("String contains a value which is not a digit"); } arrayFirstNum.add(tmp); } for (int i = 0; i < secondNum.length(); i++) { int tmp = Character.getNumericValue(secondNum.charAt(i)); if (tmp < 0 || tmp > 9) { throw new ValueOutOfRequiredIntervalException("String contains a value which is not a digit"); } arraySecondNum.add(Character.getNumericValue(secondNum.charAt(i))); } /* Checking the length and comparing if both numbers are same size. If not, add insignificant zeroes to array, so both arrays are the same size. It allows to evade adding array1[i]+array2[i] when some of those may not exist (if they are different sizes). (ArrayOutOfBoundException) */ int lengthFirstNum = arrayFirstNum.size() - 1; int lengthSecondNum = arraySecondNum.size() - 1; if (lengthFirstNum != lengthSecondNum) { int highestLength = Math.max(lengthFirstNum, lengthSecondNum); if (lengthFirstNum != highestLength) { for (int i = 0; i < highestLength - lengthFirstNum; i++) { arrayFirstNum.add(0, 0); } } else if (lengthSecondNum != highestLength) { for (int i = 0; i < highestLength - lengthSecondNum; i++) { arraySecondNum.add(0, 0); } } } // Adding alghoritm int carriage = 0; int value; // !!! It may be arraySecondNum also, as we added insignificant zeroes, both array sizes are the same. for (int i = arrayFirstNum.size() - 1; i >= 0; i--) { value = arrayFirstNum.get(i) + arraySecondNum.get(i) + carriage; carriage = 0; if (value > 9) { carriage++; value -= 10; } arrayResult.add(0, value); } if (carriage != 0) { arrayResult.add(0, carriage); } return this.arrayIntToString(arrayResult); } /** * Function multiplies two numeric values represented by Strings that should * be unsigned * * @param multiplier first value of multiplying, is the iterator of adding * loop. Should consist of digit-characters only. * @param multiplicant second value of multiplying, is the one that is being * added specific number of times. Requirements are the same as in * multiplier. * @return result of multiplying. * @throws ValueOutOfRequiredIntervalException function takes the throws * from this.writtenSubtracting and this.writtenAdding. */ public String multiplying(String multiplier, String multiplicant) throws ValueOutOfRequiredIntervalException { String multiplyingResult = "0"; this.deleteInsignificantZeros(multiplier); this.deleteInsignificantZeros(multiplicant); // Add multiplier to result as many times as multiplicant value says while (!"0".equals(multiplicant)) { multiplicant = this.writtenSubtracting(multiplicant, "1"); multiplyingResult = this.writtenAdding(multiplyingResult, multiplier); } return multiplyingResult; } /** * Function squares numeric value represented by String. Performs following * formula: toSquare*toSquare. * * @param toSquare is the value to be squared. Must be a String that * consists only of digit-characters. * @return square of the input value. * @throws ValueOutOfRequiredIntervalException function takes the throws * from this.multiplying. */ public String square(String toSquare) throws ValueOutOfRequiredIntervalException { return this.multiplying(toSquare, toSquare); } /** * Function performs basic written method of subtracting on two unsigned * values represented as String. Following formula is performed: return = * firstNum - secondNum. * * @param firstNum first number of operation represented as String. Should * consist of digit-characters only. In calculations empty values are set to * 0. * @param secondNum second number of operation represented as String. * Requirements are the same as in firstNum. * @return result of subtracting. If the firstNum is lower than the * secondNum, then the result is the firstNum. * @throws ValueOutOfRequiredIntervalException when any of input parameters * are not pure numerical chains of characters. Somewhere in the String a * non-digit character exists. If empty value input, as first number, * returns 0. */ public String writtenSubtracting(String firstNum, String secondNum) throws ValueOutOfRequiredIntervalException { if ("".equals(firstNum)) { firstNum = "0"; } if ("".equals(secondNum)) { secondNum = "0"; } /* Each char of string is put into array. It makes the alghoritm easier to implement. */ ArrayList<Integer> arrayFirstNum = new ArrayList<>(); ArrayList<Integer> arraySecondNum = new ArrayList<>(); ArrayList<Integer> arrayResult = new ArrayList<>(); firstNum = this.deleteInsignificantZeros(firstNum); secondNum = this.deleteInsignificantZeros(secondNum); for (int i = 0; i < firstNum.length(); i++) { int tmp = Character.getNumericValue(firstNum.charAt(i)); if (tmp < 0 || tmp > 9) { throw new ValueOutOfRequiredIntervalException("String contains a value which is not a digit " + firstNum); } arrayFirstNum.add(tmp); } for (int i = 0; i < secondNum.length(); i++) { int tmp = Character.getNumericValue(secondNum.charAt(i)); if (tmp < 0 || tmp > 9) { throw new ValueOutOfRequiredIntervalException("String contains a value which is not a digit"); } arraySecondNum.add(tmp); } /* If firstNum is greater than secondNum, just return firstNum, because the result should be signed. This function does not support unsigned values. */ int greaterValue; greaterValue = this.compareValues(firstNum, secondNum); if (greaterValue == 0) { // Values are the same, result is "a-a = 0". return "0"; } else if (greaterValue < 0) { // firstNum is lower, result should be negative, but this function does not support such ones. return firstNum; } else { // firstNum is higher, subtracting is possible. // Add insignificant zeros to prevent OutOfBound exceptions int lengthFirstNum = firstNum.length(); int lengthSecondNum = secondNum.length(); int highestLength = Math.max(lengthFirstNum, lengthSecondNum); if (lengthFirstNum != highestLength) { for (int i = 0; i < highestLength - lengthFirstNum; i++) { arrayFirstNum.add(0, 0); } } else if (lengthSecondNum != highestLength) { for (int i = 0; i < highestLength - lengthSecondNum; i++) { arraySecondNum.add(0, 0); } } // Subtracting int borrow = 0; int value; // !!! It may be arraySecondNum also, as we added insignificant zeroes, both array sizes are the same. for (int i = arrayFirstNum.size() - 1; i >= 0; i--) { value = arrayFirstNum.get(i) - arraySecondNum.get(i); if (value < 0) { borrow(arrayFirstNum, i); value = arrayFirstNum.get(i) - arraySecondNum.get(i); } arrayResult.add(0, value); } return this.arrayIntToString(arrayResult); } } /** * Function performs modulo operation on two Strings that should represent a * numeric unsigned value. Performs following formula: result = firstNum mod * secondNum. * * @param firstNum value that is being divided. Should consist of * digit-characters only. * @param secondNum the divider. Requirements are the same as in firstNum. * @return operation of modulo division. * @throws ValueOutOfRequiredIntervalException function takes the throws * from the throw from this.compareValues. * */ public String moduloOperation(String firstNum, String secondNum) throws ValueOutOfRequiredIntervalException { if ("0".equals(secondNum)) { throw new ArithmeticException("By 0 division."); } firstNum = this.deleteInsignificantZeros(firstNum); secondNum = this.deleteInsignificantZeros(secondNum); int firstNumLength = firstNum.length(); int secondNumLength = secondNum.length(); int comparisionResult = this.compareValues(firstNum, secondNum); if (comparisionResult == 0) { return "0"; } else if (comparisionResult < 0) { return firstNum; } else { while (comparisionResult > 0) { firstNum = this.writtenSubtracting(firstNum, secondNum); comparisionResult = this.compareValues(firstNum, secondNum); } return firstNum; } } /** * Represents parity of a number. Contains a method that performs basic * operation of dimidiation algorithm. */ private enum Parity { ODD, EVEN; /** * Function performs basic operation of dimidiation algorithm on two * adjacent digits. Enum should not contain more fields than "ODD" and * "EVEN". * * @param value is the digit that lies just to right of the one that * parity is needed. Digit is represented by int value in given * interval: 0-9 and the input value has to be in it. * @return value determined by constant table, depending on parity of a * digit and value of the digit that the first one is followed by. * Return value is initialized as "-1", should never return such value * if nothing strange happens. */ private int dimidiationElementary(int value) { int retVal = -1; switch (this) { case ODD: switch (value) { case 0: retVal = 5; break; case 1: retVal = 5; break; case 2: retVal = 6; break; case 3: retVal = 6; break; case 4: retVal = 7; break; case 5: retVal = 7; break; case 6: retVal = 8; break; case 7: retVal = 8; break; case 8: retVal = 9; break; case 9: retVal = 9; break; } break; case EVEN: switch (value) { case 0: retVal = 0; break; case 1: retVal = 0; break; case 2: retVal = 1; break; case 3: retVal = 1; break; case 4: retVal = 2; break; case 5: retVal = 2; break; case 6: retVal = 3; break; case 7: retVal = 3; break; case 8: retVal = 4; break; case 9: retVal = 4; break; } break; } return retVal; } } /** * Function performs decimal dimidiation algorithm on a numeric value * represented by String. * * @param value numeric value represented by String that should be unsigned. * Value should be unsigned and consist of no other characters than digits, * otherwise some unexpected values might be calculated. * @return decimal value divided by two as a String. */ private String decimalDimidiation(String value) { String resultString = ""; int firstNum; int secondNum; Parity firstNumParity; // Algorithm requires to have '0' as the first Char of String; value = '0' + value; for (int i = 0; i < value.length() - 1; i++) { firstNum = Character.getNumericValue(value.charAt(i)); secondNum = Character.getNumericValue(value.charAt(i + 1)); if ((firstNum & 1) == 0) { firstNumParity = Parity.EVEN; } else { firstNumParity = Parity.ODD; } Integer elementaryDivResult = firstNumParity.dimidiationElementary(secondNum); resultString += elementaryDivResult.toString(); } // Check if the result is not single 0, if it isn't, delete insignificant zero at the beginning if (resultString.charAt(0) == '0' && resultString.length() != 1) { resultString = resultString.substring(1, resultString.length()); } return resultString; } /** * Function uses decimal dimidiation algorithm and div by 2 with remainder * algorithm to convert decimal unsigned value represented as String to * binary value. * * @param valueToConvert should numeric value represented by String, * unsigned, should not consist of characters other than digits - otherwise * unexpected results may occur. * @return binary representation as a String of the decimal input value. */ private String decToBin(String valueToConvert) { // Result binary string represented as array ArrayList<Boolean> arrayBinaryString = new ArrayList<>(); // Current value to divide String toDiv = valueToConvert; while (!"0".equals(toDiv)) { int toDivLength = toDiv.length(); int lastCharValue = Character.getNumericValue(toDiv.charAt(toDivLength - 1)); /* Using AND operation on binary representation of value to check if a value is even or odd if it is even, there is no remainder. */ Parity lastCharParity; if ((lastCharValue & 1) == 0) { lastCharParity = Parity.EVEN; } else { lastCharParity = Parity.ODD; } // Depending on the remainder, the final value is being formed. if (lastCharParity == Parity.EVEN) { arrayBinaryString.add(0, false); } else { arrayBinaryString.add(0, true); } toDiv = this.decimalDimidiation(toDiv); } return this.arrayBoolToString(arrayBinaryString); } /** * Function converts array of Boolean values to String without insignificant * zeros. Given result is a binary represented value. Values that are placed * closer to [0] index of array are the ones on the left in result chain. * * @param inputArray is ArrayList of Boolean type. * @return String that represents a numeric binary value without * insignificant zeros. */ private String arrayBoolToString(ArrayList<Boolean> inputArray) { String returnString = ""; int j = 0; boolean foundFirstNum = false; while (!foundFirstNum && j < inputArray.size()) { if (inputArray.get(j) != false) { foundFirstNum = true; } else { j++; } } for (int i = j; i < inputArray.size(); i++) { if (inputArray.get(i) == true) { returnString = returnString + '1'; } else { returnString = returnString + '0'; } } if (foundFirstNum == true) { return returnString; } else { return "0"; } } /** * Function converts array of Integer values to String without insignificant * zeros. Values that are placed closer to [0] index of array are the ones * on the left in result chain. * * @param inputArray is ArrayList of Integer type. * @return String that represents a numeric value without insignificant * zeros. */ private String arrayIntToString(ArrayList<Integer> inputArray) { String returnString = ""; int j = 0; boolean foundFirstNum = false; while (!foundFirstNum && j < inputArray.size()) { if (inputArray.get(j) != 0) { foundFirstNum = true; } else { j++; } } for (int i = j; i < inputArray.size(); i++) { returnString = returnString + inputArray.get(i); } if (foundFirstNum == true) { return returnString; } else { return "0"; } } /** * Function is used in this.writtenSubtracting method. It finds the position * to borrow from and changes the input numerical chains to proper state. * * @param firstNum numerical chain. This is the chain that will be moderated * in order to pass a value to the position that wants the borrow. * @param borrowPos is position which wants to borrow. */ private void borrow(ArrayList<Integer> firstNum, int borrowPos) { boolean foundBorrow = false; for (int i = borrowPos - 1; i >= 0 && foundBorrow == false; i--) { if (firstNum.get(i) != 0) { foundBorrow = true; firstNum.set(i, firstNum.get(i) - 1); firstNum.set(i + 1, firstNum.get(i + 1) + 10); if ((i + 1) != borrowPos) { borrow(firstNum, borrowPos); } } } } }
072998d6cc298f5744038efcd44d7e9b0ea98c21
5674b95147b978c45dda5ab1baab9c604c2cbd14
/spring-cloud-zuul/spring-cloud-zuul-filter/src/main/java/com/laiyy/gitee/zuul/springcloudzuulfilter/filter/PostFilter.java
eccc03e5967e9c9312453c4d16034738826b8a64
[]
no_license
laiyy0728/springcloud
2950c6455aecd6f13ac170bf8d6963c500f39bab
1f460fef4b6fdf9e8ba3e4cbf7ee0b8a16842c0b
refs/heads/master
2020-05-07T17:48:15.458971
2019-04-18T14:55:05
2019-04-18T14:55:05
180,738,410
0
0
null
null
null
null
UTF-8
Java
false
false
1,560
java
package com.laiyy.gitee.zuul.springcloudzuulfilter.filter; import com.netflix.zuul.ZuulFilter; import com.netflix.zuul.context.RequestContext; import com.netflix.zuul.exception.ZuulException; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants; /** * @author laiyy * @date 2019/2/18 13:56 * @description */ public class PostFilter extends ZuulFilter { private static final Logger LOGGER = LoggerFactory.getLogger(PostFilter.class); @Override public String filterType() { return FilterConstants.POST_TYPE; } @Override public int filterOrder() { return 0; } @Override public boolean shouldFilter() { return true; } @Override public Object run() throws ZuulException { LOGGER.info(">>>>>>>>>>>>>>>>>>> Post Filter! <<<<<<<<<<<<<<<<"); RequestContext context = RequestContext.getCurrentContext(); // 处理返回中文乱码 context.getResponse().setCharacterEncoding("UTF-8"); // 获取上下文保存的 responseBody String responseBody = context.getResponseBody(); // 如果 responseBody 不为空,则证明流程中有异常发生 if (StringUtils.isNotBlank(responseBody)) { // 设置返回状态码 context.setResponseStatusCode(500); // 替换响应报文 context.setResponseBody(responseBody); } return null; } }
[ "=" ]
=
8088a5cda2a79bf40d177c423f735b249f500c6d
5cecafbb6e7fd7b61494f8ca50fec1c8bdf4adeb
/netflix/src/Tablet.java
8d37ec44c75ee574060558094b4e496517d6edff
[]
no_license
Massoudas/Netflix
862a34e39fd603fac3a0f13764e54371d6784c77
e1d42803c9af14105e83c0e5f6bfecfacdab5da3
refs/heads/master
2021-05-21T04:22:29.435139
2020-04-02T18:53:11
2020-04-02T18:53:11
252,540,430
0
0
null
null
null
null
UTF-8
Java
false
false
38
java
public class Tablet extends Device{ }
c6614697b6d5dc11bdb587a105c0e70b4d528bd0
d349df69a0d837e501d684bb881ccac266be1071
/fancyApp/src/main/java/com/meplus/fancy/utils/FIRUtils.java
83eb637832233a44915ef8a2ec5aaca3e70a4327
[]
no_license
DreamFly111/MePlus
90659265790478de1053570b6f4b80dc1e580f08
58504cf56f7d733378d831785eb7b6e1cfa4dc5a
refs/heads/master
2021-01-17T13:01:08.345495
2016-06-12T07:19:46
2016-06-12T07:19:46
59,458,730
0
1
null
null
null
null
UTF-8
Java
false
false
1,736
java
package com.meplus.fancy.utils; import android.content.Context; import android.util.Log; import com.marvinlabs.intents.MediaIntents; import com.meplus.fancy.Constants; import com.meplus.fancy.model.entity.FirVersion; import cn.trinea.android.common.util.PackageUtils; import im.fir.sdk.FIR; import im.fir.sdk.VersionCheckCallback; /** * Created by dandanba on 3/2/16. */ public class FIRUtils { public static void checkForUpdateInFIR(final Context context) { FIR.checkForUpdateInFIR(Constants.API_TOKEN, new VersionCheckCallback() { @Override public void onSuccess(String versionJson) { Log.i("fir", "check from fir.im success! " + "\n" + versionJson); final FirVersion version = JsonUtils.readValue(versionJson, FirVersion.class); final int versionCode = PackageUtils.getAppVersionCode(context); if (versionCode < version.getVersion()) { context.startActivity(MediaIntents.newOpenWebBrowserIntent(version.getUpdate_url())); } } @Override public void onFail(Exception exception) { Log.i("fir", "check fir.im fail! " + "\n" + exception.getMessage()); } @Override public void onStart() { Log.i("fir", "check fir.im start! " + "\n"); } @Override public void onFinish() { Log.i("fir", "check fir.im finish! " + "\n"); } } ); } }
d0de946317df3ac94bc3ed9bd2e210618f0cb0b4
ca7b16c021874e80a07c92b92d42637bcc805bd0
/src/listener/main/AssemblyGenListener.java
1cd26eab696e56c2609ea02eea9123be7be1cce3
[]
no_license
BOGUENSONG/item3
877cd19c3337275a083d8d60229bfce28335a46f
e36f0c890eb2720d5de1fccff035ff3fc5e597ce
refs/heads/master
2020-09-20T22:26:50.690278
2019-12-26T01:23:19
2019-12-26T01:23:19
224,606,006
0
0
null
null
null
null
UHC
Java
false
false
13,751
java
package listener.main; import org.antlr.v4.runtime.tree.ParseTreeListener; import org.antlr.v4.runtime.tree.ParseTreeProperty; import generated.MiniCBaseListener; import generated.MiniCParser; import generated.MiniCParser.ParamsContext; import static listener.main.AssemblyGenListenerHelper.*; import static listener.main.SymbolTable.*; public class AssemblyGenListener extends MiniCBaseListener implements ParseTreeListener { ParseTreeProperty<String> newTexts = new ParseTreeProperty<String>(); SymbolTable symbolTable = new SymbolTable(); int tab = 0; int label = 0; // program : decl+ @Override public void enterFun_decl(MiniCParser.Fun_declContext ctx) { symbolTable.initFunDecl(); String fname = getFunName(ctx); ParamsContext params; if (fname.equals("main")) { symbolTable.putLocalVar("args", Type.INTARRAY); } else { symbolTable.putFunSpecStr(ctx); params = (MiniCParser.ParamsContext) ctx.getChild(3); symbolTable.putParams(params); } } // var_decl : type_spec IDENT ';' | type_spec IDENT '=' LITERAL ';'|type_spec IDENT '[' LITERAL ']' ';' @Override public void enterVar_decl(MiniCParser.Var_declContext ctx) { String varName = ctx.IDENT().getText(); if (isArrayDecl(ctx)) { symbolTable.putGlobalVar(varName, Type.INTARRAY); } else if (isDeclWithInit(ctx)) { symbolTable.putGlobalVarWithInitVal(varName, Type.INT, initVal(ctx)); } else { // simple decl symbolTable.putGlobalVar(varName, Type.INT); } } @Override public void enterLocal_decl(MiniCParser.Local_declContext ctx) { if (isArrayDecl(ctx)) { symbolTable.putLocalVar(getLocalVarName(ctx), Type.INTARRAY); } else if (isDeclWithInit(ctx)) { symbolTable.putLocalVarWithInitVal(getLocalVarName(ctx), Type.INT, initVal(ctx)); } else { // simple decl symbolTable.putLocalVar(getLocalVarName(ctx), Type.INT); } } @Override public void exitProgram(MiniCParser.ProgramContext ctx) { String fun_decl = "", var_decl = ""; for(int i = 0; i < ctx.getChildCount(); i++) { if(isFunDecl(ctx, i)) fun_decl += newTexts.get(ctx.decl(i)); else var_decl += newTexts.get(ctx.decl(i)); } newTexts.put(ctx, var_decl + fun_decl); System.out.println(newTexts.get(ctx)); } // decl : var_decl | fun_decl @Override public void exitDecl(MiniCParser.DeclContext ctx) { String decl = ""; if(ctx.getChildCount() == 1) { if(ctx.var_decl() != null) //var_decl decl += newTexts.get(ctx.var_decl()); else //fun_decl decl += newTexts.get(ctx.fun_decl()); } newTexts.put(ctx, decl); } // stmt : expr_stmt | compound_stmt | if_stmt | while_stmt | return_stmt @Override public void exitStmt(MiniCParser.StmtContext ctx) { String stmt = ""; if(ctx.getChildCount() > 0) { if(ctx.expr_stmt() != null) // expr_stmt stmt += newTexts.get(ctx.expr_stmt()); else if(ctx.compound_stmt() != null) // compound_stmt stmt += newTexts.get(ctx.compound_stmt()); // <(0) Fill here> else if(ctx.if_stmt() != null) { stmt += newTexts.get(ctx.if_stmt()); //if_stmt } else if(ctx.while_stmt() != null) { stmt += newTexts.get(ctx.while_stmt()); //while_stmt } else { stmt += newTexts.get(ctx.return_stmt()); //return_stmt } } newTexts.put(ctx, stmt); } // expr_stmt : expr ';' @Override public void exitExpr_stmt(MiniCParser.Expr_stmtContext ctx) { String stmt = ""; if(ctx.getChildCount() == 2) { stmt += newTexts.get(ctx.expr()); // expr } newTexts.put(ctx, stmt); } // while_stmt : WHILE '(' expr ')' stmt @Override public void exitWhile_stmt(MiniCParser.While_stmtContext ctx) { // <(1) Fill here!> String loop = this.symbolTable.newLabel(); String escape = this.symbolTable.newLabel(); String expr = newTexts.get(ctx.expr()); String stmt = newTexts.get(ctx.stmt()); String temp =""; temp = loop + ":\n" + expr + "jz " + escape + "\n"+ stmt + "jmp " + loop + "\n" + escape + ":\n"; newTexts.put(ctx, temp); } @Override public void exitFun_decl(MiniCParser.Fun_declContext ctx) { // <(2) Fill here!> String ident = ctx.getChild(1).getText(); String compound_stmt = newTexts.get(ctx.compound_stmt()); String type_spec = ctx.type_spec().getText(); String stmt; //void타입의 경우 마지막에 return이 붙기 때문에 여기서 처리해준다. if (type_spec.equals("void")) { stmt = funcHeader(ctx,ident) + compound_stmt + "nop\n" + " pop rbp\n"+" ret\n"; } else { stmt = funcHeader(ctx,ident) + compound_stmt + " pop rbp\n" + " ret" + "\n" ; } newTexts.put(ctx, stmt); // type_spec IDENT '(' params ')' compound_stmt 의 구조 } private String funcHeader(MiniCParser.Fun_declContext ctx, String fname) { String variables = ""; MiniCParser.ParamsContext params = ctx.params(); for (int i = 0 ; i < params.param().size();i++) { symbolTable.push_argStack(); //Stack에 parameter 개수만큼 push한다. } for (int i = 0,j = -4 ; i < params.param().size();i++) { variables += String.format(" mov DWORD PTR [rbp%d], %s\n",j,symbolTable.get_argRegister()); j = j-4; } return symbolTable.getFunSpecStr(fname) + "\n" + " push rbp\n" + " mov rbp, rsp" + "\n" + variables; } @Override public void exitVar_decl(MiniCParser.Var_declContext ctx) { String varName = ctx.IDENT().getText(); String varDecl = ""; if (isDeclWithInit(ctx)) { varDecl += "putfield " + varName + "\n"; // v. initialization => Later! skip now..: } newTexts.put(ctx, varDecl); } //수정 11-26 @Override public void exitLocal_decl(MiniCParser.Local_declContext ctx) { String varDecl = ""; if (isDeclWithInit(ctx)) { String vId = symbolTable.getVarId(ctx); varDecl += " mov DWORD PTR [rbp" + vId + "]"+ ", " + ctx.LITERAL().getText() + "\n"; } newTexts.put(ctx, varDecl); } // compound_stmt : '{' local_decl* stmt* '}' @Override public void exitCompound_stmt(MiniCParser.Compound_stmtContext ctx) { // <(3) Fill here> String localDeclAndStmt = ""; for(MiniCParser.Local_declContext l : ctx.local_decl()) localDeclAndStmt += newTexts.get(l); for(MiniCParser.StmtContext s : ctx.stmt()) localDeclAndStmt += newTexts.get(s); newTexts.put(ctx, localDeclAndStmt); } // if_stmt : IF '(' expr ')' stmt | IF '(' expr ')' stmt ELSE stmt; @Override public void exitIf_stmt(MiniCParser.If_stmtContext ctx) { String stmt = ""; String condExpr= newTexts.get(ctx.expr()); String thenStmt = newTexts.get(ctx.stmt(0)); String lend = symbolTable.newLabel(); String lelse = symbolTable.newLabel(); if(noElse(ctx)) { stmt += condExpr + "\n" + "je " + lend + "\n" + thenStmt + "\n" + lend + ":" + "\n"; } else { String elseStmt = newTexts.get(ctx.stmt(1)); stmt += condExpr + "\n" + "je " + lelse + "\n" + thenStmt + "\n" + "jmp " + lend + "\n" + lelse + ": " + elseStmt + "\n" + lend + ":" + "\n"; } newTexts.put(ctx, stmt); } // return_stmt : RETURN ';' | RETURN expr ';' @Override public void exitReturn_stmt(MiniCParser.Return_stmtContext ctx) { // <(4) Fill here> String returnStmt; if(ctx.expr() != null) { // RETURN expr ';' String expr = newTexts.get(ctx.expr()); returnStmt = expr; } else{ // RETURN ';' 이 경우는 반환값이 VOID설정일 때인데, exitFunc_decl에서 관리해주도록 한다. returnStmt = ""; } newTexts.put(ctx, returnStmt); } @Override public void exitExpr(MiniCParser.ExprContext ctx) { String expr = ""; if(ctx.getChildCount() <= 0) { newTexts.put(ctx, ""); return; } if(ctx.getChildCount() == 1) { // IDENT | LITERAL if(ctx.IDENT() != null) { String idName = ctx.IDENT().getText(); if(symbolTable.getVarType(idName) == Type.INT) { expr += " mov " + symbolTable.push_Register() + ", DWORD PTR [rbp" + symbolTable.getVarId(idName) + "] \n"; } //else // Type int array => Later! skip now.. // expr += " lda " + symbolTable.get(ctx.IDENT().getText()).value + " \n"; } else if (ctx.LITERAL() != null) { String literalStr = ctx.LITERAL().getText(); expr += " mov " + symbolTable.push_Register() + ", " +literalStr + " \n"; } } else if(ctx.getChildCount() == 2) { // UnaryOperation expr = handleUnaryExpr(ctx,expr); } else if(ctx.getChildCount() == 3) { if(ctx.getChild(0).getText().equals("(")) { // '(' expr ')' expr = newTexts.get(ctx.expr(0)); } else if(ctx.getChild(1).getText().equals("=")) { // IDENT '=' expr expr = " mov " + symbolTable.push_Register() + ", " + "DWORD PTR [rbp" + symbolTable.getVarId(ctx.IDENT().getText()) + "]\n" + newTexts.get(ctx.expr(0)); } else { // binary operation expr = handleBinExpr(ctx, expr); } } // IDENT '(' args ')' | IDENT '[' expr ']' else if(ctx.getChildCount() == 4) { if(ctx.args() != null){ // function calls expr = handleFunCall(ctx, expr); } else { // expr // Arrays: TODO } } // IDENT '[' expr ']' '=' expr else { // Arrays: TODO */ } newTexts.put(ctx, expr); } private String handleUnaryExpr(MiniCParser.ExprContext ctx, String expr) { expr += newTexts.get(ctx.expr(0)) ; switch(ctx.getChild(0).getText()) { case "-": expr += " neg " + symbolTable.getRegister() + "\n"; break; case "--": expr += " sub " + symbolTable.getRegister() + ", 1\n"; break; case "++": expr += " add " + symbolTable.getRegister() + ", 1\n"; break; case "!": expr += " cmp " + symbolTable.getRegister() + ", 0\n" + " sete al\n" + " movzx " + symbolTable.push_Register() +", al\n"; break; } return expr; } private String handleBinExpr(MiniCParser.ExprContext ctx, String expr) { String l2 = symbolTable.newLabel(); String lend = symbolTable.newLabel(); expr += newTexts.get(ctx.expr(0)); expr += newTexts.get(ctx.expr(1)); String reg1 = symbolTable.getRegister(); String reg2 = symbolTable.getRegister(); switch (ctx.getChild(1).getText()) { case "*": expr += " imul " + reg1 + ", " + reg2 + "\n"; symbolTable.push_hasRegName(reg1); break; case "/": expr += " idiv " + reg1 + ", " + reg2 + "\n"; symbolTable.push_hasRegName(reg1); break; case "%": expr += "Error 어셈블리는 나머지연산없음"; break; //어셈블리는 나머지연산이없다 case "+": // expr(0) expr(1) iadd expr += " add " + reg1 + ", " + reg2 + "\n"; symbolTable.push_hasRegName(reg1); break; case "-": expr += " sub " + reg1 + ", " + reg2 + "\n"; symbolTable.push_hasRegName(reg1); break; case "==": expr += " cmp "+ reg1 + ", " + reg2 + "\n" + " je " + l2 + "\n" + " mov eax 0" + "\n" + " jmp " + lend + "\n" + l2 + ": \n" + " mov eax 1" + "\n" + lend + ": " + "\n"; symbolTable.push_hasRegName(reg1); break; case "!=": expr += " cmp "+ reg1 + ", " + reg2 + "\n" + " jne " + l2 + "\n" + " mov eax 0" + "\n" + " jmp " + lend + "\n" + l2 + ": \n" + " mov eax 1" + "\n" + lend + ": " + "\n"; symbolTable.push_hasRegName(reg1); break; case "<=": // <(5) Fill here> expr += " cmp "+ reg1 + ", " + reg2 + "\n" + " jle " + l2 + "\n" + " mov eax 0" + "\n" + " jmp " + lend + "\n" + l2 + ": \n" + " mov eax 1" + "\n" + lend + ": " + "\n"; symbolTable.push_hasRegName(reg1); break; case "<": // <(6) Fill here> expr += " cmp "+ reg1 + ", " + reg2 + "\n" + " jl " + l2 + "\n" + " mov eax 0" + "\n" + " jmp " + lend + "\n" + l2 + ": \n" + " mov eax 1" + "\n" + lend + ": " + "\n"; symbolTable.push_hasRegName(reg1); break; case ">=": // <(7) Fill here> expr += " cmp "+ reg1 + ", " + reg2 + "\n" + " jge " + l2 + "\n" + " mov eax 0" + "\n" + " jmp " + lend + "\n" + l2 + ": \n" + " mov eax 1" + "\n" + lend + ": " + "\n"; symbolTable.push_hasRegName(reg1); break; case ">": // <(8) Fill here> expr += " cmp "+ reg1 + ", " + reg2 + "\n" + " jg " + l2 + "\n" + " mov eax 0" + "\n" + " jmp " + lend + "\n" + l2 + ": \n" + " mov eax 1" + "\n" + lend + ": " + "\n"; symbolTable.push_hasRegName(reg1); break; // case "and": // expr += "je "+ lend + "\n" // + "pop" + "\n" + "ldc 0" + "\n" // + lend + ": " + "\n"; break; // case "or": // // <(9) Fill here> // expr += "ifeq" + lend + "\n" // + "pop" + "\n" + "ldc 1" + "\n" // + lend + ": " + "\n"; break; } return expr; } private String handleFunCall(MiniCParser.ExprContext ctx, String expr) { String fname = getFunName(ctx); expr = newTexts.get(ctx.args()) + " call " + symbolTable.getFunSpecStr(fname) + "\n"; return expr; } // args : expr (',' expr)* | ; @Override public void exitArgs(MiniCParser.ArgsContext ctx) { String argsStr = ""; for (int i=0; i < ctx.expr().size() ; i++) { argsStr += newTexts.get(ctx.expr(i)) ; } newTexts.put(ctx, argsStr); } }
6e3a44760b131188441f74453e8df6af7922458d
70b52156c30ca560a6f23dcabb3fe70ed2adc1b0
/src/main/java/br/ufsc/bridge/res/dab/medicoesobservacoes/ResABMedicoesObservacoes.java
c97782b8965ee9075c58e24efc25453583c0edb1
[ "MIT" ]
permissive
gpfurlaneto/res-api
de757813c42544792bd09f631d41303f89595ff5
04be57b1934b9edafbfb16b1239fb1c05cfcdf58
refs/heads/master
2020-12-24T12:05:35.817766
2016-10-28T20:02:05
2016-10-28T20:02:05
73,075,630
0
0
null
2016-11-07T12:20:34
2016-11-07T12:20:34
null
UTF-8
Java
false
false
729
java
package br.ufsc.bridge.res.dab.medicoesobservacoes; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import lombok.Getter; import lombok.Setter; import br.ufsc.bridge.res.dab.medicoesobservacoes.crianca.ResABCrianca; import br.ufsc.bridge.res.dab.medicoesobservacoes.gestante.ResABGestante; @Getter @Setter @XmlAccessorType(XmlAccessType.FIELD) public class ResABMedicoesObservacoes { @XmlElement(name = "Avaliação_antropométrica") private ResABAvaliacaoAntropometrica avaliacaoAntropometrica; @XmlElement(name = "Gestante") private ResABGestante gestante; @XmlElement(name = "Crianca") private ResABCrianca crianca; }
ed3030742d92f65dd5b8e6a73d7c9da15c76a0b5
2ce21de88ad55a3a9efbf0da8d55388e034c9df7
/HiiChat/app/src/main/java/com/example/hiichat/UI/VideoChatActivity.java
d377ef128be4d74ac2d4a5b2d22dabc5c0165356
[]
no_license
Chienpt35/HiiChat
60c851c534c4ee63d11c939d24cae2e41f3d5ad6
6da2f7324e1cfcf358b423b741eefb732e4db33f
refs/heads/master
2022-12-19T03:22:09.220414
2020-09-22T09:33:38
2020-09-22T09:33:38
256,989,823
3
0
null
null
null
null
UTF-8
Java
false
false
9,623
java
package com.example.hiichat.UI; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.Manifest; import android.content.Intent; import android.opengl.GLSurfaceView; import android.os.Bundle; import android.util.Log; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.Toast; import com.example.hiichat.Data.StaticConfig; import com.example.hiichat.MainActivity; import com.example.hiichat.R; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import com.opentok.android.BaseVideoRenderer; import com.opentok.android.OpentokError; import com.opentok.android.Publisher; import com.opentok.android.PublisherKit; import com.opentok.android.Session; import com.opentok.android.Stream; import com.opentok.android.Subscriber; import com.opentok.android.SubscriberKit; import pub.devrel.easypermissions.AfterPermissionGranted; import pub.devrel.easypermissions.EasyPermissions; public class VideoChatActivity extends AppCompatActivity implements Session.SessionListener, PublisherKit.PublisherListener, SubscriberKit.SubscriberListener{ private FrameLayout subscriberContainer; private FrameLayout publisherContainer; private ImageView imgCancelCall; private static String API_KEY = "46928634"; private static String SESSION_ID = "1_MX40NjkyODYzNH5-MTYwMDczNjk0Nzk3OH5NR0Z4U043cHd4OFJKc3QxVE1Bajhyd0x-fg"; private static String TOKEN = "T1==cGFydG5lcl9pZD00NjkyODYzNCZzaWc9YWMxN2M2MWQ2NjMyNTcyZmViMzUxMWZhOTJkN2U5NGVhM2MxZWZkNzpzZXNzaW9uX2lkPTFfTVg0ME5qa3lPRFl6Tkg1LU1UWXdNRGN6TmprME56azNPSDVOUjBaNFUwNDNjSGQ0T0ZKS2MzUXhWRTFCYWpoeWQweC1mZyZjcmVhdGVfdGltZT0xNjAwNzM2OTYwJm5vbmNlPTAuNDU3MzgwNDkzNjgwNDU0MiZyb2xlPXB1Ymxpc2hlciZleHBpcmVfdGltZT0xNjAzMzI4OTU4JmluaXRpYWxfbGF5b3V0X2NsYXNzX2xpc3Q9"; private static final String LOG_TAG = VideoChatActivity.class.getSimpleName(); private static final int RC_VIDEO_APP_PERM = 123; private DatabaseReference usersRef; private Session mSession; private Publisher mPublisher; private Subscriber mSubscriber; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_video_chat); usersRef = FirebaseDatabase.getInstance().getReference().child("user"); subscriberContainer = (FrameLayout) findViewById(R.id.subscriber_container); publisherContainer = (FrameLayout) findViewById(R.id.publisher_container); imgCancelCall = (ImageView) findViewById(R.id.img_cancelCall); imgCancelCall.setOnClickListener(v -> { cancelCallVideo(); }); requestPermissions(); } @Override protected void onPause() { Log.d(LOG_TAG, "onPause"); super.onPause(); if (mSession != null) { mSession.onPause(); } } @Override protected void onResume() { Log.d(LOG_TAG, "onResume"); super.onResume(); if (mSession != null) { mSession.onResume(); } } private void cancelCallVideo() { usersRef.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { if (dataSnapshot.child(StaticConfig.UID).hasChild("Ringing")){ usersRef.child(StaticConfig.UID).child("Ringing").removeValue(); if (mSession != null){ mSession.disconnect(); } startActivity(new Intent(VideoChatActivity.this, MainActivity.class)); finish(); } if (dataSnapshot.child(StaticConfig.UID).hasChild("Calling")){ usersRef.child(StaticConfig.UID).child("Calling").removeValue(); if (mSession != null){ mSession.disconnect(); } startActivity(new Intent(VideoChatActivity.this, MainActivity.class)); finish(); }else { if (mSession != null){ mSession.disconnect(); } startActivity(new Intent(VideoChatActivity.this, MainActivity.class)); finish(); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this); } @AfterPermissionGranted(RC_VIDEO_APP_PERM) private void requestPermissions(){ String[] perms = {Manifest.permission.CAMERA, Manifest.permission.INTERNET, Manifest.permission.RECORD_AUDIO}; if (EasyPermissions.hasPermissions(this, perms)) { mSession = new Session.Builder(this, API_KEY, SESSION_ID).build(); mSession.setSessionListener(VideoChatActivity.this); mSession.connect(TOKEN); } else { // Do not have permissions, request them now EasyPermissions.requestPermissions(this,"Vui lòng cho phép truy cập Micro và Camera", RC_VIDEO_APP_PERM, perms); } } @Override public void onConnected(Session session) { Log.d(LOG_TAG, "onConnected: Connected to session: "+session.getSessionId()); // initialize Publisher and set this object to listen to Publisher events mPublisher = new Publisher.Builder(this).build(); mPublisher.setPublisherListener(this); // set publisher video style to fill view mPublisher.getRenderer().setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL); publisherContainer.addView(mPublisher.getView()); if (mPublisher.getView() instanceof GLSurfaceView) { ((GLSurfaceView) mPublisher.getView()).setZOrderOnTop(true); } mSession.publish(mPublisher); } @Override public void onDisconnected(Session session) { Log.d(LOG_TAG, "onDisconnected: Disconnected from session: "+session.getSessionId()); } @Override public void onStreamReceived(Session session, Stream stream) { Log.d(LOG_TAG, "onStreamReceived: New Stream Received "+stream.getStreamId() + " in session: "+session.getSessionId()); if (mSubscriber == null) { mSubscriber = new Subscriber.Builder(this, stream).build(); mSubscriber.getRenderer().setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL); mSubscriber.setSubscriberListener(this); mSession.subscribe(mSubscriber); subscriberContainer.addView(mSubscriber.getView()); } } @Override public void onStreamDropped(Session session, Stream stream) { Log.d(LOG_TAG, "onStreamDropped: Stream Dropped: "+stream.getStreamId() +" in session: "+session.getSessionId()); if (mSubscriber != null) { mSubscriber = null; subscriberContainer.removeAllViews(); } } @Override public void onError(Session session, OpentokError opentokError) { Log.e(LOG_TAG, "onError: "+ opentokError.getErrorDomain() + " : " + opentokError.getErrorCode() + " - "+opentokError.getMessage() + " in session: "+ session.getSessionId()); showOpenTokError(opentokError); } @Override public void onStreamCreated(PublisherKit publisherKit, Stream stream) { Log.d(LOG_TAG, "onStreamCreated: Publisher Stream Created. Own stream "+stream.getStreamId()); } @Override public void onStreamDestroyed(PublisherKit publisherKit, Stream stream) { Log.d(LOG_TAG, "onStreamDestroyed: Publisher Stream Destroyed. Own stream "+stream.getStreamId()); } @Override public void onError(PublisherKit publisherKit, OpentokError opentokError) { Log.e(LOG_TAG, "onError: "+opentokError.getErrorDomain() + " : " + opentokError.getErrorCode() + " - "+opentokError.getMessage()); showOpenTokError(opentokError); } @Override public void onConnected(SubscriberKit subscriberKit) { Log.d(LOG_TAG, "onConnected: Subscriber connected. Stream: "+subscriberKit.getStream().getStreamId()); } @Override public void onDisconnected(SubscriberKit subscriberKit) { Log.d(LOG_TAG, "onDisconnected: Subscriber disconnected. Stream: "+subscriberKit.getStream().getStreamId()); } @Override public void onError(SubscriberKit subscriberKit, OpentokError opentokError) { Log.e(LOG_TAG, "onError: "+opentokError.getErrorDomain() + " : " + opentokError.getErrorCode() + " - "+opentokError.getMessage()); showOpenTokError(opentokError); } private void showOpenTokError(OpentokError opentokError) { Toast.makeText(this, opentokError.getErrorDomain().name() +": " +opentokError.getMessage() + " Please, see the logcat.", Toast.LENGTH_LONG).show(); finish(); } }
e2bc8a00ae1c1b5d1281621c1fea3267da8a40e3
ce02d86957716559c18e69770c8cf88e09c9ffeb
/src/main/java/com/zsmart/gestionComptabilite/GestionfstApplication.java
7b1512c7bc204aec2d2b29a8912bc5fc5d3a5a57
[]
no_license
onehappypie/gestioncontabiliteFST
27ebd8ef3c1032f4c40959432ee18256e68f42c3
f228ede2bb417656ea6dfad35237693b64a59595
refs/heads/master
2022-04-24T07:43:14.043289
2020-04-26T18:02:16
2020-04-26T18:02:16
254,715,803
0
0
null
null
null
null
UTF-8
Java
false
false
343
java
package com.zsmart.gestionComptabilite; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class GestionfstApplication { public static void main(String[] args) { SpringApplication.run(GestionfstApplication.class, args); } }
e2b193993a244e7e5e553bd63a2f8eee4f9796f1
8685e6b7e2bf17a0fb1051d1d43aa3edc5cdf353
/product-service-Java-SpringBoot-Docker-Liquibase/src/test/java/com/ajith/product/repository/ProductRepositoryTest.java
8b13ae2a2c0537c972cda900674a1c056d96784d
[]
no_license
tanbinh123/SpringBoot-Docker-Liquibase-ShoppingData
aa7bb801ee1bfb5c8b2ad3f80c71e44c9a1d43d6
074207fd3c8c8504faf30e35d612c8c0df884d73
refs/heads/master
2022-11-11T10:19:40.607163
2020-06-24T08:07:08
2020-06-24T08:07:08
475,396,014
1
0
null
2022-03-29T10:43:52
2022-03-29T10:43:51
null
UTF-8
Java
false
false
1,409
java
package com.ajith.product.repository; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.util.List; import javax.annotation.Resource; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.test.context.junit4.SpringRunner; import com.ajith.product.persistence.entity.Product; import com.ajith.product.persistence.repository.ProductRepository; import com.ajith.product.persistence.specification.ProductSpecification; import com.ajith.product.persistence.specification.SearchCriteria; import com.ajith.product.persistence.specification.SearchOperation; @RunWith(SpringRunner.class) @DataJpaTest public class ProductRepositoryTest { @Resource private ProductRepository productRepository; private ProductSpecification specification; private Product product; @Before public void before() { product = new Product("phone", "red", 0, 710.0, "Karlskrona"); specification = new ProductSpecification(); specification.addCriteria(new SearchCriteria("type", "phone", SearchOperation.MATCH)); productRepository.save(product); } @Test public void whenFindAll_thenReturnProducts() { List<Product> products = productRepository.findAll(specification); assertNotNull(products); assertTrue(products.size() >= 1); } }
204862f8b566f6c6e87ecce3a735a8a049c0bef5
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/9/9_4e1247e6ccf5246d054cc8f0ab1d0db760618a72/Preferences/9_4e1247e6ccf5246d054cc8f0ab1d0db760618a72_Preferences_t.java
9ec6f75f08d61fe733ee1365427f9377225bcc53
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
8,987
java
package mollusc.linguasubtitle; import mollusc.linguasubtitle.subtitle.utility.CommonUtility; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.Map; /** * @author mollusc <[email protected]> * Dialog Preferences */ public class Preferences extends JDialog { //<editor-fold desc="Form controls"> //<editor-fold desc="Private Field"> private JPanel contentPanel; private JButton OKButton; private JButton cancelButton; private JComboBox FontNamesComboBox; private JTextField mainFontSizeTextField; private JSlider transparencySlider; private JTextField translateFontSizeTextField; //</editor-fold> //<editor-fold desc="Public Field"> public JTabbedPane contentTabbedPane; public ColorSelectionButton translateWordsColorButton; public ColorSelectionButton unknownWordsColorButton; public ColorSelectionButton knownWordsColorButton; public ColorSelectionButton studiedWordsColorButton; public ColorSelectionButton nameWordsColorButton; public ColorSelectionButton hardWordsColorButton; public JCheckBox hideDialogCheckBox; public JCheckBox automaticDurationsCheckBox; public JTextField millisecondsPerCharacterTextField; public JLabel msPerCharacterLabel; public JCheckBox exportUnknownWordsCheckBox; public JCheckBox exportStudyWordsCheckBox; public JCheckBox exportKnownWordsCheckBox; public JCheckBox noBlankTranslationCheckBox; public JTextField exportMoreThanTextField; public JComboBox<String> exportLanguageComboBox; //</editor-fold> //</editor-fold> //<editor-fold desc="Private Field"> /** * Settings of the program */ private final Settings settings; /** * Map with available languages */ private final Map<String, String> languages; //</editor-fold> //<editor-fold desc="Constructor"> /** * Constructor of the class Preferences * * @param settings settings of the program * @param languages available languages */ public Preferences(JFrame parent,Settings settings, Map<String, String> languages) { super(parent); setContentPane(contentPanel); setModal(true); getRootPane().setDefaultButton(OKButton); this.settings = settings; this.languages = languages; initializeLanguagesComboBox(); initializeExportToSubtitle(); initializeExportFromDatabase(); changeEnableMillisecondsPerCharacter(); initializeFontLis(); initializeASSSettings(); this.setTitle("Preferences"); this.setSize(600, 400); this.setResizable(false); super.setLocationRelativeTo(parent); OKButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onOK(); } }); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }); // call onCancel() when cross is clicked setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { onCancel(); } }); // call onCancel() on ESCAPE contentPanel.registerKeyboardAction(new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); } //</editor-fold> //<editor-fold desc="Private Methods"> //<editor-fold desc="Initialization parameters"> private void initializeFontLis() { GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment(); Font[] fonts = e.getAllFonts(); for (Font f : fonts) { FontNamesComboBox.addItem(f.getFontName()); } } private void initializeASSSettings() { FontNamesComboBox.setSelectedItem(settings.getFontName()); mainFontSizeTextField.setText(settings.getMainFontSize().toString()); translateFontSizeTextField.setText(settings.getTranslateFontSize().toString()); long value = Long.parseLong(settings.getTransparencyKnownWords(), 16); transparencySlider.setValue((int) (100 * value / 255)); } private void initializeLanguagesComboBox() { for (String language : languages.keySet()) exportLanguageComboBox.addItem(language); } private void initializeExportFromDatabase() { exportUnknownWordsCheckBox.setSelected(settings.getExportUnknownWords()); exportStudyWordsCheckBox.setSelected(settings.getExportStudyWords()); exportKnownWordsCheckBox.setSelected(settings.getExportKnownWords()); noBlankTranslationCheckBox.setSelected(settings.getNoBlankTranslation()); exportMoreThanTextField.setText(settings.getExportMoreThan().toString()); if (languages.containsValue(settings.getExportLanguage())){ for (String key : languages.keySet()) { String value = languages.get(key); if (value.equals(settings.getLanguage())) exportLanguageComboBox.setSelectedItem(key); } } } private void initializeExportToSubtitle() { knownWordsColorButton.setColor(Color.decode("#" + settings.getColorKnownWords())); unknownWordsColorButton.setColor(Color.decode("#" + settings.getColorUnknownWords())); translateWordsColorButton.setColor(Color.decode("#" + settings.getColorTranslateWords())); hardWordsColorButton.setColor(Color.decode("#" + settings.getColorHardWord())); nameWordsColorButton.setColor(Color.decode("#" + settings.getColorNameWords())); studiedWordsColorButton.setColor(Color.decode("#" + settings.getColorStudiedWords())); millisecondsPerCharacterTextField.setText(settings.getMillisecondsPerCharacter().toString()); automaticDurationsCheckBox.setSelected(settings.getAutomaticDurations()); hideDialogCheckBox.setSelected(settings.getHideKnownDialog()); automaticDurationsCheckBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { changeEnableMillisecondsPerCharacter(); } }); } //</editor-fold> //<editor-fold desc="Handle for event"> /** * Handle clicks on OK button. */ private void onOK() { if (!CommonUtility.tryParseInt(exportMoreThanTextField.getText()) || !CommonUtility.tryParseInt(millisecondsPerCharacterTextField.getText())) { JOptionPane.showMessageDialog(this, "Wrong value of parameter.", "Error", JOptionPane.ERROR_MESSAGE); return; } updateSettings(); dispose(); } /** * Handle clicks on Cancel button. */ private void onCancel() { dispose(); } //</editor-fold> private void changeEnableMillisecondsPerCharacter() { if (automaticDurationsCheckBox.isSelected()) { millisecondsPerCharacterTextField.setEnabled(true); msPerCharacterLabel.setEnabled(true); } else { millisecondsPerCharacterTextField.setEnabled(false); msPerCharacterLabel.setEnabled(false); } } //</editor-fold> //<editor-fold desc="Public Methods"> /** * Update settings */ public void updateSettings() { settings.setColorTranslateWords(CommonUtility.toHexString(translateWordsColorButton.getColor())); settings.setColorUnknownWords(CommonUtility.toHexString(unknownWordsColorButton.getColor())); settings.setColorStudiedWords(CommonUtility.toHexString(studiedWordsColorButton.getColor())); settings.setColorKnownWords(CommonUtility.toHexString(knownWordsColorButton.getColor())); settings.setColorNameWords(CommonUtility.toHexString(nameWordsColorButton.getColor())); settings.setColorHardWord(CommonUtility.toHexString(hardWordsColorButton.getColor())); settings.setTransparencyKnownWords(Integer.toHexString(transparencySlider.getValue() * 255 / 100)); settings.setNoBlankTranslation(noBlankTranslationCheckBox.isSelected()); settings.setAutomaticDurations(automaticDurationsCheckBox.isSelected()); settings.setExportUnknownWords(exportUnknownWordsCheckBox.isSelected()); settings.setExportStudyWords(exportStudyWordsCheckBox.isSelected()); settings.setExportKnownWords(exportKnownWordsCheckBox.isSelected()); settings.setHideKnownDialog(hideDialogCheckBox.isSelected()); settings.setMillisecondsPerCharacter(millisecondsPerCharacterTextField.getText()); settings.setMainFontSize(mainFontSizeTextField.getText()); settings.setTranslateFontSize(translateFontSizeTextField.getText()); settings.setFontName(FontNamesComboBox.getSelectedItem().toString()); settings.setExportMoreThan(exportMoreThanTextField.getText()); settings.setExportLanguage(languages.get(exportLanguageComboBox.getSelectedItem().toString())); } /** * Activate tab by index * * @param index index of activated tab */ public void activateTab(int index) { contentTabbedPane.setSelectedIndex(index); } //</editor-fold> }
9ddac90ac8473695b1b655a1f792c436d8fef005
e54e2abdf9c02b650fde9e878a13b908a559a35f
/Test2e/src/junit_tests/TestUtilities.java
a1fc76723c466a64594375e4b43f2842f66107c6
[]
no_license
kaya-kaan/EECS1022-W21-workspace
07deca6095730af3a0035ae7265466cdbfeb7cdd
eac927f43ac4a6297ee302cb7947617e47c479b1
refs/heads/main
2023-08-18T11:06:59.533047
2021-09-09T04:32:40
2021-09-09T04:32:40
329,209,055
0
0
null
null
null
null
UTF-8
Java
false
false
3,357
java
package junit_tests; import static org.junit.Assert.*; import org.junit.Test; import model.Utilities; public class TestUtilities { /* * Tests related to Task 1 */ @Test public void test_task1_01() { int[] seq = {1, 2, 3, 4, 5}; int[] expected = {1, 2, 3, 4, 5}; assertArrayEquals(expected, Utilities.task1(seq, 0)); } @Test public void test_task1_02() { int[] seq = {1, 2, 3, 4, 5}; int[] expected = {2, 3, 4, 5, 1}; assertArrayEquals(expected, Utilities.task1(seq, 1)); } @Test public void test_task1_03() { int[] seq = {1, 2, 3, 4, 5}; int[] expected = {5, 1, 2, 3, 4}; assertArrayEquals(expected, Utilities.task1(seq, 4)); } @Test public void test_task1_04() { int[] seq = {1, 2, 3, 4, 5}; int[] expected = {4, 5, 1, 2, 3}; assertArrayEquals(expected, Utilities.task1(seq, 8)); } /* * Tests related to Task 2 */ @Test public void test_task2_01() { int[] seq = {3, 7, 4, 5}; int[] indices = {2, 1, 3}; int[] result = Utilities.task2(seq, indices); int[] expected = {4, 7, 5}; /* elements at indices 2, 1, 3 of `seq` */ assertArrayEquals(expected, result); } @Test public void test_task2_02() { int[] seq = {3, 7, 4, 5}; int[] indices = {2, -1, 0, 1, -2, 5, 3, 1, 0, 4}; /* invalid indices: -1, -2, 5, 4 */ int[] result = Utilities.task2(seq, indices); int[] expected = {4, 3, 7, 5, 7, 3}; assertArrayEquals(expected, result); } @Test public void test_task2_03() { int[] seq = {}; int[] indices = {2, -1, 0, 1, -2, 5, 3, 1, 0, 4}; int[] result = Utilities.task2(seq, indices); int[] expected = {}; assertArrayEquals(expected, result); } @Test public void test_task2_04() { int[] seq = {3, 7, 4, 5}; int[] indices = {-1, -2, 5, 4}; /* invalid indices: -1, -2, 5, 4 */ int[] result = Utilities.task2(seq, indices); int[] expected = {}; assertArrayEquals(expected, result); } /* * Tests related to Task 3 */ @Test public void test_task3_1() { int[] seq = {3, 1, 1, 3, 2, 4}; int[] expected = {3, 1, 1, 1, 2, 2, 2, 2}; assertArrayEquals(expected, Utilities.task3(seq)); } @Test public void test_task3_2() { int[] seq = {3, 0, 1, 3, 2, 4}; int[] expected = {1, 1, 1, 2, 2, 2, 2}; assertArrayEquals(expected, Utilities.task3(seq)); } @Test public void test_task3_3() { int[] seq = {3, 0, 1, 0, 2, 0}; int[] expected = {}; assertArrayEquals(expected, Utilities.task3(seq)); } /* * Tests related to Task 4 */ @Test public void test_task4_01() { int[] input = {3}; String[] result = Utilities.task4(input); String[] expected = {"[3]"}; assertArrayEquals(expected, result); } @Test public void test_task4_02() { int[] input = {3, 1}; String[] result = Utilities.task4(input); String[] expected = {"[3, 1]", "[1]"}; assertArrayEquals(expected, result); } @Test public void test_task4_03() { int[] input = {3, 1, 4}; String[] result = Utilities.task4(input); String[] expected = {"[3, 1, 4]", "[1, 4]", "[4]"}; assertArrayEquals(expected, result); } @Test public void test_task4_04() { int[] input = {3, 1, 4, 5}; String[] result = Utilities.task4(input); String[] expected = {"[3, 1, 4, 5]", "[1, 4, 5]", "[4, 5]", "[5]"}; assertArrayEquals(expected, result); } }
508eb141821c44171cd25f342ef0987e1aec082e
a82243ec9911708d12a074633ae9ebb97192d0bc
/sandbox/cpe/de.nagarro.nteg.domain.model/de.nagarro.nteg.domain.model/src-gen/org/example/domainmodel/domainmodel/ContentElement.java
fb7eddc681088ac8ae2caa5a86d0b438a92b77e1
[]
no_license
nteg/MDSD
404e6a1d324e6f24ff25c98c405cfa95554fa73c
403b5e0bd5175348a955b0418a8c0be8d8059f0a
refs/heads/master
2021-01-17T10:05:50.389173
2016-09-20T06:48:23
2016-09-20T06:48:23
30,355,905
0
2
null
null
null
null
UTF-8
Java
false
false
1,793
java
/** */ package org.example.domainmodel.domainmodel; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Content Element</b></em>'. * <!-- end-user-doc --> * * <p> * The following features are supported: * </p> * <ul> * <li>{@link org.example.domainmodel.domainmodel.ContentElement#getContentElement <em>Content Element</em>}</li> * </ul> * * @see org.example.domainmodel.domainmodel.DomainmodelPackage#getContentElement() * @model * @generated */ public interface ContentElement extends ViewElement { /** * Returns the value of the '<em><b>Content Element</b></em>' attribute. * The literals are from the enumeration {@link org.example.domainmodel.domainmodel.ContentElementLiteral}. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Content Element</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Content Element</em>' attribute. * @see org.example.domainmodel.domainmodel.ContentElementLiteral * @see #setContentElement(ContentElementLiteral) * @see org.example.domainmodel.domainmodel.DomainmodelPackage#getContentElement_ContentElement() * @model * @generated */ ContentElementLiteral getContentElement(); /** * Sets the value of the '{@link org.example.domainmodel.domainmodel.ContentElement#getContentElement <em>Content Element</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Content Element</em>' attribute. * @see org.example.domainmodel.domainmodel.ContentElementLiteral * @see #getContentElement() * @generated */ void setContentElement(ContentElementLiteral value); } // ContentElement
43a83adc84499e1e9cc432948de5bdd0b9c597c9
485c39292b1990c66e9b085ddd120d43194d166a
/pullFreshView/src/test/java/com/pull/sdk/util/ExampleUnitTest.java
eda16b02269605c22d3017cc5c4f7fd0e1385a89
[]
no_license
eastman-sz/CommonLibsProjs
964ec18ee9674f33c08fbc5171777b5207e24347
89bb5a799b7866dcd6ca222fc3f890e82caf8e0c
refs/heads/master
2021-01-25T13:18:17.620057
2019-01-15T05:57:21
2019-01-15T05:57:21
123,551,665
0
0
null
null
null
null
UTF-8
Java
false
false
395
java
package com.pull.sdk.util; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "Quiet800" ]
Quiet800
8b791913aafd030cb190c3fb4573c6f5d7aa3cbe
0af16729dab8b476d9d71073692cf92cf778ecc2
/com.wwm.proto.email.integration/src/test/java/com/wwm/proto/email/integration/DoSomethingUsingComplexRulesTest.java
99ca1e3e6e7afd7d97b961dcfad3ad7e0f087ec2
[]
no_license
whirlwind-match/whirlwind-apps
7992d03f14ddcd20b3df2417e8da322b0bda6b43
528573b41c9ce3118652f4fc792f10364c275cba
refs/heads/master
2021-05-28T11:01:19.194917
2011-03-04T13:32:37
2011-03-04T13:32:37
1,226,048
0
0
null
null
null
null
UTF-8
Java
false
false
773
java
package com.wwm.proto.email.integration; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.integration.channel.DirectChannel; import org.springframework.test.context.ContextConfiguration; @ContextConfiguration("classpath*:/spring/common/*-context.xml") public class DoSomethingUsingComplexRulesTest { // @Rule @ClassRule // public static TestRule rule = new SpringContextRule(); @Autowired @Qualifier("emailIn") private DirectChannel emailInChannel; @Ignore @Test public void channelsShouldBeAutowired() { Assert.assertNotNull(emailInChannel); } }
92bbbc2f00f82b34e5ce168401654c3a6e10b39a
3c44a71f3513360bf3e2b4a1963366e37bcbacb8
/src/main/java/com/travel/rest/RestException.java
f053e60f0573c37021a66002a7c1a4fde53c4345
[]
no_license
pengqiuyuan/travelDemo
de9821079efe300d484e1d889e6edb14214cd5d2
df5ec641d0d811f44b441d02ef76943e2e37d22a
refs/heads/master
2021-05-08T01:52:35.509837
2017-10-23T04:32:25
2017-10-23T04:32:25
107,932,156
0
0
null
null
null
null
UTF-8
Java
false
false
786
java
/******************************************************************************* * Copyright (c) 2005, 2014 springside.github.io * * Licensed under the Apache License, Version 2.0 (the "License"); *******************************************************************************/ package com.travel.rest; import org.springframework.http.HttpStatus; /** * 专用于Restful Service的异常. */ public class RestException extends RuntimeException { public HttpStatus status = HttpStatus.INTERNAL_SERVER_ERROR; public RestException() { } public RestException(HttpStatus status) { this.status = status; } public RestException(String message) { super(message); } public RestException(HttpStatus status, String message) { super(message); this.status = status; } }
bfbd29162a64f7a1dcc60e6b46247b45a7663674
f6e8b5549ec12ea697ecf5541f67ba4e23ef6a41
/src/problem_22.java
4069842b840e50f19888a15b85922f9ad7da0cb4
[]
no_license
XKange/jianzhioffer
7823ee096cf5d23592767445927e67633dbe0c9c
fa5366224885cf66a9c89e2ea532ff5f925db8e1
refs/heads/master
2021-09-04T17:39:05.856795
2018-01-20T15:52:08
2018-01-20T15:52:08
103,528,476
0
0
null
2017-10-17T02:27:15
2017-09-14T12:18:45
null
UTF-8
Java
false
false
929
java
import java.util.ArrayList; import java.util.LinkedList; import java.util.Queue; /** * Coded by kangkang on 2017/12/19 * Description: 从上往下打印出二叉树的每个节点,同层节点从左至右打印。 */ public class problem_22 { public ArrayList<Integer> PrintFromTopToBottom(TreeNode root) { ArrayList<Integer> result = new ArrayList(); // java只有Query接口,不像Stack可以直接使用的类,可以用LinkedList来实现队列 Queue<TreeNode> queue = new LinkedList(); // 相当于put方法 queue.offer(root); while (queue.peek() != null) { // 相当于get方法 TreeNode temp = queue.poll(); result.add(temp.val); if (temp.left != null) queue.offer(temp.left); if (temp.right != null) queue.offer(temp.right); } return result; } }
2f109309c020c876f998e7f223c60b75798b1fdb
a747bfcde628abbb4821254759c0491dae6a94ab
/src/tables/Pays.java
fc961229abe75b0e92655ccdcef6bfe27d4a4c60
[]
no_license
LeaVigli/CPOA-VIP
951ad43860da2d1a2196f5f6c15e09486a1b1b48
5e69956f0f261401991b0fa78544f739fe522694
refs/heads/master
2021-04-15T05:05:04.096992
2017-06-16T15:40:04
2017-06-16T15:40:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
248
java
package tables; /** * * @author Alice */ public class Pays { private String pays; public Pays() { } public Pays(String pays) { this.pays = pays; } public String getPays() { return pays; } }
bb6fb0c189e7653ca7cd427122e16f0367729877
09dddd5881e2a74aa791da304eb3485bd9978e36
/CuentaProyecto/src/cuentaproyecto/TestCase/CuentaTest.java
e24da8bb62949ae9ef00b3cb5464caa12cd18c40
[]
no_license
leonelguccione/Ejemplos-Test-de-Unidad-y-aserciones
89b327aff4548e423a349f1cce84e6230774f8d6
3414ce5b1f376a200ce41c57116f9c3539d73b2d
refs/heads/master
2021-06-07T01:48:31.823240
2016-09-13T22:02:25
2016-09-13T22:02:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
624
java
package cuentaproyecto.TestCase; import cuentaproyecto.Cuenta; import cuentaproyecto.Persona; import junit.framework.TestCase; public class CuentaTest extends TestCase { private Cuenta cuenta; @Override protected void setUp() { Persona cliente = new Persona("Juan González", "33435332"); cuenta = new Cuenta(cliente, 100.00); } public void testIngreso() { cuenta.ingreso(100.00); assertEquals(200.00, cuenta.getSaldo()); } public void testIngreso2() { cuenta.ingreso(150.00); assertEquals(200.00, cuenta.getSaldo()); } }
[ "leonel@leonel-QAL50" ]
leonel@leonel-QAL50