blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
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
684M
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
132 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
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
3dd0ae84fb13e8a6b26a516eb4211051c9056d0a
739767e8d8037542de9b230f9bf68e3cc16002fe
/tinybus/src/androidTest/java/de/halfbit/tinybus/impl/TaskQueueTest.java
5a1db2752913313f759cea9af724dbd2e2515aaa
[ "Apache-2.0" ]
permissive
MaTriXy/tinybus
f054f930f95fbedc6adb8bd5d967b3a75e3e0fd3
7c7bc406262a4df32e66772a4d878a88fba240db
refs/heads/master
2021-01-15T13:44:08.213980
2018-03-05T08:10:36
2018-03-05T08:10:36
26,725,659
0
0
Apache-2.0
2018-03-05T08:10:37
2014-11-16T19:45:02
Java
UTF-8
Java
false
false
2,662
java
package de.halfbit.tinybus.impl; import junit.framework.TestCase; import de.halfbit.tinybus.impl.Task; import de.halfbit.tinybus.impl.TaskQueue; public class TaskQueueTest extends TestCase { private TaskQueue mTaskQueue; @Override protected void setUp() throws Exception { super.setUp(); mTaskQueue = new TaskQueue(); } @Override protected void tearDown() throws Exception { mTaskQueue = null; super.tearDown(); } public void testEmptyInitiallyState() { assertNull(mTaskQueue.poll()); } public void testOfferPoll() { mTaskQueue.offer(Task.obtainTask(null, 1, null)); mTaskQueue.offer(Task.obtainTask(null, 2, null)); mTaskQueue.offer(Task.obtainTask(null, 3, null)); assertEquals(1, mTaskQueue.poll().code); assertEquals(2, mTaskQueue.poll().code); assertEquals(3, mTaskQueue.poll().code); assertNull(mTaskQueue.poll()); mTaskQueue.offer(Task.obtainTask(null, 4, null)); assertEquals(4, mTaskQueue.poll().code); assertNull(mTaskQueue.poll()); } public void testUnpollMultipleTimes() { mTaskQueue.offer(Task.obtainTask(null, 1, null)); mTaskQueue.offer(Task.obtainTask(null, 2, null)); Task task = mTaskQueue.poll(); assertNotNull(task); assertEquals(1, task.code); mTaskQueue.unpoll(task); mTaskQueue.poll(); assertNotNull(task); assertEquals(1, task.code); mTaskQueue.unpoll(task); mTaskQueue.poll(); assertNotNull(task); assertEquals(1, task.code); assertEquals(2, mTaskQueue.poll().code); assertNull(mTaskQueue.poll()); } public void testUnpollLast() { mTaskQueue.offer(Task.obtainTask(null, 1, null)); Task task = mTaskQueue.poll(); assertNotNull(task); assertEquals(1, task.code); assertNull(mTaskQueue.poll()); mTaskQueue.unpoll(task); assertEquals(1, mTaskQueue.poll().code); assertNull(mTaskQueue.poll()); } public void testUnpollNotLast() { mTaskQueue.offer(Task.obtainTask(null, 1, null)); mTaskQueue.offer(Task.obtainTask(null, 2, null)); mTaskQueue.offer(Task.obtainTask(null, 3, null)); Task task = mTaskQueue.poll(); assertNotNull(task); assertEquals(1, task.code); mTaskQueue.unpoll(task); task = mTaskQueue.poll(); assertNotNull(task); assertEquals(1, task.code); assertEquals(2, mTaskQueue.poll().code); assertEquals(3, mTaskQueue.poll().code); assertNull(mTaskQueue.poll()); } public void testIsEmpty() { assertTrue(mTaskQueue.isEmpty()); mTaskQueue.offer(Task.obtainTask(null, 1, null)); assertFalse(mTaskQueue.isEmpty()); Task task = mTaskQueue.poll(); assertTrue(mTaskQueue.isEmpty()); mTaskQueue.unpoll(task); assertFalse(mTaskQueue.isEmpty()); } }
[ "beworker@gmail.com" ]
beworker@gmail.com
515a3e502126a8fd595d9cf96a8200d23da1d647
0117fa13fe29aa60457ec4d5b4cce8c74952870a
/mobifoneTN/src/main/java/com/toan_itc/tn/Utils/StartSnapHelper.java
ea7a3f1086b7841036c8c2e87762aa1585c50917
[ "MIT" ]
permissive
ToanMobile/MobifoneVersion1
31486699725248d6b580b3f1b0118557984dcaf5
387b05d99cc0b8b55552b3be32eb8e713d75e6a8
refs/heads/master
2021-08-23T01:37:35.504801
2017-12-02T06:24:08
2017-12-02T06:24:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,053
java
package com.toan_itc.tn.Utils; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearSnapHelper; import android.support.v7.widget.OrientationHelper; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.View; /** * Created by Toan.IT on 15/01/17. * Email: huynhvantoan.itc@gmail.com */ public class StartSnapHelper extends LinearSnapHelper { private OrientationHelper mVerticalHelper, mHorizontalHelper; public StartSnapHelper() { } @Override public void attachToRecyclerView(@Nullable RecyclerView recyclerView) throws IllegalStateException { super.attachToRecyclerView(recyclerView); } @Override public int[] calculateDistanceToFinalSnap(@NonNull RecyclerView.LayoutManager layoutManager, @NonNull View targetView) { int[] out = new int[2]; if (layoutManager.canScrollHorizontally()) { out[0] = distanceToStart(targetView, getHorizontalHelper(layoutManager)); } else { out[0] = 0; } if (layoutManager.canScrollVertically()) { out[1] = distanceToStart(targetView, getVerticalHelper(layoutManager)); } else { out[1] = 0; } return out; } @Override public View findSnapView(RecyclerView.LayoutManager layoutManager) { if (layoutManager instanceof LinearLayoutManager) { if (layoutManager.canScrollHorizontally()) { return getStartView(layoutManager, getHorizontalHelper(layoutManager)); } else { return getStartView(layoutManager, getVerticalHelper(layoutManager)); } } return super.findSnapView(layoutManager); } private int distanceToStart(View targetView, OrientationHelper helper) { Log.wtf("distanceToStart=",(helper.getDecoratedStart(targetView) - helper.getStartAfterPadding())+""); return helper.getDecoratedStart(targetView) - helper.getStartAfterPadding(); } private View getStartView(RecyclerView.LayoutManager layoutManager, OrientationHelper helper) { if (layoutManager instanceof LinearLayoutManager) { int firstChild = ((LinearLayoutManager) layoutManager).findFirstVisibleItemPosition(); boolean isLastItem = ((LinearLayoutManager) layoutManager) .findLastCompletelyVisibleItemPosition() == layoutManager.getItemCount() - 1; if (firstChild == RecyclerView.NO_POSITION || isLastItem) { return null; } View child = layoutManager.findViewByPosition(firstChild); if (helper.getDecoratedEnd(child) >= helper.getDecoratedMeasurement(child) / 2 && helper.getDecoratedEnd(child) > 0) { return child; } else { if (((LinearLayoutManager) layoutManager).findLastCompletelyVisibleItemPosition() == layoutManager.getItemCount() - 1) { return null; } else { Log.wtf("firstChild=",(firstChild + 1)+""); return layoutManager.findViewByPosition(600); } } } return super.findSnapView(layoutManager); } private OrientationHelper getVerticalHelper(RecyclerView.LayoutManager layoutManager) { if (mVerticalHelper == null) { mVerticalHelper = OrientationHelper.createVerticalHelper(layoutManager); } return mVerticalHelper; } private OrientationHelper getHorizontalHelper(RecyclerView.LayoutManager layoutManager) { if (mHorizontalHelper == null) { mHorizontalHelper = OrientationHelper.createHorizontalHelper(layoutManager); } return mHorizontalHelper; } }
[ "huynhvantoan.itc@gmail.com" ]
huynhvantoan.itc@gmail.com
ee93515b3718f6cf3076633529f4e9847042cc9f
4734682c0ee9d9bc8a7278b245b89619d8a72177
/bundles/core/src/main/java/io/wcm/samples/core/config/impl/LinkHandlerConfigImpl.java
dbac0fb52ab1d1de9c95c8580a591990e2ac392a
[ "Apache-2.0" ]
permissive
dfparker2002/wcm-io-samples
e87d2f16c0a88df187767616103e485af0c54c42
851ed1ad03e7a7aec48a5a18e42ea212ae5cc1d9
refs/heads/master
2020-04-06T22:22:32.005465
2018-08-27T12:45:49
2018-08-27T12:45:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,300
java
/* * #%L * wcm.io * %% * Copyright (C) 2014 wcm.io * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ package io.wcm.samples.core.config.impl; import org.osgi.service.component.annotations.Component; import com.day.cq.wcm.api.Page; import io.wcm.handler.link.spi.LinkHandlerConfig; import io.wcm.samples.core.config.AppTemplate; import io.wcm.wcm.commons.util.Template; /** * Link handler configuration. */ @Component(service = LinkHandlerConfig.class) public class LinkHandlerConfigImpl extends LinkHandlerConfig { @Override public boolean isValidLinkTarget(Page page) { return !Template.is(page, AppTemplate.ADMIN_STRUCTURE_ELEMENT); } @Override public boolean isRedirect(Page page) { return Template.is(page, AppTemplate.ADMIN_REDIRECT); } }
[ "sseifert@pro-vision.de" ]
sseifert@pro-vision.de
5bdc89fe0720b3e743f3a9fb5feb8bb0fcb7262c
c850a00107b50aed7b3411100913689c1dc77420
/app/src/main/java/com/yq/customview/ViewPageAdapter.java
a2a6268663b9474cadad5e9237ebd13af559baa7
[]
no_license
yangqi1024/CustomView
63d6a97b4fe23298f2db7ee20277e0a1ff0a0b4b
ea733b55fdf6a2bed9c2c55119304dab515bc99f
refs/heads/master
2021-08-27T19:57:42.028789
2017-11-28T06:18:15
2017-11-28T06:18:15
109,778,559
0
0
null
null
null
null
UTF-8
Java
false
false
709
java
package com.yq.customview; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import java.util.ArrayList; /** * Description ... * * @author gsz * @create 2017/11/7 * @since V1.0.1 */ public class ViewPageAdapter extends FragmentPagerAdapter { private ArrayList<Fragment> mPage; public ViewPageAdapter(FragmentManager fm,ArrayList<Fragment> page) { super(fm); this.mPage = page; } @Override public int getCount() { return mPage != null ? mPage.size() : 0; } @Override public Fragment getItem(int position) { return mPage.get(position); } }
[ "yangq@dtdream.com" ]
yangq@dtdream.com
4e7beb43eb3b6b27095abb8b3c4118696324769a
923efedd7efa7ac1551e7111635dc6a3852bb6ce
/sigpro/src/pojo/PrestamoTipo.java
8145a360216ba3f1cbd6a12e9bc38642ee374bf0
[]
no_license
tikochato/sigpro
96e37730cb547ab1da9537c230447af53eb4103b
3fe033d236edeaf8c112693f6292a21a1583f812
refs/heads/master
2021-01-19T03:38:36.216758
2017-12-20T22:27:21
2017-12-20T22:27:21
87,324,684
1
0
null
2017-12-20T22:34:50
2017-04-05T15:16:38
Java
UTF-8
Java
false
false
3,898
java
package pojo; // Generated Dec 13, 2017 9:28:15 AM by Hibernate Tools 5.2.3.Final import java.util.Date; import java.util.HashSet; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import static javax.persistence.GenerationType.IDENTITY; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; /** * PrestamoTipo generated by hbm2java */ @Entity @Table(name = "prestamo_tipo", catalog = "sipro") public class PrestamoTipo implements java.io.Serializable { /** * */ private static final long serialVersionUID = 3994299610713730990L; private Integer id; private String nombre; private String descripcion; private String usuarioCreo; private String usuarioActualizo; private Date fechaCreacion; private Date fechaActualizacion; private int estado; private Set<PrestamoTipoPrestamo> prestamoTipoPrestamos = new HashSet<PrestamoTipoPrestamo>(0); public PrestamoTipo() { } public PrestamoTipo(String nombre, String usuarioCreo, Date fechaCreacion, int estado) { this.nombre = nombre; this.usuarioCreo = usuarioCreo; this.fechaCreacion = fechaCreacion; this.estado = estado; } public PrestamoTipo(String nombre, String descripcion, String usuarioCreo, String usuarioActualizo, Date fechaCreacion, Date fechaActualizacion, int estado, Set<PrestamoTipoPrestamo> prestamoTipoPrestamos) { this.nombre = nombre; this.descripcion = descripcion; this.usuarioCreo = usuarioCreo; this.usuarioActualizo = usuarioActualizo; this.fechaCreacion = fechaCreacion; this.fechaActualizacion = fechaActualizacion; this.estado = estado; this.prestamoTipoPrestamos = prestamoTipoPrestamos; } @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "id", unique = true, nullable = false) public Integer getId() { return this.id; } public void setId(Integer id) { this.id = id; } @Column(name = "nombre", nullable = false, length = 1000) public String getNombre() { return this.nombre; } public void setNombre(String nombre) { this.nombre = nombre; } @Column(name = "descripcion", length = 2000) public String getDescripcion() { return this.descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } @Column(name = "usuario_creo", nullable = false, length = 30) public String getUsuarioCreo() { return this.usuarioCreo; } public void setUsuarioCreo(String usuarioCreo) { this.usuarioCreo = usuarioCreo; } @Column(name = "usuario_actualizo", length = 30) public String getUsuarioActualizo() { return this.usuarioActualizo; } public void setUsuarioActualizo(String usuarioActualizo) { this.usuarioActualizo = usuarioActualizo; } @Temporal(TemporalType.TIMESTAMP) @Column(name = "fecha_creacion", nullable = false, length = 19) public Date getFechaCreacion() { return this.fechaCreacion; } public void setFechaCreacion(Date fechaCreacion) { this.fechaCreacion = fechaCreacion; } @Temporal(TemporalType.TIMESTAMP) @Column(name = "fecha_actualizacion", length = 19) public Date getFechaActualizacion() { return this.fechaActualizacion; } public void setFechaActualizacion(Date fechaActualizacion) { this.fechaActualizacion = fechaActualizacion; } @Column(name = "estado", nullable = false) public int getEstado() { return this.estado; } public void setEstado(int estado) { this.estado = estado; } @OneToMany(fetch = FetchType.LAZY, mappedBy = "prestamoTipo") public Set<PrestamoTipoPrestamo> getPrestamoTipoPrestamos() { return this.prestamoTipoPrestamos; } public void setPrestamoTipoPrestamos(Set<PrestamoTipoPrestamo> prestamoTipoPrestamos) { this.prestamoTipoPrestamos = prestamoTipoPrestamos; } }
[ "ing.david.o@gmail.com" ]
ing.david.o@gmail.com
286f0c0074d257084d9fdfc3952855117c2004fd
589ab2a91c460729125894d6be0d14b68293181f
/src/main/java/com/nutrition/nutritionservice/enums/database/ModelGoalEnum.java
a4f6eccc0c28ab61234740b1cc1368a518b44725
[]
no_license
HengeLiu/gugu-record-service
fcbafe49c75141595a1addeeebff20b383e601aa
75f1990021c1005b3dac3dc9ac6f5d7e3414d389
refs/heads/master
2023-05-27T22:21:44.513091
2021-04-27T09:50:39
2021-04-27T09:50:39
329,321,885
1
1
null
null
null
null
UTF-8
Java
false
false
659
java
package com.nutrition.nutritionservice.enums.database; import com.nutrition.nutritionservice.enums.CodeEnum; /** * 模型目标枚举。 * * @author heng.liu * @since 2020/12/19 */ public enum ModelGoalEnum implements CodeEnum<Integer> { UNKNOWN(0, "未知"), BALANCE(1, "平衡"), LOSE_WEIGHT(2, "减脂"), INCREASED_MUSCLE(3, "增肌") ; private final int code; private final String desc; ModelGoalEnum(int code, String desc) { this.code = code; this.desc = desc; } public Integer getCode() { return code; } public String getDesc() { return desc; } }
[ "heng.liu@bianlifeng.com" ]
heng.liu@bianlifeng.com
85a6636dd635fb5a47c45797e42a308a16bc9744
03076ba8a49b581df0228c0f608d6e4c44599f71
/MSHClientModule/src/main/java/ui/componentcontroller/hotel/ClientHotelRoomCellController.java
ec42a552a1e9543574c671e5ad9d18b490c78e76
[]
no_license
tonywang1945yes/MSH
6bae72b346c622f1ad6a6c71a3e81b5591246cf6
f2e7213bf3e5450096fb1dc8622e2d89add5e2fa
refs/heads/master
2021-06-09T20:44:55.480312
2017-01-02T08:29:17
2017-01-02T08:29:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,802
java
package ui.componentcontroller.hotel; import component.circleimage.CircleImage; import component.rectbutton.RectButton; import javafx.fxml.FXML; import javafx.scene.control.Label; import javafx.scene.image.Image; import ui.viewcontroller.client.ClientHotelDetailViewController; import vo.OrderRoomStockVO; import vo.RoomStockVO; /** * Created by Sorumi on 16/12/2. */ public class ClientHotelRoomCellController { @FXML private CircleImage imageView; @FXML private Label typeLabel; @FXML private Label priceLabel; @FXML private Label quantityLabel; @FXML private RectButton addButton; private ClientHotelDetailViewController clientHotelDetailViewController; private OrderRoomStockVO orderRoomStock; public void setClientHotelDetailViewController(ClientHotelDetailViewController clientHotelDetailViewController) { this.clientHotelDetailViewController = clientHotelDetailViewController; } public void setRoom(OrderRoomStockVO room) { this.orderRoomStock = room; imageView.setImage(new Image(getClass().getResource("/images/room/" + room.orderRoom.type.toString() + ".png").toExternalForm())); imageView.setRadius(40); typeLabel.setText(room.orderRoom.type.getName()); priceLabel.setText("¥ " + room.orderRoom.price); quantityLabel.setText("剩余 " + room.availableQuantity + " 间"); addButton.setIsAbledProperty(room.availableQuantity > 0); } @FXML private void clickAddButton() { orderRoomStock.orderRoom.quantity++; if (orderRoomStock.orderRoom.quantity >= orderRoomStock.availableQuantity) { addButton.setIsAbledProperty(false); } clientHotelDetailViewController.addRoomInOrder(orderRoomStock); } }
[ "Sorumi33@gmail.com" ]
Sorumi33@gmail.com
bdf51cf6586e1fdb63626712e903bd6059bdce1c
62a8a0bf97147a1d294127e52eba66181f273c26
/src/main/java/com/javaTask/service/UserService.java
e179f431b0291d0e7fad8c38456391009e04e88c
[]
no_license
berezkin88/webappSpringWithJpa
96aff440deb68a7bac4faa5a327b4530e963980d
50422f088b3fbb3a15604cd2d8233903a8d750de
refs/heads/master
2022-09-27T03:20:48.973392
2019-08-01T09:43:44
2019-08-01T09:43:44
199,533,895
0
0
null
2022-09-08T01:02:20
2019-07-29T22:19:00
Java
UTF-8
Java
false
false
878
java
package com.javaTask.service; import com.javaTask.model.User; import com.javaTask.repository.UserRepository; import org.springframework.stereotype.Service; import java.util.List; /** * @author Aleksandr Beryozkin */ @Service public class UserService { private final UserRepository userRepository; public UserService(UserRepository userRepository) { this.userRepository = userRepository; } public List<User> findAll() { return userRepository.findAll(); } public User findById(Long id) { return userRepository.findById(id).get(); } public User save(User user) { return userRepository.save(user); } public void deleteById(Long id) { userRepository.deleteById(id); } public User findByUsername(String username) { return userRepository.findOneByUsername(username); } }
[ "berezkin05@gmail.com" ]
berezkin05@gmail.com
e939a86ca2754db2b11ec7721597af220553a344
e3b87b3e41a16d65852132f8970902638993a1d8
/src/task5/ex1/controller/Controller.java
3a4033442945e706937d98b9d6d8f6a44ba72257
[]
no_license
Fishgood/EpamUniver
db249cabbfec06dd8b162320a832bb8b32f0944f
a992bb7b5f44e6ff3c3a522c199d2d54d9c4c55b
refs/heads/master
2020-04-08T04:28:09.264805
2018-12-01T16:26:18
2018-12-01T16:26:18
151,726,977
0
0
null
null
null
null
UTF-8
Java
false
false
148
java
package task5.ex1.controller; public class Controller { private Menu menu = new Menu(); public void run(){ menu.menu(); } }
[ "nickandruschenko19@gmail.com" ]
nickandruschenko19@gmail.com
bbad90f5e42bd1ca7264ca8f89f5e308c2549ae9
59faf9efd5c89ed97ec60fe658ca07ad669d4d89
/src/main/java/rest/GoogleResource1.java
793fed14adc408ad00c943d543db39507cd64cc7
[]
no_license
nfmbang/CA3
417ce149b4ad0be282638e5e52668f868683785c
76f36f3e47c26ee977a4e43302f67a748449a1fd
refs/heads/master
2020-09-12T10:05:40.736764
2019-11-18T14:13:14
2019-11-18T14:13:14
222,389,576
0
0
null
2019-11-18T07:37:32
2019-11-18T07:37:31
null
UTF-8
Java
false
false
4,341
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 rest; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import errorhandling.ReeQuestException; import errorhandling.ExceptionDTO; import java.lang.annotation.ElementType; import java.net.MalformedURLException; import java.util.ArrayList; import java.util.Arrays; import utils.ReeQuest; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; /** * * @author Niels Bang */ @Path("poormansgoogle") public class GoogleResource1 { private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); //ID of the custom search engine to use private static final String CX = "003739661964971794239:gvzfdunqtk6"; private static final String CX2 = "003739661964971794239:gdyspwwocdq"; //API Key private static final String KEY = "AIzaSyBXm8bLJjCtmNHDZ17xLMzd9rhkpjauPQk"; private static final String KEY2 = "e1eaeeeb0f804cbca10c195c61881545"; private final String URL = "https://www.googleapis.com"; private final String PATH = "customsearch/v1"; private final String URL2 = "https://api-eur.cognitive.microsofttranslator.com"; private final String PATH2 = "translate"; @GET @Produces({MediaType.APPLICATION_JSON}) public String demo() { return "{\"msg\":\"Poormansgoogle API\"}"; } @Path("/{query}") @GET @Produces({MediaType.APPLICATION_JSON}) public String search(@PathParam("query") String query) throws Exception { List<String> jsons = new ArrayList(); ExecutorService executor = Executors.newWorkStealingPool(); Future<String> usedSearchFuture, ebaySearchFuture; Callable<String> usedSearch = () -> { try { ReeQuest req = new ReeQuest("hvad fuck bruger du source til martin??", URL); Map<String, String> params = new HashMap(); params.put("cx", CX); params.put("key", KEY); params.put("q", query); return req.getRequest(PATH, params, "", null, "GET"); } catch (ReeQuestException | MalformedURLException e) { return e.getMessage(); } }; Callable<String> ebaySearch = () -> { try { ReeQuest req = new ReeQuest("Jeg ved stadig ikke hvad du bruger den her til martin", URL2); String body = "[{\"Text\":\"" + query + "\"}]"; HashMap<String, String> param1 = new HashMap(); param1.put("api-version", "3.0"); param1.put("from", "da"); param1.put("to", "en"); HashMap<String, String> headers = new HashMap(); headers.put("Content-Type", "application/json;charset=UTF-8"); headers.put("Ocp-Apim-Subscription-Key", KEY2); String translations = GSON.toJson(req.getRequest(PATH2, param1, body, headers, "POST")); String split = translations.split("text")[1].split("to")[0]; String trans = split.substring(5, split.length() - 5); ReeQuest req2 = new ReeQuest("", URL); Map<String, String> param2 = new HashMap(); param2.put("cx", CX2); param2.put("key", KEY); param2.put("q", trans); return req2.getRequest(PATH, param2, "", null, "GET"); } catch (ReeQuestException | MalformedURLException e) { return e.getMessage(); } }; usedSearchFuture = executor.submit(usedSearch); ebaySearchFuture = executor.submit(ebaySearch); jsons.add(usedSearchFuture.get()); jsons.add(ebaySearchFuture.get()); //executor.shutdown(); return GSON.toJson(jsons); } }
[ "43202392+nfmbang@users.noreply.github.com" ]
43202392+nfmbang@users.noreply.github.com
c537afacdc5ec1aab315fdc807732506ed6e2e08
ded03c36ade697c4391cc13edf79ae7fc8ceb69c
/gscript/src/org/gscript/view/CheckableListItem.java
18a9c516dcb5d8f8f9663cbbed019fa0c1c291aa
[]
no_license
rogro82/gscript
4401a059a548bbe2643f31a12939114134819334
a4b97f91d41501335874139fccc0eae68f078b4c
refs/heads/master
2016-09-05T20:50:49.938721
2013-09-07T23:24:24
2013-09-07T23:24:24
12,673,165
4
3
null
null
null
null
UTF-8
Java
false
false
1,817
java
package org.gscript.view; import android.annotation.TargetApi; import android.content.Context; import android.graphics.drawable.Drawable; import android.graphics.drawable.StateListDrawable; import android.os.Build; import android.util.AttributeSet; import android.widget.LinearLayout; /* Simple Checkable LinearLayout used for backwards compatibility because the activated state * for checked items in listviews is not available on pre-HONEYCOMB (SDK-11) devices */ public class CheckableListItem extends LinearLayout implements android.widget.Checkable { boolean mChecked = false; @TargetApi(Build.VERSION_CODES.HONEYCOMB) public CheckableListItem(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CheckableListItem(Context context, AttributeSet attrs) { super(context, attrs); } public CheckableListItem(Context context) { super(context); } @Override public boolean isChecked() { return mChecked; } @Override public void setChecked(boolean checked) { mChecked = checked; updateCheckedState(); } @Override public void toggle() { mChecked = !mChecked; updateCheckedState(); } @Override protected void drawableStateChanged() { super.drawableStateChanged(); updateCheckedState(); } void updateCheckedState() { Drawable drawable = this.getBackground(); if (drawable instanceof StateListDrawable) { StateListDrawable list = (StateListDrawable) drawable; list.setState(new int[] { this.isChecked() ? android.R.attr.state_checked : 0, this.isSelected() ? android.R.attr.state_selected : 0, this.isPressed() ? android.R.attr.state_pressed : 0, this.isFocused() ? android.R.attr.state_focused : 0, this.isEnabled() ? android.R.attr.state_enabled : 0, }); } } }
[ "rogro82@gmail.com" ]
rogro82@gmail.com
f7cae41c65a5650939d6cc4baaf65ab3ab61916b
53f787ee87653ababce92841f2ab41074eaaae90
/SoundCache/gen/com/aditya/SoundCache/R.java
9a541d525a84458b5dee2d1f7d1dcf92b63b9ff9
[]
no_license
022aditya/sound-cache
771f35a79910190f5bc61b852ae5615adec00984
2646db2dec6be2c2adf4d65c60bb31a43b765cc4
refs/heads/master
2020-05-20T05:59:55.645754
2015-03-16T01:48:24
2015-03-16T01:48:24
32,294,694
0
0
null
null
null
null
UTF-8
Java
false
false
177
java
/*___Generated_by_IDEA___*/ package com.aditya.SoundCache; /* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */ public final class R { }
[ "aditya.ahuja123@gmail.com" ]
aditya.ahuja123@gmail.com
87cb809a1ddb383a29db1d57bdc193b475039a2b
574265acd15be1fae9c0741fc5f36085772c3784
/exfd/src/com/webservice/GetMobilesInfoE.java
551641bb27eb8425d90305f53f3f31b2ced49b85
[]
no_license
darknight9/exfd
d61b237d4f7599ba5a1f0786d2027c01ba33dc9b
e450befb07a4ad6927cdd196d0acaadc8124768c
refs/heads/master
2016-08-08T13:36:10.748982
2014-05-11T14:34:35
2014-05-11T14:34:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
14,886
java
/** * GetMobilesInfoE.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: 1.6.2 Built on : Apr 17, 2012 (05:34:40 IST) */ package com.webservice; /** * GetMobilesInfoE bean class */ @SuppressWarnings({"unchecked","unused"}) public class GetMobilesInfoE implements org.apache.axis2.databinding.ADBBean{ public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName( "http://webservice.com/", "getMobilesInfo", "ns2"); /** * field for GetMobilesInfo */ protected com.webservice.GetMobilesInfo localGetMobilesInfo ; /** * Auto generated getter method * @return com.webservice.GetMobilesInfo */ public com.webservice.GetMobilesInfo getGetMobilesInfo(){ return localGetMobilesInfo; } /** * Auto generated setter method * @param param GetMobilesInfo */ public void setGetMobilesInfo(com.webservice.GetMobilesInfo param){ this.localGetMobilesInfo=param; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME); return factory.createOMElement(dataSource,MY_QNAME); } public void serialize(final javax.xml.namespace.QName parentQName, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ //We can safely assume an element has only one type associated with it if (localGetMobilesInfo==null){ throw new org.apache.axis2.databinding.ADBException("getMobilesInfo cannot be null!"); } localGetMobilesInfo.serialize(MY_QNAME,xmlWriter); } private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://webservice.com/")){ return "ns2"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * Utility method to write an element start tag. */ private void writeStartElement(java.lang.String prefix, java.lang.String namespace, java.lang.String localPart, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, localPart); } else { if (namespace.length() == 0) { prefix = ""; } else if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, localPart, namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext(); while (true) { java.lang.String uri = nsContext.getNamespaceURI(prefix); if (uri == null || uri.length() == 0) { break; } prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ //We can safely assume an element has only one type associated with it return localGetMobilesInfo.getPullParser(MY_QNAME); } /** * Factory class that keeps the parse method */ public static class Factory{ /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static GetMobilesInfoE parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ GetMobilesInfoE object = new GetMobilesInfoE(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() ){ if (reader.isStartElement() && new javax.xml.namespace.QName("http://webservice.com/","getMobilesInfo").equals(reader.getName())){ object.setGetMobilesInfo(com.webservice.GetMobilesInfo.Factory.parse(reader)); } // End of if for expected property start element else{ // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName()); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class }
[ "darkngiht9@163.com" ]
darkngiht9@163.com
76aef86862a383fa02393901dce58faf77a945ea
1adfa1231f3084c9987d7867f50358451de19461
/backend/src/main/java/com/fschoen/parlorplace/backend/controller/dto/game/GameStartRequestDTO.java
f9ee25449f336aa32b40f62c7f53a263075a1275
[]
no_license
FelixSchoen/ParlorPlace
3476d9712f52fb7aadb46a57c016056e9b70a52e
0229a8ed94eaf25783a8cb42f270e588bd2228b4
refs/heads/master
2023-08-04T16:47:35.927741
2021-09-19T17:46:49
2021-09-19T17:46:49
405,108,524
1
1
null
null
null
null
UTF-8
Java
false
false
427
java
package com.fschoen.parlorplace.backend.controller.dto.game; import com.fschoen.parlorplace.backend.enumeration.GameType; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import javax.validation.constraints.NotNull; @NoArgsConstructor @AllArgsConstructor @Builder(toBuilder = true) @Data public class GameStartRequestDTO { @NotNull GameType gameType; }
[ "raffael.foidl@gmail.com" ]
raffael.foidl@gmail.com
6a4e837f87fa40184e4e38c82f7cd7dc236841b5
5cb64d1db5b97f3c83c39003171e8c806d2d03fd
/src/test/java/com/mobitel/mobitelbackend/UserTestCase.java
e275cb3179e5f0e8d42e88763c7b8f95c313bab0
[]
no_license
sumonkarmakar/mobitelbackend1
dc988cca47bf06c7cd75db04706385baee273711
b8e6a6a8e0426acbf834ab86f5958efc383b16a6
refs/heads/master
2021-01-21T17:23:20.278008
2017-06-19T03:45:18
2017-06-19T03:45:18
94,693,357
0
0
null
null
null
null
UTF-8
Java
false
false
1,044
java
package com.mobitel.mobitelbackend; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import com.mobitel.mobitelbackend.dao.UserDAO; import com.mobitel.mobitelbackend.model.User; public class UserTestCase { public static void main(String[] args) { // TODO Auto-generated method stub AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.scan("com.mobitel.mobitelbackend"); context.refresh(); // Insert a Supplier Object UserDAO userDAO = (UserDAO)context.getBean("userDAO"); // Insertion test case User user = new User(); /*supplier.setSupname("Loreal"); supplier.setAddress("France");*/ user.setUname("SUMON"); user.setPassword("sk"); user.setCustName("SUMON"); user.setRole("Admin"); user.setEnable(true); user.setEmail("sk@em.c"); user.setAddress("Howrah"); user.setMobile("1234"); userDAO.insertUpdateUser(user); System.out.println("User Inserted"); } }
[ "suman.talkto@gmail.com" ]
suman.talkto@gmail.com
01424a2d771fc9b9de7c29f500f85a766a09410c
58da62dfc6e145a3c836a6be8ee11e4b69ff1878
/src/main/java/com/alipay/api/domain/MybankMarketingCampaignPrizeListQueryModel.java
c8e1e41862ab7cc69ba8de890de75be9f8a9cc44
[ "Apache-2.0" ]
permissive
zhoujiangzi/alipay-sdk-java-all
00ef60ed9501c74d337eb582cdc9606159a49837
560d30b6817a590fd9d2c53c3cecac0dca4449b3
refs/heads/master
2022-12-26T00:27:31.553428
2020-09-07T03:39:05
2020-09-07T03:39:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,741
java
package com.alipay.api.domain; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; /** * 查询用户已拥有的奖品列表 * * @author auto create * @since 1.0, 2019-08-23 14:23:40 */ public class MybankMarketingCampaignPrizeListQueryModel extends AlipayObject { private static final long serialVersionUID = 8638292128512563775L; /** * 银行参与者id,是在网商银行创建会员后生成的id,网商银行会员的唯一标识 */ @ApiField("ip_id") private String ipId; /** * 银行参与者角色id,是在网商银行创建会员后生成的角色id,网商银行会员角色的唯一标识 */ @ApiField("ip_role_id") private String ipRoleId; /** * 分页查询时的页码,从1开始 */ @ApiField("page_num") private Long pageNum; /** * 分页查询时每页返回的列表大小,最大为20 */ @ApiField("page_size") private Long pageSize; /** * COUPON_VOUCHER 利息红包 DISCOUNT_VOUCHER 打折券 */ @ApiField("type") private String type; public String getIpId() { return this.ipId; } public void setIpId(String ipId) { this.ipId = ipId; } public String getIpRoleId() { return this.ipRoleId; } public void setIpRoleId(String ipRoleId) { this.ipRoleId = ipRoleId; } public Long getPageNum() { return this.pageNum; } public void setPageNum(Long pageNum) { this.pageNum = pageNum; } public Long getPageSize() { return this.pageSize; } public void setPageSize(Long pageSize) { this.pageSize = pageSize; } public String getType() { return this.type; } public void setType(String type) { this.type = type; } }
[ "ben.zy@antfin.com" ]
ben.zy@antfin.com
b90c0248eee52cbfa261189c26df709397838f95
7a660a2acbc848a12033606950b252c3a32e8e7d
/DATA KERJA/PROYEK BUANA MEKAR/buanaMekar/src/main/java/com/example/buanaMekar/configs/WebSecurityConfig.java
ebba06b3fa0b30ab7305957a9f0bae7a2657efed
[]
no_license
AgungDonga/buanaMekar
a340a4df7371a2f401a8059a3804617001d7e6a8
e27747a058685c527318d840d0b6459f793605f3
refs/heads/master
2022-12-20T18:09:28.845642
2020-07-28T13:17:00
2020-07-28T13:17:00
282,384,975
0
0
null
2020-07-28T13:17:01
2020-07-25T06:23:02
Java
UTF-8
Java
false
false
3,120
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 com.example.buanaMekar.configs; import com.example.buanaMekar.services.UserDetailsServiceImpl; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.Ordered; import org.springframework.security.authentication.dao.DaoAuthenticationProvider; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; /** * * @author Insane */ @Configuration @EnableWebSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter{ @Bean public UserDetailsService userDetailsService(){ return new UserDetailsServiceImpl(); } @Bean public BCryptPasswordEncoder passwordEncoder(){ return new BCryptPasswordEncoder(); } @Bean public DaoAuthenticationProvider authenticationProvider(){ DaoAuthenticationProvider authenticationProvider = new DaoAuthenticationProvider(); authenticationProvider.setUserDetailsService(userDetailsService()); authenticationProvider.setPasswordEncoder(passwordEncoder()); return authenticationProvider; } public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/login").setViewName("login"); registry.setOrder(Ordered.HIGHEST_PRECEDENCE); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.authenticationProvider(authenticationProvider()); } @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .antMatchers("/edit/**","/delete/**").hasRole("ADMIN") .antMatchers("/","/images/**","/vendor/**","/scss/**" ,"/fonts/**", "/js/**", "/css/**", "/bootstrapDash/**","/buildDash/**","/distDash/**","/pagesDash/**","/pluginsDash/**").permitAll() .anyRequest().authenticated() .and() .formLogin().loginPage("/login") .defaultSuccessUrl("/") .permitAll() .and() .logout().permitAll() .and() .exceptionHandling().accessDeniedPage("/403") ; } }
[ "agungldcorp@gmail.com" ]
agungldcorp@gmail.com
3fcca86150a663e6ff4bcb94cce5c351ef624b16
3a7c998940b58ced3907a45c04aba31e28959d6c
/customerapiwiremock/src/main/java/com/virtusa/banking/controllers/CustomerController.java
8efac5e06432bacbf2a378b6a51197e9b8897793
[]
no_license
eswaribala/msusbatch1_oct2020
9afe59d5f6c24d95bf8ba480536cc1e4d85924e7
319a5c3428e1a079e4ec8506126a293dae14ffc3
refs/heads/main
2023-02-28T21:06:52.268878
2021-02-04T17:05:10
2021-02-04T17:05:10
308,073,405
1
6
null
null
null
null
UTF-8
Java
false
false
590
java
package com.virtusa.banking.controllers; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import com.virtusa.banking.models.Customer; import com.virtusa.banking.services.CustomerService; import java.util.List; @RestController public class CustomerController { @Autowired private CustomerService customerService; @GetMapping("/all") public List<Customer> getCustomers() { return customerService.getAllCustomers(); } }
[ "parameswaribala@gmail.com" ]
parameswaribala@gmail.com
ea4cf1fc41a82308000f5ae01115856278e2aa95
96a7d93cb61cef2719fab90742e2fe1b56356d29
/selected projects/desktop/mars-sim-v3.1.0/mars-sim-core/org/mars_sim/msp/core/structure/building/function/SolarPowerSource.java
e3478127a794d87e1f170d89dcafb30266942a52
[ "MIT" ]
permissive
danielogen/msc_research
cb1c0d271bd92369f56160790ee0d4f355f273be
0b6644c11c6152510707d5d6eaf3fab640b3ce7a
refs/heads/main
2023-03-22T03:59:14.408318
2021-03-04T11:54:49
2021-03-04T11:54:49
307,107,229
0
1
MIT
2021-03-04T11:54:49
2020-10-25T13:39:50
Java
UTF-8
Java
false
false
6,079
java
/** * Mars Simulation Project * SolarPowerSource.java * @version 3.1.0 2017-08-14 * @author Scott Davis */ package org.mars_sim.msp.core.structure.building.function; import java.io.Serializable; import java.util.logging.Logger; import org.mars_sim.msp.core.Coordinates; import org.mars_sim.msp.core.structure.Settlement; import org.mars_sim.msp.core.structure.building.Building; import org.mars_sim.msp.core.structure.building.BuildingManager; /** * A power source that gives a supply of power proportional * to the level of sunlight it receives. */ public class SolarPowerSource extends PowerSource implements Serializable { /** default serial id. */ private static final long serialVersionUID = 1L; /** default logger. */ private static Logger logger = Logger.getLogger(SolarPowerSource.class.getName()); private static final double MAINTENANCE_FACTOR = 2.5D; /** NASA MER has an observable solar cell degradation rate of 0.14% per sol, Here we tentatively set to 0.04% per sol instead of 0.14%, since that in 10 earth years, the efficiency will drop down to 23.21% of the initial 100% 100*(1-.04/100)^(365*10) = 23.21% */ public static double DEGRADATION_RATE_PER_SOL = .0004; // assuming it is a constant through its mission /* * The number of layers/panels that can be mechanically steered * toward the sun to maximum the solar irradiance */ public static double NUM_LAYERS = 4D; // in square feet public static double STEERABLE_ARRAY_AREA = 50D; // in square feet public static double AUXILLARY_PANEL_AREA = 15D; // in square feet public static double PI = Math.PI; public static double HALF_PI = PI / 2D; private static final String SOLAR_PHOTOVOLTAIC_ARRAY = "Solar Photovoltaic Array"; // Notes : // 1. The solar Panel is made of triple-junction solar cells with theoretical max eff of 68% // 2. the flat-plate single junction has max theoretical efficiency at 29% // 3. The modern Shockley and Queisser (SQ) Limit calculation is a maximum efficiency of 33.16% for any // type of single junction solar cell. // see http://www.solarcellcentral.com/limits_page.html /* * The theoretical max efficiency of the triple-junction solar cells */ private double efficiency_solar_panel = .55; /** * The dust deposition rates is proportional to the dust loading. Here we use MER program's extended the analysis * to account for variations in the atmospheric columnar dust amount. */ private double dust_deposition_rate = 0; // As of Sol 4786 (July 11, 2017), the solar array energy production was 352 watt-hours with // an atmospheric opacity (Tau) of 0.748 and a solar array dust factor of 0.549. private Coordinates location ; /** * Constructor. * @param maxPower the maximum generated power (kW). */ public SolarPowerSource(double maxPower) { // Call PowerSource constructor. super(PowerSourceType.SOLAR_POWER, maxPower); } /*** * Computes and updates the dust deposition rate for a settlement * @param the rate */ public void computeDustDeposition(Settlement settlement) { if (location == null) location = settlement.getCoordinates(); double tau = surface.getOpticalDepth(location); // e.g. The Material Adherence Experiement (MAE) on Pathfinder indicate steady dust accumulation on the Martian // surface at a rate of ~ 0.28% of the surface area per day (Landis and Jenkins, 1999) dust_deposition_rate = .0018 * tau /.5; // during relatively periods of clear sky, typical values for tau (optical depth) were between 0.2 and 0.5 } /** * Gets the current power produced by the power source. * @param building the building this power source is for. * @return power (kW) */ @Override public double getCurrentPower(Building building) { BuildingManager manager = building.getBuildingManager(); if (location == null) location = manager.getSettlement().getCoordinates(); double area = AUXILLARY_PANEL_AREA; if (building.getBuildingType().equalsIgnoreCase(SOLAR_PHOTOVOLTAIC_ARRAY)) { // if (orbitInfo == null) // orbitInfo = mars.getOrbitInfo(); double angle = orbitInfo.getSolarZenithAngle(location); //logger.info("angle : " + angle/ Math.PI*180D); // assuming the total area will change from 3 full panels to 1 panel based on the solar zenith angle if (angle <= - HALF_PI) { angle = angle + PI; area = STEERABLE_ARRAY_AREA * ((NUM_LAYERS - 1) / HALF_PI * angle + 1); } else if (angle <= 0) { angle = angle + HALF_PI; area = STEERABLE_ARRAY_AREA * ((1 - NUM_LAYERS) / HALF_PI * angle + NUM_LAYERS); } else if (angle <= HALF_PI) { area = STEERABLE_ARRAY_AREA * ((NUM_LAYERS - 1) / HALF_PI * angle + 1); } else { angle = angle - HALF_PI; area = STEERABLE_ARRAY_AREA * ((1 - NUM_LAYERS) / HALF_PI * angle + NUM_LAYERS); } //logger.info("area : " + area); } double available = surface.getSolarIrradiance(location) /1000D * area * efficiency_solar_panel; // add noise with * (.99 + RandomUtil.getRandomDouble(.2)); double capable = getMaxPower() * efficiency_solar_panel; if (available >= capable) { // logger.info(building.getNickName() + " solar power capable : " + Math.round(capable * 100.0)/100.0 + " kW"); return capable; } else { // logger.info(building.getNickName() + " solar power available : " + Math.round(available * 100.0)/100.0 + " kW"); return available; } } @Override public double getAveragePower(Settlement settlement) { return getMaxPower() * 0.707; } @Override public double getMaintenanceTime() { return getMaxPower() * MAINTENANCE_FACTOR; } public void setEfficiency(double value) { efficiency_solar_panel = value; } public double getEfficiency() { return efficiency_solar_panel; } @Override public void removeFromSettlement() { // TODO Auto-generated method stub } @Override public void setTime(double time) { // TODO Auto-generated method stub } @Override public void destroy() { super.destroy(); location = null; } }
[ "danielogen@gmail.com" ]
danielogen@gmail.com
14cde6b9b63260f569f8956a12d32ab6b0b790bc
20645b984308f6644d097fdae820389ab79a3084
/workspace_ehotel/FLCVinhTHinhePMS_/src/elcom/domain/eWeb.java
2820aa1f25565fb8a029985b4421ce55b5b26baa
[]
no_license
elcomthien/source
d314a09c317ea10a2cc057f897c9117263690994
b2cbb7dec061eb3d037d98b9f134ab6dc45216a8
refs/heads/master
2021-09-16T23:37:40.547101
2018-06-26T02:48:06
2018-06-26T02:48:06
109,084,993
0
0
null
null
null
null
UTF-8
Java
false
false
670
java
package elcom.domain; import javax.xml.bind.annotation.XmlRootElement; import com.sun.xml.internal.txw2.annotation.XmlAttribute; @XmlRootElement(name = "item") public class eWeb { private int Id; private String name; private String url; public eWeb() { } @XmlAttribute public int getId() { return Id; } public void setId(int webId) { this.Id = webId; } public String getName() { return name; } public void setName(String title) { this.name = title; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String toString() { return "eWeather[webId=" + Id + ",url=" + url + "]"; } }
[ "32834285+app-core@users.noreply.github.com" ]
32834285+app-core@users.noreply.github.com
330ee1e87f1b86018912cbfb8bd18fe1d7a67763
e3990e8c3b1e0b8824a0a19bf9d12e48441def7a
/ebean-core/src/main/java/io/ebeaninternal/server/grammer/EqlWhereAdapter.java
0620e3ee8271ab050f82770d961695edf37f01f6
[ "Apache-2.0" ]
permissive
ebean-orm/ebean
13c9c465f597dd2cf8b3e54e4b300543017c9dee
bfe94786de3c3b5859aaef5afb3a7572e62275c4
refs/heads/master
2023-08-22T12:57:34.271133
2023-08-22T11:43:41
2023-08-22T11:43:41
5,793,895
1,199
224
Apache-2.0
2023-09-11T14:05:26
2012-09-13T11:49:56
Java
UTF-8
Java
false
false
1,126
java
package io.ebeaninternal.server.grammer; import io.ebean.ExpressionFactory; import io.ebean.ExpressionList; import io.ebeaninternal.server.util.ArrayStack; class EqlWhereAdapter<T> extends EqlWhereListener<T> { private final ExpressionList<T> where; private final ExpressionFactory expr; private final Object[] params; private int paramIndex; EqlWhereAdapter(ExpressionList<T> where, ExpressionFactory expr, Object[] params) { this.where = where; this.expr = expr; this.params = params; } @Override ExpressionList<T> peekExprList() { if (whereStack == null) { whereStack = new ArrayStack<>(); whereStack.push(where); } return whereStack.peek(); } @Override ExpressionFactory expressionFactory() { return expr; } @Override Object positionParam(String paramPosition) { if ("?".equals(paramPosition)) { return params[paramIndex++]; } final int pos = Integer.parseInt(paramPosition.substring(1)); return params[pos -1]; } @Override Object namedParam(String substring) { throw new RuntimeException("Not supported"); } }
[ "robin.bygrave@gmail.com" ]
robin.bygrave@gmail.com
cd7199cae3c8abfa476a29aa0f32a3558a6ae3ea
67264f70a769a3fde72b3a405639641f170a01e1
/test/net/davidpereira/mazesolver/domain/SolutionTest.java
54faa84c11fe510a8d86acf0a723ac6e98daddc2
[]
no_license
drvpereira/maze-solver
e858885a70bbe6248943900c438cba9699dd4a4c
5314e4e6b0cde28617583929969899378c2675c2
refs/heads/master
2021-01-21T03:59:45.880929
2017-08-30T16:53:38
2017-08-30T16:53:38
101,906,371
0
0
null
null
null
null
UTF-8
Java
false
false
226
java
package net.davidpereira.mazesolver.domain; /** * Created with IntelliJ IDEA. * User: U403 * Date: 21/05/14 * Time: 16:11 * To change this template use File | Settings | File Templates. */ public class SolutionTest { }
[ "david@info.ufrn.br" ]
david@info.ufrn.br
cd0941b18278b144909eb302eb9d64cc625186b6
d84658c70db182a9211aaf96f0f46912579eba73
/src/main/java/com/jp/dao/JpXingDicMapper.java
c1d7f827fc9bef66686440f63f11d1966f57c623
[]
no_license
phjjava/-
091e30c53d5c89aa19bcb6d0e5d3afd9326ccfd1
49cccd9db05edc9e9c128d294b456bb0a9087ade
refs/heads/master
2022-12-27T03:19:39.443295
2019-10-24T06:51:04
2019-10-24T06:51:04
217,419,811
0
0
null
2022-12-16T08:00:54
2019-10-25T00:39:25
JavaScript
UTF-8
Java
false
false
657
java
package com.jp.dao; import com.jp.entity.JpXingDic; import com.jp.entity.JpXingDicExample; import java.util.List; import org.apache.ibatis.annotations.Param; public interface JpXingDicMapper { int countByExample(JpXingDicExample example); int deleteByExample(JpXingDicExample example); int insert(JpXingDic record); int insertSelective(JpXingDic record); List<JpXingDic> selectByExample(); int updateByExampleSelective(@Param("record") JpXingDic record, @Param("example") JpXingDicExample example); int updateByExample(@Param("record") JpXingDic record, @Param("example") JpXingDicExample example); }
[ "goodMorning_glb@atguigu.com" ]
goodMorning_glb@atguigu.com
49373ec95b3805096a3ed6b725f02bf74c65dcec
be11b1f0d7013258408abc162bc06c2d8be2daaa
/src/generics/Manipulation.java
b2e62f297fd10b752af81559b8047c0dafdb759d
[]
no_license
TarquinnJet/Thinking-in-Java-4th-Edition-by-Bruce-Eckel
0616c42c57525cec84a26773133eff2b65b45249
851a5281a2850f2e822bf1aaef6887b36ec906c2
refs/heads/master
2016-09-10T15:17:15.961085
2015-04-30T11:09:07
2015-04-30T11:09:07
34,849,779
0
0
null
null
null
null
UTF-8
Java
false
false
468
java
package generics; ///: generics/Manipulation.java // {CompileTimeError} (Won't compile) class Manipulator<T> { private T obj; public Manipulator(T x) { obj = x; } // Error: cannot find symbol: method f(): //public void manipulate() { obj.f(); } } public class Manipulation { public static void main(String[] args) { HasF hf = new HasF(); Manipulator<HasF> manipulator = new Manipulator<HasF>(hf); // manipulator.manipulate(); } } ///:~
[ "spokhylov@gmail.com" ]
spokhylov@gmail.com
f2181f955e893126a115d5d00b09cbcbbaf1fea6
126184ced2295c853d383c2a59819cebb74d5e45
/DiaryFx/src/main/java/model/PersonModel.java
8f26635e5cde615caa08677e939fa1e12dcf95c1
[]
no_license
aniszek/DiaryFX
7980de19484b96dfca0dd52ab561af7cedf18608
f685086336016b91894707bde04f299228b3138a
refs/heads/master
2020-04-24T10:34:22.243572
2018-03-21T18:07:18
2018-03-21T18:07:18
171,898,051
0
0
null
2019-02-21T15:36:17
2019-02-21T15:36:16
null
UTF-8
Java
false
false
2,859
java
package model; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import utils.Queries; import java.sql.SQLException; import java.util.List; import converters.PersonConverter; /** * Developed by anisz */ public class PersonModel { private ObjectProperty<PersonFx> personFxObjectProperty = new SimpleObjectProperty<>(new PersonFx()); private ObjectProperty<PersonFx> personFxObjectPropertyEdit = new SimpleObjectProperty<>(new PersonFx()); private ObservableList<PersonFx> personFxObservableList = FXCollections.observableArrayList(); public void init() throws Exception { List<Person> personList = Queries.queryForAll(Person.class); this.personFxObservableList.clear(); personList.forEach(person -> { PersonFx personFx = PersonConverter.convertToPersonFx(person); this.personFxObservableList.add(personFx); }); } public void savePersonEditInDataBase() throws Exception { saveOrUpdate(this.getPersonFxObjectPropertyEdit()); } public void savePersonInDataBase() throws Exception { saveOrUpdate(this.getPersonFxObjectProperty()); } public void deletePersonInDataBase() throws Exception, SQLException { Queries.deleteById(Person.class, this.getPersonFxObjectPropertyEdit().getId()); //Queries.deleteByColumnName(Event.PERSON_ID, this.getPersonFxObjectPropertyEdit().getId()); //kaskadowe kasowanie this.init(); } private void saveOrUpdate(PersonFx personFxObjectPropertyEdit) throws Exception { Person person = PersonConverter.converToPerson(personFxObjectPropertyEdit); Queries.create(person); this.init(); } public PersonFx getPersonFxObjectProperty() { return personFxObjectProperty.get(); } public ObjectProperty<PersonFx> personFxObjectPropertyProperty() { return personFxObjectProperty; } public void setPersonFxObjectProperty(PersonFx personFxObjectProperty) { this.personFxObjectProperty.set(personFxObjectProperty); } public ObservableList<PersonFx> getPersonFxObservableList() { return personFxObservableList; } public void setPersonFxObservableList(ObservableList<PersonFx> personFxObservableList) { this.personFxObservableList = personFxObservableList; } public PersonFx getPersonFxObjectPropertyEdit() { return personFxObjectPropertyEdit.get(); } public ObjectProperty<PersonFx> personFxObjectPropertyEditProperty() { return personFxObjectPropertyEdit; } public void setPersonFxObjectPropertyEdit(PersonFx personFxObjectPropertyEdit) { this.personFxObjectPropertyEdit.set(personFxObjectPropertyEdit); } }
[ "aniszek@gmail.com" ]
aniszek@gmail.com
12e510fabdb6f5c19891413b9358f15f932390c7
0373e2677fc4c7bfc09287c29cce0d7b75fcae59
/src/main/java/com/example/demo/service/UserService.java
9af572f1c31639f1dd2a87e48392f1f71bebf04b
[]
no_license
1173710113/kgmx
9d2f938da77971f14c597136acaeedcffa1dddad
a968c96604f30eeaeb767af4f538e5e555a54730
refs/heads/master
2022-11-24T21:25:38.074983
2020-07-28T05:12:27
2020-07-28T05:12:27
282,781,963
0
0
null
null
null
null
UTF-8
Java
false
false
1,487
java
package com.example.demo.service; import java.util.List; import java.util.Map; import com.alibaba.fastjson.JSONObject; import com.example.demo.domain.LecturerView; import com.example.demo.domain.StudentView; import com.example.demo.domain.User; public interface UserService { /** * 处理微信登入 * @param SessionKeyOpenId * @return */ public JSONObject wxLogin(JSONObject SessionKeyOpenId, String rawData, String signature); public void setEmployeeNumber(User user, String employeeNumber); public void updateEmployeeNumber(String openId, String employeeNumber); public void updateUserName(String openId, String nickName); public void setUserType(User user, String type, String code); public void setLecturerDescription(User user, String description); public User validateSession(String sessionKey); public void validateUserEmployeeNumber(User user); public void validateUserType(User user); public void setDepartment(User user, String departmentId); public void updateDepartment(String studentId, String departmentId); public List<LecturerView> getAllTeacher(); public LecturerView getTeacher(String id); public List<Map<String, Object>> getAllStudent(User user); public StudentView getStudent(User user, String studentId); public LecturerView updateTeacherLevel(String teacherId, String level); public String updateAvatarUrl(User user, String avatarUrl); public void changeUserType(String userId, String newType); }
[ "2716291492@qq.com" ]
2716291492@qq.com
be383e9f5cfa8d3c4e2d59470c5f34c859b700cc
4339b8e6d2409a589da43733a619aea3bc9d83c8
/src/main/java/com/ken/wms/dao/RepositoryAdminMapper.java
30e28dd4d975b2e9a6ea8ca80bc1094c34b7f902
[]
no_license
JohnBending/SkladOk
b4100712950e6e41482ee6b828b34019fc2754a4
59d93169d7ef612dbbdab120196c91dc0ea61ec9
refs/heads/master
2022-12-22T18:00:30.885341
2019-06-20T00:08:23
2019-06-20T00:08:23
192,820,195
0
0
null
2022-12-16T08:14:18
2019-06-20T00:08:20
Java
UTF-8
Java
false
false
579
java
package com.ken.wms.dao; import com.ken.wms.domain.RepositoryAdmin; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface RepositoryAdminMapper { RepositoryAdmin selectByID(Integer id); List<RepositoryAdmin> selectByName(String name); List<RepositoryAdmin> selectAll(); RepositoryAdmin selectByRepositoryID(Integer repositoryID); void insert(RepositoryAdmin repositoryAdmin); void insertBatch(List<RepositoryAdmin> repositoryAdmins); void update(RepositoryAdmin repositoryAdmin); void deleteByID(Integer id); }
[ "Agyre4ik@gmail.com" ]
Agyre4ik@gmail.com
600e6268b5390f1a872252b5fc746d8c4d6a90d7
c8bd47430ede64cd9225550bbab824755e1fddbe
/src/tacos/manolo/sistema/LogIn/Ordenar.java
a72e1dbd8485b5e7822856e020be42323bd8baa4
[]
no_license
blaze0912/Fairy-Tail
b63a9bc1a29fef68216a282cddf0780485c6b8c7
56e1c5efba9bc9060b01738db1be28a05e81f124
refs/heads/master
2016-08-11T20:45:10.827816
2015-11-24T19:12:26
2015-11-24T19:12:26
46,812,570
0
0
null
null
null
null
UTF-8
Java
false
false
40,302
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 tacos.manolo.sistema.LogIn; import java.awt.Component; import java.io.File; import java.io.FileWriter; import javax.swing.JCheckBox; /** * * @author Francisco Javier */ public class Ordenar extends javax.swing.JFrame { /** * Creates new form Ordenar */ public Ordenar() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); Regreso = new javax.swing.JButton(); Pastor = new javax.swing.JCheckBox(); Chuleta = new javax.swing.JCheckBox(); Bistec = new javax.swing.JCheckBox(); Camello = new javax.swing.JCheckBox(); Manolo = new javax.swing.JCheckBox(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); Coca = new javax.swing.JCheckBox(); Mirinda = new javax.swing.JCheckBox(); Up = new javax.swing.JCheckBox(); Horchata = new javax.swing.JCheckBox(); Sol = new javax.swing.JCheckBox(); jLabel4 = new javax.swing.JLabel(); Papas = new javax.swing.JCheckBox(); Nachos = new javax.swing.JCheckBox(); Chicharron = new javax.swing.JCheckBox(); Queso = new javax.swing.JCheckBox(); jLabel5 = new javax.swing.JLabel(); Helado = new javax.swing.JCheckBox(); Arroz = new javax.swing.JCheckBox(); Flan = new javax.swing.JCheckBox(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); jLabel12 = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); jLabel16 = new javax.swing.JLabel(); jLabel17 = new javax.swing.JLabel(); jLabel18 = new javax.swing.JLabel(); jLabel19 = new javax.swing.JLabel(); jLabel20 = new javax.swing.JLabel(); jLabel21 = new javax.swing.JLabel(); jLabel22 = new javax.swing.JLabel(); Impuestos = new javax.swing.JTextField(); Total = new javax.swing.JTextField(); SubTotal = new javax.swing.JTextField(); jLabel23 = new javax.swing.JLabel(); jLabel24 = new javax.swing.JLabel(); jLabel25 = new javax.swing.JLabel(); Calcular = new javax.swing.JButton(); Limpiar = new javax.swing.JButton(); Guardar = new javax.swing.JButton(); Guardar2 = new javax.swing.JButton(); jLabel26 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jPanel1.setBackground(new java.awt.Color(0, 102, 51)); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Cual Es La Orden ? "); Regreso.setText("Regreso"); Regreso.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { RegresoActionPerformed(evt); } }); Pastor.setText("Pastor"); Pastor.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { PastorActionPerformed(evt); } }); Chuleta.setText("Chuleta"); Bistec.setText("Bistec"); Bistec.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { BistecActionPerformed(evt); } }); Camello.setText("Camello"); Manolo.setText("Manolo"); jLabel2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel2.setForeground(new java.awt.Color(255, 255, 255)); jLabel2.setText("Orden de tacos (5 tacos)"); jLabel3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel3.setForeground(new java.awt.Color(255, 255, 255)); jLabel3.setText("Bebidas"); Coca.setText("Coca-Cola"); Mirinda.setText("Mirinda"); Up.setText("7-Up"); Horchata.setText("Horchata"); Sol.setText("Sol"); jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel4.setForeground(new java.awt.Color(255, 255, 255)); jLabel4.setText("Extra"); Papas.setText("Papas Preparadas"); Nachos.setText("Nachos"); Chicharron.setText("Chicharron"); Queso.setText("Queso Oaxaca"); jLabel5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel5.setForeground(new java.awt.Color(255, 255, 255)); jLabel5.setText("Postres"); Helado.setText("Helado"); Arroz.setText("Arroz con Leche"); Flan.setText("Flan de la Abuela"); jLabel6.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel6.setForeground(new java.awt.Color(255, 255, 255)); jLabel6.setText("$35.00"); jLabel7.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel7.setForeground(new java.awt.Color(255, 255, 255)); jLabel7.setText("$35.00"); jLabel8.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel8.setForeground(new java.awt.Color(255, 255, 255)); jLabel8.setText("$35.00"); jLabel9.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel9.setForeground(new java.awt.Color(255, 255, 255)); jLabel9.setText("$30.00"); jLabel10.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel10.setForeground(new java.awt.Color(255, 255, 255)); jLabel10.setText("$30.00"); jLabel11.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel11.setForeground(new java.awt.Color(255, 255, 255)); jLabel11.setText("$30.00"); jLabel12.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel12.setForeground(new java.awt.Color(255, 255, 255)); jLabel12.setText("$25.00"); jLabel13.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel13.setForeground(new java.awt.Color(255, 255, 255)); jLabel13.setText("$20.00"); jLabel14.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel14.setForeground(new java.awt.Color(255, 255, 255)); jLabel14.setText("$20.00"); jLabel15.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel15.setForeground(new java.awt.Color(255, 255, 255)); jLabel15.setText("$15.00"); jLabel16.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel16.setForeground(new java.awt.Color(255, 255, 255)); jLabel16.setText("$15.00"); jLabel17.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel17.setForeground(new java.awt.Color(255, 255, 255)); jLabel17.setText("$15.00"); jLabel18.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel18.setForeground(new java.awt.Color(255, 255, 255)); jLabel18.setText("$15.00"); jLabel19.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel19.setForeground(new java.awt.Color(255, 255, 255)); jLabel19.setText("$12.00"); jLabel20.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel20.setForeground(new java.awt.Color(255, 255, 255)); jLabel20.setText("$12.00"); jLabel21.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel21.setForeground(new java.awt.Color(255, 255, 255)); jLabel21.setText("$18.00"); jLabel22.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel22.setForeground(new java.awt.Color(255, 255, 255)); jLabel22.setText("$18.00"); Total.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { TotalActionPerformed(evt); } }); jLabel23.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel23.setForeground(new java.awt.Color(255, 255, 255)); jLabel23.setText("Sub-Total"); jLabel24.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel24.setForeground(new java.awt.Color(255, 255, 255)); jLabel24.setText("Impuestos"); jLabel25.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel25.setForeground(new java.awt.Color(255, 255, 255)); jLabel25.setText("Total"); Calcular.setText("Calcular"); Calcular.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { CalcularActionPerformed(evt); } }); Limpiar.setText("Limpiar"); Limpiar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { LimpiarActionPerformed(evt); } }); Guardar.setText("Guardar"); Guardar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { GuardarActionPerformed(evt); } }); Guardar2.setText("Guardar En Total"); Guardar2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { Guardar2ActionPerformed(evt); } }); jLabel26.setIcon(new javax.swing.ImageIcon(getClass().getResource("/tacos/manolo/sistema/LogIn/tacos5.jpg"))); // NOI18N jLabel26.setText("jLabel26"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(10, 10, 10) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(Sol) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel22)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(Horchata) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel20)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() .addComponent(Chuleta) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel10)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() .addComponent(Camello) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel7)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() .addComponent(Pastor) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel9)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() .addComponent(Bistec) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel12)) .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() .addComponent(Coca) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel15)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() .addComponent(Mirinda) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel16)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() .addComponent(Up) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel17)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() .addComponent(Manolo) .addGap(59, 59, 59) .addComponent(jLabel6)))) .addGap(51, 51, 51) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel4) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel25, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel24) .addComponent(jLabel23, javax.swing.GroupLayout.Alignment.TRAILING)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(SubTotal) .addComponent(Impuestos) .addComponent(Total, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(Flan) .addComponent(Arroz) .addComponent(Helado) .addComponent(jLabel5) .addComponent(Queso) .addComponent(Chicharron) .addComponent(Nachos) .addComponent(Papas)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel8) .addComponent(jLabel11)) .addComponent(jLabel13, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel14, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel18, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel19, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel21, javax.swing.GroupLayout.Alignment.TRAILING)))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(Calcular) .addComponent(Limpiar))))) .addComponent(jLabel1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel26, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 283, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(Guardar2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(Guardar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(Regreso, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(110, 110, 110))) .addContainerGap()) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(jLabel4)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Manolo) .addComponent(jLabel6)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Pastor) .addComponent(jLabel9)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Chuleta) .addComponent(jLabel10)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Bistec) .addComponent(jLabel12)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Camello) .addComponent(jLabel7)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(jLabel5)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Coca) .addComponent(jLabel15) .addComponent(Helado) .addComponent(jLabel19)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Mirinda) .addComponent(jLabel16) .addComponent(Arroz) .addComponent(jLabel18)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Up) .addComponent(jLabel17) .addComponent(Flan) .addComponent(jLabel21)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Horchata) .addComponent(jLabel20)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Sol) .addComponent(jLabel22))) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(89, 89, 89) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Papas) .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Nachos) .addComponent(jLabel11)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Chicharron) .addComponent(jLabel13)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Queso) .addComponent(jLabel14))) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(52, 52, 52) .addComponent(jLabel26, javax.swing.GroupLayout.PREFERRED_SIZE, 259, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(22, 22, 22) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel23) .addComponent(SubTotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(Guardar2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel24) .addComponent(Impuestos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(Limpiar) .addComponent(Guardar)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Calcular) .addComponent(Total, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel25) .addComponent(Regreso)) .addContainerGap(26, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 61, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void RegresoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RegresoActionPerformed Interfaz obj=new Interfaz(); obj.setVisible(true); //Mantiene abierto dispose(); }//GEN-LAST:event_RegresoActionPerformed private void PastorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PastorActionPerformed // TODO add your handling code here: }//GEN-LAST:event_PastorActionPerformed private void BistecActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BistecActionPerformed // TODO add your handling code here: }//GEN-LAST:event_BistecActionPerformed private void LimpiarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LimpiarActionPerformed Manolo.setSelected(false); Pastor.setSelected(false); Chuleta.setSelected(false); Bistec.setSelected(false); Camello.setSelected(false); Coca.setSelected(false); Mirinda.setSelected(false); Up.setSelected(false); Horchata.setSelected(false); Sol.setSelected(false); Papas.setSelected(false); Nachos.setSelected(false); Chicharron.setSelected(false); Queso.setSelected(false); Helado.setSelected(false); Arroz.setSelected(false); Flan.setSelected(false); SubTotal.setText(""); Impuestos.setText(""); Total.setText(""); }//GEN-LAST:event_LimpiarActionPerformed private void CalcularActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CalcularActionPerformed int total; int subtotal = 0; final double impuestohoy = .15; int impuesto; if (Pastor.isSelected()){ subtotal = subtotal + 30; } if (Manolo.isSelected()){ subtotal = subtotal + 35; } if (Chuleta.isSelected()){ subtotal = subtotal + 30; } if (Bistec.isSelected()){ subtotal = subtotal + 25; } if (Camello.isSelected()){ subtotal = subtotal + 35; } if (Coca.isSelected()){ subtotal = subtotal + 15; } if (Mirinda.isSelected()){ subtotal = subtotal + 15; } if (Up.isSelected()){ subtotal = subtotal + 15; } if (Horchata.isSelected()){ subtotal = subtotal + 12; } if (Sol.isSelected()){ subtotal = subtotal + 18; } if (Papas.isSelected()){ subtotal = subtotal + 35; } if (Nachos.isSelected()){ subtotal = subtotal + 30; } if (Chicharron.isSelected()){ subtotal = subtotal + 20; } if (Queso.isSelected()){ subtotal = subtotal + 20; } if (Helado.isSelected()){ subtotal = subtotal + 12; } if (Arroz.isSelected()){ subtotal = subtotal + 15; } if (Flan.isSelected()){ subtotal = subtotal + 18; } SubTotal.setText(Double.toString(subtotal)); subtotal = (int) Double.parseDouble(SubTotal.getText()); impuesto = (int) (subtotal * impuestohoy); total = impuesto + subtotal; Impuestos.setText(Double.toString(impuesto)); Total.setText(Double.toString(total)); }//GEN-LAST:event_CalcularActionPerformed private void GuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_GuardarActionPerformed // TODO add your handling code here: File fichero = null;//contiene el archivo FileWriter pw = null;//temporal para leer try { fichero = new File("archivo.txt"); pw = new FileWriter(fichero, true); String texto = (Total.getText()); String Text1 = ""; String Text2 = ""; String Text3 = ""; String Text4 = ""; String Text5 = ""; String Text6 = ""; String Text7 = ""; String Text8 = ""; String Text9 = ""; String Text10 = ""; String Text11 = ""; String Text12 = ""; String Text13 = ""; String Text14 = ""; String Text15 = ""; String Text16 = ""; String Text17 = ""; if (Manolo.isSelected()){ Text1 = (Manolo.getText()); } if (Pastor.isSelected()){ Text2 = (Pastor.getText()); } if (Chuleta.isSelected()){ Text3 = (Chuleta.getText()); } if (Bistec.isSelected()){ Text4 = (Bistec.getText()); } if (Camello.isSelected()){ Text5 = (Camello.getText()); } if (Coca.isSelected()){ Text6 = (Coca.getText()); } if (Mirinda.isSelected()){ Text7 = (Mirinda.getText()); } if (Up.isSelected()){ Text8 = (Up.getText()); } if (Horchata.isSelected()){ Text9 = (Horchata.getText()); } if (Sol.isSelected()){ Text10 = (Sol.getText()); } if (Papas.isSelected()){ Text11 = (Papas.getText()); } if (Nachos.isSelected()){ Text12 = (Nachos.getText()); } if (Chicharron.isSelected()){ Text13 = (Chicharron.getText()); } if (Queso.isSelected()){ Text14 = (Queso.getText()); } if (Helado.isSelected()){ Text15 = (Helado.getText()); } if (Arroz.isSelected()){ Text16 = (Arroz.getText()); } if (Flan.isSelected()){ Text17 = (Flan.getText()); } //escribe en el archivo de txt pw.write("||||||||||ORDEN||||||||||||"+"\n"+Text1+"\n"+Text2+"\n"+Text3+"\n"+Text4+"\n"+Text5+"\n"+Text6+"\n"+Text7+"\n"+Text8+"\n"+Text9+"\n"+Text10+"\n" +Text11+"\n"+Text12+"\n"+Text13+"\n"+Text14+"\n"+Text15+"\n"+Text16+"\n"+Text17 +"\n"+"Total: "+texto+"\n\n"+"\n\n"); } catch (Exception e) { e.printStackTrace(); } finally { try { // Nuevamente aprovechamos el finally para // asegurarnos que se cierra el fichero. if (null != fichero) pw.close(); } catch (Exception e2) { e2.printStackTrace(); } } }//GEN-LAST:event_GuardarActionPerformed private void TotalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TotalActionPerformed // TODO add your handling code here: }//GEN-LAST:event_TotalActionPerformed private void Guardar2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Guardar2ActionPerformed File conta = null; FileWriter lecturatemp0 = null; try { conta = new File("archivo2.txt"); lecturatemp0 = new FileWriter(conta,true); lecturatemp0.write((Total.getText())+"\n"); } catch (Exception e) { e.printStackTrace(); } finally { try { // Nuevamente aprovechamos el finally para // asegurarnos que se cierra el fichero. if (null != conta) lecturatemp0.close(); } catch (Exception e2) { e2.printStackTrace(); } } }//GEN-LAST:event_Guardar2ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ 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(Ordenar.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Ordenar.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Ordenar.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Ordenar.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 Ordenar().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JCheckBox Arroz; private javax.swing.JCheckBox Bistec; private javax.swing.JButton Calcular; private javax.swing.JCheckBox Camello; private javax.swing.JCheckBox Chicharron; private javax.swing.JCheckBox Chuleta; private javax.swing.JCheckBox Coca; private javax.swing.JCheckBox Flan; private javax.swing.JButton Guardar; private javax.swing.JButton Guardar2; private javax.swing.JCheckBox Helado; private javax.swing.JCheckBox Horchata; private javax.swing.JTextField Impuestos; private javax.swing.JButton Limpiar; private javax.swing.JCheckBox Manolo; private javax.swing.JCheckBox Mirinda; private javax.swing.JCheckBox Nachos; private javax.swing.JCheckBox Papas; private javax.swing.JCheckBox Pastor; private javax.swing.JCheckBox Queso; private javax.swing.JButton Regreso; private javax.swing.JCheckBox Sol; private javax.swing.JTextField SubTotal; private javax.swing.JTextField Total; private javax.swing.JCheckBox Up; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel16; private javax.swing.JLabel jLabel17; private javax.swing.JLabel jLabel18; private javax.swing.JLabel jLabel19; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel20; private javax.swing.JLabel jLabel21; private javax.swing.JLabel jLabel22; private javax.swing.JLabel jLabel23; private javax.swing.JLabel jLabel24; private javax.swing.JLabel jLabel25; private javax.swing.JLabel jLabel26; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; // End of variables declaration//GEN-END:variables }
[ "frank_torres0912@hotmail.com" ]
frank_torres0912@hotmail.com
54cb740f381a26a081a1ce9664320a4e333f9ac8
ee8808ef2a641b44c6e21bfdddaa85760e2fb143
/model/src/main/java/io/wcm/devops/conga/model/environment/Node.java
565634d184e786e3befdda0a14d42237f265b1f0
[ "Apache-2.0" ]
permissive
zoosky/conga
c20d5e154ebb1c990c55d5233b1eaa30b119b66c
b75de33ae14a82ecb11d7db9c334ad67ea47f8b7
refs/heads/develop
2023-04-17T16:52:19.576764
2018-04-10T08:19:34
2018-04-10T08:19:34
130,014,696
0
0
Apache-2.0
2023-04-03T23:49:49
2018-04-18T06:31:16
Java
UTF-8
Java
false
false
2,200
java
/* * #%L * wcm.io * %% * Copyright (C) 2015 wcm.io * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ package io.wcm.devops.conga.model.environment; import static io.wcm.devops.conga.model.util.DefaultUtil.defaultEmptyList; import java.util.ArrayList; import java.util.List; import io.wcm.devops.conga.model.shared.AbstractConfigurable; /** * Environment node. A node is a system to deploy to, e.g. a physical machine, virtual machine, Docker container or any * other deployment target. */ public final class Node extends AbstractConfigurable { private String node; private List<String> nodes = new ArrayList<>(); private List<NodeRole> roles = new ArrayList<>(); /** * Defines the node name. This is usually a host name or any other unique name identifying the node. * @return Node name */ public String getNode() { return this.node; } public void setNode(String node) { this.node = node; } /** * Defines multiple node names. This is useful if the same set of roles, role variants and configuration apply * to multiple nodes. In this case you can define a single node definition with multiple node names. * The single node name property must nost be used in this case. * @return List of node names */ public List<String> getNodes() { return this.nodes; } public void setNodes(List<String> nodes) { this.nodes = defaultEmptyList(nodes); } /** * Defines roles to be used by this node. * @return Role assignments for node */ public List<NodeRole> getRoles() { return this.roles; } public void setRoles(List<NodeRole> roles) { this.roles = defaultEmptyList(roles); } }
[ "sseifert@pro-vision.de" ]
sseifert@pro-vision.de
b3e97d87bc38357ad3d2aa886cf9a875cd886304
20e012ead1e57a3f5b05f2025e870e3657701988
/shop-springcloud/my-project-service/cart-service/src/test/java/com/qf/CartServiceApplicationTests.java
f90b4e88953f42f7ffa1583faf7045d0cdb21273
[]
no_license
an-unknown-coder/shop
186e96f0b37450c3b9a5494a86d8419153c80a24
6b877207452ba367415fc0407c4f883afe726520
refs/heads/master
2022-11-23T21:29:42.117081
2020-03-21T14:55:31
2020-03-21T14:55:31
246,032,484
1
0
null
2022-11-15T23:35:02
2020-03-09T12:41:29
CSS
UTF-8
Java
false
false
212
java
package com.qf; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class CartServiceApplicationTests { @Test void contextLoads() { } }
[ "1525426775@qq.com" ]
1525426775@qq.com
fefdaaaab0a1f29e45df424563857b7b45212720
058988befbe7134005db0bf09edd15227ca69193
/src/main/java/com/graph/editor/model/MainModel.java
0036a482c7f4ab355135673429eb5c99f51103db
[]
no_license
Ilyanast/SDiIS_4_lab_1
b21886972ca56692ff312db89443b2282cc82292
e6da2a02f4642bce6b31a8a9a23cac760b6c34ad
refs/heads/master
2023-03-28T15:19:37.351207
2021-04-02T03:21:46
2021-04-02T03:21:46
340,293,739
0
0
null
null
null
null
UTF-8
Java
false
false
772
java
package com.graph.editor.model; public class MainModel { private final Graph graph; private final CurrentTool currentTool; private final SelectedElement selectedElement; private final EdgeTargetVertices edgeTargetVertices; public MainModel() { graph = new Graph(); currentTool = new CurrentTool(); selectedElement = new SelectedElement(); edgeTargetVertices = new EdgeTargetVertices(); } public Graph getGraph() { return graph; } public CurrentTool getCurrentTool() { return currentTool; } public SelectedElement getSelectedElement() { return selectedElement; } public EdgeTargetVertices getEdgeTargetVertices() { return edgeTargetVertices; } }
[ "miningilya4@fmail.com" ]
miningilya4@fmail.com
fd8beab6edc865ae332d2d58dfa68aa2f1a0cd9b
1cc11ab64bb5472838277462aa8baf95d36dbbbf
/TugasBesar/src/frontend/FormTransaksi.java
872abccbc52cdb0452db6dbd0f786b66bf08c758
[]
no_license
gopla/pbo-laundry
d5173b39abbbbcd9063b261d29b0c0b3f254c65b
0e762d2622368ed8fb58bf9513755c282a689634
refs/heads/master
2020-09-28T12:15:37.430703
2019-12-13T10:30:06
2019-12-13T10:30:06
226,776,642
0
0
null
null
null
null
UTF-8
Java
false
false
18,031
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 frontend; import backend.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import javax.swing.JOptionPane; /** * * @author Gopla */ public class FormTransaksi extends javax.swing.JFrame { /** * Creates new form transaksi */ public FormTransaksi(int id_user) { initComponents(); id_userHidden.setVisible(false); id_userHidden.setText(String.valueOf(id_user)); setLocationRelativeTo(null); setTeksHarga(); setTeksTotalHarga(); } public void resetForm(){ nama.setText(""); berat.setText(""); harga.setText(""); total_harga.setText(""); bayar.setText(""); } public void setTeksTotalHarga(){ berat.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e){ if (berat.getText().equals("")) { }else{ int hargaTotal = Integer.valueOf(harga.getText()) * Integer.valueOf(berat.getText()); total_harga.setText(String.valueOf(hargaTotal)); } } }); } public void setTeksHarga(){ jenis_cuci.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { if (jenis_cuci.getSelectedItem().toString() == "Setrika") { harga.setText("5000"); } else if(jenis_cuci.getSelectedItem().toString() == "Cuci Kering"){ harga.setText("10000"); }else if(jenis_cuci.getSelectedItem().toString() == "Cuci Kering Setrika"){ harga.setText("15000"); } } }); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jSeparator1 = new javax.swing.JSeparator(); jPanel1 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); nama = new javax.swing.JTextField(); jenis_cuci = new javax.swing.JComboBox<>(); jLabel8 = new javax.swing.JLabel(); harga = new javax.swing.JTextField(); jLabel7 = new javax.swing.JLabel(); berat = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); total_harga = new javax.swing.JTextField(); jLabel6 = new javax.swing.JLabel(); bayar = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jPanel3 = new javax.swing.JPanel(); id_userHidden = new javax.swing.JLabel(); jPanel1.setBackground(new java.awt.Color(102, 153, 255)); jPanel2.setBackground(new java.awt.Color(255, 255, 255)); jLabel1.setBackground(new java.awt.Color(0, 102, 153)); jLabel1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jLabel1.setForeground(new java.awt.Color(0, 51, 102)); jLabel1.setText("Laundry Form"); jLabel3.setText("Nama"); jenis_cuci.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Setrika", "Cuci Kering", "Cuci Kering Setrika", " " })); jenis_cuci.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jenis_cuciActionPerformed(evt); } }); jLabel8.setText("Jenis Cuci"); harga.setEditable(false); harga.setText("5000"); jLabel7.setText("Harga Per Kilo"); jLabel4.setText("Berat"); jLabel5.setText("Total Harga"); total_harga.setEditable(false); jLabel6.setText("Bayar"); jButton1.setBackground(new java.awt.Color(0, 102, 204)); jButton1.setForeground(new java.awt.Color(255, 255, 255)); jButton1.setText("Simpan"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setBackground(new java.awt.Color(0, 102, 204)); jButton2.setForeground(new java.awt.Color(255, 255, 255)); jButton2.setText("Batal"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jPanel3.setBackground(new java.awt.Color(0, 102, 153)); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 141, Short.MAX_VALUE) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 2, Short.MAX_VALUE) ); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(35, 35, 35) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel6) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel5) .addComponent(jLabel4) .addComponent(jenis_cuci, javax.swing.GroupLayout.Alignment.TRAILING, 0, 269, Short.MAX_VALUE) .addComponent(jLabel7) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabel3) .addGap(59, 59, 59)) .addComponent(nama, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel8) .addComponent(harga, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(berat) .addComponent(total_harga)) .addComponent(bayar, javax.swing.GroupLayout.PREFERRED_SIZE, 266, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(87, 87, 87) .addComponent(jButton1) .addGap(41, 41, 41) .addComponent(jButton2))) .addContainerGap(33, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addComponent(jLabel1) .addGap(124, 124, 124)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(96, 96, 96)))) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(6, 6, 6) .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(nama, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(17, 17, 17) .addComponent(jLabel8) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jenis_cuci, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel7) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(harga, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(berat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(total_harga, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(bayar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1) .addComponent(jButton2)) .addContainerGap(23, Short.MAX_VALUE)) ); id_userHidden.setText("jLabel2"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(id_userHidden) .addContainerGap()) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(33, 33, 33) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(42, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(id_userHidden) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 45, Short.MAX_VALUE) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(49, 49, 49)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: if (Integer.parseInt(bayar.getText()) < Integer.parseInt(total_harga.getText())) { JOptionPane.showMessageDialog(rootPane, "Uang Kurang"); } else { JOptionPane.showMessageDialog(rootPane, "Data Dimasukkan"); Transaksi trans = new Transaksi(); trans.setNama(nama.getText()); trans.setId_user(Integer.parseInt(id_userHidden.getText())); trans.setBerat(Integer.parseInt(berat.getText())); trans.setJenisCuci(jenis_cuci.getSelectedItem().toString()); trans.setTotal(Integer.parseInt(total_harga.getText())); trans.save(); resetForm(); this.dispose(); } }//GEN-LAST:event_jButton1ActionPerformed private void jenis_cuciActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jenis_cuciActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jenis_cuciActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: resetForm(); }//GEN-LAST:event_jButton2ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ 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(Transaksi.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Transaksi.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Transaksi.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Transaksi.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new FormTransaksi(0).setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField bayar; private javax.swing.JTextField berat; private javax.swing.JTextField harga; private javax.swing.JLabel id_userHidden; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JSeparator jSeparator1; private javax.swing.JComboBox<String> jenis_cuci; private javax.swing.JTextField nama; private javax.swing.JTextField total_harga; // End of variables declaration//GEN-END:variables }
[ "yudhistn@gmail.com" ]
yudhistn@gmail.com
26462b3797f50938301dc2aa00765b9394051aea
e638f6dc7fe96b0845893b977b08f1f9e78b453d
/src/main/java/com/josiahebhomenye/sound/WaveReader.java
23c2aa8fb74b03c8d280b979e3d4cb3af252d0e8
[]
no_license
ejosiah/sound-eval
19798e00de5cb422f1ac27646023d208036422a1
f5f279f3202e059f60572139453d6a11d87267be
refs/heads/master
2020-12-02T17:16:56.446648
2020-01-10T22:27:46
2020-01-10T22:27:46
231,070,878
0
0
null
null
null
null
UTF-8
Java
false
false
531
java
package com.josiahebhomenye.sound; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.nio.ByteBuffer; import java.nio.ByteOrder; public class WaveReader { public String read(InputStream in) throws Exception{ byte[] buf = new byte[4]; int read = in.read(buf); return new String(buf); } }
[ "josia.ebhomenye@news.co.uk" ]
josia.ebhomenye@news.co.uk
f094c6575e84a8972306e279cf317e8306eb07b3
d330f5f719df5e8fb602bff950db474730c75834
/Lesson015/src/com/gmail/granovskiy/s/App.java
25622a4890f51d2ad4e9cf48d3d463043e88e816
[]
no_license
SviatoslavExpert/JavaForBeginners-Lessons-Udemy
de0eb215d82237422dc4b3426aa0047fb9726fd7
5ea8ceae543f3a0dccaf58fb36ba58dc8a6aec5e
refs/heads/master
2020-04-04T17:21:51.908070
2018-11-13T10:03:00
2018-11-13T10:03:00
156,117,789
0
0
null
null
null
null
UTF-8
Java
false
false
326
java
// Method Parameters package com.gmail.granovskiy.s; public class App { public static void main(String[] args) { Robot sam = new Robot(); sam.speak("I am Sam."); sam.jump(9); sam.move("West", 17.35); String greeting = "Nice to meet you!"; sam.speak(greeting); } }
[ "s.granovskiy@gmail.com" ]
s.granovskiy@gmail.com
be67cae80f6fa727f25f4336c0d0eb045ad2a6ee
b50004ff7eee3b61d332f934bf6df3c262cd8e3f
/src/com/example/accountmanager/activity/AddInAccountActivity.java
22ebf43e38bd166b8517253f75acb924d56ed172
[ "Apache-2.0" ]
permissive
nongweiyi/AccountManager
b922d281047766a7871483841c17fbf2eefe9dd3
4376f6f2183175c78fc141fd1592c5c569e5ca74
refs/heads/master
2020-04-21T01:26:55.376948
2015-10-11T12:45:36
2015-10-11T12:45:36
42,380,002
0
0
null
null
null
null
GB18030
Java
false
false
4,838
java
package com.example.accountmanager.activity; import java.text.SimpleDateFormat; import java.util.Calendar; import com.example.accountmanager.R; import com.example.accountmanager.db.DbManager; import com.example.accountmanager.model.InAccount; import android.app.Activity; import android.app.AlertDialog; import android.app.DatePickerDialog; import android.app.AlertDialog.Builder; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.DatePicker; import android.widget.EditText; import android.widget.Spinner; import android.widget.Toast; public class AddInAccountActivity extends Activity implements OnClickListener { EditText et_money, et_time, et_handler, et_mark; Spinner sp_type; Button btn_save, btn_cancle, btn_datePicker; DbManager dbManager; /******** 日期选择器相关 **********/ SimpleDateFormat df; Calendar cal; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_addinaccount); dbManager = DbManager.getInstance(this); init(); } private void init() { et_money = (EditText) this.findViewById(R.id.et_money); et_time = (EditText) this.findViewById(R.id.et_time); et_handler = (EditText) this.findViewById(R.id.et_handler); et_mark = (EditText) this.findViewById(R.id.et_mark); sp_type = (Spinner) this.findViewById(R.id.sp_type); btn_save = (Button) this.findViewById(R.id.btn_save); btn_cancle = (Button) this.findViewById(R.id.btn_cancle); btn_datePicker = (Button) this.findViewById(R.id.btn_datePicker); btn_save.setOnClickListener(this); btn_cancle.setOnClickListener(this); btn_datePicker.setOnClickListener(this); cal = Calendar.getInstance(); } @Override public void onClick(View v) { switch (v.getId()) { // 选择日期 case R.id.btn_datePicker: setDataPicker(); break; // 保存 case R.id.btn_save: saveInAccountInfo(); break; // 取消 case R.id.btn_cancle: showAlertDialog(); break; default: break; } } /**************************************** 日期选择器相关 ***************************************/ private DatePickerDialog.OnDateSetListener listener = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker arg0, int arg1, int arg2, int arg3) { cal.set(Calendar.YEAR, arg1); cal.set(Calendar.MONTH, arg2); cal.set(Calendar.DAY_OF_MONTH, arg3); updateDate(); } }; // 当 DatePickerDialog 关闭,更新日期显示 private void updateDate() { df = new SimpleDateFormat("yyyy-MM-dd"); et_time.setText(df.format(cal.getTime())); } private void setDataPicker() { // 构建一个 DatePickerDialog 并显示 new DatePickerDialog(this, listener, cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH)).show(); } /******************************************************************************************/ /* * 保存新增收入数据 */ private void saveInAccountInfo() { InAccount inAccount = new InAccount(); String inputMoney = et_money.getText().toString().trim(); String inputTime = et_time.getText().toString().trim(); if (TextUtils.isEmpty(inputMoney) || TextUtils.isEmpty(inputTime)) { Toast.makeText(this, "金额和时间为必填项", 0).show(); return; } inAccount.setMoney(Float.valueOf(inputMoney)); inAccount.setTime(inputTime); inAccount.setType(sp_type.getSelectedItem().toString()); inAccount.setHandler(et_handler.getText().toString()); inAccount.setMark(et_mark.getText().toString()); Boolean flag = dbManager.saveInAccountInfo(inAccount); if (flag) { // 保存成功,启动我的收入Activity Toast.makeText(this, "保存成功", 0).show(); Intent intent = new Intent(this, InAccountInfoActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } else { // 保存失败 Toast.makeText(this, "系统繁忙,请重试", 0).show(); } } /* * 出现对话框询问是否取消保存 */ private void showAlertDialog() { AlertDialog.Builder dialog = new Builder(this); dialog.setTitle("提示"); dialog.setMessage("取消新增收入并返回?"); dialog.setPositiveButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); } }); dialog.setNegativeButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); dialog.create(); dialog.show(); } }
[ "nongweiyilady@163.com" ]
nongweiyilady@163.com
7514d0cbfc11c05834f23386020b55a4b4b48fab
d6fc905c3380d1a473e1768ef9b1bb66917920e9
/app/src/androidTest/java/redlocks/app/myviewandviews/ExampleInstrumentedTest.java
5d3cad6f1e35f224fdb46329acf4311ae9210b77
[]
no_license
faizkhoiron/viewgroup
b9333bc9be4c8965f8574920dbcd73f51f592f87
dab9a94910b335853315b084f7431131da5621d1
refs/heads/master
2020-04-19T15:18:32.936305
2019-01-30T04:05:54
2019-01-30T04:05:54
168,269,848
0
0
null
null
null
null
UTF-8
Java
false
false
738
java
package redlocks.app.myviewandviews; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("redlocks.app.myviewandviews", appContext.getPackageName()); } }
[ "yapimda@gmail.com" ]
yapimda@gmail.com
63a26b6774da13494199e7bb3348c6e5dc056aca
7f8b19cf613c3cb2af24794a6945e4d65f6e66a5
/src/main/java/ci/dcg/visionzero/notationquestion/NotationQuestionService.java
8145e26921561f9ad6190487fa02bfede0ecaee6
[]
no_license
syliGaye/visionzero
db714bd73199d975657d4225fc4a06afca3ab92e
afbf5c1fe82d9bb914a63f0c0164b3a284ecf7cb
refs/heads/master
2021-08-07T15:55:43.827878
2021-07-01T09:11:24
2021-07-01T09:11:24
174,563,135
0
0
null
null
null
null
UTF-8
Java
false
false
769
java
package ci.dcg.visionzero.notationquestion; import ci.dcg.visionzero.support.ServiceFactory; import java.util.List; public interface NotationQuestionService extends ServiceFactory<NotationQuestion, String> { List<NotationQuestion> findAllByQuestion(String codeQuestion); List<NotationQuestion> findAllByReponse(String codeReponse); List<NotationQuestion> findAllByEntreprise(String codeEntreprise); NotationQuestion findByQuestionnaireAndReponseAndEntreprise(String codeQuestion, String codeReponse, String codeEntreprise); NotationQuestion findByQuestionnaireAndEntreprise(String codeQuestion, String codeEntreprise); int countByReponse(String codeReponse); int countByQuestion(String codeQuestion); int countByEntreprise(String codeEntreprise); }
[ "sylvestregaye@gmail.com" ]
sylvestregaye@gmail.com
361fa7f18e32448bc7d7c4b2e88e284ac28aae74
4b1fe6196be3f2a56daa768d2001071ec2b3689b
/src/composite/shapes/CompoundShape.java
4f52ceeb43a89275bb4224746fccb9c8415cfada
[]
no_license
Ilmak17/DesignPatterns
0a01a6752cdae2ae1715c3c301fb6c6ab23a1443
eb0fe08517f3a9c8e277d818fd2e221e9212c738
refs/heads/master
2022-11-30T13:36:44.183661
2020-08-03T13:30:11
2020-08-03T13:30:11
284,707,422
0
0
null
null
null
null
UTF-8
Java
false
false
3,286
java
package composite.shapes; import java.awt.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class CompoundShape extends BaseShape { protected List<Shape> children = new ArrayList<>(); public CompoundShape(Shape... components) { super(0,0, Color.BLACK); add(components); } public void add(Shape component) { children.add(component); } public void add(Shape... components) { children.addAll(Arrays.asList(components)); } public void remove(Shape child) { children.remove(child); } public void remove(Shape... components) { children.removeAll(Arrays.asList(components)); } public void clear() { children.clear(); } @Override public int getX() { if (children.size() == 0) { return 0; } int x = children.get(0).getX(); for (Shape child : children) { if (child.getX() < x) { x = child.getX(); } } return x; } @Override public int getY() { if (children.size() == 0) { return 0; } int y = children.get(0).getY(); for (Shape child : children) { if (child.getY() < y) { y = child.getY(); } } return y; } @Override public int getWidth() { int maxWidth = 0; int x = getX(); for (Shape child : children) { int childsRelativeX = child.getX() - x; int childWidth = childsRelativeX + child.getWidth(); if (childWidth > maxWidth) { maxWidth = childWidth; } } return maxWidth; } @Override public int getHeight() { int maxHeight = 0; int y = getY(); for (Shape child : children) { int childsRelativeY = child.getY() - y; int childHeight = childsRelativeY + child.getHeight(); if (childHeight > maxHeight) { maxHeight = childHeight; } } return maxHeight; } @Override public void move(int x, int y) { for (Shape child : children) { child.move(x, y); } } @Override public boolean isInsideBounds(int x, int y) { for (Shape child : children) { if (child.isInsideBounds(x, y)) { return true; } } return false; } @Override public void unSelect() { super.unSelect(); for (Shape child : children) { child.unSelect(); } } public boolean selectChildAt(int x, int y) { for (Shape child : children) { if (child.isInsideBounds(x, y)) { child.select(); return true; } } return false; } @Override public void paint(Graphics graphics) { if (isSelected()) { enableSelectionStyle(graphics); graphics.drawRect(getX() - 1, getY() - 1, getWidth() + 1, getHeight() + 1); disableSelectionStyle(graphics); } for (Shape child : children) { child.paint(graphics); } } }
[ "Ilmak1704@gmail.com" ]
Ilmak1704@gmail.com
8dfd9da8416a78e1693107a9ae110e10ea7473ec
2ce496d562a933e26199cfc90aa4ad52ab36230b
/src/main/java/com/vferneda/minhaprevisaodotempo/model/dto/openweather/OpenWeatherListCloudsDTO.java
e2e3205972f4de6fb46cc3c5af99b5b61d3e818a
[]
no_license
viniciusferneda/minhaprevisaodotempo
a7bb96de2760a5b4a1ed28ead37e0772525905a5
2931c03a50bab825dccb4ea9be1278926ee0e842
refs/heads/master
2020-09-16T16:54:14.272739
2019-11-28T14:46:17
2019-11-28T14:46:17
223,835,431
0
0
null
null
null
null
UTF-8
Java
false
false
300
java
package com.vferneda.minhaprevisaodotempo.model.dto.openweather; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Data @Builder @NoArgsConstructor @AllArgsConstructor public class OpenWeatherListCloudsDTO { private Integer all; }
[ "vinicius.ferneda@gmail.com" ]
vinicius.ferneda@gmail.com
040cfd05d585092aac0184b34e6f688dd83b008e
05825dcffa3cc572ea2c4449c7c6828480434fb1
/src/main/java/com/javampire/openscad/references/OpenSCADModuleReference.java
2329abf5f2616e33230cfbfcf84a621c4869557d
[]
no_license
covers1624/idea-openscad
3d980e7ee61108bc7a2b473cda9a67b51d7a1c4f
566ba6b1313b83c811ff97c5c17a15cf810f7461
refs/heads/master
2020-05-20T15:41:16.003199
2018-11-02T10:48:48
2018-11-02T10:48:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,397
java
package com.javampire.openscad.references; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.TextRange; import com.intellij.psi.*; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.util.ArrayUtil; import com.javampire.openscad.psi.OpenSCADModuleDeclaration; import com.javampire.openscad.psi.OpenSCADNamedElement; import com.javampire.openscad.psi.stub.index.OpenSCADModuleIndex; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.List; public class OpenSCADModuleReference extends PsiReferenceBase<OpenSCADNamedElement> implements PsiPolyVariantReference { private static final Logger LOG = Logger.getInstance("#com.javampire.openscad.references.OpenSCADModuleReference"); private String moduleName; public OpenSCADModuleReference(@NotNull OpenSCADNamedElement element, TextRange textRange) { super(element, textRange); moduleName = element.getName(); } @NotNull @Override public ResolveResult[] multiResolve(boolean incompleteCode) { Project project = myElement.getProject(); final Collection<OpenSCADModuleDeclaration> modules = OpenSCADModuleIndex.getInstance().get(this.moduleName, project, GlobalSearchScope.allScope(project)); LOG.debug("multiResolve modules:" + modules); final List<ResolveResult> results = new ArrayList<ResolveResult>(); for (OpenSCADModuleDeclaration module : modules) { results.add(new PsiElementResolveResult(module)); } LOG.debug("multiResolve results:" + results); return results.toArray(new ResolveResult[0]); } @Nullable @Override public PsiElement resolve() { LOG.debug("resolve called"); final ResolveResult[] resolveResults = multiResolve(false); return resolveResults.length == 1 ? resolveResults[0].getElement() : null; } @NotNull @Override public Object[] getVariants() { // TODO: implement (this is used for code completion) LOG.debug("getVariants called"); return ArrayUtil.EMPTY_OBJECT_ARRAY; } @Override public String toString() { return "ModuleReference(" + this.moduleName + ", " + getRangeInElement() + ")"; } }
[ "csaba.nagy@mapp.com" ]
csaba.nagy@mapp.com
dd1e5bfa6f3c9e488e3e4ad0047931e674273f8f
98430d682cc89cae7513f7341d481e008abf4a24
/src/main/java/fr/kyolo/restrictormod/RestrictorItem.java
28928e89bde729c8a20e55833a43afd81526dad2
[]
no_license
Kyolo/Restrictor-Mod
9502921a1ce3d9295621e436b98b602ab2c21eae
f87ff885d3fd7a04ebd338a9f4e95118bfc96161
refs/heads/master
2021-01-20T20:24:39.089732
2016-07-28T18:46:24
2016-07-28T18:46:24
64,399,288
0
0
null
null
null
null
UTF-8
Java
false
false
2,378
java
package fr.kyolo.restrictormod; import java.util.List; import fr.kyolo.restrictormod.restrictor.Restrictor; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ChatComponentText; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class RestrictorItem extends Item { private final String name; public RestrictorItem(){ name = "restrictorItem"; setUnlocalizedName(RestrictorMod.MODID+"_"+name); setTextureName(RestrictorMod.MODID+":itemRestrict"); setMaxStackSize(1); setHasSubtypes(true); setCreativeTab(CreativeTabs.tabMisc); } @Override public boolean onItemUse(ItemStack itemStack, EntityPlayer plr, World wrld, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { if(wrld.isRemote) return false; if((Restrictor.isPlayerInOneGroup(plr.getDisplayName()))&&(!Restrictor.isPlayerInDefaultGroup(plr.getDisplayName()))){ plr.addChatComponentMessage(new ChatComponentText("You already are in a group")); return false; } boolean playerWasInGroup = Restrictor.isPlayerInOneGroup(plr.getDisplayName()); int groupNum = MathHelper.clamp_int(itemStack.getItemDamage(), 0, Restrictor.getGroupNumber()); Restrictor.addPlayerToGroup(groupNum, plr.getDisplayName()); if(playerWasInGroup) Restrictor.removePlayerFromGroup(plr.getDisplayName(), "default"); plr.inventory.consumeInventoryItem(itemStack.getItem()); return true; } @Override public void addInformation(ItemStack item, EntityPlayer plr, List list, boolean p_77624_4_) { list.add("Linked to : "+Restrictor.getGroupByNumber(item.getItemDamage()).getGroupName()); if((Restrictor.isPlayerInOneGroup(plr.getDisplayName()))&&(!Restrictor.isPlayerInDefaultGroup(plr.getDisplayName()))){ list.add("You already are in a group"); } else { list.add("Right click to use"); } super.addInformation(item, plr, list, p_77624_4_); } @Override public void getSubItems(Item item, CreativeTabs tabs, List lst) { for(int i = 0; i < Restrictor.getGroupNumber();i++){ lst.add(new ItemStack(this, i)); } } }
[ "Kyolo@users.noreply.github.com" ]
Kyolo@users.noreply.github.com
6c005ed49b866e3c49fa9e3d2f9deffe32885446
acba6f76e4a15e31a3b225241610d2bb52f17f6b
/exec/java-exec/src/main/java/org/apache/drill/exec/physical/resultSet/project/Qualifier.java
976f968f2d4e99094afdbe51c13233e865fd723c
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "MIT", "LicenseRef-scancode-unknown" ]
permissive
apache/drill
c273c928be0ea6c32b9cc627f817893fe6f36d35
aa52f05c33b786c5eda002e713ccfee7722753fc
refs/heads/master
2023-08-31T09:52:49.660378
2023-08-29T15:44:04
2023-08-29T15:44:04
5,683,653
1,725
1,006
Apache-2.0
2023-08-25T13:52:24
2012-09-05T07:00:26
Java
UTF-8
Java
false
false
4,152
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.drill.exec.physical.resultSet.project; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.stream.Collectors; import org.apache.drill.exec.physical.resultSet.project.RequestedTuple.TupleProjectionType; /** * Represents one level of qualifier for a column. Analogous to * a {@code SchemaPath}, but represents the result of coalescing * multiple occurrences of the same column. */ public class Qualifier implements QualifierContainer { /** * Marker to indicate that that a) the item is an * array, and b) that all indexes are to be projected. * Used when seeing both a and a[x]. */ private static final Set<Integer> ALL_INDEXES = new HashSet<>(); private Set<Integer> indexes; private RequestedTuple members; private Qualifier child; @Override public Qualifier qualifier() { return child; } @Override public Qualifier requireQualifier() { if (child == null) { child = new Qualifier(); } return child; } public boolean isArray() { return indexes != null; } public boolean hasIndexes() { return isArray() && indexes != ALL_INDEXES; } public boolean hasIndex(int index) { return hasIndexes() && indexes.contains(index); } public int maxIndex() { if (! hasIndexes()) { return 0; } int max = 0; for (final Integer index : indexes) { max = Math.max(max, index); } return max; } public boolean[] indexArray() { if (! hasIndexes()) { return null; } final int max = maxIndex(); final boolean map[] = new boolean[max+1]; for (final Integer index : indexes) { map[index] = true; } return map; } public boolean isTuple() { return members != null || (child != null && child.isTuple()); } public RequestedTuple tuple() { if (members != null) { return members; } if (child != null) { return child.tuple(); } else { return null; } } protected void addIndex(int index) { if (indexes == null) { indexes = new HashSet<>(); } if (indexes != ALL_INDEXES) { indexes.add(index); } } protected void projectAllElements() { indexes = ALL_INDEXES; } public int arrayDims() { if (!isArray()) { return 0; } else if (child == null) { return 1; } else { return 1 + child.arrayDims(); } } public void projectAllMembers() { if (members == null || members.type() != TupleProjectionType.ALL) { members = ImpliedTupleRequest.ALL_MEMBERS; } } public RequestedTupleImpl explicitMembers() { if (members == null) { members = new RequestedTupleImpl(); } if (members.type() == TupleProjectionType.SOME) { return (RequestedTupleImpl) members; } else { return null; } } @Override public String toString() { StringBuilder buf = new StringBuilder(); if (isArray()) { buf.append("["); if (indexes == ALL_INDEXES) { buf.append("*"); } else { List<String> idxs = indexes.stream().sorted().map(i -> Integer.toString(i)).collect(Collectors.toList()); buf.append(String.join(", ", idxs)); } buf.append("]"); } if (members != null) { buf.append(members.toString()); } return buf.toString(); } }
[ "anton5813@gmail.com" ]
anton5813@gmail.com
81ccab41d5f6576a9e5aaf1f42359c770551d4fd
365b59229710d5b387e00f924ac0087102cb97c9
/framework/jcompany_commons/src/main/java/com/powerlogic/jcompany/domain/validation/PlcValExactSizeValidator.java
0f389535831c5db75390e48fc8a071881383e743
[]
no_license
iecker/jaguar615
a8045ad4729b8fe572d13cb91239b9cca81d5383
4b2658738dac4fb93dd52489de640c7f3de4e782
refs/heads/master
2020-04-21T15:20:20.126020
2018-05-25T15:14:03
2018-05-25T15:14:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,185
java
/* Jaguar-jCompany Developer Suite. Powerlogic 2010-2014. Please read licensing information in your installation directory.Contact Powerlogic for more information or contribute with this project: suporte@powerlogic.com.br - www.powerlogic.com.br */ package com.powerlogic.jcompany.domain.validation; import java.io.Serializable; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; /** * Validação para Tamanho exato de propriedades */ public class PlcValExactSizeValidator implements ConstraintValidator<PlcValExactSize, String>, Serializable { private static final long serialVersionUID = 1L; private int size; public void initialize(PlcValExactSize parameters) { size = parameters.size(); } public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) { if ( value == null ) return true; if ( !( value instanceof String ) ) return false; String string = (String) value; int length = string.length(); return length == size; } }
[ "josivan.silva@castgroup.com.br" ]
josivan.silva@castgroup.com.br
587364361d6ec1dc8a7440b4a9f416c958ab30c9
82f581a93c6e619c1417fcf7e67e6af180701999
/cagrid/Software/core/caGrid/projects/cql/src/java/utils/org/cagrid/cql/utilities/CQL2toCQL1Converter.java
099905fade9d56216963d7e9da1c3363a912cbe1
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
NCIP/cagrid
e9ad9121d41d03185df7b1f08381ad19745a0ce6
b1b99fdeaa4d4f15117c01c5f1e5eeb2cb8180bb
refs/heads/master
2023-03-13T15:50:00.120900
2014-04-02T19:15:14
2014-04-02T19:15:14
9,086,195
0
1
null
null
null
null
UTF-8
Java
false
false
10,549
java
package org.cagrid.cql.utilities; import gov.nih.nci.cagrid.cqlquery.Association; import gov.nih.nci.cagrid.cqlquery.Attribute; import gov.nih.nci.cagrid.cqlquery.CQLQuery; import gov.nih.nci.cagrid.cqlquery.Group; import gov.nih.nci.cagrid.cqlquery.LogicalOperator; import gov.nih.nci.cagrid.cqlquery.Object; import gov.nih.nci.cagrid.cqlquery.Predicate; import gov.nih.nci.cagrid.cqlquery.QueryModifier; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.HashMap; import java.util.Map; import org.cagrid.cql2.Aggregation; import org.cagrid.cql2.AttributeValue; import org.cagrid.cql2.BinaryPredicate; import org.cagrid.cql2.CQLAssociatedObject; import org.cagrid.cql2.CQLAttribute; import org.cagrid.cql2.CQLGroup; import org.cagrid.cql2.CQLObject; import org.cagrid.cql2.CQLQueryModifier; import org.cagrid.cql2.DistinctAttribute; import org.cagrid.cql2.GroupLogicalOperator; import org.cagrid.cql2.NamedAttribute; import org.cagrid.cql2.UnaryPredicate; public class CQL2toCQL1Converter { private static Map<BinaryPredicate, Predicate> binaryPredicateConversion = null; private static Map<UnaryPredicate, Predicate> unaryPredicateConversion = null; static { binaryPredicateConversion = new HashMap<BinaryPredicate, Predicate>(); unaryPredicateConversion = new HashMap<UnaryPredicate, Predicate>(); binaryPredicateConversion.put(BinaryPredicate.EQUAL_TO, Predicate.EQUAL_TO); binaryPredicateConversion.put(BinaryPredicate.GREATER_THAN, Predicate.GREATER_THAN); binaryPredicateConversion.put(BinaryPredicate.GREATER_THAN_EQUAL_TO, Predicate.GREATER_THAN_EQUAL_TO); binaryPredicateConversion.put(BinaryPredicate.LESS_THAN, Predicate.LESS_THAN); binaryPredicateConversion.put(BinaryPredicate.LESS_THAN_EQUAL_TO, Predicate.LESS_THAN_EQUAL_TO); binaryPredicateConversion.put(BinaryPredicate.LIKE, Predicate.LIKE); binaryPredicateConversion.put(BinaryPredicate.NOT_EQUAL_TO, Predicate.NOT_EQUAL_TO); unaryPredicateConversion.put(UnaryPredicate.IS_NOT_NULL, Predicate.IS_NOT_NULL); unaryPredicateConversion.put(UnaryPredicate.IS_NULL, Predicate.IS_NULL); } private CQL2toCQL1Converter() { } public static CQLQuery convertToCql1Query(org.cagrid.cql2.CQLQuery cql2Query) throws QueryConversionException { assertNoAssociationPopulation(cql2Query); assertValidAggregation(cql2Query); CQLQuery query = new CQLQuery(); Object target = convertObject(cql2Query.getCQLTargetObject()); query.setTarget(target); if (cql2Query.getCQLQueryModifier() != null) { QueryModifier mods = convertQueryModifier(cql2Query.getCQLQueryModifier()); query.setQueryModifier(mods); } return query; } private static void assertNoAssociationPopulation(org.cagrid.cql2.CQLQuery query) throws QueryConversionException { if (query.getAssociationPopulationSpecification() != null) { throw new QueryConversionException("Association population is not supported in CQL 1"); } } private static void assertValidAggregation(org.cagrid.cql2.CQLQuery query) throws QueryConversionException { CQLQueryModifier mods = query.getCQLQueryModifier(); if (mods != null && mods.getDistinctAttribute() != null && mods.getDistinctAttribute().getAggregation() != null) { Aggregation agg = mods.getDistinctAttribute().getAggregation(); if (!agg.equals(Aggregation.COUNT)) { throw new QueryConversionException("CQL 1 does not support aggregations of the type " + agg.getValue()); } } } private static Object convertObject(CQLObject cql2Object) throws QueryConversionException { if (cql2Object.get_instanceof() != null) { throw new QueryConversionException("CQL 1 does not support \"instanceof\" operations"); } if (cql2Object.getCQLExtension() != null) { throw new QueryConversionException("CQL 1 does not support query extensions"); } Object o = new Object(); o.setName(cql2Object.getClassName()); if (cql2Object.getCQLAssociatedObject() != null) { Association assoc = convertAssociation(cql2Object.getCQLAssociatedObject()); o.setAssociation(assoc); } if (cql2Object.getCQLAttribute() != null) { Attribute attr = convertAttribute(cql2Object.getCQLAttribute()); o.setAttribute(attr); } if (cql2Object.getCQLGroup() != null) { Group g = convertGroup(cql2Object.getCQLGroup()); o.setGroup(g); } return o; } private static Association convertAssociation(CQLAssociatedObject cql2Association) throws QueryConversionException { Object base = convertObject(cql2Association); Association assoc = new Association(); assoc.setAssociation(base.getAssociation()); assoc.setAttribute(base.getAttribute()); assoc.setGroup(base.getGroup()); assoc.setName(base.getName()); assoc.setRoleName(cql2Association.getEndName()); return assoc; } private static Attribute convertAttribute(CQLAttribute cql2Attribute) throws QueryConversionException { if (cql2Attribute.getAttributeExtension() != null) { throw new QueryConversionException("CQL 1 does not support query extensions"); } Attribute attr = new Attribute(); attr.setName(cql2Attribute.getName()); Predicate pred = null; if (cql2Attribute.getBinaryPredicate() != null) { pred = binaryPredicateConversion.get(cql2Attribute.getBinaryPredicate()); attr.setValue(getAttributeValueAsString(cql2Attribute.getAttributeValue())); } else { pred = unaryPredicateConversion.get(cql2Attribute.getUnaryPredicate()); } attr.setPredicate(pred); return attr; } private static String getAttributeValueAsString(AttributeValue value) throws QueryConversionException { String string = null; if (value.getStringValue() != null) { string = value.getStringValue(); } else if (value.getBooleanValue() != null) { string = value.getBooleanValue().toString(); } else if (value.getDateValue() != null) { // conforms to xsd:date per http://www.w3schools.com/schema/schema_dtypes_date.asp SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); string = format.format(value.getDateValue()); } else if (value.getDoubleValue() != null) { string = value.getDoubleValue().toString(); } else if (value.getIntegerValue() != null) { string = value.getIntegerValue().toString(); } else if (value.getLongValue() != null) { string = value.getLongValue().toString(); } else if (value.getTimeValue() != null) { string = DateFormat.getTimeInstance().format( value.getTimeValue()); } else { // no value??? throw new QueryConversionException("No attribute value found to convert!"); } return string; } private static Group convertGroup(CQLGroup cql2Group) throws QueryConversionException { if (cql2Group.getCQLExtension() != null) { throw new QueryConversionException("CQL 1 does not support query extensions"); } Group group = new Group(); group.setLogicRelation(cql2Group.getLogicalOperation() == GroupLogicalOperator.AND ? LogicalOperator.AND : LogicalOperator.OR); if (cql2Group.getCQLAssociatedObject() != null) { Association[] associations = new Association[cql2Group.getCQLAssociatedObject().length]; for (int i = 0; i < cql2Group.getCQLAssociatedObject().length; i++) { associations[i] = convertAssociation(cql2Group.getCQLAssociatedObject(i)); } group.setAssociation(associations); } if (cql2Group.getCQLAttribute() != null) { Attribute[] attributes = new Attribute[cql2Group.getCQLAttribute().length]; for (int i = 0; i < cql2Group.getCQLAttribute().length; i++) { attributes[i] = convertAttribute(cql2Group.getCQLAttribute(i)); } group.setAttribute(attributes); } if (cql2Group.getCQLGroup() != null) { Group[] groups = new Group[cql2Group.getCQLGroup().length]; for (int i = 0; i < cql2Group.getCQLGroup().length; i++) { groups[i] = convertGroup(cql2Group.getCQLGroup(i)); } group.setGroup(groups); } return group; } private static QueryModifier convertQueryModifier(CQLQueryModifier cql2Modifier) throws QueryConversionException { QueryModifier modifier = new QueryModifier(); if (cql2Modifier.getCountOnly() != null && cql2Modifier.getCountOnly().booleanValue()) { modifier.setCountOnly(true); } if (cql2Modifier.getDistinctAttribute() != null) { DistinctAttribute da = cql2Modifier.getDistinctAttribute(); if (da.getAggregation() != null) { if (Aggregation.COUNT.equals(da.getAggregation())) { modifier.setCountOnly(true); } else { throw new QueryConversionException("Aggregation " + da.getAggregation().getValue() + " is not supported in CQL 1"); } } modifier.setDistinctAttribute(da.getAttributeName()); } else if (cql2Modifier.getNamedAttribute() != null && cql2Modifier.getNamedAttribute().length != 0) { NamedAttribute[] namedAttribs = cql2Modifier.getNamedAttribute(); String[] names = new String[namedAttribs.length]; for (int i = 0; i < namedAttribs.length; i++) { names[i] = namedAttribs[i].getAttributeName(); } modifier.setAttributeNames(names); } return modifier; } }
[ "ervind" ]
ervind
3c2d24d341790925756e974e4011db878f3a9000
2e26ceac10d166fe4ee74219d5c1e61418f21188
/questone/fourthlevel/lecture13/Rectangle.java
12f39c5d095d51f3c94cc3e56defcc7fcfb65c66
[]
no_license
TimurDubov/JavaRush
c88835b64bb45c90a2f11cf60193c3845e4838d0
7786877b7a81496ef46498a1c911352cc8eb4cc8
refs/heads/master
2023-01-20T07:39:15.862943
2020-11-22T19:05:02
2020-11-22T19:05:02
315,110,507
0
0
null
null
null
null
UTF-8
Java
false
false
623
java
package questone.fourthlevel.lecture13; import java.io.BufferedReader; import java.io.InputStreamReader; public class Rectangle { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int y = Integer.parseInt(reader.readLine()); int x = Integer.parseInt(reader.readLine()); for (int i = 0; i < x; i++) { System.out.println(" "); for (int j = 0; j < y; j++) { System.out.print(8); } } //напишите тут ваш код } }
[ "tdubov@mail.ru" ]
tdubov@mail.ru
aae24959936de9016eb542242c9f4b73c011fbf6
bfc042b37296ec5e54f009bc0151bef232f9ffe2
/src/main/java/com/epam/rd/java/basic/practice5/Part4.java
ebccdb814bbf31e365f1c798bc456183e7047eb9
[]
no_license
HRABOVENSKYI/Multithreading-tasks
356b697342108020d79a31c11e35c14ef0f81260
f96de209879a1efbfd60628fadc711309f1efef7
refs/heads/main
2023-06-24T11:14:07.895855
2021-07-29T11:41:30
2021-07-29T11:41:30
390,704,174
0
0
null
null
null
null
UTF-8
Java
false
false
3,928
java
package com.epam.rd.java.basic.practice5; import java.io.*; import java.util.logging.Level; import static com.epam.rd.java.basic.practice5.Demo.logger; public class Part4 { private static final String FILENAME = "part4.txt"; private static final int NUM_OF_LINES; private static final Thread[] threads; static { NUM_OF_LINES = linesCount(FILENAME); threads = new Thread[NUM_OF_LINES]; } private static void maxWithMultithreading() { final long startTime = System.currentTimeMillis(); int[] nums = new int[NUM_OF_LINES]; try (BufferedReader br = new BufferedReader(new FileReader(FILENAME))) { String line; int i = 0; while ((line = br.readLine()) != null) { final String fLine = line; final int pos = i; threads[i] = new Thread(() -> lineMax(nums, pos, fLine)); threads[i].start(); i++; } } catch (IOException e) { logger.log(Level.SEVERE, e.getMessage(), e); } for (int i = 0; i < threads.length; i++) { try { threads[i].join(); } catch (InterruptedException e) { logger.log(Level.SEVERE, e.getMessage(), e); Thread.currentThread().interrupt(); } catch (NullPointerException e) { logger.log(Level.SEVERE, e.getMessage(), e); } } int max = max(nums); final long endTime = System.currentTimeMillis(); System.out.println(max); System.out.println(endTime - startTime); } private static void maxWithoutMultithreading() { final long startTime = System.currentTimeMillis(); int[] nums = new int[NUM_OF_LINES]; try (BufferedReader br = new BufferedReader(new FileReader(FILENAME))) { String line; int i = 0; while ((line = br.readLine()) != null) { lineMax(nums, i, line); i++; } } catch (IOException e) { logger.log(Level.SEVERE, e.getMessage(), e); } int max = max(nums); final long endTime = System.currentTimeMillis(); System.out.println(max); System.out.println(endTime - startTime); } public static int linesCount(String filename) { try (InputStream is = new BufferedInputStream(new FileInputStream(filename))) { byte[] c = new byte[1024]; int count = 1; int readChars; while ((readChars = is.read(c)) != -1) { for (int i = 0; i < readChars; ++i) { if (c[i] == '\n') { ++count; } } } return (count == 0) ? 1 : count; } catch (IOException e) { logger.log(Level.SEVERE, e.getMessage(), e); } return 0; } private static void lineMax(int[] nums, int pos, String localLine) { int localMax = 0; for (String number : localLine.split(" ")) { try { Thread.sleep(1); } catch (InterruptedException e) { logger.log(Level.SEVERE, e.getMessage(), e); Thread.currentThread().interrupt(); } int num = Integer.parseInt(number); if (num > localMax) { localMax = num; } } nums[pos] = localMax; } private static int max(int[] arr) { int i; int max = arr[0]; for (i = 1; i < Part4.NUM_OF_LINES; i++) { if (arr[i] > max) { max = arr[i]; } } return max; } public static void main(final String[] args) { maxWithMultithreading(); maxWithoutMultithreading(); } }
[ "teodor.gr.2002@gmail.com" ]
teodor.gr.2002@gmail.com
4c540e231b6f8ffdb31946a14a49490ed8105699
fa06977d4113564761dc53ae17c61c9fa80499b8
/src/main/java/com/divinitor/discord/wahrbot/core/module/ModuleManager.java
f67aef12ad3cf107e6a7d8942060261f55f94cfd
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
vincentzhang96/WahrBotCore
e4250441beab9c344c6ae511991a9189a364d6b1
579d9ae933160c5e84741227a33d53faa5c5b356
refs/heads/dev
2022-06-01T09:53:39.394813
2022-05-15T02:28:50
2022-05-15T02:28:50
100,992,601
0
0
MIT
2021-07-21T13:28:09
2017-08-21T21:06:24
Java
UTF-8
Java
false
false
1,383
java
package com.divinitor.discord.wahrbot.core.module; import com.github.zafarkhaja.semver.Version; import java.io.IOException; import java.util.Map; public interface ModuleManager { void unloadModule(String moduleId); void reloadModule(String moduleId, Version newVersion) throws ModuleLoadException; void reloadModule(String moduleId) throws ModuleLoadException; void loadModule(String moduleId, Version version) throws ModuleLoadException; void loadModule(String moduleId) throws ModuleLoadException; void loadLatestModulesFromList() throws ModuleLoadException; void saveCurrentModuleList() throws IOException; void unloadAll(); /** * Returns a map of all modules that are loaded. The returned map is unmodifiable and contains interally weak * references to the actual module handles and modules. This collection is safe to keep around and will not * prevent modules from being unloaded. However, storing Modules returned by the contained ModuleHandles is * <b>NOT</b> safe and should be kept only locally or in a WeakReference. If a module contained in this result * is unloaded, the corresponding {@link ModuleHandle}'s methods will throw an IllegalStateException. * * @return A Map of loaded modules, mapping module IDs to ModuleHandles. */ Map<String, ModuleHandle> getLoadedModules(); }
[ "vzhang@purdue.edu" ]
vzhang@purdue.edu
e0c0d9740516f8d58a71ea82469937f79aa62f87
df7414712221d6a7b74ed29026a60c491627d146
/src/main/java/cn/hejinyo/jelly/modules/wechat/service/WechatJokeService.java
d24fd6668aa92757bd0f644240da03f492880e91
[]
no_license
HejinYo/jelly
6df5ea59db5cf9f46690eec7285f62e1338f8127
8714562a6a11335dc5e2de10d7b3058178600a3c
refs/heads/master
2021-05-06T01:30:11.563155
2018-12-30T01:58:58
2018-12-30T01:58:58
114,379,800
0
0
null
null
null
null
UTF-8
Java
false
false
403
java
package cn.hejinyo.jelly.modules.wechat.service; import cn.hejinyo.jelly.common.base.BaseService; import cn.hejinyo.jelly.modules.wechat.model.WechatJoke; /** * @author : HejinYo hejinyo@gmail.com * @date : 2017/8/23 22:23 * @Description : */ public interface WechatJokeService extends BaseService<WechatJoke, Integer> { WechatJoke getRandomWechatJoke(); String weater(String citys); }
[ "hejinyo@gmail.com" ]
hejinyo@gmail.com
7f3f399a721ef40f3fedf5fcd5ec846f61e901a1
bfe4d17fd99926f42e5402766c8aec1a026fdf8d
/src/interfaces/CRUD_autor.java
334611f26edf714934e82bf640610318f3549cdf
[]
no_license
b3nj4hb/Proyecto_Integrador
8c06f19b70db27a4ba5612555c5177955fef4fbf
51a176339d063c8732b15474cecffbb8742c2b68
refs/heads/main
2023-02-01T11:19:43.711837
2020-12-17T01:46:11
2020-12-17T01:46:11
311,709,399
0
0
null
null
null
null
UTF-8
Java
false
false
315
java
package interfaces; import java.util.List; import modelo.Autor; public interface CRUD_autor { public List listarautor(); public Autor buscarautor(int idautor); public boolean agregarautor(Autor autor); public boolean editarautor(Autor autor); public boolean eliminarautor(int idautor); }
[ "pdhc2212@gmail.com" ]
pdhc2212@gmail.com
9b1c741c226b0e141ad24bc1a0deb8e79db80acb
263cabd52a41e74cbf1afa493f24c18a7e0a9c3f
/c&s/compare&search/src/main/java/scrape/bike/domain/Engine.java
3e023ca44b8e1c3d5feaf96b7fe7a2520d722152
[]
no_license
bibekshakya35/NLP
2e4cb1ffa951122683a3127f8d4e43c2acc9d746
127f4f75e4fd1c1d99f4d3498c15e9ec0d06fac5
refs/heads/master
2022-07-09T19:08:05.922237
2019-02-15T03:50:29
2019-02-15T03:50:29
102,276,875
0
0
null
2022-07-01T20:38:16
2017-09-03T16:09:31
Java
UTF-8
Java
false
false
1,790
java
package scrape.bike.domain; /** * @author bibek on 12/5/17 * @project compare&search */ public class Engine { private String engineType; private String power; private String bore; private String fuelSystem; private String ignition; private String engineDisplacement; private String torque; private String stroke; private FuelType fuelType; public String getEngineType() { return engineType; } public void setEngineType(String engineType) { this.engineType = engineType; } public String getPower() { return power; } public void setPower(String power) { this.power = power; } public String getBore() { return bore; } public void setBore(String bore) { this.bore = bore; } public String getFuelSystem() { return fuelSystem; } public void setFuelSystem(String fuelSystem) { this.fuelSystem = fuelSystem; } public String getIgnition() { return ignition; } public void setIgnition(String ignition) { this.ignition = ignition; } public String getEngineDisplacement() { return engineDisplacement; } public void setEngineDisplacement(String engineDisplacement) { this.engineDisplacement = engineDisplacement; } public String getTorque() { return torque; } public void setTorque(String torque) { this.torque = torque; } public String getStroke() { return stroke; } public void setStroke(String stroke) { this.stroke = stroke; } public FuelType getFuelType() { return fuelType; } public void setFuelType(FuelType fuelType) { this.fuelType = fuelType; } }
[ "bibekshakyanp@gmail.com" ]
bibekshakyanp@gmail.com
38ca1f03873d31cb899b1e1daf15b2e648c74648
8d657dd951529ae652ab68563d877aa39da98094
/app/src/main/java/brmnt/twiterpi/MainTwiter.java
7cd2ef44efc711eea22dba8562ec910cfd210758
[]
no_license
Bramengton/TwiterPI
e7e360406a3b675501eae5fad8dab7f32d85cf92
f7a1a94bc7cc9815c1983855feda98832f596de5
refs/heads/master
2020-12-03T00:35:35.978892
2017-07-04T18:08:23
2017-07-04T18:08:23
96,046,709
0
0
null
null
null
null
UTF-8
Java
false
false
409
java
package brmnt.twiterpi; import android.os.Bundle; import brmnt.twiterpi.fragments.Search; public class MainTwiter extends BaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_drawer); getActionBarToolbar(); setFragment(R.id.navSearch, Search.getInstance()).commit(); } }
[ "paladiym@gmail.com" ]
paladiym@gmail.com
728f4c250b028ff471011c333d46b4df29392ffa
6801b74ae39b7b4fcb8e8c24ec4def4c5b7c1e5b
/seata/order-service/src/test/java/fast/cloud/nacos/orderservice/OrderServiceApplicationTests.java
5910727e1be68e70b7610abde342d426386bd248
[]
no_license
wkaiwen/fast-cloud-nacos
626aeda2fb3c715fce57ede11d5817a6ec6e0828
6ce4e1b93b362d572ab93f317b4342a081848924
refs/heads/master
2023-03-13T08:18:39.596994
2021-03-03T03:33:27
2021-03-03T03:33:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
236
java
package fast.cloud.nacos.orderservice; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class OrderServiceApplicationTests { @Test void contextLoads() { } }
[ "17521222912@163.com" ]
17521222912@163.com
d1ccdfc51e1d08b1be04b2a96a9ddb30db5a76c5
27332714ed3acb8e135acdd3246997bb15dd09b0
/src/main/java/ru/smb/smb/service/BoxService.java
2e277019fd2aba2f4b0b603883dd15fe91f0843e
[]
no_license
source-store/smb
773b07c6321b5047be7d7a8c75ec092fa6a5cd59
e7d317033a9ad410be1f84f6a5cf8b6ca866b760
refs/heads/master
2023-08-17T13:26:21.669097
2021-09-26T14:14:02
2021-09-26T14:14:02
352,873,315
0
1
null
2021-05-20T11:55:49
2021-03-30T04:47:51
Java
UTF-8
Java
false
false
1,100
java
package ru.smb.smb.service; /* * @autor Alexandr.Yakubov **/ import org.springframework.stereotype.Service; import org.springframework.util.Assert; import ru.smb.smb.model.SmbBox; import ru.smb.smb.model.User; import ru.smb.smb.repository.BoxRepository; import ru.smb.smb.to.SmbBoxTo; import java.util.List; @Service public class BoxService { private final BoxRepository repository; public BoxService(BoxRepository repository) { this.repository = repository; } public List<SmbBox> getFromBox(User user) { Assert.isTrue(user.isSubscriber(), "User not access read from the box"); List<SmbBox> list = repository.getFromBox(user); return list; } public void createBox(User user) throws Exception { repository.createBox(user); } public void putToBox(List<SmbBoxTo> lists, User user) { Assert.isTrue(user.isPublisher(), "User not access to put in box"); repository.putToBox(lists, user); } public void delFromBox(List<SmbBox> lists, User user) { repository.delFromBox(lists, user); } }
[ "73580046+source-store@users.noreply.github.com" ]
73580046+source-store@users.noreply.github.com
cefaff0f5b8a0a62f6d1b3b9662019089891d52d
b369b34aad02d9cf485593e4eb1df6fea71b8b03
/src/main/java/com/broadcom/angularpoc/repository/UserRepository.java
cd7b7992bf0f88b8be7715df0af026d3646948f8
[]
no_license
Shivani524127/Angular-Backend
1c7326a87924e778b21990999cf7ebc013daad8a
68f76b7f0a12221b36587cb3011852f671b5a4dd
refs/heads/master
2022-05-29T18:37:24.411514
2020-05-04T11:32:11
2020-05-04T11:32:11
255,871,066
0
0
null
null
null
null
UTF-8
Java
false
false
459
java
package com.broadcom.angularpoc.repository; import java.util.List; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; import com.broadcom.angularpoc.entity.User; @Repository public interface UserRepository extends CrudRepository<User, Integer> { /** * @param email * @return */ @Query public List<User> findByEmail(String email); }
[ "shivaniagrawal@deloitte.com" ]
shivaniagrawal@deloitte.com
f02ee2400acb8c1f65226df4b34e7a6b1715bcdd
5e4523cf99063e41b316cff6a19d0c55d62b7614
/payment_api/src/main/java/nordea/models/PaymentMethodsRequest.java
2854b802cdacf6afc76e939009f6ab9c1a6c4d25
[]
no_license
rajesr/psp
df5f0d2d85dc4ba3388b23998f9590f5b5d41759
171eca13d70fff7267282d6ebea571fd14a19063
refs/heads/master
2021-04-29T06:45:43.383223
2017-01-03T08:52:24
2017-01-03T08:52:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
429
java
package nordea.models; import java.util.UUID; import static nordea.utils.Uuid.generate; public class PaymentMethodsRequest implements PaymentMethods { private Merchant merchant; private UUID uuid; public PaymentMethodsRequest() { this.uuid = generate(); } public Merchant getMerchant() { return merchant; } @Override public UUID getUuid() { return this.uuid; } }
[ "tommi.taskinen@vincit.com" ]
tommi.taskinen@vincit.com
3d5b25a705ca4fa53346c00b66b64c476ba16e68
eff05129e529a2d1b2b3d9a1743cd07161317eeb
/src/com/gitsina/coolweather/app/util/HttpUtil.java
35792107afefe8849644e9f642da25997a0648d9
[ "Apache-2.0" ]
permissive
gitsina/coolweather
ff2212d78d062c64b3351b3736a1e3988ba3c33d
f3b2a83f2615bdc74e049c7ad27c9808b9713d0d
refs/heads/master
2021-01-12T06:44:33.379818
2016-12-27T16:12:21
2016-12-27T16:12:21
77,432,757
0
0
null
null
null
null
GB18030
Java
false
false
1,277
java
package com.gitsina.coolweather.app.util; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class HttpUtil { public static void sendHttpRequest(final String address, final HttpCallbackListener listener) { new Thread(new Runnable() { @Override public void run() { HttpURLConnection connection = null; try { URL url = new URL(address); connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setConnectTimeout(8000); connection.setReadTimeout(8000); InputStream in = connection.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); StringBuilder response = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { response.append(line); } if (listener != null) { // 回调onFinish()方法 listener.onFinish(response.toString()); } } catch (Exception e) { if (listener != null) { // 回调onError()方法 listener.onError(e); } } finally { if (connection != null) { connection.disconnect(); } } } }).start(); } }
[ "mymail0@sina.com" ]
mymail0@sina.com
29db2cf2b52a7c42839d13ff2d1d06fe5512e45f
8494c17b608e144370ee5848756b7c6ae38e8046
/gulimall-product/src/main/java/com/atguigu/gulimall/product/entity/CategoryBrandRelationEntity.java
c9dfb570f8d7c190e278d019bef2647e6062e9ce
[ "Apache-2.0" ]
permissive
cchaoqun/SideProject1_GuliMall
b235ee01df30bc207c747cf281108006482a778a
aef4c26b7ed4b6d17f7dcadd62e725f5ee68b13e
refs/heads/main
2023-06-11T02:23:28.729831
2021-07-07T11:56:13
2021-07-07T11:56:13
375,354,919
0
0
null
null
null
null
UTF-8
Java
false
false
738
java
package com.atguigu.gulimall.product.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import java.io.Serializable; import java.util.Date; import lombok.Data; /** * 品牌分类关联 * * @author chengchaoqun * @email chengchaoqun@gmail.com * @date 2021-06-10 16:04:24 */ @Data @TableName("pms_category_brand_relation") public class CategoryBrandRelationEntity implements Serializable { private static final long serialVersionUID = 1L; /** * */ @TableId private Long id; /** * 品牌id */ private Long brandId; /** * 分类id */ private Long catelogId; /** * */ private String brandName; /** * */ private String catelogName; }
[ "chengchaoqun@hotmail.com" ]
chengchaoqun@hotmail.com
5aacacffe0e0b3fb5a743da402ea61f63071caeb
13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3
/crash-reproduction-new-fitness/results/XWIKI-13196-3-26-Single_Objective_GGA-IntegrationSingleObjective-BasicBlockCoverage/org/xwiki/model/reference/AttachmentReference_ESTest.java
545be83280195d484ea048f50aaeb9d4116ea437
[ "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
1,241
java
/* * This file was automatically generated by EvoSuite * Mon May 18 01:20:36 UTC 2020 */ package org.xwiki.model.reference; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.shaded.org.mockito.Mockito.*; import static org.evosuite.runtime.EvoAssertions.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.evosuite.runtime.ViolatedAssumptionAnswer; import org.junit.runner.RunWith; import org.xwiki.model.reference.AttachmentReference; import org.xwiki.model.reference.DocumentReference; @RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true) public class AttachmentReference_ESTest extends AttachmentReference_ESTest_scaffolding { @Test(timeout = 4000) public void test0() throws Throwable { DocumentReference documentReference0 = mock(DocumentReference.class, new ViolatedAssumptionAnswer()); AttachmentReference attachmentReference0 = new AttachmentReference("(h8D<jI\"<o", documentReference0); DocumentReference documentReference1 = mock(DocumentReference.class, new ViolatedAssumptionAnswer()); AttachmentReference attachmentReference1 = new AttachmentReference("", documentReference1); } }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
9d2d6016c456b96062eea10211820abe1c0b2229
6f30a7e11ac2867ae1c19ea6677f5be8568f7dce
/app/src/main/java/com/apps/miekeljerianto/belajarpakar/login/register/LoginActivity.java
f13cb063ed5f4803c553a7563ab99625e3937c07
[]
no_license
miekeljerianto/SistemPakarLoveBirdMJ
47bd00d4990af5da02b87f108777268e9fd913b5
b1202a2eab23b6af67a39d1c97bd45f88b09ab67
refs/heads/master
2020-04-11T18:38:53.793965
2018-12-16T14:01:11
2018-12-16T14:01:11
162,006,342
0
0
null
null
null
null
UTF-8
Java
false
false
4,061
java
package com.apps.miekeljerianto.belajarpakar.login.register; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Patterns; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.apps.miekeljerianto.belajarpakar.Index; import com.apps.miekeljerianto.belajarpakar.R; import com.apps.miekeljerianto.belajarpakar.User; import com.apps.miekeljerianto.belajarpakar.database.DBHelper; public class LoginActivity extends AppCompatActivity { EditText email_edittext; EditText password_edittext; Button login_button; TextView donthave_textView; TextView create_account_textView; DBHelper dbHelper; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); dbHelper = new DBHelper( this ); email_edittext = findViewById( R.id.email_edittext_login_activity ); password_edittext = findViewById( R.id.password_edittext_login_activity ); login_button = findViewById( R.id.login_button_login_acitvity ); donthave_textView = findViewById( R.id.Dont_have_account_textview_Login_activity ); create_account_textView = findViewById( R.id.create_account_login_activity ); create_account_textView.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent myintent = new Intent( LoginActivity.this,RegisterActivity.class ); startActivity( myintent ); } } ); //set click event of login button login_button.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { //check user input is correct or not if(validate()){ //get values from edittext fields String Email = email_edittext.getText().toString(); String Password = password_edittext.getText().toString(); //authenticating user in database User currentUser = dbHelper.Authenticate(new User(null,null,Email,Password)); //check Authentication is successful or not if(currentUser != null){ Toast.makeText( getApplicationContext(),"Login Success",Toast.LENGTH_SHORT ).show(); //user login successfully now opening next activity Intent intent = new Intent( LoginActivity.this, Index.class ); startActivity( intent ); finish(); }else{ //user logged in failed Toast.makeText( getApplicationContext(),"Login Failed",Toast.LENGTH_SHORT ).show(); } } } } ); } public boolean validate(){ boolean valid = false; //get values from Edittext field String Email = email_edittext.getText().toString(); String Password = password_edittext.getText().toString(); //handling validation for Email field if(!Patterns.EMAIL_ADDRESS.matcher( Email ).matches()){ valid = false; Toast.makeText( this,"Please Enter A valid email address",Toast.LENGTH_SHORT ).show(); }else{ valid = true; } //handling validation for password field if(Password.isEmpty()){ valid = false; Toast.makeText( this,"Please Enter Valid Password",Toast.LENGTH_SHORT ).show(); }else { if(Password.length()>5){ valid = true; }else{ valid = false; Toast.makeText( this,"Password is too Short",Toast.LENGTH_LONG ).show(); } } return valid; } }
[ "miekeljerianto@gmail.com" ]
miekeljerianto@gmail.com
c25f4b8f3558dcdcf326cd1c8e2e3f9c40c3b376
8d8b3d295b4a45a1226755ecaffd37065edd8e56
/src/main/java/com/zmm/diary/bean/Hotspot.java
9e3d146e0b2aef1d62b5390be54c7a9d461b642e
[]
no_license
Giousa/Diray
61b7da13c65085ba8df30e911ec4345a672a41f0
15c55373af75d930f8d7541982b3d65cd98dc209
refs/heads/master
2020-04-04T02:04:18.541072
2019-04-17T03:22:05
2019-04-17T03:22:05
155,688,103
0
0
null
null
null
null
UTF-8
Java
false
false
876
java
package com.zmm.diary.bean; import lombok.Data; import org.hibernate.annotations.DynamicUpdate; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import javax.persistence.Entity; import javax.persistence.EntityListeners; import javax.persistence.Id; import java.util.Date; /** * Description: * Author:zhangmengmeng * Date:2018/11/1 * Email:65489469@qq.com */ @Entity @Data @EntityListeners(AuditingEntityListener.class) @DynamicUpdate public class Hotspot { @Id private String id; private String uId; private String pic; private String content; private int collect; private int appreciate; @CreatedDate private Date createTime; @LastModifiedDate private Date updateTime; }
[ "65489469@qq.com" ]
65489469@qq.com
b54561f3343deab9875539678d98a161e5eb918a
20eb62855cb3962c2d36fda4377dfd47d82eb777
/newEvaluatedBugs/Jsoup_28_buggy/mutated/1129/HtmlTreeBuilderState.java
eb58a7ee04d5d776df9723ef3414b29b3cb89467
[]
no_license
ozzydong/CapGen
356746618848065cce4e253e5d3c381baa85044a
0ba0321b6b1191443276021f1997833342f02515
refs/heads/master
2023-03-18T20:12:02.923428
2020-08-21T03:08:28
2020-08-21T03:08:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
70,278
java
package org.jsoup.parser; import org.jsoup.helper.DescendableLinkedList; import org.jsoup.helper.StringUtil; import org.jsoup.nodes.*; import java.util.Iterator; import java.util.LinkedList; /** * The Tree Builder's current state. Each state embodies the processing for the state, and transitions to other states. */ enum HtmlTreeBuilderState { Initial { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { return true; // ignore whitespace } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { // todo: parse error check on expected doctypes // todo: quirk state check on doctype ids Token.Doctype d = t.asDoctype(); DocumentType doctype = new DocumentType(d.getName(), d.getPublicIdentifier(), d.getSystemIdentifier(), tb.getBaseUri()); tb.getDocument().appendChild(doctype); if (d.isForceQuirks()) tb.getDocument().quirksMode(Document.QuirksMode.quirks); tb.transition(BeforeHtml); } else { // todo: check not iframe srcdoc tb.transition(BeforeHtml); return tb.process(t); // re-process token } return true; } }, BeforeHtml { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isDoctype()) { tb.error(this); return false; } else if (t.isComment()) { tb.insert(t.asComment()); } else if (isWhitespace(t)) { return true; // ignore whitespace } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { tb.insert(t.asStartTag()); tb.transition(BeforeHead); } else if (t.isEndTag() && (StringUtil.in(t.asEndTag().name(), "head", "body", "html", "br"))) { return anythingElse(t, tb); } else if (t.isEndTag()) { tb.error(this); return false; } else { return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { tb.insert("html"); tb.transition(BeforeHead); return tb.process(t); } }, BeforeHead { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { return true; } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { return InBody.process(t, tb); // does not transition } else if (t.isStartTag() && t.asStartTag().name().equals("head")) { Element head = tb.insert(t.asStartTag()); tb.setHeadElement(head); tb.transition(InHead); } else if (t.isEndTag() && (StringUtil.in(t.asEndTag().name(), "head", "body", "html", "br"))) { tb.process(new Token.StartTag("head")); return tb.process(t); } else if (t.isEndTag()) { tb.error(this); return false; } else { tb.process(new Token.StartTag("head")); return tb.process(t); } return true; } }, InHead { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); return true; } switch (t.type) { case Comment: tb.insert(t.asComment()); break; case Doctype: tb.error(this); return false; case StartTag: Token.StartTag start = t.asStartTag(); String name = start.name(); if (name.equals("html")) { return InBody.process(t, tb); } else if (StringUtil.in(name, "base", "basefont", "bgsound", "command", "link")) { Element el = tb.insertEmpty(start); // jsoup special: update base the frist time it is seen if (name.equals("base") && el.hasAttr("href")) tb.maybeSetBaseUri(el); } else if (name.equals("meta")) { Element meta = tb.insertEmpty(start); // todo: charset switches } else if (name.equals("title")) { handleRcData(start, tb); } else if (StringUtil.in(name, "noframes", "style")) { handleRawtext(start, tb); } else if (name.equals("noscript")) { // else if noscript && scripting flag = true: rawtext (jsoup doesn't run script, to handle as noscript) tb.insert(start); tb.transition(InHeadNoscript); } else if (name.equals("script")) { // skips some script rules as won't execute them tb.tokeniser.transition(TokeniserState.ScriptData); tb.markInsertionMode(); tb.transition(Text); tb.insert(start); } else if (name.equals("head")) { tb.error(this); return false; } else { return anythingElse(t, tb); } break; case EndTag: Token.EndTag end = t.asEndTag(); name = end.name(); if (name.equals("head")) { tb.pop(); tb.transition(AfterHead); } else if (StringUtil.in(name, "body", "html", "br")) { return anythingElse(t, tb); } else { tb.error(this); return false; } break; default: return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, TreeBuilder tb) { tb.process(new Token.EndTag("head")); return tb.process(t); } }, InHeadNoscript { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isDoctype()) { tb.error(this); } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { return tb.process(t, InBody); } else if (t.isEndTag() && t.asEndTag().name().equals("noscript")) { tb.pop(); tb.transition(InHead); } else if (isWhitespace(t) || t.isComment() || (t.isStartTag() && StringUtil.in(t.asStartTag().name(), "basefont", "bgsound", "link", "meta", "noframes", "style"))) { return tb.process(t, InHead); } else if (t.isEndTag() && t.asEndTag().name().equals("br")) { return anythingElse(t, tb); } else if ((t.isStartTag() && StringUtil.in(t.asStartTag().name(), "head", "noscript")) || t.isEndTag()) { tb.error(this); return false; } else { return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { tb.error(this); tb.process(new Token.EndTag("noscript")); return tb.process(t); } }, AfterHead { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { tb.error(this); } else if (t.isStartTag()) { Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("html")) { return tb.process(t, InBody); } else if (name.equals("body")) { tb.insert(startTag); tb.framesetOk(false); tb.transition(InBody); } else if (name.equals("frameset")) { tb.insert(startTag); tb.transition(InFrameset); } else if (StringUtil.in(name, "base", "basefont", "bgsound", "link", "meta", "noframes", "script", "style", "title")) { tb.error(this); Element head = tb.getHeadElement(); tb.push(head); tb.process(t, InHead); tb.removeFromStack(head); } else if (name.equals("head")) { tb.error(this); return false; } else { anythingElse(t, tb); } } else if (t.isEndTag()) { if (StringUtil.in(t.asEndTag().name(), "body", "html")) { anythingElse(t, tb); } else { tb.error(this); return false; } } else { anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { tb.process(new Token.StartTag("body")); tb.framesetOk(true); return tb.process(t); } }, InBody { boolean process(Token t, HtmlTreeBuilder tb) { switch (t.type) { case Character: { Token.Character c = t.asCharacter(); if (c.getData().equals(nullString)) { // todo confirm that check tb.error(this); return false; } else if (isWhitespace(c)) { tb.reconstructFormattingElements(); tb.insert(c); } else { tb.reconstructFormattingElements(); tb.insert(c); tb.framesetOk(false); } break; } case Comment: { tb.insert(t.asComment()); break; } case Doctype: { tb.error(this); return false; } case StartTag: Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("html")) { tb.error(this); // merge attributes onto real html Element html = tb.getStack().getFirst(); for (Attribute attribute : startTag.getAttributes()) { if (!html.hasAttr(attribute.getKey())) html.attributes().put(attribute); } } else if (StringUtil.in(name, Constants.InBodyStartToHead)) { return tb.process(t, InHead); } else if (name.equals("body")) { tb.error(this); LinkedList<Element> stack = tb.getStack(); if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals("body"))) { // only in fragment case return false; // ignore } else { tb.framesetOk(false); Element body = stack.get(1); for (Attribute attribute : startTag.getAttributes()) { if (!body.hasAttr(attribute.getKey())) body.attributes().put(attribute); } } } else if (name.equals("frameset")) { tb.error(this); LinkedList<Element> stack = tb.getStack(); if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals("body"))) { // only in fragment case return false; // ignore } else if (!tb.framesetOk()) { return false; // ignore frameset } else { Element second = stack.get(1); if (second.parent() != null) second.remove(); // pop up to html element while (stack.size() > 1) stack.removeLast(); tb.insert(startTag); tb.transition(InFrameset); } } else if (StringUtil.in(name, Constants.InBodyStartPClosers)) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); } else if (StringUtil.in(name, Constants.Headings)) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } if (StringUtil.in(tb.currentElement().nodeName(), Constants.Headings)) { tb.error(this); tb.pop(); } tb.insert(startTag); } else if (StringUtil.in(name, Constants.InBodyStartPreListing)) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); // todo: ignore LF if next token tb.framesetOk(false); } else if (name.equals("form")) { if (tb.getFormElement() != null) { tb.error(this); return false; } if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insertForm(startTag, true); } else if (name.equals("li")) { tb.framesetOk(false); LinkedList<Element> stack = tb.getStack(); for (int i = stack.size() - 1; i > 0; i--) { Element el = stack.get(i); if (el.nodeName().equals("li")) { tb.process(new Token.EndTag("li")); break; } if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), Constants.InBodyStartLiBreakers)) break; } if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); } else if (StringUtil.in(name, Constants.DdDt)) { tb.framesetOk(false); LinkedList<Element> stack = tb.getStack(); for (int i = stack.size() - 1; i > 0; i--) { Element el = stack.get(i); if (StringUtil.in(el.nodeName(), Constants.DdDt)) { tb.process(new Token.EndTag(el.nodeName())); break; } if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), Constants.InBodyStartLiBreakers)) break; } if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); } else if (name.equals("plaintext")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); tb.tokeniser.transition(TokeniserState.PLAINTEXT); // once in, never gets out } else if (name.equals("button")) { if (tb.inButtonScope("button")) { // close and reprocess tb.error(this); tb.process(new Token.EndTag("button")); tb.process(startTag); } else { tb.reconstructFormattingElements(); tb.insert(startTag); tb.framesetOk(false); } } else if (name.equals("a")) { if (tb.getActiveFormattingElement("a") != null) { tb.error(this); tb.process(new Token.EndTag("a")); // still on stack? Element remainingA = tb.getFromStack("a"); if (remainingA != null) { tb.removeFromActiveFormattingElements(remainingA); tb.removeFromStack(remainingA); } } tb.reconstructFormattingElements(); Element a = tb.insert(startTag); tb.pushActiveFormattingElements(a); } else if (StringUtil.in(name, Constants.Formatters)) { tb.reconstructFormattingElements(); Element el = tb.insert(startTag); tb.pushActiveFormattingElements(el); } else if (name.equals("nobr")) { tb.reconstructFormattingElements(); if (tb.inScope("nobr")) { tb.error(this); tb.process(new Token.EndTag("nobr")); tb.reconstructFormattingElements(); } Element el = tb.insert(startTag); tb.pushActiveFormattingElements(el); } else if (StringUtil.in(name, Constants.InBodyStartApplets)) { tb.reconstructFormattingElements(); tb.insert(startTag); tb.insertMarkerToFormattingElements(); tb.framesetOk(false); } else if (name.equals("table")) { if (tb.getDocument().quirksMode() != Document.QuirksMode.quirks && tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); tb.framesetOk(false); tb.transition(InTable); } else if (StringUtil.in(name, Constants.InBodyStartEmptyFormatters)) { tb.reconstructFormattingElements(); tb.insertEmpty(startTag); tb.framesetOk(false); } else if (name.equals("input")) { tb.reconstructFormattingElements(); Element el = tb.insertEmpty(startTag); if (!el.attr("type").equalsIgnoreCase("hidden")) tb.framesetOk(false); } else if (StringUtil.in(name, Constants.InBodyStartMedia)) { tb.insertEmpty(startTag); } else if (name.equals("hr")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insertEmpty(startTag); tb.framesetOk(false); } else if (name.equals("image")) { startTag.name("img"); return tb.process(startTag); } else if (name.equals("isindex")) { // how much do we care about the early 90s? tb.error(this); if (tb.getFormElement() != null) return false; tb.tokeniser.acknowledgeSelfClosingFlag(); tb.process(new Token.StartTag("form")); if (startTag.attributes.hasKey("action")) { Element form = tb.getFormElement(); form.attr("action", startTag.attributes.get("action")); } tb.process(new Token.StartTag("hr")); tb.process(new Token.StartTag("label")); // hope you like english. String prompt = startTag.attributes.hasKey("prompt") ? startTag.attributes.get("prompt") : "This is a searchable index. Enter search keywords: "; tb.process(new Token.Character(prompt)); // input Attributes inputAttribs = new Attributes(); for (Attribute attr : startTag.attributes) { if (!StringUtil.in(attr.getKey(), Constants.InBodyStartInputAttribs)) inputAttribs.put(attr); } inputAttribs.put("name", "isindex"); tb.process(new Token.StartTag("input", inputAttribs)); tb.process(new Token.EndTag("label")); tb.process(new Token.StartTag("hr")); tb.process(new Token.EndTag("form")); } else if (name.equals("textarea")) { tb.insert(startTag); // todo: If the next token is a U+000A LINE FEED (LF) character token, then ignore that token and move on to the next one. (Newlines at the start of textarea elements are ignored as an authoring convenience.) tb.tokeniser.transition(TokeniserState.Rcdata); tb.markInsertionMode(); tb.framesetOk(false); tb.transition(Text); } else if (name.equals("xmp")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.reconstructFormattingElements(); tb.framesetOk(false); handleRawtext(startTag, tb); } else if (name.equals("iframe")) { tb.framesetOk(false); handleRawtext(startTag, tb); } else if (name.equals("noembed")) { // also handle noscript if script enabled handleRawtext(startTag, tb); } else if (name.equals("select")) { tb.reconstructFormattingElements(); tb.insert(startTag); tb.framesetOk(false); HtmlTreeBuilderState state = tb.state(); if (state.equals(InTable) || state.equals(InCaption) || state.equals(InTableBody) || state.equals(InRow) || state.equals(InCell)) tb.transition(InSelectInTable); else tb.transition(InSelect); } else if (StringUtil.in(name, Constants.InBodyStartOptions)) { if (tb.currentElement().nodeName().equals("option")) tb.process(new Token.EndTag("option")); tb.reconstructFormattingElements(); tb.insert(startTag); } else if (StringUtil.in(name, Constants.InBodyStartRuby)) { if (tb.inScope("ruby")) { tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals("ruby")) { tb.error(this); tb.popStackToBefore("ruby"); // i.e. close up to but not include name } tb.insert(startTag); } } else if (name.equals("math")) { tb.reconstructFormattingElements(); // todo: handle A start tag whose tag name is "math" (i.e. foreign, mathml) tb.insert(startTag); tb.tokeniser.acknowledgeSelfClosingFlag(); } else if (name.equals("svg")) { tb.reconstructFormattingElements(); // todo: handle A start tag whose tag name is "svg" (xlink, svg) tb.process(new org.jsoup.parser.Token.StartTag("label")); tb.insert(startTag); tb.tokeniser.acknowledgeSelfClosingFlag(); } else if (StringUtil.in(name, Constants.InBodyStartDrop)) { tb.error(this); return false; } else { tb.reconstructFormattingElements(); tb.insert(startTag); } break; case EndTag: Token.EndTag endTag = t.asEndTag(); name = endTag.name(); if (name.equals("body")) { if (!tb.inScope("body")) { tb.error(this); return false; } else { // todo: error if stack contains something not dd, dt, li, optgroup, option, p, rp, rt, tbody, td, tfoot, th, thead, tr, body, html tb.transition(AfterBody); } } else if (name.equals("html")) { boolean notIgnored = tb.process(new Token.EndTag("body")); if (notIgnored) return tb.process(endTag); } else if (StringUtil.in(name, Constants.InBodyEndClosers)) { if (!tb.inScope(name)) { // nothing to close tb.error(this); return false; } else { tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); } } else if (name.equals("form")) { Element currentForm = tb.getFormElement(); tb.setFormElement(null); if (currentForm == null || !tb.inScope(name)) { tb.error(this); return false; } else { tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); // remove currentForm from stack. will shift anything under up. tb.removeFromStack(currentForm); } } else if (name.equals("p")) { if (!tb.inButtonScope(name)) { tb.error(this); tb.process(new Token.StartTag(name)); // if no p to close, creates an empty <p></p> return tb.process(endTag); } else { tb.generateImpliedEndTags(name); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); } } else if (name.equals("li")) { if (!tb.inListItemScope(name)) { tb.error(this); return false; } else { tb.generateImpliedEndTags(name); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); } } else if (StringUtil.in(name, Constants.DdDt)) { if (!tb.inScope(name)) { tb.error(this); return false; } else { tb.generateImpliedEndTags(name); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); } } else if (StringUtil.in(name, Constants.Headings)) { if (!tb.inScope(Constants.Headings)) { tb.error(this); return false; } else { tb.generateImpliedEndTags(name); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(Constants.Headings); } } else if (name.equals("sarcasm")) { // *sigh* return anyOtherEndTag(t, tb); } else if (StringUtil.in(name, Constants.InBodyEndAdoptionFormatters)) { // Adoption Agency Algorithm. OUTER: for (int i = 0; i < 8; i++) { Element formatEl = tb.getActiveFormattingElement(name); if (formatEl == null) return anyOtherEndTag(t, tb); else if (!tb.onStack(formatEl)) { tb.error(this); tb.removeFromActiveFormattingElements(formatEl); return true; } else if (!tb.inScope(formatEl.nodeName())) { tb.error(this); return false; } else if (tb.currentElement() != formatEl) tb.error(this); Element furthestBlock = null; Element commonAncestor = null; boolean seenFormattingElement = false; LinkedList<Element> stack = tb.getStack(); // the spec doesn't limit to < 64, but in degenerate cases (9000+ stack depth) this prevents // run-aways final int stackSize = stack.size(); for (int si = 0; si < stackSize && si < 64; si++) { Element el = stack.get(si); if (el == formatEl) { commonAncestor = stack.get(si - 1); seenFormattingElement = true; } else if (seenFormattingElement && tb.isSpecial(el)) { furthestBlock = el; break; } } if (furthestBlock == null) { tb.popStackToClose(formatEl.nodeName()); tb.removeFromActiveFormattingElements(formatEl); return true; } // todo: Let a bookmark note the position of the formatting element in the list of active formatting elements relative to the elements on either side of it in the list. // does that mean: int pos of format el in list? Element node = furthestBlock; Element lastNode = furthestBlock; INNER: for (int j = 0; j < 3; j++) { if (tb.onStack(node)) node = tb.aboveOnStack(node); if (!tb.isInActiveFormattingElements(node)) { // note no bookmark check tb.removeFromStack(node); continue INNER; } else if (node == formatEl) break INNER; Element replacement = new Element(Tag.valueOf(node.nodeName()), tb.getBaseUri()); tb.replaceActiveFormattingElement(node, replacement); tb.replaceOnStack(node, replacement); node = replacement; if (lastNode == furthestBlock) { // todo: move the aforementioned bookmark to be immediately after the new node in the list of active formatting elements. // not getting how this bookmark both straddles the element above, but is inbetween here... } if (lastNode.parent() != null) lastNode.remove(); node.appendChild(lastNode); lastNode = node; } if (StringUtil.in(commonAncestor.nodeName(), Constants.InBodyEndTableFosters)) { if (lastNode.parent() != null) lastNode.remove(); tb.insertInFosterParent(lastNode); } else { if (lastNode.parent() != null) lastNode.remove(); commonAncestor.appendChild(lastNode); } Element adopter = new Element(formatEl.tag(), tb.getBaseUri()); adopter.attributes().addAll(formatEl.attributes()); Node[] childNodes = furthestBlock.childNodes().toArray(new Node[furthestBlock.childNodeSize()]); for (Node childNode : childNodes) { adopter.appendChild(childNode); // append will reparent. thus the clone to avoid concurrent mod. } furthestBlock.appendChild(adopter); tb.removeFromActiveFormattingElements(formatEl); // todo: insert the new element into the list of active formatting elements at the position of the aforementioned bookmark. tb.removeFromStack(formatEl); tb.insertOnStackAfter(furthestBlock, adopter); } } else if (StringUtil.in(name, Constants.InBodyStartApplets)) { if (!tb.inScope("name")) { if (!tb.inScope(name)) { tb.error(this); return false; } tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); tb.clearFormattingElementsToLastMarker(); } } else if (name.equals("br")) { tb.error(this); tb.process(new Token.StartTag("br")); return false; } else { return anyOtherEndTag(t, tb); } break; case EOF: // todo: error if stack contains something not dd, dt, li, p, tbody, td, tfoot, th, thead, tr, body, html // stop parsing break; } return true; } boolean anyOtherEndTag(Token t, HtmlTreeBuilder tb) { String name = t.asEndTag().name(); DescendableLinkedList<Element> stack = tb.getStack(); Iterator<Element> it = stack.descendingIterator(); while (it.hasNext()) { Element node = it.next(); if (node.nodeName().equals(name)) { tb.generateImpliedEndTags(name); if (!name.equals(tb.currentElement().nodeName())) tb.error(this); tb.popStackToClose(name); break; } else { if (tb.isSpecial(node)) { tb.error(this); return false; } } } return true; } }, Text { // in script, style etc. normally treated as data tags boolean process(Token t, HtmlTreeBuilder tb) { if (t.isCharacter()) { tb.insert(t.asCharacter()); } else if (t.isEOF()) { tb.error(this); // if current node is script: already started tb.pop(); tb.transition(tb.originalState()); return tb.process(t); } else if (t.isEndTag()) { // if: An end tag whose tag name is "script" -- scripting nesting level, if evaluating scripts tb.pop(); tb.transition(tb.originalState()); } return true; } }, InTable { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isCharacter()) { tb.newPendingTableCharacters(); tb.markInsertionMode(); tb.transition(InTableText); return tb.process(t); } else if (t.isComment()) { tb.insert(t.asComment()); return true; } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag()) { Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("caption")) { tb.clearStackToTableContext(); tb.insertMarkerToFormattingElements(); tb.insert(startTag); tb.transition(InCaption); } else if (name.equals("colgroup")) { tb.clearStackToTableContext(); tb.insert(startTag); tb.transition(InColumnGroup); } else if (name.equals("col")) { tb.process(new Token.StartTag("colgroup")); return tb.process(t); } else if (StringUtil.in(name, "tbody", "tfoot", "thead")) { tb.clearStackToTableContext(); tb.insert(startTag); tb.transition(InTableBody); } else if (StringUtil.in(name, "td", "th", "tr")) { tb.process(new Token.StartTag("tbody")); return tb.process(t); } else if (name.equals("table")) { tb.error(this); boolean processed = tb.process(new Token.EndTag("table")); if (processed) // only ignored if in fragment return tb.process(t); } else if (StringUtil.in(name, "style", "script")) { return tb.process(t, InHead); } else if (name.equals("input")) { if (!startTag.attributes.get("type").equalsIgnoreCase("hidden")) { return anythingElse(t, tb); } else { tb.insertEmpty(startTag); } } else if (name.equals("form")) { tb.error(this); if (tb.getFormElement() != null) return false; else { tb.insertForm(startTag, false); } } else { return anythingElse(t, tb); } return true; // todo: check if should return processed http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#parsing-main-intable } else if (t.isEndTag()) { Token.EndTag endTag = t.asEndTag(); String name = endTag.name(); if (name.equals("table")) { if (!tb.inTableScope(name)) { tb.error(this); return false; } else { tb.popStackToClose("table"); } tb.resetInsertionMode(); } else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html", "tbody", "td", "tfoot", "th", "thead", "tr")) { tb.error(this); return false; } else { return anythingElse(t, tb); } return true; // todo: as above todo } else if (t.isEOF()) { if (tb.currentElement().nodeName().equals("html")) tb.error(this); return true; // stops parsing } return anythingElse(t, tb); } boolean anythingElse(Token t, HtmlTreeBuilder tb) { tb.error(this); boolean processed = true; if (StringUtil.in(tb.currentElement().nodeName(), "table", "tbody", "tfoot", "thead", "tr")) { tb.setFosterInserts(true); processed = tb.process(t, InBody); tb.setFosterInserts(false); } else { processed = tb.process(t, InBody); } return processed; } }, InTableText { boolean process(Token t, HtmlTreeBuilder tb) { switch (t.type) { case Character: Token.Character c = t.asCharacter(); if (c.getData().equals(nullString)) { tb.error(this); return false; } else { tb.getPendingTableCharacters().add(c); } break; default: if (tb.getPendingTableCharacters().size() > 0) { for (Token.Character character : tb.getPendingTableCharacters()) { if (!isWhitespace(character)) { // InTable anything else section: tb.error(this); if (StringUtil.in(tb.currentElement().nodeName(), "table", "tbody", "tfoot", "thead", "tr")) { tb.setFosterInserts(true); tb.process(character, InBody); tb.setFosterInserts(false); } else { tb.process(character, InBody); } } else tb.insert(character); } tb.newPendingTableCharacters(); } tb.transition(tb.originalState()); return tb.process(t); } return true; } }, InCaption { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isEndTag() && t.asEndTag().name().equals("caption")) { Token.EndTag endTag = t.asEndTag(); String name = endTag.name(); if (!tb.inTableScope(name)) { tb.error(this); return false; } else { tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals("caption")) tb.error(this); tb.popStackToClose("caption"); tb.clearFormattingElementsToLastMarker(); tb.transition(InTable); } } else if (( t.isStartTag() && StringUtil.in(t.asStartTag().name(), "caption", "col", "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr") || t.isEndTag() && t.asEndTag().name().equals("table")) ) { tb.error(this); boolean processed = tb.process(new Token.EndTag("caption")); if (processed) return tb.process(t); } else if (t.isEndTag() && StringUtil.in(t.asEndTag().name(), "body", "col", "colgroup", "html", "tbody", "td", "tfoot", "th", "thead", "tr")) { tb.error(this); return false; } else { return tb.process(t, InBody); } return true; } }, InColumnGroup { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); return true; } switch (t.type) { case Comment: tb.insert(t.asComment()); break; case Doctype: tb.error(this); break; case StartTag: Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("html")) return tb.process(t, InBody); else if (name.equals("col")) tb.insertEmpty(startTag); else return anythingElse(t, tb); break; case EndTag: Token.EndTag endTag = t.asEndTag(); name = endTag.name(); if (name.equals("colgroup")) { if (tb.currentElement().nodeName().equals("html")) { // frag case tb.error(this); return false; } else { tb.pop(); tb.transition(InTable); } } else return anythingElse(t, tb); break; case EOF: if (tb.currentElement().nodeName().equals("html")) return true; // stop parsing; frag case else return anythingElse(t, tb); default: return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, TreeBuilder tb) { boolean processed = tb.process(new Token.EndTag("colgroup")); if (processed) // only ignored in frag case return tb.process(t); return true; } }, InTableBody { boolean process(Token t, HtmlTreeBuilder tb) { switch (t.type) { case StartTag: Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("tr")) { tb.clearStackToTableBodyContext(); tb.insert(startTag); tb.transition(InRow); } else if (StringUtil.in(name, "th", "td")) { tb.error(this); tb.process(new Token.StartTag("tr")); return tb.process(startTag); } else if (StringUtil.in(name, "caption", "col", "colgroup", "tbody", "tfoot", "thead")) { return exitTableBody(t, tb); } else return anythingElse(t, tb); break; case EndTag: Token.EndTag endTag = t.asEndTag(); name = endTag.name(); if (StringUtil.in(name, "tbody", "tfoot", "thead")) { if (!tb.inTableScope(name)) { tb.error(this); return false; } else { tb.clearStackToTableBodyContext(); tb.pop(); tb.transition(InTable); } } else if (name.equals("table")) { return exitTableBody(t, tb); } else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html", "td", "th", "tr")) { tb.error(this); return false; } else return anythingElse(t, tb); break; default: return anythingElse(t, tb); } return true; } private boolean exitTableBody(Token t, HtmlTreeBuilder tb) { if (!(tb.inTableScope("tbody") || tb.inTableScope("thead") || tb.inScope("tfoot"))) { // frag case tb.error(this); return false; } tb.clearStackToTableBodyContext(); tb.process(new Token.EndTag(tb.currentElement().nodeName())); // tbody, tfoot, thead return tb.process(t); } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { return tb.process(t, InTable); } }, InRow { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isStartTag()) { Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (StringUtil.in(name, "th", "td")) { tb.clearStackToTableRowContext(); tb.insert(startTag); tb.transition(InCell); tb.insertMarkerToFormattingElements(); } else if (StringUtil.in(name, "caption", "col", "colgroup", "tbody", "tfoot", "thead", "tr")) { return handleMissingTr(t, tb); } else { return anythingElse(t, tb); } } else if (t.isEndTag()) { Token.EndTag endTag = t.asEndTag(); String name = endTag.name(); if (name.equals("tr")) { if (!tb.inTableScope(name)) { tb.error(this); // frag return false; } tb.clearStackToTableRowContext(); tb.pop(); // tr tb.transition(InTableBody); } else if (name.equals("table")) { return handleMissingTr(t, tb); } else if (StringUtil.in(name, "tbody", "tfoot", "thead")) { if (!tb.inTableScope(name)) { tb.error(this); return false; } tb.process(new Token.EndTag("tr")); return tb.process(t); } else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html", "td", "th")) { tb.error(this); return false; } else { return anythingElse(t, tb); } } else { return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { return tb.process(t, InTable); } private boolean handleMissingTr(Token t, TreeBuilder tb) { boolean processed = tb.process(new Token.EndTag("tr")); if (processed) return tb.process(t); else return false; } }, InCell { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isEndTag()) { Token.EndTag endTag = t.asEndTag(); String name = endTag.name(); if (StringUtil.in(name, "td", "th")) { if (!tb.inTableScope(name)) { tb.error(this); tb.transition(InRow); // might not be in scope if empty: <td /> and processing fake end tag return false; } tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); tb.clearFormattingElementsToLastMarker(); tb.transition(InRow); } else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html")) { tb.error(this); return false; } else if (StringUtil.in(name, "table", "tbody", "tfoot", "thead", "tr")) { if (!tb.inTableScope(name)) { tb.error(this); return false; } closeCell(tb); return tb.process(t); } else { return anythingElse(t, tb); } } else if (t.isStartTag() && StringUtil.in(t.asStartTag().name(), "caption", "col", "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr")) { if (!(tb.inTableScope("td") || tb.inTableScope("th"))) { tb.error(this); return false; } closeCell(tb); return tb.process(t); } else { return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { return tb.process(t, InBody); } private void closeCell(HtmlTreeBuilder tb) { if (tb.inTableScope("td")) tb.process(new Token.EndTag("td")); else tb.process(new Token.EndTag("th")); // only here if th or td in scope } }, InSelect { boolean process(Token t, HtmlTreeBuilder tb) { switch (t.type) { case Character: Token.Character c = t.asCharacter(); if (c.getData().equals(nullString)) { tb.error(this); return false; } else { tb.insert(c); } break; case Comment: tb.insert(t.asComment()); break; case Doctype: tb.error(this); return false; case StartTag: Token.StartTag start = t.asStartTag(); String name = start.name(); if (name.equals("html")) return tb.process(start, InBody); else if (name.equals("option")) { tb.process(new Token.EndTag("option")); tb.insert(start); } else if (name.equals("optgroup")) { if (tb.currentElement().nodeName().equals("option")) tb.process(new Token.EndTag("option")); else if (tb.currentElement().nodeName().equals("optgroup")) tb.process(new Token.EndTag("optgroup")); tb.insert(start); } else if (name.equals("select")) { tb.error(this); return tb.process(new Token.EndTag("select")); } else if (StringUtil.in(name, "input", "keygen", "textarea")) { tb.error(this); if (!tb.inSelectScope("select")) return false; // frag tb.process(new Token.EndTag("select")); return tb.process(start); } else if (name.equals("script")) { return tb.process(t, InHead); } else { return anythingElse(t, tb); } break; case EndTag: Token.EndTag end = t.asEndTag(); name = end.name(); if (name.equals("optgroup")) { if (tb.currentElement().nodeName().equals("option") && tb.aboveOnStack(tb.currentElement()) != null && tb.aboveOnStack(tb.currentElement()).nodeName().equals("optgroup")) tb.process(new Token.EndTag("option")); if (tb.currentElement().nodeName().equals("optgroup")) tb.pop(); else tb.error(this); } else if (name.equals("option")) { if (tb.currentElement().nodeName().equals("option")) tb.pop(); else tb.error(this); } else if (name.equals("select")) { if (!tb.inSelectScope(name)) { tb.error(this); return false; } else { tb.popStackToClose(name); tb.resetInsertionMode(); } } else return anythingElse(t, tb); break; case EOF: if (!tb.currentElement().nodeName().equals("html")) tb.error(this); break; default: return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { tb.error(this); return false; } }, InSelectInTable { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isStartTag() && StringUtil.in(t.asStartTag().name(), "caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th")) { tb.error(this); tb.process(new Token.EndTag("select")); return tb.process(t); } else if (t.isEndTag() && StringUtil.in(t.asEndTag().name(), "caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th")) { tb.error(this); if (tb.inTableScope(t.asEndTag().name())) { tb.process(new Token.EndTag("select")); return (tb.process(t)); } else return false; } else { return tb.process(t, InSelect); } } }, AfterBody { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { return tb.process(t, InBody); } else if (t.isComment()) { tb.insert(t.asComment()); // into html node } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { return tb.process(t, InBody); } else if (t.isEndTag() && t.asEndTag().name().equals("html")) { if (tb.isFragmentParsing()) { tb.error(this); return false; } else { tb.transition(AfterAfterBody); } } else if (t.isEOF()) { // chillax! we're done } else { tb.error(this); tb.transition(InBody); return tb.process(t); } return true; } }, InFrameset { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag()) { Token.StartTag start = t.asStartTag(); String name = start.name(); if (name.equals("html")) { return tb.process(start, InBody); } else if (name.equals("frameset")) { tb.insert(start); } else if (name.equals("frame")) { tb.insertEmpty(start); } else if (name.equals("noframes")) { return tb.process(start, InHead); } else { tb.error(this); return false; } } else if (t.isEndTag() && t.asEndTag().name().equals("frameset")) { if (tb.currentElement().nodeName().equals("html")) { // frag tb.error(this); return false; } else { tb.pop(); if (!tb.isFragmentParsing() && !tb.currentElement().nodeName().equals("frameset")) { tb.transition(AfterFrameset); } } } else if (t.isEOF()) { if (!tb.currentElement().nodeName().equals("html")) { tb.error(this); return true; } } else { tb.error(this); return false; } return true; } }, AfterFrameset { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { return tb.process(t, InBody); } else if (t.isEndTag() && t.asEndTag().name().equals("html")) { tb.transition(AfterAfterFrameset); } else if (t.isStartTag() && t.asStartTag().name().equals("noframes")) { return tb.process(t, InHead); } else if (t.isEOF()) { // cool your heels, we're complete } else { tb.error(this); return false; } return true; } }, AfterAfterBody { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype() || isWhitespace(t) || (t.isStartTag() && t.asStartTag().name().equals("html"))) { return tb.process(t, InBody); } else if (t.isEOF()) { // nice work chuck } else { tb.error(this); tb.transition(InBody); return tb.process(t); } return true; } }, AfterAfterFrameset { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype() || isWhitespace(t) || (t.isStartTag() && t.asStartTag().name().equals("html"))) { return tb.process(t, InBody); } else if (t.isEOF()) { // nice work chuck } else if (t.isStartTag() && t.asStartTag().name().equals("noframes")) { return tb.process(t, InHead); } else { tb.error(this); return false; } return true; } }, ForeignContent { boolean process(Token t, HtmlTreeBuilder tb) { return true; // todo: implement. Also; how do we get here? } }; private static String nullString = String.valueOf('\u0000'); abstract boolean process(Token t, HtmlTreeBuilder tb); private static boolean isWhitespace(Token t) { if (t.isCharacter()) { String data = t.asCharacter().getData(); // todo: this checks more than spec - "\t", "\n", "\f", "\r", " " for (int i = 0; i < data.length(); i++) { char c = data.charAt(i); if (!StringUtil.isWhitespace(c)) return false; } return true; } return false; } private static void handleRcData(Token.StartTag startTag, HtmlTreeBuilder tb) { tb.insert(startTag); tb.tokeniser.transition(TokeniserState.Rcdata); tb.markInsertionMode(); tb.transition(Text); } private static void handleRawtext(Token.StartTag startTag, HtmlTreeBuilder tb) { tb.insert(startTag); tb.tokeniser.transition(TokeniserState.Rawtext); tb.markInsertionMode(); tb.transition(Text); } // lists of tags to search through. A little harder to read here, but causes less GC than dynamic varargs. // was contributing around 10% of parse GC load. private static final class Constants { private static final String[] InBodyStartToHead = new String[]{"base", "basefont", "bgsound", "command", "link", "meta", "noframes", "script", "style", "title"}; private static final String[] InBodyStartPClosers = new String[]{"address", "article", "aside", "blockquote", "center", "details", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "menu", "nav", "ol", "p", "section", "summary", "ul"}; private static final String[] Headings = new String[]{"h1", "h2", "h3", "h4", "h5", "h6"}; private static final String[] InBodyStartPreListing = new String[]{"pre", "listing"}; private static final String[] InBodyStartLiBreakers = new String[]{"address", "div", "p"}; private static final String[] DdDt = new String[]{"dd", "dt"}; private static final String[] Formatters = new String[]{"b", "big", "code", "em", "font", "i", "s", "small", "strike", "strong", "tt", "u"}; private static final String[] InBodyStartApplets = new String[]{"applet", "marquee", "object"}; private static final String[] InBodyStartEmptyFormatters = new String[]{"area", "br", "embed", "img", "keygen", "wbr"}; private static final String[] InBodyStartMedia = new String[]{"param", "source", "track"}; private static final String[] InBodyStartInputAttribs = new String[]{"name", "action", "prompt"}; private static final String[] InBodyStartOptions = new String[]{"optgroup", "option"}; private static final String[] InBodyStartRuby = new String[]{"rp", "rt"}; private static final String[] InBodyStartDrop = new String[]{"caption", "col", "colgroup", "frame", "head", "tbody", "td", "tfoot", "th", "thead", "tr"}; private static final String[] InBodyEndClosers = new String[]{"address", "article", "aside", "blockquote", "button", "center", "details", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "listing", "menu", "nav", "ol", "pre", "section", "summary", "ul"}; private static final String[] InBodyEndAdoptionFormatters = new String[]{"a", "b", "big", "code", "em", "font", "i", "nobr", "s", "small", "strike", "strong", "tt", "u"}; private static final String[] InBodyEndTableFosters = new String[]{"table", "tbody", "tfoot", "thead", "tr"}; } }
[ "justinwm@163.com" ]
justinwm@163.com
45999d09e7cb3901e908b9d5e078b489b3a0a645
b9638616221aa06e06d86a40443d0f8475f0259d
/dz-im/src/main/java/com/dz/dzim/pojo/vo/MemberVo.java
3b920e6bf76ed4c646c31c76c72bb6c12d67ca6c
[]
no_license
baohan123/dz-res
32ec613904af7f617f234607c2a7fd7b923ca6b9
4a2f8e8cc5ffa86021f320089e65f24a4710c471
refs/heads/main
2023-03-09T07:05:09.470005
2021-02-20T10:33:05
2021-02-20T10:33:05
332,599,468
0
1
null
null
null
null
UTF-8
Java
false
false
854
java
package com.dz.dzim.pojo.vo; import org.springframework.web.socket.WebSocketSession; /** * @author baohan * @className 用户信息Vo * @description TODO * @date 2021/2/5 13:14 */ public class MemberVo { /** * 大会场id */ private String bigId; /** * 用户id */ private Long memberId; /** * 用户类型 */ private String memberType; public String getBigId() { return bigId; } public void setBigId(String bigId) { this.bigId = bigId; } public Long getMemberId() { return memberId; } public void setMemberId(Long memberId) { this.memberId = memberId; } public String getMemberType() { return memberType; } public void setMemberType(String memberType) { this.memberType = memberType; } }
[ "13366741095@163.com" ]
13366741095@163.com
c1eea29b270081eb236c9426b9864d58aa535932
21a603d64cd1d27d1d81de1bc901e4e1f2c4fce0
/ITE Release/eu.fittest.softeam/eu.fittest.distributed.framework/eu.fittest.agent.ite/src/main/java/eu/fittest/agent/ite/services/httpserver/spec/IHTTPServerService.java
95d91cd417b9030acea10df2e4e5e1c942603edf
[]
no_license
alebagnato/FITTEST
3dc511146a134c0f8d836a8a6af67fcce498cca9
b8839c5bd8186b79f3668a4b195836315a8929a0
refs/heads/master
2016-09-11T07:03:22.224713
2014-02-10T12:12:10
2014-02-10T12:12:10
32,155,665
5
1
null
null
null
null
UTF-8
Java
false
false
199
java
package eu.fittest.agent.ite.services.httpserver.spec; import eu.fittest.common.core.service.IService; public interface IHTTPServerService extends IService, ILocalHTTPServerService { }
[ "urko.rueda" ]
urko.rueda
0e602126327061982fafab4b3d2a549b919de465
d1a0b7a30547c0723ae90356040a0694e3feb1c2
/app/src/main/java/com/joel/restaurants/adapters/MyRestaurantsArrayAdapter.java
8c940d70407e0ad7ab0b7227145633c9177d16d3
[]
no_license
Joelmukono/MyRestaurants
2ddfe063bfb00d519a47bc0facfda3e57ff65234
d6835e1dbb484dd120b9c212038d82dc2ce22c5b
refs/heads/master
2021-01-04T07:48:58.042067
2020-02-14T07:40:05
2020-02-14T07:40:05
240,453,818
0
0
null
null
null
null
UTF-8
Java
false
false
951
java
package com.joel.restaurants.adapters; import android.content.Context; import android.widget.ArrayAdapter; public class MyRestaurantsArrayAdapter extends ArrayAdapter { private Context mContext; private String[] mRestaurants; private String[] mCuisines; public MyRestaurantsArrayAdapter(Context mContext, int resource, String[] mRestaurants, String[] mCuisines) { //context is the current state of the application super(mContext, resource); this.mContext = mContext; this.mRestaurants = mRestaurants; this.mCuisines = mCuisines; } @Override public Object getItem(int position) { String restaurant = mRestaurants[position]; String cuisine = mCuisines[position]; return String.format("%s \nServes great: %s", restaurant, cuisine); } @Override public int getCount() { return mRestaurants.length; } // an adapter looks like a pojo }
[ "jlmukono@gamil.com" ]
jlmukono@gamil.com
eba318791deec1abcd4c70a7a5becd7fedb5957b
8df8c60db4cfc3edd8ff0cbca229211a19d3bdcd
/src/test/java/gal/udc/fic/vvs/email/correo/AdjuntoTest.java
f2c028129cfccd48c010ac7546bc4e25f4905d67
[]
no_license
UDC-FIC-VVS/sistema-de-correo-electronico-antonvalletas
02e29869a44cb5e26a511f4527152d8f26e081c4
0f3631ffe5525b06ea441ccb08d6b3f433232651
refs/heads/main
2023-02-15T06:09:06.282456
2021-01-14T13:33:15
2021-01-14T13:33:15
313,652,441
0
0
null
2021-01-05T23:41:10
2020-11-17T14:55:34
HTML
UTF-8
Java
false
false
2,709
java
package gal.udc.fic.vvs.email.correo; import gal.udc.fic.vvs.email.archivo.Texto; import org.junit.Test; import java.util.Collection; import java.util.Vector; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; public class AdjuntoTest { Texto texto = new Texto("valor", "contenido"); Mensaje mensaje = new Mensaje(texto); /*Tests constructor for adjunto*/ @Test public void adjuntoTest() { Adjunto adjunto = new Adjunto(mensaje, texto); assertNotNull(adjunto); } @Test public void leidoTest() { Adjunto adjunto = new Adjunto(mensaje, texto); adjunto.establecerLeido(true); assertEquals(0, adjunto.obtenerNoLeidos()); } @Test public void iconoTest() { Adjunto adjunto = new Adjunto(mensaje, texto); assertEquals(mensaje.obtenerIcono(), adjunto.obtenerIcono()); } @Test public void previsualizacionTest() { Adjunto adjunto = new Adjunto(mensaje, texto); assertEquals(mensaje.obtenerPreVisualizacion(), adjunto.obtenerPreVisualizacion()); } @Test public void rutaTest() { Adjunto adjunto = new Adjunto(mensaje, texto); assertEquals(mensaje.obtenerRuta(), adjunto.obtenerRuta()); } @Test(expected = OperacionInvalida.class) public void explorarTest() throws OperacionInvalida { Adjunto adjunto = new Adjunto(mensaje, texto); adjunto.explorar(); } @Test public void buscarTest() { Adjunto adjunto = new Adjunto(mensaje, texto); Collection ans = new Vector(); ans.add(adjunto); assertEquals(ans, adjunto.buscar("contenido")); } @Test(expected = OperacionInvalida.class) public void añadirTest() throws OperacionInvalida { Adjunto adjunto = new Adjunto(mensaje, texto); adjunto.añadir(mensaje); } @Test(expected = OperacionInvalida.class) public void eliminarTest() throws OperacionInvalida { Adjunto adjunto = new Adjunto(mensaje, texto); adjunto.eliminar(mensaje); } @Test(expected = OperacionInvalida.class) public void obtenerHijoTest() throws OperacionInvalida { Adjunto adjunto = new Adjunto(mensaje, texto); adjunto.obtenerHijo(0); } @Test public void padreTest() { Adjunto adjunto = new Adjunto(mensaje, texto); Mensaje mensaje2 = new Mensaje(texto); adjunto.establecerPadre(mensaje2); assertEquals(mensaje2, adjunto.obtenerPadre()); } @Test public void obtenerTamañoTest() { Adjunto adjunto = new Adjunto(mensaje, texto); assertEquals(mensaje.obtenerTamaño() + texto.obtenerTamaño(), adjunto.obtenerTamaño()); } @Test public void obtenerVisualizacionTest() { Adjunto adjunto = new Adjunto(mensaje, texto); assertEquals(mensaje.obtenerVisualizacion() + "\n\nAdxunto: " + texto.obtenerPreVisualizacion(), adjunto.obtenerVisualizacion()); } }
[ "anton.valladares@udc.es" ]
anton.valladares@udc.es
3b08d83451df2a475760a168a65da5961cfb2983
f74079b664d9ae03708528cb2dfd57fb5059bbd6
/app/src/main/java/com/jvera/awareness/demo/awareness/barrier/WifiBarrierActivity.java
dae0572de50784342d6972b4bda3466e12a1cfd7
[]
no_license
jverahuawei/awareness_demo
57371ca54bbead89daac279e00d59e0bf19e855c
76c3de009099f37ba4e5371ff0096c5e152703bb
refs/heads/master
2023-03-12T17:09:19.683782
2021-02-24T19:12:59
2021-02-24T19:12:59
342,008,459
0
0
null
null
null
null
UTF-8
Java
false
false
4,116
java
package com.jvera.awareness.demo.awareness.barrier; import com.jvera.awareness.demo.R; import com.jvera.awareness.demo.Utils; import com.jvera.awareness.demo.logger.LogView; import com.huawei.hms.kit.awareness.barrier.AwarenessBarrier; import com.huawei.hms.kit.awareness.barrier.BarrierStatus; import com.huawei.hms.kit.awareness.barrier.WifiBarrier; import com.huawei.hms.kit.awareness.status.WifiStatus; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.view.View; import android.widget.ScrollView; import androidx.appcompat.app.AppCompatActivity; public class WifiBarrierActivity extends AppCompatActivity implements View.OnClickListener { private static final String KEEPING_BARRIER_LABEL = "keeping wifi barrier label"; private LogView mLogView; private ScrollView mScrollView; private PendingIntent mPendingIntent; private WifiBarrierReceiver mBarrierReceiver; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_wifi_barrier); initView(); String barrierReceiverAction = getApplication().getPackageName() + "WIFI_BARRIER_RECEIVER_ACTION"; Intent intent = new Intent(barrierReceiverAction); // You can also create PendingIntent with getActivity() or getService(). // This depends on what action you want Awareness Kit to trigger when the barrier status changes. mPendingIntent = PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); // Register a broadcast receiver to receive the broadcast sent by Awareness Kit when the barrier status changes. mBarrierReceiver = new WifiBarrierReceiver(); registerReceiver(mBarrierReceiver, new IntentFilter(barrierReceiverAction)); } @Override protected void onDestroy() { super.onDestroy(); if (mBarrierReceiver != null) { unregisterReceiver(mBarrierReceiver); } } private void initView() { findViewById(R.id.add_wifiBarrier_keeping).setOnClickListener(this); findViewById(R.id.delete_wifi_barrier).setOnClickListener(this); findViewById(R.id.clear_wifi_barrier_log).setOnClickListener(this); mLogView = findViewById(R.id.logView); mScrollView = findViewById(R.id.log_scroll); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.add_wifiBarrier_keeping: AwarenessBarrier keepingConnectedBarrier = WifiBarrier.keeping(WifiStatus.CONNECTED, null, null); Utils.addBarrier(this, KEEPING_BARRIER_LABEL, keepingConnectedBarrier, mPendingIntent); break; case R.id.delete_wifi_barrier: Utils.deleteBarrier(this, KEEPING_BARRIER_LABEL); break; case R.id.clear_wifi_barrier_log: mLogView.setText(""); break; default: break; } } final class WifiBarrierReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { BarrierStatus barrierStatus = BarrierStatus.extract(intent); String label = barrierStatus.getBarrierLabel(); int barrierPresentStatus = barrierStatus.getPresentStatus(); if (!KEEPING_BARRIER_LABEL.equals(label)) { return; } if (barrierPresentStatus == BarrierStatus.TRUE) { mLogView.printLog("The wifi is connected."); } else if (barrierPresentStatus == BarrierStatus.FALSE) { mLogView.printLog("The wifi is disconnected."); } else { mLogView.printLog("The wifi status is unknown."); } mScrollView.postDelayed(() -> mScrollView.smoothScrollTo(0, mScrollView.getBottom()), 200); } } }
[ "jose.vera@huawei.com" ]
jose.vera@huawei.com
0dbb9336ece0a3b6c59844f3621daa362a0e6bae
4509375eb8d1b3c7a5efc59ac0bb134573966aa6
/src/main/java/com/falanadamian/krim/schedule/repository/RoleRepository.java
b56731c0650a746d1d47d2cc8eed376ad4c99860
[]
no_license
falanadamian/krim-schedule-management-system
382d98874c0339cf3cd6a7cda03487974bf0e6f3
fc75710afd75765eae85525410ca98424a3c63ef
refs/heads/master
2022-05-01T13:23:09.778421
2019-07-16T11:35:02
2019-07-16T11:35:02
197,181,818
0
0
null
null
null
null
UTF-8
Java
false
false
316
java
package com.falanadamian.krim.schedule.repository; import com.falanadamian.krim.schedule.domain.model.*; import com.falanadamian.krim.schedule.domain.model.enumeration.RoleType; import org.springframework.data.jpa.repository.JpaRepository; public interface RoleRepository extends JpaRepository<Role, RoleType> { }
[ "falanadamian@gmail.com" ]
falanadamian@gmail.com
ef16369f1a53e28dc6591be81cf157c6d5f7badf
ff79e46531d5ad204abd019472087b0ee67d6bd5
/common/util/src/och/util/model/Pair.java
fed252da59923db6033a338d18e5793e2241537c
[ "Apache-2.0" ]
permissive
Frankie-666/live-chat-engine
24f927f152bf1ef46b54e3d55ad5cf764c37c646
3125d34844bb82a34489d05f1dc5e9c4aaa885a0
refs/heads/master
2020-12-25T16:36:00.156135
2015-08-16T09:16:57
2015-08-16T09:16:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,066
java
/* * Copyright 2015 Evgeny Dolganov (evgenij.dolganov@gmail.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package och.util.model; public class Pair<A, B>{ public A first; public B second; public Pair(A first, B second) { super(); this.first = first; this.second = second; } public Pair() { super(); } public void setFirst(A first) { this.first = first; } public void setSecond(B second) { this.second = second; } @Override public String toString() { return "Pair [" + first + ", " + second + "]"; } }
[ "evgenij.dolganov@gmail.com" ]
evgenij.dolganov@gmail.com
c23183d816b4a0860078c926883dd068ef0e6f07
080e9d6f10e03c2ca4ca2c76263de3c2e97d8f99
/everyreplycore/testsrc/com/everyreply/core/job/QuoteToExpireSoonJobPerformableTest.java
37450325b495865880015ea52b428282e5a4a1ba
[]
no_license
erkumod/everyreply
3421915fdce20a2f1ffc7d64405a7c40a4a6e4b6
b48e0feeec96bcfec41080d32c30932f053c8d5c
refs/heads/master
2020-06-25T00:36:57.941164
2019-11-02T09:09:39
2019-11-02T09:09:39
199,141,107
1
0
null
2020-04-30T09:53:35
2019-07-27T08:58:06
Java
UTF-8
Java
false
false
4,276
java
/* * [y] hybris Platform * * Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. * * This software is the confidential and proprietary information of SAP * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with SAP. */ package com.everyreply.core.job; import static com.everyreply.core.job.QuoteToExpireSoonJobPerformable.DAYS_TO_EXPIRE; import static com.everyreply.core.job.QuoteToExpireSoonJobPerformable.DEFAULT_DAYS_TO_EXPIRE; import static org.hamcrest.Matchers.hasProperty; import static org.hamcrest.Matchers.sameInstance; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anySet; import static org.mockito.Matchers.argThat; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.*; import java.util.Arrays; import java.util.Date; import java.util.GregorianCalendar; import java.util.Set; import org.apache.commons.configuration.Configuration; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; import org.mockito.runners.MockitoJUnitRunner; import de.hybris.bootstrap.annotations.UnitTest; import de.hybris.platform.commerceservices.enums.QuoteNotificationType; import de.hybris.platform.commerceservices.order.dao.CommerceQuoteDao; import de.hybris.platform.core.enums.QuoteState; import de.hybris.platform.core.model.order.QuoteModel; import de.hybris.platform.cronjob.model.CronJobModel; import de.hybris.platform.servicelayer.config.ConfigurationService; import de.hybris.platform.servicelayer.event.EventService; import de.hybris.platform.servicelayer.model.ModelService; import de.hybris.platform.servicelayer.search.SearchResult; import de.hybris.platform.servicelayer.time.TimeService; @RunWith(MockitoJUnitRunner.class) @UnitTest public class QuoteToExpireSoonJobPerformableTest { @Mock protected Set<QuoteState> supportedQuoteStatuses; @Mock protected CommerceQuoteDao commerceQuoteDao; @Mock private EventService eventService; @Mock private ModelService modelService; @Mock private ConfigurationService configurationService; @Mock private TimeService timeService; @Spy @InjectMocks private final QuoteToExpireSoonJobPerformable job = new QuoteToExpireSoonJobPerformable(); @Test public void testPerform() { final Date date1 = new GregorianCalendar(2017, 1, 25, 10, 0, 0).getTime(); final Date date2 = new GregorianCalendar(2017, 1, 25, 18, 0, 0).getTime(); // current date final Date date3 = new GregorianCalendar(2017, 1, 28, 10, 0, 0).getTime(); final Date date4 = new GregorianCalendar(2017, 1, 28, 18, 0, 0).getTime(); // three days from current date // Mock current date time doReturn(date2).when(timeService).getCurrentTime(); // Mock search results final SearchResult<QuoteModel> searchResult = mock(SearchResult.class); final QuoteModel quote1 = buildQuoteModel(date1); final QuoteModel quote2 = buildQuoteModel(date2); final QuoteModel quote3 = buildQuoteModel(date3); final QuoteModel quote4 = buildQuoteModel(date4); doReturn(Arrays.asList(quote1, quote2, quote3, quote4)).when(searchResult).getResult(); doReturn(searchResult).when(commerceQuoteDao).findQuotesSoonToExpire(eq(date2), eq(date4), any(QuoteNotificationType.class), anySet()); // Mock cron job final CronJobModel cronJob = mock(CronJobModel.class); Configuration configuration = mock(Configuration.class); doReturn(configuration).when(configurationService).getConfiguration(); doReturn(Integer.valueOf(3)).when(configuration).getInt(DAYS_TO_EXPIRE, DEFAULT_DAYS_TO_EXPIRE); job.perform(cronJob); verify(commerceQuoteDao).findQuotesSoonToExpire(eq(date2), eq(date4), eq(QuoteNotificationType.EXPIRING_SOON), eq(supportedQuoteStatuses)); searchResult.getResult().stream() .forEach(quoteModel -> verify(eventService).publishEvent(argThat(hasProperty("quote", sameInstance(quoteModel))))); } private QuoteModel buildQuoteModel(final Date expiryTime) { final QuoteModel quoteModel = mock(QuoteModel.class); doReturn(expiryTime).when(quoteModel).getExpirationTime(); return quoteModel; } }
[ "erkumod@gmail.com" ]
erkumod@gmail.com
53c33d2f2271591e46749a830f9b04caa52796da
41cc5f970fbd2e7e3d2dbc29f82cce001d761d86
/src/test/java/edu/berkeley/cs186/database/concurrency/TestLockManager.java
415713f04eb3c4121b9195400b43d03874ffb701
[]
no_license
miueon/sp20-moocbase
3870b1cc9953796edece5422bda3906c55e38de5
59886b600441ae8b8e72425ca71c4d30dd909550
refs/heads/master
2022-04-06T23:51:44.570843
2020-01-21T17:06:05
2020-01-21T17:06:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
18,764
java
package edu.berkeley.cs186.database.concurrency; import edu.berkeley.cs186.database.AbstractTransactionContext; import edu.berkeley.cs186.database.TransactionContext; import edu.berkeley.cs186.database.TimeoutScaling; import edu.berkeley.cs186.database.categories.*; import edu.berkeley.cs186.database.common.Pair; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.rules.DisableOnDebug; import org.junit.rules.TestRule; import org.junit.rules.Timeout; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicBoolean; import static org.junit.Assert.*; @Category({HW4Tests.class, HW4Part1Tests.class}) public class TestLockManager { private LoggingLockManager lockman; private TransactionContext[] transactions; private ResourceName dbResource; private ResourceName[] tables; // 2 seconds per test @Rule public TestRule globalTimeout = new DisableOnDebug(Timeout.millis((long) ( 2000 * TimeoutScaling.factor))); static boolean holds(LockManager lockman, TransactionContext transaction, ResourceName name, LockType type) { List<Lock> locks = lockman.getLocks(transaction); if (locks == null) { return false; } for (Lock lock : locks) { if (lock.name == name && lock.lockType == type) { return true; } } return false; } @Before public void setUp() { lockman = new LoggingLockManager(); transactions = new TransactionContext[8]; dbResource = new ResourceName(new Pair<>("database", 0L)); tables = new ResourceName[transactions.length]; for (int i = 0; i < transactions.length; ++i) { transactions[i] = new DummyTransactionContext(lockman, i); tables[i] = new ResourceName(dbResource, new Pair<>("table" + i, (long) i)); } } @Test @Category(PublicTests.class) public void testSimpleAcquireRelease() { DeterministicRunner runner = new DeterministicRunner(1); runner.run(0, () -> { lockman.acquireAndRelease(transactions[0], tables[0], LockType.S, Collections.emptyList()); lockman.acquireAndRelease(transactions[0], tables[1], LockType.S, Collections.singletonList(tables[0])); }); assertEquals(LockType.NL, lockman.getLockType(transactions[0], tables[0])); assertEquals(Collections.emptyList(), lockman.getLocks(tables[0])); assertEquals(LockType.S, lockman.getLockType(transactions[0], tables[1])); assertEquals(Collections.singletonList(new Lock(tables[1], LockType.S, 0L)), lockman.getLocks(tables[1])); runner.joinAll(); } @Test @Category(PublicTests.class) public void testAcquireReleaseQueue() { DeterministicRunner runner = new DeterministicRunner(2); runner.run(0, () -> lockman.acquireAndRelease(transactions[0], tables[0], LockType.X, Collections.emptyList())); runner.run(1, () -> lockman.acquireAndRelease(transactions[1], tables[1], LockType.X, Collections.emptyList())); runner.run(0, () -> lockman.acquireAndRelease(transactions[0], tables[1], LockType.X, Collections.singletonList(tables[0]))); assertEquals(LockType.X, lockman.getLockType(transactions[0], tables[0])); assertEquals(Collections.singletonList(new Lock(tables[0], LockType.X, 0L)), lockman.getLocks(tables[0])); assertEquals(LockType.NL, lockman.getLockType(transactions[0], tables[1])); assertEquals(Collections.singletonList(new Lock(tables[1], LockType.X, 1L)), lockman.getLocks(tables[1])); assertTrue(transactions[0].getBlocked()); runner.join(1); } @Test @Category(PublicTests.class) public void testAcquireReleaseDuplicateLock() { DeterministicRunner runner = new DeterministicRunner(1); runner.run(0, () -> lockman.acquireAndRelease(transactions[0], tables[0], LockType.X, Collections.emptyList())); try { runner.run(0, () -> lockman.acquireAndRelease(transactions[0], tables[0], LockType.X, Collections.emptyList())); fail(); } catch (DuplicateLockRequestException e) { // do nothing } runner.joinAll(); } @Test @Category(PublicTests.class) public void testAcquireReleaseNotHeld() { DeterministicRunner runner = new DeterministicRunner(1); runner.run(0, () -> lockman.acquireAndRelease(transactions[0], tables[0], LockType.X, Collections.emptyList())); try { runner.run(0, () -> lockman.acquireAndRelease(transactions[0], tables[2], LockType.X, Arrays.asList(tables[0], tables[1]))); fail(); } catch (NoLockHeldException e) { // do nothing } runner.joinAll(); } @Test @Category(PublicTests.class) public void testAcquireReleaseUpgrade() { DeterministicRunner runner = new DeterministicRunner(1); runner.run(0, () -> { lockman.acquireAndRelease(transactions[0], tables[0], LockType.S, Collections.emptyList()); lockman.acquireAndRelease(transactions[0], tables[0], LockType.X, Collections.singletonList(tables[0])); }); assertEquals(LockType.X, lockman.getLockType(transactions[0], tables[0])); assertEquals(Collections.singletonList(new Lock(tables[0], LockType.X, 0L)), lockman.getLocks(tables[0])); assertFalse(transactions[0].getBlocked()); runner.joinAll(); } @Test @Category(PublicTests.class) public void testSimpleAcquireLock() { DeterministicRunner runner = new DeterministicRunner(2); runner.run(0, () -> lockman.acquire(transactions[0], tables[0], LockType.S)); runner.run(1, () -> lockman.acquire(transactions[1], tables[1], LockType.X)); assertEquals(LockType.S, lockman.getLockType(transactions[0], tables[0])); assertEquals(Collections.singletonList(new Lock(tables[0], LockType.S, 0L)), lockman.getLocks(tables[0])); assertEquals(LockType.X, lockman.getLockType(transactions[1], tables[1])); assertEquals(Collections.singletonList(new Lock(tables[1], LockType.X, 1L)), lockman.getLocks(tables[1])); runner.joinAll(); } @Test @Category(PublicTests.class) public void testSimpleAcquireLockFail() { DeterministicRunner runner = new DeterministicRunner(1); TransactionContext t1 = transactions[0]; ResourceName r1 = dbResource; runner.run(0, () -> lockman.acquire(t1, r1, LockType.X)); try { runner.run(0, () -> lockman.acquire(t1, r1, LockType.X)); fail(); } catch (DuplicateLockRequestException e) { // do nothing } runner.joinAll(); } @Test @Category(PublicTests.class) public void testSimpleReleaseLock() { DeterministicRunner runner = new DeterministicRunner(1); runner.run(0, () -> { lockman.acquire(transactions[0], dbResource, LockType.X); lockman.release(transactions[0], dbResource); }); assertEquals(LockType.NL, lockman.getLockType(transactions[0], dbResource)); assertEquals(Collections.emptyList(), lockman.getLocks(dbResource)); runner.joinAll(); } @Test @Category(PublicTests.class) public void testSimpleConflict() { DeterministicRunner runner = new DeterministicRunner(2); runner.run(0, () -> lockman.acquire(transactions[0], dbResource, LockType.X)); runner.run(1, () -> lockman.acquire(transactions[1], dbResource, LockType.X)); assertEquals(LockType.X, lockman.getLockType(transactions[0], dbResource)); assertEquals(LockType.NL, lockman.getLockType(transactions[1], dbResource)); assertEquals(Collections.singletonList(new Lock(dbResource, LockType.X, 0L)), lockman.getLocks(dbResource)); assertFalse(transactions[0].getBlocked()); assertTrue(transactions[1].getBlocked()); runner.run(0, () -> lockman.release(transactions[0], dbResource)); assertEquals(LockType.NL, lockman.getLockType(transactions[0], dbResource)); assertEquals(LockType.X, lockman.getLockType(transactions[1], dbResource)); assertEquals(Collections.singletonList(new Lock(dbResource, LockType.X, 1L)), lockman.getLocks(dbResource)); assertFalse(transactions[0].getBlocked()); assertFalse(transactions[1].getBlocked()); runner.joinAll(); } @Test @Category(PublicTests.class) public void testSXS() { DeterministicRunner runner = new DeterministicRunner(3); List<Boolean> blocked_status = new ArrayList<>(); runner.run(0, () -> lockman.acquire(transactions[0], dbResource, LockType.S)); runner.run(1, () -> lockman.acquire(transactions[1], dbResource, LockType.X)); runner.run(2, () -> lockman.acquire(transactions[2], dbResource, LockType.S)); assertEquals(Collections.singletonList(new Lock(dbResource, LockType.S, 0L)), lockman.getLocks(dbResource)); for (int i = 0; i < 3; ++i) { blocked_status.add(i, transactions[i].getBlocked()); } assertEquals(Arrays.asList(false, true, true), blocked_status); runner.run(0, () -> lockman.release(transactions[0], dbResource)); assertEquals(Collections.singletonList(new Lock(dbResource, LockType.X, 1L)), lockman.getLocks(dbResource)); blocked_status.clear(); for (int i = 0; i < 3; ++i) { blocked_status.add(i, transactions[i].getBlocked()); } assertEquals(Arrays.asList(false, false, true), blocked_status); runner.run(1, () -> lockman.release(transactions[1], dbResource)); assertEquals(Collections.singletonList(new Lock(dbResource, LockType.S, 2L)), lockman.getLocks(dbResource)); blocked_status.clear(); for (int i = 0; i < 3; ++i) { blocked_status.add(i, transactions[i].getBlocked()); } assertEquals(Arrays.asList(false, false, false), blocked_status); runner.joinAll(); } @Test @Category(PublicTests.class) public void testXSXS() { DeterministicRunner runner = new DeterministicRunner(4); List<Boolean> blocked_status = new ArrayList<>(); runner.run(0, () -> lockman.acquire(transactions[0], dbResource, LockType.X)); runner.run(1, () -> lockman.acquire(transactions[1], dbResource, LockType.S)); runner.run(2, () -> lockman.acquire(transactions[2], dbResource, LockType.X)); runner.run(3, () -> lockman.acquire(transactions[3], dbResource, LockType.S)); assertEquals(Collections.singletonList(new Lock(dbResource, LockType.X, 0L)), lockman.getLocks(dbResource)); for (int i = 0; i < 4; ++i) { blocked_status.add(i, transactions[i].getBlocked()); } assertEquals(Arrays.asList(false, true, true, true), blocked_status); runner.run(0, () -> lockman.release(transactions[0], dbResource)); assertEquals(Collections.singletonList(new Lock(dbResource, LockType.S, 1L)), lockman.getLocks(dbResource)); blocked_status.clear(); for (int i = 0; i < 4; ++i) { blocked_status.add(i, transactions[i].getBlocked()); } assertEquals(Arrays.asList(false, false, true, true), blocked_status); runner.run(1, () -> lockman.release(transactions[1], dbResource)); assertEquals(Collections.singletonList(new Lock(dbResource, LockType.X, 2L)), lockman.getLocks(dbResource)); blocked_status.clear(); for (int i = 0; i < 4; ++i) { blocked_status.add(i, transactions[i].getBlocked()); } assertEquals(Arrays.asList(false, false, false, true), blocked_status); runner.run(2, () -> lockman.release(transactions[2], dbResource)); assertEquals(Collections.singletonList(new Lock(dbResource, LockType.S, 3L)), lockman.getLocks(dbResource)); blocked_status.clear(); for (int i = 0; i < 4; ++i) { blocked_status.add(i, transactions[i].getBlocked()); } assertEquals(Arrays.asList(false, false, false, false), blocked_status); runner.joinAll(); } @Test @Category(PublicTests.class) public void testSimplePromoteLock() { DeterministicRunner runner = new DeterministicRunner(1); runner.run(0, () -> { lockman.acquire(transactions[0], dbResource, LockType.S); lockman.promote(transactions[0], dbResource, LockType.X); }); assertEquals(LockType.X, lockman.getLockType(transactions[0], dbResource)); assertEquals(Collections.singletonList(new Lock(dbResource, LockType.X, 0L)), lockman.getLocks(dbResource)); runner.joinAll(); } @Test @Category(PublicTests.class) public void testSimplePromoteLockNotHeld() { DeterministicRunner runner = new DeterministicRunner(1); try { runner.run(0, () -> lockman.promote(transactions[0], dbResource, LockType.X)); fail(); } catch (NoLockHeldException e) { // do nothing } runner.joinAll(); } @Test @Category(PublicTests.class) public void testSimplePromoteLockAlreadyHeld() { DeterministicRunner runner = new DeterministicRunner(1); runner.run(0, () -> lockman.acquire(transactions[0], dbResource, LockType.X)); try { runner.run(0, () -> lockman.promote(transactions[0], dbResource, LockType.X)); fail(); } catch (DuplicateLockRequestException e) { // do nothing } runner.joinAll(); } @Test @Category(PublicTests.class) public void testFIFOQueueLocks() { DeterministicRunner runner = new DeterministicRunner(3); runner.run(0, () -> lockman.acquire(transactions[0], dbResource, LockType.X)); runner.run(1, () -> lockman.acquire(transactions[1], dbResource, LockType.X)); runner.run(2, () -> lockman.acquire(transactions[2], dbResource, LockType.X)); assertTrue(holds(lockman, transactions[0], dbResource, LockType.X)); assertFalse(holds(lockman, transactions[1], dbResource, LockType.X)); assertFalse(holds(lockman, transactions[2], dbResource, LockType.X)); runner.run(0, () -> lockman.release(transactions[0], dbResource)); assertFalse(holds(lockman, transactions[0], dbResource, LockType.X)); assertTrue(holds(lockman, transactions[1], dbResource, LockType.X)); assertFalse(holds(lockman, transactions[2], dbResource, LockType.X)); runner.run(1, () -> lockman.release(transactions[1], dbResource)); assertFalse(holds(lockman, transactions[0], dbResource, LockType.X)); assertFalse(holds(lockman, transactions[1], dbResource, LockType.X)); assertTrue(holds(lockman, transactions[2], dbResource, LockType.X)); runner.joinAll(); } @Test @Category(PublicTests.class) public void testStatusUpdates() { DeterministicRunner runner = new DeterministicRunner(2); TransactionContext t1 = transactions[0]; TransactionContext t2 = transactions[1]; ResourceName r1 = dbResource; runner.run(0, () -> lockman.acquire(t1, r1, LockType.X)); runner.run(1, () -> lockman.acquire(t2, r1, LockType.X)); assertTrue(holds(lockman, t1, r1, LockType.X)); assertFalse(holds(lockman, t2, r1, LockType.X)); assertFalse(t1.getBlocked()); assertTrue(t2.getBlocked()); runner.run(0, () -> lockman.release(t1, r1)); assertFalse(holds(lockman, t1, r1, LockType.X)); assertTrue(holds(lockman, t2, r1, LockType.X)); assertFalse(t1.getBlocked()); assertFalse(t2.getBlocked()); runner.joinAll(); } @Test @Category(PublicTests.class) public void testTableEventualUpgrade() { DeterministicRunner runner = new DeterministicRunner(2); TransactionContext t1 = transactions[0]; TransactionContext t2 = transactions[1]; ResourceName r1 = dbResource; runner.run(0, () -> lockman.acquire(t1, r1, LockType.S)); runner.run(1, () -> lockman.acquire(t2, r1, LockType.S)); assertTrue(holds(lockman, t1, r1, LockType.S)); assertTrue(holds(lockman, t2, r1, LockType.S)); runner.run(0, () -> lockman.promote(t1, r1, LockType.X)); assertTrue(holds(lockman, t1, r1, LockType.S)); assertFalse(holds(lockman, t1, r1, LockType.X)); assertTrue(holds(lockman, t2, r1, LockType.S)); runner.run(1, () -> lockman.release(t2, r1)); assertTrue(holds(lockman, t1, r1, LockType.X)); assertFalse(holds(lockman, t2, r1, LockType.S)); runner.run(0, () -> lockman.release(t1, r1)); assertFalse(holds(lockman, t1, r1, LockType.X)); assertFalse(holds(lockman, t2, r1, LockType.S)); runner.joinAll(); } @Test @Category(PublicTests.class) public void testIntentBlockedAcquire() { DeterministicRunner runner = new DeterministicRunner(2); TransactionContext t1 = transactions[0]; TransactionContext t2 = transactions[1]; ResourceName r0 = dbResource; runner.run(0, () -> lockman.acquire(t1, r0, LockType.S)); runner.run(1, () -> lockman.acquire(t2, r0, LockType.IX)); assertTrue(holds(lockman, t1, r0, LockType.S)); assertFalse(holds(lockman, t2, r0, LockType.IX)); runner.run(0, () -> lockman.release(t1, r0)); assertFalse(holds(lockman, t1, r0, LockType.S)); assertTrue(holds(lockman, t2, r0, LockType.IX)); runner.joinAll(); } @Test @Category(PublicTests.class) public void testReleaseUnheldLock() { DeterministicRunner runner = new DeterministicRunner(1); TransactionContext t1 = transactions[0]; try { runner.run(0, () -> lockman.release(t1, dbResource)); fail(); } catch (NoLockHeldException e) { // do nothing } runner.joinAll(); } }
[ "chriswong21@berkeley.edu" ]
chriswong21@berkeley.edu
946b08e9ded035b699f22c8792de13f2ffcb52b5
5a8e7ab780c40eebd414b3aab7a1b64c31f9c76b
/src/main/java/com/fsp/challenge/daos/CustomerDao.java
44db7cda802a9e96940c4d2f4c24296a9c6044dc
[]
no_license
aksh4y/FastSpring-Pizza-Challenge
383e83136985895b54eaec1ab7848e0af96aa045
600fb5512a9cfed8b7c274f7b1f717b278577cf1
refs/heads/master
2020-04-02T03:07:10.289562
2018-11-22T15:48:35
2018-11-22T15:48:35
153,947,073
0
0
null
null
null
null
UTF-8
Java
false
false
1,794
java
package com.fsp.challenge.daos; import org.springframework.beans.factory.annotation.Autowired; 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.RestController; import com.fsp.challenge.entities.Customer; import com.fsp.challenge.repositories.CustomerRepository; @RestController public class CustomerDao { @Autowired CustomerRepository customerRepository; @PostMapping("/api/customer") public Customer createCustomer(@RequestBody Customer customer) { return customerRepository.save(customer); } @GetMapping("/api/customer") public Iterable<Customer> findAllCustomers() { return customerRepository.findAll(); } @GetMapping("/api/customer/{customerId}") public Customer findCustomerById( @PathVariable("customerId") int id) { return customerRepository.findOne(id); } @PutMapping("/api/customer/{customerId}") public Customer updateCustomer( @PathVariable("customerId") int id, @RequestBody Customer newCustomer) { Customer customer = customerRepository.findOne(id); customer.set(newCustomer); return customerRepository.save(customer); } @DeleteMapping("/api/customer/{customerId}") public void deleteCustomer (@PathVariable("customerId") int id) { customerRepository.delete(id); } /*public void test() { // Delete all customers List<Customer> customers = (List<Customer>) findAllCustomers(); for(Customer customer : customers) { deleteCustomer(customer.getId()); } }*/ }
[ "akshay.sadarangani@gmail.com" ]
akshay.sadarangani@gmail.com
1375935c9cf2ee89859a77f518d6d414d20a2b55
7628163c0ea0add2d763ce5ad4d1ecb70b4e84e7
/engine/src/main/java/org/terasology/engine/module/ExternalApiWhitelist.java
094d582d6bf0430122e21bf72a9053f3ef4f9e1f
[ "CC-BY-4.0", "Apache-2.0" ]
permissive
richnewcomb/Terasology
c6d93ec500cd281802555eafd6268ad3a2632b5a
4e0c6b0d9b0b77e4572de3decc18338bbfc2b48f
refs/heads/develop
2021-01-24T09:38:28.493176
2016-09-27T05:50:45
2016-09-27T05:50:45
69,521,708
1
0
null
2016-09-29T02:13:39
2016-09-29T02:13:39
null
UTF-8
Java
false
false
3,628
java
/* * Copyright 2016 MovingBlocks * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.terasology.engine.module; import com.google.common.collect.ImmutableSet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.BufferedReader; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.lang.reflect.InvocationTargetException; import java.util.Set; public final class ExternalApiWhitelist { public static final Set<String> PACKAGES = new ImmutableSet.Builder<String>() // TODO: This one org.terasology entry is a hack and needs a proper fix .add("org.terasology.world.biomes") .add("org.terasology.math.geom") .add("java.lang") .add("java.lang.invoke") .add("java.lang.ref") .add("java.math") .add("java.util") .add("java.util.concurrent") .add("java.util.concurrent.atomic") .add("java.util.concurrent.locks") .add("java.util.function") .add("java.util.regex") .add("java.util.stream") .add("java.awt") .add("java.awt.geom") .add("java.awt.image") .add("com.google.common.annotations") .add("com.google.common.cache") .add("com.google.common.collect") .add("com.google.common.base") .add("com.google.common.math") .add("com.google.common.primitives") .add("com.google.common.util.concurrent") .add("gnu.trove") .add("gnu.trove.decorator") .add("gnu.trove.function") .add("gnu.trove.iterator") .add("gnu.trove.iterator.hash") .add("gnu.trove.list") .add("gnu.trove.list.array") .add("gnu.trove.list.linked") .add("gnu.trove.map") .add("gnu.trove.map.hash") .add("gnu.trove.map.custom_hash") .add("gnu.trove.procedure") .add("gnu.trove.procedure.array") .add("gnu.trove.queue") .add("gnu.trove.set") .add("gnu.trove.set.hash") .add("gnu.trove.stack") .add("gnu.trove.stack.array") .add("gnu.trove.strategy") .add("javax.vecmath") .add("com.yourkit.runtime") .add("com.bulletphysics.linearmath") .add("sun.reflect") .build(); public static final Set<Class<?>> CLASSES = new ImmutableSet.Builder<Class<?>>() .add(com.esotericsoftware.reflectasm.MethodAccess.class) .add(IOException.class) .add(InvocationTargetException.class) .add(LoggerFactory.class) .add(Logger.class) .add(Reader.class) .add(StringReader.class) .add(BufferedReader.class) .add(java.awt.datatransfer.UnsupportedFlavorException.class) .add(java.nio.ByteBuffer.class) .add(java.nio.IntBuffer.class) .build(); private ExternalApiWhitelist() { } }
[ "jaffre.malo@gmail.com" ]
jaffre.malo@gmail.com
436382a97f81dca3b6be01acfbc787d8e2f2bc4b
5b0d51c9e9154d16c0b32252fd142b68964e49dd
/src/designpattern/structuralpattern/bridge/GreenCircle.java
dcb3f8ad1814c06c29e11b96c3f63a8126602718
[]
no_license
kiragirl/test
8b2eb67e36a4adb457487d5e366da7c7343530d2
30baff7f45eff3fbc43a72cfa411d2a41cfd381c
refs/heads/master
2021-05-10T10:47:22.811815
2019-07-04T01:46:03
2019-07-04T01:46:03
118,392,839
0
0
null
null
null
null
UTF-8
Java
false
false
571
java
/** * @author:liyiming * @date:2018年2月5日 * Description: **/ package designpattern.structuralpattern.bridge; /** * Title: GreenCircle Description: Company:pusense * * @author :lyiming * @date :2018年2月5日 **/ public class GreenCircle implements DrawAPI{ /** * @author:liyiming * @date:2018年2月5日 * @Description: * @param radius * @param x * @param y */ @Override public void drawCircle(int radius, int x, int y) { System.out.println("Drawing Circle[ color: green, radius: " + radius + ", x: " + x + ", " + y + "]"); } }
[ "liyiming0215@sina.com" ]
liyiming0215@sina.com
db58e85615e5398734da538453cbde02a3e9ecb8
3b40731b408184125f3424f611c446ce135f2a4d
/core/src/main/java/com/hna/social/weixin/connect/WeixinConnectionFactory.java
e1c0e828479d946850f14ceb4a5194e3bd86a378
[]
no_license
starway/security
3977055336cc4e827e8b7183e0746d641d05d1be
8f1c69d532977c09c302d0d3b0344afbb9ea7e59
refs/heads/master
2021-05-14T18:37:56.456161
2018-01-03T03:20:34
2018-01-03T03:20:34
116,080,798
0
0
null
null
null
null
UTF-8
Java
false
false
2,398
java
/** * */ package com.hna.social.weixin.connect; import com.imooc.security.core.social.weixin.api.Weixin; import org.springframework.social.connect.ApiAdapter; import org.springframework.social.connect.Connection; import org.springframework.social.connect.ConnectionData; import org.springframework.social.connect.support.OAuth2Connection; import org.springframework.social.connect.support.OAuth2ConnectionFactory; import org.springframework.social.oauth2.AccessGrant; import org.springframework.social.oauth2.OAuth2ServiceProvider; /** * 微信连接工厂 * * @author zhailiang * */ public class WeixinConnectionFactory extends OAuth2ConnectionFactory<Weixin> { /** * @param appId * @param appSecret */ public WeixinConnectionFactory(String providerId, String appId, String appSecret) { super(providerId, new WeixinServiceProvider(appId, appSecret), new WeixinAdapter()); } /** * 由于微信的openId是和accessToken一起返回的,所以在这里直接根据accessToken设置providerUserId即可,不用像QQ那样通过QQAdapter来获取 */ @Override protected String extractProviderUserId(AccessGrant accessGrant) { if(accessGrant instanceof WeixinAccessGrant) { return ((WeixinAccessGrant)accessGrant).getOpenId(); } return null; } /* (non-Javadoc) * @see org.springframework.social.connect.support.OAuth2ConnectionFactory#createConnection(org.springframework.social.oauth2.AccessGrant) */ public Connection<Weixin> createConnection(AccessGrant accessGrant) { return new OAuth2Connection<Weixin>(getProviderId(), extractProviderUserId(accessGrant), accessGrant.getAccessToken(), accessGrant.getRefreshToken(), accessGrant.getExpireTime(), getOAuth2ServiceProvider(), getApiAdapter(extractProviderUserId(accessGrant))); } /* (non-Javadoc) * @see org.springframework.social.connect.support.OAuth2ConnectionFactory#createConnection(org.springframework.social.connect.ConnectionData) */ public Connection<Weixin> createConnection(ConnectionData data) { return new OAuth2Connection<Weixin>(data, getOAuth2ServiceProvider(), getApiAdapter(data.getProviderUserId())); } private ApiAdapter<Weixin> getApiAdapter(String providerUserId) { return new WeixinAdapter(providerUserId); } private OAuth2ServiceProvider<Weixin> getOAuth2ServiceProvider() { return (OAuth2ServiceProvider<Weixin>) getServiceProvider(); } }
[ "tong_wei@hnair.com" ]
tong_wei@hnair.com
fc0380569555e925258bbba02132d305d7729a55
4531ded25a237c6968de4a612e1f5a592a9c0ade
/src/main/java/events/EventBrokerEvent.java
5f6f39580228f236040373927d8ecfc6c9c598cb
[ "Apache-2.0" ]
permissive
RTDM/rtdm-srv
46d1a4ac52abce9e9b17297b1fe09228335b3f5b
7eec3a1d4d5a9b900661fb7ae639b37ad35c657a
refs/heads/master
2021-01-22T20:25:59.958032
2014-10-12T19:00:31
2014-10-12T19:00:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
367
java
package events; public class EventBrokerEvent { private final String type; public EventBrokerEvent(String type) { this.type = type; } public String getType() { return type; } @Override public String toString() { return "EventBrokerEvent{" + "type='" + type + '\'' + '}'; } }
[ "xavier.hanin@4sh.fr" ]
xavier.hanin@4sh.fr
572ac9e92e3d7d1679c4b9f609f2ed45a8390e73
474844edc5f2a6b60ee13fcc65c206e900f01d88
/src/main/java/com/sys/pro/advice/LogAdvice.java
84b037ff0d0c4c08da5005658b3cde56fb02fa3e
[]
no_license
pampersnow/Sys-AdminPlatform
e0e93fbc8ca5d292a7228733ad5064bc1ef05e7f
0583542e05dbc94f4cc90dd744d4aa50ed9c0ec4
refs/heads/master
2020-04-13T04:23:26.600165
2018-12-26T10:03:09
2018-12-26T10:03:09
162,959,833
0
0
null
null
null
null
UTF-8
Java
false
false
1,874
java
package com.sys.pro.advice; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.reflect.MethodSignature; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; import com.sys.pro.annotation.LogAnnotation; import com.sys.pro.model.SysLogs; import com.sys.pro.service.SysLogService; import com.sys.pro.utils.UserUtil; import io.swagger.annotations.ApiOperation; /** * @author JYB * @date 2018.10 * @version 1.0 * @parameter 统一日志处理 * @return 返回值 * @throws 异常类及抛出条件 */ public class LogAdvice { @Autowired private SysLogService logService; @Around(value = "@annotation(com.sys.pro.annotation.LogAnnotation)") public Object logSave(ProceedingJoinPoint joinPoint) throws Throwable { SysLogs sysLogs = new SysLogs(); sysLogs.setUser(UserUtil.getLoginUser()); // 设置当前登录用户 MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature(); String module = null; LogAnnotation logAnnotation = methodSignature.getMethod().getDeclaredAnnotation(LogAnnotation.class); module = logAnnotation.module(); if (StringUtils.isEmpty(module)) { ApiOperation apiOperation = methodSignature.getMethod().getDeclaredAnnotation(ApiOperation.class); if (apiOperation != null) { module = apiOperation.value(); } } if (StringUtils.isEmpty(module)) { throw new RuntimeException("没有指定日志module"); } sysLogs.setModule(module); try { Object object = joinPoint.proceed(); sysLogs.setFlag(true); return object; } catch (Exception e) { sysLogs.setFlag(false); sysLogs.setRemark(e.getMessage()); throw e; } finally { if (sysLogs.getUser() != null) { logService.save(sysLogs); } } } }
[ "17611309300@163.com" ]
17611309300@163.com
efc6fa6fc0b0845b3fc43deada68f9de3db7569c
b6178780b1897aab7ee6b427020302622afbf7e4
/src/main/java/pokecube/core/commands/CountCommand.java
6dab29b4ed026ff251da9162da6bb8884cddeb83
[ "MIT" ]
permissive
Pokecube-Development/Pokecube-Core
ea9a22599fae9016f8277a30aee67a913b50d790
1343c86dcb60b72e369a06dd7f63c05103e2ab53
refs/heads/master
2020-03-26T20:59:36.089351
2020-01-20T19:00:53
2020-01-20T19:00:53
145,359,759
5
0
MIT
2019-06-08T22:58:58
2018-08-20T03:07:37
Java
UTF-8
Java
false
false
3,252
java
package pokecube.core.commands; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.Map.Entry; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.entity.Entity; import net.minecraft.server.MinecraftServer; import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; import pokecube.core.database.Database; import pokecube.core.database.PokedexEntry; import pokecube.core.interfaces.IPokemob; import pokecube.core.interfaces.PokecubeMod; import pokecube.core.interfaces.capabilities.CapabilityPokemob; import thut.core.common.commands.CommandTools; public class CountCommand extends CommandBase { @Override public int getRequiredPermissionLevel() { return 2; } @Override public String getName() { return "pokecount"; } @Override public String getUsage(ICommandSender sender) { return "/pokecount"; } @Override public void execute(MinecraftServer server, ICommandSender cSender, String[] args) throws CommandException { boolean specific = args.length > 0; World world = cSender.getEntityWorld(); List<Entity> entities = new ArrayList<Entity>(world.loadedEntityList); int count1 = 0; int count2 = 0; String name = ""; Map<PokedexEntry, Integer> counts = Maps.newHashMap(); PokedexEntry entry = null; if (specific) { name = args[1]; entry = Database.getEntry(name); if (entry == null) throw new CommandException(name + " not found"); } for (Entity o : entities) { IPokemob e = CapabilityPokemob.getPokemobFor(o); if (e != null) { if (!specific || e.getPokedexEntry() == entry) { if (o.getDistance(cSender.getPositionVector().x, cSender.getPositionVector().y, cSender.getPositionVector().z) > PokecubeMod.core.getConfig().maxSpawnRadius) count2++; else count1++; Integer i = counts.get(e.getPokedexEntry()); if (i == null) i = 0; counts.put(e.getPokedexEntry(), i + 1); } } } List<Map.Entry<PokedexEntry, Integer>> entries = Lists.newArrayList(counts.entrySet()); Collections.sort(entries, new Comparator<Map.Entry<PokedexEntry, Integer>>() { @Override public int compare(Entry<PokedexEntry, Integer> o1, Entry<PokedexEntry, Integer> o2) { return o2.getValue() - o1.getValue(); } }); cSender.sendMessage(CommandTools.makeTranslatedMessage("pokecube.command.count", "", count1, count2)); cSender.sendMessage(new TextComponentString(entries.toString())); } }
[ "elpatricimo@gmail.com" ]
elpatricimo@gmail.com
f87ae1bccc767b235a87b6435aea8c47c4e72b9a
8b5e2b57b05edc09e6c063046785f4e8234e8f2b
/MVN-SAT/src/main/java/br/com/barcadero/module/sat/devices/integrador/vfpe/Integrador.java
2cd44cf7ea956a7085bee8510d02dc61b4237a02
[]
no_license
Rafasystec/MVN
d3a0e82ecd22852642342196f873127164a20656
e8a739b27a8cde54579261ebce8771068fd385b3
refs/heads/master
2021-01-19T02:40:59.145594
2017-11-24T00:38:49
2017-11-24T00:38:49
54,285,723
1
0
null
null
null
null
UTF-8
Java
false
false
917
java
package br.com.barcadero.module.sat.devices.integrador.vfpe; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import br.com.barcadero.module.sat.devices.integrador.xml.Identificador; @XmlRootElement(name="Integrador") @XmlAccessorType(XmlAccessType.FIELD) public class Integrador { @XmlElement(name="Identificador") private Identificador identificador; @XmlElement(name="Componente") private Componente componente; public Identificador getIdentificador() { return identificador; } public void setIdentificador(Identificador identificador) { this.identificador = identificador; } public Componente getComponente() { return componente; } public void setComponente(Componente componente) { this.componente = componente; } }
[ "rafasystec@yahoo.com.br" ]
rafasystec@yahoo.com.br
62a4d81261bf74475c7e8ecb3c35585a60b7fd21
46550133a80aa6487ba5ccef710bdb84260314ff
/exoplayer-core/src/main/java/com/google/android/exoplayer2/offline/ActionFile.java
b7045c0fe0ddc242b52a81546f96806bbc11535a
[]
no_license
lgphill/Music
2102b6168b68d2ca54326bbbe51bb009fad518fa
6fbcd7a3c82633a09bc0fd3585540d83f3b42d3b
refs/heads/master
2020-04-11T01:40:18.576740
2018-12-12T03:19:50
2018-12-12T03:19:50
161,422,576
1
0
null
null
null
null
UTF-8
Java
false
false
3,379
java
/* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.android.exoplayer2.offline; import com.google.android.exoplayer2.offline.DownloadAction.Deserializer; import com.google.android.exoplayer2.util.AtomicFile; import com.google.android.exoplayer2.util.Util; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; /** * Stores and loads {@link DownloadAction}s to/from a file. */ public final class ActionFile { /* package */ static final int VERSION = 0; private final AtomicFile atomicFile; private final File actionFile; /** * @param actionFile File to be used to store and load {@link DownloadAction}s. */ public ActionFile(File actionFile) { this.actionFile = actionFile; atomicFile = new AtomicFile(actionFile); } /** * Loads {@link DownloadAction}s from file. * * @param deserializers {@link Deserializer}s to deserialize DownloadActions. * @return Loaded DownloadActions. If the action file doesn't exists returns an empty array. * @throws IOException If there is an error during loading. */ public DownloadAction[] load(Deserializer... deserializers) throws IOException { if (!actionFile.exists()) { return new DownloadAction[0]; } InputStream inputStream = null; try { inputStream = atomicFile.openRead(); DataInputStream dataInputStream = new DataInputStream(inputStream); int version = dataInputStream.readInt(); if (version > VERSION) { throw new IOException("Unsupported action file version: " + version); } int actionCount = dataInputStream.readInt(); DownloadAction[] actions = new DownloadAction[actionCount]; for (int i = 0; i < actionCount; i++) { actions[i] = DownloadAction.deserializeFromStream(deserializers, dataInputStream); } return actions; } finally { Util.closeQuietly(inputStream); } } /** * Stores {@link DownloadAction}s to file. * * @param downloadActions DownloadActions to store to file. * @throws IOException If there is an error during storing. */ public void store(DownloadAction... downloadActions) throws IOException { DataOutputStream output = null; try { output = new DataOutputStream(atomicFile.startWrite()); output.writeInt(VERSION); output.writeInt(downloadActions.length); for (DownloadAction action : downloadActions) { DownloadAction.serializeToStream(action, output); } atomicFile.endWrite(output); // Avoid calling close twice. output = null; } finally { Util.closeQuietly(output); } } }
[ "p_gpliu@tencent.com" ]
p_gpliu@tencent.com
c9e3ca896687dc5af317a248f28589c56749cc26
ac14f6052c15b6e2143894f19942d86776347a5c
/.metadata/.plugins/org.eclipse.core.resources/.history/a7/b074d5d4f77900151818c77ff3505142
67358d0e0e02cfd6af209297d56f4241204b2b4a
[]
no_license
Malience/Game-Jam-2015-Project
8e37f4b25fdf0297a204752110c8a8894d2ee457
6d91169f4da0a5d674f4df59621a0c8402a044a6
refs/heads/master
2021-12-14T02:41:25.169938
2015-10-24T03:24:33
2015-10-24T03:24:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,295
package com.base.engine.rendering; import com.base.engine.components.BaseLight; import com.base.engine.components.Camera; import com.base.engine.components.DirectionalLight; import com.base.engine.core.GameObject; import com.base.engine.core.Matrix4f; import com.base.engine.core.Transform; import com.base.engine.core.Vector3f; import com.base.engine.rendering.MeshLoading.ResourceManagement.MappedValues; import java.util.ArrayList; import java.util.HashMap; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL12.*; import static org.lwjgl.opengl.GL14.*; import static org.lwjgl.opengl.GL15.glDeleteBuffers; import static org.lwjgl.opengl.GL30.*; import static org.lwjgl.opengl.GL32.*; public class RenderingEngine extends MappedValues { private Camera mainCamera; private ArrayList<BaseLight> lights; private BaseLight activeLight; private HashMap<String, Integer> samplerMap; private Shader forwardAmbient; private Shader shadowShader; public static DirectionalLight dlight; public RenderingEngine() { super(); lights = new ArrayList<BaseLight>(); samplerMap = new HashMap<String, Integer>(); samplerMap.put("diffuse", 0); addVector3f("ambient", new Vector3f(0.1f,0.1f,0.1f)); forwardAmbient = new Shader("forward-ambient"); shadowShader = new Shader("shadowShader"); glClearColor(0.0f, 1.0f, 1.0f, 0.0f); glFrontFace(GL_CW); glCullFace(GL_BACK); glEnable(GL_CULL_FACE); glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_CLAMP); glEnable(GL_TEXTURE_2D); } public void updateUniformStruct(Transform transform, Material material, RenderingEngine renderingEngine, String uniformName, String uniformType) { throw new IllegalArgumentException(uniformName + " is not a supported type in Rendering Engine"); } public void render(GameObject object) { int framebuffer = glGenFramebuffers(); glBindFramebuffer(GL_FRAMEBUFFER, framebuffer); int depthTexture = glGenTextures(); glBindTexture(GL_TEXTURE_2D, depthTexture); glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT16, 1024, 1024, 0, GL_DEPTH_COMPONENT, GL_FLOAT, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depthTexture, 0); glDrawBuffer(GL_NONE); Vector3f lightInvDir = dlight.getDirection(); Matrix4f depthProjectionMatrix = new Matrix4f().initOrthographic(-10, 10, -10, 10, -10, 20); Matrix4f depthViewMatrix = new Transform().getLookAtRotation(lightInvDir, new Vector3f(0,1,0)).toRotationMatrix(); //Matrix4f depthModelMatrix = new Matrix4f().initIdentity(); //Doesn't matter Matrix4f depthMVP = depthProjectionMatrix.mul(depthViewMatrix); dlight.setMVP(depthMVP); activeLight = dlight; object.renderAll(shadowShader, this); samplerMap.put("shadowMap", depthTexture); //Window.bindRenderTarget(Texture.renderToTexture()); Window.bindAsRenderTarget(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); object.renderAll(forwardAmbient, this); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE); glDepthMask(false); glDepthFunc(GL_EQUAL); for(BaseLight light : lights) { activeLight = light; object.renderAll(light.getShader(), this); } glDepthFunc(GL_LESS); glDepthMask(true); glDisable(GL_BLEND); glDeleteTextures(depthTexture); glDeleteBuffers(depthTexture); glDeleteBuffers(framebuffer); } // private static void clearScreen() // { // //TODO: Stencil Buffer // glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // } public static String getOpenGLVersion() { return glGetString(GL_VERSION); } public void addLight(BaseLight light) { lights.add(light); } public void addCamera(Camera camera) { mainCamera = camera; } public int getSamplerSlot(String samplerName) { return samplerMap.get(samplerName); } public BaseLight getActiveLight() { return activeLight; } public Camera getMainCamera() { return mainCamera; } public void setMainCamera(Camera mainCamera) { this.mainCamera = mainCamera; } }
[ "Mastamats@yahoo.com" ]
Mastamats@yahoo.com
ebfd482beb9a4a7b13957f785195b3f5aa9e66eb
2a11a0386e79d2bdeac4b5fcfaab605befcf0b09
/src/jeet/code/BTest.java
d22bbb6bb357dad55a948121cb0583577c8e52f7
[]
no_license
hanshihai/jeetcode
0199ea5e99bfcde5dd0bc20f0454aeda5727fa18
f025fd2a2667174508d6a5e2b5d2b79506408eb3
refs/heads/master
2022-11-03T15:30:56.110656
2022-10-21T08:40:27
2022-10-21T08:40:27
126,299,106
1
0
null
null
null
null
UTF-8
Java
false
false
1,435
java
package jeet.code; import java.util.ArrayList; import java.util.List; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; public class BTest { public static int triangle(int a, int b, int c) { if(a <= 0 || b <= 0 || c <= 0) { return 0; }else if(a==b && b==c) { return 2; } if(a+b>c && a+c>b && b+c>a) { return 1; } return 0; } public static List<Integer> deltaArray(int[] array) { if(array == null || array.length == 0) { return new ArrayList(); } List<Integer> result = new ArrayList<>(); if(array.length == 1) { result.add(array[0]); return result; } Integer temp = array[0]; boolean start = true; for(int a:array) { if(start) { result.add(temp); start = false; }else{ int delta = a - temp; temp = a; result.add(delta); } } return result; } public static void main(String[] args) { assertThat(2, is(BTest.triangle(3,3,3))); assertThat(1, is(BTest.triangle(3,4,6))); assertThat(0, is(BTest.triangle(3,5,9))); BTest.deltaArray(new int[] {100, 50, 25, 12, 6, 3}).stream().forEach(i -> System.out.print(i + " ")); } }
[ "shi-hai.han@dxc.com" ]
shi-hai.han@dxc.com
f873b137a3a84d6b960a64f7ff0340e45fa2e466
1c547eb3243a8a938a1b2cbbefbcbb2e31f43ea4
/src/Default/AutoitDemo.java
466a6930cd4e8406338ef2dd970b267e790a04c4
[]
no_license
shubhamjoshi2436/Selenium
8b2bbd59c4ea69b12e0f4c26bed7509cd4751574
caeb2d7afdbc23e97d7ffdf09126e472906fc5c8
refs/heads/master
2022-11-25T11:06:11.201741
2020-08-04T07:30:08
2020-08-04T07:30:08
284,909,190
0
0
null
null
null
null
UTF-8
Java
false
false
802
java
package Default; import java.io.IOException; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class AutoitDemo { public static void main(String[] args) throws InterruptedException, IOException { System.setProperty("webdriver.chrome.driver", ".\\software\\chromedriver.exe"); ChromeDriver driver=new ChromeDriver(); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.get("http://demo.guru99.com/test/upload/"); Thread.sleep(2000); WebElement upload = driver.findElement(By.id("file_wraper0")); upload.click(); Runtime.getRuntime().exec("C:\\Users\\Shubham\\Desktop\\upload.exe"); } }
[ "Shubham@DESKTOP-LT0MAOO" ]
Shubham@DESKTOP-LT0MAOO
e0770549d804c586fd4317c8c13e1809161dbd0f
647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4
/com.tencent.minihd.qq/assets/exlibs.1.jar/classes.jar/jif.java
921fc85990e54297e1d5b37be95530c417a9bba8
[]
no_license
tsuzcx/qq_apk
0d5e792c3c7351ab781957bac465c55c505caf61
afe46ef5640d0ba6850cdefd3c11badbd725a3f6
refs/heads/main
2022-07-02T10:32:11.651957
2022-02-01T12:41:38
2022-02-01T12:41:38
453,860,108
36
9
null
2022-01-31T09:46:26
2022-01-31T02:43:22
Java
UTF-8
Java
false
false
2,691
java
import android.os.Handler; import android.os.Message; import com.tencent.mobileqq.emoticon.DownloadInfo; import com.tencent.mobileqq.msf.sdk.MsfSdkUtils; import com.tencent.mobileqq.nearby.profilecard.NearbyPeopleProfileActivity; import com.tencent.mobileqq.util.ProfileCardUtil; import com.tencent.mobileqq.utils.HttpDownloadUtil; import com.tencent.qphone.base.util.QLog; import java.io.File; public class jif implements Runnable { public jif(NearbyPeopleProfileActivity paramNearbyPeopleProfileActivity, String paramString1, int paramInt, String paramString2, boolean paramBoolean) {} public void run() { int j = 1; Object localObject = this.jdField_a_of_type_JavaLangString + this.jdField_a_of_type_Int; if (QLog.isColorLevel()) { QLog.e("Q.nearby_people_card.", 2, "downloadHDAvatar() uin=" + this.b + ", mgSize=" + this.jdField_a_of_type_Int + ", url = " + (String)localObject); } File localFile1 = new File(ProfileCardUtil.a(String.valueOf(this.b))); boolean bool2; if ((localFile1.exists()) && (!this.jdField_a_of_type_Boolean)) { if (QLog.isColorLevel()) { QLog.e("Q.nearby_people_card.", 2, "download HDAvatar file is exists"); } bool2 = true; localObject = new Message(); ((Message)localObject).what = 102; if (!bool2) { break label296; } i = 1; label158: ((Message)localObject).arg1 = i; if (!this.jdField_a_of_type_Boolean) { break label301; } } label296: label301: for (int i = j;; i = 0) { ((Message)localObject).arg2 = i; this.jdField_a_of_type_ComTencentMobileqqNearbyProfilecardNearbyPeopleProfileActivity.a.sendMessage((Message)localObject); return; File localFile2 = new File(localFile1.getPath() + Long.toString(System.currentTimeMillis())); if (HttpDownloadUtil.a(this.jdField_a_of_type_ComTencentMobileqqNearbyProfilecardNearbyPeopleProfileActivity.app, new DownloadInfo(MsfSdkUtils.insertMtype("friendlist", (String)localObject), localFile2, 0), null) == 0) {} for (boolean bool1 = true;; bool1 = false) { bool2 = bool1; if (bool1) { bool2 = localFile2.renameTo(localFile1); } NearbyPeopleProfileActivity.a(this.jdField_a_of_type_ComTencentMobileqqNearbyProfilecardNearbyPeopleProfileActivity, bool2); break; } i = 0; break label158; } } } /* Location: L:\local\mybackup\temp\qq_apk\com.tencent.minihd.qq\assets\exlibs.1.jar\classes.jar * Qualified Name: jif * JD-Core Version: 0.7.0.1 */
[ "98632993+tsuzcx@users.noreply.github.com" ]
98632993+tsuzcx@users.noreply.github.com
4191b0487c2531e417b9beb0882797ed19377a70
cb0722be7d0691d97e6102a4e8614b1225ce90f9
/Page Rank, HITS/HITS/Code/BaseSet.java
c45e5f2791c5b8840e51e71c68cb738717c6e047
[]
no_license
sanjanamanoj/Information-Retrieval
10f05dff366dbdeaca1bfe2a2d07f9f37382778b
82f8be2af974c28991a71ba27d208f9256c92206
refs/heads/master
2021-01-20T15:36:50.852426
2016-08-07T17:46:55
2016-08-07T17:46:55
61,221,475
0
0
null
null
null
null
UTF-8
Java
false
false
3,911
java
package IR.assn4; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.net.InetAddress; import java.util.HashMap; import java.util.HashSet; import java.util.Map.Entry; import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.client.Client; import org.elasticsearch.client.transport.TransportClient; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.InetSocketTransportAddress; public class BaseSet { public static HashSet<String> BaseSet = new HashSet<String>(); public static HashSet<String> docs = new HashSet<String>(); public static void getBase() throws IOException { Settings settings = Settings.builder().build(); Client client = TransportClient.builder().settings(settings).build() .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300)); HashMap<String,HashSet<String>> inlinks = new HashMap<String,HashSet<String>>(); HashMap<String,HashSet<String>> outlinks = new HashMap<String,HashSet<String>>(); getDocList(); HashSet<String> rootSet = new HashSet<String>(); BufferedReader br = new BufferedReader(new FileReader("RootSet.txt")); String data = br.readLine(); while(data!=null) { rootSet.add(data.trim()); data=br.readLine(); } br.close(); BaseSet.addAll(rootSet); String[] a = {"docno","out_links"}; for(String docno: rootSet) { GetResponse response = client.prepareGet("four", "document",docno ) .setFetchSource(a,null) .get(); if(response.isExists()) { String out = (String) response.getSource().get("out_links"); String[] temp2 = out.split("\t"); HashSet<String> o = new HashSet<String>(); for(String j : temp2) { o.add(j); } //System.out.println(" "+o.size()); outlinks.put(docno,o); } } String[] b = {"docno","in_links"}; for(String docno: rootSet) { GetResponse response = client.prepareGet("four", "document",docno ) .setFetchSource(b,null) .get(); if(response.isExists()) { //System.out.println(docno); String in = (String)response.getSource().get("in_links"); String[] temp1 = in.split("\t"); HashSet<String> i = new HashSet<String>(); for(String j : temp1) { i.add(j); } //System.out.print(i.size()); inlinks.put(docno,i); } } for(Entry<String,HashSet<String>> e : inlinks.entrySet()) { processInlinks(e.getValue()); } for(Entry<String,HashSet<String>> e : outlinks.entrySet()) { processOutlinks(e.getValue()); } printBase(); } public static void processInlinks(HashSet<String> in) { int d = 1; HashSet<String> temp = new HashSet<String>(); for(String s: BaseSet) { temp.add(s.toLowerCase()); } for(String s : in ) { if(d<50 && !temp.contains(s.toLowerCase())) { BaseSet.add(s); d++; } } } public static void processOutlinks(HashSet<String> out) { HashSet<String> temp = new HashSet<String>(); for(String s: BaseSet) { temp.add(s.toLowerCase()); } for(String s: out) { if(docs.contains(s)&& !temp.contains(s.toLowerCase())) { BaseSet.add(s); } } } public static void getDocList() throws IOException { BufferedReader br1 = new BufferedReader(new FileReader("MergedUrlList.txt")); String data = br1.readLine(); while(data!=null) { docs.add(data.trim()); data=br1.readLine(); } br1.close(); } public static void printBase() throws FileNotFoundException, UnsupportedEncodingException { PrintWriter pw = new PrintWriter("baseSet.txt","UTF-8"); for(String s: BaseSet) { pw.println(s); } pw.close(); } }
[ "sanjanamanoj@gmail.com" ]
sanjanamanoj@gmail.com
b81e24552c102bfe3d3dc6696e70dd59c9c0adcf
c0d3563346002ff7b158fc20c5b13fd47b91b957
/module3/multithread1form/src/multithread1form/RunnableFibonacci.java
2c9ee75d20be6f3afd3de967ba1c40439cf088a9
[]
no_license
vincent-courtalon/formationheducap2019
1a38eb2f625b78fb7b00b7411aab57444aa9368c
8df31ad914c6d4ebe465847b9349002aed598539
refs/heads/master
2023-01-13T04:58:10.738346
2019-09-13T13:27:16
2019-09-13T13:27:16
193,926,782
1
5
null
2023-01-07T21:54:49
2019-06-26T15:00:34
Java
UTF-8
Java
false
false
457
java
package multithread1form; public class RunnableFibonacci implements Runnable { @Override public void run() { // Thread.currentThread() renvoie le thread actuel (en execution) for (int i = 0; i < 42; i++) { System.out.println(Thread.currentThread().getName() + " -> " + fibonacci(i)); } } private long fibonacci(long n) { if (n == 0) return 0; if (n == 1) return 1; return fibonacci(n-1) + fibonacci(n - 2); } }
[ "Stagiaire@INSTRUCT" ]
Stagiaire@INSTRUCT
85fd7a4064e2552a5d115abbbe4705588e80c699
baea7ebb2f486a698c2f830510e046e6ce30af3f
/src/day02_FirstJavaProgramming/PrintExercise.java
f5b168d42cf2be1bbd635e1ea797f817df179b05
[]
no_license
minicandoit/src
448069d51bb39f0c54160c93f220fbb06dae7aaa
d48c096c9163559d9a410dbff864205eb7ee771e
refs/heads/master
2023-02-04T14:34:07.545440
2020-12-26T02:57:06
2020-12-26T02:57:06
324,470,507
1
0
null
null
null
null
UTF-8
Java
false
false
421
java
package day02_FirstJavaProgramming; public class PrintExercise { public static void main(String[] args) { System.out.println("Tuncay"); System.out.println("Oktay"); System.out.println("Dovran"); System.out.println("Alison"); System.out.println(); System.out.println("Hello"); System.out.println("Cybertek"); System.out.println("MClean"); } }
[ "74155239+minicandoit@users.noreply.github.com" ]
74155239+minicandoit@users.noreply.github.com
f71fd822f6051a0f292ef87d95e514454247198a
56eee1bc1b25a32050453ab01a5dec4f09e64ada
/NotepadApp/res/CreateDB/gen/com/app/createdb/R.java
7b6f1600d74c5eb4d4b9121cd8c9199117d5690c
[]
no_license
doyouevenmitch/Assignment3
fcfb86f40d267a1b7e16537e4d5aead72f66f3a3
6bd28f7826abfa26dd62fd6c8a670f0f16c9b68b
refs/heads/master
2020-06-06T06:57:59.336286
2013-07-25T07:21:23
2013-07-25T07:21:23
11,625,860
0
1
null
null
null
null
UTF-8
Java
false
false
4,108
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.app.createdb; public final class R { public static final class attr { } public static final class dimen { /** Default screen margins, per the Android Design guidelines. Customize dimensions originally defined in res/values/dimens.xml (such as screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. */ public static final int activity_horizontal_margin=0x7f040000; public static final int activity_vertical_margin=0x7f040001; } public static final class drawable { public static final int add=0x7f020000; public static final int b=0x7f020001; public static final int back=0x7f020002; public static final int barcode=0x7f020003; public static final int camera=0x7f020004; public static final int cloud=0x7f020005; public static final int copy=0x7f020006; public static final int delete=0x7f020007; public static final int export=0x7f020008; public static final int gps=0x7f020009; public static final int ic_launcher=0x7f02000a; public static final int icon=0x7f02000b; public static final int more=0x7f02000c; public static final int options=0x7f02000d; public static final int photos=0x7f02000e; public static final int picture=0x7f02000f; public static final int save=0x7f020010; public static final int search=0x7f020011; public static final int synced=0x7f020012; public static final int tag=0x7f020013; public static final int unsynced=0x7f020014; } public static final class id { public static final int action_settings=0x7f080008; public static final int button1=0x7f080000; public static final int button2=0x7f080007; public static final int button3=0x7f080005; public static final int button4=0x7f080004; public static final int editText1=0x7f080002; public static final int editText2=0x7f080006; public static final int textView1=0x7f080001; public static final int textView2=0x7f080003; } public static final class layout { public static final int activity_main=0x7f030000; public static final int activity_view=0x7f030001; public static final int newnote=0x7f030002; } public static final class menu { public static final int main=0x7f070000; } public static final class string { public static final int action_settings=0x7f050001; public static final int addNote=0x7f050003; public static final int app_name=0x7f050000; public static final int hello_world=0x7f050002; } public static final class style { /** Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+ devices. API 11 theme customizations can go here. Base application theme for API 14+. This theme completely replaces AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml on API 14+ devices. API 14 theme customizations can go here. */ public static final int AppBaseTheme=0x7f060000; /** Application theme. All customizations that are NOT specific to a particular API-level can go here. */ public static final int AppTheme=0x7f060001; } }
[ "mitch@aktech.com.au" ]
mitch@aktech.com.au
93d15478bfa9274807e239140d883c147d7f1dc9
53fd1f99d87194b2954a5710198181fa664fb31d
/src/main/velo/exceptions/action/ActionPreException.java
4c81d2e49ab1ba90722207d5766b5ea7c06a0f31
[]
no_license
identityxx/velo1
5bfbeecee7b87de562b43bb137e4e497dad39780
a6ded14c57976ae09d922dc6b0594f5b5afa626b
refs/heads/master
2016-09-05T15:23:45.060022
2009-09-22T11:33:02
2009-09-22T11:33:02
317,654
0
1
null
null
null
null
UTF-8
Java
false
false
1,257
java
/** * Copyright (c) 2000-2007, Shakarchi Asaf * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package velo.exceptions.action; import velo.exceptions.EdmException; /** * @author Asaf Shakarchi * * Threw whenever an action pre phase fails */ public class ActionPreException extends EdmException { private static final long serialVersionUID = 1987305452306161213L; /** * Constructor of the exception * @param msg A message that describes the exception */ public ActionPreException(String msg) { super(msg); } public ActionPreException(Throwable e) { super(e); } }
[ "asaf@.(none)" ]
asaf@.(none)
120f0cbb6197bac7bb02f1d5f3c72b933008df1d
bd276aaa53f0f9fae7810eaa303b5b78c72239cb
/app/src/main/java/com/example/myapplication1302/MainActivity.java
f871d2f8a101a731b62e5bc5078a308d72899a34
[]
no_license
allexna/MyApplication13021
14abceeb0cdcff7c587bfdd36e5395a898369f39
38b1947e761e24b5694c4cf96fe4801d8ec0303a
refs/heads/master
2021-01-04T00:45:20.576988
2020-02-13T16:10:19
2020-02-13T16:10:19
240,308,365
0
0
null
null
null
null
UTF-8
Java
false
false
4,844
java
package com.example.myapplication1302; import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatActivity; import android.annotation.TargetApi; import android.content.res.AssetFileDescriptor; import android.content.res.AssetManager; import android.media.AudioAttributes; import android.media.AudioManager; import android.media.SoundPool; import android.os.Build; import android.os.Bundle; import android.view.View; import android.widget.ImageButton; import android.widget.Toast; import java.io.IOException; import static android.view.View.*; public class MainActivity extends AppCompatActivity { SoundPool mSoundPool; AssetManager assets; private int mCatSound,mDogSound; private int mStreamID; private OnClickListener onClickListener; //@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ImageButton catImageButton=findViewById(R.id.imageButtonCat); catImageButton.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v){ playSound(mCatSound); } }); ImageButton dogImageButton=findViewById(R.id.imageButtonDog); dogImageButton.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v){ playSound(mDogSound); } }); mSoundPool=new SoundPool(2, AudioManager.STREAM_MUSIC,0); assets=getAssets(); // mSoundPool.load(this,R.raw.cat,1); // mSoundPool.load(this,R.raw.dog,2); mCatSound=loadSound("cat.mp3"); mDogSound=loadSound("dog.mp3"); } private int loadSound(String fileName){ AssetFileDescriptor afd=null; try{ afd=assets.openFd(fileName); }catch (IOException e){ e.printStackTrace(); Toast.makeText(this, "Couldnt load file'"+fileName+"'", Toast.LENGTH_SHORT).show(); return -1; } return mSoundPool.load(afd,1); } /* View.OnClickListener OnClickListener=new View.OnClickListener() { @Override public void onClick(View v) { switch(v.getId()) {case R.id.imageButtonCat: playSound(mCatSound); break; case R.id.imageButtonDog: playSound(mDogSound); break; } } };*/ protected void playSound(int sound){ if(sound>0) mSoundPool.play(sound,1,1,1,0,1); } /* private void createSoundPool(){ AudioAttributes attributes=new AudioAttributes.Builder() .setUsage(AudioAttributes.USAGE_GAME) .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION).build(); mSoundPool=new SoundPool.Builder() .setAudioAttributes(attributes).build(); } private int playSound(int sound){ if(sound>0){ mStreamID=mSoundPool.play(sound,1,1,1,0,1); } return mStreamID; } // private void int loadSound(String fileName){ // AssetFileDescriptor afd; // return mSoundPool.load(afd,1); // }*/ /* createSoundPool(); mAssetManager=getAssets(); mCatSound=loadSound("cat.mp3"); mDogSound=loadSound("dog.mp3"); ImageButton catImageButton=findViewById(R.id.imageButtonCat); catImageButton.setOnClickListener(onClickListener); ImageButton dogImageButton=findViewById(R.id.imageButtonDog); dogImageButton.setOnClickListener(onClickListener); OnClickListener onClickListener=new OnClickListener() { @Override public void onClick(View v) { switch(v.getId()) {case R.id.imageButtonCat: playSound(mCatSound); break; case R.id.imageButtonDog: playSound(mDogSound); break; } } }; private void createSoundPool(){ AudioAttributes attributes=new AudioAttributes.Builder() .setUsage(AudioAttributes.USAGE_GAME) .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION).build(); mSoundPool=new SoundPool.Builder() .setAudioAttributes(attributes).build(); } private void int loadSound(String fileName){ AssetFileDescriptor afd; return mSoundPool.load(afd,1); } }*/ }
[ "alexna39@gmail.com" ]
alexna39@gmail.com
447022484a8517c86c37ad17676d4f30540cda2d
084e943b175d35a8b4568980a6394450e6548e14
/yolotest/src/main/java/com/example/payload/DiaryResponse.java
4559b0b0b92ea94e2932bae94295eca09a93d800
[]
no_license
Rrou03/YOLO-Diary0805
0903d7ece6eacc975ceb8ce89ef3e435e39efce9
a8bbe6502648e564bd40b5750dd99514f3407a1b
refs/heads/master
2022-01-18T07:51:53.188153
2019-01-09T10:42:14
2019-01-09T10:42:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,052
java
package com.example.payload; import java.time.Instant; public class DiaryResponse { private String id; private String text; private String createdBy; // private UserSummary createdBy; private Instant creationDateTime; private String albumId; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getText() { return text; } public void setText(String text) { this.text = text; } // public UserSummary getCreatedBy() { // return createdBy; // } // // public void setCreatedBy(UserSummary createdBy) { // this.createdBy = createdBy; // } public String getCreatedBy() { return createdBy; } public void setCreatedBy(String createdBy) { this.createdBy = createdBy; } public Instant getCreationDateTime() { return creationDateTime; } public void setCreationDateTime(Instant creationDateTime) { this.creationDateTime = creationDateTime; } public String getAlbumId() { return albumId; } public void setAlbumId(String albumId) { this.albumId = albumId; } }
[ "inse52086@gmail.com" ]
inse52086@gmail.com
83ee77036f0fff24a0fecf598de2926eacc7dead
847a11dce60564bf9eab2aebb9eb42e2343f8a44
/mall-pms/pms-biz/src/test/java/com/youlai/mall/pms/controller/ProductControllerTest.java
0e1e33ef39f3e3cd5df4ff8318678980e524036b
[ "Apache-2.0" ]
permissive
shawning/meat
65b39e917eedb7e758b5e1ae67ea6d06932c8ad0
e062f933ec6691fb5118b8cd8a8cfbf6843435ff
refs/heads/master
2023-06-30T04:54:01.784805
2021-03-05T11:15:28
2021-03-05T11:15:28
343,693,228
0
0
null
null
null
null
UTF-8
Java
false
false
5,780
java
package com.youlai.mall.pms.controller; import com.youlai.common.result.ResultCode; import com.youlai.mall.pms.bo.AppProductBO; import com.youlai.mall.pms.controller.admin.AdminProductController; import com.youlai.mall.pms.pojo.PmsSpec; import com.youlai.mall.pms.service.IPmsSpuAttrValueService; import com.youlai.mall.pms.service.IPmsSpecService; import com.youlai.mall.pms.service.IPmsSpuService; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.HttpMethod; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import java.util.List; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; @AutoConfigureMockMvc @SpringBootTest @Slf4j public class ProductControllerTest { @Autowired public MockMvc mockMvc; @Autowired public AdminProductController adminProductController; @Test public void saveGoods() throws Exception { String goods = "{\"spu\":{\"name\":\"小米手机10\",\"categoryId\":\"8\",\"brandId\":\"1\",\"originPrice\":599900,\"price\":499900,\"pic\":\"http://101.37.69.49:9000/default/40ffc46040ca431aba23c48798a82bb8.jpg\",\"album\":\"[\\\"http://101.37.69.49:9000/default/dbb1c4e37b6244f3a6b0f635db90bf54.jpg\\\"]\",\"unit\":\"台\",\"description\":\"商品简介\",\"detail\":\"<p>商品详情</p>\",\"status\":1},\"attributes\":[{\"name\":\"上市时间\",\"value\":\"2020-10-10\"}],\"specifications\":[{\"name\":\"颜色\",\"value\":\"黑色\"},{\"name\":\"颜色\",\"value\":\"白色\"},{\"name\":\"内存\",\"value\":\"4G\"},{\"name\":\"内存\",\"value\":\"6G\"},{\"name\":\"存储\",\"value\":\"64G\"},{\"name\":\"存储\",\"value\":\"128G\"}],\"skuList\":[{\"颜色\":\"黑色\",\"内存\":\"4G\",\"存储\":\"64G\",\"price\":401,\"originPrice\":1,\"stock\":2,\"pic\":\"http://101.37.69.49:9000/default/d7c36e289eb14dcea67d20ebcac79d87.jpg\",\"barCode\":\"1605317058485\",\"specification\":\"{\\\"颜色\\\":\\\"黑色\\\",\\\"内存\\\":\\\"4G\\\",\\\"存储\\\":\\\"64G\\\"}\"},{\"颜色\":\"黑色\",\"内存\":\"4G\",\"存储\":\"128G\",\"price\":301,\"originPrice\":1,\"stock\":1,\"pic\":\"http://101.37.69.49:9000/default/29697a3f43f64172b91b4d1d241ca602.jpg\",\"barCode\":\"1605317059016\",\"specification\":\"{\\\"颜色\\\":\\\"黑色\\\",\\\"内存\\\":\\\"4G\\\",\\\"存储\\\":\\\"128G\\\"}\"},{\"颜色\":\"黑色\",\"内存\":\"6G\",\"存储\":\"64G\",\"price\":200.99999999999997,\"originPrice\":1,\"stock\":1,\"pic\":\"http://101.37.69.49:9000/default/d4b46f2405b54635bb1c0589f68a74e6.png\",\"barCode\":\"1605317059753\",\"specification\":\"{\\\"颜色\\\":\\\"黑色\\\",\\\"内存\\\":\\\"6G\\\",\\\"存储\\\":\\\"64G\\\"}\"},{\"颜色\":\"黑色\",\"内存\":\"6G\",\"存储\":\"128G\",\"price\":301,\"originPrice\":1,\"stock\":1,\"pic\":\"http://101.37.69.49:9000/default/432579106d32465296f930d15eafd466.png\",\"barCode\":\"1605317060895\",\"specification\":\"{\\\"颜色\\\":\\\"黑色\\\",\\\"内存\\\":\\\"6G\\\",\\\"存储\\\":\\\"128G\\\"}\"},{\"颜色\":\"白色\",\"内存\":\"4G\",\"存储\":\"64G\",\"price\":200.99999999999997,\"originPrice\":2.01,\"stock\":1,\"pic\":\"http://101.37.69.49:9000/default/f5eb5e307adf439cb7da0f847f4ddace.png\",\"barCode\":\"1605317061416\",\"specification\":\"{\\\"颜色\\\":\\\"白色\\\",\\\"内存\\\":\\\"4G\\\",\\\"存储\\\":\\\"64G\\\"}\"},{\"颜色\":\"白色\",\"内存\":\"4G\",\"存储\":\"128G\",\"price\":200.99999999999997,\"originPrice\":1.01,\"stock\":1,\"pic\":\"http://101.37.69.49:9000/default/9de00b77c06245538572c09ad689dfda.jpg\",\"specification\":\"{\\\"颜色\\\":\\\"白色\\\",\\\"内存\\\":\\\"4G\\\",\\\"存储\\\":\\\"128G\\\"}\"},{\"颜色\":\"白色\",\"内存\":\"6G\",\"存储\":\"64G\",\"price\":200.99999999999997,\"originPrice\":1.01,\"stock\":1,\"pic\":\"http://101.37.69.49:9000/default/d48ac97541f44cea8087b8f26da588c4.jpg\",\"barCode\":\"1605317062900\",\"specification\":\"{\\\"颜色\\\":\\\"白色\\\",\\\"内存\\\":\\\"6G\\\",\\\"存储\\\":\\\"64G\\\"}\"},{\"颜色\":\"白色\",\"内存\":\"6G\",\"存储\":\"128G\",\"price\":301,\"originPrice\":0.01,\"stock\":1,\"pic\":\"http://101.37.69.49:9000/default/9b2a4dfae67b44b89cc9589de691ee8d.jpg\",\"barCode\":\"1605317063290\",\"specification\":\"{\\\"颜色\\\":\\\"白色\\\",\\\"内存\\\":\\\"6G\\\",\\\"存储\\\":\\\"128G\\\"}\"}]}"; MvcResult result = mockMvc.perform(MockMvcRequestBuilders.request(HttpMethod.POST, "/goods") .contentType("application/json") .content(goods)) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.jsonPath("$.code").value(ResultCode.SUCCESS.getCode())) .andDo(print()) .andReturn(); log.info(result.getResponse().getContentAsString()); } @Autowired public IPmsSpecService iPmsSpecService; @Test public void getProductSpecList() { List<PmsSpec> specifications = iPmsSpecService.listBySpuId(1l); log.info(specifications.toString()); } @Autowired public IPmsSpuAttrValueService iPmsSpuAttrValueService; @Autowired private IPmsSpuService iPmsSpuService; @Test public void getProduct() { AppProductBO product = iPmsSpuService.getProductByIdForApp(1l); log.info(product.toString()); } }
[ "1490493387@qq.com" ]
1490493387@qq.com
62b50d05baf8fcdae48d54a83e08db4b514d770d
1bd473c45309e21b45b92fe8b7ecfe37b7e1a7aa
/bin/custom/training/trainingcore/src/de/hybris/training/core/search/solrfacetsearch/provider/impl/ColorFacetDisplayNameProvider.java
3804bfc5596859a61765de89ff83e59aceca4934
[]
no_license
trowqe/hybris_b2c
eed721d85a150553631f52a013065a0a163b679b
f62d000269f4d5467d9f77586e56df34f80c6619
refs/heads/master
2020-09-15T13:14:58.356537
2019-11-22T18:21:02
2019-11-22T18:21:02
223,456,010
1
0
null
2020-04-30T13:14:02
2019-11-22T17:47:12
Java
UTF-8
Java
false
false
2,761
java
/* * [y] hybris Platform * * Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. * * This software is the confidential and proprietary information of SAP * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with SAP. */ package de.hybris.training.core.search.solrfacetsearch.provider.impl; import de.hybris.platform.core.HybrisEnumValue; import de.hybris.platform.enumeration.EnumerationService; import de.hybris.platform.servicelayer.i18n.CommonI18NService; import de.hybris.platform.servicelayer.i18n.I18NService; import de.hybris.platform.solrfacetsearch.config.IndexedProperty; import de.hybris.platform.solrfacetsearch.provider.impl.AbstractFacetValueDisplayNameProvider; import de.hybris.platform.solrfacetsearch.search.SearchQuery; import de.hybris.training.core.enums.SwatchColorEnum; import java.util.Locale; import org.springframework.beans.factory.annotation.Required; public class ColorFacetDisplayNameProvider extends AbstractFacetValueDisplayNameProvider { private EnumerationService enumerationService; private I18NService i18nService; private CommonI18NService commonI18NService; @Override public String getDisplayName(final SearchQuery query, final IndexedProperty property, final String facetValue) { if (facetValue == null) { return ""; } final HybrisEnumValue colorEnumValue = getEnumerationService().getEnumerationValue(SwatchColorEnum.class, facetValue); Locale queryLocale = null; if (query == null || query.getLanguage() == null || query.getLanguage().isEmpty()) { queryLocale = getI18nService().getCurrentLocale(); } if (queryLocale == null && query != null) { queryLocale = getCommonI18NService().getLocaleForLanguage(getCommonI18NService().getLanguage(query.getLanguage())); } String colorName = getEnumerationService().getEnumerationName(colorEnumValue, queryLocale); if (colorName == null || colorName.isEmpty()) { colorName = facetValue; } return colorName; } protected EnumerationService getEnumerationService() { return enumerationService; } @Required public void setEnumerationService(final EnumerationService enumerationService) { this.enumerationService = enumerationService; } protected I18NService getI18nService() { return i18nService; } @Required public void setI18nService(final I18NService i18nService) { this.i18nService = i18nService; } protected CommonI18NService getCommonI18NService() { return commonI18NService; } @Required public void setCommonI18NService(final CommonI18NService commonI18NService) { this.commonI18NService = commonI18NService; } }
[ "trowqe@gmail.com" ]
trowqe@gmail.com
43d322447ae0aed8b2e2b2220744272dc1003c47
c22dd114bacd0cc338eca0bdbdea3f0ab5ba89c9
/common/tasks/xsdtojava/generated/WaypointV2.java
b67112030f46403addb334a6cca88736afc7e522
[ "Apache-2.0" ]
permissive
java-pawar2014/practice
3c3740365366ff78b8bdd8a876c867d291559978
149e482798e1fca2ae870df66aa0f76a54ab39ad
refs/heads/master
2021-04-29T20:27:12.694994
2018-10-08T09:25:42
2018-10-08T09:25:42
121,596,858
0
0
null
null
null
null
UTF-8
Java
false
false
1,830
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 // 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: 2017.12.26 at 02:59:00 PM IST // package generated; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for waypointV2 complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="waypointV2"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="lon" type="{http://www.w3.org/2001/XMLSchema}double"/> * &lt;element name="lat" type="{http://www.w3.org/2001/XMLSchema}double"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "waypointV2", propOrder = { "lon", "lat" }) public class WaypointV2 { protected double lon; protected double lat; /** * Gets the value of the lon property. * */ public double getLon() { return lon; } /** * Sets the value of the lon property. * */ public void setLon(double value) { this.lon = value; } /** * Gets the value of the lat property. * */ public double getLat() { return lat; } /** * Sets the value of the lat property. * */ public void setLat(double value) { this.lat = value; } }
[ "java.pawar2014@gmail.com" ]
java.pawar2014@gmail.com
49504642eaa352364655abba65c37a9d2e9da699
d57fc3d03a9fba5c45507f0d30e00fca7a09d55f
/app/src/main/java/com/mybetterandroid/wheel/other/Utils.java
e5d6f81d483a7293ac2077fd07dc2b89ec50e93a
[]
no_license
gyymz1993/V6.1
8bc1cd4d9c10890331a4366b06c9384c7ba9068c
ecb13d853b4adc69f915ec24ff3cd501f99ee80e
refs/heads/master
2020-03-28T21:41:16.584853
2017-06-20T11:58:41
2017-06-20T11:58:41
94,621,793
0
0
null
null
null
null
UTF-8
Java
false
false
3,980
java
package com.mybetterandroid.wheel.other; import java.security.MessageDigest; import java.util.List; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.util.TypedValue; import android.view.View; import android.view.inputmethod.InputMethodManager; public class Utils { /** * Hides the input method. * * @param context context * @param view The currently focused view * @return success or not. */ public static boolean hideInputMethod(Context context, View view) { if (context == null || view == null) { return false; } InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { return imm.hideSoftInputFromWindow(view.getWindowToken(), 0); } return false; } /** * Show the input method. * * @param context context * @param view The currently focused view, which would like to receive soft keyboard input * @return success or not. */ public static boolean showInputMethod(Context context, View view) { if (context == null || view == null) { return false; } InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { return imm.showSoftInput(view, 0); } return false; } public static float pixelToDp(Context context, float val) { float density = context.getResources().getDisplayMetrics().density; return val * density; } public static int dipToPx(Context context, int dipValue) { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dipValue, context .getResources().getDisplayMetrics()); } public static String getHashedFileName(String url) { if (url == null || url.endsWith("/" )) { return null ; } String suffix = getSuffix(url); StringBuilder sb = null; try { MessageDigest digest = MessageDigest. getInstance("MD5"); byte[] dstbytes = digest.digest(url.getBytes("UTF-8")); // GMaFroid uses UTF-16LE sb = new StringBuilder(); for (int i = 0; i < dstbytes.length; i++) { sb.append(Integer. toHexString(dstbytes[i] & 0xff)); } } catch (Exception e) { e.printStackTrace(); } if (null != sb && null != suffix) { return sb.toString() + "." + suffix; } return null; } private static String getSuffix(String fileName) { int dot_point = fileName.lastIndexOf( "."); int sl_point = fileName.lastIndexOf( "/"); if (dot_point < sl_point) { return "" ; } if (dot_point != -1) { return fileName.substring(dot_point + 1); } return null; } /** * Indicates whether the specified action can be used as an intent. This * method queries the package manager for installed packages that can * respond to an intent with the specified action. If no suitable package is * found, this method returns false. * * @param context The application's environment. * @param intent The Intent action to check for availability. * * @return True if an Intent with the specified action can be sent and * responded to, false otherwise. */ public static boolean isIntentAvailable(Context context, Intent intent) { final PackageManager packageManager = context.getPackageManager(); List<ResolveInfo> list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); return list.size() > 0; } }
[ "gyymz1993@126.com" ]
gyymz1993@126.com
c67f60883aa8fdd89ee003d6cec428662e8a588e
6452009983c24c7ef5716d333aa431de2020fde0
/src/main/java/es/upm/miw/apaw/patterns/strategy/Language.java
50dad134c68acea9679391dc841d9806291c41fc
[]
no_license
alexph9/APAW.ECP1.Alejandro.Puebla
77dc6807e419ee839b834580bd30295933ab393c
d381fd0881cdd0fbbcbfc5fabe05e1e1ea12bf06
refs/heads/master
2020-03-30T10:57:42.815827
2018-10-07T18:34:48
2018-10-07T18:34:48
151,146,148
0
0
null
null
null
null
UTF-8
Java
false
false
102
java
package es.upm.miw.apaw.patterns.strategy; public interface Language { public String greet(); }
[ "alexph9@hotmail.com" ]
alexph9@hotmail.com
99c3f4b33f3cc45ed4c137f83a2e6a13cfb8c29a
2c0b7ae1be863f6cf6c4e69474bda723c8d6c2b2
/src/main/java/org/conquernos/shover/stats/ShoverStats.java
d743b0bb8242c8eff317a90c60a6cea2b22b2693
[]
no_license
conquernos/shover
9134137a8e0c536f74588a241444a9b5015f040e
019fc7953fbf911f8e00ca134b97bd85f8b289cb
refs/heads/master
2020-05-03T18:18:32.251119
2019-04-01T00:53:29
2019-04-01T00:53:29
178,754,704
0
0
null
null
null
null
UTF-8
Java
false
false
807
java
package org.conquernos.shover.stats; import java.util.concurrent.atomic.AtomicLong; public class ShoverStats { private AtomicLong numberOfMessages = new AtomicLong(0); private AtomicLong numberOfCompletedMessages = new AtomicLong(0); public long getNumberOfMessages() { return numberOfMessages.get(); } public long getNumberOfCompletedMessages() { return numberOfCompletedMessages.get(); } public long addNumberOfMessages(long number) { return numberOfMessages.addAndGet(number); } public long addNumberOfCompletedMessages(long number) { return numberOfCompletedMessages.addAndGet(number); } @Override public String toString() { return "ShoverStats{" + "numberOfMessages=" + numberOfMessages + ", numberOfCompletedMessages=" + numberOfCompletedMessages + '}'; } }
[ "conquernos@gmail.com" ]
conquernos@gmail.com
6dcbb33af73d5b3baa91f5fc1933e28f34867f08
536600d7852ee095d48821314561aabf7207ba38
/app/src/main/java/com/zuoyu/business/entity/ViewPageInfo.java
fbf3b5f45a2eabb966ee540849df109d2f62b0b8
[]
no_license
Sunnyfor/Business
a85e9705af01092aa4c5d23853f4091c28cee1c8
6358f5d1bde37275c8f3f2fd92e1c5602e675c2e
refs/heads/master
2020-09-30T10:27:32.990519
2019-12-11T03:35:58
2019-12-11T03:35:58
227,269,592
0
0
null
null
null
null
UTF-8
Java
false
false
400
java
package com.zuoyu.business.entity; import android.os.Bundle; public final class ViewPageInfo { public final String tag; public final Class<?> clazz; public final Bundle args; public final String title; public ViewPageInfo(String _title, String _tag, Class<?> _class, Bundle _args) { title = _title; tag = _tag; clazz = _class; args = _args; } }
[ "yongzuo.chen@foxmail.com" ]
yongzuo.chen@foxmail.com
4257bb17baa651eccffd6bdae12c7549f17225a3
da765fbb821511b8299032fe39d8a67b702f16c5
/simulation-master/simulation-master-server/src/main/java/at/sintrum/fog/simulation/scenario/evaluation/BasicEvalScenario.java
f06b90f446b983dc2ec8a5d43a849a1312d76c61
[]
no_license
Mittemi/fog
16542153da167fb3474631cafadf816230c0bca8
7aa3069eb41fe271fe89c25b978d611741e69622
refs/heads/master
2021-09-21T17:42:36.560910
2018-08-29T15:46:00
2018-08-29T15:46:00
90,863,582
0
0
null
null
null
null
UTF-8
Java
false
false
4,548
java
package at.sintrum.fog.simulation.scenario.evaluation; import at.sintrum.fog.applicationhousing.client.api.AppEvolutionClient; import at.sintrum.fog.metadatamanager.client.api.AppRequestClient; import at.sintrum.fog.metadatamanager.client.api.ImageMetadataClient; import at.sintrum.fog.simulation.SimulationServerConfig; import at.sintrum.fog.simulation.scenario.dto.BasicScenarioInfo; import at.sintrum.fog.simulation.service.FogResourceService; import at.sintrum.fog.simulation.service.ScenarioService; import at.sintrum.fog.simulation.simulation.mongo.respositories.FullSimulationResultRepository; import at.sintrum.fog.simulation.taskengine.TaskListBuilder; import at.sintrum.fog.simulation.taskengine.TrackExecutionState; import at.sintrum.fog.simulation.taskengine.tasks.WaitTillFinishedTask; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; /** * Created by Michael Mittermayr on 31.10.2017. */ @Service public class BasicEvalScenario extends EvaluationScenarioBase { private Logger LOG = LoggerFactory.getLogger(BasicEvalScenario.class); public BasicEvalScenario(TaskListBuilder taskListBuilder, ImageMetadataClient imageMetadataClient, SimulationServerConfig simulationServerConfig, FogResourceService fogResourceService, AppRequestClient appRequestClient, AppEvolutionClient appEvolutionClient, FullSimulationResultRepository fullSimulationResultRepository, @Lazy ScenarioService scenarioService) { super(taskListBuilder, imageMetadataClient, simulationServerConfig, fogResourceService, appRequestClient, appEvolutionClient, fullSimulationResultRepository, scenarioService, 10, 120); } @Override protected void setupSimulation(WaitTillFinishedTask.State simulationControlTrack, TaskListBuilder.TaskListBuilderState taskListBuilderState, BasicScenarioInfo basicScenarioInfo, List<TrackExecutionState> applications, boolean useAuction, ArrayList<TaskListBuilder.TaskListBuilderState.AppTaskBuilder> taskBuilders) { } protected int[][] getRequestMatrix() { return BasicEvalScenario.getBasicEvalRequestMatrix(); } public static int[][] getBasicEvalRequestMatrix() { int[][] requestMatrix = new int[5][10]; //FOG 0 requestMatrix[0][0] = 0; requestMatrix[0][1] = 5; requestMatrix[0][2] = 10; requestMatrix[0][3] = 0; requestMatrix[0][4] = 0; requestMatrix[0][5] = 0; requestMatrix[0][6] = 20; requestMatrix[0][7] = 5; requestMatrix[0][8] = 0; requestMatrix[0][9] = 30; //FOG 1 requestMatrix[1][0] = 20; requestMatrix[1][1] = 30; requestMatrix[1][2] = 10; requestMatrix[1][3] = 8; requestMatrix[1][4] = 0; requestMatrix[1][5] = 10; requestMatrix[1][6] = 0; requestMatrix[1][7] = 0; requestMatrix[1][8] = 8; requestMatrix[1][9] = 0; //FOG 2 requestMatrix[2][0] = 0; requestMatrix[2][1] = 5; requestMatrix[2][2] = 0; requestMatrix[2][3] = 0; requestMatrix[2][4] = 8; requestMatrix[2][5] = 0; requestMatrix[2][6] = 20; requestMatrix[2][7] = 0; requestMatrix[2][8] = 0; requestMatrix[2][9] = 7; //FOG 3 requestMatrix[3][0] = 15; requestMatrix[3][1] = 30; requestMatrix[3][2] = 10; requestMatrix[3][3] = 0; requestMatrix[3][4] = 0; requestMatrix[3][5] = 5; requestMatrix[3][6] = 10; requestMatrix[3][7] = 15; requestMatrix[3][8] = 0; requestMatrix[3][9] = 9; //FOG 4 requestMatrix[4][0] = 5; requestMatrix[4][1] = 0; requestMatrix[4][2] = 0; requestMatrix[4][3] = 5; requestMatrix[4][4] = 5; requestMatrix[4][5] = 0; requestMatrix[4][6] = 0; requestMatrix[4][7] = 0; requestMatrix[4][8] = 5; requestMatrix[4][9] = 15; return requestMatrix; } @Override public String getId() { return "basicEval"; } }
[ "mmichael@edumail.at" ]
mmichael@edumail.at
7bcbada37d5cb480ac7b28bbaa95c4eeaf8a083a
54c007a9a99c4094284508d603f1d1d7428523dc
/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/file/FileRouterFactory.java
68567b074448a56807e5b0a60d455307260e743e
[ "Apache-2.0" ]
permissive
ZengLiQAQ/dubbo-2.6.5
3aaa40b38ba5e9b45773ab4f730ddf1722b3509e
09675b552a306dc24a498133729fcc48409d47bf
refs/heads/master
2021-05-20T14:37:57.068836
2019-12-21T11:17:46
2019-12-21T11:17:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,749
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.alibaba.dubbo.rpc.cluster.router.file; import com.alibaba.dubbo.common.Constants; import com.alibaba.dubbo.common.URL; import com.alibaba.dubbo.common.utils.IOUtils; import com.alibaba.dubbo.rpc.cluster.Router; import com.alibaba.dubbo.rpc.cluster.RouterFactory; import com.alibaba.dubbo.rpc.cluster.router.script.ScriptRouterFactory; import java.io.File; import java.io.FileReader; import java.io.IOException; // public class FileRouterFactory implements RouterFactory { public static final String NAME = "file"; private RouterFactory routerFactory; public void setRouterFactory(RouterFactory routerFactory) { this.routerFactory = routerFactory; } @Override public Router getRouter(URL url) { try { // Transform File URL into Script Route URL, and Load // file:///d:/path/to/route.js?router=script ==> script:///d:/path/to/route.js?type=js&rule=<file-content> String protocol = url.getParameter(Constants.ROUTER_KEY, ScriptRouterFactory.NAME); // Replace original protocol (maybe 'file') with 'script' String type = null; // Use file suffix to config script type, e.g., js, groovy ... String path = url.getPath(); if (path != null) { int i = path.lastIndexOf('.'); if (i > 0) { type = path.substring(i + 1); } } String rule = IOUtils.read(new FileReader(new File(url.getAbsolutePath()))); boolean runtime = url.getParameter(Constants.RUNTIME_KEY, false); URL script = url.setProtocol(protocol).addParameter(Constants.TYPE_KEY, type).addParameter(Constants.RUNTIME_KEY, runtime).addParameterAndEncoded(Constants.RULE_KEY, rule); return routerFactory.getRouter(script); } catch (IOException e) { throw new IllegalStateException(e.getMessage(), e); } } }
[ "xunzhao3456" ]
xunzhao3456
19b53a76c2f5c3aacb9681f8e441dc6aa8f9f53c
ee08dd986af11fe9e8241cb666bd024c64a1a43d
/fathom-core/src/main/java/fathom/utils/ServiceLocator.java
76cae5710058b61e5287f9e0baf355447d9c9260
[ "Apache-2.0" ]
permissive
gitblit/fathom
d8410fc770d2f62368d8c9e1e761a255af719b11
e05b5527fb2cbcb0f09b8996fe2caae5d1f6e635
refs/heads/master
2023-08-11T05:02:56.803755
2021-05-02T21:19:47
2021-05-02T21:19:47
35,689,778
29
8
Apache-2.0
2022-10-12T20:18:12
2015-05-15T18:23:33
Java
UTF-8
Java
false
false
1,593
java
/* * Copyright (C) 2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package fathom.utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.List; import java.util.ServiceLoader; /** * @author Decebal Suiu */ public class ServiceLocator { private static final Logger log = LoggerFactory.getLogger(ServiceLocator.class); private ServiceLocator() { } public static <T> T locate(Class<T> service) { List<T> services = locateAll(service); return services.isEmpty() ? null : services.get(0); } public static <T> List<T> locateAll(Class<T> service) { log.debug("Locate service '{}' using ServiceLoader", service.getName()); ServiceLoader<T> loader = ServiceLoader.load(service, service.getClassLoader()); final List<T> services = new ArrayList<T>(); for (T item : loader) { log.debug("Found '{}'", item.getClass().getName()); services.add(item); } return services; } }
[ "james.moger@gitblit.com" ]
james.moger@gitblit.com