text
stringlengths
10
2.72M
/* Copyright (C) 2013-2014, Securifera, Inc All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Securifera, Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================================ Pwnbrew is provided under the 3-clause BSD license above. The copyright on this package is held by Securifera, Inc */ /* * Powershell.java * */ package pwnbrew.shell; import java.util.concurrent.Executor; import java.util.regex.Matcher; import java.util.regex.Pattern; import pwnbrew.misc.Constants; /** * * */ public class Powershell extends Shell { private static String[] POWERSHELL_EXE_STR = new String[]{"powershell", "-version", "2", "-exec", "bypass", "-"}; private static final String encoding = "UTF-8"; private static final String promptCmd = "prompt\r\n"; private static final String PROMPT_REGEX = "PS [a-zA-Z]:(\\\\|(\\\\[^\\\\/:*\"<>|]+)+)>"; private static final Pattern PROMPT_PATTERN = Pattern.compile(PROMPT_REGEX); // ========================================================================== /** * Constructor * * @param passedExecutor * @param passedListener */ public Powershell(Executor passedExecutor, ShellListener passedListener) { super(passedExecutor, passedListener); } // ========================================================================== /** * Handles the bytes read * * @param passedId * @param buffer the buffer into which the bytes were read */ @Override public void handleBytesRead( int passedId, byte[] buffer ) { //Add the bytes to the string builder switch( passedId ){ case Constants.STD_OUT_ID: synchronized(theStdOutStringBuilder) { theStdOutStringBuilder.append( new String( buffer )); String tempStr = theStdOutStringBuilder.toString(); //Set the prompt if( !promptFlag ){ //See if it matches the prompt Matcher m = PROMPT_PATTERN.matcher(tempStr); if( m.find()){ int matchEnd = m.end(); String aStr = tempStr.substring(0, matchEnd); buffer = aStr.getBytes(); promptFlag = true; } } else { return; } //Reset the string builder theStdOutStringBuilder.setLength(0); } break; } //Send to the runner pane super.handleBytesRead(passedId, buffer); } // ========================================================================== /** * Get the command string * * @return */ @Override public String[] getCommandStringArray() { return POWERSHELL_EXE_STR; } // ========================================================================== /** * Get character encoding. * * @return */ @Override public String getEncoding() { return encoding; } // ========================================================================== /** * * @return */ @Override public String toString(){ return "Powershell"; } // ========================================================================== /** * Get the string to append to the end of every command * * @return */ @Override public String getInputTerminator(){ String aStr = super.getInputTerminator(); return aStr.concat(promptCmd); } // ========================================================================== /** * Get the string to run on the shell startup * * @return */ @Override public String getStartupCommand(){ return promptCmd; } }
package com.sirma.itt.javacourse.collections.task3.exceptionsMessageManager; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.Map; import javax.naming.directory.InvalidAttributesException; /** * Class that Manages Exception messages. * * @author simeon */ public class ExceptionsMessageManager { /** * Constant that contain a key value in the manger. */ public static final String THIRD = "third"; /** * Constant that contain a key value in the manger. */ public static final String SECOND = "second"; /** * Constant that contain a key value in the manger. */ public static final String FIRST = "first"; /** * Constant that contain a value in the manger. */ public static final String INVALID_POSTAL_CODE = "Invalid postal code"; /** * Constant that contain a value in the manger. */ public static final String INVALID_EGN = "Invalid EGN"; /** * Constant that contain a value in the manger. */ public static final String INVALID_CARD_NUMBER = "Invalid card number"; /** * Constant that contain a value in the manger. */ public static final String SEPARATOR = System.getProperty("line.separator"); private final Map<String, String> exceptions; private String message = ""; /** * Adds an exception message that is from the map, otherwise throws an exception. * * @param mess * the exception message to be added. * @return all the error messages in one string. * @throws InvalidAttributesException */ public String addExceptionMessage(String mess) throws InvalidAttributesException { if (!exceptions.containsValue(mess)) { throw new InvalidAttributesException(); } return message += (mess + SEPARATOR); } /** * Constructor for the ExceptionsMessageManager class. */ public ExceptionsMessageManager() { exceptions = new HashMap<String, String>(); exceptions.put(FIRST, INVALID_CARD_NUMBER); exceptions.put(SECOND, INVALID_EGN); exceptions.put(THIRD, INVALID_POSTAL_CODE); } /** * Add an exception message to the current list of messages. This method should be used the * following way : <br>myManager.addExceptionMessageUsingCode(ExceptionsMessageManager.THIRD)). * * @param messageCode * the code of the message. * @return the full message String. * @throws InvalidAttributesException * if a invalid code was given. */ public String addExceptionMessageUsingCode(String messageCode) throws InvalidAttributesException { if (!exceptions.containsKey(messageCode)) { throw new InvalidAttributesException(); } return message += (exceptions.get(messageCode) + SEPARATOR); } /** * Gives the current message. * * @return the current message; */ public String getMesage() { return message; } /** * Transforms the message into a list with a line separator as divider. * * @return the full list of messages. * @throws InvalidAttributesException * if the String value that was given to the method doesn't contain none of the * managed values. */ public static Collection<String> getMesages(String messagesCombination) throws InvalidAttributesException { if (!messagesCombination.contains(INVALID_POSTAL_CODE) && !messagesCombination.contains(INVALID_CARD_NUMBER) && !messagesCombination.contains(INVALID_EGN)) { throw new InvalidAttributesException(); } Collection<String> result = Arrays.asList(messagesCombination.split(SEPARATOR)); return result; } }
package com.jg.apirest.Model; import javax.persistence.*; @Entity @Table(name = "tipo_mascota") public class TipoMascota { @Id @Column(name = "idtipo_mascota") private final String id; @Column(name = "descripcion", length = 45) private final String comentarios; public TipoMascota(String id, String comentarios) { this.id = id; this.comentarios = comentarios; } public String getId() { return id; } public String getComentarios() { return comentarios; } @Override public String toString() { return "TipoMascota{" + "id='" + id + '\'' + ", comentarios='" + comentarios + '\'' + '}'; } }
package controller.admin.student; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import configuration.EncryptandDecrypt; import connection.DBConfiguration; /** * Servlet implementation class AdmissionSectionViewController */ @WebServlet("/Admin/Controller/Admin/Student/AdmissionSectionViewController") public class AdmissionSectionViewController extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public AdmissionSectionViewController() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.getWriter().append("Served at: ").append(request.getContextPath()); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/plain"); EncryptandDecrypt ec = new EncryptandDecrypt(); String course = request.getParameter("course"); String year = request.getParameter("year"); DBConfiguration db = new DBConfiguration(); Connection conn = db.getConnection(); Statement stmnt = null; try { stmnt = conn.createStatement(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } String sql = ""; sql = "SELECT Curriculum_Code,Section_Section,(SELECT FORMAT(sum(Fee_Amount),2) FROM `t_assign_section_fee_item` inner join r_fee on Assign_Section_Fee_Item_Fee_ID = Fee_ID WHERE Assign_Section_Fee_Item_Section_ID = Section_ID) AS FEE FROM `r_section` INNER JOIN r_curriculum ON Section_CurriculumID = Curriculum_ID WHERE Section_CourseID = (SELECT Course_ID FROM r_course where Course_Code = '"+ec.encrypt(ec.key, ec.initVector, course)+"') and Section_Year = "+year; JSONArray arr = new JSONArray(); List<String> list = new ArrayList<String>(); PrintWriter out = response.getWriter(); try { ResultSet rs = stmnt.executeQuery(sql); while(rs.next()){ JSONObject obj = new JSONObject(); obj.put("curcode", ec.decrypt(ec.key, ec.initVector, rs.getString("Curriculum_Code"))); obj.put("fee", rs.getString("FEE")); obj.put("section", ec.decrypt(ec.key, ec.initVector, rs.getString("Section_Section"))); arr.add(obj); } out.print(arr); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
package org.levelup.dao; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.extension.ExtendWith; import org.levelup.model.Role; import org.levelup.model.UserRole; import org.levelup.tests.TestConfiguration; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.junit.jupiter.api.Assertions.*; @ExtendWith(SpringExtension.class) @TestInstance(TestInstance.Lifecycle.PER_CLASS) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @ContextConfiguration(classes = TestConfiguration.class) class RoleDaoTest { @Autowired private RoleDao dao; @Test void create() { Role role = new Role(UserRole.TEST_ROLE); Role actualRole = dao.create(role); creatingAssertions(actualRole); assertEquals(UserRole.TEST_ROLE, actualRole.getName()); } @Test void findByName() { Role role = new Role(UserRole.TEST_ROLE); dao.create(role); Role actualRole = dao.findByName(UserRole.TEST_ROLE); creatingAssertions(actualRole); assertEquals(UserRole.TEST_ROLE, actualRole.getName()); } private void creatingAssertions(Role role) { assertNotNull(role, "Role hasn't been created"); assertNotEquals(0, role.getId(), "Role hasn't been created"); } }
package com.marvell.updater.entity; public class DevelopPackageInfo extends BasePackageInfo { public String mDate; public String mModel; public String mBranch; }
package com.zl.service; import com.zl.pojo.DealerDO; import com.zl.pojo.UserDO; import com.zl.util.AjaxPutPage; import com.zl.util.AjaxResultPage; import com.zl.util.MessageException; import java.util.List; /** * @program: FruitSales * @classname: DealerService * @description: * @author: 朱林 * @create: 2019-01-19 23:06 **/ public interface DealerService { /** * @Description: 返回零售商列表[可带条件] * @Param: [ajaxPutPage] * @return: java.util.List<com.zl.pojo.PeasantDO> * @Author: ZhuLin * @Date: 2019/1/13 */ AjaxResultPage<DealerDO> listDealer(AjaxPutPage<DealerDO> ajaxPutPage); /** * @Description: 获取返回的零售商总数 * @Param: [] * @return: java.lang.Integer * @Author: ZhuLin * @Date: 2019/1/13 */ Integer getDealerCount(); /*** * @Description: 删除零售商 * @Param: [id] * @return: void * @Author: ZhuLin * @Date: 2019/1/21 */ void deleteDealer(String id) throws MessageException; /** * @Description: 批量删除零售商 * @Param: [deleteId] * @return: void * @Author: ZhuLin * @Date: 2019/1/21 */ void batchesDelPeasant(List<String> deleteId) throws MessageException; /** * @Description: 添加零售商 * @Param: [dealerDO] * @return: void * @Author: ZhuLin * @Date: 2019/1/21 */ void insertDealer(UserDO userDO, DealerDO dealerDO) throws MessageException; /** * @Description: 修改零售商 * @Param: [dealerDO] * @return: void * @Author: ZhuLin * @Date: 2019/1/22 */ void updateDealer(DealerDO dealerDO) throws MessageException; }
/* * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.web.reactive.function.client; import java.util.List; import java.util.function.Predicate; import org.reactivestreams.Publisher; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import org.springframework.core.codec.CodecException; import org.springframework.http.ResponseEntity; /** * Internal methods shared between {@link DefaultWebClient} and * {@link DefaultClientResponse}. * * @author Arjen Poutsma * @since 5.2 */ abstract class WebClientUtils { private static final String VALUE_NONE = "\n\t\t\n\t\t\n\uE000\uE001\uE002\n\t\t\t\t\n"; /** * Predicate that returns true if an exception should be wrapped. */ public final static Predicate<? super Throwable> WRAP_EXCEPTION_PREDICATE = t -> !(t instanceof WebClientException) && !(t instanceof CodecException); /** * Map the given response to a single value {@code ResponseEntity<T>}. */ @SuppressWarnings("unchecked") public static <T> Mono<ResponseEntity<T>> mapToEntity(ClientResponse response, Mono<T> bodyMono) { return ((Mono<Object>) bodyMono).defaultIfEmpty(VALUE_NONE).map(body -> new ResponseEntity<>( body != VALUE_NONE ? (T) body : null, response.headers().asHttpHeaders(), response.statusCode())); } /** * Map the given response to a {@code ResponseEntity<List<T>>}. */ public static <T> Mono<ResponseEntity<List<T>>> mapToEntityList(ClientResponse response, Publisher<T> body) { return Flux.from(body).collectList().map(list -> new ResponseEntity<>(list, response.headers().asHttpHeaders(), response.statusCode())); } }
package app.akeorcist.deviceinformation.fragment.main; import android.os.Bundle; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; import android.widget.TextView; import com.inthecheesefactory.thecheeselibrary.fragment.support.v4.app.StatedFragment; import com.squareup.otto.Subscribe; import app.akeorcist.deviceinformation.R; import app.akeorcist.deviceinformation.event.ChooseDeviceEvent; import app.akeorcist.deviceinformation.event.ConfirmSwitchEvent; import app.akeorcist.deviceinformation.event.DevicePrompt; import app.akeorcist.deviceinformation.event.DeviceSwitchEvent; import app.akeorcist.deviceinformation.event.DeviceSwitcherNext; import app.akeorcist.deviceinformation.event.PagerControlEvent; import app.akeorcist.deviceinformation.model.SubDevice; import app.akeorcist.deviceinformation.provider.BusProvider; import app.akeorcist.deviceinformation.utility.AnimateUtils; public class SwitcherConfirmFragment extends StatedFragment implements View.OnClickListener { private TextView tvDeviceName; private TextView tvDeviceVersion; private TextView tvDeviceFingerprint; private ImageButton btnDeviceBack; private ImageButton btnSwitcherCancel; private ImageButton btnSwitcherOK; private String brand; private String name; private String model; private String version; private String fingerprint; private SubDevice subDevice; // Handler device info prompt private boolean isInfoPrompt = false; public static SwitcherConfirmFragment newInstance() { SwitcherConfirmFragment fragment = new SwitcherConfirmFragment(); return fragment; } public SwitcherConfirmFragment() { } public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_switcher_confirm, container, false); tvDeviceName = (TextView) rootView.findViewById(R.id.tv_device_name); tvDeviceVersion = (TextView) rootView.findViewById(R.id.tv_device_version); tvDeviceFingerprint = (TextView) rootView.findViewById(R.id.tv_device_fingerprint); btnDeviceBack = (ImageButton) rootView.findViewById(R.id.btn_device_back); btnDeviceBack.setOnClickListener(this); btnDeviceBack.setOnTouchListener(AnimateUtils.touchAnimateListener); btnSwitcherCancel = (ImageButton) rootView.findViewById(R.id.btn_switcher_cancel); btnSwitcherCancel.setOnClickListener(this); btnSwitcherCancel.setOnTouchListener(AnimateUtils.touchAnimateListener); btnSwitcherOK = (ImageButton) rootView.findViewById(R.id.btn_switcher_ok); btnSwitcherOK.setOnClickListener(this); btnSwitcherOK.setOnTouchListener(AnimateUtils.touchAnimateListener); return rootView; } @Override public void onSaveState(Bundle outState) { super.onSaveState(outState); if(subDevice != null) { outState.putString("brand", subDevice.getBrand()); outState.putString("name", subDevice.getName()); outState.putString("model", subDevice.getModel()); outState.putString("version", subDevice.getVersion()); outState.putString("fingerprint", subDevice.getFingerprint()); } outState.putBoolean("isInfoPrompt", isInfoPrompt); } @Override public void onRestoreState(Bundle savedInstanceState) { super.onRestoreState(savedInstanceState); name = savedInstanceState.getString("name"); brand = savedInstanceState.getString("brand"); model = savedInstanceState.getString("model"); version = savedInstanceState.getString("version"); fingerprint = savedInstanceState.getString("fingerprint"); isInfoPrompt = savedInstanceState.getBoolean("isInfoPrompt"); subDevice = new SubDevice(); subDevice.setName(name); subDevice.setBrand(brand); subDevice.setModel(model); subDevice.setVersion(version); subDevice.setFingerprint(fingerprint); initialView(); } @Override public void onClick(View v) { int id = v.getId(); switch (id) { case R.id.btn_device_back: BusProvider.getInstance().post(new PagerControlEvent(PagerControlEvent.MOVE_PREV)); break; case R.id.btn_switcher_cancel: BusProvider.getInstance().post(new PagerControlEvent(0)); break; case R.id.btn_switcher_ok: BusProvider.getInstance().post(new ConfirmSwitchEvent(subDevice)); hideSwitcherProgress(); break; } } @Subscribe public void retrieveDeviceInfo(final DeviceSwitchEvent event) { if(DeviceSwitchEvent.EVENT_FAILURE.equals(event.getEvent())) { getActivity().runOnUiThread(new Runnable() { @Override public void run() { showSwitcherProgress(); } }); } } private void hideSwitcherProgress() { disableButton(); AnimateUtils.scaleOut(btnSwitcherOK); AnimateUtils.scaleOut(btnSwitcherCancel); } private void showSwitcherProgress() { enableButton(); if(isInfoPrompt) { AnimateUtils.scaleOutWithZero(btnSwitcherOK); AnimateUtils.scaleOutWithZero(btnSwitcherCancel); } else { AnimateUtils.scaleIn(btnSwitcherOK); AnimateUtils.scaleIn(btnSwitcherCancel); } } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); BusProvider.getInstance().register(this); BusProvider.getNetworkInstance().register(this); } @Override public void onDestroy() { super.onDestroy(); BusProvider.getInstance().unregister(this); BusProvider.getNetworkInstance().unregister(this); } @Subscribe public void readyChooseDevice(ChooseDeviceEvent event) { isInfoPrompt = false; brand = event.getBrand(); name = event.getName(); model = event.getModel(); version = event.getVersion(); fingerprint = event.getFingerprint(); subDevice = new SubDevice(); subDevice.setName(name); subDevice.setBrand(brand); subDevice.setModel(model); subDevice.setVersion(version); subDevice.setFingerprint(fingerprint); initialView(); } @Subscribe public void failedRetrieveDeviceInfo(final DeviceSwitchEvent event) { if(DeviceSwitchEvent.EVENT_FAILURE.equals(event.getEvent())) { getActivity().runOnUiThread(new Runnable() { @Override public void run() { showSwitcherProgress(); } }); } } @Subscribe public void setDeviceSwitcherPrompt(DevicePrompt event) { isInfoPrompt = true; } private void disableButton() { btnSwitcherCancel.setEnabled(false); btnSwitcherOK.setEnabled(false); } private void enableButton() { btnSwitcherCancel.setEnabled(true); btnSwitcherOK.setEnabled(true); } private void initialView() { tvDeviceName.setText(brand + " " + name + " " + model); tvDeviceVersion.setText(version); tvDeviceFingerprint.setText(fingerprint); showSwitcherProgress(); } }
package ankang.springcloud.homework.common.pojo; import lombok.Data; import org.springframework.data.annotation.Id; import org.springframework.data.redis.core.RedisHash; /** * @author: ankang * @email: dreedisgood@qq.com * @create: 2021-01-11 */ @RedisHash(value = "identifyingCode", timeToLive = 180) @Data public class IdentifyingCode { @Id protected String id; protected String code; }
package com.maliang.core.exception; public class Break extends RuntimeException{ private static final long serialVersionUID = 1L; public Break(){ super(); } }
package com.needii.dashboard.service; import java.util.Date; import java.util.List; import java.util.Set; import com.needii.dashboard.utils.ChartData; import com.needii.dashboard.utils.Option; import org.springframework.data.domain.Pageable; import org.springframework.data.repository.query.Param; import com.needii.dashboard.model.Product; import com.needii.dashboard.model.ProductData; public interface ProductService { List<Product> findAll(); List<Product> findAll(Date from, Date to); List<Product> findAll(Option option); List<ProductData> findByName(@Param("name") String name, @Param("languageId") int languageId, @Param("supplierId") long supplierId, Pageable pageable); List<ProductData> findByNameWithoutSupplier(@Param("name") String name, @Param("languageId") int languageId, Pageable pageable); List<Product> findByIdIn(Set<Long> ids); Long count(Option option); Product findOne(long id); void create(Product model); void update(Product model); void delete(Product model); List<ChartData> findInWeek(String firstDay, String lastDay); List<ChartData> findInMonth(String firstDay, String lastDay); List<ChartData> findInYear(String firstDay, String lastDay); Long count(); }
package com.example.saddi.eventfusionproject; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.media.RingtoneManager; import android.net.Uri; import android.support.v4.app.NotificationCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; public class NotificationTest extends AppCompatActivity { Button simple,bigText,bigPicture,notificationAction; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_notification_test); simple=findViewById(R.id.button); bigText=findViewById(R.id.button2); bigPicture=findViewById(R.id.button3); notificationAction=findViewById(R.id.button4); simple.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { simpleN(); } }); bigText.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { bigTextN(); } }); bigPicture.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { bigPictureN(); } }); notificationAction.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { notificationActionN(); } }); } private void simpleN() { int nId =0; NotificationCompat.Builder builder =new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.icon) .setLargeIcon(BitmapFactory.decodeResource(getResources(),R.drawable.icon)) .setContentTitle("Android course") .setContentText("brief description of android course") .setAutoCancel(true) .setDefaults(NotificationCompat.DEFAULT_ALL); Uri path= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); builder.setSound(path); NotificationManager notificationManager=(NotificationManager)getSystemService(NOTIFICATION_SERVICE); notificationManager.notify(nId,builder.build()); } private void bigTextN() { int nId = 1; NotificationCompat.Builder builder= new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.wall) .setLargeIcon(BitmapFactory.decodeResource(getResources(),R.drawable.wall)) .setContentTitle("Android course big picture") .setStyle(new NotificationCompat.BigTextStyle().bigText("i am text")) .setAutoCancel(true); Uri path= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); builder.setSound(path); NotificationManager notificationManager=(NotificationManager)getSystemService(NOTIFICATION_SERVICE); notificationManager.notify(nId,builder.build()); } private void bigPictureN() { int nId =2; Bitmap picture = BitmapFactory.decodeResource(getResources(),R.drawable.icon); NotificationCompat.Builder builder= new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.wall) .setLargeIcon(BitmapFactory.decodeResource(getResources(),R.drawable.wall)) .setContentTitle("Android course big picture") .setStyle(new NotificationCompat.BigPictureStyle().bigPicture(picture)) .setAutoCancel(true); Uri path= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); builder.setSound(path); NotificationManager notificationManager=(NotificationManager)getSystemService(NOTIFICATION_SERVICE); notificationManager.notify(nId,builder.build()); } private void notificationActionN() { int nId =3; NotificationCompat.Builder builder= new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.wall) .setLargeIcon(BitmapFactory.decodeResource(getResources(),R.drawable.wall)) .setContentTitle("Android course big picture") .setStyle(new NotificationCompat.BigTextStyle().bigText("click to visit gogle")) .setAutoCancel(true) .setDefaults(NotificationCompat.DEFAULT_ALL); Intent intent= new Intent(Intent.ACTION_VIEW,Uri.parse("www.google.com")); PendingIntent pendingIntent=PendingIntent.getActivity(this,0,intent,0); builder.addAction(R.drawable.icon,"view",pendingIntent); Uri path= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); builder.setSound(path); NotificationManager notificationManager=(NotificationManager)getSystemService(NOTIFICATION_SERVICE); notificationManager.notify(nId,builder.build()); } }
package com.brainacademy.vehicle; public class Motorbike extends MotorVehicle { public Motorbike() { System.out.println("Motorbike"); } }
package br.ufsc.ine5605.clavicularioeletronico.validacoes; /** * * @author Gabriel */ public class ValidacaoDadosVeiculo { private ValidacaoDadosVeiculo() { } public static boolean validaPlaca(String placa) { if (!placa.matches("[A-Z]{3}-{1}\\d{4}")) { System.out.println("A placa deve seguir o seguinte formato: (AAA-9999)"); return false; } return true; } public static boolean validaModelo(String modelo) { if (!modelo.matches("^[^ ]*[a-zA-Z0-9 ]+")) { System.out.println("Você deve digitar o modelo do carro."); return false; } return true; } public static boolean validaMarca(String marca) { if (!marca.matches("^[^ ]*[a-zA-Z0-9 ]+")) { System.out.println("Você deve digitar a marca do carro."); return false; } return true; } public static boolean validaAno(String ano) { if (!ano.matches("\\d{4}")) { System.out.println("Você deve informar um ano com 4 digitos."); return false; } return true; } public static boolean validaQuilometragem(String quilometragem) { if (!quilometragem.matches("[0-9]+")) { System.out.println("Você deve informar a quilometragem do carro com 1 ou mais digitos."); return false; } return true; } }
package com.git.cloud.resmgt.network.model.po; import com.git.cloud.common.model.base.BaseBO; /** * @Title RmNwCclassPo.java * @Package com.git.cloud.resmgt.network.model.po * @author syp * @date 2014-9-15下午4:32:26 * @version 1.0.0 * @Description * */ public class RmNwCclassPo extends BaseBO implements java.io.Serializable{ // Fields private static final long serialVersionUID = 1L; private String cclassId; private String platformId; private String platformName; private String virtualTypeId; private String virtualTypeName; private String hostTypeId; private String hostTypeName; private String useId; private String useName; private String bclassId; private String useRelCode; private String secureAreaId; private String secureAreaName; private String secureTierId; private String secureTierName; private String cclassName; private String subnetmask; private String gateway; private String vlanId; private Long ipStart; private Long ipEnd; private Long aclassIp; private Long bclassIp; private Long cclassIp; private Long ipTotalCnt; private Long ipAvailCnt; private String datacenterId; private String convergeId; private String convergeName; private String isActive; private Long usedNum; private String remark; // private Timestamp updateTime; // Constructors /** default constructor */ public RmNwCclassPo() { } /** full constructor */ public RmNwCclassPo(String cclassId, String platformId, String platformName, String virtualTypeId, String virtualTypeName, String hostTypeId, String hostTypeName, String useId, String useName, String bclassId, String useRelCode, String secureAreaId, String secureAreaName, String secureTierId, String secureTierName, String cclassName, String subnetmask, String gateway, String vlanId, Long ipStart, Long ipEnd, Long aclassIp, Long bclassIp, Long cclassIp, Long ipTotalCnt, Long ipAvailCnt, String datacenterId, String convergeId, String convergeName, String isActive, Long usedNum) { super(); this.cclassId = cclassId; this.platformId = platformId; this.platformName = platformName; this.virtualTypeId = virtualTypeId; this.virtualTypeName = virtualTypeName; this.hostTypeId = hostTypeId; this.hostTypeName = hostTypeName; this.useId = useId; this.useName = useName; this.bclassId = bclassId; this.useRelCode = useRelCode; this.secureAreaId = secureAreaId; this.secureAreaName = secureAreaName; this.secureTierId = secureTierId; this.secureTierName = secureTierName; this.cclassName = cclassName; this.subnetmask = subnetmask; this.gateway = gateway; this.vlanId = vlanId; this.ipStart = ipStart; this.ipEnd = ipEnd; this.aclassIp = aclassIp; this.bclassIp = bclassIp; this.cclassIp = cclassIp; this.ipTotalCnt = ipTotalCnt; this.ipAvailCnt = ipAvailCnt; this.datacenterId = datacenterId; this.convergeId = convergeId; this.convergeName = convergeName; this.isActive = isActive; this.usedNum = usedNum; } // Property accessors public String getCclassId() { return cclassId; } public void setCclassId(String cclassId) { this.cclassId = cclassId; } public String getBclassId() { return bclassId; } public void setBclassId(String bclassId) { this.bclassId = bclassId; } public String getUseRelCode() { return useRelCode; } public void setUseRelCode(String useRelCode) { this.useRelCode = useRelCode; } public String getSecureAreaId() { return secureAreaId; } public void setSecureAreaId(String secureAreaId) { this.secureAreaId = secureAreaId; } public String getSecureTierId() { return secureTierId; } public void setSecureTierId(String secureTierId) { this.secureTierId = secureTierId; } public String getCclassName() { return cclassName; } public void setCclassName(String cclassName) { this.cclassName = cclassName; } public String getSubnetmask() { return subnetmask; } public void setSubnetmask(String subnetmask) { this.subnetmask = subnetmask; } public String getGateway() { return gateway; } public void setGateway(String gateway) { this.gateway = gateway; } public String getVlanId() { return vlanId; } public void setVlanId(String vlanId) { this.vlanId = vlanId; } public Long getIpStart() { return ipStart; } public void setIpStart(Long ipStart) { this.ipStart = ipStart; } public Long getIpEnd() { return ipEnd; } public void setIpEnd(Long ipEnd) { this.ipEnd = ipEnd; } public Long getAclassIp() { return aclassIp; } public void setAclassIp(Long aclassIp) { this.aclassIp = aclassIp; } public Long getBclassIp() { return bclassIp; } public void setBclassIp(Long bclassIp) { this.bclassIp = bclassIp; } public Long getCclassIp() { return cclassIp; } public void setCclassIp(Long cclassIp) { this.cclassIp = cclassIp; } public Long getIpTotalCnt() { return ipTotalCnt; } public void setIpTotalCnt(Long ipTotalCnt) { this.ipTotalCnt = ipTotalCnt; } public Long getIpAvailCnt() { return ipAvailCnt; } public void setIpAvailCnt(Long ipAvailCnt) { this.ipAvailCnt = ipAvailCnt; } public String getDatacenterId() { return datacenterId; } public void setDatacenterId(String datacenterId) { this.datacenterId = datacenterId; } public String getConvergeId() { return convergeId; } public void setConvergeId(String convergeId) { this.convergeId = convergeId; } public String getIsActive() { return isActive; } public void setIsActive(String isActive) { this.isActive = isActive; } public String getPlatformId() { return platformId; } public void setPlatformId(String platformId) { this.platformId = platformId; } public String getVirtualTypeId() { return virtualTypeId; } public void setVirtualTypeId(String virtualTypeId) { this.virtualTypeId = virtualTypeId; } public String getHostTypeId() { return hostTypeId; } public void setHostTypeId(String hostTypeId) { this.hostTypeId = hostTypeId; } public String getUseId() { return useId; } public void setUseId(String useId) { this.useId = useId; } public String getPlatformName() { return platformName; } public void setPlatformName(String platformName) { this.platformName = platformName; } public String getVirtualTypeName() { return virtualTypeName; } public void setVirtualTypeName(String virtualTypeName) { this.virtualTypeName = virtualTypeName; } public String getHostTypeName() { return hostTypeName; } public void setHostTypeName(String hostTypeName) { this.hostTypeName = hostTypeName; } public String getUseName() { return useName; } public void setUseName(String useName) { this.useName = useName; } public String getSecureAreaName() { return secureAreaName; } public void setSecureAreaName(String secureAreaName) { this.secureAreaName = secureAreaName; } public String getSecureTierName() { return secureTierName; } public void setSecureTierName(String secureTierName) { this.secureTierName = secureTierName; } public String getConvergeName() { return convergeName; } public void setConvergeName(String convergeName) { this.convergeName = convergeName; } public Long getUsedNum() { return usedNum; } public void setUsedNum(Long usedNum) { this.usedNum = usedNum; } /* (non-Javadoc) * @see com.git.cloud.common.model.base.BaseBO#getBizId() */ @Override public String getBizId() { // TODO Auto-generated method stub return null; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } }
package com.giora.climasale.features.weatherDetails.domain; public class GetForecastsUseCase implements IGetForecastsUseCase { @Override public int getNumberOfDays() { return 5; } }
package com.m104.futebol.model.telas; import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.imageio.ImageIO; import javax.xml.ws.BindingProvider; import javax.xml.ws.handler.MessageContext; import com.m104.futebol.model.webservice.Time; import com.m104.futebol.model.webservice.TimesWS; import com.m104.futebol.model.webservice.TimesWSService; public class Teste { private static String WS_URL = "http://localhost:8085/futebol/TimesWS?wsdl"; public static void main(String[] args) { TimesWSService timesWSService = new TimesWSService(); TimesWS timesWS = timesWSService.getTimesWSPort(); Map<String, Object> req_ctx = ((BindingProvider)timesWS).getRequestContext(); req_ctx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, WS_URL); Map<String, List<String>> headers = new HashMap<String, List<String>>(); headers.put("Username", Collections.singletonList("futebol")); headers.put("Password", Collections.singletonList("1234")); req_ctx.put(MessageContext.HTTP_REQUEST_HEADERS, headers); List<Time> times = timesWS.buscarTodos(); Class<Time> classe = Time.class; int totalAtributosClasse = classe.getDeclaredFields().length; BufferedImage bi = new BufferedImage(800, 600, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = bi.createGraphics(); g2.setColor(Color.WHITE); g2.fillRect(0, 0, bi.getWidth(), bi.getHeight()); Font fonte = new Font("Comics",Font.PLAIN,18); g2.setFont(fonte); int alturaTexto = fonte.getSize()+10; int yLinha = alturaTexto; for (int i = 0; i < (times.size()/2); i++) { g2.setColor(new Color(245,245,245)); g2.fillRect(0, yLinha, bi.getWidth(), alturaTexto); yLinha += alturaTexto*2; } yLinha = alturaTexto-7; for (Time time : times) { g2.setColor(new Color(255,129,119)); g2.drawString(time.getNome(), 6, yLinha); int xLinha = 160; for (int i = 1; i < totalAtributosClasse; i++) { g2.drawOval(xLinha, yLinha-alturaTexto+10, 20, 20); xLinha += ((600 - 160) / totalAtributosClasse); } yLinha += alturaTexto; } File outputfile = new File("saved.png"); try { ImageIO.write(bi, "png", outputfile); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
/* * 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 q02_howToColor; /** * * @author shivani tangellapally */ public interface Colorable { /** * * @param color * @return */ public String howToColor(String color); }
package com.maco.tresenraya; import org.json.JSONArray; import org.json.JSONObject; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.LinearLayout; import android.widget.Toast; import com.maco.blackjack.BlackJackActivity; import com.maco.blackjack.domainBlackJack.BlackJack; import com.maco.tresenraya.domain.TresEnRaya; import com.maco.tresenraya.jsonMessages.GameListMessage; import edu.uclm.esi.common.androidClient.dialogs.Dialogs; import edu.uclm.esi.common.androidClient.dialogs.IDialogListener; import edu.uclm.esi.common.androidClient.domain.Store; import edu.uclm.esi.common.androidClient.domain.User; import edu.uclm.esi.common.androidClient.http.Proxy; import edu.uclm.esi.common.jsonMessages.ErrorMessage; import edu.uclm.esi.common.jsonMessages.JSONMessage; import edu.uclm.esi.common.jsonMessages.JSONParameter; import edu.uclm.esi.common.jsonMessages.OKMessage; public class GameListActivity extends ActionBarActivity implements IDialogListener { private LinearLayout gameList; private Button btnSelectedGameId; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Store.get().setCurrentContext(this); setContentView(R.layout.activity_game_list); this.gameList=(LinearLayout) this.findViewById(R.id.LinearLayoutGameList); Proxy proxy=Proxy.get(); try { JSONMessage jsm=proxy.postJSONOrderWithResponse("GameList.action"); if (jsm.getType().equals(GameListMessage.class.getSimpleName())) { GameListMessage glm=(GameListMessage) jsm; JSONArray jsa=glm.getGames(); for (int i=0; i<jsa.length(); i++) { JSONObject jGame=jsa.getJSONObject(i); final Button btnGame=new Button(this); btnGame.setTag(jGame.getInt("id")); btnGame.setText(jGame.getString("name")); btnGame.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { btnSelectedGameId=(Button) v; Dialogs.showTwoButtonsDialog(GameListActivity.this, "OK", "Do you wanna join " + btnGame.getText() + "?", "Yes", "No"); } }); LinearLayout ll=new LinearLayout(this); ll.addView(btnGame); this.gameList.addView(ll); } } else { ErrorMessage erm=(ErrorMessage) jsm; throw new Exception(erm.getText()); } } catch (Exception e) { Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); } } @Override public Context getContext() { return this; } @Override public void setSelectedButton(int button) { if (button==IDialogListener.YES) { Proxy proxy=Proxy.get(); try { Store store=Store.get(); User user=store.getUser(); JSONParameter jspIdGame=new JSONParameter("idGame", btnSelectedGameId.getTag().toString()); JSONParameter jspIdUSer=new JSONParameter("idUser", ""+ user.getId()); JSONMessage jso=proxy.postJSONOrderWithResponse("JoinGame.action", jspIdGame, jspIdUSer); if (jso.getType().equals(OKMessage.class.getSimpleName())) { OKMessage okm=(OKMessage) jso; store.setGame((Integer) btnSelectedGameId.getTag()); store.setMatch(okm.getAdditionalInfo().getInt(0)); if (store.getIdGame()==TresEnRaya.TRES_EN_RAYA) { Intent i=new Intent(this, TresEnRayaActivity.class); startActivity(i); } else if(store.getIdGame()== BlackJack.BLACK_JACK){ Intent i=new Intent(this, BlackJackActivity.class); startActivity(i); } else { Toast.makeText(this, "That game is not implemented", Toast.LENGTH_LONG).show(); } } else { ErrorMessage em=(ErrorMessage) jso; Toast.makeText(this, em.getText(), Toast.LENGTH_LONG).show(); } } catch (Exception e) { Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); } } else { btnSelectedGameId=null; } } }
package com.example.snapup_android.dao; import com.example.snapup_android.pojo.TrainRun; public interface TrainRunMapper { //通过车次编号查询车次信息 public TrainRun findTrainRunByCode(String run_code); }
package com.oa.bbs.controller; import java.text.DateFormat; import java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import com.oa.bbs.form.Forum; import com.oa.bbs.form.Reply; import com.oa.bbs.form.Topic; import com.oa.bbs.service.ForumService; import com.oa.bbs.service.ReplyService; import com.oa.bbs.service.TopicService; import com.oa.page.PageUtils; import com.oa.page.form.Page; import com.oa.user.form.UserInfo; import com.oa.user.service.UserInfoService; @Controller @RequestMapping("/bbs/topic") public class TopicController { @Autowired private ForumService forumService; @Autowired private UserInfoService userInfoService; @Autowired private TopicService topicService; @Autowired private ReplyService replyService; @RequestMapping(value="/listTopicsByForumId/{id}") public ModelAndView listForums(@PathVariable("id") int forumId,Map<String,Object> model,HttpServletRequest request){ String pageNo = request.getParameter("pageNo"); pageNo = pageNo == null ? "1" : pageNo; String pageSize = request.getParameter("pageSize"); pageSize = pageSize == null ? "10" : pageSize; int totalCount = 0; if(forumService.findAllForums()!=null){ List<Topic> topics = topicService.findAllTopicByForumId(forumId); if(topics!=null){ totalCount = topics.size(); } } Forum forum = forumService.findForumById(forumId); forum.setClickCount(forum.getClickCount()+1); forumService.updateForum(forum); List<UserInfo> allUser = userInfoService.selectAllUser(); Page<Topic> page = PageUtils.createPage(Integer.parseInt(pageSize), totalCount, Integer.parseInt(pageNo)); model.put("listTopics",topicService.findTopicByPageAndForumId(page,forumId)); model.put("page", page); model.put("forumId",forumId); model.put("forumName",forum.getName()); model.put("allUser",allUser); return new ModelAndView("/bbs/topic/listTopics",model); } @RequestMapping(value="/listReplyByTopicId/{id}") public ModelAndView listReply(@PathVariable("id") int topicId,Map<String,Object> model){ Topic topic = topicService.findTopicById(topicId); List<Reply> replyList = replyService.findReplyByTopicId(topicId); List<UserInfo> allUser = userInfoService.selectAllUser(); List<Forum> listForum = forumService.findAllForums(); model.put("listForum",listForum); model.put("topic",topic); model.put("allUser",allUser); model.put("replyList",replyList); return new ModelAndView("/bbs/topic/listReplys",model); } @RequestMapping(value="/addReply") public String addReply(@ModelAttribute("reply") Reply reply ,HttpServletRequest request,Map<String,Object> model){ String topicId = request.getParameter("topicId"); String userId = request.getParameter("userId"); Topic topic = topicService.findTopicById(Integer.parseInt(topicId)); topic.setClickCount(topic.getClickCount()+1); topic.setLastReplayUserId(Integer.parseInt(userId)); topic.setLastReplayTime(new Date()); reply.setTopic(topic); reply.setReplytopicUserId(Integer.parseInt(userId)); Date date = new Date(); reply.setReplyTime(date); replyService.addReply(reply); return "redirect:/bbs/topic/listReplyByTopicId/"+topic.getId(); } @RequestMapping(value="/addTopic/{forumId}") public ModelAndView addTopic(@PathVariable("forumId") int forumId,HttpServletRequest request ) { String userId = request.getParameter("userId"); if(userId==null || userId.length()==0){ userId = "1"; } Forum forum = forumService.findForumById(forumId); UserInfo userInfo = userInfoService.selectUserById(Integer.parseInt(userId)); Map<String,Object> model = new HashMap<String,Object>(); model.put("forum", forum); model.put("userInfo", userInfo); model.put("topic", new Topic()); return new ModelAndView("/bbs/topic/addTopic",model); } @RequestMapping(value="/saveTopic") public String saveTopic(@ModelAttribute("topic") Topic topic,HttpServletRequest request ) { String forumId = request.getParameter("forumId"); String userId = request.getParameter("userId"); if(!userId.equals("1")){ userId="1"; } Forum forum = forumService.findForumById(Integer.parseInt(forumId)); forum.setTopicCount(forum.getTopicCount()+1); topic.setForum(forum); UserInfo userInfo = userInfoService.selectUserById(Integer.parseInt(userId)); topic.setCreateBBSTopicUserInfo(userInfo); topicService.addTopic(topic); return "redirect:/bbs/topic/listTopicsByForumId/"+forum.getId()+""; } @RequestMapping("/goBack") public String listForum(Map<String,Object> model,HttpServletRequest request) { return "redirect:/bbs/forum/listForums"; } @RequestMapping(value="/editTopicById/{id}",method = RequestMethod.GET) public ModelAndView editForumById(@PathVariable("id") String id) { Forum forum = forumService.findForumById(Integer.parseInt(id)); Map<String, Object> map = new HashMap<String, Object>(); map.put("forum", forum); return new ModelAndView("/bbs/forum/editForum", map); } @RequestMapping(value="/updateForum", method=RequestMethod.POST) public String updateNotice(@ModelAttribute("forum")Forum forum) { forumService.updateForum(forum); return "redirect:/bbs/forum/listForums"; } @RequestMapping(value="/deleteForum/{id}",method = RequestMethod.GET) public String deleteNotice(@PathVariable("id") Integer forumId) { forumService.deleteForum(forumId); return "redirect:/bbs/forum/listForums"; } }
//Lonnie Williams //Jump Training import java.util.Random; import java.util.Scanner; public class SimpleDie { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); SimpleDie dice = new SimpleDie(); while (true) { //Allows the user to input choices. System.out.println("Press any key to throw a die OR type Q & Enter to quit."); String input = scanner.nextLine(); //Quits the game. if (input.equalsIgnoreCase("Q")) { System.out.println("Bye!"); scanner.close(); return; } //Print out the result. if (input.equalsIgnoreCase("Q") || input.equalsIgnoreCase("Q")) { System.out.println("Bye!"); scanner.close(); return; } else{ int X = dice.roll1(); int Y = dice.roll2(); System.out.println("First Die: " + X); System.out.println("Second Die: " + Y); System.out.println(" "); } } } // Roll the dice in Java private int roll1() { Random r1 = new Random(); return r1.nextInt(6) + 1; } private int roll2() { Random r2 = new Random(); return r2.nextInt(6) + 1; } }
package com.example.biblioteca.Fragmentos; import android.annotation.SuppressLint; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.pdf.PdfRenderer; import android.media.ThumbnailUtils; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.os.ParcelFileDescriptor; import android.os.StrictMode; import android.text.TextUtils; import android.util.Log; import android.view.ContextMenu; import android.view.LayoutInflater; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.webkit.MimeTypeMap; import android.widget.AbsListView; import android.widget.AdapterView; import android.widget.EditText; import android.widget.ListView; import android.widget.Toast; import androidx.activity.OnBackPressedCallback; import androidx.annotation.NonNull; import androidx.fragment.app.DialogFragment; import androidx.fragment.app.Fragment; import com.example.biblioteca.Adapters.filesAdapter; import com.example.biblioteca.Clases.Documento; import com.example.biblioteca.Clases.MainActivity; import com.example.biblioteca.R; import com.example.biblioteca.databinding.FragmentAlmacenamientoBinding; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.OnProgressListener; import com.google.firebase.storage.StorageReference; import com.google.firebase.storage.UploadTask; import org.jetbrains.annotations.NotNull; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; import java.util.HashSet; import java.util.List; import java.util.Objects; import java.util.Set; import static android.content.Context.MODE_PRIVATE; public class almacenamientoFragment extends Fragment { private FragmentAlmacenamientoBinding binding; public ListView lst_Folder; public String dirPath=""; public String ParentdirPath=""; public ArrayList<String> theNamesOfFiles; public ArrayList<Bitmap> intImages; public ArrayList<String> pathlist; public com.example.biblioteca.Adapters.filesAdapter filesAdapter; public File dir; public String path; public ArrayList<Integer> intSelected; String TAG = "fav"; public FirebaseUser auth; FirebaseDatabase database; public FirebaseStorage storage; public DatabaseReference myRef; StorageReference storageRef; String ref; ArrayList<File> files; SharedPreferences sharedPreferences; String[] spnAction; /** * * @param inflater * @param container * @param savedInstanceState * @return */ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { binding = FragmentAlmacenamientoBinding.inflate(inflater, container, false); auth = FirebaseAuth.getInstance().getCurrentUser(); storage = FirebaseStorage.getInstance(); database = FirebaseDatabase.getInstance(); myRef = database.getReference("Documentos"); storageRef =storage.getReference("Archivos"); files = new ArrayList<>(); pathlist = new ArrayList<>(); sharedPreferences = getActivity().getSharedPreferences("Archivos", MODE_PRIVATE); theNamesOfFiles = new ArrayList<String >(); intImages = new ArrayList<Bitmap>(); intSelected = new ArrayList<Integer>(); lst_Folder=(ListView) binding.lsvFolder.findViewById(R.id.lsvFolder); registerForContextMenu(lst_Folder); String pathdescargas = (Environment.DIRECTORY_DOWNLOADS.toString()); String storageDirectory = (Environment.getExternalStorageDirectory().toString()); if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { dirPath = storageDirectory; txpath(); } StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build()); RefreshListView(); set_Adapter(); binding.imageButton.findViewById(R.id.imageButton).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onbackpress(); } }); requireActivity().getOnBackPressedDispatcher().addCallback(new OnBackPressedCallback(true) { /** * */ @Override public void handleOnBackPressed() { onbackpress(); } }); binding.lsvFolder.setOnItemClickListener(new AdapterView.OnItemClickListener() { /** * * @param adapterView * @param view * @param i * @param l */ @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { try{ ParentdirPath = dirPath; dirPath = dirPath+"/"+theNamesOfFiles.get(i); File f = new File(dirPath); if (f.isDirectory()){ RefreshListView(); RefreshAdapter(); txpath(); }else{ Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setAction(Intent.ACTION_VIEW); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); File file = new File(dirPath); String type = extencion(file); intent.setDataAndType(Uri.fromFile(file), type); startActivity(intent); dirPath=ParentdirPath; txpath(); } }catch (Exception e){ Toast.makeText(getContext(), e.toString(), Toast.LENGTH_LONG).show(); Log.d("storage",e.toString()); } } }); lst_Folder.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE); return binding.getRoot(); } /** * */ private void txpath(){ binding.path.setText(dirPath); } /**manejo de el boton "Atrás"*/ public void onbackpress(){ if (!dirPath.equals(String.valueOf(android.os.Environment.getExternalStorageDirectory()))){ String[] folders = dirPath.split("\\/"); String[] folders2={}; folders2 = Arrays.copyOf(folders, folders.length-1); dirPath = TextUtils.join("/", folders2); } RefreshListView(); RefreshAdapter(); } /** * Crear los valores para el adapter */ private void RefreshListView() { /**/ try{ dir = new File(dirPath); File[] filelist = dir.listFiles(); Bitmap file = BitmapFactory.decodeResource(getResources(),R.drawable.file); Bitmap folder = BitmapFactory.decodeResource(getResources(),R.drawable.folder); theNamesOfFiles.clear(); intImages.clear(); for (int i = 0; i < filelist.length; i++) { theNamesOfFiles.add(filelist[i].getName()); if(filelist[i].isDirectory()){ intImages.add(folder); } else if(filelist[i].isFile()) { intImages.add(getBitmap(filelist[i])); } else{ intImages.add(file); } } }catch (Exception e){ Log.d(TAG, "RefreshListView: "+e.toString()); } } private Bitmap getBitmap(File file){ return ThumbnailUtils.extractThumbnail(BitmapFactory.decodeFile(file.getPath()),100,100); } /** *Se le da valores al fileAdapter */ private void set_Adapter(){ filesAdapter = new filesAdapter(this.getActivity(),intImages,theNamesOfFiles); lst_Folder.setAdapter(filesAdapter); } /** *Recargar el adapter para mostrar los nuevos cambios */ public void RefreshAdapter(){ filesAdapter.notifyDataSetChanged(); txpath(); } /** *Al destruir la vista esta queda null para que pueda ser anclada en otro fragment */ @Override public void onDestroyView() { super.onDestroyView(); binding = null; } /** * * @param menu * @param v * @param menuInfo */ @Override public void onCreateContextMenu(@NonNull @NotNull ContextMenu menu, @NonNull @NotNull View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); if (v.getId()==R.id.lsvFolder){ MenuInflater inflater = getActivity().getMenuInflater(); inflater.inflate(R.menu.options_menu_files,menu); } } /** * * @param item * @return */ @SuppressLint("NonConstantResourceId") @Override public boolean onContextItemSelected(@NonNull @NotNull MenuItem item) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); switch (item.getItemId()) { case R.id.info: path = dirPath+"/"+theNamesOfFiles.get(info.position); File file = new File(path); info(file,intImages.get(info.position)); return true; case R.id.save: path = dirPath+"/"+theNamesOfFiles.get(info.position); file = new File(path); Documento doc = new Documento(); String ext = file.getName().substring(file.getName().indexOf(".") + 1); if (ext.equals("pdf")){ carga(file.getName(),file,this.getContext(),getView()); }else { Toast.makeText(getContext(),"Solo Archivos '.pdf'", Toast.LENGTH_LONG).show(); } return true; case R.id.delete: path = dirPath+"/"+theNamesOfFiles.get(info.position); file = new File(path); delete(file); return true; case R.id.favorite: path = dirPath+"/"+theNamesOfFiles.get(info.position); file = new File(path); if (!file.isDirectory()){ if (extencion(file).equals("application/pdf")){ favorite(file); }else { Toast.makeText(getContext(),"Solo Archivos PDF",Toast.LENGTH_SHORT).show(); } }else { Toast.makeText(getContext(),"Solo Archivos PDF",Toast.LENGTH_SHORT).show(); } return true; case R.id.rename: path = dirPath+"/"+theNamesOfFiles.get(info.position); file = new File(path); renombrar(file); return true; default: Toast.makeText(getContext(),"error, default", Toast.LENGTH_LONG).show(); return true; } } /** * * @param file */ private void favorite(File file) { pathlist.clear(); Set<String> set = new HashSet<String>(); set = sharedPreferences.getStringSet("files", null); if (set!=null){ pathlist.addAll(set); if (!set.contains(file.toPath().toString())){ pathlist.add(file.toPath().toString()); set = new HashSet<String>(pathlist); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putStringSet("files", set); editor.commit(); new MainActivity().fav(getView()); }else { Toast.makeText(getContext(), file.getName()+"El archivo la existe como favorito", Toast.LENGTH_LONG).show(); } Log.d(TAG, "favorite: no soy null"); }else{ Log.d(TAG, "favorite: soy null"); } } /** * * @param file * @param bitmap */ public void info(File file, Bitmap bitmap) { long createdDate = file.lastModified(); DialogFragment newFragment = new infoDialogFragment(); Bundle args = new Bundle(); args.putString("name",file.getName()); args.putString("path",path); args.putString("date",String.valueOf(createdDate)); args.putString("size", String.valueOf(file.getTotalSpace())); ByteArrayOutputStream stream = new ByteArrayOutputStream(); if (bitmap!=null){ if (file.isFile()&&extencion(file).equals("application/pdf")){ bitmap= pdfToBitmap(file); }else if (file.isDirectory()){ bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); } }else { bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.file); } bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); byte[] byteArray = stream.toByteArray(); args.putByteArray("img",byteArray); newFragment.setArguments(args); newFragment.show(getActivity().getSupportFragmentManager(), "Informacion"); } /** * * @param file */ public void delete(File file) { List<String> command = new ArrayList<String>(); try { command.clear(); command.add("/system/bin/rm"); command.add("-rf"); command.add(file.toString()); ProcessBuilder pb = new ProcessBuilder(command); Process process = pb.start(); process.waitFor(); RefreshListView(); RefreshAdapter(); Toast.makeText(getContext(), file.getName()+" Eliminado correctamente", Toast.LENGTH_LONG).show(); } catch (Exception e) { Toast.makeText(getContext(), e.toString(), Toast.LENGTH_LONG).show(); Toast.makeText(getContext(), e.toString(), Toast.LENGTH_LONG).show(); } } /** * * @param file */ private void renombrar(File file) { try{ AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getContext()); LayoutInflater inflater = this.getLayoutInflater(); final View dialogView = inflater.inflate(R.layout.dialog_rename_file, null); dialogBuilder.setView(dialogView); final EditText newname = (EditText) dialogView.findViewById(R.id.newname); newname.setText(file.getName()); dialogBuilder.setTitle("Renombrar"); dialogBuilder.setMessage("Ingrese el nuevo nombre:"); dialogBuilder.setPositiveButton("Listo", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { File f = new File(file.toString()); extencion(file); File fRename = new File(dirPath+"/"+newname.getText().toString()+"."+file.getName().substring(file.getName().indexOf(".") + 1)); f.renameTo(fRename); RefreshListView(); RefreshAdapter(); } }); dialogBuilder.setNegativeButton("Cancelar", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }); AlertDialog b = dialogBuilder.create(); b.show(); }catch (Exception e){ Toast.makeText(getContext(), e.toString(), Toast.LENGTH_LONG).show(); } } /** * Metodo para el manejo del ciclo de vida de la app */ @Override public void onResume() { super.onResume(); RefreshAdapter(); set_Adapter(); } /**Obetner * * @param file * @return */ public String extencion(File file){ MimeTypeMap mime = MimeTypeMap.getSingleton(); String ext = file.getName().substring(file.getName().indexOf(".") + 1); Log.d(TAG, "extencion: "+ext); return mime.getMimeTypeFromExtension(ext); } /** * Se obtiene una instancia en Firebase para cargar el archivo * @param nombre * @param path * @param context */ public void carga(String nombre, File path, Context context,View view) { FirebaseUser auth = FirebaseAuth.getInstance().getCurrentUser(); FirebaseStorage storage = FirebaseStorage.getInstance(); FirebaseDatabase database = FirebaseDatabase.getInstance(); StorageReference storageRef =storage.getReference("Archivos"); DatabaseReference myRef = database.getReference("Documentos"); Documento doc = new Documento(); FileInputStream stream = null; try { stream = new FileInputStream(new File(String.valueOf(path))); } catch (FileNotFoundException e) { e.printStackTrace(); } Bitmap image = pdfToBitmap(new File(String.valueOf(path))); ByteArrayOutputStream baos = new ByteArrayOutputStream(); image.compress(Bitmap.CompressFormat.JPEG, 100, baos); byte[] data = baos.toByteArray(); AlertDialog.Builder builder = new AlertDialog .Builder(context); builder.setMessage("Cargando Archivo..."); builder.setCancelable(false); AlertDialog alertDialog = builder.create(); String ref = myRef.push().getKey(); UploadTask imagetask = (UploadTask) storageRef.child(ref).child("img").putBytes(data); imagetask.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() { @Override public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { Task<Uri> result = Objects.requireNonNull(Objects.requireNonNull(taskSnapshot.getMetadata()).getReference()).getDownloadUrl(); result.addOnSuccessListener(new OnSuccessListener<Uri>() { @Override public void onSuccess(Uri uri) { doc.setImg_pdf(uri.toString()); myRef.child(ref).setValue(doc); } }); } }); UploadTask uploadtask = storageRef.child(ref).child("pdf").putStream(stream); uploadtask.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() { @Override public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { Toast.makeText(context,"Carga de pdf correcta",Toast.LENGTH_SHORT).show(); Task<Uri> result = taskSnapshot.getMetadata().getReference().getDownloadUrl(); result.addOnSuccessListener(new OnSuccessListener<Uri>() { @Override public void onSuccess(Uri uri) { doc.setUrl(uri.toString()); doc.setId_usuario(auth.getUid()); doc.setNombre(nombre); doc.setFecha(Calendar.getInstance().getTime().toString()); myRef.child(ref).setValue(doc); alertDialog.dismiss(); String titulo=("Se ha cargado correctamente el archivo, ¿Desea verlo en su Nube personal?"); String mensaje=("Archivo Cargado"); showAlertDialog(context,mensaje,titulo, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { switch (i){ case -1: new MainActivity().nube(view); case -2: dialogInterface.cancel(); default: dialogInterface.cancel(); } } }); } }); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull @NotNull Exception e) { Toast.makeText(context,"error al cargar pdf",Toast.LENGTH_SHORT).show(); } }).addOnProgressListener(new OnProgressListener<UploadTask.TaskSnapshot>() { @Override public void onProgress(@NonNull @NotNull UploadTask.TaskSnapshot snapshot) { alertDialog.setCancelable(false); alertDialog.show(); } }); } /** * Metodo para crear una instantanea de la primera pagina del PDF seleccionado * @param pdfFile, Archivo completo del pdf * @return bitmap, El cual es una "vista previa" de la primera imagen del pdf" */ public Bitmap pdfToBitmap(File pdfFile) { Bitmap bitmap = null; try { PdfRenderer renderer = new PdfRenderer(ParcelFileDescriptor.open(pdfFile, ParcelFileDescriptor.MODE_READ_ONLY)); final int pageCount = renderer.getPageCount(); if(pageCount>0){ PdfRenderer.Page page = renderer.openPage(0); int width = (int) (page.getWidth()); int height = (int) (page.getHeight()); bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); canvas.drawColor(Color.WHITE); canvas.drawBitmap(bitmap, 0, 0, null); page.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY); page.close(); renderer.close(); } } catch (Exception ex) { ex.printStackTrace(); } return bitmap; } /** * Metodo generado para la cracion del AlertDialog * @param context * @param title * @param msg * @param listener */ public void showAlertDialog(Context context, String title ,String msg, DialogInterface.OnClickListener listener){ AlertDialog.Builder builder=new AlertDialog.Builder(context); builder.setTitle(title); builder.setMessage(msg); builder.setPositiveButton("Ver", (DialogInterface.OnClickListener) listener); builder.setNegativeButton("Ok",(DialogInterface.OnClickListener) listener); builder.create().show(); } }
package Th1; class Job2 implements Runnable //1첫번째 쓰레트 상속 두번째 러너블인터페이스상속 { private String name; public Job2(String name) { this.name = name; } public Job2(){} @Override public void run() { // TODO Auto-generated method stub for (int i = 0; i < 10; i++) { System.out.println(name+":"+i); } } } public class A4threadTest { public static void main(String[] args) { Job2 ins=new Job2("쓰레드1"); Thread th1 = new Thread(ins);//스레드에 올림. th1.start(); // Job2 ins2=new Job2("tttt:2"); Job2 ins2=new Job2();//이름 없이 부여할 수 있다.//null값이 나옴 Thread th2 = new Thread(ins2,"th2"); th2.start(); } } //쓰레드 클래스를 상속받아 사용할수있다. //러너블 인터페이스 상속받아 사용할수있다./.
package comp303.fivehundred.ai.basic; import comp303.fivehundred.ai.ICardExchangeStrategy; import comp303.fivehundred.model.Bid; import comp303.fivehundred.model.Hand; import comp303.fivehundred.util.Card; import comp303.fivehundred.util.Card.Suit; import comp303.fivehundred.util.CardList; /** * @author Gerald Lang 260402748 * Picks the six lowest non-trump cards. */ public class BasicCardExchangeStrategy implements ICardExchangeStrategy { private static final int WIDOW_HAND_SIZE = 16; private static final int CARDS_TO_REMOVE = 6; private static final int BID_LENGTH = 4; private static final int MIN_BID_INDEX = 0; private static final int MAX_BID_INDEX = 3; @Override public CardList selectCardsToDiscard( Bid[] pBids, int pIndex, Hand pHand) { assert pBids.length == BID_LENGTH && pHand.size()==WIDOW_HAND_SIZE && pIndex>=MIN_BID_INDEX && pIndex <= MAX_BID_INDEX; assert !Bid.max(pBids).isPass(); Suit trumpSuit = Bid.max(pBids).getSuit(); CardList cardRemoved = new CardList(); Hand clonedHand = pHand.clone(); while (cardRemoved.size() != CARDS_TO_REMOVE) { Card toRemove = clonedHand.selectLowest(trumpSuit); clonedHand.remove(toRemove); cardRemoved.add(toRemove); } return cardRemoved; } }
package com.class3601.social.persistence; import java.util.List; //import org.apache.struts.action.ActionError; //import org.apache.struts.action.ActionErrors; //import org.apache.struts.action.ActionMessage; //import org.apache.struts.action.ActionMessages; import org.hibernate.HibernateException; import org.hibernate.ObjectNotFoundException; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.exception.JDBCConnectionException; import com.class3601.social.persistence.HibernateUtil; import com.class3601.social.common.BookingLogger; import com.class3601.social.common.Messages; import com.class3601.social.models.User; public class HibernateUserManager extends AbstractHibernateDatabaseManager { private static String USER_TABLE_NAME = "USER"; private static String USER_CLASS_NAME = "User"; private static String SELECT_ALL_USERS = "from " + USER_CLASS_NAME + " as user"; private static String SELECT_USER_WITH_ID = "from " + USER_CLASS_NAME + " as user where user.id = ?"; private static String SELECT_USER_WITH_TOKEN = "from " + USER_CLASS_NAME + " as user where user.token = ?"; private static final String DROP_TABLE_SQL = "drop table if exists " + USER_TABLE_NAME + ";"; private static String SELECT_NUMBER_USERS = "select count (*) from " + USER_CLASS_NAME; private static String METHOD_INCREMENT_USER_BY_ID_BY = "incrementUserByIdBy"; private static final String CREATE_TABLE_SQL = "create table " + USER_TABLE_NAME + "(USER_ID_PRIMARY_KEY char(36) primary key, " + "ID tinytext, " + "EMAIL tinytext, " + "PASSWORD tinytext, " + "COUNTER integer, " + "TIMESTAMP timestamp, " + "TOKEN tinytext);"; private static final String METHOD_GET_N_USERS = "getNUsersStartingAtIndex"; private static String METHOD_GET_OBJECT_WITH_NAME = "getObjectWithName"; private static HibernateUserManager manager; public HibernateUserManager() { super(); } /** * Returns default instance. * * @return */ public static HibernateUserManager getDefault() { if (manager == null) { manager = new HibernateUserManager(); } return manager; } public String getClassName() { return USER_CLASS_NAME; } @Override public boolean setupTable() { HibernateUtil.executeSQLQuery(DROP_TABLE_SQL); return HibernateUtil.executeSQLQuery(CREATE_TABLE_SQL); } /** * Adds given object (user) to the database */ public synchronized boolean add(Object object) { return super.add(object); } /** * Updates given object (user). * * @param object * @return */ public synchronized boolean update(User user) { boolean result = super.update(user); return result; } /** * Deletes given user from the database. * Returns true if successful, otherwise returns false. * * @param object * @return */ public synchronized boolean delete(User user){ Session session = null; Transaction transaction = null; boolean errorResult = false; try { session = HibernateUtil.getCurrentSession(); transaction = session.beginTransaction(); session.delete(user); transaction.commit(); return true; } catch (HibernateException exception) { rollback(transaction); BookingLogger.getDefault().severe(this, Messages.METHOD_DELETE_USER, Messages.HIBERNATE_FAILED, exception); return errorResult; } catch (RuntimeException exception) { rollback(transaction); BookingLogger.getDefault().severe(this, Messages.METHOD_DELETE_USER, Messages.GENERIC_FAILED, exception); return errorResult; } finally { closeSession(); } } /** * Increments counter found for given name by 1. * * @param name */ public synchronized void incrementUserById(String id) { incrementUserByIdBy(id, 1); } /** * Increments counter found for given name by given count. * * @param name * @param count */ public synchronized void incrementUserByIdBy(String id, int count) { Session session = null; Transaction transaction = null; try { session = HibernateUtil.getCurrentSession(); transaction = session.beginTransaction(); Query query = session.createQuery(SELECT_USER_WITH_ID); query.setParameter(0, id); User user = (User) query.uniqueResult(); if (user != null) { user.setCounter(user.getCounter() + count); session.update(user); transaction.commit(); } else { BookingLogger.getDefault().severe(this, METHOD_INCREMENT_USER_BY_ID_BY, Messages.OBJECT_NOT_FOUND_FAILED + ":" + id, null); } } catch (ObjectNotFoundException exception) { BookingLogger.getDefault().severe(this, METHOD_INCREMENT_USER_BY_ID_BY, Messages.OBJECT_NOT_FOUND_FAILED, exception); } catch (HibernateException exception) { BookingLogger.getDefault().severe(this, METHOD_INCREMENT_USER_BY_ID_BY, Messages.HIBERNATE_FAILED, exception); } catch (RuntimeException exception) { BookingLogger.getDefault().severe(this, METHOD_INCREMENT_USER_BY_ID_BY, Messages.GENERIC_FAILED, exception); } finally { closeSession(); } } /** * Returns user from the database with given id. * Upon exception returns null. * * @param id * @return */ public synchronized User getUserById(String id) { Session session = null; User errorResult = null; try { session = HibernateUtil.getCurrentSession(); Query query = session.createQuery(SELECT_USER_WITH_ID); query.setParameter(0, id); User aUser = (User) query.uniqueResult(); return aUser; } catch (ObjectNotFoundException exception) { BookingLogger.getDefault().severe(this, METHOD_GET_OBJECT_WITH_NAME, Messages.OBJECT_NOT_FOUND_FAILED, exception); return errorResult; } catch (HibernateException exception) { BookingLogger.getDefault().severe(this, METHOD_GET_OBJECT_WITH_NAME, Messages.HIBERNATE_FAILED, exception); return errorResult; } catch (RuntimeException exception) { BookingLogger.getDefault().severe(this, METHOD_GET_OBJECT_WITH_NAME, Messages.GENERIC_FAILED, exception); return errorResult; } finally { closeSession(); } } public synchronized User getUserByToken(String token) { Session session = null; User errorResult = null; try { session = HibernateUtil.getCurrentSession(); Query query = session.createQuery(SELECT_USER_WITH_TOKEN); query.setParameter(0, token); User aUser = (User) query.uniqueResult(); return aUser; } catch (ObjectNotFoundException exception) { BookingLogger.getDefault().severe(this, METHOD_GET_OBJECT_WITH_NAME, Messages.OBJECT_NOT_FOUND_FAILED, exception); return errorResult; } catch (HibernateException exception) { BookingLogger.getDefault().severe(this, METHOD_GET_OBJECT_WITH_NAME, Messages.HIBERNATE_FAILED, exception); return errorResult; } catch (RuntimeException exception) { BookingLogger.getDefault().severe(this, METHOD_GET_OBJECT_WITH_NAME, Messages.GENERIC_FAILED, exception); return errorResult; } finally { closeSession(); } } /** * Returns user with given emailAddress and password from the database. * If not found returns null. * * @param emailAddress * @param password * @return */ public User getUser(String id, String password) { User user = getUserById(id); if ((user != null) && (user.getId().equals(id))) { return user; } else { return null; } } /** * Returns users, * from database. * If not found returns null. * Upon error returns null. * * @param phonenumber * @return */ @SuppressWarnings("unchecked") public synchronized List<User> getNUsersStartingAtIndex(int index, int n) { List<User> errorResult = null; Session session = null; try { session = HibernateUtil.getCurrentSession(); Query query = session.createQuery(SELECT_ALL_USERS); query.setFirstResult(index); query.setMaxResults(n); List<User> users = query.list(); return users; } catch (ObjectNotFoundException exception) { BookingLogger.getDefault().severe(this, METHOD_GET_N_USERS, Messages.OBJECT_NOT_FOUND_FAILED, exception); return errorResult; } catch (JDBCConnectionException exception) { HibernateUtil.clearSessionFactory(); BookingLogger.getDefault().severe(this, METHOD_GET_N_USERS, Messages.HIBERNATE_CONNECTION_FAILED, exception); return errorResult; } catch (HibernateException exception) { BookingLogger.getDefault().severe(this, METHOD_GET_N_USERS, Messages.HIBERNATE_FAILED, exception); return errorResult; } catch (RuntimeException exception) { BookingLogger.getDefault().severe(this, METHOD_GET_N_USERS, Messages.GENERIC_FAILED, exception); return errorResult; } finally { closeSession(); } } public String getTableName() { return USER_TABLE_NAME; } /** * Returns number of users. * * Upon error returns empty list. * * @param a charge status * @return */ public synchronized int getNumberOfUsers() { Session session = null; Long aLong; try { session = HibernateUtil.getCurrentSession(); Query query = session .createQuery(SELECT_NUMBER_USERS); aLong = (Long) query.uniqueResult(); return aLong.intValue(); } catch (ObjectNotFoundException exception) { BookingLogger.getDefault().severe(this, Messages.METHOD_GET_NUMBER_OF_USERS, Messages.OBJECT_NOT_FOUND_FAILED, exception); return 0; } catch (HibernateException exception) { BookingLogger.getDefault().severe(this, Messages.METHOD_GET_NUMBER_OF_USERS, Messages.HIBERNATE_FAILED, exception); return 0; } catch (RuntimeException exception) { BookingLogger.getDefault().severe(this, Messages.METHOD_GET_NUMBER_OF_USERS, Messages.GENERIC_FAILED, exception); return 0; } finally { closeSession(); } } }
package com.lucianoscilletta.battleship.graphics; import com.lucianoscilletta.battleship.*; import java.awt.*; import java.awt.geom.*; /** * This class has been automatically generated using <a * href="https://flamingo.dev.java.net">Flamingo SVG transcoder</a>. */ public class GameOver implements GameGraphics { float scaleFactor = BattleshipGame.getScaleFactor(); AffineTransform atScale = null; /** * Paints the transcoded SVG image on the specified com.lucianoscilletta.battleship.graphics context. You * can install a custom transformation on the com.lucianoscilletta.battleship.graphics context to scale the * image. * * @param g * Graphics context. */ public void paint(Graphics2D g) { Shape shape = null; Paint paint = null; Stroke stroke = null; float origAlpha = 1.0f; Composite origComposite = ((Graphics2D)g).getComposite(); if (origComposite instanceof AlphaComposite) { AlphaComposite origAlphaComposite = (AlphaComposite)origComposite; if (origAlphaComposite.getRule() == AlphaComposite.SRC_OVER) { origAlpha = origAlphaComposite.getAlpha(); } } atScale = g.getTransform(); atScale.scale(scaleFactor, scaleFactor); g.setTransform(atScale); AffineTransform defaultTransform_ = g.getTransform(); // g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); AffineTransform defaultTransform__0 = g.getTransform(); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0 g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); AffineTransform defaultTransform__0_0 = g.getTransform(); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_0 g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); AffineTransform defaultTransform__0_0_0 = g.getTransform(); g.transform(new AffineTransform(0.9575048089027405f, 0.0f, 0.0f, 0.9575048089027405f, 21.76285171508789f, -270.57281494140625f)); // _0_0_0 paint = new Color(0, 70, 0, 0); shape = new Rectangle2D.Double(32.26347351074219, 316.6259460449219, 565.6527709960938, 565.6527709960938); g.setPaint(paint); g.fill(shape); g.setTransform(defaultTransform__0_0_0); g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); AffineTransform defaultTransform__0_0_1 = g.getTransform(); g.transform(new AffineTransform(0.9575048089027405f, 0.0f, 0.0f, 0.9575048089027405f, 21.76285171508789f, -270.57281494140625f)); // _0_0_1 paint = new Color(0, 70, 0, 255); shape = new Rectangle2D.Double(32.26347351074219, 316.6259460449219, 565.6527709960938, 565.6527709960938); g.setPaint(paint); g.fill(shape); g.setTransform(defaultTransform__0_0_1); g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); AffineTransform defaultTransform__0_0_2 = g.getTransform(); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_0_2 paint = new Color(0, 255, 0, 255); shape = new GeneralPath(); ((GeneralPath)shape).moveTo(195.11023, 177.86937); ((GeneralPath)shape).curveTo(189.44383, 178.0755, 183.7332, 177.85397, 178.06294, 177.6024); ((GeneralPath)shape).curveTo(177.34084, 177.5703, 179.50836, 177.62671, 180.23108, 177.6389); ((GeneralPath)shape).curveTo(177.54199, 177.87923, 174.724, 177.6782, 172.12758, 178.57764); ((GeneralPath)shape).curveTo(170.06915, 179.29076, 166.12283, 181.33963, 164.3989, 182.15204); ((GeneralPath)shape).curveTo(162.56305, 183.01718, 160.71014, 183.84569, 158.86577, 184.6925); ((GeneralPath)shape).curveTo(151.34142, 188.00748, 143.89688, 191.66916, 136.86046, 195.94113); ((GeneralPath)shape).curveTo(133.57243, 197.93738, 130.46031, 200.2099, 127.25352, 202.33417); ((GeneralPath)shape).curveTo(123.50371, 204.61862, 119.56965, 206.6229, 116.0384, 209.25116); ((GeneralPath)shape).curveTo(113.7714, 212.12901, 111.46986, 214.97423, 109.54901, 218.1037); ((GeneralPath)shape).curveTo(108.02525, 221.66087, 106.3425, 225.11244, 106.09202, 229.012); ((GeneralPath)shape).curveTo(105.8349, 230.53438, 105.935555, 232.14427, 105.60575, 233.65784); ((GeneralPath)shape).curveTo(105.55165, 233.9063, 105.66995, 232.99284, 105.59485, 232.04063); ((GeneralPath)shape).curveTo(106.22228, 231.35403, 105.45308, 232.02783, 106.83986, 232.84616); ((GeneralPath)shape).curveTo(107.04686, 232.96832, 107.34374, 232.70879, 107.560165, 232.81335); ((GeneralPath)shape).curveTo(109.40961, 233.70659, 111.145546, 235.541, 112.67779, 236.86917); ((GeneralPath)shape).curveTo(113.657555, 238.01987, 114.018875, 237.69945, 115.16366, 238.01201); ((GeneralPath)shape).curveTo(115.65837, 238.14708, 116.104706, 238.43475, 116.603455, 238.55403); ((GeneralPath)shape).curveTo(117.63783, 238.80144, 118.727684, 238.66454, 119.79005, 238.71475); ((GeneralPath)shape).curveTo(123.752464, 238.88101, 127.724045, 238.79515, 131.68703, 238.95213); ((GeneralPath)shape).curveTo(132.36223, 238.97884, 130.33562, 238.93983, 129.65991, 238.93364); ((GeneralPath)shape).curveTo(130.5291, 238.96104, 131.39828, 238.98843, 132.26747, 239.01584); ((GeneralPath)shape).curveTo(130.65082, 239.18982, 135.69408, 238.82343, 135.234, 239.60916); ((GeneralPath)shape).curveTo(135.03606, 239.9472, 134.2525, 240.05653, 134.38744, 240.42429); ((GeneralPath)shape).curveTo(134.40593, 240.47469, 136.02284, 239.06573, 136.05771, 239.03569); ((GeneralPath)shape).curveTo(139.53523, 235.41559, 144.14368, 233.42813, 148.56082, 231.24754); ((GeneralPath)shape).curveTo(152.17793, 229.20284, 156.2073, 228.08377, 159.82585, 226.05832); ((GeneralPath)shape).curveTo(162.32751, 224.68343, 164.44948, 222.70882, 166.64227, 220.89792); ((GeneralPath)shape).curveTo(170.49257, 218.15092, 174.10315, 215.1114, 177.84502, 212.22903); ((GeneralPath)shape).curveTo(186.25784, 206.19301, 182.25949, 209.28055, 195.78638, 220.96454); ((GeneralPath)shape).curveTo(195.51683, 221.32098, 195.19965, 221.64597, 194.97775, 222.03387); ((GeneralPath)shape).curveTo(194.28778, 223.24007, 193.97339, 224.62648, 193.40636, 225.89511); ((GeneralPath)shape).curveTo(191.86406, 229.3458, 190.5469, 232.71812, 189.37439, 236.31642); ((GeneralPath)shape).curveTo(187.59303, 244.3367, 185.43002, 252.3071, 182.33974, 259.92627); ((GeneralPath)shape).curveTo(181.69383, 261.046, 181.04791, 262.16574, 180.40202, 263.2855); ((GeneralPath)shape).curveTo(179.81818, 264.52905, 162.2314, 256.2724, 162.81523, 255.02882); ((GeneralPath)shape).lineTo(162.81523, 255.02882); ((GeneralPath)shape).curveTo(163.04573, 254.62685, 163.27625, 254.22487, 163.50676, 253.8229); ((GeneralPath)shape).curveTo(164.63345, 250.74448, 165.15155, 247.5681, 165.91454, 244.38174); ((GeneralPath)shape).curveTo(166.98654, 239.90477, 168.22447, 235.46722, 169.2689, 230.98326); ((GeneralPath)shape).curveTo(169.79019, 229.32259, 170.21477, 227.62839, 170.83281, 226.00124); ((GeneralPath)shape).curveTo(172.50298, 221.6041, 174.79732, 217.6527, 177.5324, 213.85638); ((GeneralPath)shape).curveTo(178.35628, 212.71284, 179.11017, 211.51152, 180.0373, 210.44998); ((GeneralPath)shape).curveTo(180.5953, 209.81107, 181.32028, 209.33987, 181.96178, 208.78484); ((GeneralPath)shape).curveTo(187.12001, 212.11667, 192.3588, 215.327, 197.4365, 218.78035); ((GeneralPath)shape).curveTo(197.59949, 218.8912, 196.95116, 219.89435, 196.19797, 220.94888); ((GeneralPath)shape).curveTo(194.8809, 222.7929, 193.26863, 224.29228, 191.60748, 225.8257); ((GeneralPath)shape).curveTo(190.38297, 226.71559, 189.06949, 227.48386, 187.8828, 228.42361); ((GeneralPath)shape).curveTo(185.46812, 230.33586, 183.26532, 232.66226, 180.38564, 233.90993); ((GeneralPath)shape).curveTo(173.7355, 239.03325, 181.0006, 233.68517, 177.37892, 235.90732); ((GeneralPath)shape).curveTo(175.29224, 237.18765, 173.83084, 239.39973, 171.56834, 240.46123); ((GeneralPath)shape).curveTo(169.95894, 241.38417, 168.55507, 242.54341, 166.98131, 243.52739); ((GeneralPath)shape).curveTo(164.7609, 244.91566, 162.323, 245.8745, 159.99818, 247.06262); ((GeneralPath)shape).curveTo(159.20607, 247.43051, 155.77287, 249.04184, 154.91049, 249.3778); ((GeneralPath)shape).curveTo(154.27672, 249.6247, 152.4482, 250.19073, 151.60962, 250.3354); ((GeneralPath)shape).curveTo(151.39297, 250.3728, 151.14088, 250.2467, 150.95042, 250.3565); ((GeneralPath)shape).curveTo(150.44574, 250.64754, 150.06075, 251.10889, 149.61589, 251.48509); ((GeneralPath)shape).curveTo(145.8845, 254.43723, 142.9146, 257.31738, 137.86327, 257.7473); ((GeneralPath)shape).curveTo(129.15912, 258.7453, 120.071686, 258.55685, 111.59382, 256.21268); ((GeneralPath)shape).curveTo(106.96464, 254.53477, 102.32789, 252.8116, 98.52849, 249.5581); ((GeneralPath)shape).curveTo(95.216675, 246.86186, 91.73218, 244.28891, 89.45974, 240.58203); ((GeneralPath)shape).curveTo(89.05103, 239.73293, 88.58462, 238.90924, 88.23359, 238.03471); ((GeneralPath)shape).curveTo(87.03652, 235.0523, 87.1534, 231.76414, 86.98848, 228.61594); ((GeneralPath)shape).curveTo(87.04528, 222.02345, 88.65953, 216.30191, 91.89721, 210.5498); ((GeneralPath)shape).curveTo(93.90821, 206.40544, 95.3145, 204.59769, 98.50601, 201.38141); ((GeneralPath)shape).curveTo(100.04086, 199.83466, 99.12889, 200.25188, 100.334854, 199.83437); ((GeneralPath)shape).curveTo(103.473656, 194.709, 107.65451, 190.32262, 112.25777, 186.47766); ((GeneralPath)shape).curveTo(117.418564, 182.78825, 122.455215, 178.81949, 127.86877, 175.50092); ((GeneralPath)shape).curveTo(133.89786, 171.805, 140.32591, 168.85709, 146.86116, 166.18533); ((GeneralPath)shape).curveTo(155.84618, 162.98369, 164.89134, 159.55682, 174.41202, 158.3826); ((GeneralPath)shape).curveTo(183.57205, 158.06631, 192.98593, 157.7098, 201.8432, 160.53728); ((GeneralPath)shape).curveTo(203.06877, 161.01337, 196.33583, 178.34564, 195.11024, 177.86955); ((GeneralPath)shape).closePath(); g.setPaint(paint); g.fill(shape); g.setTransform(defaultTransform__0_0_2); g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); AffineTransform defaultTransform__0_0_3 = g.getTransform(); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_0_3 paint = new Color(0, 255, 0, 255); shape = new GeneralPath(); ((GeneralPath)shape).moveTo(198.17023, 251.4834); ((GeneralPath)shape).curveTo(197.09436, 241.38376, 199.15524, 231.37273, 201.09947, 221.5135); ((GeneralPath)shape).curveTo(203.74911, 209.4859, 209.11867, 198.54706, 215.34273, 188.02487); ((GeneralPath)shape).curveTo(216.55315, 185.76485, 218.17087, 183.62369, 218.87086, 181.11499); ((GeneralPath)shape).curveTo(219.31964, 179.50668, 219.41982, 177.81708, 219.82898, 176.19826); ((GeneralPath)shape).curveTo(220.14494, 174.94818, 220.55486, 173.72374, 220.9178, 172.48648); ((GeneralPath)shape).curveTo(222.3362, 168.81725, 223.93834, 165.15855, 226.39644, 162.04903); ((GeneralPath)shape).curveTo(226.97334, 161.31924, 227.49353, 160.51898, 228.21599, 159.93294); ((GeneralPath)shape).curveTo(229.69449, 158.73364, 231.37054, 157.80084, 232.94781, 156.7348); ((GeneralPath)shape).curveTo(236.66751, 157.20857, 240.57559, 156.89497, 244.10689, 158.15613); ((GeneralPath)shape).curveTo(245.9803, 158.8252, 251.10551, 165.20787, 252.33096, 166.72661); ((GeneralPath)shape).curveTo(258.23898, 174.0485, 263.34998, 181.80821, 268.48428, 189.68292); ((GeneralPath)shape).curveTo(276.85812, 203.86893, 283.59964, 219.15149, 287.126, 235.3003); ((GeneralPath)shape).curveTo(288.81473, 243.03368, 288.67764, 245.41643, 289.13074, 253.0505); ((GeneralPath)shape).curveTo(288.14902, 261.2742, 289.07245, 257.48474, 286.63574, 264.4824); ((GeneralPath)shape).curveTo(286.35226, 265.8533, 266.96466, 261.84442, 267.24814, 260.47348); ((GeneralPath)shape).lineTo(267.24814, 260.47348); ((GeneralPath)shape).curveTo(266.78848, 258.0591, 267.0969, 259.71854, 266.37494, 255.48573); ((GeneralPath)shape).curveTo(265.92712, 253.4646, 265.59888, 251.41318, 265.03143, 249.4223); ((GeneralPath)shape).curveTo(264.27853, 246.78072, 263.31345, 244.20407, 262.4192, 241.60692); ((GeneralPath)shape).curveTo(257.59283, 227.58992, 251.87357, 213.90073, 245.37318, 200.57465); ((GeneralPath)shape).curveTo(240.28383, 190.55727, 241.04922, 192.3401, 236.70198, 182.81502); ((GeneralPath)shape).curveTo(235.79787, 180.83403, 234.95273, 178.82646, 234.0474, 176.84604); ((GeneralPath)shape).curveTo(233.55458, 175.76802, 232.8276, 174.78198, 232.50797, 173.64058); ((GeneralPath)shape).curveTo(232.45076, 173.43646, 232.87776, 173.4333, 233.06265, 173.32965); ((GeneralPath)shape).curveTo(235.73264, 173.29655, 238.4026, 173.26355, 241.07259, 173.23045); ((GeneralPath)shape).curveTo(241.84769, 172.36551, 242.6382, 171.51411, 243.39792, 170.6356); ((GeneralPath)shape).curveTo(243.44162, 170.585, 243.2615, 170.6829, 243.22643, 170.73984); ((GeneralPath)shape).curveTo(242.93245, 171.217, 242.6995, 171.72926, 242.42358, 172.21707); ((GeneralPath)shape).curveTo(241.44594, 173.9456, 241.57649, 173.45827, 240.717, 175.5267); ((GeneralPath)shape).curveTo(240.42099, 176.23907, 240.17761, 176.97218, 239.9079, 177.69492); ((GeneralPath)shape).curveTo(237.52473, 183.66464, 237.29797, 190.34349, 234.60666, 196.24208); ((GeneralPath)shape).curveTo(228.21141, 210.2999, 237.31645, 190.49316, 230.36539, 204.91302); ((GeneralPath)shape).curveTo(227.1781, 211.52496, 224.8984, 218.5968, 222.77017, 225.60051); ((GeneralPath)shape).curveTo(221.42258, 230.85954, 220.0908, 236.1164, 218.97603, 241.43098); ((GeneralPath)shape).curveTo(218.4224, 244.07039, 218.04169, 246.74643, 217.41632, 249.36977); ((GeneralPath)shape).curveTo(217.24509, 250.08807, 216.97409, 250.77887, 216.75298, 251.48341); ((GeneralPath)shape).curveTo(216.75298, 252.79741, 198.17027, 252.79741, 198.17027, 251.48341); ((GeneralPath)shape).closePath(); g.setPaint(paint); g.fill(shape); g.setTransform(defaultTransform__0_0_3); g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); AffineTransform defaultTransform__0_0_4 = g.getTransform(); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_0_4 paint = new Color(0, 255, 0, 255); shape = new GeneralPath(); ((GeneralPath)shape).moveTo(223.1999, 216.38712); ((GeneralPath)shape).curveTo(224.8784, 215.70067, 226.51974, 214.9153, 228.23537, 214.32779); ((GeneralPath)shape).curveTo(242.93811, 209.29301, 259.2187, 206.27065, 274.60165, 204.39227); ((GeneralPath)shape).curveTo(278.72397, 203.8889, 282.8723, 203.62834, 287.00763, 203.24637); ((GeneralPath)shape).curveTo(290.17487, 203.13438, 293.34213, 203.02238, 296.50937, 202.91039); ((GeneralPath)shape).curveTo(298.11737, 202.27068, 307.16434, 225.01117, 305.55634, 225.6509); ((GeneralPath)shape).lineTo(305.55634, 225.6509); ((GeneralPath)shape).curveTo(302.5344, 226.48418, 299.51242, 227.31747, 296.4905, 228.15076); ((GeneralPath)shape).curveTo(282.015, 230.7359, 286.33084, 230.18477, 271.00412, 231.96565); ((GeneralPath)shape).curveTo(257.72003, 233.50919, 244.3201, 234.95271, 230.93614, 233.84456); ((GeneralPath)shape).curveTo(229.7017, 234.3916, 221.96548, 216.93413, 223.19992, 216.3871); ((GeneralPath)shape).closePath(); g.setPaint(paint); g.fill(shape); g.setTransform(defaultTransform__0_0_4); g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); AffineTransform defaultTransform__0_0_5 = g.getTransform(); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_0_5 paint = new Color(0, 255, 0, 255); shape = new GeneralPath(); ((GeneralPath)shape).moveTo(303.31723, 255.4123); ((GeneralPath)shape).curveTo(303.28262, 250.26115, 303.7994, 245.08629, 304.94604, 240.0641); ((GeneralPath)shape).curveTo(305.78088, 235.42242, 307.09015, 230.95934, 308.80667, 226.57614); ((GeneralPath)shape).curveTo(310.47858, 221.55894, 312.30063, 216.55666, 313.1644, 211.32492); ((GeneralPath)shape).curveTo(314.15182, 206.43224, 315.46567, 201.6072, 317.18967, 196.92313); ((GeneralPath)shape).curveTo(318.1307, 194.68048, 317.47952, 192.29756, 317.8886, 189.87573); ((GeneralPath)shape).curveTo(317.9689, 186.51402, 318.62854, 183.22856, 319.28397, 179.9439); ((GeneralPath)shape).curveTo(319.75668, 177.0724, 319.61563, 174.18527, 320.46802, 171.36545); ((GeneralPath)shape).curveTo(324.05347, 164.46677, 322.60645, 165.09332, 337.40103, 167.27792); ((GeneralPath)shape).curveTo(338.92416, 167.50284, 339.30542, 169.69878, 340.20667, 170.94707); ((GeneralPath)shape).curveTo(340.93317, 171.95332, 341.55206, 173.03459, 342.28195, 174.03838); ((GeneralPath)shape).curveTo(343.0002, 175.02617, 343.79266, 175.95784, 344.54803, 176.91757); ((GeneralPath)shape).curveTo(345.40955, 178.13176, 346.2711, 179.34595, 347.1326, 180.56013); ((GeneralPath)shape).curveTo(349.49637, 183.90982, 352.01297, 187.14893, 354.42844, 190.45694); ((GeneralPath)shape).curveTo(355.102, 191.37938, 355.66528, 192.38011, 356.35464, 193.2908); ((GeneralPath)shape).curveTo(357.31113, 194.55443, 358.40533, 195.70969, 359.36307, 196.97235); ((GeneralPath)shape).curveTo(359.7121, 197.43796, 359.92926, 198.0415, 360.41013, 198.36914); ((GeneralPath)shape).curveTo(360.6529, 198.53453, 360.13397, 197.81316, 360.16913, 197.52153); ((GeneralPath)shape).curveTo(360.18344, 197.40305, 360.48764, 197.56783, 360.52057, 197.45312); ((GeneralPath)shape).curveTo(360.56625, 197.29393, 360.1542, 196.98376, 360.31915, 196.9989); ((GeneralPath)shape).curveTo(360.7184, 197.0355, 361.044, 197.34276, 361.39667, 197.53351); ((GeneralPath)shape).curveTo(362.10043, 197.91414, 362.79053, 198.31952, 363.48743, 198.71252); ((GeneralPath)shape).curveTo(364.5702, 200.16713, 365.9809, 201.42757, 366.73572, 203.07637); ((GeneralPath)shape).curveTo(367.36337, 204.44746, 367.30914, 206.03839, 367.5244, 207.53088); ((GeneralPath)shape).curveTo(367.57452, 207.87834, 367.63474, 208.91914, 367.52942, 208.58403); ((GeneralPath)shape).curveTo(367.2394, 207.65504, 367.79153, 206.22415, 366.95865, 205.72078); ((GeneralPath)shape).curveTo(356.2384, 199.2418, 351.3867, 203.85904, 355.25854, 200.39526); ((GeneralPath)shape).curveTo(363.38956, 193.91864, 371.61694, 187.5682, 379.72424, 181.05893); ((GeneralPath)shape).curveTo(384.8499, 177.3301, 389.46463, 172.99072, 394.42422, 169.05438); ((GeneralPath)shape).curveTo(395.42334, 168.2614, 396.42093, 167.46431, 397.4621, 166.72737); ((GeneralPath)shape).curveTo(397.8552, 166.44914, 398.25592, 165.88185, 398.71884, 166.01465); ((GeneralPath)shape).curveTo(399.0689, 166.11508, 398.75974, 166.74188, 398.78024, 167.10548); ((GeneralPath)shape).curveTo(399.9562, 176.39572, 397.84952, 174.98312, 411.72913, 176.89117); ((GeneralPath)shape).curveTo(412.62225, 177.01396, 413.03226, 175.50368, 413.90775, 175.28854); ((GeneralPath)shape).curveTo(414.24338, 175.20604, 414.10477, 175.9573, 414.12543, 176.3023); ((GeneralPath)shape).curveTo(414.26703, 178.66556, 414.14444, 181.03725, 414.14612, 183.40474); ((GeneralPath)shape).curveTo(414.31857, 192.73, 415.2174, 202.06802, 414.41992, 211.391); ((GeneralPath)shape).curveTo(414.2661, 213.1889, 413.9595, 214.97044, 413.7293, 216.76016); ((GeneralPath)shape).curveTo(412.4782, 223.87254, 411.6733, 231.04875, 410.27942, 238.13643); ((GeneralPath)shape).curveTo(409.4913, 240.58882, 409.4258, 242.17719, 409.40375, 244.74437); ((GeneralPath)shape).curveTo(408.24756, 247.73949, 407.4181, 250.59322, 407.11197, 253.761); ((GeneralPath)shape).curveTo(406.91458, 255.98369, 407.2207, 258.19672, 407.44583, 260.40335); ((GeneralPath)shape).curveTo(407.70386, 261.79236, 407.46893, 263.2323, 407.6167, 264.62378); ((GeneralPath)shape).curveTo(407.6217, 264.67297, 407.72247, 264.51205, 407.7481, 264.55438); ((GeneralPath)shape).curveTo(407.86563, 264.7487, 407.90253, 264.98187, 407.96533, 265.20013); ((GeneralPath)shape).curveTo(408.07736, 265.5894, 408.16998, 265.98398, 408.2723, 266.3759); ((GeneralPath)shape).curveTo(408.3799, 266.88422, 408.4875, 267.39258, 408.5951, 267.9009); ((GeneralPath)shape).curveTo(408.81985, 269.18625, 390.64236, 272.36478, 390.41763, 271.07944); ((GeneralPath)shape).lineTo(390.41763, 271.07944); ((GeneralPath)shape).curveTo(390.34402, 270.72122, 390.2705, 270.363, 390.19696, 270.00482); ((GeneralPath)shape).curveTo(389.6348, 267.4774, 389.27814, 264.95154, 389.30655, 262.3636); ((GeneralPath)shape).curveTo(388.737, 258.9904, 387.91614, 255.63608, 388.21118, 252.17908); ((GeneralPath)shape).curveTo(388.5741, 248.59406, 389.19937, 245.18918, 390.9715, 241.99478); ((GeneralPath)shape).curveTo(391.2165, 241.55316, 391.49646, 240.33167, 391.80634, 240.73047); ((GeneralPath)shape).curveTo(392.2215, 241.26477, 391.63824, 242.07327, 391.5542, 242.74467); ((GeneralPath)shape).curveTo(391.6044, 243.32864, 391.7877, 243.91634, 391.70496, 244.4966); ((GeneralPath)shape).curveTo(391.64847, 244.89291, 391.5411, 243.71274, 391.47238, 243.31837); ((GeneralPath)shape).curveTo(391.0604, 240.95398, 390.878, 238.5553, 390.9541, 236.155); ((GeneralPath)shape).curveTo(391.32788, 229.12357, 392.22748, 222.12163, 392.60147, 215.0875); ((GeneralPath)shape).curveTo(392.63947, 214.38611, 393.09647, 206.04306, 393.10162, 205.54373); ((GeneralPath)shape).curveTo(393.18283, 197.72223, 392.03925, 189.88313, 393.07224, 182.06944); ((GeneralPath)shape).curveTo(394.63098, 170.3239, 397.82037, 153.66698, 415.20483, 164.75584); ((GeneralPath)shape).curveTo(417.2143, 166.0376, 416.09665, 169.43858, 416.54257, 171.77994); ((GeneralPath)shape).curveTo(416.31924, 172.91423, 416.23453, 174.0849, 415.8726, 175.18285); ((GeneralPath)shape).curveTo(412.77557, 184.57765, 402.9818, 190.60063, 396.2528, 197.14828); ((GeneralPath)shape).curveTo(386.79578, 204.02089, 377.31616, 211.10274, 366.34525, 215.3986); ((GeneralPath)shape).curveTo(360.17972, 217.89882, 361.27573, 218.03676, 350.30148, 212.01268); ((GeneralPath)shape).curveTo(349.18454, 211.39955, 349.5957, 209.56094, 349.34644, 208.3114); ((GeneralPath)shape).curveTo(349.28873, 208.0221, 349.25952, 207.16113, 349.38675, 207.4273); ((GeneralPath)shape).curveTo(349.78387, 208.2585, 349.71933, 209.27904, 350.18774, 210.07224); ((GeneralPath)shape).curveTo(350.88522, 211.2533, 351.94098, 212.1821, 352.81763, 213.23703); ((GeneralPath)shape).curveTo(353.06522, 213.4102, 353.41827, 213.48991, 353.56042, 213.75652); ((GeneralPath)shape).curveTo(353.9618, 214.50935, 348.37695, 212.00714, 348.3052, 211.95917); ((GeneralPath)shape).curveTo(347.00333, 211.08849, 345.09863, 209.37889, 343.77237, 208.21487); ((GeneralPath)shape).curveTo(337.9325, 202.93683, 332.77762, 196.88045, 328.55908, 190.2316); ((GeneralPath)shape).curveTo(327.31308, 188.10341, 323.26852, 181.74504, 323.19324, 179.26025); ((GeneralPath)shape).curveTo(323.18524, 178.98578, 323.69363, 179.58266, 323.96582, 179.54622); ((GeneralPath)shape).curveTo(338.21063, 177.63843, 336.24988, 181.65318, 338.36514, 175.63759); ((GeneralPath)shape).curveTo(338.27853, 175.9664, 338.44345, 176.65962, 338.10535, 176.62401); ((GeneralPath)shape).curveTo(337.7538, 176.587, 337.96237, 175.24223, 337.88406, 175.58693); ((GeneralPath)shape).curveTo(337.76965, 176.0904, 337.96677, 176.61642, 337.98987, 177.13219); ((GeneralPath)shape).curveTo(338.07047, 178.92908, 338.02426, 180.72987, 337.81204, 182.5171); ((GeneralPath)shape).curveTo(337.36102, 185.74573, 336.47073, 188.85739, 336.16928, 192.10199); ((GeneralPath)shape).curveTo(336.12637, 192.47372, 336.3288, 192.9784, 336.0407, 193.21722); ((GeneralPath)shape).curveTo(335.82718, 193.39424, 335.77277, 192.15132, 335.77524, 192.42865); ((GeneralPath)shape).curveTo(335.78125, 193.143, 336.00555, 193.84096, 336.05264, 194.5538); ((GeneralPath)shape).curveTo(336.18848, 196.60954, 336.09244, 198.73032, 335.42938, 200.69614); ((GeneralPath)shape).curveTo(334.71198, 205.1842, 333.6905, 209.62477, 332.7114, 214.0613); ((GeneralPath)shape).curveTo(331.62756, 220.49857, 329.82645, 226.72333, 326.9579, 232.61238); ((GeneralPath)shape).curveTo(325.60324, 235.89981, 324.0401, 239.135, 323.85312, 242.75998); ((GeneralPath)shape).curveTo(323.3633, 247.85658, 323.22165, 253.06985, 321.57538, 257.96155); ((GeneralPath)shape).curveTo(321.3951, 259.25262, 303.1364, 256.7033, 303.31668, 255.41223); ((GeneralPath)shape).closePath(); g.setPaint(paint); g.fill(shape); g.setTransform(defaultTransform__0_0_5); g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); AffineTransform defaultTransform__0_0_6 = g.getTransform(); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_0_6 paint = new Color(0, 255, 0, 255); shape = new GeneralPath(); ((GeneralPath)shape).moveTo(454.80063, 177.10019); ((GeneralPath)shape).curveTo(455.36816, 182.73265, 454.76724, 188.42053, 455.24835, 194.05626); ((GeneralPath)shape).curveTo(455.3861, 195.66998, 456.7955, 204.18427, 456.9404, 205.08368); ((GeneralPath)shape).curveTo(458.18155, 213.83997, 458.94403, 222.7309, 458.0549, 231.56535); ((GeneralPath)shape).curveTo(457.71362, 234.95653, 456.9586, 237.98724, 456.2362, 241.29976); ((GeneralPath)shape).curveTo(454.82077, 246.05247, 452.94714, 250.76875, 450.11276, 254.86937); ((GeneralPath)shape).curveTo(450.04947, 254.92928, 449.92346, 255.13597, 449.9229, 255.04887); ((GeneralPath)shape).curveTo(449.92224, 254.8966, 450.39453, 253.71877, 450.39594, 253.72217); ((GeneralPath)shape).curveTo(450.6222, 254.28494, 450.86948, 255.832, 450.95447, 256.28937); ((GeneralPath)shape).curveTo(451.5338, 260.55838, 450.88077, 255.53874, 451.36227, 259.94302); ((GeneralPath)shape).curveTo(451.3954, 260.24557, 451.67645, 261.11884, 451.5848, 260.82858); ((GeneralPath)shape).curveTo(450.78146, 258.28427, 451.564, 260.02493, 449.15344, 256.6147); ((GeneralPath)shape).curveTo(450.37463, 254.32758, 444.8394, 255.65503, 445.84042, 254.9234); ((GeneralPath)shape).curveTo(447.3097, 253.84955, 449.35443, 253.97351, 451.12277, 253.54358); ((GeneralPath)shape).curveTo(453.72107, 252.91187, 456.32193, 252.28703, 458.93912, 251.7388); ((GeneralPath)shape).curveTo(466.9049, 250.07018, 472.79514, 249.14249, 480.91858, 247.7478); ((GeneralPath)shape).curveTo(484.9756, 247.24094, 489.0326, 246.73407, 493.0896, 246.22719); ((GeneralPath)shape).curveTo(494.85266, 245.57532, 504.07144, 270.50864, 502.30838, 271.16052); ((GeneralPath)shape).lineTo(502.30838, 271.16052); ((GeneralPath)shape).curveTo(498.28235, 271.64804, 494.25632, 272.13556, 490.2303, 272.62308); ((GeneralPath)shape).curveTo(481.4094, 273.38345, 475.5111, 274.0478, 466.7592, 274.2286); ((GeneralPath)shape).curveTo(446.97498, 274.63736, 466.20184, 274.0969, 451.93958, 273.4642); ((GeneralPath)shape).curveTo(449.16943, 273.3413, 446.37796, 273.7818, 443.62103, 273.4852); ((GeneralPath)shape).curveTo(442.1683, 273.32892, 440.84393, 272.5758, 439.45538, 272.12112); ((GeneralPath)shape).curveTo(438.09323, 270.9056, 436.55386, 269.8634, 435.3689, 268.47458); ((GeneralPath)shape).curveTo(433.04926, 265.7559, 432.7875, 261.6947, 432.4325, 258.335); ((GeneralPath)shape).curveTo(432.1219, 254.37701, 431.81784, 250.35263, 433.7225, 246.69751); ((GeneralPath)shape).curveTo(435.076, 244.07439, 435.79562, 241.32986, 436.03238, 238.35793); ((GeneralPath)shape).curveTo(437.15005, 228.03368, 435.72726, 217.5998, 434.76242, 207.3198); ((GeneralPath)shape).curveTo(434.40344, 202.87846, 433.78796, 198.45229, 433.65198, 193.99855); ((GeneralPath)shape).curveTo(433.45813, 187.64964, 434.47925, 181.2488, 436.15005, 175.1448); ((GeneralPath)shape).curveTo(436.28833, 173.826, 454.9389, 175.78134, 454.80066, 177.10014); ((GeneralPath)shape).closePath(); g.setPaint(paint); g.fill(shape); g.setTransform(defaultTransform__0_0_6); g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); AffineTransform defaultTransform__0_0_7 = g.getTransform(); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_0_7 paint = new Color(0, 255, 0, 255); shape = new GeneralPath(); ((GeneralPath)shape).moveTo(449.67493, 209.13927); ((GeneralPath)shape).curveTo(466.13098, 204.93478, 483.38605, 204.8664, 500.24084, 205.85522); ((GeneralPath)shape).curveTo(501.83902, 205.38148, 508.5388, 227.98297, 506.9406, 228.45671); ((GeneralPath)shape).lineTo(506.9406, 228.45671); ((GeneralPath)shape).curveTo(504.2536, 228.85825, 501.58206, 229.38225, 498.8796, 229.66129); ((GeneralPath)shape).curveTo(483.99423, 231.19829, 468.82898, 230.42668, 454.25644, 226.98305); ((GeneralPath)shape).curveTo(452.9947, 227.307, 448.41318, 209.46321, 449.67493, 209.13925); ((GeneralPath)shape).closePath(); g.setPaint(paint); g.fill(shape); g.setTransform(defaultTransform__0_0_7); g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); AffineTransform defaultTransform__0_0_8 = g.getTransform(); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_0_8 paint = new Color(0, 255, 0, 255); shape = new GeneralPath(); ((GeneralPath)shape).moveTo(434.11722, 166.98587); ((GeneralPath)shape).curveTo(435.78143, 166.2804, 437.38812, 165.4199, 439.1098, 164.86946); ((GeneralPath)shape).curveTo(447.50623, 162.18497, 457.02112, 161.18954, 465.70102, 160.03178); ((GeneralPath)shape).curveTo(478.6463, 158.3051, 477.17615, 158.56541, 490.50424, 157.22995); ((GeneralPath)shape).curveTo(494.89856, 156.90373, 499.29288, 156.5775, 503.6872, 156.25127); ((GeneralPath)shape).curveTo(505.5217, 155.66867, 513.76074, 181.61252, 511.92627, 182.1951); ((GeneralPath)shape).lineTo(511.92627, 182.1951); ((GeneralPath)shape).curveTo(507.62674, 182.45111, 503.3272, 182.70712, 499.02768, 182.96313); ((GeneralPath)shape).curveTo(491.13214, 183.46373, 481.50186, 184.14618, 473.574, 184.36748); ((GeneralPath)shape).curveTo(469.95813, 184.46841, 466.33954, 184.40637, 462.72238, 184.43457); ((GeneralPath)shape).curveTo(458.41397, 184.46817, 451.30048, 184.70119, 446.74426, 184.25377); ((GeneralPath)shape).curveTo(445.41086, 184.12283, 444.11685, 183.72746, 442.80316, 183.4643); ((GeneralPath)shape).curveTo(441.63797, 184.07849, 432.952, 167.60002, 434.11722, 166.98582); ((GeneralPath)shape).closePath(); g.setPaint(paint); g.fill(shape); g.setTransform(defaultTransform__0_0_8); g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); AffineTransform defaultTransform__0_0_9 = g.getTransform(); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_0_9 paint = new Color(0, 255, 0, 255); shape = new GeneralPath(); ((GeneralPath)shape).moveTo(141.86844, 322.17365); ((GeneralPath)shape).curveTo(136.42625, 327.22177, 130.4102, 331.6339, 124.82316, 336.53137); ((GeneralPath)shape).curveTo(122.49025, 338.39383, 121.08002, 339.1132, 120.05035, 341.91095); ((GeneralPath)shape).curveTo(118.226746, 345.8601, 116.07915, 349.6569, 114.00657, 353.48306); ((GeneralPath)shape).curveTo(112.11969, 356.11172, 111.95858, 358.90732, 111.86779, 362.02075); ((GeneralPath)shape).curveTo(111.48915, 366.82434, 110.93348, 371.61533, 110.93778, 376.43848); ((GeneralPath)shape).curveTo(111.112526, 379.06876, 110.54553, 381.71783, 110.62744, 384.342); ((GeneralPath)shape).curveTo(110.636444, 384.63416, 110.61744, 383.7426, 110.72434, 383.47052); ((GeneralPath)shape).curveTo(110.75344, 383.39642, 110.88311, 383.48212, 110.962494, 383.4879); ((GeneralPath)shape).curveTo(112.641914, 386.68408, 114.437645, 389.81723, 116.31564, 392.91397); ((GeneralPath)shape).curveTo(117.35742, 394.13235, 118.070656, 396.51456, 119.84255, 396.98883); ((GeneralPath)shape).curveTo(120.05526, 397.04572, 120.28293, 396.98984, 120.503136, 396.99182); ((GeneralPath)shape).curveTo(121.11192, 397.25842, 121.72072, 397.52502, 122.329506, 397.79163); ((GeneralPath)shape).curveTo(123.05955, 398.194, 123.78959, 398.59637, 124.51962, 398.99875); ((GeneralPath)shape).curveTo(125.089615, 399.21042, 125.68376, 399.36584, 126.229576, 399.6338); ((GeneralPath)shape).curveTo(127.46519, 400.2403, 129.55539, 402.4614, 130.63838, 401.1925); ((GeneralPath)shape).curveTo(122.67217, 400.45773, 126.72402, 401.07373, 128.44244, 400.8992); ((GeneralPath)shape).curveTo(129.95132, 400.74594, 131.43198, 400.38116, 132.90672, 400.04626); ((GeneralPath)shape).curveTo(137.48445, 399.46417, 141.9393, 398.01312, 146.16452, 396.19464); ((GeneralPath)shape).curveTo(150.2348, 394.08163, 154.64822, 392.36035, 157.89899, 389.00992); ((GeneralPath)shape).curveTo(160.441, 385.16705, 163.32709, 381.66168, 166.65375, 378.47906); ((GeneralPath)shape).curveTo(168.32228, 377.40033, 168.71893, 375.64987, 169.21292, 373.65076); ((GeneralPath)shape).curveTo(170.2411, 370.10675, 171.18011, 366.55844, 172.05223, 362.97525); ((GeneralPath)shape).curveTo(172.30107, 359.4124, 171.96463, 355.8087, 171.93378, 352.22925); ((GeneralPath)shape).curveTo(171.75412, 349.9973, 172.23322, 347.7287, 172.0806, 345.50052); ((GeneralPath)shape).curveTo(172.065, 345.27255, 172.0392, 345.95563, 172.0185, 346.1832); ((GeneralPath)shape).curveTo(170.71956, 342.7287, 170.3819, 338.99896, 169.74074, 335.38025); ((GeneralPath)shape).curveTo(169.51654, 334.6687, 169.11694, 333.56754, 168.53825, 333.0214); ((GeneralPath)shape).curveTo(168.44565, 332.934, 168.66353, 333.34903, 168.54836, 333.40326); ((GeneralPath)shape).curveTo(167.88124, 333.71732, 168.50716, 332.46475, 168.09143, 333.5113); ((GeneralPath)shape).curveTo(167.68622, 333.2283, 167.2983, 332.91876, 166.87576, 332.66235); ((GeneralPath)shape).curveTo(166.48436, 332.42487, 166.02878, 332.29727, 165.65503, 332.03287); ((GeneralPath)shape).curveTo(163.34132, 330.39606, 161.87614, 328.0274, 160.17114, 325.82922); ((GeneralPath)shape).curveTo(159.51088, 324.73965, 158.84116, 323.4155, 157.919, 322.48126); ((GeneralPath)shape).curveTo(157.8204, 322.38135, 157.63005, 322.41986, 157.52902, 322.32242); ((GeneralPath)shape).curveTo(157.17442, 321.98035, 156.99785, 321.45007, 156.57979, 321.18936); ((GeneralPath)shape).curveTo(156.43103, 321.09656, 156.56299, 321.5396, 156.55458, 321.71472); ((GeneralPath)shape).curveTo(156.58678, 321.9217, 156.85577, 322.29074, 156.65118, 322.33563); ((GeneralPath)shape).curveTo(156.05368, 322.4667, 154.13829, 320.85352, 153.69313, 320.5829); ((GeneralPath)shape).curveTo(152.9163, 320.1106, 151.6316, 319.5863, 150.74232, 319.2727); ((GeneralPath)shape).curveTo(149.70415, 319.77124, 150.42479, 319.5453, 148.53937, 319.2767); ((GeneralPath)shape).curveTo(147.43196, 319.1188, 146.29395, 319.1384, 145.20854, 318.8679); ((GeneralPath)shape).curveTo(144.27106, 318.63425, 142.44156, 317.84924, 141.46715, 317.44736); ((GeneralPath)shape).curveTo(141.13454, 317.3217, 140.82083, 317.1238, 140.46933, 317.07034); ((GeneralPath)shape).curveTo(140.15257, 317.02225, 139.263, 317.3915, 139.58032, 317.4357); ((GeneralPath)shape).curveTo(142.4885, 317.84048, 144.94208, 317.59103, 141.97119, 317.72787); ((GeneralPath)shape).curveTo(141.46436, 317.75116, 140.95796, 317.78348, 140.45134, 317.81128); ((GeneralPath)shape).curveTo(140.08607, 317.71658, 135.57462, 318.43152, 135.44955, 318.31625); ((GeneralPath)shape).curveTo(135.43056, 318.29877, 136.0205, 317.52737, 136.03477, 317.50845); ((GeneralPath)shape).curveTo(135.3472, 320.11856, 134.02858, 323.19662, 132.92337, 325.81363); ((GeneralPath)shape).curveTo(132.35493, 327.12643, 113.78927, 319.08765, 114.3577, 317.77487); ((GeneralPath)shape).lineTo(114.3577, 317.77487); ((GeneralPath)shape).curveTo(116.69521, 314.3839, 118.53268, 310.7259, 120.61778, 307.17432); ((GeneralPath)shape).curveTo(121.34874, 306.29773, 121.9913, 305.33914, 122.81065, 304.54456); ((GeneralPath)shape).curveTo(125.99263, 301.45874, 130.42595, 300.06238, 134.78311, 299.9767); ((GeneralPath)shape).curveTo(139.95708, 299.57565, 145.20476, 299.4732, 150.17606, 301.13226); ((GeneralPath)shape).curveTo(154.17131, 301.59216, 158.0996, 302.314, 161.64891, 304.37448); ((GeneralPath)shape).curveTo(162.82214, 305.03638, 164.18938, 306.0104, 165.42712, 306.54532); ((GeneralPath)shape).curveTo(165.49292, 306.57373, 165.38443, 306.31558, 165.45422, 306.33203); ((GeneralPath)shape).curveTo(166.91144, 306.67508, 168.44794, 307.88528, 169.57669, 308.5984); ((GeneralPath)shape).curveTo(171.89745, 310.87396, 174.00931, 313.2252, 175.76044, 315.97116); ((GeneralPath)shape).curveTo(177.03215, 317.53278, 178.37451, 318.65967, 180.19273, 319.6532); ((GeneralPath)shape).curveTo(184.76819, 323.4752, 187.15099, 326.55612, 188.5316, 332.549); ((GeneralPath)shape).curveTo(189.16628, 336.02884, 189.42143, 339.5418, 189.9044, 343.03864); ((GeneralPath)shape).curveTo(190.25986, 345.80682, 190.47409, 348.5882, 190.92, 351.34738); ((GeneralPath)shape).curveTo(191.40442, 356.3338, 191.46347, 361.358, 190.44092, 366.29044); ((GeneralPath)shape).curveTo(189.67162, 370.30035, 189.21638, 374.4242, 187.41743, 378.14908); ((GeneralPath)shape).curveTo(185.93095, 382.5214, 184.61606, 387.0862, 181.34442, 390.5274); ((GeneralPath)shape).curveTo(178.79082, 392.85785, 176.14728, 395.0816, 174.56984, 398.23117); ((GeneralPath)shape).curveTo(173.17496, 400.49255, 172.67377, 401.54105, 170.90546, 403.50543); ((GeneralPath)shape).curveTo(167.14534, 407.68243, 162.40979, 410.6239, 157.3976, 413.0819); ((GeneralPath)shape).curveTo(151.78574, 415.42612, 145.6228, 417.54248, 139.4526, 417.37054); ((GeneralPath)shape).curveTo(135.12065, 417.10565, 128.10768, 421.60144, 123.994606, 418.68463); ((GeneralPath)shape).curveTo(119.319016, 417.32745, 114.82893, 415.3778, 110.65124, 412.864); ((GeneralPath)shape).curveTo(105.621956, 409.79263, 101.299774, 406.09933, 98.71873, 400.66205); ((GeneralPath)shape).curveTo(97.22015, 397.56302, 96.04709, 394.28055, 94.17621, 391.38022); ((GeneralPath)shape).curveTo(93.770706, 390.54532, 93.26438, 389.75223, 92.95971, 388.8755); ((GeneralPath)shape).curveTo(91.513626, 384.71417, 91.39266, 380.20425, 91.38012, 375.85495); ((GeneralPath)shape).curveTo(91.687416, 371.14862, 92.06785, 366.4656, 93.05581, 361.84406); ((GeneralPath)shape).curveTo(93.04051, 355.73267, 93.18854, 350.6641, 96.44412, 345.17676); ((GeneralPath)shape).curveTo(97.7153, 343.12936, 99.01261, 341.12848, 100.4041, 339.16284); ((GeneralPath)shape).curveTo(101.00085, 338.31985, 101.42102, 337.33737, 102.141266, 336.5971); ((GeneralPath)shape).curveTo(102.20976, 336.5267, 102.337006, 336.6134, 102.434875, 336.6216); ((GeneralPath)shape).curveTo(103.99184, 332.3041, 105.61343, 327.9116, 108.49725, 324.27982); ((GeneralPath)shape).curveTo(109.50002, 323.1047, 110.44158, 321.87445, 111.50558, 320.75446); ((GeneralPath)shape).curveTo(116.91942, 315.05563, 123.58784, 310.42953, 130.78714, 307.3158); ((GeneralPath)shape).curveTo(131.83781, 306.53223, 142.91917, 321.39108, 141.8685, 322.17465); ((GeneralPath)shape).closePath(); g.setPaint(paint); g.fill(shape); g.setTransform(defaultTransform__0_0_9); g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); AffineTransform defaultTransform__0_0_10 = g.getTransform(); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_0_10 paint = new Color(0, 255, 0, 255); shape = new GeneralPath(); ((GeneralPath)shape).moveTo(215.43166, 311.86865); ((GeneralPath)shape).curveTo(223.29904, 324.11038, 229.1232, 337.47385, 234.8829, 350.78952); ((GeneralPath)shape).curveTo(240.21887, 364.03506, 247.68683, 376.3904, 251.71555, 390.1534); ((GeneralPath)shape).curveTo(251.9333, 391.00937, 252.15106, 391.86536, 252.36882, 392.7213); ((GeneralPath)shape).curveTo(252.30151, 392.8524, 252.28172, 393.207, 252.16702, 393.11453); ((GeneralPath)shape).curveTo(251.49216, 392.57047, 251.17572, 390.706, 250.44229, 391.16812); ((GeneralPath)shape).curveTo(220.65436, 409.93735, 234.7874, 397.74188, 238.79803, 404.548); ((GeneralPath)shape).curveTo(239.10652, 405.0715, 237.8011, 403.85303, 237.30263, 403.50552); ((GeneralPath)shape).curveTo(236.17079, 401.52097, 234.58952, 399.7322, 233.90714, 397.55185); ((GeneralPath)shape).curveTo(232.98308, 394.59933, 234.85945, 388.98724, 235.67885, 386.1161); ((GeneralPath)shape).curveTo(237.65541, 379.19025, 236.66605, 382.40344, 239.42323, 374.59042); ((GeneralPath)shape).curveTo(244.05365, 362.30402, 248.83698, 350.0474, 254.39568, 338.1444); ((GeneralPath)shape).curveTo(258.36578, 329.64316, 259.80063, 327.1963, 264.1548, 319.01202); ((GeneralPath)shape).curveTo(268.71173, 311.21283, 273.0461, 303.2817, 279.02036, 296.46426); ((GeneralPath)shape).curveTo(279.5984, 295.15857, 298.0637, 303.33304, 297.48566, 304.63873); ((GeneralPath)shape).lineTo(297.48566, 304.63873); ((GeneralPath)shape).curveTo(295.1341, 313.07706, 291.01556, 320.82175, 287.30923, 328.72614); ((GeneralPath)shape).curveTo(278.4962, 346.68884, 270.35507, 365.0, 260.507, 382.43463); ((GeneralPath)shape).curveTo(258.04153, 386.80655, 255.70021, 391.28165, 252.9512, 395.48615); ((GeneralPath)shape).curveTo(252.64737, 395.95084, 252.50182, 397.09262, 252.00058, 396.85385); ((GeneralPath)shape).curveTo(249.49792, 395.6617, 255.61864, 387.15265, 248.14404, 389.48587); ((GeneralPath)shape).curveTo(247.85161, 389.2468, 246.9486, 388.56506, 247.26674, 388.76868); ((GeneralPath)shape).curveTo(248.31859, 389.44183, 251.03027, 389.85037, 250.34966, 390.89743); ((GeneralPath)shape).curveTo(247.134, 395.84418, 242.59117, 399.94373, 237.78125, 403.36066); ((GeneralPath)shape).curveTo(237.60542, 403.48557, 233.49438, 398.57733, 233.11092, 398.13058); ((GeneralPath)shape).curveTo(229.54884, 393.60843, 226.8266, 388.8631, 224.00613, 383.84448); ((GeneralPath)shape).curveTo(219.41179, 375.6695, 214.8627, 367.46353, 211.40448, 358.71912); ((GeneralPath)shape).curveTo(206.39752, 345.6925, 200.75359, 332.71667, 198.28375, 318.90665); ((GeneralPath)shape).curveTo(197.78609, 317.69412, 214.93396, 310.65613, 215.43163, 311.86868); ((GeneralPath)shape).closePath(); g.setPaint(paint); g.fill(shape); g.setTransform(defaultTransform__0_0_10); g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); AffineTransform defaultTransform__0_0_11 = g.getTransform(); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_0_11 paint = new Color(0, 255, 0, 255); shape = new GeneralPath(); ((GeneralPath)shape).moveTo(335.16336, 307.90402); ((GeneralPath)shape).curveTo(337.01254, 318.44678, 337.20633, 329.22592, 337.45206, 339.90414); ((GeneralPath)shape).curveTo(337.35696, 350.4928, 337.92908, 361.09888, 337.54486, 371.68518); ((GeneralPath)shape).curveTo(337.3809, 376.20255, 336.85144, 382.5205, 336.50085, 387.0751); ((GeneralPath)shape).curveTo(335.91635, 393.45105, 334.85992, 399.7961, 332.6827, 405.8273); ((GeneralPath)shape).curveTo(332.51736, 407.1813, 313.36914, 404.84317, 313.53445, 403.48917); ((GeneralPath)shape).lineTo(313.53445, 403.48917); ((GeneralPath)shape).curveTo(313.03378, 397.71545, 313.40823, 391.9122, 313.59305, 386.13046); ((GeneralPath)shape).curveTo(313.91318, 370.71902, 314.5521, 355.32022, 314.45218, 339.9041); ((GeneralPath)shape).curveTo(314.69788, 329.2259, 314.8917, 318.44675, 316.74088, 307.904); ((GeneralPath)shape).curveTo(316.74088, 306.60132, 335.16345, 306.60132, 335.16345, 307.904); ((GeneralPath)shape).closePath(); g.setPaint(paint); g.fill(shape); g.setTransform(defaultTransform__0_0_11); g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); AffineTransform defaultTransform__0_0_12 = g.getTransform(); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_0_12 paint = new Color(0, 255, 0, 255); shape = new GeneralPath(); ((GeneralPath)shape).moveTo(321.21948, 303.63376); ((GeneralPath)shape).curveTo(323.36368, 302.96017, 325.45633, 302.09256, 327.6521, 301.61304); ((GeneralPath)shape).curveTo(337.743, 299.40927, 350.23065, 298.94775, 359.92853, 298.3108); ((GeneralPath)shape).curveTo(366.11133, 297.90472, 372.30316, 297.64978, 378.48914, 297.2948); ((GeneralPath)shape).curveTo(382.2971, 297.0763, 386.0964, 296.65475, 389.91006, 296.59033); ((GeneralPath)shape).curveTo(395.82764, 296.49033, 401.74606, 296.7314, 407.66406, 296.80197); ((GeneralPath)shape).curveTo(409.75592, 296.21527, 418.05313, 325.79877, 415.96127, 326.38544); ((GeneralPath)shape).lineTo(415.96127, 326.38544); ((GeneralPath)shape).curveTo(410.0412, 326.76773, 404.1322, 327.41083, 398.20102, 327.5323); ((GeneralPath)shape).curveTo(384.8588, 327.8055, 366.69763, 327.621, 352.78296, 326.04465); ((GeneralPath)shape).curveTo(350.04062, 325.73398, 347.39667, 324.8223, 344.6728, 324.378); ((GeneralPath)shape).curveTo(321.8238, 320.65115, 344.0092, 325.02286, 327.49036, 321.64438); ((GeneralPath)shape).curveTo(326.21683, 322.0878, 319.94595, 304.07718, 321.21948, 303.63376); ((GeneralPath)shape).closePath(); g.setPaint(paint); g.fill(shape); g.setTransform(defaultTransform__0_0_12); g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); AffineTransform defaultTransform__0_0_13 = g.getTransform(); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_0_13 paint = new Color(0, 255, 0, 255); shape = new GeneralPath(); ((GeneralPath)shape).moveTo(319.29544, 347.3534); ((GeneralPath)shape).curveTo(336.07376, 343.65997, 353.03217, 340.63016, 370.07584, 338.4415); ((GeneralPath)shape).curveTo(375.50156, 337.74475, 380.95108, 337.24765, 386.3887, 336.65073); ((GeneralPath)shape).curveTo(391.30353, 336.37802, 396.21835, 336.10532, 401.13315, 335.8326); ((GeneralPath)shape).curveTo(403.02496, 335.1678, 412.427, 361.92206, 410.5352, 362.58688); ((GeneralPath)shape).lineTo(410.5352, 362.58688); ((GeneralPath)shape).curveTo(405.77267, 363.31558, 401.0102, 364.04428, 396.24768, 364.77298); ((GeneralPath)shape).curveTo(390.7262, 365.30017, 385.216, 365.96307, 379.68323, 366.35455); ((GeneralPath)shape).curveTo(371.47723, 366.93515, 357.49228, 367.3354, 349.00714, 367.38522); ((GeneralPath)shape).curveTo(342.085, 367.42593, 335.57028, 367.39792, 328.72067, 366.58704); ((GeneralPath)shape).curveTo(327.12717, 366.39838, 325.57114, 365.97067, 323.99637, 365.6625); ((GeneralPath)shape).curveTo(322.70172, 365.9949, 318.00073, 347.68582, 319.29538, 347.3534); ((GeneralPath)shape).closePath(); g.setPaint(paint); g.fill(shape); g.setTransform(defaultTransform__0_0_13); g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); AffineTransform defaultTransform__0_0_14 = g.getTransform(); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_0_14 paint = new Color(0, 255, 0, 255); shape = new GeneralPath(); ((GeneralPath)shape).moveTo(459.89017, 306.65674); ((GeneralPath)shape).curveTo(462.4691, 320.0969, 462.3177, 333.89587, 462.07266, 347.51877); ((GeneralPath)shape).curveTo(461.24658, 357.7241, 460.41144, 367.9565, 458.7803, 378.07324); ((GeneralPath)shape).curveTo(457.91742, 383.42496, 456.83862, 388.5627, 454.81784, 393.5827); ((GeneralPath)shape).curveTo(450.32245, 399.21295, 453.33417, 395.98077, 436.07584, 395.73962); ((GeneralPath)shape).curveTo(435.6057, 395.73264, 435.3805, 394.01468, 435.66205, 394.3912); ((GeneralPath)shape).curveTo(436.8603, 395.99362, 437.79675, 397.77603, 438.8641, 399.46844); ((GeneralPath)shape).curveTo(437.80954, 398.76416, 447.76956, 383.85025, 448.82413, 384.55453); ((GeneralPath)shape).lineTo(448.82413, 384.55453); ((GeneralPath)shape).curveTo(450.27954, 386.4118, 451.75275, 388.25525, 453.1903, 390.12637); ((GeneralPath)shape).curveTo(456.592, 394.55408, 437.32025, 397.68518, 435.24768, 391.6448); ((GeneralPath)shape).curveTo(434.39478, 386.5648, 434.42206, 381.52353, 434.51868, 376.37158); ((GeneralPath)shape).curveTo(434.70944, 366.19897, 435.49707, 356.06244, 436.61685, 345.95114); ((GeneralPath)shape).curveTo(438.359, 332.86673, 439.41092, 319.6902, 441.4676, 306.65668); ((GeneralPath)shape).curveTo(441.4676, 305.354, 459.89014, 305.354, 459.89014, 306.65668); ((GeneralPath)shape).closePath(); g.setPaint(paint); g.fill(shape); g.setTransform(defaultTransform__0_0_14); g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); AffineTransform defaultTransform__0_0_15 = g.getTransform(); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_0_15 paint = new Color(0, 255, 0, 255); shape = new GeneralPath(); ((GeneralPath)shape).moveTo(436.99408, 295.72522); ((GeneralPath)shape).curveTo(447.24536, 289.23563, 459.37845, 287.1306, 471.25128, 285.94492); ((GeneralPath)shape).curveTo(479.46506, 285.44794, 481.75522, 285.07486, 491.22504, 285.99872); ((GeneralPath)shape).curveTo(493.74734, 286.24478, 496.3225, 286.56143, 498.67993, 287.4916); ((GeneralPath)shape).curveTo(504.78094, 289.899, 508.75757, 294.90976, 513.1051, 299.48187); ((GeneralPath)shape).curveTo(514.6598, 301.75504, 516.5833, 304.0235, 517.50366, 306.684); ((GeneralPath)shape).curveTo(517.7518, 307.40125, 518.6882, 308.34418, 518.14075, 308.8699); ((GeneralPath)shape).curveTo(503.40512, 323.02145, 505.55298, 313.65283, 504.21356, 319.69742); ((GeneralPath)shape).curveTo(508.95758, 320.17017, 510.28656, 321.53763, 513.68036, 317.95084); ((GeneralPath)shape).curveTo(514.6083, 316.97015, 515.01874, 315.60498, 515.64404, 314.40842); ((GeneralPath)shape).curveTo(515.7853, 314.13812, 515.8389, 313.28412, 515.97687, 313.55612); ((GeneralPath)shape).curveTo(516.50244, 314.59265, 516.13293, 317.69357, 516.0845, 318.51385); ((GeneralPath)shape).curveTo(514.33307, 327.07285, 510.1068, 330.64563, 502.86554, 334.82538); ((GeneralPath)shape).curveTo(498.08395, 337.22534, 493.20615, 339.4357, 488.31952, 341.61423); ((GeneralPath)shape).curveTo(487.6099, 341.93817, 486.87756, 342.21643, 486.1906, 342.58606); ((GeneralPath)shape).curveTo(484.45908, 343.51773, 482.93912, 344.79892, 481.28262, 345.85828); ((GeneralPath)shape).curveTo(476.20108, 349.10803, 470.9486, 352.02628, 465.6444, 354.89084); ((GeneralPath)shape).curveTo(459.50534, 357.8032, 453.48773, 361.03354, 447.17596, 363.57358); ((GeneralPath)shape).curveTo(445.92102, 364.0786, 444.62582, 365.30722, 443.33817, 364.89276); ((GeneralPath)shape).curveTo(442.5653, 364.644, 444.15634, 363.43124, 444.21857, 362.6217); ((GeneralPath)shape).curveTo(444.52353, 358.6555, 444.35962, 354.66708, 444.43015, 350.68976); ((GeneralPath)shape).curveTo(446.99402, 350.32904, 449.53577, 349.7349, 452.12177, 349.60757); ((GeneralPath)shape).curveTo(460.9146, 349.17453, 471.50214, 350.10135, 480.04315, 351.19675); ((GeneralPath)shape).curveTo(490.9572, 352.59653, 505.33325, 355.24887, 515.9501, 357.92355); ((GeneralPath)shape).curveTo(521.91956, 359.42743, 527.77344, 361.3576, 533.6851, 363.07465); ((GeneralPath)shape).curveTo(545.9106, 367.83844, 558.84546, 372.13657, 569.3544, 380.32187); ((GeneralPath)shape).curveTo(570.9123, 381.5353, 572.2394, 383.03253, 573.50854, 384.54538); ((GeneralPath)shape).curveTo(573.6933, 384.7656, 573.7931, 385.17508, 573.6155, 385.40112); ((GeneralPath)shape).curveTo(569.80743, 390.24863, 565.6823, 394.8384, 561.7157, 399.55707); ((GeneralPath)shape).curveTo(558.7487, 399.40924, 556.46, 398.11398, 553.9514, 396.66724); ((GeneralPath)shape).curveTo(552.8482, 395.80878, 564.98883, 380.2066, 566.09204, 381.0651); ((GeneralPath)shape).lineTo(566.09204, 381.0651); ((GeneralPath)shape).curveTo(569.0352, 382.46146, 572.0221, 383.82236, 574.16656, 386.38763); ((GeneralPath)shape).curveTo(570.68677, 391.44104, 567.9716, 397.11728, 563.7271, 401.54788); ((GeneralPath)shape).curveTo(562.8906, 402.42102, 561.3321, 401.21243, 560.13635, 401.03305); ((GeneralPath)shape).curveTo(558.5879, 400.80078, 557.02356, 400.65012, 555.4945, 400.31293); ((GeneralPath)shape).curveTo(543.3365, 397.6319, 531.5526, 393.43884, 519.4745, 390.45572); ((GeneralPath)shape).curveTo(502.77148, 386.04773, 486.0332, 381.85037, 469.23306, 377.82745); ((GeneralPath)shape).curveTo(464.55756, 376.7079, 459.87903, 375.60083, 455.1987, 374.50146); ((GeneralPath)shape).curveTo(451.32825, 373.59235, 447.3937, 372.92838, 443.58078, 371.8021); ((GeneralPath)shape).curveTo(440.48154, 370.8866, 437.53128, 369.52682, 434.50653, 368.3892); ((GeneralPath)shape).curveTo(432.17017, 363.6432, 428.64328, 359.3155, 427.4975, 354.15115); ((GeneralPath)shape).curveTo(427.07547, 352.24887, 429.0079, 350.50974, 430.1974, 348.9664); ((GeneralPath)shape).curveTo(431.13632, 347.74817, 432.48883, 346.9008, 433.75668, 346.03003); ((GeneralPath)shape).curveTo(439.55453, 342.0481, 446.12268, 339.25793, 452.47797, 336.33563); ((GeneralPath)shape).curveTo(473.44202, 328.10062, 446.0529, 338.84317, 464.60724, 331.61304); ((GeneralPath)shape).curveTo(467.0587, 330.65778, 469.5862, 329.87476, 471.95358, 328.72687); ((GeneralPath)shape).curveTo(473.06982, 328.18564, 474.1016, 327.48523, 475.1756, 326.8644); ((GeneralPath)shape).curveTo(475.87482, 326.545, 476.574, 326.22565, 477.27322, 325.90625); ((GeneralPath)shape).curveTo(480.38046, 324.4339, 483.3884, 322.73407, 486.53342, 321.34436); ((GeneralPath)shape).curveTo(487.16324, 321.06607, 487.83597, 320.8898, 488.459, 320.5967); ((GeneralPath)shape).curveTo(489.3072, 320.19772, 490.11252, 319.7134, 490.93927, 319.27176); ((GeneralPath)shape).curveTo(492.97504, 318.354, 495.1608, 317.3552, 497.34445, 317.0313); ((GeneralPath)shape).curveTo(497.78043, 315.27194, 497.26175, 313.2563, 497.7273, 311.57275); ((GeneralPath)shape).curveTo(498.71204, 308.01147, 500.46375, 303.9389, 504.6658, 302.98624); ((GeneralPath)shape).curveTo(507.15668, 302.4215, 509.7642, 303.30252, 512.31335, 303.46063); ((GeneralPath)shape).curveTo(519.2011, 306.5908, 513.4077, 303.3332, 501.50317, 315.28195); ((GeneralPath)shape).curveTo(501.19498, 315.59128, 502.15802, 316.5606, 501.72156, 316.57358); ((GeneralPath)shape).curveTo(501.20367, 316.589, 497.5252, 312.37668, 496.9326, 312.0462); ((GeneralPath)shape).curveTo(495.5937, 310.7976, 494.393, 309.30133, 492.6033, 308.65906); ((GeneralPath)shape).curveTo(491.785, 308.3654, 490.9127, 308.24515, 490.05472, 308.10452); ((GeneralPath)shape).curveTo(483.9473, 307.10355, 484.75037, 307.0684, 478.34238, 306.95654); ((GeneralPath)shape).curveTo(472.44025, 307.39832, 466.56314, 307.99533, 460.72394, 308.9968); ((GeneralPath)shape).curveTo(457.31088, 309.58215, 454.18234, 310.422, 450.76736, 310.91785); ((GeneralPath)shape).curveTo(449.65494, 311.07938, 448.52902, 311.1282, 447.40985, 311.23337); ((GeneralPath)shape).curveTo(446.31326, 311.96988, 435.89743, 296.46176, 436.99402, 295.72525); ((GeneralPath)shape).closePath(); g.setPaint(paint); g.fill(shape); g.setTransform(defaultTransform__0_0_15); g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); AffineTransform defaultTransform__0_0_16 = g.getTransform(); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_0_16 paint = new Color(0, 255, 0, 255); shape = new GeneralPath(); ((GeneralPath)shape).moveTo(324.40173, 389.9114); ((GeneralPath)shape).curveTo(331.8197, 387.564, 339.5731, 386.7645, 347.3111, 386.48514); ((GeneralPath)shape).curveTo(351.06985, 386.76825, 354.9985, 385.9524, 358.54544, 387.48697); ((GeneralPath)shape).curveTo(360.1179, 388.1673, 361.35797, 389.3945, 361.07248, 388.69284); ((GeneralPath)shape).curveTo(359.38382, 387.90237, 362.49823, 387.64563, 362.46875, 387.64246); ((GeneralPath)shape).curveTo(361.4073, 387.52805, 360.32565, 387.72546, 359.26627, 387.59305); ((GeneralPath)shape).curveTo(358.68073, 387.51996, 360.4427, 387.49716, 361.0318, 387.4629); ((GeneralPath)shape).curveTo(361.67007, 387.42578, 362.30927, 387.40698, 362.94797, 387.3791); ((GeneralPath)shape).curveTo(367.52042, 387.39767, 372.1165, 387.2949, 376.6823, 387.54962); ((GeneralPath)shape).curveTo(378.54166, 387.59613, 389.05618, 387.26736, 380.01172, 387.32745); ((GeneralPath)shape).curveTo(382.7315, 387.0967, 385.45007, 386.65637, 388.0909, 385.96262); ((GeneralPath)shape).curveTo(392.9411, 384.52127, 397.9475, 384.30927, 402.9731, 384.93835); ((GeneralPath)shape).curveTo(405.13934, 385.31458, 407.32608, 385.08597, 409.50787, 385.03296); ((GeneralPath)shape).curveTo(410.7814, 385.3748, 405.9469, 403.38516, 404.6734, 403.0433); ((GeneralPath)shape).lineTo(404.6734, 403.0433); ((GeneralPath)shape).curveTo(402.20038, 402.93433, 399.76498, 402.58948, 397.29868, 402.4137); ((GeneralPath)shape).curveTo(396.98645, 402.4157, 396.0497, 402.4187, 396.36197, 402.4187); ((GeneralPath)shape).curveTo(397.61942, 402.4197, 398.8778, 402.465, 400.13428, 402.4157); ((GeneralPath)shape).curveTo(400.38803, 402.4057, 399.63385, 402.3268, 399.38132, 402.3001); ((GeneralPath)shape).curveTo(398.38593, 402.19507, 397.4036, 402.29712, 396.4317, 402.53326); ((GeneralPath)shape).curveTo(393.09006, 403.40445, 389.7583, 404.29105, 386.4033, 405.11673); ((GeneralPath)shape).curveTo(383.91144, 405.26788, 381.42218, 405.47125, 378.92773, 405.5702); ((GeneralPath)shape).curveTo(376.60196, 405.66238, 374.29254, 405.01746, 371.96216, 405.21158); ((GeneralPath)shape).curveTo(369.29062, 405.30807, 372.08517, 405.1894, 374.35504, 405.2989); ((GeneralPath)shape).curveTo(374.7775, 405.31927, 373.50992, 405.3347, 373.08746, 405.3548); ((GeneralPath)shape).curveTo(371.42175, 405.4342, 369.75687, 405.535, 368.0894, 405.5733); ((GeneralPath)shape).curveTo(363.29367, 405.6398, 368.9582, 405.5803, 364.20386, 405.5713); ((GeneralPath)shape).curveTo(359.96838, 405.5633, 356.1825, 406.02573, 352.31827, 404.2266); ((GeneralPath)shape).curveTo(351.97794, 404.06082, 351.65875, 403.84174, 351.2973, 403.72925); ((GeneralPath)shape).curveTo(350.61594, 403.5172, 351.7299, 404.02728, 351.85715, 404.38922); ((GeneralPath)shape).curveTo(351.89954, 404.50983, 351.5706, 404.71854, 351.69702, 404.7378); ((GeneralPath)shape).curveTo(354.5694, 405.1758, 357.37576, 404.65378, 353.6186, 405.19308); ((GeneralPath)shape).curveTo(346.11948, 406.34283, 338.56122, 408.12112, 330.93396, 407.48914); ((GeneralPath)shape).curveTo(329.69098, 407.95102, 323.15887, 390.37265, 324.40182, 389.91077); ((GeneralPath)shape).closePath(); g.setPaint(paint); g.fill(shape); g.setTransform(defaultTransform__0_0_16); g.setTransform(defaultTransform__0_0); g.setTransform(defaultTransform__0); g.setTransform(defaultTransform_); } /** * Returns the X of the bounding box of the original SVG image. * * @return The X of the bounding box of the original SVG image. */ public int getOrigX() { return Math.round(53 * scaleFactor); } /** * Returns the Y of the bounding box of the original SVG image. * * @return The Y of the bounding box of the original SVG image. */ public int getOrigY() { return Math.round(33 * scaleFactor); } /** * Returns the width of the bounding box of the original SVG image. * * @return The width of the bounding box of the original SVG image. */ public int getOrigWidth() { return Math.round(542 * scaleFactor); } /** * Returns the height of the bounding box of the original SVG image. * * @return The height of the bounding box of the original SVG image. */ public int getOrigHeight() { return Math.round(542 * scaleFactor); } }
package hr.bosak_turk.planetdemo; import org.jsoup.Jsoup; public class StringHandling { public static String modifyDate(String date) { String day = date.substring(8, 10)+"."; String month = date.substring(5, 7); String year = date.substring(0, 4)+"."; //simpledateformat klasa ?? switch (month) { case "01": return day + "siječnja " + year; case "02": return day + "veljače " + year; case "03": return day + "ožujka " + year; case "04": return day + "travnja " + year; case "05": return day + "svibnja " + year; case "06": return day + "lipnja " + year; case "07": return day + "srpnja " + year; case "08": return day + "kolovoza " + year; case "09": return day + "rujna " + year; case "10": return day + "listopada " + year; case "11": return day + "studenog " + year; case "12": return day + "prosinca " + year; } return day + "/" + month + "./" + year; } public static String categoryHandling(String link) { String[] row = link.substring(18, link.length()).split("/"); if (row[0].substring(0, 3).equals("na-")) return "Na današnji dan"; else if (row[0].substring(0, 3).equals("ist")) return "Istraživanja"; String category = row[0].replace("-", " "); return category.substring(0, 1).toUpperCase() + category.substring(1); } public static String html2text(String html) { return Jsoup.parse(html).text(); } }
/* (c) 2011 Thomas Smits */ package de.smits_net.tpe.innere.basics.local; class A { void methode() { class B { } } }
package merchantsNotesTest; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import extras.MerchantsException; import function_support.RomanCalculator; class RomanCalculatorTest { @BeforeAll static void romanCalculator_setup() { RomanCalculator.initial(); } @Test void test_simple_1() { String testCase = "I"; int expectedResult = 1; int result = 0; try { result = RomanCalculator.convertRomanToDecimal(testCase); } catch (MerchantsException e) { // do nothing } assertEquals(result, expectedResult); } @Test void test_simple_2() { String testCase = "IV"; int expectedResult = 4; int result = 0; try { result = RomanCalculator.convertRomanToDecimal(testCase); } catch (MerchantsException e) { // do nothing } assertEquals(result, expectedResult); } @Test void test_simple_3() { String testCase = "L"; int expectedResult = 50; int result = 0; try { result = RomanCalculator.convertRomanToDecimal(testCase); } catch (MerchantsException e) { // do nothing } assertEquals(result, expectedResult); } @Test void test_complicated_1() { String testCase = "XXIII"; int expectedResult = 23; int result = 0; try { result = RomanCalculator.convertRomanToDecimal(testCase); } catch (MerchantsException e) { // do nothing } assertEquals(result, expectedResult); } @Test void test_complicated_2() { String testCase = "XLII"; int expectedResult = 42; int result = 0; try { result = RomanCalculator.convertRomanToDecimal(testCase); } catch (MerchantsException e) { // do nothing } assertEquals(result, expectedResult); } @Test void test_complicated_3() { String testCase = "MMVI"; int expectedResult = 2006; int result = 0; try { result = RomanCalculator.convertRomanToDecimal(testCase); } catch (MerchantsException e) { // do nothing } assertEquals(result, expectedResult); } @Test void test_complicated_4() { String testCase = "MCMXLIV"; int expectedResult = 1944; int result = 0; try { result = RomanCalculator.convertRomanToDecimal(testCase); } catch (MerchantsException e) { // do nothing } assertEquals(result, expectedResult); } @Test void test_long_roman_number_1() { String testCase = "MDCCCLXXXVIII"; int expectedResult = 1888; int result = 0; try { result = RomanCalculator.convertRomanToDecimal(testCase); } catch (MerchantsException e) { // do nothing } assertEquals(result, expectedResult); } @Test void test_long_roman_number_2() { String testCase = "MMMDCCCLXXXVIII"; int expectedResult = 3888; int result = 0; try { result = RomanCalculator.convertRomanToDecimal(testCase); } catch (MerchantsException e) { // do nothing } assertEquals(result, expectedResult); } @Test void test_largest_roman_number() { String testCase = "MMMCMXCIX"; int expectedResult = 3999; int result = 0; try { result = RomanCalculator.convertRomanToDecimal(testCase); } catch (MerchantsException e) { // do nothing } assertEquals(result, expectedResult); } @Test void test_invalid_roman_repetitions_1() { String testCase = "XXXX"; assertThrows(MerchantsException.class, () -> RomanCalculator.convertRomanToDecimal(testCase)); } @Test void test_invalid_roman_repetitions_2() { String testCase = "MMMCCCC"; assertThrows(MerchantsException.class, () -> RomanCalculator.convertRomanToDecimal(testCase)); } @Test void test_invalid_roman_repetitions_3() { String testCase = "VV"; assertThrows(MerchantsException.class, () -> RomanCalculator.convertRomanToDecimal(testCase)); } @Test void test_invalid_roman_repetitions_4() { String testCase = "MMMDDXXX"; assertThrows(MerchantsException.class, () -> RomanCalculator.convertRomanToDecimal(testCase)); } @Test void test_valid_roman_repetitions_1() { String testCase = "XXXIX"; int expectedResult = 39; int result = 0; try { result = RomanCalculator.convertRomanToDecimal(testCase); } catch (MerchantsException e) { // do nothing } assertEquals(result, expectedResult); } @Test void test_invalid_roman_subtraction_1() { String testCase = "VL"; assertThrows(MerchantsException.class, () -> RomanCalculator.convertRomanToDecimal(testCase)); } @Test void test_invalid_roman_subtraction_2() { String testCase = "IM"; assertThrows(MerchantsException.class, () -> RomanCalculator.convertRomanToDecimal(testCase)); } @Test void test_invalid_roman_subtraction_3() { String testCase = "DM"; assertThrows(MerchantsException.class, () -> RomanCalculator.convertRomanToDecimal(testCase)); } }
package kr.ac.inha.cse.pl; public class Expression_01 { static int a = 1; public static int f() { a = 2; return 5; } public static void main(String[] args) { System.out.println(a + f()); System.out.println(a); // int a = 1, i = 7; // String k; // k = (i%2!=0) ? "홀수" : "짝수"; // 삼항 // System.out.println(k); // System.out.println(a + 2); // 이항, LISP (+ a 2) // System.out.println(++a); // 단항 // 3 * 2 + 1 // add(1, multiply(3, 2)) // int a = 1, b = 2, c = 3; // System.out.println(a - b + c); // APL : 우결합, 우선순위 동등 // Ada : a ** b ** c, 지수 연산자는 결합 규칙을 갖지 않아 컴파일 오류 발생 // (a ** b) ** c, 괄호로 해결 } }
package designpatterns.reactor.demo2.three; import java.io.IOException; import java.net.InetSocketAddress; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; import java.util.Iterator; import java.util.Set; class Reactor implements Runnable { final Selector selector; final ServerSocketChannel serverSocket; Reactor(int port) throws IOException { //Reactor初始化 selector = Selector.open(); serverSocket = ServerSocketChannel.open(); serverSocket.socket().bind(new InetSocketAddress(port)); serverSocket.configureBlocking(false); //非阻塞 SelectionKey sk = serverSocket.register(selector, SelectionKey.OP_ACCEPT); //分步处理,第一步,接收accept事件 sk.attach(new Acceptor()); //attach callback object, Acceptor } public void run() { try { while (!Thread.interrupted()) { selector.select(); Set selected = selector.selectedKeys(); Iterator it = selected.iterator(); while (it.hasNext()) dispatch((SelectionKey)(it.next())); //Reactor负责dispatch收到的事件 selected.clear(); } } catch (IOException ex) { /* ... */ } } void dispatch(SelectionKey k) { Runnable r = (Runnable)(k.attachment()); //调用之前注册的callback对象 if (r != null) r.run(); } class Acceptor implements Runnable { // inner public void run() { try { SocketChannel c = serverSocket.accept(); if (c != null) { // new Handler(selector, c); } } catch(IOException ex) { /* ... */ } } } } //class Handler implements Runnable { // // uses util.concurrent thread pool // static PooledExecutor pool = new PooledExecutor(...); // static final int PROCESSING = 3; // // ... // synchronized void read() { // ... // socket.read(input); // if (inputIsComplete()) { // state = PROCESSING; // pool.execute(new Processer()); //使用线程pool异步执行 // } // } // // synchronized void processAndHandOff() { // process(); // state = SENDING; // or rebind attachment // sk.interest(SelectionKey.OP_WRITE); //process完,开始等待write事件 // } // // class Processer implements Runnable { // public void run() { processAndHandOff(); } // } //}
package com.goldenasia.lottery.fragment; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.Toast; import com.goldenasia.lottery.R; import com.goldenasia.lottery.app.BaseFragment; import com.goldenasia.lottery.app.GoldenAsiaApp; import com.goldenasia.lottery.data.UserInfo; import com.goldenasia.lottery.material.ConstantInformation; import com.goldenasia.lottery.material.Register; import java.util.regex.Matcher; import java.util.regex.Pattern; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; /** * Created by ACE-PC on 2016/5/2. */ public class RegisterSetting extends BaseFragment { private static final String TAG = RegisterSetting.class.getSimpleName(); @BindView(R.id.reg_edituser) EditText regEdituser; @BindView(R.id.proxy) RadioButton proxy; @BindView(R.id.user) RadioButton user; @BindView(R.id.testuser) RadioButton testUser; @BindView(R.id.user_type) RadioGroup userType; @BindView(R.id.reg_editpass) EditText regEditpass; @BindView(R.id.reg_surepass) EditText regSurepass; @BindView(R.id.nickname) EditText nickname; private Register registerData; private UserInfo userInfo; @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflateView(inflater, container, true, "注册下级", R.layout.register_setting); ButterKnife.bind(this, view); return view; } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); userInfo = GoldenAsiaApp.getUserCentre().getUserInfo(); if (userInfo.getLevel() != 1) { testUser.setVisibility(View.GONE); } userType.setOnCheckedChangeListener((group, checkedId) -> { switch (group.getCheckedRadioButtonId()) { case R.id.proxy: registerData.setType(1); break; case R.id.user: registerData.setType(2); break; case R.id.testuser: registerData.setType(3); break; } }); } private void init() { registerData = new Register(); user.setChecked(true); //registerData.setType(1); userType.check(R.id.proxy); } @OnClick({R.id.rebates_settingbut}) public void onClick(View v) { switch (v.getId()) { case R.id.rebates_settingbut: if (verification()) { registerData.setUsername(regEdituser.getText().toString()); registerData.setNickname(nickname.getText().toString()); registerData.setPassword(regEditpass.getText().toString()); registerData.setPassword2(regSurepass.getText().toString()); Bundle bundle = new Bundle(); bundle.putSerializable("reg", registerData); bundle.putString("openType","manual"); launchFragmentForResult(LowerRebateSetting.class, bundle, 1); } break; } } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (resultCode) { case ConstantInformation.REFRESH_RESULT: getActivity().setResult(ConstantInformation.REFRESH_RESULT); getActivity().finish(); } } //判断字符串中是否含Emoji表情正则表达式 public boolean hasEmoji(String content){ //过滤Emoji表情 // Pattern p = Pattern.compile("[^\\u0000-\\uFFFF]"); //过滤Emoji表情和颜文字 // Pattern p = Pattern.compile("[\\ud83c\\udc00-\\ud83c\\udfff]|[\\ud83d\\udc00-\\ud83d\\udfff]|[\\u2600-\\u27ff]|[\\ud83e\\udd00-\\ud83e\\uddff]|[\\u2300-\\u23ff]|[\\u2500-\\u25ff]|[\\u2100-\\u21ff]|[\\u0000-\\u00ff]|[\\u2b00-\\u2bff]|[\\u2d06]|[\\u3030]"); //禁用emoji表情和颜文字 Pattern p = Pattern.compile("[^a-zA-Z0-9\\u4E00-\\u9FA5_,.?!:;…~_\\-\"\"/@*+'()<>{}/[/]()<>{}\\[\\]=%&$|\\/♀♂#¥£¢€\"^` ,。?!:;……~“”、“()”、(——)‘’@‘·’&*#《》¥《〈〉》〈$〉[]£[]{}{}¢【】【】%〖〗〖〗/〔〕〔〕\『』『』^「」「」|﹁﹂`.]"); //判断字符串中是否含Emoji表情正则表达式 // Pattern p = Pattern.compile("[\ud83c\udc00-\ud83c\udfff]|[\ud83d\udc00-\ud83d\udfff]|[\u2600-\u27ff]"); Matcher matcher = p.matcher(content); if(matcher .find()){ return true; } return false; } private boolean verification() { if (TextUtils.isEmpty(regEdituser.getText().toString())) { Toast.makeText(getContext(), "请输入用户名", Toast.LENGTH_LONG).show(); return false; } if (!(regEdituser.getText().toString().charAt(0) <= 'Z' && regEdituser.getText().toString().charAt(0) >= 'A' || regEdituser.getText().toString().charAt(0) <= 'z' && regEdituser.getText().toString().charAt(0) >= 'a')) { Toast.makeText(getContext(), "用户名必须以字母开头", Toast.LENGTH_LONG).show(); return false; } String userNameReg="^[A-Za-z0-9_]+$";//英文和数字 Pattern pAll= Pattern.compile(userNameReg); Matcher mAll = pAll.matcher(regEdituser.getText().toString()); if (!mAll.matches()) { Toast.makeText(getContext(), "用户名只能是字母或者数字或者下划线", Toast.LENGTH_LONG).show(); return false; } if(regEdituser.getText().toString().length()>16||regEdituser.getText().toString().length()<5){ Toast.makeText(getContext(), "用户名只能是长度为5-16位", Toast.LENGTH_LONG).show(); return false; } if (TextUtils.isEmpty(nickname.getText().toString())) { Toast.makeText(getContext(), "请输入昵称", Toast.LENGTH_LONG).show(); return false; } //// 清除掉所有特殊字符 // String regEx="[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]"; // Pattern p = Pattern.compile(regEx); // Matcher matcher = p.matcher(nickname.getText().toString()); // if(matcher .find()){ // showToast("昵称不能包含特殊字符", Toast.LENGTH_SHORT); // return false; // } if (hasEmoji(nickname.getText().toString())) { showToast("昵称不能包含Emoji表情", Toast.LENGTH_SHORT); return false; } if (TextUtils.isEmpty(regEditpass.getText().toString())) { Toast.makeText(getContext(), "请输入密码", Toast.LENGTH_LONG).show(); return false; } String regex = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$"; if (!regEditpass.getText().toString().matches(regex)) { Toast.makeText(getActivity(), "密码格式不正确", Toast.LENGTH_LONG).show(); return false; } if (TextUtils.isEmpty(regSurepass.getText().toString())) { Toast.makeText(getContext(), "请输入确认密码", Toast.LENGTH_LONG).show(); return false; } if (!regEditpass.getText().toString().equals(regSurepass.getText().toString())) { Toast.makeText(getContext(), "密码与确认密码不相同", Toast.LENGTH_LONG).show(); return false; } return true; } @Override public void onResume() { init(); super.onResume(); } @Override public void onDestroyView() { getActivity().finish(); super.onDestroyView(); } }
package io.zentity.devtools; import com.fasterxml.jackson.databind.JsonNode; import io.zentity.common.StreamUtil; import org.junit.ComparisonFailure; import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; public class JsonTestUtil { static List<JsonNode> sortedListFromIterable(Iterable<JsonNode> iterable) { return StreamUtil.fromIterable(iterable) .sorted(UNORDERED_COMPARATOR) .collect(Collectors.toList()); } static Comparator<JsonNode> UNORDERED_COMPARATOR = new Comparator<JsonNode>() { @Override public int compare(JsonNode node1, JsonNode node2) { // will not sort "equivalent" number classes, like Doubles and Longs, in "logical" order, // but should not matter for true equality tests where 5.0d != 5l if (node1.getClass() != node2.getClass()) { return node1.getClass().getCanonicalName().compareTo(node2.getClass().getCanonicalName()); } if (node1.isNumber()) { return (int) (node1.numberValue().doubleValue() - node2.numberValue().doubleValue()); } if (node1.isTextual()) { return node1.textValue().compareTo(node2.textValue()); } if (node1.size() != node2.size()) { return node1.size() - node2.size(); } List<JsonNode> list1 = sortedListFromIterable(node1); List<JsonNode> list2 = sortedListFromIterable(node2); int sum = 0; for (int i = 0; i < list1.size(); i += 1) { sum += this.compare(list1.get(i), list2.get(i)); } return sum; } }; /** * Order-independent equality check. * * @param node1 A JsonNode. * @param node2 Another JsonNode. * @return If the nodes are equal, once sorted. */ public static boolean unorderedEquals(JsonNode node1, JsonNode node2) { if (node1 == null || node2 == null) { return node1 == null && node2 == null; } if (node1.size() != node2.size()) { return false; } if (node1.size() == 0) { return node1.equals(node2); } List<JsonNode> list1 = sortedListFromIterable(node1); List<JsonNode> list2 = sortedListFromIterable(node2); for (int i = 0; i < list1.size(); i += 1) { if (!unorderedEquals(list1.get(i), list2.get(i))) { return false; } } return true; } /** * Asserts that two JSON nodes are equal, independent of the order of their children. * * @param message An optional message in case of failure. * @param expected Expected JSON. * @param actual Actual JSON. * @throws ComparisonFailure If the two nodes are not equal. */ public static void assertUnorderedEquals(String message, JsonNode expected, JsonNode actual) { if (unorderedEquals(expected, actual)) { return; } String cleanMessage = message == null ? "" : message; throw new ComparisonFailure(cleanMessage, String.valueOf(expected), String.valueOf(actual)); } /** * Asserts that two JSON nodes are equal, independent of the order of their children. * * @param expected Expected JSON. * @param actual Actual JSON. * @throws ComparisonFailure If the two nodes are not equal. */ public static void assertUnorderedEquals(JsonNode expected, JsonNode actual) { assertUnorderedEquals(null, expected, actual); } }
package IteratorPattern; public class IteratorPattern { public static void main(String[] args) { // TODO Auto-generated method stub MenuByArrayList allList = new MenuByArrayList("allList", "allList!!"); MenuByArrayList a = new MenuByArrayList("a", "a!!"); MenuByArray b = new MenuByArray("b", "b!!"); MenuByArrayList c = new MenuByArrayList("c", "c!!"); a.add(new MenuItem("a1",1,"a1!!",true)); a.add(new MenuItem("a2",2,"a2!!",false)); a.add(new MenuItem("a3",3,"a3!!",true)); b.add(new MenuItem("b1",1,"b1!!",false)); b.add(new MenuItem("b2",2,"b2!!",true)); b.add(new MenuItem("b3",3,"b3!!",false)); c.add(new MenuItem("c1",1,"c1!!",false)); c.add(new MenuItem("c2",2,"c2!!",true)); c.add(new MenuItem("c3",3,"c3!!",false)); allList.add(a); allList.add(b); a.add(c); allList.print(); CompositeIterator iterator = new CompositeIterator(allList); while (iterator.hasNext()) { MenuComponent menuComponent = (MenuComponent) iterator.next(); if (menuComponent instanceof MenuItem) { menuComponent.print(); } } } }
package com.flyme.dao; public abstract class OrderDao { }
package edu.kmi.primejavaC.JWC.Controller.Event; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.SQLException; import javax.swing.JOptionPane; import edu.kmi.primejavaC.JWC.Controller.FrontController; import edu.kmi.primejavaC.JWC.Model.Member; import edu.kmi.primejavaC.JWC.View.Form.Insert_Profile_Form; import edu.kmi.primejavaC.JWC.View.Form.Login_Form; import edu.kmi.primejavaC.JWC.View.Form.Main_Form; public class LoginEvent implements ActionListener { String id; String pw; Login_Form frame; Member info; public LoginEvent(Login_Form frame){ this.frame = frame; } @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub String[] account = frame.get_Account(); this.id = account[0]; this.pw = account[1]; frame.getControl().open(); try { info = frame.getControl().checkUser(id, pw); } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); System.out.println("ssss??"); } frame.getControl().close(); if(!(info == null)){ if(info.getProfilecheck() == 1){ frame.dispose(); Main_Form main_frame = new Main_Form(frame.getControl(), info); } else{ frame.dispose(); Insert_Profile_Form insert_form = new Insert_Profile_Form(frame.getControl(), info); } } else{ JOptionPane.showMessageDialog(null, "ID or Password does not match"); } } }
package me.saptarshidebnath.jwebsite.utils; import me.saptarshidebnath.jwebsite.utils.jlog.JLog; import java.util.HashMap; /** Created by saptarshi on 10/3/2016. */ public enum WebInstanceConstants { INST; private final HashMap<String, String> cache; private WebInstanceConstants() { this.cache = new HashMap<>(); } public String getValueFor(final String key) { final String returnValue = this.cache.get(key); JLog.info("Replying back with >> " + key + " : " + returnValue); return returnValue; } public void storeValue(final String forKey, final String value) { JLog.info(forKey + " : " + value); // // Check if key exists or not in a synchronized fashion // synchronized (this.cache) { // Arrays.asList(Thread.currentThread().getStackTrace()).forEach(System.out::println); if (this.cache.containsKey(forKey)) { final String currentValue = this.cache.get(forKey); JLog.warning( "Key \"" + forKey + "\" already present in cache with value \"" + currentValue + "\" . The current value \"" + currentValue + "\" will be replaced with the new " + "value \"" + "\""); } this.cache.put(forKey, value); } } }
package iteration04.fr.agh.services; import iteration04.fr.agh.domain.Dimension; import iteration04.fr.agh.domain.Grid; /** * @author elm * */ public interface PrintService { public void print(int stepNumber,Grid grid,Dimension dimension); }
package algorithms.graph.process; import algorithms.graph.Graph; /** * Created by Chen Li on 2018/5/5. */ public interface ConnectedComponents<T extends Graph> { void init(T graph); /** * are v and w connected? */ boolean connected(int v, int w); /** * number of connected components */ int count(); /** * component identifer for v * ( between 0 and count()-1 ) */ int getComponentId(int vertex); }
package com.jedralski.MovieRecommendationSystems.dao; import com.jedralski.MovieRecommendationSystems.connection.DBConnector; import com.jedralski.MovieRecommendationSystems.exception.DatabaseException; import com.jedralski.MovieRecommendationSystems.exception.InputException; import com.jedralski.MovieRecommendationSystems.model.User; import org.springframework.stereotype.Repository; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @Repository public class UserDAOImpl implements UserDAO { @Override public boolean addUser(User user) throws InputException, DatabaseException { Connection connection = null; PreparedStatement preparedStatement = null; try { connection = DBConnector.getConnection(); String query = "INSERT INTO public.user (username, sex, birth_date, nationality, real) VALUES (?, ?, ?, ?, ?)"; preparedStatement = connection.prepareStatement(query); preparedStatement.setString(1, user.getUsername()); preparedStatement.setString(2, user.getSex()); preparedStatement.setDate(3, user.getBirthDate()); preparedStatement.setString(4, user.getNationality()); preparedStatement.setBoolean(5, true); preparedStatement.executeUpdate(); return true; } catch (IllegalArgumentException e) { return false; } catch (SQLException e) { return false; } finally { DBConnector.closeStatement(preparedStatement); DBConnector.closeConnection(connection); } } @Override public User getUserDataByUsername(String username) throws DatabaseException { Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; try { connection = DBConnector.getConnection(); String query = "SELECT * FROM public.user WHERE username LIKE ?"; preparedStatement = connection.prepareStatement(query); preparedStatement.setString(1, username); resultSet = preparedStatement.executeQuery(); User user = null; if (resultSet == null) { throw new DatabaseException("Error returning result."); } if (resultSet.next()) { user = User.builder() .userId(resultSet.getLong("id")) .username(resultSet.getString("username")) .sex(resultSet.getString("sex")) .birthDate(resultSet.getDate("birth_date")) .nationality(resultSet.getString("nationality")) .build(); } if (resultSet.next()) { throw new DatabaseException("Query returned more than 1 record."); } return user; } catch (SQLException e) { throw new DatabaseException("Exception: " + e); } finally { DBConnector.closeResultSet(resultSet); DBConnector.closeStatement(preparedStatement); DBConnector.closeConnection(connection); } } }
package com.chen.lister; import javax.servlet.ServletRequestEvent; import javax.servlet.ServletRequestListener; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; public class ListerClassPath implements ServletRequestListener{ @Override public void requestDestroyed(ServletRequestEvent arg0) { // TODO Auto-generated method stub } @Override public void requestInitialized(ServletRequestEvent arg) { // 获得客户端的绝对路径 HttpServletRequest request=(HttpServletRequest) arg.getServletRequest(); String path = request.getContextPath(); String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/"; // 把客户端路径存储到session内置对象中 HttpSession session=request.getSession(); if(session.getAttribute("basePath")==null){//第一次请求,session中没有存储客户端绝对信息 session.setAttribute("basePath", basePath); } } }
public abstract class Quadrilateral extends Shape { private double side1, side2, side3, side4; public Quadrilateral(double s1, double s2, double s3, double s4, String quadName) { super(quadName); side1 = s1; side2 = s2; side3 = s3; side4 = s4; } public double perimeter() { return side1 + side2 + side3 + side4; } public double getSide1() { return side1; } public double getSide2() { return side2; } public double getSide3() { return side3; } public double getSide4() { return side4; } }
package com.example.ecoleenligne.util; import android.os.SystemClock; import android.view.InputDevice; import android.view.MotionEvent; import android.webkit.WebView; import android.webkit.WebViewClient; public class AutoPlayVideoWebViewClient extends WebViewClient { @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); // mimic onClick() event on the center of the WebView long delta = 100; long downTime = SystemClock.uptimeMillis(); float x = view.getLeft() + (view.getWidth()/2); float y = view.getTop() + (view.getHeight()/2); MotionEvent tapDownEvent = MotionEvent.obtain(downTime, downTime + delta, MotionEvent.ACTION_DOWN, x, y, 0); tapDownEvent.setSource(InputDevice.SOURCE_CLASS_POINTER); MotionEvent tapUpEvent = MotionEvent.obtain(downTime, downTime + delta + 2, MotionEvent.ACTION_UP, x, y, 0); tapUpEvent.setSource(InputDevice.SOURCE_CLASS_POINTER); view.dispatchTouchEvent(tapDownEvent); view.dispatchTouchEvent(tapUpEvent); } }
package MainPackage; import java.util.ArrayList; import java.util.Scanner; public class Menu extends ArrayList<String> { public Menu(){ super(); } public int getUserChoice(){ int choice = 0; boolean check; Scanner scanner = new Scanner(System.in); for (int i=0;i<this.size();i++){ System.out.println((i+1)+". "+this.get(i)); } do { System.out.print("Your choice: "); try { choice =Integer.parseInt(scanner.nextLine()); check = false; } catch (Exception e){ check = true; System.out.println("Wrong type input!"); } } while (check); return choice; } }
package com.example.qiyue.mvp_dragger.views; import android.os.Bundle; import android.widget.TextView; import com.example.qiyue.mvp_dragger.R; import com.example.qiyue.mvp_dragger.compent.DaggerTestUserComponent; import com.example.qiyue.mvp_dragger.core.BaseActivity; import com.example.qiyue.mvp_dragger.core.ThreadExecutor; import com.example.qiyue.mvp_dragger.entity.TestUser; import com.example.qiyue.mvp_dragger.module.TestUserModule; import javax.inject.Inject; import butterknife.Bind; import butterknife.ButterKnife; public class TestModuleOneActivity extends BaseActivity { @Inject TestUser testUser; @Bind(R.id.tv_useinfo) TextView tvUseinfo; @Bind(R.id.tv_one) TextView tvOne; @Bind(R.id.tv_two) TextView tvTwo; /** * 应为有依赖所以可以注入.applicationComponent(getApplicationComponent()) */ @Inject ThreadExecutor executor; @Override protected int getLayoutId() { return R.layout.activity_test_module_one; } @Override protected void initViews(Bundle savedInstanceState) { DaggerTestUserComponent.builder() .applicationComponent(getApplicationComponent()) .testUserModule(new TestUserModule()) .build() .inject(this); } @Override protected void initData() { tvOne.setText("这是一个测试Moudle如何提供依赖的一个测试,在Moudle中,我们需要创建一个TestUser对象,TestUser的创建需要两个参数," + "我们来分析这两个参数该怎么传递"); tvTwo.setText("第①种通过在一个Moudle中同样提供他的参数对象" + "第②种就是通过在参数对象中添加无参构造方法并在上面加上注解@Inject,然后rebuild的时候就会自动调用" + "这个无参构造方法"); tvUseinfo.setText(testUser.toString()); if (executor!=null){ toast("executor注入成功"); }else{ toast("注入失败"); } } }
package com.example.demo.mapper; import java.util.List; import com.example.demo.VO.StockVO; public interface StockMapper{ //insert訊息至資料庫 public void insertStock(List<StockVO> stockList); }
package com.shensu.dao; import java.util.HashMap; import java.util.List; import com.shensu.pojo.Franchiser; import com.shensu.pojo.FranchiserUser; public interface FranchiserUserMapper { int deleteByPrimaryKey(Integer franchiseruserid); int insert(FranchiserUser record); int insertSelective(FranchiserUser record); FranchiserUser selectByPrimaryKey(Integer franchiseruserid); int updateByPrimaryKeySelective(FranchiserUser record); int updateByPrimaryKey(int franchiserUserId); //添加加盟者账号信息 int insertFranchiserUser(FranchiserUser franchiserUser); //根据加盟者openId查询用户信息 int findUser(String openId); //根据条件分页 List<FranchiserUser> selectByCondition(HashMap<String,Object> map); //根据条件查总数 int selectCountByCondition(HashMap<String,Object> map); //根据加盟者id查询用户信息 FranchiserUser findFranchiserUser(Integer franchiseruserid); //修改加盟者信息 int modifyFranchiserUser(FranchiserUser franchiserUser); //删除加盟者信息 int deleteFranchiserUser(int franchiserUserId); //查询加盟者账号全部列表 List<FranchiserUser> findAllFranchiserUserDetails(FranchiserUser franchiserUser); //用户查询pid FranchiserUser findUserPId(String openId); //查询编辑账号全部信息(除了本条信息之外的) List<FranchiserUser> editFranchiserUser(Integer franchiseruserid); }
package com.xh.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Target; /** * @version 创建时间:2017-12-15 下午3:42:38 项目:repair 包名:com.xh.annotation * 文件名:ViewAnnotation.java 作者:lhl 说明: */ @Target({ ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR }) public @interface ViewAnnotation { int id() default 0; String clickMethodName() default ""; }
package com.beike.core.service.trx.impl; import java.util.Date; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.beike.common.entity.trx.Payment; import com.beike.common.entity.trx.TrxLog; import com.beike.common.entity.trx.TrxorderGoods; import com.beike.common.enums.trx.PaymentType; import com.beike.common.enums.trx.TrxLogType; import com.beike.core.service.trx.TrxLogService; import com.beike.dao.trx.TrxLogDao; import com.beike.util.Amount; import com.beike.util.BankInfoUtil; import com.beike.util.EnumUtil; /** * @Title: TrxLogService.java * @Package com.beike.core.service.trx * @Description: 日志服务类 * @author wh.cheng@sinobogroup.com * @date May 5, 2011 3:25:41 PM * @version V1.0 */ @Service("trxLogService") public class TrxLogServiceImpl implements TrxLogService { private final Log logger = LogFactory.getLog(TrxLogServiceImpl.class); @Autowired private TrxLogDao trxLogDao; public void addTrxLogForSuc(List<Payment> paymentList, List<TrxorderGoods> trxorderGoodsList) { double vcActAmount = 0.0;// 账户里虚拟币金额 double cashActAmount = 0.0;// 账户里现金金额 double cashPayAmount = 0.0;// 网银支付的现金金额 double actAmount = 0.0;// 账户里虚拟币金额+账户里现金 String providerType = "";// 第三方支付渠道 String payChannel = "";// 支付通道 StringBuilder payInfoSb = new StringBuilder(); if (paymentList == null || paymentList.size() == 0 || trxorderGoodsList == null || trxorderGoodsList.size() == 0) { logger .info("++++++paymentList or trxorderGoodsList is null!+++++++++"); return; } try { // 遍历Payment for (Payment paymentItem : paymentList) { if (PaymentType.ACTVC.equals(paymentItem.getPaymentType())) { vcActAmount = paymentItem.getTrxAmount(); } else if (PaymentType.ACTCASH.equals(paymentItem .getPaymentType())) { cashActAmount = paymentItem.getTrxAmount(); } else if (PaymentType.PAYCASH.equals(paymentItem .getPaymentType())) { cashPayAmount = paymentItem.getTrxAmount(); providerType = EnumUtil.transEnumToString(paymentItem .getProviderType()); payChannel = paymentItem.getPayChannel(); } } // 账户支付金额合并 actAmount = Amount.add(vcActAmount, cashActAmount); // 支付日志信息封装 payInfoSb.append("账户支付:¥"); payInfoSb.append(actAmount); payInfoSb.append(";"); // 如果有网银支付记录 if (cashPayAmount > 0.0) {// 如果有网银支付记录。cashPayAmount>0则一定会有,反之亦然。 String providerAndChannel = BankInfoUtil .convProviderAndChannel(providerType, payChannel); payInfoSb.append(providerAndChannel); } payInfoSb.append("网银支付:¥"); payInfoSb.append(cashPayAmount); // 遍历商品订单,循环存入 for (TrxorderGoods item : trxorderGoodsList) { Long trxorderGoodsId = item.getId(); logger.info("++++trxorderGoodsId:" + trxorderGoodsId + "++++logContent:" + payInfoSb.toString()); TrxLog trxLog = new TrxLog(item.getTrxGoodsSn(), new Date(), TrxLogType.SUCCESS, "购买成功", payInfoSb.toString()); trxLogDao.addTrxLog(trxLog); } } catch (Exception e) { logger.debug("+++++++++++" + e + "++++++++++++++"); e.printStackTrace(); } } /** * 根据传入的trxorderGoodsList记录运营下单操作日志 * * @param trxorderGoodsList */ public void addTrxLogForCreate(List<TrxorderGoods> trxorderGoodsList){ if(trxorderGoodsList==null || trxorderGoodsList.size()==0){ logger.info("++++++ trxorderGoodsList is null!+++++++++"); return ; } for(TrxorderGoods trxorderGoods:trxorderGoodsList){ TrxLog trxLog = new TrxLog(trxorderGoods.getTrxGoodsSn(),new Date(), TrxLogType.INIT, "下单成功", "商品订单号:"+ trxorderGoods.getTrxGoodsSn()); trxLogDao.addTrxLog(trxLog); } } }
/* * 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 poker2; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.ImageIcon; import javax.swing.JOptionPane; /** * * @author Danil */ public class VentanaManoOcasional extends javax.swing.JFrame { ArrayList<Carta> mano1= new ArrayList<>(); ArrayList<Carta> baraja1= new ArrayList<>(); JugadorOcasional jugadorO= VentanaJugarSinRegistro.jo; /** * Creates new form VentanaManoOcasional */ public VentanaManoOcasional() { 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() { jLabel2 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); CantidadApostada = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); AumentaSaldo = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); AumentarSaldo = new javax.swing.JButton(); Jugar = new javax.swing.JButton(); RetirarBeneficios = new javax.swing.JButton(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); Beneficio = new javax.swing.JTextField(); SaldoRestante = new javax.swing.JTextField(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); Resultado = new javax.swing.JTextField(); Mano1 = new javax.swing.JLabel(); Mano2 = new javax.swing.JLabel(); Mano3 = new javax.swing.JLabel(); Mano4 = new javax.swing.JLabel(); Mano5 = new javax.swing.JLabel(); Factura = new javax.swing.JButton(); jLabel2.setText("jLabel2"); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); jLabel1.setText("¿Cuánto deseas apostar?"); jLabel3.setText("€"); jLabel4.setText("Introduce para aumentar saldo"); jLabel5.setText("€"); AumentarSaldo.setText("¿Aumentar Saldo?"); AumentarSaldo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { AumentarSaldoActionPerformed(evt); } }); Jugar.setText("JUGAR"); Jugar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { JugarActionPerformed(evt); } }); RetirarBeneficios.setText("¿Retirar Beneficios?"); RetirarBeneficios.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { RetirarBeneficiosActionPerformed(evt); } }); jLabel6.setText("Beneficio:"); jLabel7.setText("Saldo Restante:"); jLabel8.setText("€"); jLabel9.setText("€"); jLabel10.setText("Su saldo resultante tras la jugada:"); Factura.setText("Imprimir Factura"); Factura.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { FacturaActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(282, 282, 282) .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(219, 219, 219) .addComponent(Resultado, javax.swing.GroupLayout.PREFERRED_SIZE, 374, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(109, 109, 109) .addComponent(Mano1, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(Mano2, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(Mano3, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(Mano4, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(Mano5, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(0, 126, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addGap(43, 43, 43) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(CantidadApostada, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(AumentaSaldo, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel5)) .addComponent(AumentarSaldo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(78, 78, 78) .addComponent(Jugar, javax.swing.GroupLayout.PREFERRED_SIZE, 203, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel3)) .addGroup(layout.createSequentialGroup() .addGap(107, 107, 107) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jLabel7, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(Beneficio, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE) .addComponent(SaldoRestante))) .addComponent(RetirarBeneficios, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addGap(144, 144, 144) .addComponent(Factura, javax.swing.GroupLayout.PREFERRED_SIZE, 234, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(32, 32, 32) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(Factura, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(CantidadApostada, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(21, 21, 21) .addComponent(jLabel4) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(7, 7, 7) .addComponent(RetirarBeneficios, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6) .addComponent(Beneficio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel8)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7) .addComponent(SaldoRestante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel9))) .addGroup(layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(AumentaSaldo, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(AumentarSaldo, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(Jugar, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGap(72, 72, 72) .addComponent(jLabel10) .addGap(18, 18, 18) .addComponent(Resultado, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(65, 65, 65) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(Mano5, javax.swing.GroupLayout.DEFAULT_SIZE, 183, Short.MAX_VALUE) .addComponent(Mano4, javax.swing.GroupLayout.DEFAULT_SIZE, 183, Short.MAX_VALUE) .addComponent(Mano3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(Mano2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(Mano1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap(153, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void AumentarSaldoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AumentarSaldoActionPerformed // TODO add your handling code here: jugadorO.aumentarSaldo(Double.parseDouble(AumentaSaldo.getText())); Resultado.setText(String.valueOf(jugadorO.getSaldoAcumulado())); }//GEN-LAST:event_AumentarSaldoActionPerformed private void JugarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JugarActionPerformed try{ if(Integer.parseInt(CantidadApostada.getText())>jugadorO.getSaldoAcumulado()){ throw new JugadorException(JugadorException.SALDO_INSUFICIENTE); } mano1.clear(); baraja1=Baraja.creaBaraja(); mano1= Baraja.creaMano(baraja1); baraja1.clear(); jugadorO.actualizaSaldo(mano1,Integer.parseInt(CantidadApostada.getText())); Resultado.setText(String.valueOf(jugadorO.getSaldoAcumulado())); ImageIcon imagen1 = new ImageIcon("CartasEspañolas/" + mano1.get(0).toString()); ImageIcon imgRedimensionada1 = new ImageIcon(imagen1.getImage().getScaledInstance(Mano1.getWidth(), Mano1.getHeight(), 1)); Mano1.setIcon(imgRedimensionada1); ImageIcon imagen2 = new ImageIcon("CartasEspañolas/" + mano1.get(1).toString()); ImageIcon imgRedimensionada2 = new ImageIcon(imagen2.getImage().getScaledInstance(Mano2.getWidth(), Mano2.getHeight(), 1)); Mano2.setIcon(imgRedimensionada2); ImageIcon imagen3 = new ImageIcon("CartasEspañolas/" + mano1.get(2).toString()); ImageIcon imgRedimensionada3 = new ImageIcon(imagen3.getImage().getScaledInstance(Mano3.getWidth(), Mano3.getHeight(), 1)); Mano3.setIcon(imgRedimensionada3); ImageIcon imagen4 = new ImageIcon("CartasEspañolas/" + mano1.get(3).toString()); ImageIcon imgRedimensionada4 = new ImageIcon(imagen4.getImage().getScaledInstance(Mano4.getWidth(), Mano4.getHeight(), 1)); Mano4.setIcon(imgRedimensionada4); ImageIcon imagen5 = new ImageIcon("CartasEspañolas/" + mano1.get(4).toString()); ImageIcon imgRedimensionada5 = new ImageIcon(imagen5.getImage().getScaledInstance(Mano5.getWidth(), Mano5.getHeight(), 1)); Mano5.setIcon(imgRedimensionada5); } catch(JugadorException je){ JOptionPane.showMessageDialog(this, je.toString(), "Error", JOptionPane.WARNING_MESSAGE); } }//GEN-LAST:event_JugarActionPerformed private void RetirarBeneficiosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RetirarBeneficiosActionPerformed // TODO add your handling code here: Beneficio.setText(String.valueOf(jugadorO.retirarBeneficios())); SaldoRestante.setText(String.valueOf(jugadorO.getSaldoAcumulado())); }//GEN-LAST:event_RetirarBeneficiosActionPerformed private void FacturaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FacturaActionPerformed // TODO add your handling code here: PrintWriter salida = null; try { // TODO add your handling code here: public static void generaFicha(Persona per) throws IOException { salida = new PrintWriter(new BufferedWriter(new FileWriter(jugadorO.getNIF() + ".txt"))); salida.println("-------------------------------- Ficha "+ jugadorO.getNombre() +" --------------------------------"); salida.println("\n"); salida.println("DNI: " + jugadorO.getNIF()); salida.println("\n"); salida.println("Nombre: " + jugadorO.getNombre()); salida.println("\n"); salida.println("Fecha de nacimiento: " + jugadorO.getFechaNacimiento()); salida.println("\n"); salida.println("Beneficio: " + Beneficio.getText() + "€"); salida.println("\n"); salida.println("\n"); salida.println("-------------------------------------------------------------------------------"); } catch (IOException ex) { Logger.getLogger(VentanaMano.class.getName()).log(Level.SEVERE, null, ex); } finally { salida.close(); } }//GEN-LAST:event_FacturaActionPerformed /** * @param args the command line arguments */ // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField AumentaSaldo; private javax.swing.JButton AumentarSaldo; private javax.swing.JTextField Beneficio; private javax.swing.JTextField CantidadApostada; private javax.swing.JButton Factura; private javax.swing.JButton Jugar; private javax.swing.JLabel Mano1; private javax.swing.JLabel Mano2; private javax.swing.JLabel Mano3; private javax.swing.JLabel Mano4; private javax.swing.JLabel Mano5; private javax.swing.JTextField Resultado; private javax.swing.JButton RetirarBeneficios; private javax.swing.JTextField SaldoRestante; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel2; 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; // End of variables declaration//GEN-END:variables }
package com.ipincloud.iotbj.srv.service.impl; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import com.alibaba.fastjson.JSONObject; import com.ipincloud.iotbj.srv.domain.ModInfo; import com.ipincloud.iotbj.srv.dao.*; import com.ipincloud.iotbj.srv.service.ModInfoService; import com.ipincloud.iotbj.utils.ParaUtils; //(ModInfo)模型表 服务实现类 //generate by redcloud,2020-07-24 19:59:20 @Service("ModInfoService") public class ModInfoServiceImpl implements ModInfoService { @Resource private ModInfoDao modInfoDao; //@param id 主键 //@return 实例对象ModInfo @Override public ModInfo queryById(Long id){ return this.modInfoDao.queryById(id); } //@param jsonObj 调用参数 //@return 实例对象ModInfo @Override public JSONObject addInst( JSONObject jsonObj){ jsonObj = ParaUtils.removeSurplusCol(jsonObj,"mod_id,mod_name,mod_desc,mod_index,mod_index_type,mod_index_len,mod_key,user_name"); this.modInfoDao.addInst(jsonObj); return jsonObj; } }
package rayleighquotient; import util.MatrixUtil; import util.VectorUtil; public class RayleighQuotient { /** * @param matrix matrix * @param eigenvector eigenvector of matrix * @return corresponding eigenvalue of the eigenvector */ public static double rayleighQuotient(double[][] matrix, double[] eigenvector) { return VectorUtil.dotProduct(MatrixUtil.multiplyVectorByMatrix(matrix, eigenvector), eigenvector) / VectorUtil .dotProduct(eigenvector, eigenvector); } }
package io.ceph.rgw.client.core.admin; import io.ceph.rgw.client.model.admin.ModifyUserResponse; import io.ceph.rgw.client.model.admin.UserCap; import org.junit.Assert; import org.junit.Test; import org.junit.experimental.categories.Category; /** * @author zhuangshuo * Created by zhuangshuo on 2020/7/31. */ @Category(AdminTests.class) public class ModifyUserTest extends BaseAdminClientTest { @Test public void testSync() { ModifyUserResponse resp = logResponse(adminClient.prepareModifyUser() .withUid(userId) .withDisplayName("modified") .run()); Assert.assertEquals("modified", resp.getUserInfo().getDisplayName()); } @Test public void testCallback() throws InterruptedException { Latch latch = newLatch(); adminClient.prepareModifyUser() .withUid(userId) .withDisplayName("modified") .addUserCap(UserCap.Type.ZONE, UserCap.Perm.WRITE) .execute(newActionListener(latch)); latch.await(); } @Test public void testAsync() { logResponse(adminClient.prepareModifyUser() .withUid(userId) .withAccessKey("a") .withSecretKey("s") .execute()); } @Override boolean isCreateUser() { return true; } }
package communication.udp; import data.communication.ServerData; public interface ServerUpdateListener { public void server_update(ServerData state); }
package cn.xeblog.xechat.service; import cn.xeblog.xechat.domain.mo.User; import cn.xeblog.xechat.domain.vo.MessageVO; import cn.xeblog.xechat.enums.inter.Code; /** * 消息处理 * * @author yanpanyi * @date 2019/4/15 */ public interface MessageService { /** * 发送消息 * * @param subAddress 消息订阅地址 * @param messageVO 消息视图 * @throws Exception */ void sendMessage(String subAddress, MessageVO messageVO) throws Exception; /** * 发送消息到指定用户 * * @param receiver 消息接收者,是一个存入用户id的string数组 * @param messageVO 消息视图 * @throws Exception */ void sendMessageToUser(String[] receiver, MessageVO messageVO) throws Exception; /** * 发送错误消息 * * @param code 错误码 * @param user 发送消息的用户信息,将发送错误消息到该用户 */ void sendErrorMessage(Code code, User user); /** * 发送消息到机器人 * * @param subAddress 消息订阅地址 * @param message 消息文本 * @param user 发送消息的用户信息 * @throws Exception */ void sendMessageToRobot(String subAddress, String message, User user) throws Exception; /** * 发送机器人消息 * * @param subAddress 消息订阅地址 * @param message 消息文本 * @throws Exception */ void sendRobotMessage(String subAddress, String message) throws Exception; }
/* * Copyright Verizon Media, Licensed under the terms of the Apache License, Version 2.0. See LICENSE file in project root for terms. */ package com.yahoo.cubed.dao; import com.yahoo.cubed.model.PipelineProjection; /** * Pipeline projection data access object. */ public interface PipelineProjectionDAO extends AbstractAssociationDAO<PipelineProjection> { }
package com.gxtc.huchuan.dialog; import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.support.annotation.NonNull; import android.support.annotation.StyleRes; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.gxtc.commlibrary.utils.ToastUtil; import com.gxtc.huchuan.R; import com.gxtc.huchuan.adapter.ComplaintAdapter; import com.gxtc.huchuan.bean.dao.User; import com.gxtc.huchuan.data.UserManager; import com.gxtc.huchuan.http.ApiCallBack; import com.gxtc.huchuan.http.ApiObserver; import com.gxtc.huchuan.http.ApiResponseBean; import com.gxtc.huchuan.http.service.AllApi; import com.gxtc.huchuan.ui.news.NewsCommentDialog; import com.gxtc.huchuan.utils.LoginErrorCodeUtil; import java.util.ArrayList; import java.util.List; import rx.Subscription; import rx.android.schedulers.AndroidSchedulers; import rx.schedulers.Schedulers; /** * Created by sjr on 2017/3/29. * 文章投诉 */ public class ComplaintDialog extends Dialog implements View.OnClickListener { private final String mTitle; private final String mType; private TextView tvContent; private RecyclerView mRecyclerView; private TextView tvOk; String[] title = {"广告", "重复", "低俗", "标题夸张", "与事实不符", "内容质量差", "疑似抄袭"}; private List<String> mDatas; private List<String> mSelectedDatas; private ComplaintAdapter mAdapter; private View view; private Context mContext; private Activity mActivity; private String id; Subscription sub; private TextView tvTitle; /** * @param activity * @param context * @param themeResId * @param id 文章id * @param title 标题 * @param type 举报类型 */ public ComplaintDialog(Activity activity, @NonNull Context context, @StyleRes int themeResId, String id, String title, String type) { super(context, R.style.dialog_Translucent); this.mActivity = activity; this.mContext = context; this.id = id; mTitle = title; mType = type; initView(); initData(); } private void initView() { view = LayoutInflater.from(mContext).inflate(R.layout.pop_complaint, null); mRecyclerView = (RecyclerView) view.findViewById(R.id.rv_complaint); tvContent = (TextView) view.findViewById(R.id.tv_complaint_content); tvOk = (TextView) view.findViewById(R.id.tv_complaint_ok); tvTitle = (TextView) view.findViewById(R.id.tv_title); setContentView(view); ViewGroup.LayoutParams layoutParams = view.getLayoutParams(); layoutParams.width = mContext.getResources().getDisplayMetrics().widthPixels; view.setLayoutParams(layoutParams); } private void initData() { mDatas = new ArrayList<>(); mSelectedDatas = new ArrayList<>(); for (String string : title) mDatas.add(string); tvTitle.setText(mTitle); mAdapter = new ComplaintAdapter(mContext, mDatas, R.layout.item_complaint); LinearLayoutManager manager = new LinearLayoutManager(mContext); mRecyclerView.setLayoutManager(manager); mRecyclerView.setAdapter(mAdapter); mAdapter.setOnSelectedListener(new ComplaintAdapter.OnSelectedItemListener() { @Override public void onSelected(String msg, boolean isSelected) { if (isSelected) mSelectedDatas.add(msg); else mSelectedDatas.remove(msg); } }); tvOk.setOnClickListener(this); tvContent.setOnClickListener(this); } NewsCommentDialog mCOmmentDialog; @Override public void onClick(View v) { mCOmmentDialog = new NewsCommentDialog(mContext); switch (v.getId()) { case R.id.tv_complaint_ok: if (mSelectedDatas.isEmpty() && mSelectedDatas.size() == 0) { ComplaintDialog.this.dismiss(); return; } complaint(mSelectedDatas.toString()); break; case R.id.tv_complaint_content: mCOmmentDialog.setOnSendListener(new NewsCommentDialog.OnSendListener() { @Override public void sendComment(String content) { complaint(content); } }); mCOmmentDialog.show(); break; } } /** * 投诉 */ private void complaint(String conten) { //到这里肯定是已经登录的 sub = AllApi.getInstance().complaintArticle(UserManager.getInstance().getToken(), mType, id, conten) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new ApiObserver<ApiResponseBean<Void>>(new ApiCallBack() { @Override public void onSuccess(Object data) { ToastUtil.showShort(mContext, "投诉成功,我们将会对投诉内容进行审核"); ComplaintDialog.this.dismiss(); if (mCOmmentDialog.isShowing()) mCOmmentDialog.dismiss(); } @Override public void onError(String errorCode, String message) { LoginErrorCodeUtil.showHaveTokenError(mActivity, errorCode, message); } })); } @Override public void onDetachedFromWindow() { super.onDetachedFromWindow(); if (sub != null && sub.isUnsubscribed()) { sub.unsubscribe(); } } }
package com.smartsampa.busapi; /** * Created by ruan0408 on 12/04/2016. */ public interface Bus { String getPrefixNumber(); boolean isWheelChairCapable(); Double getLatitude(); Double getLongitude(); }
package com.shangdao.phoenix.entity.moduleManager; import org.springframework.data.jpa.repository.JpaRepository; /** * @author huanghengkun * @date 2018/04/02 */ public interface ModuleManagerFileRepository extends JpaRepository<ModuleManagerFile, Long> { }
package maven_ssm.generation.entity; import java.io.Serializable; public class FieldEntity implements Serializable { /** * version: 字段表 *---------------------- * author:xiezhyan * date:2017-6-4 */ private static final long serialVersionUID = 6482847865746417225L; //所属字段 private String field; //字段类型 private String type; //字段编码 private String collation; //字段是否是主键,外键等 private String key; private String extra; private String comment; private String javaType; private String javaField; public String getJavaType() { return javaType; } public void setJavaType(String javaType) { this.javaType = javaType; } public String getJavaField() { return javaField; } public void setJavaField(String javaField) { this.javaField = javaField; } public String getField() { return field; } public void setField(String field) { this.field = field; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getCollation() { return collation; } public void setCollation(String collation) { this.collation = collation; } public String getKey() { return key; } public void setKey(String key) { this.key = key; } public String getExtra() { return extra; } public void setExtra(String extra) { this.extra = extra; } public String getComment() { return comment; } public void setComment(String comment) { this.comment = comment; } }
package lk.ijse.dinemore.business.custom.impl; import lk.ijse.dinemore.business.custom.ChefBO; import lk.ijse.dinemore.dto.ChefDTO; import lk.ijse.dinemore.entity.Chef; import lk.ijse.dinemore.repository.RepositoryFactory; import lk.ijse.dinemore.repository.custom.ChefRepository; import lk.ijse.dinemore.util.HibernateUtil; import org.hibernate.Session; import java.util.ArrayList; import java.util.List; public class ChefBOImpl implements ChefBO { private ChefRepository chefRepository; private int id; public ChefBOImpl() { this.chefRepository= (ChefRepository) RepositoryFactory.getInstance().getRepository(RepositoryFactory.RepositoryTypes.CHEF); } @Override public boolean addChef(ChefDTO chefDTO) throws Exception { try (Session session= HibernateUtil.getSessionFactory().openSession()){ chefRepository.setSession(session); session.getTransaction(); session.beginTransaction(); Chef chef=new Chef( chefDTO.getChefID(), chefDTO.getNic(), chefDTO.getName(), chefDTO.getAddress(), chefDTO.getPhoneNo() ); chefRepository.save(chef); session.getTransaction().commit(); } return true; } @Override public boolean updateChef(ChefDTO chefDTO) throws Exception { return false; } @Override public boolean deleteChef(int id) throws Exception { return false; } @Override public ChefDTO findChefByID(int ID) throws Exception { return null; } @Override public ArrayList<ChefDTO> getAllChef() throws Exception { Session session=HibernateUtil.getSessionFactory().openSession(); chefRepository.setSession(session); session.beginTransaction(); List<Chef>chefs=chefRepository.findAll(); session.getTransaction().commit(); if (chefs !=null){ List<ChefDTO>alChef=new ArrayList<>(); for(Chef chef: chefs){ ChefDTO chefDTO=new ChefDTO(chef.getChefID(), chef.getNic(), chef.getName(), chef.getAddress(),chef.getPhoneNo()); alChef.add(chefDTO); } return (ArrayList<ChefDTO>) alChef; }else { return null; } } }
package controllers; import java.util.Arrays; import java.util.GregorianCalendar; import java.util.List; import java.util.Map; import java.util.Set; import org.joda.time.DateTime; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import linfo.project.terminalscraping.parser.containerinfo.ContainerScraper; import models.PLAY_TEST_BAR; import models.T_vessel_schedule; import models.T_vessel_schedule_history; import models.Task; import play.libs.Json; import play.mvc.*; import views.html.*; import play.api.mvc.Request; import play.data.*; import play.db.ebean.Model; import play.db.ebean.Model.Finder; @With(CorsAction.class) public class Application extends Controller { static Form<Task> taskForm = Form.form(Task.class); static Form<T_vessel_schedule> berthForm = Form.form(T_vessel_schedule.class); public static Result getTasks(){ List<Task> tasks = new Model.Finder(Long.class, Task.class).all(); return ok(Json.toJson(tasks)); } public static Result index() { // Result ok = ok("Hello world!"); // Result notFound = notFound(); // Result pageNotFound = notFound("<h1>Page not found</h1>").as("text/html"); // Result badRequest = badRequest(views.html.form.render(formWithErrors)); // Result oops = internalServerError("Oops"); // Result anyStatus = status(488, "Strange response type"); // return redirect(routes.Application.tasks()); // return redirect(routes.Application.berthinfo()); return ok(index.render("Start.. Berth Information!!!")); } public static Result tasks(){ return ok(views.html.task.render(Task.all(), taskForm)); } public static Result newTask(){ Form<Task> filledForm = taskForm.bindFromRequest(); if(filledForm.hasErrors()){ return badRequest(views.html.task.render(Task.all(), filledForm)); }else{ Task.create(filledForm.get()); return redirect(routes.Application.tasks()); } } public static Result deleteTask(Long id){ Task.delete(id); return redirect(routes.Application.tasks()); } public static Result berthinfo(){ System.out.println("Request Time(berthinfo) : " + GregorianCalendar.getInstance()); return ok(views.html.berthinfo.render(T_vessel_schedule.all(), berthForm)); } public static Result getBerthinfo(){ // final Set<Map.Entry<String,String[]>> entries = request().queryString().entrySet(); // for (Map.Entry<String,String[]> entry : entries) { // final String key = entry.getKey(); // final String value = Arrays.toString(entry.getValue()); // Logger.debug(key + " " + value); // } String tml = request().getQueryString("tml"); String vcod = request().getQueryString("vcod"); String vvd = request().getQueryString("vvd"); String year = request().getQueryString("year"); String opr = request().getQueryString("opr"); String in_vvd_opr = request().getQueryString("in_vvd_opr"); String out_vvd_opr = request().getQueryString("out_vvd_opr"); String berth_no = request().getQueryString("berth_no"); String cct = request().getQueryString("cct"); String etb = request().getQueryString("etb"); String etd = request().getQueryString("etd"); String atb = request().getQueryString("atb"); String atd = request().getQueryString("atd"); String vvd_status = request().getQueryString("vvd_status"); String vsl_name = request().getQueryString("vsl_name"); String route = request().getQueryString("route"); response().setHeader("Access-Control-Allow-Origin", "*"); // Need to add the correct domain in here!! // response().setHeader("Access-Control-Allow-Methods", "POST"); // Only allow POST // response().setHeader("Access-Control-Max-Age", "300"); // Cache response for 5 minutes // response().setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); // Ensure this header is also allowed! System.out.println("tml:" + tml + ",vcod:" + vcod + ",vvd:" + vvd + ",year:" + year + ",opr:" + opr + ",in_vvd_opr:" + ",out_vvd_opr:" + berth_no + ",cct:" + cct + ",etb:" + etb + ",etd:" + etd + ",atb:" + atb + ",atd:" + atd + ",vvd_status:" + vvd_status + ",vsl_name:" + vsl_name + ",route:" + route); return ok(Json.toJson(T_vessel_schedule.terminal(tml, vcod, vvd, year, opr, in_vvd_opr, out_vvd_opr, berth_no, cct, etb, etd, atb, atd, vvd_status, vsl_name, route))); } public static Result berthinfoTerminal(){ System.out.println("Request Time(berthinfoTerminal) : " + GregorianCalendar.getInstance()); Form<T_vessel_schedule> filledForm = berthForm.bindFromRequest(); return ok(views.html.berthinfo.render(T_vessel_schedule.terminal(berthForm.bindFromRequest()), berthForm)); } public static Result berthinfoAllJson(){ System.out.println("Request Time(berthinfoJson) : " + GregorianCalendar.getInstance()); // List<T_vessel_schedule_history> berthInfo = new Model.Finder(String.class, T_vessel_schedule_history.class).all(); return ok(Json.toJson(T_vessel_schedule.all())); } public static Result berthinfoTerminalJson(){ // System.out.println("Request Time(berthinfoTerminalJson) : " + GregorianCalendar.getInstance()); // return ok(Json.toJson(T_vessel_schedule.terminal(berthForm.bindFromRequest()))); String tml = request().getQueryString("tml"); String vcod = request().getQueryString("vcod"); String vvd = request().getQueryString("vvd"); String year = request().getQueryString("year"); String opr = request().getQueryString("opr"); String in_vvd_opr = request().getQueryString("in_vvd_opr"); String out_vvd_opr = request().getQueryString("out_vvd_opr"); String berth_no = request().getQueryString("berth_no"); String cct = request().getQueryString("cct"); String etb = request().getQueryString("etb"); String etd = request().getQueryString("etd"); String atb = request().getQueryString("atb"); String atd = request().getQueryString("atd"); String vvd_status = request().getQueryString("vvd_status"); String vsl_name = request().getQueryString("vsl_name"); String route = request().getQueryString("route"); response().setHeader("Access-Control-Allow-Origin", "*"); // Need to add the correct domain in here!! // response().setHeader("Access-Control-Allow-Methods", "POST"); // Only allow POST // response().setHeader("Access-Control-Max-Age", "300"); // Cache response for 5 minutes // response().setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); // Ensure this header is also allowed! System.out.println("tml:" + tml + ",vcod:" + vcod + ",vvd:" + vvd + ",year:" + year + ",opr:" + opr + ",in_vvd_opr:" + ",out_vvd_opr:" + berth_no + ",cct:" + cct + ",etb:" + etb + ",etd:" + etd + ",atb:" + atb + ",atd:" + atd + ",vvd_status:" + vvd_status + ",vsl_name:" + vsl_name + ",route:" + route); return ok(Json.toJson(T_vessel_schedule.terminal(tml, vcod, vvd, year, opr, in_vvd_opr, out_vvd_opr, berth_no, cct, etb, etd, atb, atd, vvd_status, vsl_name, route))); } public static Result checkPreFlight(){ response().setHeader("Access-Control-Allow-Origin", "*"); // Need to add the correct domain in here!! return ok(); } public static Result getContainerInfo(){ String cntr_no = request().getQueryString("cntr_no"); String tml = request().getQueryString("tml"); String vsl_cod = request().getQueryString("vsl_cod"); String vvd = request().getQueryString("vvd"); String year = request().getQueryString("year"); ContainerScraper cs = new ContainerScraper(tml, cntr_no, vsl_cod, vvd, year); cs.doScraper(); return ok(index.render(cntr_no + tml)); } }
/* $Id$ */ package db; public class DBRowLanguages extends DBRowAbstract { @Override public Class<? extends AbstractTableDataModel> getTableClass() { return LanguagesDataModel.class; } }
package gromcode.main.lesson17.homework17_2; public class Demo { public static void main(String[] args) { //String str = "qwe qwer qwert y1 qw7ertyuio"; Solution solution = new Solution(); //System.out.println(solution.maxWord(str)); //System.out.println(solution.minWord(str)); //System.out.println(); System.out.println(solution.minWord(" h yhy ")); //test(); } public static void test(){ Solution solution = new Solution(); //0. работа с разделителями System.out.println(solution.maxWord("onE two thr7e Four FIVE O")); System.out.println(solution.minWord("onE two thr7e Four FIVE O")); //1.null value System.out.println(solution.maxWord(null)); System.out.println(solution.minWord(null)); //2. first char == space System.out.println(solution.maxWord(" ffff iii")); System.out.println(solution.minWord(" ffff iii")); //3." " value System.out.println(solution.maxWord(" ")); System.out.println(solution.minWord(" ")); //4/ "" value System.out.println(solution.maxWord("")); System.out.println(solution.minWord("")); //5. not text values System.out.println(solution.maxWord("123 456 7 8 454lololo ")); System.out.println(solution.minWord("123 456 7 8 454lololo ")); //6. diff case words System.out.println(solution.maxWord("Upper lowER C_se")); System.out.println(solution.minWord("Upper lowER C_se")); } }
package com.xixiwan.platform.face.feign.basic.api; import com.xixiwan.platform.module.common.rest.RestResponse; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; @FeignClient(name = "face-basic") public interface BasicApi { @GetMapping("/hello") @ResponseBody public RestResponse<String> hello(@RequestParam("username") String username); }
package cn.itheima.day_07.Car; public class CarTest { public static void main(String[] args) { Car car = new Car(); car.setBrand("BMW"); car.setColor("基佬紫"); car.setPrice(300); car.run(); Car car1 = new Car(); car1.setBrand("Carl Bench"); car1.setColor("silver"); car1.setPrice(250); car1.run(); Car car2 = new Car("五菱",10,"蓝"); car2.run(); } }
package com.lenovohit.hwe.treat.service; import java.util.Map; import com.lenovohit.hwe.treat.model.Deposit; import com.lenovohit.hwe.treat.transfer.RestEntityResponse; import com.lenovohit.hwe.treat.transfer.RestListResponse; public interface HisDepositService { public RestEntityResponse<Deposit> getInfo(Deposit request, Map<String, ?> variables); public RestListResponse<Deposit> findList(Deposit request, Map<String, ?> variables); public RestEntityResponse<Deposit> recharge(Deposit request, Map<String, ?> variables); public RestEntityResponse<Deposit> freeze(Deposit request, Map<String, ?> variables); public RestEntityResponse<Deposit> confirmFreeze(Deposit request, Map<String, ?> variables); public RestEntityResponse<Deposit> unfreeze(Deposit request, Map<String, ?> variables); public RestEntityResponse<Deposit> reufndCancel(Deposit request, Map<String, ?> variables); }
package com.reservation.controller; import java.util.List; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.reservation.model.Company; import com.reservation.service.CompanyService; @RestController @RequestMapping("/company") public class CompanyController { @Autowired CompanyService service; @GetMapping(value = "/getAll") public ResponseEntity<List<Company>> getAllCompany() { List<Company> list = service.getCompany(); return ResponseEntity.ok(list); } @PreAuthorize("hasRole('ADMIN')") @PostMapping(value = "/insertCompany") public ResponseEntity<Company> insertCompany(@RequestBody Company request) { Company company = service.insertCompany(request); return ResponseEntity.ok(company); } @GetMapping(value = "/getCompanyById") public ResponseEntity<Optional<Company>> getCompanyById(@RequestBody Company request) { Optional<Company> stock = service.getById(request); if (stock.isPresent()) { return ResponseEntity.ok(stock); } else { return ResponseEntity.ok(null); } } @PreAuthorize("hasRole('ADMIN')") @PostMapping(value = "updateCompany") public ResponseEntity<Company> updateCompany( @RequestBody Company request) { Optional<Company> stock = service.getById(request); if (stock.isPresent()) { Company company = service.insertCompany(request); company.setCompanyName(request.getCompanyName()); company.setRegistrationDate(request.getRegistrationDate()); return ResponseEntity.ok(company); } return ResponseEntity.ok(null); } @PreAuthorize("hasRole('ADMIN')") @PostMapping(value = "deleteCompany") public ResponseEntity<?> deleteCompany(@RequestBody Company request){ Optional<Company> stock = service.getById(request); if(stock.isPresent()) { service.deleteCompany(request); return ResponseEntity.ok("Company deleted!"); } else { return ResponseEntity.ok("Record doesn't exist !"); } } /* Pagination */ @GetMapping(value = "/getPaged") public ResponseEntity<List<Company>> getPagedCompany( @RequestParam(defaultValue = "0") Integer pageNo, @RequestParam(defaultValue = "10") Integer pageSize) { List<Company> list = service.getPagedCompany(pageNo, pageSize); return new ResponseEntity<List<Company>>(list, new HttpHeaders(), HttpStatus.OK); } /* Pagination with order*/ @GetMapping(value = "/getPagedWithOrder") public ResponseEntity<List<Company>> getPagedCompany( @RequestParam(defaultValue = "0") Integer pageNo, @RequestParam(defaultValue = "10") Integer pageSize, @RequestParam(defaultValue = "id") String sortBy) { List<Company> list = service.getPagedCompanyWithOrder(pageNo, pageSize, sortBy); return new ResponseEntity<List<Company>>(list, new HttpHeaders(), HttpStatus.OK); } }
package data.playerdata; import java.awt.Image; import java.awt.Toolkit; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; import java.util.HashMap; import dataservice.playerdataservice.PlayerDataService; import po.PlayerPO; public class PlayerData_old { Toolkit toolkit = Toolkit.getDefaultToolkit(); HashMap<String,PlayerPO> allData ; //init the dataSource public PlayerData_old() { } //获得所有的球员数据 public HashMap<String,PlayerPO> getAllPlayerData() { if(allData==null) allData=readAll(); return allData; } public PlayerPO getOnePlayerData(String playerName) { if(allData==null) allData=readAll(); return allData.get(playerName); } // 得到文件目录下的所有子目录 private File[] getAllFile(File f) { File[] paths = null; if (f.isDirectory()) paths = f.listFiles(); return paths; } // 读出所有球员的信息 private HashMap<String,PlayerPO> readAll() { HashMap<String,PlayerPO> allPlayerData = new HashMap<String,PlayerPO>(); File[] info = getAllFile(new File("data\\players\\info\\")); for (int i = 0; i < info.length; i++) { PlayerPO playerPO = readOne(info[i]); allPlayerData.put(playerPO.getName(), playerPO); } return allPlayerData; } // 读出单个球员的信息 private PlayerPO readOne(File filename) { PlayerPO playerPO = null; Image action = null; Image portrait=null; try { BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(filename),"UTF-8")); int i = 0; String line = null; int m = 0; String [] usingStr = new String[18];; while ((line = br.readLine()) != null) { i++; if (i % 2 != 0) continue; String [] lines = line.split("[│\t\n║\r]"); for (int j = 0; j < lines.length; j++ ) { if (!lines[j].equals("")) { usingStr[m] = lines[j]; ++m; } } } String name = usingStr[1]; String numStr = usingStr[3]; int number = -1; if (!numStr.equals("N/A")) number = Integer.parseInt(numStr); char position = usingStr[5].charAt(0); String [] heights = usingStr[7].split("-"); int heightfeet = Integer.parseInt(heights[0]); int heightinch = Integer.parseInt(heights[1]); int weight = Integer.parseInt(usingStr[9]); String birth = usingStr[11]; String ageStr = usingStr[13]; int age = Integer.parseInt(usingStr[13]); String ballAge = usingStr[15]; int exp = 0; if (!ballAge.equals("R")) exp = Integer.parseInt(usingStr[15]); String school = usingStr[17]; //读取两张图片 String [] imagePaths = filename.toString().split("\\\\"); try { action = toolkit.getImage(imagePaths[0]+"/"+imagePaths[1]+"/"+"action"+"/"+imagePaths[3]+".png"); }catch (Exception e){ e.printStackTrace(); } try{ portrait = toolkit.getImage(imagePaths[0]+"/"+imagePaths[1]+"/"+"portrait"+"/"+imagePaths[3]+".png"); }catch (Exception e) { e.printStackTrace(); } playerPO = new PlayerPO(action,portrait,name,number,String.valueOf(position),heightfeet,heightinch,weight,birth,age,exp,school); br.close(); return playerPO; }catch (Exception e){e.printStackTrace();} return null; } }
package com.capitalone.socialApiFb; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class SocialApiFbApplication { public static void main(String[] args) { SpringApplication.run(SocialApiFbApplication.class, args); } }
/* * 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 Modelo; import java.io.Serializable; /** * * @author alexeik */ public class Grupo implements Serializable{ private int idGrupo; private String salon; private int idCarrera; private int idMaestro; public Grupo(int idGrupo, String salon, int idCarrera, int idMaestro) { this.idGrupo = idGrupo; this.salon = salon; this.idCarrera = idCarrera; this.idMaestro = idMaestro; } public int getIdGrupo() { return idGrupo; } public void setIdGrupo(int idGrupo) { this.idGrupo = idGrupo; } public String getSalon() { return salon; } public void setSalon(String salon) { this.salon = salon; } public int getIdCarrera() { return idCarrera; } public void setIdCarrera(int idCarrera) { this.idCarrera = idCarrera; } public int getIdMaestro() { return idMaestro; } public void setIdMaestro(int idMaestro) { this.idMaestro = idMaestro; } }
package com.limegroup.gnutella.gui.search.tests; import com.frostwire.JsonEngine; public class SignedMessage { public final byte[] unsignedData; public final byte[] signature; public final String base32DataString; public SignedMessage() { unsignedData = null; signature = null; base32DataString = null; } public SignedMessage(final byte[] unsignedData, final byte[] signature) { this.unsignedData = unsignedData; this.signature = signature; this.base32DataString = Base32.encode(unsignedData); } /** * Returns the JSON String that represents this object converted to bytes. * @return */ public byte[] toBytes() { return new JsonEngine().toJson(this).getBytes(); } /** * * @param json * @return */ public static SignedMessage fromBytes(byte[] jsonBytes) { String json = new String(jsonBytes); return new JsonEngine().toObject(json, SignedMessage.class); } }
/* * Copyright 2008-2009 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 com.stk123.common.db.util; import lombok.extern.apachecommons.CommonsLog; import java.io.*; import java.net.Socket; import java.sql.*; @CommonsLog public class CloseUtil { /** * 关闭给定的输入流. <BR> * @param inStream */ public static void close(InputStream inStream) { if (inStream != null) { try { inStream.close(); } catch (IOException e) { log.error("error on close the inputstream.", e); } } } /** * 关闭给定的输出流. <BR> * @param outStream */ public static void close(OutputStream outStream) { if (outStream != null) { try { outStream.close(); } catch (IOException e) { log.error("error on close the outputstream.", e); } } } /** * 关闭给定的输出流. <BR> * @param writer */ public static void close(Writer writer) { if (writer != null) { try { writer.close(); } catch (IOException e) { log.error("error on close the outputstream.", e); } } } /** * 关闭给定的Socket. * @param socket 给定的Socket */ public static void close(Socket socket) { if (socket != null) { try { socket.close(); } catch (IOException e) { log.error("fail on close socket: " + socket, e); } } } public static void close(Reader reader) { if (reader != null) { try { reader.close(); } catch (IOException e) { log.error("error on close the Reader.", e); } } } public static void close(Connection conn) { if (conn != null) { try { conn.close(); conn = null; } catch (Exception e) { log.error("error on close java.sql.Connection.", e); } } } public static void close(PreparedStatement ps) { if (ps != null) { try { ps.close(); } catch (Exception e) { log.error("error on close java.sql.PreparedStatement.", e); } } } public static void close(ResultSet rs) { if (rs != null) { try { rs.close(); } catch (Exception e) { log.error("error on close java.sql.ResultSet.", e); } } } public static void close(Statement st) { if(st != null){ try { st.close() ; } catch (SQLException e) { log.error("error on close java.sql.Statement.", e); } } } }
package com.sai.one.algorithms.arrays; import java.util.HashMap; import java.util.Stack; /** * Created by shravan on 30/8/16. * http://www.programcreek.com/2012/12/leetcode-valid-parentheses-java/ */ public class ValidParanthesis { public static void main(String[] args) { System.out.print(isValid("]")); } public static boolean isValid(String s) { Stack<Character> st = new Stack<Character>(); HashMap<Character, Character> map = new HashMap<Character, Character>(); map.put('(', ')'); map.put('[', ']'); map.put('{', '}'); for (int i = 0; i < s.length(); i++) { if (map.containsKey(s.charAt(i))) { st.push(s.charAt(i)); } else if (!st.isEmpty()) { char tmp = st.pop(); if (s.charAt(i) != map.get(tmp)) { return false; } } else { return false; } } return st.isEmpty(); } }
package org.jamesgames.easysprite.physics.simple; import org.jamesgames.easysprite.sprite.Sprite; /** * SimpleShapeCollisionDetection is a class that provides a static interface to detect a {@link * SimpleCollisionDirection} between two rectangles, and from what general direction the collision came from. The class * also provides other useful but basic methods for collisions between two Sprites. * * @author James Murphy */ public class SimpleShapeCollisionDetection { /** * Determines if there is a collision between two rectangles and if so from what general direction. Direction is * described in what part of rectangle One that Rectangle Two "hit", so if rectangle One is intersecting Rectangle * Two and rectangle One appears to be more above rectangle Two then it is to the side of rectangle two, then * from_bottom would be returned. If the collision came equally on a corner of two sprites, then this method favors * side collisions and will return either from_left or from_right. * * @return If there is a collision and if so the direction of the collision */ public static SimpleCollisionDirection detectCollisionOfTwoRectangles(int xOne, int yOne, int widthOne, int heightOne, int xTwo, int yTwo, int widthTwo, int heightTwo) { if (widthOne <= 0 || heightOne <= 0 || widthTwo <= 0 || heightTwo <= 0) { return SimpleCollisionDirection.no_collision; } // check if the two sprites' boundaries intersect if (xOne < xTwo + widthTwo && xTwo < xOne + widthOne && yOne < yTwo + heightTwo && yTwo < yOne + heightOne) { int numberOfUnitsSharedInXAxis = calculateUnitsSharedAlongAxis(xOne, widthOne, xTwo, widthTwo); int numberOfUnitsSharedInYAxis = calculateUnitsSharedAlongAxis(yOne, heightOne, yTwo, heightTwo); if (numberOfUnitsSharedInXAxis > numberOfUnitsSharedInYAxis) { // Intersection of two came from more of a y direction return yOne < yTwo ? SimpleCollisionDirection.from_bottom : SimpleCollisionDirection.from_top; } else { // Intersection of two came from more of a x direction return xOne < xTwo ? SimpleCollisionDirection.from_right : SimpleCollisionDirection.from_left; } } return SimpleCollisionDirection.no_collision; } private static int calculateUnitsSharedAlongAxis(int axisCoordOne, int axisLengthOne, int axisCoordTwo, int axisLengthTwo) { boolean isARectangleFullyInTheOtherAlongXAxis = (axisCoordOne < axisCoordTwo && axisCoordOne + axisLengthOne > axisCoordTwo + axisLengthTwo) || (axisCoordTwo < axisCoordOne && axisCoordTwo + axisLengthTwo > axisCoordOne + axisLengthOne); if (isARectangleFullyInTheOtherAlongXAxis) { return Math.min(axisLengthOne, axisLengthTwo); } else { boolean rectOneIsLeftOfRectTwo = axisCoordOne < axisCoordTwo; return rectOneIsLeftOfRectTwo ? (axisCoordOne + axisLengthOne) - axisCoordTwo : (axisCoordTwo + axisLengthTwo) - axisCoordOne; } } public static void moveSpritesOffOfCollidingSprite(Sprite sprite, Sprite potentialCollidingSprite, SimpleCollisionDirection collision) { switch (collision) { case no_collision: break; case from_right: sprite.setXCoordinateTopLeft(potentialCollidingSprite.getOldXCoordinateTopLeft() - sprite.getWidth()); break; case from_left: sprite.setXCoordinateTopLeft( potentialCollidingSprite.getOldXCoordinateTopLeft() + potentialCollidingSprite.getWidth()); break; case from_bottom: sprite.setYCoordinateTopLeft(potentialCollidingSprite.getOldYCoordinateTopLeft() - sprite.getHeight()); break; case from_top: sprite.setYCoordinateTopLeft( potentialCollidingSprite.getOldYCoordinateTopLeft() + potentialCollidingSprite.getHeight()); break; } } /** * Reverses velocities if needed on a collision of two sprites. If both sprites were travelling in the same * direction, only the faster of the two sprites has the velocity changed. * * @param sprite * The sprite that had a collision, whom the direction corresponds to * @param collidingSprite * The other sprite that the main sprite collided with * @param direction * The direction in relation to the main sprite that the collision (other sprite) came from */ public static void changeVelocitiesIfNeededOnCollision(Sprite sprite, Sprite collidingSprite, SimpleCollisionDirection direction) { if (chasedCollidingSpriteFromLeftOrRight(sprite, collidingSprite, direction) || direction.isRightOrLeftDirection() && xVelocitiesBothDifferentDirections(sprite, collidingSprite)) { sprite.setXVelocity(-sprite.getXVelocity()); } else if (chasedCollidingSpriteFromBelowOrAbove(sprite, collidingSprite, direction) || direction.isTopOrBottomDirection() && yVelocitiesBothDifferentDirections(sprite, collidingSprite)) { sprite.setYVelocity(-sprite.getYVelocity()); } } /** * Reverses velocities if needed on a collision of two sprites, tries to transfer velocities from a faster sprite to * a slower sprite if the faster sprite hit the slower sprite where both sprites were traveling in the same * direction. * * @param sprite * The sprite that had a collision, whom the direction corresponds to * @param collidingSprite * The other sprite that the main sprite collided with * @param direction * The direction in relation to the main sprite that the collision (other sprite) came from */ public static void changeVelocitiesWithMomentumTransferIfNeededOnCollision(Sprite sprite, Sprite collidingSprite, SimpleCollisionDirection direction) { // Sprite chased (x direction) if (chasedCollidingSpriteFromLeftOrRight(sprite, collidingSprite, direction)) { // Flip the velocity, but only go half as fast (other half transferred to the other sprite, for when it // calls this method sprite.setXVelocity(-(sprite.getOldXVelocity() / 2)); } // Sprite was chased (x direction) else if (chasedCollidingSpriteFromLeftOrRight(collidingSprite, sprite, direction.oppositeDirection())) { // Add some of the velocity from the previous sprite sprite.setXVelocity(sprite.getOldXVelocity() + (collidingSprite.getOldXVelocity() / 2)); } // Neither sprite chased (x direction) else if (direction.isRightOrLeftDirection() && xVelocitiesBothDifferentDirections(sprite, collidingSprite)) { sprite.setXVelocity(-sprite.getOldXVelocity()); } // Sprite chased (y direction) else if (chasedCollidingSpriteFromBelowOrAbove(sprite, collidingSprite, direction)) { sprite.setYVelocity(-(sprite.getOldYVelocity() / 2)); } // Sprite was chased (y direction) else if (chasedCollidingSpriteFromBelowOrAbove(collidingSprite, sprite, direction.oppositeDirection())) { sprite.setYVelocity(sprite.getOldYVelocity() + (collidingSprite.getOldYVelocity() / 2)); } // Neither sprite chased (y direction) else if (direction.isTopOrBottomDirection() && yVelocitiesBothDifferentDirections(sprite, collidingSprite)) { sprite.setYVelocity(-sprite.getOldYVelocity()); } } private static boolean chasedCollidingSpriteFromLeftOrRight(Sprite s, Sprite collidingS, SimpleCollisionDirection direction) { return direction.isRightOrLeftDirection() && ((xVelocitiesBothPositive(s, collidingS) && direction == SimpleCollisionDirection.from_right) || (xVelocitiesBothNegative(s, collidingS) && direction == SimpleCollisionDirection.from_left)); } private static boolean chasedCollidingSpriteFromBelowOrAbove(Sprite s, Sprite collidingS, SimpleCollisionDirection direction) { return direction.isTopOrBottomDirection() && ((yVelocitiesBothPositive(s, collidingS) && direction == SimpleCollisionDirection.from_bottom) || (yVelocitiesBothNegative(s, collidingS) && direction == SimpleCollisionDirection.from_top)); } private static boolean xVelocitiesBothPositive(Sprite a, Sprite b) { return a.getOldXVelocity() > 0 && b.getOldXVelocity() > 0; } private static boolean xVelocitiesBothNegative(Sprite a, Sprite b) { return a.getOldXVelocity() < 0 && b.getOldXVelocity() < 0; } private static boolean yVelocitiesBothPositive(Sprite a, Sprite b) { return a.getOldYVelocity() > 0 && b.getOldYVelocity() > 0; } private static boolean yVelocitiesBothNegative(Sprite a, Sprite b) { return a.getOldYVelocity() < 0 && b.getOldYVelocity() < 0; } private static boolean xVelocitiesBothDifferentDirections(Sprite a, Sprite b) { return (a.getOldXVelocity() >= 0 && b.getOldXVelocity() <= 0) || (a.getOldXVelocity() <= 0 && b.getOldXVelocity() >= 0); } private static boolean yVelocitiesBothDifferentDirections(Sprite a, Sprite b) { return (a.getOldYVelocity() >= 0 && b.getOldYVelocity() <= 0) || (a.getOldYVelocity() <= 0 && b.getOldYVelocity() >= 0); } }
/****************************************************************************** * __ * * <-----/@@\-----> * * <-< < \\// > >-> * * <-<-\ __ /->-> * * Data / \ Crow * * ^ ^ * * info@datacrow.net * * * * This file is part of Data Crow. * * Data Crow is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public * * License as published by the Free Software Foundation; either * * version 3 of the License, or any later version. * * * * Data Crow is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * See the GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public * * License along with this program. If not, see http://www.gnu.org/licenses * * * ******************************************************************************/ package net.datacrow.core.db; import java.io.File; import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; import java.util.List; import net.datacrow.core.DataCrow; import net.datacrow.core.DcRepository; import net.datacrow.core.modules.DcModule; import net.datacrow.core.modules.DcModules; import net.datacrow.core.objects.DcField; import net.datacrow.core.objects.DcMapping; import net.datacrow.core.objects.DcObject; import net.datacrow.core.objects.Loan; import net.datacrow.core.objects.Picture; import net.datacrow.util.Utilities; import org.apache.log4j.Logger; public class DeleteQuery extends Query { private final static Logger logger = Logger.getLogger(DeleteQuery.class.getName()); private DcObject dco; public DeleteQuery(DcObject dco) throws SQLException { super(dco.getModule().getIndex(), dco.getRequests()); this.dco = dco; } @Override protected void clear() { super.clear(); dco = null; } @SuppressWarnings("resource") @Override public List<DcObject> run() { boolean success = false; Connection conn = null; Statement stmt = null; try { conn = DatabaseManager.getAdminConnection(); stmt = conn.createStatement(); if (!dco.hasPrimaryKey()) { String sql = "DELETE FROM " + dco.getTableName() + " WHERE "; int counter = 0; boolean isString; for (DcField field : dco.getFields()) { isString = field.getValueType() == DcRepository.ValueTypes._STRING || field.getValueType() == DcRepository.ValueTypes._DATETIME || field.getValueType() == DcRepository.ValueTypes._DATE; if ( dco.isChanged(field.getIndex()) && !field.isUiOnly() && !Utilities.isEmpty(dco.getValue(field.getIndex()))) { sql += counter == 0 ? "" : " AND "; sql += field.getDatabaseFieldName() + " = "; sql += isString ? "'" : ""; sql += String.valueOf(Utilities.getQueryValue(dco.getValue(field.getIndex()), field)).replaceAll("\'", "''"); sql += isString ? "'" : ""; counter++; } } stmt.execute(sql); try { if (stmt != null) stmt.close(); } catch (SQLException e) { logger.error("Error while closing connection", e); } } else { stmt.execute("DELETE FROM " + dco.getTableName() + " WHERE ID = '" + dco.getID() + "'"); if (dco.getModule().canBeLend()) { stmt.execute("DELETE FROM " + DcModules.get(DcModules._LOAN).getTableName() + " WHERE " + DcModules.get(DcModules._LOAN).getField(Loan._D_OBJECTID).getDatabaseFieldName() + " = '" + dco.getID() + "'"); } // Delete children. Ignore any abstract module (parent and/or children) if ( dco.getModule().getChild() != null && !dco.getModule().isAbstract() && !dco.getModule().getChild().isAbstract()) { DcModule childModule = dco.getModule().getChild(); stmt.execute("DELETE FROM " + childModule.getTableName() + " WHERE " + childModule.getField(childModule.getParentReferenceFieldIndex()).getDatabaseFieldName() + " = '" + dco.getID() + "'"); } // Remove any references to the to be deleted item. if (dco.getModule().hasDependingModules()) { for (DcModule m : DcModules.getReferencingModules(dco.getModule().getIndex())) { if (m.isAbstract()) continue; if (m.getType() == DcModule._TYPE_MAPPING_MODULE) { stmt.execute("DELETE FROM " + m.getTableName() + " WHERE " + m.getField(DcMapping._B_REFERENCED_ID).getDatabaseFieldName() + " = '" + dco.getID() + "'"); } else { for (DcField field : m.getFields()) { if (!field.isUiOnly() && field.getReferenceIdx() == dco.getModule().getIndex()) { stmt.execute("UPDATE " + m.getTableName() + " SET " + field.getDatabaseFieldName() + " = NULL WHERE " + field.getDatabaseFieldName() + " = '" + dco.getID() + "'"); } } } } } File file; boolean deleted; for (DcField field : dco.getFields()) { if (field.getValueType() == DcRepository.ValueTypes._PICTURE) { file = new File(DataCrow.imageDir, dco.getID() + "_" + field.getDatabaseFieldName() + ".jpg"); if (file.exists()) { deleted = file.delete(); logger.debug("Delete file " + file + " [success = " + deleted + "]"); } file = new File(DataCrow.imageDir, dco.getID() + "_" + field.getDatabaseFieldName() + "_small.jpg"); if (file.exists()) { deleted = file.delete(); logger.debug("Delete file " + file + " [success = " + deleted + "]"); } } if (field.getValueType() == DcRepository.ValueTypes._DCOBJECTCOLLECTION) { DcModule m = DcModules.get(DcModules.getMappingModIdx(field.getModule(), field.getReferenceIdx(), field.getIndex())); stmt.execute("DELETE FROM " + m.getTableName() + " WHERE " + m.getField(DcMapping._A_PARENT_ID).getDatabaseFieldName() + " = '" + dco.getID() + "'"); } } stmt.execute("DELETE FROM " + DcModules.get(DcModules._PICTURE).getTableName() + " WHERE " + DcModules.get(DcModules._PICTURE).getField(Picture._A_OBJECTID).getDatabaseFieldName() + " = '" + dco.getID() + "'"); success = true; } } catch (SQLException se) { logger.error(se, se); } try { if (stmt != null) stmt.close(); } catch (SQLException e) { logger.error("Error while closing connection", e); } handleRequest(success); return null; } @Override protected void finalize() throws Throwable { clear(); super.finalize(); } }
package com.santander.exception; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseStatus; import java.io.IOException; @SuppressWarnings("serial") @ControllerAdvice @Component @Order(Ordered.HIGHEST_PRECEDENCE) public class ControllerErrorMapper { //private static final long serialVersionUID = 1L; @Autowired ErrorResponse error ; @ExceptionHandler(ErrorResponse.class) public ResponseEntity<ErrorResponse> exceptionHandler(ErrorResponse ex) { HttpStatus status; switch(ex.getErrorCode()) { case 1000 : status = HttpStatus.NOT_FOUND; break; case 1001 : status = HttpStatus.BAD_REQUEST; break; case 1003 : status = HttpStatus.NO_CONTENT; break; default : status = HttpStatus.BAD_REQUEST; } return new ResponseEntity(ex,status); } @ExceptionHandler(Exception.class) public ResponseEntity<ErrorResponse> handleInternalServerError(Exception ex) { return new ResponseEntity(new ErrorResponse(1002,"Error occured!"),HttpStatus.INTERNAL_SERVER_ERROR); } public ErrorResponse getError() { return error; } public void setError(ErrorResponse error) { this.error = error; } }
package loecraftpack.common.potions; import loecraftpack.ponies.abilities.AbilityPlayerData; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.Potion; public class PotionEnergy extends Potion { /*bad: FALSE*/ public PotionEnergy(int potionID, boolean bad, int color) { super(potionID, bad, color); } public void performEffect(EntityLiving entityLiving, int level) { System.out.println("Surge"); if (entityLiving instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)entityLiving; AbilityPlayerData abilityData = AbilityPlayerData.Get(player.username); if (player.worldObj.isRemote) { abilityData.restoreOrDrainEnergy(100*level); } else abilityData.addEnergy(100*level, false); } } @Override public boolean isInstant() { return true; } @Override public boolean isUsable() { return true; } @Override public boolean isReady(int par1, int par2) { return par1 >= 20; } }
package ForLoop; //input any number and print table of it. import java.util.Scanner; public class Table { public static void main(String[] args) { // TODO Auto-generated method stub Scanner s=new Scanner(System.in); int n; System.out.println("Enter any number"); n=s.nextInt(); for(int i=1;i<=12;i++) { System.out.println(n*i); } } }
package io.github.ihongs.serv.master; import io.github.ihongs.Cnst; import io.github.ihongs.Core; import io.github.ihongs.HongsException; import io.github.ihongs.action.ActionHelper; import io.github.ihongs.db.DB; import io.github.ihongs.db.Grade; import io.github.ihongs.db.Table; import io.github.ihongs.db.util.FetchCase; import io.github.ihongs.serv.auth.AuthKit; import io.github.ihongs.util.Synt; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; /** * 部门基础信息树模型 * @author Hongs */ public class Dept extends Grade { public Dept() throws HongsException { this(DB.getInstance("master").getTable("dept")); } public Dept(Table table) throws HongsException { super(table); } @Override public String add(Map data) throws HongsException { permit(null, data); return super.add(data); } @Override public int put(String id, Map data) throws HongsException { permit( id , data); return super.put(id, data); } @Override public int del(String id, FetchCase caze) throws HongsException { permit( id , null); return super.del(id, caze); } @Override public Map getList(Map rd, FetchCase caze) throws HongsException { if (caze == null) { caze = new FetchCase(); } Map sd = super.getList(rd, caze); // 管辖范围限制标识: 0 一般用户, 1 管理员, 2 管理层 if (Synt.declare(rd.get("bind-scope"), false )) { sd.put("scope", caze.getOption("SCOPE", 0)); } return sd; } @Override protected void filter(FetchCase caze, Map req) throws HongsException { /** * 非超级管理员或在超级管理组 * 限制查询为当前管辖范围以内 */ if (Synt.declare (req.get("bind-scope"), false)) { ActionHelper helper = Core.getInstance(ActionHelper.class); String mid = (String) helper.getSessibute ( Cnst.UID_SES ); String pid = Synt.declare(req.get("pid"),""); if (!Cnst.ADM_UID.equals( mid )) { Set set = AuthKit.getUserDepts(mid); if (!set.contains(Cnst.ADM_GID)) { if ("0".equals( pid )) { set = AuthKit.getLessDepts(set); req.remove( "pid" ); req.put( "id", set); } else { set = AuthKit.getMoreDepts(set); if (! set.contains( pid ) ) // 有则不必限制 req.put( "id", set); } } else caze.setOption("SCOPE" , 2 ); } else caze.setOption("SCOPE" , 1 ); } /** * 如果有指定 user_id * 则关联 a_master_dept_user 来约束范围 * 当其为横杠时表示取那些没有关联的部门 */ Object uid = req.get("user_id"); if (null != uid && ! "".equals(uid)) { if ( "-".equals (uid)) { caze.gotJoin("users") .from ("a_master_dept_user") .by (FetchCase.INNER) .on ("`users`.`dept_id` = `dept`.`id`") .filter ("`users`.`user_id` IS NULL" /**/ ); } else { caze.gotJoin("users") .from ("a_master_dept_user") .by (FetchCase.INNER) .on ("`users`.`dept_id` = `dept`.`id`") .filter ("`users`.`user_id` IN (?)" , uid ); } } super.filter(caze, req); } protected void permit(String id, Map data) throws HongsException { String pid = null; if (data != null) { // 上级部门 pid = (String) data.get ("pid"); if (pid == null || pid.equals("")) { data.remove("pid"); pid = null; } // 权限限制, 仅能赋予当前登录用户所有的权限 if (data.containsKey("roles")) { data.put("rtime", System.currentTimeMillis() / 1000); List list = Synt.asList(data.get( "roles" )); AuthKit.cleanDeptRoles (list, id); // if ( list.isEmpty() ) { // throw new HongsException(400) // .setLocalizedContent("master.user.dept.error") // .setLocalizedContext("master"); // } data.put("roles", list); } } else { List list ; Table tablx = db.getTable("dept_user"); // 删除限制, 如果部门下有部门则中止当前操作 list = table.fetchCase() .filter("pid = ? AND state > ?", id, 0 ) .limit (1) .getAll( ); if (!list.isEmpty() ) { throw new HongsException(400) .setLocalizedContent("master.dept.have.depts") .setLocalizedContext("master"); } // 删除限制, 如果部门下有用户则中止当前操作 list = tablx.fetchCase() .filter("dept_id = ?", id) .limit (1) .getAll( ); if (!list.isEmpty() ) { throw new HongsException(400) .setLocalizedContent("master.dept.have.users") .setLocalizedContext("master"); } } if (id == null && pid == null) { throw new NullPointerException("id and pid cannot be all null"); } if (id != null || pid != null) { // 超级管理员可操作任何部门 ActionHelper helper = Core.getInstance(ActionHelper.class); String uid = (String) helper.getSessibute ( Cnst.UID_SES ); if (Cnst.ADM_UID.equals(uid )) { return; } // 超级管理组可操作任何部门 // 但禁止操作顶级部门 Set cur = AuthKit.getUserDepts(uid); if (cur.contains(Cnst.ADM_GID) && !Cnst.ADM_GID.equals( id )) { return; } // 仅可以操作下级部门 for (Object gid : cur) { Set cld = new HashSet(this.getChildIds((String) gid, true)); if ( null != pid && (gid. equals(pid) || cld.contains(pid))) { return; } if ( null != id && cld.contains( id) ) { return; } } throw new HongsException(400) .setLocalizedContent("master.dept.unit.error") .setLocalizedContext("master"); } } }
public class TestaValores { public static void main(String[] args) { Conta conta = new Conta(5648, 6594); // tratamos comportamentos com 0 e null nos numeros da conta System.out.println(conta.getAgencia()); System.out.println(conta.getNumero()); Conta conta2 = new Conta(5648, 5656); Conta conta3 = new Conta(95959, 6564); // pedir o numero das contas pelo nome da classe System.out.println(Conta.getTotal()); } }
package com.dummy.dummydmanagement.controllers; import com.dummy.dummydmanagement.model.Item; import com.dummy.dummydmanagement.service.ItemService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import static com.dummy.dummydmanagement.constants.ItemConstants.ITEM_END_POINT_V1; @RestController public class ItemController { private static final Logger logger = LoggerFactory.getLogger(ItemController.class); @Autowired private ItemService itemService; @GetMapping(ITEM_END_POINT_V1) public Flux<Item> getAllItems() throws Exception { logger.info("*** Inside getAllItems controller ***"); return itemService.getAllItemsService(); } @GetMapping(ITEM_END_POINT_V1+"/{id}") public Mono<Item> getOneItem(@PathVariable Integer id){ logger.info("*** Inside getOneItem controller ***"); return itemService.getOneItemService(id); } }
package demo; //import java.util.*; public class Tuplo { private String x; //nota private String y; //quantidade public Tuplo (String a) { String[] b = a.split(","); this.x = b[0]; this.y = b[1]; } public String getX() { return this.x; } public String getY() { return this.y; } }
package com.crawler.tentacle.html.getter.weibo; import java.util.Set; import org.openqa.selenium.Cookie; import org.openqa.selenium.WebElement; import org.openqa.selenium.htmlunit.HtmlUnitDriver; public class WeiboTool { public final static String URL_HTTP_HEAD = "http://"; public final static String URL_HTTPS_HEAD = "https://"; /** * Get Weibo.cn Cookie to login * * @param userName * @param passWrod * @return * @throws Exception */ public static String getSinaCookie(String userName, String passWord) throws Exception { StringBuilder sb = new StringBuilder(); HtmlUnitDriver driver = new HtmlUnitDriver(); driver.setJavascriptEnabled(true); driver.get("http://login.weibo.cn/login/"); WebElement mobile = driver.findElementByCssSelector("input[name=mobile]"); mobile.sendKeys(userName); WebElement pass = driver.findElementByCssSelector("input[name^=password]"); pass.sendKeys(passWord); WebElement rem = driver.findElementByCssSelector("input[name=remember]"); rem.click(); WebElement submit = driver.findElementByCssSelector("input[name=submit]"); submit.click(); Set<Cookie> cookieSet = driver.manage().getCookies(); driver.close(); for (Cookie cookie : cookieSet) { sb.append(cookie.getName() + "=" + cookie.getValue() + ";"); } String result = sb.toString(); if (result.contains("_T_WM")) { return result; } else { throw new Exception("Weibo login Failed~" + result); } } /** * Make cookie String from input String * * @param input * @return */ public static String makeCookie(String input) { String[] items = input.split(","); StringBuilder sb = new StringBuilder(); for (int i = 0; i < items.length / 2; i++) { sb.append(items[i * 2] + "=" + items[i * 2 + 1] + ";"); } return sb.toString(); } /** * Get MainDomain of input url; input url need to be full url * * @param fullUrl * @return */ public static String getDomain(String fullUrl) { int pos = fullUrl.indexOf(URL_HTTP_HEAD);// + "http://".length(); if (pos < 0) { pos = fullUrl.indexOf(URL_HTTPS_HEAD); if (pos < 0) { return ""; } else { pos += URL_HTTPS_HEAD.length(); } } else { pos += URL_HTTP_HEAD.length(); } int end = fullUrl.indexOf("/", pos); if (end < 0) { end = fullUrl.length(); } return fullUrl.substring(pos, end); } }
package com.petclinicspring.com.services; import com.petclinicspring.com.models.Pet; public interface PetService extends CrudService<Pet, Long>{ }
package com.dodoca.create_image.service.impl; import com.dodoca.create_image.exception.MyServiceException; import com.dodoca.create_image.service.QRCodeCreateService; import com.dodoca.create_image.utils.QRCodeGenerator; import com.google.zxing.WriterException; import com.google.zxing.client.j2se.MatrixToImageWriter; import com.google.zxing.common.BitMatrix; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * @description: * @author: tianguanghui * @create: 2019-07-03 14:01 **/ @Service public class QRCodeCreateServiceImpl implements QRCodeCreateService { private static final Logger logger = LoggerFactory.getLogger(QRCodeCreateServiceImpl.class); @Value("${QRCode_image_dir}") String QRCodeImageDir; @Override public String generateQRCodeImage(String QRCodeContent) { logger.info("generateQRCodeImage >>> QRCodeContent:{}", QRCodeContent); try { String filePath = QRCodeImageDir + "222.jpg"; //根据具体业务设二维码名称和大小 QRCodeGenerator.generateQRCodeImage(QRCodeContent, 350, 350, "jpg", filePath); return filePath; } catch (WriterException | IOException e) { logger.error(e.getMessage(), e); throw new MyServiceException("生成二维码异常", 1011); } } @Override public void generateQRCodeStream(String content, HttpServletResponse response) { try { QRCodeGenerator.generateQRCodeImageStream(content, 350, 350, response); } catch (WriterException e) { logger.error(e.getMessage(), e); throw new MyServiceException("生成二维码异常", 1011); } catch (IOException e) { logger.error(e.getMessage(), e); throw new MyServiceException("将二维码写入响应体异常", 1012); } } }
package opendict.dictionary.longman.response; /** * Created by baoke on 21/12/2016. */ public class Pronunciation implements opendict.common.Pronunciation { public Audio[] audio; public String ipa; public String lang; @Override public opendict.common.Audio getAudio() { if (audio == null) return null; else return audio[0]; } @Override public String getIPA() { return ipa; } }
package com.dollarsbank.model; public class Transaction { private int transactionId; private int accountId; private String description; private static int historyId; public Transaction(int transactionId, int accountId, String description) { super(); if (transactionId > historyId) { historyId = transactionId; } this.transactionId = transactionId; this.accountId = accountId; this.description = description; } public int getTransactionId() { return transactionId; } public void setTransactionId(int transactionId) { this.transactionId = transactionId; } public int getAccountId() { return accountId; } public void setAccountId(int accountId) { this.accountId = accountId; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public static int generateTransactionId() { return ++historyId; } @Override public String toString() { return "[TransactionId= " + getTransactionId() + ", AccountId= " + getAccountId() + ", Description= " + getDescription() + "]"; } }
package com.meizu.scriptkeeper.schedule.monkey; import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONType; /** * Author: jinghao * Date: 2015-03-24 * Package: com.meizu.anonymous.utils.json.schedule.monkey */ @JSONType(orders = {"crash_type", "stamp", "length", "screenshot"}, asm = false) public class MonkeyCrash { @JSONField(name = "crash_type") private int type; @JSONField(name = "screenshot") private String name; @JSONField(name = "stamp") private long stamp; @JSONField(name = "length") private long length; public int getType() { return type; } public void setType(int type) { this.type = type; } public String getName() { return name; } public void setName(String name) { this.name = name; } public long getStamp() { return stamp; } public void setStamp(long stamp) { this.stamp = stamp; } public long getLength() { return length; } public void setLength(long length) { this.length = length; } }
package projecteuler; import java.io.IOException; public class CoinSums { public static void main(String args[]) throws IOException { /* # the 8 coins correspond to 8 columns */ int[] coins = { 1, 2, 5, 10, 20, 50, 100, 200 }; int[][] waysmatrix = new int[201][8]; for (int i = 0; i <= 200; i++) { waysmatrix[i][0] = 1; } for (int i = 0; i <= 200; i++) { for (int j = 1; j < coins.length; j++) { waysmatrix[i][j] = 0; /* Is the target big enough to accomodate coins[x]? */ if (i >= coins[j]) { /* * # If yes, then the number of ways to form the target sum * are obtained via: (a) the number of ways to form this * target using ONLY coins less than column x i.e. * matrix[y][x-1] */ waysmatrix[i][j] += waysmatrix[i][j - 1]; /* * # plus (b) the number of ways to form this target when * USING the coin of column x which means for a remainder of * y-coins[x] i.e. matrix[y-coins[x]][x] */waysmatrix[i][j] += waysmatrix[i - coins[j]][j]; } else { /* * # if the target is not big enough to allow # usage of the * coin in column x, # then just copy the number of ways * from the # column to the left (i.e. with smaller coins) */ waysmatrix[i][j] = waysmatrix[i][j - 1]; } } } for (int i = 0; i <= 200; i++) { System.out.print("target " + i + " "); for (int j = 0; j < coins.length; j++) { System.out.print(waysmatrix[i][j] + " "); } System.out.println(); } } }
/* * Copyright 2017 Lantrack Corporation All Rights Reserved. * * The source code contained or described herein and all documents related to * the source code ("Material") are owned by Lantrack Corporation or its suppliers * or licensors. Title to the Material remains with Lantrack Corporation or its * suppliers and licensors. The Material contains trade secrets and proprietary * and confidential information of Lantrack or its suppliers and licensors. The * Material is protected by worldwide copyright and trade secret laws and * treaty provisions. * No part of the Material may be used, copied, reproduced, modified, published * , uploaded, posted, transmitted, distributed, or disclosed in any way * without Lantrack's prior express written permission. * * No license under any patent, copyright, trade secret or other intellectual * property right is granted to or conferred upon you by disclosure or delivery * of the Materials, either expressly, by implication, inducement, estoppel or * otherwise. Any license under such intellectual property rights must be * express and approved by Intel in writing. * */ package net.lantrack.framework.core.importexport.excel; import java.io.File; import java.util.List; /** * excel导入导出接口 2018年2月6日 * * @author lin */ public interface ExcelService { List importExcel(Class excelModel,File excel,int startRow); boolean validateFile(Class excelModel,File excel); /** * @param modelClass 往前台返回的数据model * @param headers 导出的列 * @param datas 导出的列的数据 * @return * 2018年2月22日 * @author lin */ String export(Class modelClass, List<String> headers, List<?> datas); }
/* * 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 Indicadores; /** * * @author jluis */ public class ClassIndicador { public int codigo; public String nombre; public String depto; public String fecha; public int evaluacion; public int fase; public int getCodigo() { return codigo; } public void setCodigo(int codigo) { this.codigo = codigo; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getDepto() { return depto; } public void setDepto(String depto) { this.depto = depto; } public String getFecha() { return fecha; } public void setFecha(String fecha) { this.fecha = fecha; } public int getEvaluacion() { return evaluacion; } public void setEvaluacion(int evaluacion) { this.evaluacion = evaluacion; } public int getFase() { return fase; } public void setFase(int fase) { this.fase = fase; } }
package lab.tiyo.trigonometry.models; import android.graphics.Bitmap; import lab.tiyo.fraction.models.TNumber; /** * Created by root on 31/12/16. */ public class ItemDescriptionDialog { private String id; private String title; private Bitmap background; private String inputType; private TNumber tNumber; public static final String INPUT_LENGTH_TYPE = "input_length_type"; public static final String INPUT_CONSTANTA = "input_constanta"; public ItemDescriptionDialog(){ } public ItemDescriptionDialog(String id, String title, Bitmap background) { this.id = id; this.title = title; this.background = background; } public ItemDescriptionDialog(String id, String title, Bitmap background, String inputType) { this.id = id; this.title = title; this.background = background; this.inputType = inputType; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public Bitmap getBackground() { return background; } public void setBackground(Bitmap background) { this.background = background; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getInputType() { return inputType; } public void setInputType(String inputType) { this.inputType = inputType; } public TNumber getTNumber() { return tNumber; } public void setTNumber(TNumber tNumber) { this.tNumber = tNumber; } public boolean isBackgroundExists(){ return background != null; } }
package com.ravi.jsonb.adapter; import com.ravi.jsonb.beans.User; import javax.json.Json; import javax.json.JsonObject; import javax.json.bind.adapter.JsonbAdapter; public class CustomAdapter implements JsonbAdapter<User, JsonObject> { @Override public JsonObject adaptToJson(User user) throws Exception { JsonObject jsonObject = Json.createObjectBuilder().add("firstName", user.getFirstName()).add("lastName", user.getLastName()).build(); return jsonObject; } @Override public User adaptFromJson(JsonObject jsonObject) throws Exception { User user = new User(); if (jsonObject.getString("firstName").equals("Raveendra")) { user.setFirstName("First Name is Captured"); } if (jsonObject.getString("lastName").equals("Bikkina")) { user.setFirstName("Last Name is Captured"); } return user; } }
/** * */ /** * @author david * */ package org.valdi.st.event;
package ltd.getman.testjobproject.presentation.activities; import android.os.Bundle; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.EditText; import android.widget.ProgressBar; import android.widget.RadioGroup; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import javax.inject.Inject; import ltd.getman.testjobproject.R; import ltd.getman.testjobproject.TestJobApplication; import ltd.getman.testjobproject.domain.models.mechanizm.Data; import ltd.getman.testjobproject.domain.models.sort.BaseSortedClass; import ltd.getman.testjobproject.presentation.adapters.DataAdapter; import ltd.getman.testjobproject.presentation.presenters.MainActivityPresenter; public class MainActivity extends AppCompatActivity implements MainActivityPresenter.View { @BindView(R.id.rv_data) RecyclerView rvData; @BindView(R.id.progress) ProgressBar progressBar; @BindView(R.id.rg_sort) RadioGroup rgSortType; @BindView(R.id.et_cars_count) EditText etCarsCount; @BindView(R.id.et_planes_count) EditText etPlanesCount; @BindView(R.id.et_ships_count) EditText etShipsCount; @BindView(R.id.empty_placeholder) View emptyPlaceholder; @Inject MainActivityPresenter presenter; @Inject DataAdapter dataAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TestJobApplication.getApplicationComponent().inject(this); ButterKnife.bind(this); initContent(); } private void initContent() { rvData.setLayoutManager(new LinearLayoutManager(this)); rvData.setAdapter(dataAdapter); } @Override protected void onResume() { super.onResume(); presenter.bind(this); } @Override protected void onPause() { presenter.unbind(); super.onPause(); } @OnClick(R.id.btn_start) protected void onStartClick() { BaseSortedClass.TYPE type; switch (rgSortType.getCheckedRadioButtonId()) { case R.id.rb_bubble_sort: default: type = BaseSortedClass.TYPE.BUBBLE; break; case R.id.rb_quick_sort: type = BaseSortedClass.TYPE.QUICK; break; case R.id.rb_insertion_sort: type = BaseSortedClass.TYPE.INSERT; break; } int carsCount = Integer.valueOf(etCarsCount.getText().toString()); int planesCount = Integer.valueOf(etPlanesCount.getText().toString()); int shipsCount = Integer.valueOf(etShipsCount.getText().toString()); presenter.onLoadDataClick(type, carsCount, planesCount, shipsCount); } @Override public void showSnackbarMessage(String text) { final Snackbar snackbar = Snackbar.make(findViewById(android.R.id.content), text, Snackbar.LENGTH_LONG); snackbar.setAction(getResources().getString(R.string.okay), view -> snackbar.dismiss()); snackbar.show(); } @Override public void showProgress() { progressBar.setVisibility(View.VISIBLE); rvData.setVisibility(View.GONE); } @Override public void hideProgress() { progressBar.setVisibility(View.GONE); rvData.setVisibility(View.VISIBLE); } @Override public void showSortedData(Data data) { emptyPlaceholder.setVisibility(View.GONE); dataAdapter.setMechanizms(data); } @Override public void showEmptyList() { emptyPlaceholder.setVisibility(View.VISIBLE); rvData.setVisibility(View.GONE); } }
package cassandra; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import com.datastax.driver.core.Cluster; import com.datastax.driver.core.Host; import com.datastax.driver.core.Metadata; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Row; import com.datastax.driver.core.Session; public class CassandraConnector { /** Cassandra Cluster. */ private Cluster cluster; /** Cassandra Session. */ private Session session; /** * Connect to Cassandra Cluster specified by provided node IP address and * port number. * * @param node * Cluster node IP address. * @param port * Port of cluster host. */ public void connect() { // Connect to the cluster and keyspace "demo" cluster = Cluster.builder().addContactPoint("127.0.0.1").build(); session = cluster.connect("bigdata"); } // read data from csv and save to cassandra public void insertData() { try { FileReader fileReader = new FileReader("test.csv"); BufferedReader bufferedReader = new BufferedReader(fileReader); String line = bufferedReader.readLine(); // initialize all data records while ((line = bufferedReader.readLine()) != null) { String[] parts = line.split(","); // if (parts[0].equals("0")) // bidMean = "false"; // else // bidMean = "true"; // if (parts[1].equals("0")) // askMean = "false"; // else // askMean = "true"; // if (parts[2].equals("0")) // diff = "false"; // else // diff = "true"; // if (parts[3].equals("0")) // range = "false"; // else // range = "true"; // if (parts[4].equals("0")) // spread = "false"; // else // spread = "true"; // if (parts[5].equals("0")) // lable = "false"; // else // lable = "true"; String command = String.format( "INSERT INTO test (rid, bidMean, askMean, diff, range, spread, lable) VALUES (now(), %s, %s, %s, %s, %s, %s)", parts[0], parts[1], parts[2], parts[3], parts[4], parts[5]); session.execute(command); } bufferedReader.close(); } catch (IOException e) { e.printStackTrace(); } } /** * Provide my Session. * * @return My session. */ public Session getSession() { return this.session; } /** Close cluster. */ public void close() { cluster.close(); } /** * Main function for demonstrating connecting to Cassandra with host and * port. * * @param args * Command-line arguments; first argument, if provided, is the * host and second argument, if provided, is the port. */ public static void main(final String[] args) { final CassandraConnector client = new CassandraConnector(); client.connect(); client.insertData(); client.close(); } }
import java.io.*; import java.util.*; import static org.junit.Assert.*; import org.junit.After; import org.junit.Before; import org.junit.Test; /** * The test class LaneTest. * * @author Kody Dangtongdee * @version 1 */ public class LaneTest { @Test public void testAdd() { Lane lane = new Lane(); assertTrue(lane.add("Kat1", 2, 4)); assertFalse(lane.add("Kat1", 2, 5)); assertFalse(lane.add("ASD&ff.", 3, 4)); assertEquals(1, lane.size()); assertTrue(lane.add("Kat2", 3, 7)); } @Test public void testAddFamily() { Lane lane = new Lane(); assertFalse(lane.addToFamily("Kat1", "Kat2")); lane.add("Kat1", 1, 1); assertTrue(lane.addToFamily("Kat1", "Kat2")); assertTrue(lane.addToFamily("Kat2", "Kat4")); lane.add("Kat3", 2, 2); assertFalse(lane.addToFamily("Kat1", "Kat3")); } @Test public void testRemove() { Lane lane = new Lane(); assertFalse(lane.remove("Kat1")); lane.add("Kat1", 1, 1); assertTrue(lane.remove("Kat1")); } @Test public void testLookUp() { Lane lane = new Lane(); lane.add("Kat1", 1, 3); lane.addToFamily("Kat1", "Kat3"); assertEquals("1 3 : Kat1 Kat3", lane.lookup("Kat1")); assertTrue(lane.addToFamily("Kat3", "Kat4")); assertEquals("1 3 : Kat1 Kat3 Kat4", lane.lookup("Kat1")); } @Test public void testClear() { Lane lane = new Lane(); lane.add("Kat1", 1, 3); lane.addToFamily("Kat1", "Kat3"); assertEquals(2, lane.size()); lane.clear(); assertEquals(0, lane.size()); assertTrue(lane.isEmpty()); } @Test public void testIterator() { ArrayList<String> list = new ArrayList<String>(); Lane lane = new Lane(); lane.add("Kat1", 1, 3); lane.addToFamily("Kat1", "Kat2"); lane.addToFamily("Kat1", "Kat3"); assertEquals(" : Kat1 Kat2 Kat3", lane.iterator().next()); lane.add("Kat4", 2, 4); Iterator<String> itr = lane.iterator(); assertEquals(" : Kat1 Kat2 Kat3", itr.next()); assertEquals(" : Kat1 Kat2 Kat3 : Kat4", itr.next()); //assertEquals(" : Kat4", itr.next()); } @Test public void testCompressed() { List<String> correct = new ArrayList<String>(); correct.add(" 4 : mikey yaaX"); correct.add(" 5 : mikey yaaX : falB : axxy"); correct.add("6-7 : mikey yaXX"); Lane lane = new Lane(); lane.add("mikey", 4, 7); lane.addToFamily("mikey", "yaaX"); lane.add("falB", 5, 6); lane.add("axxy", 5, 5); List<String> test = lane.getCompressed(); int index = 0; for (String line : test) { //assertEquals(correct.get(index), line); index++; } } @Test public void testLoad() { try { Lane lane = new Lane(); lane.loadFile("meerkatFile.txt"); assertTrue(true); assertEquals(10, lane.size()); } catch (IOException e) { fail(); } try { Lane lane = new Lane(); lane.loadFile("dummy file"); fail(); } catch (IOException e) { assertTrue(true); } } @Test public void testList() { List<String> correct = new ArrayList<String>(); correct.add("a 1 2"); correct.add("b 1 2"); correct.add("cnd 1 2"); correct.add("sm7_a 5 6"); Lane lane = new Lane(); lane.add("a", 1, 2); lane.addToFamily("a", "b"); lane.addToFamily("a", "cnd"); lane.add("sm7_a", 5, 6); List<String> test = lane.listMembers(); for (int index = 0; index < correct.size(); index++) { assertEquals(correct.get(index), test.get(index)); } } @Test public void testContains() { Lane lane = new Lane(); assertFalse(lane.contains("not there")); lane.add("but oh so there", 1, 5); assertTrue(lane.contains("but oh so there")); } @Test public void testEmpty() { Lane lane = new Lane(); assertTrue(lane.isEmpty()); } }