text
stringlengths 7
1.01M
|
|---|
/*
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.debezium.junit;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Marker annotation used together with the {@link SkipTestRule} JUnit rule, that allows tests to be excluded
* from the build if they are run on certain platforms.
*
* @author Horia Chiorean
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.TYPE })
public @interface SkipOnOS {
/**
* Symbolic constant used to determine the Windows operating system, from the "os.name" system property.
*/
String WINDOWS = "windows";
/**
* Symbolic constant used to determine the OS X operating system, from the "os.name" system property.
*/
String MAC = "mac";
/**
* Symbolic constant used to determine the Linux operating system, from the "os.name" system property.
*/
String LINUX = "linux";
/**
* The list of OS names on which the test should be skipped.
*
* @return a list of "symbolic" OS names.
* @see #WINDOWS
* @see #MAC
* @see #LINUX
*/
String[] value();
/**
* An optional description which explains why the test should be skipped.
*
* @return a string which explains the reasons for skipping the test.
*/
String description() default "";
}
|
package com.guidovezzoni.mvplibrary.api;
public class Api {
// query params
public static final String QUERY_PARAM_CITY_ID = "id";
public static final String QUERY_PARAM_APP_ID = "APPID";
public static final String QUERY_PARAM_UNITS = "units";
public static final String QUERY_PARAM_UNITS_METRIC = "metric";
public static final String QUERY_PARAM_UNITS_IMPERIAL = "imperial";
// root folders
public static final String DATA = "data";
// api version
public static final String V2_5_API = "2.5";
// endpoint
public static final String FORECAST = "forecast";
// full endpoints
public static final String DATA_FORECAST = DATA + "/" + V2_5_API + "/" + FORECAST;
}
|
package it.mulders.shop.cart.repository;
import java.util.Optional;
import javax.inject.Named;
import javax.inject.Singleton;
import it.mulders.shop.cart.domain.Cart;
@Named("dapr")
@Singleton
public class DaprShoppingCartRepository implements ShoppingCartRepository {
private final DaprStateStore<Cart> carts = new DaprStateStore<>("carts", Cart.class);
@Override
public Optional<Cart> getCart(final String cartId) {
return carts.getValue(cartId);
}
@Override
public Cart storeCart(final String id, final Cart cart) {
carts.storeValue(id, cart);
return cart;
}
}
|
package com.xiaoxiao.baiduTest;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
import java.util.concurrent.TimeUnit;
public class Search {
public static WebDriver driver;
public static String baseURL="https://www.baidu.com/";
public static String string=System.setProperty("webdriver.chrome.driver","c:\\Program Files (x86)\\Google\\Chrome\\Application\\chromedriver.exe");
@Test
public void testBaidu(){
driver=new ChromeDriver();
driver.manage().timeouts().implicitlyWait(100, TimeUnit.SECONDS);
driver.get(baseURL);
driver.findElement(By.xpath(".//*[@id='kw']")).sendKeys("肖梦含");
driver.findElement(By.xpath(".//*[@id='su']")).click();
}
}
|
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.8
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package org.ogre;
public enum RenderQueueGroupID {
RENDER_QUEUE_BACKGROUND(OgreJNI.RENDER_QUEUE_BACKGROUND_get()),
RENDER_QUEUE_SKIES_EARLY(OgreJNI.RENDER_QUEUE_SKIES_EARLY_get()),
RENDER_QUEUE_1(OgreJNI.RENDER_QUEUE_1_get()),
RENDER_QUEUE_2(OgreJNI.RENDER_QUEUE_2_get()),
RENDER_QUEUE_WORLD_GEOMETRY_1(OgreJNI.RENDER_QUEUE_WORLD_GEOMETRY_1_get()),
RENDER_QUEUE_3(OgreJNI.RENDER_QUEUE_3_get()),
RENDER_QUEUE_4(OgreJNI.RENDER_QUEUE_4_get()),
RENDER_QUEUE_MAIN(OgreJNI.RENDER_QUEUE_MAIN_get()),
RENDER_QUEUE_6(OgreJNI.RENDER_QUEUE_6_get()),
RENDER_QUEUE_7(OgreJNI.RENDER_QUEUE_7_get()),
RENDER_QUEUE_WORLD_GEOMETRY_2(OgreJNI.RENDER_QUEUE_WORLD_GEOMETRY_2_get()),
RENDER_QUEUE_8(OgreJNI.RENDER_QUEUE_8_get()),
RENDER_QUEUE_9(OgreJNI.RENDER_QUEUE_9_get()),
RENDER_QUEUE_SKIES_LATE(OgreJNI.RENDER_QUEUE_SKIES_LATE_get()),
RENDER_QUEUE_OVERLAY(OgreJNI.RENDER_QUEUE_OVERLAY_get()),
RENDER_QUEUE_MAX(OgreJNI.RENDER_QUEUE_MAX_get());
public final int swigValue() {
return swigValue;
}
public static RenderQueueGroupID swigToEnum(int swigValue) {
RenderQueueGroupID[] swigValues = RenderQueueGroupID.class.getEnumConstants();
if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
return swigValues[swigValue];
for (RenderQueueGroupID swigEnum : swigValues)
if (swigEnum.swigValue == swigValue)
return swigEnum;
throw new IllegalArgumentException("No enum " + RenderQueueGroupID.class + " with value " + swigValue);
}
@SuppressWarnings("unused")
private RenderQueueGroupID() {
this.swigValue = SwigNext.next++;
}
@SuppressWarnings("unused")
private RenderQueueGroupID(int swigValue) {
this.swigValue = swigValue;
SwigNext.next = swigValue+1;
}
@SuppressWarnings("unused")
private RenderQueueGroupID(RenderQueueGroupID swigEnum) {
this.swigValue = swigEnum.swigValue;
SwigNext.next = this.swigValue+1;
}
private final int swigValue;
private static class SwigNext {
private static int next = 0;
}
}
|
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package org.glassfish.pfl.dynamic.codegen;
public class SecondException extends TestException {
public SecondException( String message, Throwable cause ) {
super( message, cause ) ;
}
public SecondException( String message ) {
this( message, null ) ;
}
public SecondException( Throwable cause ) {
this( null, cause ) ;
}
public SecondException() {
this( null, null ) ;
}
}
|
/*
* 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 co.edu.uniandes.csw.especialistas.ejb;
import co.edu.uniandes.csw.especialistas.entities.FarmaciaEntity;
import co.edu.uniandes.csw.especialistas.persistence.FarmaciaPersitence;
import co.edu.uniandes.csw.especialistas.persistence.UbicacionPersistence;
import co.edu.uniandes.csw.especialistas.exceptions.BusinessLogicException;
import java.util.List;
import javax.ejb.Stateless;
import javax.inject.Inject;
import org.springframework.util.Assert;
/**
*
* @author rc.tejon
*/
@Stateless
public class FarmaciaLogic {
private final FarmaciaPersitence persistence;
private final UbicacionPersistence up;
public FarmaciaLogic(){
persistence = null;
up = null;
}
@Inject
public FarmaciaLogic(FarmaciaPersitence persistence,UbicacionPersistence up){
Assert.notNull(persistence, "MyCollaborator must not be null!");
Assert.notNull(up, "MyCollaborator must not be null!");
this.persistence = persistence;
this.up = up;
}
/**
* Método encargado de persistir un farmacia nuevo
* @param entity Entidad del farmacia
* @return Farmacia persistido
*/
public FarmaciaEntity createFarmacia(FarmaciaEntity entity)
{
up.create(entity.getUbicacion());
persistence.create(entity);
return entity;
}
/**
* Método encargadod de eliminar un farmacia de la persistencia
* @param id Id del farmacia
* @return true si la entidad fue eliminada, false de lo contrario
*/
public FarmaciaEntity deleteFarmacia(Long id)throws BusinessLogicException
{
persistence.deleteById(id);
return persistence.findById(id);
}
/**
* Método que retorna la lista de todos los farmacias
* @return Lista con todas las entidades de los farmacias
*/
public List<FarmaciaEntity> getFarmacias()
{
return persistence.findAll();
}
/**
* Método que retorna un farmacia por su id
* @param id id del farmacia
* @return FarmaciaEntity del farmacia buscado
*/
public FarmaciaEntity getFarmacia(Long id)
{
return persistence.findById(id);
}
/**
* Método encargado de actualizar la información de un farmacia
* @param entity Farmacia con la nueva información
* @return FarmaciaEntity con la información del farmacia actualizado
*/
public FarmaciaEntity updateFarmacia(FarmaciaEntity entity)
{
persistence.update(entity);
return entity;
}
/**
* Método encargado de buscar un farmacia por su nombre
* @param nombre nombre del farmacia
* @return FarmaciaEntity correspondiente al farmacia
*/
public FarmaciaEntity getHospitalByName(String nombre)
{
return persistence.findByName(nombre);
}
}
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
* contributors by the @authors tag. See the copyright.txt in the
* distribution for a full listing of individual contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.weld.tests.injectionPoint;
import javax.enterprise.util.AnnotationLiteral;
public class ExtraSpecialLiteral extends AnnotationLiteral<ExtraSpecial> implements ExtraSpecial {
public static final ExtraSpecial INSTANCE = new ExtraSpecialLiteral();
private ExtraSpecialLiteral() {
}
}
|
package com.easybusiness.usermanagement.services.serviceimpl;
import static com.easybusiness.usermanagement.constant.UserManagementConstant.USER_HOST_SERVER;
import java.sql.Date;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.easybusiness.usermanagement.DTO.MenuDTO;
import com.easybusiness.usermanagement.DTO.SubMenuDTO;
import com.easybusiness.usermanagement.DTO.SubMenuUrlDTO;
import com.easybusiness.usermanagement.dao.MenuDao;
import com.easybusiness.usermanagement.dao.SubMenuDao;
import com.easybusiness.usermanagement.dao.SubMenuUrlDao;
import com.easybusiness.usermanagement.entity.Menu;
import com.easybusiness.usermanagement.entity.SubMenu;
import com.easybusiness.usermanagement.entity.SubMenuUrl;
import com.easybusiness.usermanagement.services.MenuService;
/*
* Service and RestController class for MENU_MASTER table
*/
@Service
public class MenuServiceImpl implements MenuService {
@Autowired
MenuDao menuDao;
@Autowired
SubMenuDao subMenuDao;
@Autowired
SubMenuUrlDao subMenuUrlDao;
private static Logger LOGGER = LoggerFactory.getLogger(MenuServiceImpl.class);
/*
* (non-Javadoc)
* @see com.easybusiness.usermanagement.services.menu.MenuService#getMenuByName(java.lang.String)
* fetching menu by menuname
* GET method for MENU_MASTER table with param menuName
*/
@Override
public MenuDTO getMenuByName(String menuName) {
Menu menu = menuDao.findByMenuName(menuName);
return prepareMenuResponse(menu);
}
/*
* preparing MenuDTO from Menu entity
*/
private MenuDTO prepareMenuResponse(Menu menu) {
MenuDTO menuItem = new MenuDTO();
menuItem.setId(menu.getId());
menuItem.setMenuName(menu.getMenuName());
menuItem.setModifiedBy(menu.getModifiedBy());
menuItem.setModifiedTime(menu.getModifiedTime());
menuItem.setMenuIconName(menu.getMenuIconName());
return menuItem;
}
@Override
public List<MenuDTO> getMenuAsPerCriteria(String whereClause) {
return null;
}
/*
* (non-Javadoc)
* @see com.easybusiness.usermanagement.services.menu.MenuService#addMenu(com.easybusiness.usermanagement.DTO.MenuDTO)
* saving menu to database
* POST method for MENU_MASTER table with MenuDTO request body
*/
@Override
public ResponseEntity<MenuDTO> addMenu(MenuDTO menuDTO) {
Menu menuItem = new Menu();
menuItem.setMenuName(menuDTO.getMenuName());
menuItem.setModifiedBy(menuDTO.getModifiedBy());
menuItem.setModifiedTime(menuDTO.getModifiedTime());
menuItem.setMenuIconName(menuDTO.getMenuIconName());
if(menuDTO.getId() == 0) {
menuDao.addMenu(menuItem);
}else {
Menu menu = menuDao.findMenuById(menuDTO.getId());
menu.setMenuIconName(menuDTO.getMenuIconName());
menu.setMenuName(menuDTO.getMenuName());
menu.setModifiedBy(menuDTO.getModifiedBy());
menu.setModifiedTime(Date.valueOf(LocalDate.now()));
menuDao.updateMenu(menu);
}
return new ResponseEntity<MenuDTO>(menuDTO, HttpStatus.CREATED);
}
/*
* (non-Javadoc)
* @see com.easybusiness.usermanagement.services.menu.MenuService#updateMenu(com.easybusiness.usermanagement.DTO.MenuDTO)
* updating menu
* POST method for MENU_MASTER table with MenuDTO request body
*/
@Override
public void updateMenu(MenuDTO menu) {
Menu menuEntity = menuDao.findMenuById(menu.getId());
menuEntity.setMenuIconName(menu.getMenuIconName());
menuEntity.setMenuName(menu.getMenuName());
menuEntity.setModifiedBy(menu.getModifiedBy());
menuEntity.setModifiedTime(menu.getModifiedTime());
menuDao.updateMenu(menuEntity);
LOGGER.info("menu successfully updated "+menu.toString());
}
/*
* (non-Javadoc)
* @see com.easybusiness.usermanagement.services.menu.MenuService#getAllMenuItems()
* Fetching all menus
* GET method for MENU_MASTER table
*/
@Override
public List<MenuDTO> getAllMenuItems() throws Exception {
List<Menu> menuList = menuDao.findAll();
List<MenuDTO> menuModelList = new ArrayList<MenuDTO>();
menuList.forEach(menu -> {
MenuDTO menuItem = prepareMenuResponse(menu);
menuModelList.add(menuItem);
});
return menuModelList;
}
/*
* (non-Javadoc)
* @see com.easybusiness.usermanagement.services.menu.MenuService#getMenuById(java.lang.Long)
* fetching menu by menuId
* GET method for MENU_MASTER table with param menuId
*/
@Override
public MenuDTO getMenuById(Long menuId) {
LOGGER.info("inside get Menu By Id");
Menu menu = menuDao.findMenuById(menuId);
MenuDTO menuItem = prepareMenuResponse(menu);
return menuItem;
}
/*
* (non-Javadoc)
* @see com.easybusiness.usermanagement.services.menu.MenuService#deleteMenu(java.lang.Long)
* deleting menu by menuId
* DELETE method for MENU_MASTER table with param menuID
*/
@Override
public ResponseEntity<MenuDTO> deleteMenu(Long menuId) {
Menu menu = menuDao.findMenuById(menuId);
menuDao.deleteMenu(menuId);
return new ResponseEntity<MenuDTO>(prepareMenuResponse(menu), HttpStatus.OK);
}
@Override
public List<MenuDTO> getFieldEq(Class<MenuDTO> type, String propertyName, Object value, int offset, int size) {
return null;
}
/*
* (non-Javadoc)
* @see com.easybusiness.usermanagement.services.menu.MenuService#getSubMenuById(java.lang.Long)
* fetching submenu by parent menu id
* GET method for SUBMENU_MASTER table with param menuId
*/
@Override
public List<SubMenuDTO> getSubMenuById(Long parentMenuId) {
List<SubMenu> subMenuList = subMenuDao.findByMenu(menuDao.findMenuById(parentMenuId));
List<SubMenuDTO> subMenuDTOList = new ArrayList<SubMenuDTO>();
subMenuList.forEach(subMenu -> {
SubMenuDTO subMenuDTO = new SubMenuDTO();
subMenuDTO.setId(subMenu.getId());
subMenuDTO.setSubMenu(subMenu.getSubMenu());
MenuDTO menuDTOvalue = new MenuDTO();
menuDTOvalue.setId(subMenu.getMenu().getId());
menuDTOvalue.setMenuName(subMenu.getMenu().getMenuName());
menuDTOvalue.setModifiedBy(subMenu.getMenu().getModifiedBy());
menuDTOvalue.setModifiedTime(subMenu.getMenu().getModifiedTime());
menuDTOvalue.setMenuIconName(subMenu.getMenu().getMenuIconName());
subMenuDTO.setMenu(menuDTOvalue);
subMenuDTOList.add(subMenuDTO);
});
return subMenuDTOList;
}
/*
* (non-Javadoc)
* @see com.easybusiness.usermanagement.services.menu.MenuService#getSubMenuBySubMenuId(java.lang.Long)
* fetching submenu by submenuid
* GET method for SUBMENU_MASTER table with param menuId(submenuId)
*/
@Override
public SubMenuDTO getSubMenuBySubMenuId(Long subMenuId) {
SubMenu subMenu = subMenuDao.findSubMenuById(subMenuId);
SubMenuDTO subMenuDTO = new SubMenuDTO();
subMenuDTO.setId(subMenu.getId());
subMenuDTO.setSubMenu(subMenu.getSubMenu());
MenuDTO menuDTOvalue = new MenuDTO();
menuDTOvalue.setId(subMenu.getMenu().getId());
menuDTOvalue.setMenuName(subMenu.getMenu().getMenuName());
menuDTOvalue.setModifiedBy(subMenu.getMenu().getModifiedBy());
menuDTOvalue.setModifiedTime(subMenu.getMenu().getModifiedTime());
menuDTOvalue.setMenuIconName(subMenu.getMenu().getMenuIconName());
subMenuDTO.setMenu(menuDTOvalue);
return subMenuDTO;
}
/*
* (non-Javadoc)
* @see com.easybusiness.usermanagement.services.menu.MenuService#getAllSubMenuItems()
* fetching all submenus
* GET method for SUBMENU_MASTER table
*/
@Override
public List<SubMenuDTO> getAllSubMenuItems() throws Exception {
List<SubMenu> subMenuList = subMenuDao.findAll();
List<SubMenuDTO> subMenuModelList = new ArrayList<SubMenuDTO>();
subMenuList.forEach(subMenu -> {
SubMenuDTO subMenuItem = prepareSubMenuResponse(subMenu);
subMenuModelList.add(subMenuItem);
});
return subMenuModelList;
}
/*
* preparing SubMenuDTO from SubMenu entity
*/
private SubMenuDTO prepareSubMenuResponse(SubMenu subMenu) {
SubMenuDTO subMenuDTO = new SubMenuDTO();
subMenuDTO.setId(subMenu.getId());
subMenuDTO.setMenu(prepareMenuResponse(subMenu.getMenu()));
subMenuDTO.setModifiedBy(subMenu.getModifiedBy());
subMenuDTO.setModifiedTime(subMenu.getModifiedTime());
subMenuDTO.setSubMenu(subMenu.getSubMenu());
return subMenuDTO;
}
/*
* (non-Javadoc)
* @see com.easybusiness.usermanagement.services.menu.MenuService#addSubMenu(com.easybusiness.usermanagement.DTO.SubMenuDTO)
* saving submenu to database
* POST method for SUBMENU_MASTER table with SubMenuDTO request body
*/
@Override
public ResponseEntity<SubMenuDTO> addSubMenu(SubMenuDTO subMenuDTO) {
SubMenu subMenu = new SubMenu();
Menu menuItem = new Menu();
menuItem.setMenuName(subMenuDTO.getMenu().getMenuName());
menuItem.setModifiedBy(subMenuDTO.getMenu().getModifiedBy());
menuItem.setModifiedTime(subMenuDTO.getMenu().getModifiedTime());
menuItem.setId(subMenuDTO.getMenu().getId());
menuItem.setMenuIconName(subMenuDTO.getMenu().getMenuIconName());
subMenu.setMenu(menuItem);
subMenu.setModifiedBy(subMenuDTO.getModifiedBy());
subMenu.setModifiedTime(subMenuDTO.getModifiedTime());
subMenu.setSubMenu(subMenuDTO.getSubMenu());
subMenuDao.addSubMenu(subMenu);
return new ResponseEntity<SubMenuDTO>(subMenuDTO, HttpStatus.CREATED);
}
/*
* (non-Javadoc)
* @see com.easybusiness.usermanagement.services.menu.MenuService#updateSubMenu(com.easybusiness.usermanagement.DTO.SubMenuDTO)
* updating submenu
* POST method for SUBMENU_MASTER table with SubMenuDTO request body
*/
@Override
public void updateSubMenu(SubMenuDTO subMenuDto) {
SubMenu submenu = subMenuDao.findSubMenuById(subMenuDto.getId());
Menu menuItem = menuDao.findMenuById(subMenuDto.getMenu().getId());
menuItem.setMenuName(subMenuDto.getMenu().getMenuName());
menuItem.setModifiedBy(subMenuDto.getMenu().getModifiedBy());
menuItem.setModifiedTime(subMenuDto.getMenu().getModifiedTime());
menuItem.setId(subMenuDto.getMenu().getId());
submenu.setMenu(menuItem);
submenu.setModifiedBy(subMenuDto.getModifiedBy());
submenu.setModifiedTime(subMenuDto.getModifiedTime());
submenu.setSubMenu(subMenuDto.getSubMenu());
subMenuDao.updateSubMenu(submenu);
}
/*
* (non-Javadoc)
* @see com.easybusiness.usermanagement.services.menu.MenuService#deleteSubMenu(java.lang.Long)
* deleting submenu by submenuid
* DELETE method for SUBMENU_MASTER table with param submenuId
*/
@Override
public ResponseEntity<SubMenuDTO> deleteSubMenu(Long subMenuId) {
SubMenu subMenu = subMenuDao.findSubMenuById(subMenuId);
SubMenuDTO subMenuDTO = new SubMenuDTO();
subMenuDTO.setId(subMenu.getId());
subMenuDTO.setSubMenu(subMenu.getSubMenu());
subMenuDao.deleteSubMenu(subMenuId);
return new ResponseEntity<SubMenuDTO>(subMenuDTO, HttpStatus.OK);
}
/*
* (non-Javadoc)
* @see com.easybusiness.usermanagement.services.menu.MenuService#getUrlBySubMenuId(java.lang.Long)
* fetching menu url by subMenuId
* GET method for SUBMENU_URL_MAP table with param subMenuId
*/
@Override
public SubMenuUrlDTO getUrlBySubMenuId(Long subMenuId) {
SubMenuUrl subMenuUrlEntity = subMenuUrlDao.findBySubMenu(subMenuDao.findSubMenuById(subMenuId));
SubMenuUrlDTO subMenuUrlDTO = new SubMenuUrlDTO();
subMenuUrlDTO.setCreatedBy(subMenuUrlEntity.getCreatedBy());
subMenuUrlDTO.setCreatedOn(subMenuUrlEntity.getCreatedOn());
subMenuUrlDTO.setId(subMenuUrlEntity.getId());
SubMenuDTO subMenuDTO = new SubMenuDTO();
subMenuDTO.setId(subMenuUrlEntity.getSubMenu().getId());
subMenuDTO.setSubMenu(subMenuUrlEntity.getSubMenu().getSubMenu());
subMenuUrlDTO.setSubMenu(subMenuDTO);
subMenuUrlDTO.setUrl(subMenuUrlEntity.getUrl());
return subMenuUrlDTO;
}
}
|
/**
* Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.engine.view;
import javax.time.Instant;
/**
*
*/
public class InMemoryViewDeltaResultModel extends InMemoryViewResultModel implements ViewDeltaResultModel {
private static final long serialVersionUID = 1L;
private Instant _previousResultTimestamp;
/**
* @return the previousResultTimestamp
*/
public Instant getPreviousResultTimestamp() {
return _previousResultTimestamp;
}
/**
* @param previousResultTimestamp the previousResultTimestamp to set
*/
public void setPreviousCalculationTime(Instant previousResultTimestamp) {
_previousResultTimestamp = previousResultTimestamp;
}
}
|
/*
BEEM is a videoconference application on the Android Platform.
Copyright (C) 2009 by Frederic-Charles Barthelery,
Jean-Manuel Da Silva,
Nikita Kozlov,
Philippe Lago,
Jean Baptiste Vergely,
Vincent Veronis.
This file is part of BEEM.
BEEM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
BEEM 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 BEEM. If not, see <http://www.gnu.org/licenses/>.
Please send bug reports with examples or suggestions to
contact@beem-project.com or http://dev.beem-project.com/
Epitech, hereby disclaims all copyright interest in the program "Beem"
written by Frederic-Charles Barthelery,
Jean-Manuel Da Silva,
Nikita Kozlov,
Philippe Lago,
Jean Baptiste Vergely,
Vincent Veronis.
Nicolas Sadirac, November 26, 2009
President of Epitech.
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
*/
package com.beem.project.btf.smack.avatar;
import java.io.InputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.HttpResponse;
import org.apache.http.HttpEntity;
/**
* An AvatarRetriever which retrieve the avatar over HTTP using the Apache HttpClient.
*/
public class HttpClientAvatarRetriever implements AvatarRetriever {
private String mUrl;
private HttpClient mClient;
/**
* Create a HttpAvatarRetriever.
* @param client the custom HttpClient to use to downlowad
* @param url the url of the avatar to download.
*/
public HttpClientAvatarRetriever(final HttpClient client, final String url) {
mUrl = url;
mClient = client;
}
/**
* Create a HttpAvatarRetriever.
* @param url the url of the avatar to download.
*/
public HttpClientAvatarRetriever(final String url) {
mUrl = url;
mClient = new DefaultHttpClient();
}
@Override
public byte[] getAvatar() throws IOException {
HttpUriRequest request;
try {
request = new HttpGet(mUrl);
} catch (IllegalArgumentException e) {
IOException ioe = new IOException("Invalid url " + mUrl);
ioe.initCause(e);
throw ioe;
}
HttpResponse response = mClient.execute(request);
HttpEntity entity = response.getEntity();
InputStream in = entity.getContent();
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
byte[] data = new byte[1024];
int nbread;
while ((nbread = in.read(data)) != -1) {
os.write(data, 0, nbread);
}
} finally {
in.close();
os.close();
}
return os.toByteArray();
}
}
|
/*
* Copyright (C) 2017 MINDORKS NEXTGEN PRIVATE LIMITED
*
* 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://mindorks.com/license/apache-v2
*
* 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.frestoinc.maildemo.base.rx;
import androidx.annotation.NonNull;
import io.reactivex.Scheduler;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
/**
* Created by frestoinc on 06,December,2019 for MailDemo.
*/
public class AppSchedulerProvider implements SchedulerProvider {
@Override
@NonNull
public Scheduler computation() {
return Schedulers.computation();
}
@Override
@NonNull
public Scheduler io() {
return Schedulers.io();
}
@Override
@NonNull
public Scheduler ui() {
return AndroidSchedulers.mainThread();
}
}
|
package com.zeligsoft.domain.omg.dds.api.QOS.impl;
import com.zeligsoft.base.zdl.staticapi.util.ZDLFactoryRegistry;
import com.zeligsoft.domain.omg.dds.api.QOS.lbQosPolicy;
import com.zeligsoft.domain.omg.dds.api.QOS.impl.qosPolicyZImpl;
import com.zeligsoft.domain.omg.dds.api.QOS.Duration;
import com.zeligsoft.base.zdl.util.ZDLUtil;
public class lbQosPolicyZImpl extends qosPolicyZImpl implements lbQosPolicy {
protected Duration _duration;
public lbQosPolicyZImpl(org.eclipse.emf.ecore.EObject element) {
super(element);
}
@Override
public Duration getDuration() {
if (_duration == null) {
final Object rawValue = com.zeligsoft.base.zdl.util.ZDLUtil
.getValue(eObject(), "DDS::QOS::lbQosPolicy", "duration");
if (rawValue instanceof org.eclipse.emf.ecore.EObject) {
_duration = ZDLFactoryRegistry.INSTANCE.create(
(org.eclipse.emf.ecore.EObject) rawValue,
Duration.class);
}
}
return _duration;
}
@Override
public void setDuration(Duration val) {
ZDLUtil.setValue(element, "DDS::QOS::lbQosPolicy", "duration",
val.eObject());
}
@Override
public <T extends Duration> T createDuration(Class<T> typeToCreate,
String concept) {
org.eclipse.emf.ecore.EObject newConcept = ZDLUtil.createZDLConcept(
element, "DDS::QOS::lbQosPolicy", "duration", concept);
T element = ZDLFactoryRegistry.INSTANCE.create(
newConcept, typeToCreate);
return element;
}
@Override
public Duration createDuration() {
org.eclipse.emf.ecore.EObject newConcept = ZDLUtil.createZDLConcept(
element, "DDS::QOS::lbQosPolicy", "duration",
"DDS::QOS::Duration");
Duration element = ZDLFactoryRegistry.INSTANCE.create(
newConcept, Duration.class);
return element;
}
}
|
import javafx.scene.Scene;
import javafx.scene.Group;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.control.Label;
import javafx.scene.text.Font;
import javafx.scene.layout.AnchorPane;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
import java.lang.Object;
import javafx.scene.Node;
import javafx.scene.shape.*;
import javafx.scene.Group;
import javafx.scene.paint.Color;
import javafx.scene.shape.*;
import javafx.scene.text.Text;
import javafx.scene.shape.Path;
import javafx.scene.shape.VLineTo;
import javafx.scene.shape.MoveTo;
import javafx.scene.control.Labeled;
import javafx.scene.text.TextAlignment;
import javafx.scene.image.ImageView;
import javafx.geometry.Pos;
public class Display {
private Group root;
private Canvas canvas;
private GraphicsContext context;
private Scene scene;
private Label scoreDisplay;
private Label bestScoreDisplay;
private Line vLine;
private ImageView banner, start;
private boolean flickerStart;
private double lineOffSet;
private double time;
public Display(int width, int height) {
this.root = new Group();
this.canvas = new Canvas(width, height);
this.context = canvas.getGraphicsContext2D();
this.root.getChildren().add(this.canvas);
this.scene = new Scene(this.root, width, height);
AnchorPane ap = new AnchorPane();
root.getChildren().add(ap);
ap.setPrefSize(width, height);
lineOffSet = 180f;
banner = new ImageView(Sprites.banner);
ap.getChildren().add(banner);
ap.setTopAnchor(banner, 100.0);
System.out.println((lineOffSet + (width - lineOffSet)/2 - banner.getImage().getWidth()) + "" + " AND " + banner.getImage().getWidth());
ap.setLeftAnchor(banner, 220.0);
start = new ImageView(Sprites.start);
ap.getChildren().add(start);
ap.setLeftAnchor(start, 350.0);
ap.setBottomAnchor(start, 130.0);
flickerStart = true;
Label orderLabel = new Label("ORDER:");
orderLabel.setFont(new Font(30));
ap.getChildren().add(orderLabel);
ap.setTopAnchor(orderLabel, 10.0);
ap.setLeftAnchor(orderLabel, 10.0);
Label instructions = new Label("arrows - move\nspace - fling food");
instructions.setFont(new Font(15));
ap.getChildren().add(instructions);
ap.setBottomAnchor(instructions, 100.0);
ap.setLeftAnchor(instructions, 5.0);
scoreDisplay = new Label("SCORE");
scoreDisplay.setFont(new Font(30));
scoreDisplay.setTextAlignment(TextAlignment.CENTER);
ap.getChildren().add(scoreDisplay);
ap.setBottomAnchor(scoreDisplay, 300.0);
ap.setLeftAnchor(scoreDisplay, 5.0);
bestScoreDisplay = new Label("TOP SCORE: ");
bestScoreDisplay.setFont(new Font(20));
bestScoreDisplay.setTextAlignment(TextAlignment.CENTER);
ap.getChildren().add(bestScoreDisplay);
ap.setBottomAnchor(bestScoreDisplay, 250.0);
ap.setLeftAnchor(bestScoreDisplay, 5.0);
vLine = new Line();
vLine.setStartX(lineOffSet);
vLine.setStartY(0f);
vLine.setEndY(2500f);
vLine.setEndX(lineOffSet);
vLine.setStrokeWidth(17.0);
vLine.setStroke(Color.DARKSALMON);
root.getChildren().add(vLine);
}
public void makeScoreBrown() {
scoreDisplay.setTextFill(Color.BROWN);
vLine.setStroke(Color.BROWN);
}
public void makeScoreBlack() {
scoreDisplay.setTextFill(Color.BLACK);
vLine.setStroke(Color.DARKSALMON);
}
public double getLineOffSet() {
return lineOffSet;
}
public void setDemoMode() {
vLine.setStroke(Color.DARKSALMON);
banner.setOpacity(100);
scoreDisplay.setTextFill(Color.BLACK);
flickerStart = true;
}
public void setPlayMode() {
if(vLine.getStroke() != Color.BROWN)
vLine.setStroke(Color.BLACK);
banner.setOpacity(0);
flickerStart = false;
start.setOpacity(0);
}
public void handleStart(double deltaTime) {
time += deltaTime;
if (flickerStart) {
if((int)time % 2 == 0) {
start.setOpacity(0);
} else {
start.setOpacity(100);
}
} else {
start.setOpacity(0);
}
}
public void setScoreDisplay(String str) { scoreDisplay.setText(str);}
public void setBestScoreDisplay(String str) { bestScoreDisplay.setText(str);}
public void clear() {
this.context.clearRect(0, 0, this.canvas.getWidth(), this.canvas.getHeight());
}
public Scene getScene() { return this.scene; } // this is to hook up to the game class
public Canvas getCanvas() { return this.canvas; } // probably useless
public GraphicsContext getContext() { return this.context; } // just draw directly onto the context
}
|
package seedu.address.logic.parser;
import static java.util.Objects.requireNonNull;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import seedu.address.commons.core.Messages;
import seedu.address.commons.core.index.Index;
import seedu.address.commons.util.StringUtil;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.item.Name;
import seedu.address.model.tag.Tag;
/**
* Contains utility methods used for parsing strings in the various *Parser classes.
*/
public class ParserUtil {
public static final String MESSAGE_INVALID_INDEX = "Index is not a non-zero unsigned integer.";
/**
* Parses {@code oneBasedIndex} into an {@code Index} and returns it. Leading and trailing whitespaces will be
* trimmed.
* @throws ParseException if the specified index is invalid (not non-zero unsigned integer).
*/
public static Index parseIndex(String oneBasedIndex) throws ParseException {
String trimmedIndex = oneBasedIndex.trim();
if (!StringUtil.isNonZeroUnsignedInteger(trimmedIndex)) {
throw new ParseException(MESSAGE_INVALID_INDEX);
}
return Index.fromOneBased(Integer.parseInt(trimmedIndex));
}
/**
* Parses a {@code String name} into a {@code Name}.
* Leading and trailing whitespaces will be trimmed.
*
* @throws ParseException if the given {@code name} is invalid.
*/
public static Name parseName(String name) throws ParseException {
requireNonNull(name);
String trimmedName = name.trim();
if (!Name.isValidName(trimmedName)) {
throw new ParseException(Name.MESSAGE_CONSTRAINTS);
}
return new Name(trimmedName);
}
/**
* Parses a {@code String tag} into a {@code Tag}.
* Leading and trailing whitespaces will be trimmed.
*
* @throws ParseException if the given {@code tag} is invalid.
*/
public static Tag parseTag(String tag) throws ParseException {
requireNonNull(tag);
String trimmedTag = tag.trim();
if (!Tag.isValidTagName(trimmedTag)) {
throw new ParseException(Tag.MESSAGE_CONSTRAINTS);
}
return new Tag(trimmedTag);
}
/**
* Parses {@code Collection<String> tags} into a {@code Set<Tag>}.
*/
public static Set<Tag> parseTags(Collection<String> tags) throws ParseException {
requireNonNull(tags);
final Set<Tag> tagSet = new HashSet<>();
for (String tagName : tags) {
tagSet.add(parseTag(tagName));
}
return tagSet;
}
/**
* Parses {@code String costPrice} into a {@code Double}.
*/
public static Double parseCostPrice(String costPrice) throws ParseException {
try {
Double.parseDouble(costPrice);
} catch (NumberFormatException e) {
throw new ParseException(Messages.MESSAGE_INVALID_COSTPRICE_FORMAT);
}
if (Double.parseDouble(costPrice) > 0) {
return Double.parseDouble(costPrice);
} else {
throw new ParseException(Messages.MESSAGE_INVALID_COSTPRICE_FORMAT);
}
}
/**
* Parses {@code String salesPrice} into a {@code Double}.
*/
public static Double parseSalesPrice(String salesPrice) throws ParseException {
try {
Double.parseDouble(salesPrice);
} catch (NumberFormatException e) {
throw new ParseException(Messages.MESSAGE_INVALID_SALESPRICE_FORMAT);
}
if (Double.parseDouble(salesPrice) > 0) {
return Double.parseDouble(salesPrice);
} else {
throw new ParseException(Messages.MESSAGE_INVALID_SALESPRICE_FORMAT);
}
}
/**
* Parses {@code String count} into a {@code id}.
*/
public static Integer parseId(String id) throws ParseException {
try {
Integer.parseInt(id);
} catch (NumberFormatException e) {
throw new ParseException(Messages.MESSAGE_INVALID_ID_FORMAT);
}
if (id.length() <= 6 && Integer.parseInt(id) > 0) {
return Integer.parseInt(id);
} else {
throw new ParseException(Messages.MESSAGE_INVALID_ID_LENGTH_AND_SIGN);
}
}
/**
* Parses {@code String count} into a {@code Integer}.
*/
public static Integer parseCount(String count) throws ParseException {
try {
Integer.parseInt(count);
} catch (NumberFormatException e) {
throw new ParseException(Messages.MESSAGE_INVALID_COUNT_FORMAT);
}
if (Integer.parseInt(count) > 0) {
return Integer.parseInt(count);
} else {
throw new ParseException(Messages.MESSAGE_INVALID_COUNT_INTEGER);
}
}
}
|
/*
* Copyright 2015-2018 Real Logic Ltd, Adaptive Financial Consulting Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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 uk.co.real_logic.artio.engine.logger;
import io.aeron.ExclusivePublication;
import io.aeron.logbuffer.BufferClaim;
import io.aeron.logbuffer.ControlledFragmentHandler;
import io.aeron.logbuffer.Header;
import org.agrona.DirectBuffer;
import org.agrona.ErrorHandler;
import org.agrona.MutableDirectBuffer;
import org.agrona.collections.IntHashSet;
import org.agrona.concurrent.EpochClock;
import org.agrona.concurrent.IdleStrategy;
import uk.co.real_logic.artio.DebugLogger;
import uk.co.real_logic.artio.LogTag;
import uk.co.real_logic.artio.Pressure;
import uk.co.real_logic.artio.builder.Encoder;
import uk.co.real_logic.artio.decoder.HeaderDecoder;
import uk.co.real_logic.artio.decoder.SequenceResetDecoder;
import uk.co.real_logic.artio.engine.PossDupEnabler;
import uk.co.real_logic.artio.engine.ReplayHandler;
import uk.co.real_logic.artio.engine.SenderSequenceNumbers;
import uk.co.real_logic.artio.messages.*;
import uk.co.real_logic.artio.util.AsciiBuffer;
import uk.co.real_logic.artio.util.MutableAsciiBuffer;
import static io.aeron.logbuffer.ControlledFragmentHandler.Action.ABORT;
import static io.aeron.logbuffer.ControlledFragmentHandler.Action.CONTINUE;
import static uk.co.real_logic.artio.LogTag.REPLAY;
import static uk.co.real_logic.artio.engine.FixEngine.ENGINE_LIBRARY_ID;
import static uk.co.real_logic.artio.engine.logger.Replayer.MESSAGE_FRAME_BLOCK_LENGTH;
class ReplayerSession implements ControlledFragmentHandler
{
private static final int NONE = -1;
private enum State
{
REPLAYING,
CHECK_REPLAY,
SEND_COMPLETE_MESSAGE
}
// Safe to share between multiple instances due to single threaded nature of the replayer
private static final FixMessageEncoder FIX_MESSAGE_ENCODER = new FixMessageEncoder();
private static final MessageHeaderDecoder MESSAGE_HEADER = new MessageHeaderDecoder();
private static final FixMessageDecoder FIX_MESSAGE = new FixMessageDecoder();
private static final HeaderDecoder FIX_HEADER = new HeaderDecoder();
private static final MessageHeaderEncoder MESSAGE_HEADER_ENCODER = new MessageHeaderEncoder();
private static final AsciiBuffer ASCII_BUFFER = new MutableAsciiBuffer();
private static final ReplayCompleteEncoder REPLAY_COMPLETE_ENCODER = new ReplayCompleteEncoder();
private final GapFillEncoder gapFillEncoder = new GapFillEncoder();
private final BufferClaim bufferClaim;
private final PossDupEnabler possDupEnabler;
private final String message;
private final IdleStrategy idleStrategy;
private final ReplayHandler replayHandler;
private final int maxClaimAttempts;
private final IntHashSet gapFillMessageTypes;
private final SenderSequenceNumbers senderSequenceNumbers;
private final ExclusivePublication publication;
private final ReplayQuery replayQuery;
private final ErrorHandler errorHandler;
private int beginSeqNo;
private int endSeqNo;
private boolean upToMostRecent;
private long connectionId;
private long sessionId;
private int sequenceIndex;
private int lastSeqNo;
private int beginGapFillSeqNum = NONE;
private ReplayOperation replayOperation;
private State state;
ReplayerSession(
final BufferClaim bufferClaim,
final IdleStrategy idleStrategy,
final ReplayHandler replayHandler,
final int maxClaimAttempts,
final IntHashSet gapFillMessageTypes,
final SenderSequenceNumbers senderSequenceNumbers,
final ExclusivePublication publication,
final EpochClock clock,
final int beginSeqNo,
final int endSeqNo,
final boolean upToMostRecent,
final long connectionId,
final long sessionId,
final int sequenceIndex,
final ReplayQuery replayQuery,
final String message,
final ErrorHandler errorHandler,
final HeaderDecoder requestHeader)
{
this.bufferClaim = bufferClaim;
this.idleStrategy = idleStrategy;
this.replayHandler = replayHandler;
this.maxClaimAttempts = maxClaimAttempts;
this.gapFillMessageTypes = gapFillMessageTypes;
this.senderSequenceNumbers = senderSequenceNumbers;
this.publication = publication;
this.beginSeqNo = beginSeqNo;
this.endSeqNo = endSeqNo;
this.upToMostRecent = upToMostRecent;
this.connectionId = connectionId;
this.sessionId = sessionId;
this.sequenceIndex = sequenceIndex;
this.message = message;
this.errorHandler = errorHandler;
this.replayQuery = replayQuery;
lastSeqNo = beginSeqNo - 1;
gapFillEncoder.setupMessage(requestHeader);
possDupEnabler = new PossDupEnabler(
bufferClaim,
this::claimBuffer,
this::onPreCommit,
this::onIllegalState,
this::onException,
clock,
publication.maxPayloadLength(),
LogTag.FIX_MESSAGE);
state = State.REPLAYING;
}
private void onPreCommit(final MutableDirectBuffer buffer, final int offset)
{
final int frameOffset = offset + MessageHeaderEncoder.ENCODED_LENGTH;
FIX_MESSAGE_ENCODER
.wrap(buffer, frameOffset)
.connection(connectionId);
}
private void onException(final Throwable e)
{
final String exMessage = String.format("[%s] Error replying to message", message);
errorHandler.onError(new IllegalArgumentException(exMessage, e));
}
private void onIllegalState(final String message, final Object... arguments)
{
errorHandler.onError(new IllegalStateException(String.format(message, arguments)));
}
void query()
{
replayOperation = replayQuery.query(
this,
sessionId,
beginSeqNo,
sequenceIndex,
endSeqNo,
sequenceIndex,
LogTag.CATCHUP);
}
// Callback for the ReplayQuery:
public Action onFragment(
final DirectBuffer srcBuffer, final int srcOffset, final int srcLength, final Header header)
{
MESSAGE_HEADER.wrap(srcBuffer, srcOffset);
final int actingBlockLength = MESSAGE_HEADER.blockLength();
final int offset = srcOffset + MessageHeaderDecoder.ENCODED_LENGTH;
FIX_MESSAGE.wrap(
srcBuffer,
offset,
actingBlockLength,
MESSAGE_HEADER.version());
final int messageOffset = srcOffset + MESSAGE_FRAME_BLOCK_LENGTH;
final int messageLength = srcLength - MESSAGE_FRAME_BLOCK_LENGTH;
ASCII_BUFFER.wrap(srcBuffer);
FIX_HEADER.reset();
FIX_HEADER.decode(ASCII_BUFFER, messageOffset, messageLength);
final int msgSeqNum = FIX_HEADER.msgSeqNum();
final int messageType = FIX_MESSAGE.messageType();
replayHandler.onReplayedMessage(
ASCII_BUFFER,
messageOffset,
messageLength,
FIX_MESSAGE.libraryId(),
FIX_MESSAGE.session(),
FIX_MESSAGE.sequenceIndex(),
messageType);
if (gapFillMessageTypes.contains(messageType))
{
if (beginGapFillSeqNum == NONE)
{
beginGapFillSeqNum = lastSeqNo + 1;
}
lastSeqNo = msgSeqNum;
return CONTINUE;
}
else
{
if (beginGapFillSeqNum != NONE)
{
sendGapFill(beginGapFillSeqNum, msgSeqNum);
}
else if (msgSeqNum > lastSeqNo + 1)
{
sendGapFill(lastSeqNo, msgSeqNum);
}
final Action action = possDupEnabler.enablePossDupFlag(
srcBuffer, messageOffset, messageLength, srcOffset, srcLength);
if (action != ABORT)
{
lastSeqNo = msgSeqNum;
}
return action;
}
}
private Action sendGapFill(final int msgSeqNo, final int newSeqNo)
{
final long result = gapFillEncoder.encode(msgSeqNo, newSeqNo);
final int gapFillLength = Encoder.length(result);
final int gapFillOffset = Encoder.offset(result);
if (claimBuffer(MESSAGE_FRAME_BLOCK_LENGTH + gapFillLength))
{
final int destOffset = bufferClaim.offset();
final MutableDirectBuffer destBuffer = bufferClaim.buffer();
final MutableAsciiBuffer gapFillBuffer = gapFillEncoder.buffer();
FIX_MESSAGE_ENCODER
.wrapAndApplyHeader(destBuffer, destOffset, MESSAGE_HEADER_ENCODER)
.libraryId(ENGINE_LIBRARY_ID)
.messageType(SequenceResetDecoder.MESSAGE_TYPE)
.session(this.sessionId)
.sequenceIndex(this.sequenceIndex)
.connection(this.connectionId)
.timestamp(0)
.status(MessageStatus.OK)
.putBody(gapFillBuffer, gapFillOffset, gapFillLength);
bufferClaim.commit();
DebugLogger.log(LogTag.FIX_MESSAGE, "Replayed: %s%n", gapFillBuffer, gapFillOffset, gapFillLength);
this.beginGapFillSeqNum = NONE;
return CONTINUE;
}
else
{
DebugLogger.log(REPLAY, "Back pressured trying to sendGapFill");
return ABORT;
}
}
private boolean claimBuffer(final int newLength)
{
for (int i = 0; i < maxClaimAttempts; i++)
{
final long position = publication.tryClaim(newLength, bufferClaim);
if (position > 0)
{
idleStrategy.reset();
return true;
}
else if (Pressure.isBackPressured(position))
{
idleStrategy.idle();
}
else
{
return false;
}
}
return false;
}
boolean attempReplay()
{
switch (state)
{
case REPLAYING:
DebugLogger.log(REPLAY, "ReplayerSession: REPLAYING step");
if (replayOperation.attemptReplay())
{
state = State.CHECK_REPLAY;
return attempReplay();
}
return false;
case CHECK_REPLAY:
DebugLogger.log(REPLAY, "ReplayerSession: CHECK_REPLAY step");
if (completeReplay())
{
state = State.SEND_COMPLETE_MESSAGE;
}
return false;
case SEND_COMPLETE_MESSAGE:
return sendCompleteMessage();
default:
return false;
}
}
private boolean completeReplay()
{
// Load state needed to complete the replay
final int replayedMessages = replayOperation.replayedMessages();
// If the last N messages were admin messages then we need to send a gapfill
// after the replay query has run.
if (beginGapFillSeqNum != NONE)
{
final int newSequenceNumber =
upToMostRecent ? newSeqNo(connectionId) : endSeqNo + 1;
final Action action = sendGapFill(beginGapFillSeqNum, newSequenceNumber);
DebugLogger.log(
REPLAY,
"ReplayerSession: completeReplay-sendGapFill action=%s, replayedMessages=%d, " +
"beginGapFillSeqNum=%d, newSequenceNumber=%d%n",
action,
replayedMessages,
beginGapFillSeqNum,
newSequenceNumber);
return action != ABORT;
}
else
{
// Validate that we've replayed the correct number of messages.
// If we have missing messages for some reason then just gap fill them.
if (!upToMostRecent)
{
// We know precisely what number to gap fill up to.
final int expectedCount = endSeqNo - beginSeqNo + 1;
DebugLogger.log(
REPLAY,
"ReplayerSession: completeReplay-!upToMostRecent replayedMessages=%d endSeqNo=%d " +
"beginSeqNo=%d expectedCount=%d%n",
replayedMessages,
endSeqNo,
beginSeqNo,
expectedCount);
if (replayedMessages != expectedCount)
{
if (replayedMessages == 0)
{
final Action action = sendGapFill(beginSeqNo, endSeqNo + 1);
if (action == ABORT)
{
return false;
}
}
onIllegalState(
"[%s] Error in resend request, count(%d) < expectedCount (%d)",
message, replayedMessages, expectedCount);
}
}
else
{
DebugLogger.log(
REPLAY,
"ReplayerSession: completeReplay-upToMostRecent replayedMessages=%d%n",
replayedMessages);
}
}
return true;
}
private boolean sendCompleteMessage()
{
if (claimBuffer(MessageHeaderEncoder.ENCODED_LENGTH + ReplayCompleteEncoder.BLOCK_LENGTH))
{
REPLAY_COMPLETE_ENCODER.wrapAndApplyHeader(
bufferClaim.buffer(),
bufferClaim.offset(),
MESSAGE_HEADER_ENCODER)
.connection(connectionId);
bufferClaim.commit();
return true;
}
else
{
return false;
}
}
private int newSeqNo(final long connectionId)
{
return senderSequenceNumbers.lastSentSequenceNumber(connectionId) + 1;
}
public void close()
{
if (replayOperation != null)
{
replayOperation.close();
}
}
}
|
package fun.mortnon.flyrafter.resolver.template;
/**
* @author Moon Wu
* @date 2021/4/25
*/
public interface AlertSQLTemplate {
String ALTER_PREFIX = "ALTER TABLE `%s` ";
String MODIFY_COLUMN = "MODIFY COLUMN `%s` %s";
String ADD_COLUMN = "ADD `%s` %s";
String ADD_PRIMARY_KEY = "ADD PRIMARY KEY(`%s`)";
String DROP_COLUMN = "DROP COLUMN `%s`";
}
|
/**
* Copyright 2014 Internet2
*
* 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.
*/
/**
* @author mchyzer
* $Id$
*/
package edu.internet2.middleware.grouper.xml.export;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.dom4j.Element;
import org.dom4j.ElementHandler;
import org.dom4j.ElementPath;
import org.hibernate.Query;
import org.hibernate.ScrollableResults;
import org.hibernate.Session;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
import com.thoughtworks.xstream.io.xml.CompactWriter;
import com.thoughtworks.xstream.io.xml.Dom4JReader;
import edu.internet2.middleware.grouper.Group;
import edu.internet2.middleware.grouper.group.TypeOfGroup;
import edu.internet2.middleware.grouper.hibernate.AuditControl;
import edu.internet2.middleware.grouper.hibernate.GrouperTransactionType;
import edu.internet2.middleware.grouper.hibernate.HibUtils;
import edu.internet2.middleware.grouper.hibernate.HibernateHandler;
import edu.internet2.middleware.grouper.hibernate.HibernateHandlerBean;
import edu.internet2.middleware.grouper.hibernate.HibernateSession;
import edu.internet2.middleware.grouper.internal.dao.GrouperDAOException;
import edu.internet2.middleware.grouper.misc.GrouperVersion;
import edu.internet2.middleware.grouper.util.GrouperUtil;
import edu.internet2.middleware.grouper.xml.importXml.XmlImportMain;
/**
*
*/
public class XmlExportGroup {
/**
*
*/
private static final String XML_EXPORT_GROUP_XPATH = "/grouperExport/groups/XmlExportGroup";
/**
*
*/
private static final String GROUPS_XPATH = "/grouperExport/groups";
/** alternate name */
private String alternateName;
/** uuid */
private String uuid;
/** parentStem */
private String parentStem;
/** name */
private String name;
/** displayName */
private String displayName;
/** creatorId */
private String creatorId;
/** createTime */
private String createTime;
/** modifierId */
private String modifierId;
/** modifierTime */
private String modifierTime;
/** displayExtension */
private String displayExtension;
/** extension */
private String extension;
/** description */
private String description;
/** hibernateVersionNumber */
private long hibernateVersionNumber;
/** contextId */
private String contextId;
/** typeOfGroup */
private String typeOfGroup;
/** T or F */
private String enabled;
/** timestamp of when enabled */
private String enabledTimestamp;
/** timestamp of when disabled */
private String disableTimestamp;
/**
* logger
*/
private static final Log LOG = GrouperUtil.getLog(XmlExportGroup.class);
/**
* type of group
* @return type of group
*/
public String getTypeOfGroup() {
return this.typeOfGroup;
}
/**
* type of group
* @param typeOfGroup1
*/
public void setTypeOfGroup(String typeOfGroup1) {
this.typeOfGroup = typeOfGroup1;
}
/**
*
*/
public XmlExportGroup() {
}
/**
* alternate name
* @return alternate name
*/
public String getAlternateName() {
return this.alternateName;
}
/**
* alternateName
* @param alternateName1
*/
public void setAlternateName(String alternateName1) {
this.alternateName = alternateName1;
}
/**
* uuid
* @return uuid
*/
public String getUuid() {
return this.uuid;
}
/**
* uuid
* @param uuid1
*/
public void setUuid(String uuid1) {
this.uuid = uuid1;
}
/**
* parentStem
* @return parentStem
*/
public String getParentStem() {
return this.parentStem;
}
/**
* parentStem
* @param parentStem1
*/
public void setParentStem(String parentStem1) {
this.parentStem = parentStem1;
}
/**
* name
* @return name
*/
public String getName() {
return this.name;
}
/**
* name
* @param name
*/
public void setName(String name) {
this.name = name;
}
/**
* display name
* @return display name
*/
public String getDisplayName() {
return this.displayName;
}
/**
* display name
* @param displayName1
*/
public void setDisplayName(String displayName1) {
this.displayName = displayName1;
}
/**
* creatorId
* @return creatorId
*/
public String getCreatorId() {
return this.creatorId;
}
/**
* creatorId
* @param creatorId1
*/
public void setCreatorId(String creatorId1) {
this.creatorId = creatorId1;
}
/**
* createTime
* @return createTime
*/
public String getCreateTime() {
return this.createTime;
}
/**
* createTime
* @param createTime1
*/
public void setCreateTime(String createTime1) {
this.createTime = createTime1;
}
/**
* modifierId
* @return modifierId
*/
public String getModifierId() {
return this.modifierId;
}
/** idIndex */
private Long idIndex;
/**
*
* @return id index
*/
public Long getIdIndex() {
return this.idIndex;
}
/**
* id index
* @param idIndex1
*/
public void setIdIndex(Long idIndex1) {
this.idIndex = idIndex1;
}
/**
* modifierId
* @param modifierId1
*/
public void setModifierId(String modifierId1) {
this.modifierId = modifierId1;
}
/**
* modifierTime
* @return modifierTime
*/
public String getModifierTime() {
return this.modifierTime;
}
/**
* modifierTime
* @param modifierTime1
*/
public void setModifierTime(String modifierTime1) {
this.modifierTime = modifierTime1;
}
/**
* displayExtension
* @return displayExtension
*/
public String getDisplayExtension() {
return this.displayExtension;
}
/**
* displayExtension
* @param displayExtension1
*/
public void setDisplayExtension(String displayExtension1) {
this.displayExtension = displayExtension1;
}
/**
* extension
* @return extension
*/
public String getExtension() {
return this.extension;
}
/**
* extension
* @param extension1
*/
public void setExtension(String extension1) {
this.extension = extension1;
}
/**
* description
* @return description
*/
public String getDescription() {
return this.description;
}
/**
* description
* @param description1
*/
public void setDescription(String description1) {
this.description = description1;
}
/**
* hibernateVersionNumber
* @return hibernateVersionNumber
*/
public long getHibernateVersionNumber() {
return this.hibernateVersionNumber;
}
/**
* hibernateVersionNumber
* @param hibernateVersionNumber1
*/
public void setHibernateVersionNumber(long hibernateVersionNumber1) {
this.hibernateVersionNumber = hibernateVersionNumber1;
}
/**
* contextId
* @return contextId
*/
public String getContextId() {
return this.contextId;
}
/**
* contextId
* @param contextId1
*/
public void setContextId(String contextId1) {
this.contextId = contextId1;
}
/**
* enabled T|F
* @return enabled T|F
*/
public String getEnabled() {
return this.enabled;
}
/**
* enabled T|F
* @param enabled1
*/
public void setEnabled(String enabled1) {
this.enabled = enabled1;
}
/**
* enabled timestamp
* @return enabled timestamp
*/
public String getEnabledTimestamp() {
return this.enabledTimestamp;
}
/**
* enabled timestamp
* @param enabledTimestamp1
*/
public void setEnabledTimestamp(String enabledTimestamp1) {
this.enabledTimestamp = enabledTimestamp1;
}
/**
* disabled timestamp
* @return disabled timestamp
*/
public String getDisableTimestamp() {
return this.disableTimestamp;
}
/**
* disabled timestamp
* @param disableTimestamp1
*/
public void setDisableTimestamp(String disableTimestamp1) {
this.disableTimestamp = disableTimestamp1;
}
/**
* convert to group
* @return the group
*/
public Group toGroup() {
Group group = new Group();
group.setAlternateNameDb(this.alternateName);
group.setContextId(this.contextId);
group.setCreateTimeLong(GrouperUtil.dateLongValue(this.createTime));
group.setCreatorUuid(this.creatorId);
group.setDescriptionDb(this.description);
group.setDisplayExtensionDb(this.displayExtension);
group.setDisplayNameDb(this.displayName);
group.setExtensionDb(this.extension);
group.setHibernateVersionNumber(this.hibernateVersionNumber);
group.setIdIndex(this.idIndex);
group.setModifierUuid(this.modifierId);
group.setModifyTimeLong(GrouperUtil.dateLongValue(this.modifierTime));
group.setNameDb(this.name);
group.setParentUuid(this.parentStem);
group.setTypeOfGroupDb(this.typeOfGroup);
group.setUuid(this.uuid);
group.setDisabledTimeDb(GrouperUtil.dateLongValue(this.disableTimestamp));
group.setEnabled(GrouperUtil.booleanValue(this.enabled, true));
group.setEnabledTimeDb(GrouperUtil.dateLongValue(this.enabledTimestamp));
return group;
}
/**
* @param exportVersion
* @return the xml string
*/
public String toXml(GrouperVersion exportVersion) {
StringWriter stringWriter = new StringWriter();
this.toXml(exportVersion, stringWriter);
return stringWriter.toString();
}
/**
* @param exportVersion
* @param writer
*/
public void toXml(
@SuppressWarnings("unused") GrouperVersion exportVersion, Writer writer) {
XStream xStream = XmlExportUtils.xstream();
CompactWriter compactWriter = new CompactWriter(writer);
xStream.marshal(this, compactWriter);
}
/**
* @param exportVersion
* @param writer
* @throws IOException
*/
public void toGsh(
@SuppressWarnings("unused") GrouperVersion exportVersion, Writer writer) throws IOException {
//new GroupSave(grouperSession).assignName(this.name).assignCreateParentStemsIfNotExist(true)
//.assignDescription(this.description).assignDisplayName(this.displayName).save();
writer.write("groupSave = new GroupSave(grouperSession).assignName(\""
+ GrouperUtil.escapeDoubleQuotesSlashesAndNewlinesForString(this.name)
+ "\").assignCreateParentStemsIfNotExist(true)");
if (!StringUtils.isBlank(this.description)) {
writer.write(".assignDescription(\""
+ GrouperUtil.escapeDoubleQuotesSlashesAndNewlinesForString(this.description)
+ "\")");
}
writer.write(".assignDisplayName(\""
+ GrouperUtil.escapeDoubleQuotesSlashesAndNewlinesForString(this.displayName)
+ "\")");
writer.write(".assignTypeOfGroup(TypeOfGroup." + TypeOfGroup.valueOfIgnoreCase(this.typeOfGroup, true).name() + ");\n");
writer.write("group = groupSave.save();\ngshTotalObjectCount++;\nif (groupSave.getSaveResultType() != SaveResultType.NO_CHANGE) { System.out.println(\"Made change for group: \" + group.getName()); gshTotalChangeCount++;}\n");
if (!StringUtils.isBlank(this.alternateName)) {
writer.write("group.addAlternateName(\"" + GrouperUtil.escapeDoubleQuotesSlashesAndNewlinesForString(this.alternateName) + "\");\n");
}
}
/**
*
* @param writer
* @param xmlExportMain
*/
public static void exportGroupsGsh(final Writer writer, final XmlExportMain xmlExportMain) {
//get the members
HibernateSession.callbackHibernateSession(GrouperTransactionType.READONLY_OR_USE_EXISTING, AuditControl.WILL_NOT_AUDIT, new HibernateHandler() {
public Object callback(HibernateHandlerBean hibernateHandlerBean)
throws GrouperDAOException {
Session session = hibernateHandlerBean.getHibernateSession().getSession();
//select all members in order
Query query = session.createQuery(
"select distinct theGroup " + exportFromOnQuery(xmlExportMain, true));
final GrouperVersion grouperVersion = new GrouperVersion(GrouperVersion.GROUPER_VERSION);
//this is an efficient low-memory way to iterate through a resultset
ScrollableResults results = null;
try {
results = query.scroll();
while(results.next()) {
Object object = results.get(0);
final Group group = (Group)object;
final XmlExportGroup xmlExportGroup = group.xmlToExportGroup(grouperVersion);
HibernateSession.callbackHibernateSession(GrouperTransactionType.READONLY_NEW, AuditControl.WILL_NOT_AUDIT, new HibernateHandler() {
public Object callback(HibernateHandlerBean hibernateHandlerBean)
throws GrouperDAOException {
try {
xmlExportGroup.toGsh(grouperVersion, writer);
} catch (IOException ioe) {
throw new RuntimeException("Problem exporting group to gsh: " + group, ioe);
}
return null;
}
});
xmlExportMain.incrementRecordCount();
}
} finally {
HibUtils.closeQuietly(results);
}
return null;
}
});
}
/**
* parse the xml file for groups
* @param xmlImportMain
*/
public static void processXmlSecondPass(final XmlImportMain xmlImportMain) {
xmlImportMain.getReader().addHandler( GROUPS_XPATH,
new ElementHandler() {
public void onStart(ElementPath path) {
}
public void onEnd(ElementPath path) {
// process a ROW element
Element row = path.getCurrent();
// prune the tree
row.detach();
}
}
);
xmlImportMain.getReader().addHandler( XML_EXPORT_GROUP_XPATH,
new ElementHandler() {
public void onStart(ElementPath path) {
// do nothing here...
}
public void onEnd(ElementPath path) {
Element row = null;
try {
// process a ROW element
row = path.getCurrent();
// prune the tree
row.detach();
XmlExportGroup xmlExportGroupFromFile = (XmlExportGroup)xmlImportMain.getXstream().unmarshal(new Dom4JReader(row));
Group group = xmlExportGroupFromFile.toGroup();
XmlExportUtils.syncImportable(group, xmlImportMain);
xmlImportMain.incrementCurrentCount();
} catch (RuntimeException re) {
LOG.error("Problem importing group: " + XmlExportUtils.toString(row), re);
throw re;
}
}
}
);
}
/**
* get db count
* @param xmlExportMain
* @return db count
*/
public static long dbCount(XmlExportMain xmlExportMain) {
long result = HibernateSession.byHqlStatic().createQuery("select count(theGroup) "
+ exportFromOnQuery(xmlExportMain, false)).uniqueResult(Long.class);
return result;
}
/**
* get the query from the FROM clause on to the end for export
* @param xmlExportMain
* @param includeOrderBy
* @return the export query
*/
private static String exportFromOnQuery(XmlExportMain xmlExportMain, boolean includeOrderBy) {
//select all members in order
StringBuilder queryBuilder = new StringBuilder();
if (!xmlExportMain.filterStemsOrObjects()) {
queryBuilder.append(" from Group as theGroup ");
} else {
queryBuilder.append(
" from Group as theGroup where ");
xmlExportMain.appendHqlStemLikeOrObjectEquals(queryBuilder, "theGroup", "nameDb", false);
}
if (includeOrderBy) {
queryBuilder.append(" order by theGroup.nameDb");
}
return queryBuilder.toString();
}
/**
*
* @param writer
* @param xmlExportMain
*/
public static void exportGroups(final Writer writer, final XmlExportMain xmlExportMain) {
//get the groups
HibernateSession.callbackHibernateSession(GrouperTransactionType.READONLY_OR_USE_EXISTING, AuditControl.WILL_NOT_AUDIT, new HibernateHandler() {
public Object callback(HibernateHandlerBean hibernateHandlerBean)
throws GrouperDAOException {
Session session = hibernateHandlerBean.getHibernateSession().getSession();
//select all groups in order
Query query = session.createQuery(
"select distinct theGroup " + exportFromOnQuery(xmlExportMain, true));
GrouperVersion grouperVersion = new GrouperVersion(GrouperVersion.GROUPER_VERSION);
try {
writer.write(" <groups>\n");
//this is an efficient low-memory way to iterate through a resultset
ScrollableResults results = null;
try {
results = query.scroll();
while(results.next()) {
Object object = results.get(0);
Group group = (Group)object;
XmlExportGroup xmlExportGroup = group.xmlToExportGroup(grouperVersion);
writer.write(" ");
xmlExportGroup.toXml(grouperVersion, writer);
writer.write("\n");
xmlExportMain.incrementRecordCount();
}
} finally {
HibUtils.closeQuietly(results);
}
//end the groups element
writer.write(" </groups>\n");
} catch (IOException ioe) {
throw new RuntimeException("Problem with streaming groups", ioe);
}
return null;
}
});
}
/**
* take a reader (e.g. dom reader) and convert to an xml export group
* @param exportVersion
* @param hierarchicalStreamReader
* @return the bean
*/
public static XmlExportGroup fromXml(@SuppressWarnings("unused") GrouperVersion exportVersion,
HierarchicalStreamReader hierarchicalStreamReader) {
XStream xStream = XmlExportUtils.xstream();
XmlExportGroup xmlExportGroup = (XmlExportGroup)xStream.unmarshal(hierarchicalStreamReader);
return xmlExportGroup;
}
/**
*
* @param exportVersion
* @param xml
* @return the object from xml
*/
public static XmlExportGroup fromXml(
@SuppressWarnings("unused") GrouperVersion exportVersion, String xml) {
XStream xStream = XmlExportUtils.xstream();
XmlExportGroup xmlExportGroup = (XmlExportGroup)xStream.fromXML(xml);
return xmlExportGroup;
}
/**
* parse the xml file for groups
* @param xmlImportMain
*/
public static void processXmlFirstPass(final XmlImportMain xmlImportMain) {
xmlImportMain.getReader().addHandler( GROUPS_XPATH,
new ElementHandler() {
public void onStart(ElementPath path) {
}
public void onEnd(ElementPath path) {
// process a ROW element
Element row = path.getCurrent();
// prune the tree
row.detach();
}
}
);
xmlImportMain.getReader().addHandler( XML_EXPORT_GROUP_XPATH,
new ElementHandler() {
public void onStart(ElementPath path) {
// do nothing here...
}
public void onEnd(ElementPath path) {
// process a ROW element
Element row = path.getCurrent();
// prune the tree
row.detach();
xmlImportMain.incrementTotalImportFileCount();
}
}
);
}
}
|
package org.wildfly.swarm.examples.camel.cxf.jaxrs;
import org.fest.assertions.Assertions;
import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.junit.Arquillian;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.WebDriver;
import org.wildfly.swarm.it.AbstractIntegrationTest;
import org.wildfly.swarm.it.Log;
@RunWith(Arquillian.class)
public class CamelCxfJaxrsIT extends AbstractIntegrationTest {
@Drone
WebDriver browser;
@Test
public void testIt() throws Exception {
Log log = getStdOutLog();
assertThatLog( log ).hasLineContaining( "Bound camel naming object: java:jboss/camel/context/cxfrs-camel-context" );
browser.navigate().to("http://localhost:8080/camel/greeting/hello/Bob");
Assertions.assertThat(browser.getPageSource()).contains("Hello Bob");
}
}
|
public class ComponenteElectrico {
public String miTIPO = "NADA_POR_DEFAULT";
public int metros;
public int precioKw;
public int calorias;
public int ambientes;
public ComponenteElectrico(String type){
if (type == "LOSA_RADIANTE"){
this.miTIPO = "LOSA_RADIANTE";
}else if (type == "CeRcO-ElEcTrIcO"){
this.miTIPO = "CeRcO-ElEcTrIcO";
}else if (type == "estufa"){
this.miTIPO = "estufa";
}else{
//Por defualt será nada
}
}
public int getConsumo() {
if (miTIPO == "LOSA_RADIANTE"){
return precioKw * metros * metros;
}else if (miTIPO == "CeRcO-ElEcTrIcO"){
return metros * precioKw;
}else if (miTIPO == "estufa"){
return ambientes * precioKw * calorias;
}else{
return 0;
}
}
}
|
package edata.exception.api.request;
public class CountryBadRequestException extends RuntimeException {
public CountryBadRequestException() {
}
public CountryBadRequestException(String message) {
super(message);
}
public CountryBadRequestException(String message, Throwable cause) {
super(message, cause);
}
public CountryBadRequestException(Throwable cause) {
super(cause);
}
}
|
/*
* Copyright 2015-2018 Real Logic Ltd, Adaptive Financial Consulting Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package uk.co.real_logic.artio.engine.logger;
import io.aeron.Aeron;
import io.aeron.Subscription;
import io.aeron.archive.client.AeronArchive;
import io.aeron.archive.codecs.MessageHeaderDecoder;
import io.aeron.archive.codecs.RecordingStartedDecoder;
import io.aeron.logbuffer.FragmentHandler;
import io.aeron.logbuffer.Header;
import org.agrona.DirectBuffer;
import org.agrona.concurrent.AgentInvoker;
import org.agrona.concurrent.IdleStrategy;
import java.nio.charset.StandardCharsets;
import static io.aeron.archive.codecs.RecordingStartedDecoder.channelHeaderLength;
import static uk.co.real_logic.artio.GatewayProcess.INBOUND_LIBRARY_STREAM;
import static uk.co.real_logic.artio.GatewayProcess.OUTBOUND_LIBRARY_STREAM;
public class RecordingIdStore implements AutoCloseable
{
private static final int FRAGMENT_COUNT_LIMIT = 10;
private final RecordingIdLookup inboundLookup;
private final RecordingIdLookup outboundLookup;
private final Subscription subscription;
private final RecordingEventHandler recordingEventHandler;
public RecordingIdStore(
final Aeron aeron,
final String requiredChannel,
final AgentInvoker conductorAgentInvoker,
final IdleStrategy startupIdleStrategy,
final IdleStrategy archiverIdleStrategy)
{
subscription = aeron.addSubscription(
AeronArchive.Configuration.recordingEventsChannel(),
AeronArchive.Configuration.recordingEventsStreamId());
inboundLookup = new RecordingIdLookup(INBOUND_LIBRARY_STREAM, this, archiverIdleStrategy);
outboundLookup = new RecordingIdLookup(OUTBOUND_LIBRARY_STREAM, this, archiverIdleStrategy);
recordingEventHandler = new RecordingEventHandler(inboundLookup, outboundLookup, requiredChannel);
// Wait for the subscription setup to ensure that we receive onStart events of all
// recording started after this constructor.
while (!subscription.isConnected())
{
poll();
if (conductorAgentInvoker != null)
{
conductorAgentInvoker.invoke();
}
startupIdleStrategy.idle();
}
startupIdleStrategy.reset();
}
public RecordingIdLookup inboundLookup()
{
return inboundLookup;
}
public RecordingIdLookup outboundLookup()
{
return outboundLookup;
}
int poll()
{
return subscription.poll(recordingEventHandler, FRAGMENT_COUNT_LIMIT);
}
@Override
public void close()
{
subscription.close();
}
// RecordingEventsHandler that ships with Aeron Archive allocates objects for every onStart event.
static class RecordingEventHandler implements FragmentHandler
{
private final MessageHeaderDecoder messageHeaderDecoder = new MessageHeaderDecoder();
private final RecordingStartedDecoder recordingStartedDecoder = new RecordingStartedDecoder();
private final byte[] requiredChannel;
private final RecordingIdLookup inboundLookup;
private final RecordingIdLookup outboundLookup;
RecordingEventHandler(
final RecordingIdLookup inboundLookup,
final RecordingIdLookup outboundLookup,
final String requiredChannel)
{
this.inboundLookup = inboundLookup;
this.outboundLookup = outboundLookup;
this.requiredChannel = requiredChannel.getBytes(StandardCharsets.US_ASCII);
}
@Override
public void onFragment(
final DirectBuffer buffer, final int offset, final int length, final Header header)
{
messageHeaderDecoder.wrap(buffer, offset);
final int templateId = messageHeaderDecoder.templateId();
switch (templateId)
{
case RecordingStartedDecoder.TEMPLATE_ID:
recordingStartedDecoder.wrap(
buffer,
offset + MessageHeaderDecoder.ENCODED_LENGTH,
messageHeaderDecoder.blockLength(),
messageHeaderDecoder.version());
final long recordingId = recordingStartedDecoder.recordingId();
final int sessionId = recordingStartedDecoder.sessionId();
final int streamId = recordingStartedDecoder.streamId();
if (hasRequiredChannel(buffer))
{
inboundLookup.onStart(recordingId, sessionId, streamId);
outboundLookup.onStart(recordingId, sessionId, streamId);
}
break;
}
}
private boolean hasRequiredChannel(final DirectBuffer buffer)
{
final byte[] requiredChannel = this.requiredChannel;
final int channelLength = recordingStartedDecoder.channelLength();
if (channelLength != requiredChannel.length)
{
return false;
}
final int channelOffset = recordingStartedDecoder.limit() + channelHeaderLength();
for (int i = 0; i < channelLength; i++)
{
if (requiredChannel[i] != buffer.getByte(i + channelOffset))
{
return false;
}
}
return true;
}
}
}
|
package com.codex.et.accounts;
import java.util.ArrayList;
import java.util.List;
import com.codex.et.common.AccountActivity;
import com.codex.et.user.User;
import com.codex.et.util.AccountType;
import com.codex.et.util.TimeLine;
public class BankAccount implements Account {
private AccountType accountType;
private long balance;
private long accountNumber;
private User user;
public AccountType getAccountType() {
return accountType;
}
public long getAccountBalance() {
return balance;
}
public long getAccountNumber() {
return accountNumber;
}
public User getAssociatedUser() {
return user;
}
public List<AccountActivity> getAccountActivity(Account account, TimeLine timeLine) {
return new ArrayList<AccountActivity>();
}
public List<AccountActivity> getAccountExpenses(Account account, TimeLine timeLine) {
return new ArrayList<AccountActivity>();
}
public List<AccountActivity> getAccountIncomes(Account account, TimeLine timeLine) {
return new ArrayList<AccountActivity>();
}
public Transaction creditAccount(Account account) {
return new Transaction();
}
public Transaction debitAccount(Account account) {
return new Transaction();
}
public List<Transaction> transfer(Account toAccount) {
return new ArrayList<Transaction>();
}
}
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.qpid.server.streams;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
import java.util.LinkedList;
/**
* Allows a series of input streams to be treated as if they were one.
* NotThreadSafe
*/
public class CompositeInputStream extends InputStream
{
private final LinkedList<InputStream> _inputStreams;
private InputStream _current = null;
public CompositeInputStream(Collection<InputStream> streams)
{
if (streams == null)
{
throw new IllegalArgumentException("streams cannot be null");
}
_inputStreams = new LinkedList<>(streams);
}
@Override
public int read() throws IOException
{
int count = -1;
if (_current != null)
{
count = _current.read();
}
if (count == -1 && _inputStreams.size() > 0)
{
if (_current != null)
{
_current.close();
}
_current = _inputStreams.removeFirst();
count = read();
}
return count;
}
@Override
public int read(byte[] b, int off, int len) throws IOException
{
int count = -1;
if (_current != null)
{
count = _current.read(b, off, len);
}
if (count < len && _inputStreams.size() > 0)
{
if (_current != null)
{
_current.close();
}
_current = _inputStreams.removeFirst();
int numRead = count <= 0 ? 0 : count;
int recursiveCount = read(b, off + numRead, len - numRead);
if (recursiveCount == -1 && count == -1)
{
count = -1;
}
else if (recursiveCount == -1)
{
count = numRead;
}
else
{
count = recursiveCount + numRead;
}
}
return count;
}
@Override
public int read(byte[] b) throws IOException
{
return read(b, 0, b.length);
}
@Override
public int available() throws IOException
{
int available = 0;
if (_current != null)
{
available = _current.available();
}
if (_inputStreams != null)
{
for (InputStream is : _inputStreams)
{
if (is != null)
{
available += is.available();
}
}
}
return available;
}
@Override
public boolean markSupported()
{
return false;
}
@Override
public void mark(final int readlimit)
{
}
@Override
public void reset() throws IOException
{
throw new IOException("mark/reset not supported");
}
@Override
public void close() throws IOException
{
IOException ioException = null;
try
{
if (_current != null)
{
try
{
_current.close();
_current = null;
}
catch (IOException e)
{
ioException = e;
}
}
for (InputStream is : _inputStreams)
{
try
{
is.close();
}
catch (IOException e)
{
if (ioException != null)
{
ioException = e;
}
}
}
}
finally
{
if (ioException != null)
{
throw ioException;
}
}
}
}
|
/*
* 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.aliyuncs.retailadvqa_public.model.v20200515;
import com.aliyuncs.RpcAcsRequest;
import com.aliyuncs.http.ProtocolType;
import com.aliyuncs.http.MethodType;
/**
* @author auto create
* @version
*/
public class GetInstanceInstanceRequest extends RpcAcsRequest<GetInstanceInstanceResponse> {
private String accessId;
private String accountId;
private String accountName;
public GetInstanceInstanceRequest() {
super("retailadvqa-public", "2020-05-15", "GetInstanceInstance");
setProtocol(ProtocolType.HTTPS);
setMethod(MethodType.POST);
}
public String getAccessId() {
return this.accessId;
}
public void setAccessId(String accessId) {
this.accessId = accessId;
if(accessId != null){
putQueryParameter("AccessId", accessId);
}
}
public String getAccountId() {
return this.accountId;
}
public void setAccountId(String accountId) {
this.accountId = accountId;
if(accountId != null){
putQueryParameter("AccountId", accountId);
}
}
public String getAccountName() {
return this.accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
if(accountName != null){
putQueryParameter("AccountName", accountName);
}
}
@Override
public Class<GetInstanceInstanceResponse> getResponseClass() {
return GetInstanceInstanceResponse.class;
}
}
|
package com.forestry.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import com.forestry.bean.BoardCert;
import com.forestry.bean.PlantCert;
import com.forestry.bean.WoodCert;
import com.forestry.dto.CommonResDto;
import com.forestry.service.CertService;
@RestController
@RequestMapping("/cert")
public class CertController {
@Autowired
private CertService certService;
@RequestMapping(value = "/addWoodCert", method = RequestMethod.POST)
public CommonResDto addWoodCert(@RequestBody @Valid WoodCert woodCert, BindingResult bindingResult) {
if (certService.addWoodCert(woodCert) == 1) {
return CommonResDto.ok("addWoodCert success");
}
return CommonResDto.error("添加原木类开证单失败,请重新提交");
}
@RequestMapping(value = "/addBoardCert", method = RequestMethod.POST)
public CommonResDto addBoardCert(@RequestBody @Valid BoardCert boardCert, BindingResult bindingResult) {
if (certService.addBoardCert(boardCert) == 1) {
return CommonResDto.ok("addBoardCert success");
}
return CommonResDto.error("添加板材类开证单失败,请重新提交");
}
@RequestMapping(value = "/addPlantCert", method = RequestMethod.POST)
public CommonResDto addPlantCert(@RequestBody @Valid PlantCert plantCert, BindingResult bindingResult) {
if (certService.addPlantCert(plantCert) == 1) {
return CommonResDto.ok("addPlantCert success");
}
return CommonResDto.error("添加木材运输证与植物检疫申请失败,请重新提交");
}
@RequestMapping(value = "/addPlantCertPicture", method = RequestMethod.POST)
public CommonResDto addPlantCertPicture(HttpServletResponse res, @RequestBody Map<String, Object> reqMap) {
if (
reqMap.get("picture_url") == null ||
reqMap.get("picture_location") == null ||
reqMap.get("picture_time") == null ||
reqMap.get("id") == null
) {
res.setStatus(400);
return CommonResDto.error("缺少参数");
}
if (certService.addPlantCertPicture(reqMap.get("id").toString(), reqMap.get("picture_url").toString(), reqMap.get("picture_location").toString(), reqMap.get("picture_time").toString()) == 1) {
return CommonResDto.ok("addPlantCertPicture success");
}
return CommonResDto.error("上传车辆运输图片失败,请重新提交");
}
@RequestMapping(value = "/getCertAmount", method = RequestMethod.GET)
public CommonResDto getCertAmount() throws ExecutionException, InterruptedException {
Map<String, Object> resMap = new HashMap<>();
List<Future<Integer>> futureList = new ArrayList<>();
String[] keyArray = {"boardCertAmount", "woodCertAmount"};
int i = 0;
futureList.add(certService.getBoardCertAmount());
futureList.add(certService.getWoodCertAmount());
for (Future future : futureList) {
resMap.put(keyArray[i++], future.get());
}
return CommonResDto.ok("getCertAmount success", resMap);
}
@RequestMapping(value = "/getCert", method = RequestMethod.GET)
// 这块没必要加@RequestParam
public CommonResDto getCert(
@RequestParam(name = "type") String type,
@RequestParam(name = "status") int status
) throws ExecutionException, InterruptedException {
Map<String, Object> resMap = new HashMap<>();
List<Future<List>> futureList = new ArrayList<>();
String[] keyArray = new String[3];
int i = 0;
switch (type) {
case "": {
keyArray[0] = "boardCert";
keyArray[1] = "woodCert";
keyArray[2] = "plantCert";
futureList.add(certService.getBoardCert(status));
futureList.add(certService.getWoodCert(status));
futureList.add(certService.getPlantCert(status));
break;
}
case "wood": {
keyArray[0] = "woodCert";
futureList.add(certService.getWoodCert(status));
break;
}
case "board": {
keyArray[0] = "boardCert";
futureList.add(certService.getBoardCert(status));
break;
}
case "plant": {
keyArray[0] = "plantCert";
futureList.add(certService.getPlantCert(status));
break;
}
default: {
break;
}
}
for (Future future : futureList) {
resMap.put(keyArray[i++], future.get());
}
return CommonResDto.ok("getCert success", resMap);
}
}
|
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
package org.ofbiz.service.engine;
import java.util.Map;
import org.ofbiz.base.util.BshUtil;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.GeneralException;
import static org.ofbiz.base.util.UtilGenerics.cast;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.cache.UtilCache;
import org.ofbiz.service.GenericServiceException;
import org.ofbiz.service.ModelService;
import org.ofbiz.service.ServiceDispatcher;
import org.ofbiz.service.ServiceUtil;
/**
* BeanShell Script Service Engine
*/
public final class BeanShellEngine extends GenericAsyncEngine {
public static UtilCache<String, String> scriptCache = UtilCache.createUtilCache("BeanShellScripts", 0, 0);
public BeanShellEngine(ServiceDispatcher dispatcher) {
super(dispatcher);
}
/**
* @see org.ofbiz.service.engine.GenericEngine#runSyncIgnore(java.lang.String, org.ofbiz.service.ModelService, java.util.Map)
*/
@Override
public void runSyncIgnore(String localName, ModelService modelService, Map<String, Object> context) throws GenericServiceException {
runSync(localName, modelService, context);
}
/**
* @see org.ofbiz.service.engine.GenericEngine#runSync(java.lang.String, org.ofbiz.service.ModelService, java.util.Map)
*/
@Override
public Map<String, Object> runSync(String localName, ModelService modelService, Map<String, Object> context) throws GenericServiceException {
return serviceInvoker(localName, modelService, context);
}
// Invoke the BeanShell Script.
private Map<String, Object> serviceInvoker(String localName, ModelService modelService, Map<String, Object> context) throws GenericServiceException {
if (UtilValidate.isEmpty(modelService.location)) {
throw new GenericServiceException("Cannot run Beanshell service with empty location");
}
String location = this.getLocation(modelService);
context.put("dctx", dispatcher.getLocalContext(localName));
try {
Object resultObj = BshUtil.runBshAtLocation(location, context);
if (resultObj != null && resultObj instanceof Map) {
Debug.logInfo("Got result Map from script return: " + resultObj, module);
return cast(resultObj);
} else if (context.get("result") != null && context.get("result") instanceof Map) {
Debug.logInfo("Got result Map from context: " + resultObj, module);
return cast(context.get("result"));
}
} catch (GeneralException e) {
throw new GenericServiceException(e);
}
return ServiceUtil.returnSuccess();
}
}
|
package com.MBCAF.common.pinyin;
import com.MBCAF.common.pinyin.HanziToPinyin3.Token;
import java.util.ArrayList;
import java.util.List;
public class PinYin {
public static class PinYinElement {
// 开源TT ==> kaiyuantt
public String pinyin;
//every token's pinyin, so "你xx好" -> ["NI", "X", "Y", "HAO"]
public List<String> tokenPinyinList = new ArrayList<String>();
//every first char bonds together for all token's pinyin list
public String tokenFirstChars = "";
@Override
public String toString() {
StringBuilder part1 = new StringBuilder("PinYinElement [pinyin=" + pinyin + ", firstChars=" + tokenFirstChars + "]");
StringBuilder part2 = new StringBuilder("tokenPinyinList:");
for (String tokenPinyin : tokenPinyinList) {
part2.append(tokenPinyin).append(",");
}
return part1.append(part2).toString();
}
//@YM getPinYin 调用的入口太多,暂时临时解决
public void clear(){
tokenFirstChars = "";
tokenPinyinList.clear();
pinyin = null;
}
}
// 汉字返回拼音,字母原样返回,都转换为小写
// 函数的名称也是存在问题
public static void getPinYin(String input,PinYinElement pinyinElement) {
ArrayList<Token> tokens = HanziToPinyin3.getInstance().get(input);
StringBuilder sb = new StringBuilder();
pinyinElement.clear();
if (tokens != null && tokens.size() > 0) {
for (Token token : tokens) {
if (Token.PINYIN == token.type) {
sb.append(token.target);
pinyinElement.tokenPinyinList.add(token.target);
pinyinElement.tokenFirstChars += token.target.substring(0, 1);
} else {
//你xyz好 -> token.source = xyz, so we should separate every original character here
sb.append(token.source);
for (int i = 0; i < token.source.length(); ++i) {
String childString = token.source.substring(i, i + 1).toUpperCase();
pinyinElement.tokenPinyinList.add(childString);
pinyinElement.tokenFirstChars += childString;
}
}
}
}
String ret = sb.toString().toUpperCase();
if (!ret.isEmpty()) {
int firstChar = ret.charAt(0);
if (!(firstChar >= 'A' && firstChar <= 'Z')) {
ret = "#" + ret;
}
}
pinyinElement.pinyin = ret;
}
}
|
package com.sunbc.configure;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
/**
* Created on 2020-09-03
*
* @author sunbc
* @Describe
* @since
*/
@Configuration
public class DepartCodeConfigure {
@Bean
public RestTemplate restTemplate(){
return new RestTemplate();
}
}
|
package dev.alexferreira.projetobasico.data.repository;
import dev.alexferreira.projetobasico.data.model.UserModel;
public interface IUserRepository {
UserModel getUser(String id) throws RepositoryException;
void saveUser(UserModel userModel) throws RepositoryException;
}
|
package org.ado.biblio.config;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
import org.springframework.web.servlet.view.JstlView;
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 Andoni del Olmo
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
@Configuration
@EnableWebMvc
@ComponentScan(basePackages = "org.ado.biblio")
public class AppConfig {
@Bean
public ViewResolver viewResolver() {
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
viewResolver.setViewClass(JstlView.class);
viewResolver.setPrefix("/WEB-INF/views/");
viewResolver.setSuffix(".jsp");
return viewResolver;
}
@Bean
public MessageSource messageSource() {
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setBasename("messages");
return messageSource;
}
}
|
package com.acg12.lib.utils.skin;
import android.content.Context;
import com.acg12.lib.utils.PreferencesUtils;
/**
* Created by DELL on 2016/12/29.
*/
public class SkinConfig {
public static final String NAMESPACE = "http://schemas.android.com/android/skin";
public static final String SKIN_SUFFIX = ".theme";
public static final String SKIN_FOLER_NAME = "skin";
public static final String PREF_CUSTOM_SKIN_PATH = "cn_feng_skin_custom_path";
public static final String DEFALT_SKIN = "cn_feng_skin_default";
public static final String SKIN_FROM = "cn_feng_skin_from";
public static final int FROM_INTERNAL = 0;
public static final int FROM_EXTERNAL = 1;
public static final String ATTR_SKIN_ENABLE = "enable";
/**
* get path of last skin package path
*
* @param context
* @return path of skin package
*/
public static String getCustomSkinPath(Context context) {
return PreferencesUtils.getString(context, PREF_CUSTOM_SKIN_PATH, DEFALT_SKIN);
}
public static void saveSkinPath(Context context, String path) {
PreferencesUtils.putString(context, PREF_CUSTOM_SKIN_PATH, path);
}
public static boolean isDefaultSkin(Context context) {
return DEFALT_SKIN.equals(getCustomSkinPath(context));
}
}
|
package de.dc.spring.fx.ui.jregis.metro.ui.gen.contacts.dates.model;
import java.util.*;
import java.time.*;
import org.apache.commons.lang.builder.ToStringBuilder;
import javax.persistence.*;
@Entity
public class ContactDates{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID", nullable = false, columnDefinition = "BIGINT")
private Long id;
@Column(nullable = true)
private Long contactId;
@Column(nullable = true)
private String name;
@Column(nullable = true)
private LocalDateTime date;
@Column(nullable = true)
private Integer status;
@Column(nullable = true)
private LocalDateTime createdOn;
@Column(nullable = true)
private LocalDateTime updatedOn;
public ContactDates() {
}
public ContactDates(Long contactId, String name, LocalDateTime date, Integer status, LocalDateTime createdOn, LocalDateTime updatedOn) {
this.contactId = contactId;
this.name = name;
this.date = date;
this.status = status;
this.createdOn = createdOn;
this.updatedOn = updatedOn;
}
public Long getId(){
return id;
}
public void setId(Long id){
this.id=id;
}
public Long getContactId() {
return contactId;
}
public void setContactId(Long contactId) {
this.contactId = contactId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public LocalDateTime getDate() {
return date;
}
public void setDate(LocalDateTime date) {
this.date = date;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public LocalDateTime getCreatedOn() {
return createdOn;
}
public void setCreatedOn(LocalDateTime createdOn) {
this.createdOn = createdOn;
}
public LocalDateTime getUpdatedOn() {
return updatedOn;
}
public void setUpdatedOn(LocalDateTime updatedOn) {
this.updatedOn = updatedOn;
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
}
|
/*================================================================================
Copyright (c) 2012 Steve Jin. 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 VMware, 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 VMWARE, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
================================================================================*/
package com.vmware.vim25;
/**
* @author Steve Jin (http://www.doublecloud.org)
* @version 5.1
*/
@SuppressWarnings("all")
public class HostUnresolvedVmfsResolutionResult extends DynamicData {
public HostUnresolvedVmfsResolutionSpec spec;
public HostVmfsVolume vmfs;
public LocalizedMethodFault fault;
public HostUnresolvedVmfsResolutionSpec getSpec() {
return this.spec;
}
public HostVmfsVolume getVmfs() {
return this.vmfs;
}
public LocalizedMethodFault getFault() {
return this.fault;
}
public void setSpec(HostUnresolvedVmfsResolutionSpec spec) {
this.spec=spec;
}
public void setVmfs(HostVmfsVolume vmfs) {
this.vmfs=vmfs;
}
public void setFault(LocalizedMethodFault fault) {
this.fault=fault;
}
}
|
package cn.leo.leoblog.pojo;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;
@Entity
@Table(name = "c_tag")
public class Tag {
@Id
@GeneratedValue
private Long id;
private String name;
@ManyToMany(mappedBy = "tags")
private List<Blog> blogs=new ArrayList<>();
public Tag() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<Blog> getBlogs() {
return blogs;
}
public void setBlogs(List<Blog> blogs) {
this.blogs = blogs;
}
@Override
public String toString() {
return "Tag{" +
"id=" + id +
", name='" + name + '\'' +
'}';
}
}
|
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of Smetana.
* Smetana is a partial translation of Graphviz/Dot sources from C to Java.
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* This translation is distributed under the same Licence as the original C program:
*
*************************************************************************
* Copyright (c) 2011 AT&T Intellectual Property
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors: See CVS logs. Details at http://www.graphviz.org/
*************************************************************************
*
* THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
* LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0]
*
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES
* RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
*
* You may obtain a copy of the License at
*
* http://www.eclipse.org/legal/epl-v10.html
*
* 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 gen.lib.cdt;
import static smetana.core.Macro.UNSUPPORTED;
public class dtrenew__c {
//1 9k44uhd5foylaeoekf3llonjq
// extern Dtmethod_t* Dtset
//1 1ahfywsmzcpcig2oxm7pt9ihj
// extern Dtmethod_t* Dtbag
//1 anhghfj3k7dmkudy2n7rvt31v
// extern Dtmethod_t* Dtoset
//1 5l6oj1ux946zjwvir94ykejbc
// extern Dtmethod_t* Dtobag
//1 2wtf222ak6cui8cfjnw6w377z
// extern Dtmethod_t* Dtlist
//1 d1s1s6ibtcsmst88e3057u9r7
// extern Dtmethod_t* Dtstack
//1 axa7mflo824p6fspjn1rdk0mt
// extern Dtmethod_t* Dtqueue
//1 ega812utobm4xx9oa9w9ayij6
// extern Dtmethod_t* Dtdeque
//1 cyfr996ur43045jv1tjbelzmj
// extern Dtmethod_t* Dtorder
//1 wlofoiftbjgrrabzb2brkycg
// extern Dtmethod_t* Dttree
//1 12bds94t7voj7ulwpcvgf6agr
// extern Dtmethod_t* Dthash
//1 9lqknzty480cy7zsubmabkk8h
// extern Dtmethod_t _Dttree
//1 bvn6zkbcp8vjdhkccqo1xrkrb
// extern Dtmethod_t _Dthash
//1 9lidhtd6nsmmv3e7vjv9e10gw
// extern Dtmethod_t _Dtlist
//1 34ujfamjxo7xn89u90oh2k6f8
// extern Dtmethod_t _Dtqueue
//1 3jy4aceckzkdv950h89p4wjc8
// extern Dtmethod_t _Dtstack
//3 dpntyaoee84n51hi5hei3meki
// void* dtrenew(Dt_t* dt, register void* obj)
public static Object dtrenew(Object... arg) {
UNSUPPORTED("c1icavxc4bdl41jaglud7ov9y"); // void* dtrenew(Dt_t* dt, register void* obj)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("75g1y88zfpqk2mdy0p3bzcp5u"); // register void* key;
UNSUPPORTED("7hzc11j4z5915otom5ec9sc1p"); // register Dtlink_t *e, *t, **s;
UNSUPPORTED("ab9fv18fhjzwp3wngyyqarrns"); // register Dtdisc_t* disc = dt->disc;
UNSUPPORTED("ckjxpmega2z5oju8xk72wsy0q"); // ((dt->data->type&010000) ? dtrestore(dt,((Dtlink_t*)0)) : 0);
UNSUPPORTED("afazqxuj3nf5t37agp5loypap"); // if(!(e = dt->data->here) || (disc->link < 0 ? ((Dthold_t*)(e))->obj : (void*)((char*)(e) - disc->link) ) != obj)
UNSUPPORTED("5p6q7ip4om6y4nrsjz07ua456"); // return ((void*)0);
UNSUPPORTED("epetks7tchxd027a5fogh5s8y"); // if(dt->data->type&(0000040|0000100|0000020))
UNSUPPORTED("62u47ehg5sw7ibh04rvqqdaws"); // return obj;
UNSUPPORTED("d0a3msvhdhl5w8ezkp8afz1ay"); // else if(dt->data->type&(0000004|0000010) )
UNSUPPORTED("6nk9lof9sqibzqlvn7z3v0adk"); // { if(!e->right ) /* make left child the new root */
UNSUPPORTED("ca72p6wo0wlrje8mc1clzkgd"); // dt->data->here = e->hl._left;
UNSUPPORTED("9kvzz8qhw1tc87iizefkx7jux"); // else /* make right child the new root */
UNSUPPORTED("bw0zxd3ks2tqu4oa88193x30s"); // { dt->data->here = e->right;
UNSUPPORTED("7xxvhxwnjmtln4k5iqxwas7gy"); // /* merge left subtree to right subtree */
UNSUPPORTED("b5hfkdgjlasjtdi2d8j9cnsfl"); // if(e->hl._left)
UNSUPPORTED("7qj77o9upzr06q7w290ppiijf"); // { for(t = e->right; t->hl._left; t = t->hl._left)
UNSUPPORTED("6f76030mwgybzczalesd54a9q"); // ;
UNSUPPORTED("31m2jyxntk5bvmxrlz7e1060n"); // t->hl._left = e->hl._left;
UNSUPPORTED("3to5h0rvqxdeqs38mhv47mm3o"); // }
UNSUPPORTED("6eq5kf0bj692bokt0bixy1ixh"); // }
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
UNSUPPORTED("9jvkhuwh0wij26qmyu1sft73s"); // else /*if(dt->data->type&(DT_SET|DT_BAG))*/
UNSUPPORTED("av4lr5g8w88ulq2cwdubl498l"); // { s = dt->data->hh._htab + ((e->hl._hash)&((dt->data->ntab)-1));
UNSUPPORTED("blraorobd8eq0hg3b3w3uxkwt"); // if((t = *s) == e)
UNSUPPORTED("6bxfg7yydrmhsw5oysk7cxytq"); // *s = e->right;
UNSUPPORTED("7e1uy5mzei37p66t8jp01r3mk"); // else
UNSUPPORTED("z3sto7b7d7g3tgy1pobqnftq"); // { for(; t->right != e; t = t->right)
UNSUPPORTED("8c0hnggfgcchqp0vr4bwobm4t"); // ;
UNSUPPORTED("2bmnk8u0o0gw61p068qqsvd35"); // t->right = e->right;
UNSUPPORTED("6eq5kf0bj692bokt0bixy1ixh"); // }
UNSUPPORTED("7i9supotcfsya189dptbk9mg6"); // key = (void*)(disc->size < 0 ? *((char**)((char*)(obj)+disc->key)) : ((char*)(obj)+disc->key));
UNSUPPORTED("6k8ldpnvi2limcrix2xyqga8a"); // e->hl._hash = (disc->hashf ? (*disc->hashf)(dt,key,disc) : dtstrhash(0,key,disc->size) );
UNSUPPORTED("6vkn7padspfbtju9g5b65b34w"); // dt->data->here = ((Dtlink_t*)0);
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
UNSUPPORTED("zjdphdwef22jifi7kl4wial9"); // dt->data->size -= 1;
UNSUPPORTED("27sbkwn3jowh7b7zt5tzb2v4q"); // return (*dt->meth->searchf)(dt,(void*)e,0000040) ? obj : ((void*)0);
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
}
}
|
/*
* Created on Aug 20, 2010
*/
package org.uslhcnet.rrd;
import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
import lia.util.MLProcess;
import org.uslhcnet.rrd.config.RRDConfig;
import org.uslhcnet.rrd.config.RRDConfigManager;
/**
* @author ramiro
*/
public class RRDFile {
private static final Logger logger = Logger.getLogger(RRDFile.class.getName());
private final File rrdFile;
private final RRDConfig template;
/**
* @param rrdDirectory
* @param rrdFileKey
* @param dataSources
* @param rraConfig
* @throws IOException
*/
public RRDFile(final String rrdFileName, RRDConfig template) throws IOException {
final RRDConfigManager rrdCfgMgr = RRDConfigManager.getInstance();
final String rrdDir = rrdCfgMgr.rrdDirectory();
final String rrdExt = rrdCfgMgr.rrdFileExtension();
this.rrdFile = new File(rrdDir + File.separatorChar + rrdFileName + rrdExt);
this.template = template;
}
/**
* @throws IOException
*/
public synchronized void createRRDFile() throws IOException {
if (!rrdFile.exists()) {
final String rrdCreateCMD = template.getRRDCreateCommand(rrdFile.toString());
logger.log(Level.INFO, " RRDFile: " + rrdFile + " does not exist. Creating it using cmd: " + rrdCreateCMD);
try {
Process p = MLProcess.exec(RRDConfigManager.getInstance().rrdToolCmd() + " " + rrdCreateCMD);
int exitStatus = p.waitFor();
if (exitStatus != 0) {
logger.log(Level.WARNING, " exist status for: " + rrdCreateCMD + " was " + exitStatus);
throw new IOException("Unable to rrdcreate " + rrdFile + ". Exit status = " + exitStatus);
}
} catch (Throwable t) {
throw new IOException("Unable to rrdcreate " + rrdFile + ". Cause: ", t);
}
}
}
public <T> void addValues(final long timestamp, Collection<DSValue<T>> values) throws IOException {
if (!rrdFile.exists()) {
createRRDFile();
}
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST, " [ RRDFile ] " + rrdFile + " add multiple values: " + values);
}
StringBuilder sb = new StringBuilder();
sb.append(" update ").append(rrdFile.toString()).append(" --template ");
StringBuilder sbValTS = new StringBuilder(" ").append(timestamp).append(':');
// build cmd line
for (final Iterator<DSValue<T>> it = values.iterator(); it.hasNext();) {
final DSValue<T> dsVal = it.next();
//
sb.append(dsVal.ds().name());
sbValTS.append(dsVal.value());
if (it.hasNext()) {
sb.append(':');
sbValTS.append(':');
}
}
final String updateCmd = sb.toString() + sbValTS.toString();
if (logger.isLoggable(Level.FINER)) {
logger.log(Level.FINER, " [ RRDFile ] update cmd: " + updateCmd);
}
try {
Process p = MLProcess.exec(RRDConfigManager.getInstance().rrdToolCmd() + " " + updateCmd);
int exitStatus = p.waitFor();
if (exitStatus != 0) {
logger.log(Level.SEVERE, " [ RRDFile ] [ rrdupdate ERROR ] exist status for: " + updateCmd + " was "
+ exitStatus);
}
} catch (Throwable t) {
throw new IOException("Unable to rrdupdate " + rrdFile + ". Cause: ", t);
}
}
}
|
package org.monkey.mmq.config.modules;
import org.monkey.mmq.core.utils.StringUtils;
/**
* @ClassNameBaseModule
* @Description
* @Author Solley
* @Date2022/1/18 23:00
* @Version V1.0
**/
public abstract class BaseModule<Param> implements IModule<Param> {
protected ModelMateData modelMateData;
@Override
public void update(ModelMateData modelMateData) {
if (modelMateData == null) return;
if (StringUtils.isEmpty(modelMateData.getDescription())) return;
if (StringUtils.isEmpty(modelMateData.getIcon())) return;
if (StringUtils.isEmpty(modelMateData.getModuleName())) return;
this.modelMateData = modelMateData;
}
@Override
public ModelMateData getConfig() {
return this.modelMateData;
}
@Override
public boolean getEnable() {
return this.modelMateData.getEnable();
}
}
|
package cn.parzulpan.service;
import cn.parzulpan.dao.BankAccountDAO;
import cn.parzulpan.domain.BankAccount;
import java.util.List;
/**
* @Author : parzulpan
* @Time : 2020-12
* @Desc : 银行账户的业务层接口的实现类
*/
public class BankAccountServiceImpl implements BankAccountService {
private BankAccountDAO bankAccountDAO;
public void setBankAccountDAO(BankAccountDAO bankAccountDAO) {
this.bankAccountDAO = bankAccountDAO;
}
public List<BankAccount> findAll() {
return bankAccountDAO.findAll();
}
public BankAccount findById(Integer id) {
return bankAccountDAO.findById(id);
}
public void save(BankAccount bankAccount) {
bankAccountDAO.save(bankAccount);
}
public void update(BankAccount bankAccount) {
bankAccountDAO.update(bankAccount);
}
public void deleteById(Integer id) {
bankAccountDAO.deleteById(id);
}
}
|
package pkg_servicio;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Clase Java para eliminarTipoTransac complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* <complexType name="eliminarTipoTransac">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="as_codigo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "eliminarTipoTransac", propOrder = {
"asCodigo"
})
public class EliminarTipoTransac {
@XmlElement(name = "as_codigo")
protected String asCodigo;
/**
* Obtiene el valor de la propiedad asCodigo.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAsCodigo() {
return asCodigo;
}
/**
* Define el valor de la propiedad asCodigo.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAsCodigo(String value) {
this.asCodigo = value;
}
}
|
package com.vmware.avi.sdk.model;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
/**
* The RateLimiterAction is a POJO class extends AviRestResource that used for creating
* RateLimiterAction.
*
* @version 1.0
* @since
*
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class RateLimiterAction {
@JsonProperty("file")
private HTTPLocalFile file = null;
@JsonProperty("redirect")
private HTTPRedirectAction redirect = null;
@JsonProperty("status_code")
private String statusCode = "HTTP_LOCAL_RESPONSE_STATUS_CODE_429";
@JsonProperty("type")
private String type = "RL_ACTION_NONE";
/**
* This is the getter method this will return the attribute value.
* File to be used for http local response rate limit action.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @return file
*/
public HTTPLocalFile getFile() {
return file;
}
/**
* This is the setter method to the attribute.
* File to be used for http local response rate limit action.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @param file set the file.
*/
public void setFile(HTTPLocalFile file) {
this.file = file;
}
/**
* This is the getter method this will return the attribute value.
* Parameters for http redirect rate limit action.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @return redirect
*/
public HTTPRedirectAction getRedirect() {
return redirect;
}
/**
* This is the setter method to the attribute.
* Parameters for http redirect rate limit action.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @param redirect set the redirect.
*/
public void setRedirect(HTTPRedirectAction redirect) {
this.redirect = redirect;
}
/**
* This is the getter method this will return the attribute value.
* Http status code for local response rate limit action.
* Enum options - HTTP_LOCAL_RESPONSE_STATUS_CODE_200, HTTP_LOCAL_RESPONSE_STATUS_CODE_204, HTTP_LOCAL_RESPONSE_STATUS_CODE_403,
* HTTP_LOCAL_RESPONSE_STATUS_CODE_404, HTTP_LOCAL_RESPONSE_STATUS_CODE_429, HTTP_LOCAL_RESPONSE_STATUS_CODE_501.
* Default value when not specified in API or module is interpreted by Avi Controller as "HTTP_LOCAL_RESPONSE_STATUS_CODE_429".
* @return statusCode
*/
public String getStatusCode() {
return statusCode;
}
/**
* This is the setter method to the attribute.
* Http status code for local response rate limit action.
* Enum options - HTTP_LOCAL_RESPONSE_STATUS_CODE_200, HTTP_LOCAL_RESPONSE_STATUS_CODE_204, HTTP_LOCAL_RESPONSE_STATUS_CODE_403,
* HTTP_LOCAL_RESPONSE_STATUS_CODE_404, HTTP_LOCAL_RESPONSE_STATUS_CODE_429, HTTP_LOCAL_RESPONSE_STATUS_CODE_501.
* Default value when not specified in API or module is interpreted by Avi Controller as "HTTP_LOCAL_RESPONSE_STATUS_CODE_429".
* @param statusCode set the statusCode.
*/
public void setStatusCode(String statusCode) {
this.statusCode = statusCode;
}
/**
* This is the getter method this will return the attribute value.
* Type of action to be enforced upon hitting the rate limit.
* Enum options - RL_ACTION_NONE, RL_ACTION_DROP_CONN, RL_ACTION_RESET_CONN, RL_ACTION_CLOSE_CONN, RL_ACTION_LOCAL_RSP, RL_ACTION_REDIRECT.
* Default value when not specified in API or module is interpreted by Avi Controller as "RL_ACTION_NONE".
* @return type
*/
public String getType() {
return type;
}
/**
* This is the setter method to the attribute.
* Type of action to be enforced upon hitting the rate limit.
* Enum options - RL_ACTION_NONE, RL_ACTION_DROP_CONN, RL_ACTION_RESET_CONN, RL_ACTION_CLOSE_CONN, RL_ACTION_LOCAL_RSP, RL_ACTION_REDIRECT.
* Default value when not specified in API or module is interpreted by Avi Controller as "RL_ACTION_NONE".
* @param type set the type.
*/
public void setType(String type) {
this.type = type;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
RateLimiterAction objRateLimiterAction = (RateLimiterAction) o;
return Objects.equals(this.type, objRateLimiterAction.type)&&
Objects.equals(this.redirect, objRateLimiterAction.redirect)&&
Objects.equals(this.statusCode, objRateLimiterAction.statusCode)&&
Objects.equals(this.file, objRateLimiterAction.file);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class RateLimiterAction {\n");
sb.append(" file: ").append(toIndentedString(file)).append("\n");
sb.append(" redirect: ").append(toIndentedString(redirect)).append("\n");
sb.append(" statusCode: ").append(toIndentedString(statusCode)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
|
package leviathan.proxy;
public class ServerProxy extends CommonProxy {
}
|
package net.minecraft.world.gen.structure;
import com.google.common.collect.Lists;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.world.World;
public class StructureNetherBridgePieces
{
private static final StructureNetherBridgePieces.PieceWeight[] primaryComponents = new StructureNetherBridgePieces.PieceWeight[] {new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Straight.class, 30, 0, true), new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Crossing3.class, 10, 4), new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Crossing.class, 10, 4), new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Stairs.class, 10, 3), new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Throne.class, 5, 2), new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Entrance.class, 5, 1)};
private static final StructureNetherBridgePieces.PieceWeight[] secondaryComponents = new StructureNetherBridgePieces.PieceWeight[] {new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Corridor5.class, 25, 0, true), new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Crossing2.class, 15, 5), new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Corridor2.class, 5, 10), new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Corridor.class, 5, 10), new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Corridor3.class, 10, 3, true), new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Corridor4.class, 7, 2), new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.NetherStalkRoom.class, 5, 2)};
private static final String __OBFID = "CL_00000453";
public static void registerNetherFortressPieces()
{
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Crossing3.class, "NeBCr");
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.End.class, "NeBEF");
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Straight.class, "NeBS");
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Corridor3.class, "NeCCS");
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Corridor4.class, "NeCTB");
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Entrance.class, "NeCE");
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Crossing2.class, "NeSCSC");
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Corridor.class, "NeSCLT");
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Corridor5.class, "NeSC");
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Corridor2.class, "NeSCRT");
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.NetherStalkRoom.class, "NeCSR");
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Throne.class, "NeMT");
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Crossing.class, "NeRC");
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Stairs.class, "NeSR");
MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Start.class, "NeStart");
}
private static StructureNetherBridgePieces.Piece func_175887_b(StructureNetherBridgePieces.PieceWeight p_175887_0_, List p_175887_1_, Random p_175887_2_, int p_175887_3_, int p_175887_4_, int p_175887_5_, EnumFacing p_175887_6_, int p_175887_7_)
{
Class var8 = p_175887_0_.weightClass;
Object var9 = null;
if (var8 == StructureNetherBridgePieces.Straight.class)
{
var9 = StructureNetherBridgePieces.Straight.func_175882_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_6_, p_175887_7_);
}
else if (var8 == StructureNetherBridgePieces.Crossing3.class)
{
var9 = StructureNetherBridgePieces.Crossing3.func_175885_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_6_, p_175887_7_);
}
else if (var8 == StructureNetherBridgePieces.Crossing.class)
{
var9 = StructureNetherBridgePieces.Crossing.func_175873_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_6_, p_175887_7_);
}
else if (var8 == StructureNetherBridgePieces.Stairs.class)
{
var9 = StructureNetherBridgePieces.Stairs.func_175872_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_7_, p_175887_6_);
}
else if (var8 == StructureNetherBridgePieces.Throne.class)
{
var9 = StructureNetherBridgePieces.Throne.func_175874_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_7_, p_175887_6_);
}
else if (var8 == StructureNetherBridgePieces.Entrance.class)
{
var9 = StructureNetherBridgePieces.Entrance.func_175881_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_6_, p_175887_7_);
}
else if (var8 == StructureNetherBridgePieces.Corridor5.class)
{
var9 = StructureNetherBridgePieces.Corridor5.func_175877_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_6_, p_175887_7_);
}
else if (var8 == StructureNetherBridgePieces.Corridor2.class)
{
var9 = StructureNetherBridgePieces.Corridor2.func_175876_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_6_, p_175887_7_);
}
else if (var8 == StructureNetherBridgePieces.Corridor.class)
{
var9 = StructureNetherBridgePieces.Corridor.func_175879_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_6_, p_175887_7_);
}
else if (var8 == StructureNetherBridgePieces.Corridor3.class)
{
var9 = StructureNetherBridgePieces.Corridor3.func_175883_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_6_, p_175887_7_);
}
else if (var8 == StructureNetherBridgePieces.Corridor4.class)
{
var9 = StructureNetherBridgePieces.Corridor4.func_175880_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_6_, p_175887_7_);
}
else if (var8 == StructureNetherBridgePieces.Crossing2.class)
{
var9 = StructureNetherBridgePieces.Crossing2.func_175878_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_6_, p_175887_7_);
}
else if (var8 == StructureNetherBridgePieces.NetherStalkRoom.class)
{
var9 = StructureNetherBridgePieces.NetherStalkRoom.func_175875_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_6_, p_175887_7_);
}
return (StructureNetherBridgePieces.Piece)var9;
}
public static class Corridor extends StructureNetherBridgePieces.Piece
{
private boolean field_111021_b;
private static final String __OBFID = "CL_00000461";
public Corridor() {}
public Corridor(int p_i45615_1_, Random p_i45615_2_, StructureBoundingBox p_i45615_3_, EnumFacing p_i45615_4_)
{
super(p_i45615_1_);
this.coordBaseMode = p_i45615_4_;
this.boundingBox = p_i45615_3_;
this.field_111021_b = p_i45615_2_.nextInt(3) == 0;
}
protected void readStructureFromNBT(NBTTagCompound p_143011_1_)
{
super.readStructureFromNBT(p_143011_1_);
this.field_111021_b = p_143011_1_.getBoolean("Chest");
}
protected void writeStructureToNBT(NBTTagCompound p_143012_1_)
{
super.writeStructureToNBT(p_143012_1_);
p_143012_1_.setBoolean("Chest", this.field_111021_b);
}
public void buildComponent(StructureComponent p_74861_1_, List p_74861_2_, Random p_74861_3_)
{
this.getNextComponentX((StructureNetherBridgePieces.Start)p_74861_1_, p_74861_2_, p_74861_3_, 0, 1, true);
}
public static StructureNetherBridgePieces.Corridor func_175879_a(List p_175879_0_, Random p_175879_1_, int p_175879_2_, int p_175879_3_, int p_175879_4_, EnumFacing p_175879_5_, int p_175879_6_)
{
StructureBoundingBox var7 = StructureBoundingBox.func_175897_a(p_175879_2_, p_175879_3_, p_175879_4_, -1, 0, 0, 5, 7, 5, p_175879_5_);
return isAboveGround(var7) && StructureComponent.findIntersecting(p_175879_0_, var7) == null ? new StructureNetherBridgePieces.Corridor(p_175879_6_, p_175879_1_, var7, p_175879_5_) : null;
}
public boolean addComponentParts(World worldIn, Random p_74875_2_, StructureBoundingBox p_74875_3_)
{
this.func_175804_a(worldIn, p_74875_3_, 0, 0, 0, 4, 1, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 0, 4, 5, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 4, 2, 0, 4, 5, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 4, 3, 1, 4, 4, 1, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 4, 3, 3, 4, 4, 3, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 0, 0, 5, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 4, 3, 5, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 1, 3, 4, 1, 4, 4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 3, 3, 4, 3, 4, 4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
if (this.field_111021_b && p_74875_3_.func_175898_b(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3))))
{
this.field_111021_b = false;
this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 2, 3, field_111019_a, 2 + p_74875_2_.nextInt(4));
}
this.func_175804_a(worldIn, p_74875_3_, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
for (int var4 = 0; var4 <= 4; ++var4)
{
for (int var5 = 0; var5 <= 4; ++var5)
{
this.func_175808_b(worldIn, Blocks.nether_brick.getDefaultState(), var4, -1, var5, p_74875_3_);
}
}
return true;
}
}
public static class Corridor2 extends StructureNetherBridgePieces.Piece
{
private boolean field_111020_b;
private static final String __OBFID = "CL_00000463";
public Corridor2() {}
public Corridor2(int p_i45613_1_, Random p_i45613_2_, StructureBoundingBox p_i45613_3_, EnumFacing p_i45613_4_)
{
super(p_i45613_1_);
this.coordBaseMode = p_i45613_4_;
this.boundingBox = p_i45613_3_;
this.field_111020_b = p_i45613_2_.nextInt(3) == 0;
}
protected void readStructureFromNBT(NBTTagCompound p_143011_1_)
{
super.readStructureFromNBT(p_143011_1_);
this.field_111020_b = p_143011_1_.getBoolean("Chest");
}
protected void writeStructureToNBT(NBTTagCompound p_143012_1_)
{
super.writeStructureToNBT(p_143012_1_);
p_143012_1_.setBoolean("Chest", this.field_111020_b);
}
public void buildComponent(StructureComponent p_74861_1_, List p_74861_2_, Random p_74861_3_)
{
this.getNextComponentZ((StructureNetherBridgePieces.Start)p_74861_1_, p_74861_2_, p_74861_3_, 0, 1, true);
}
public static StructureNetherBridgePieces.Corridor2 func_175876_a(List p_175876_0_, Random p_175876_1_, int p_175876_2_, int p_175876_3_, int p_175876_4_, EnumFacing p_175876_5_, int p_175876_6_)
{
StructureBoundingBox var7 = StructureBoundingBox.func_175897_a(p_175876_2_, p_175876_3_, p_175876_4_, -1, 0, 0, 5, 7, 5, p_175876_5_);
return isAboveGround(var7) && StructureComponent.findIntersecting(p_175876_0_, var7) == null ? new StructureNetherBridgePieces.Corridor2(p_175876_6_, p_175876_1_, var7, p_175876_5_) : null;
}
public boolean addComponentParts(World worldIn, Random p_74875_2_, StructureBoundingBox p_74875_3_)
{
this.func_175804_a(worldIn, p_74875_3_, 0, 0, 0, 4, 1, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 0, 4, 5, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 0, 0, 5, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 3, 1, 0, 4, 1, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 3, 3, 0, 4, 3, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 4, 2, 0, 4, 5, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 1, 2, 4, 4, 5, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 1, 3, 4, 1, 4, 4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 3, 3, 4, 3, 4, 4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
if (this.field_111020_b && p_74875_3_.func_175898_b(new BlockPos(this.getXWithOffset(1, 3), this.getYWithOffset(2), this.getZWithOffset(1, 3))))
{
this.field_111020_b = false;
this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 1, 2, 3, field_111019_a, 2 + p_74875_2_.nextInt(4));
}
this.func_175804_a(worldIn, p_74875_3_, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
for (int var4 = 0; var4 <= 4; ++var4)
{
for (int var5 = 0; var5 <= 4; ++var5)
{
this.func_175808_b(worldIn, Blocks.nether_brick.getDefaultState(), var4, -1, var5, p_74875_3_);
}
}
return true;
}
}
public static class Corridor3 extends StructureNetherBridgePieces.Piece
{
private static final String __OBFID = "CL_00000457";
public Corridor3() {}
public Corridor3(int p_i45619_1_, Random p_i45619_2_, StructureBoundingBox p_i45619_3_, EnumFacing p_i45619_4_)
{
super(p_i45619_1_);
this.coordBaseMode = p_i45619_4_;
this.boundingBox = p_i45619_3_;
}
public void buildComponent(StructureComponent p_74861_1_, List p_74861_2_, Random p_74861_3_)
{
this.getNextComponentNormal((StructureNetherBridgePieces.Start)p_74861_1_, p_74861_2_, p_74861_3_, 1, 0, true);
}
public static StructureNetherBridgePieces.Corridor3 func_175883_a(List p_175883_0_, Random p_175883_1_, int p_175883_2_, int p_175883_3_, int p_175883_4_, EnumFacing p_175883_5_, int p_175883_6_)
{
StructureBoundingBox var7 = StructureBoundingBox.func_175897_a(p_175883_2_, p_175883_3_, p_175883_4_, -1, -7, 0, 5, 14, 10, p_175883_5_);
return isAboveGround(var7) && StructureComponent.findIntersecting(p_175883_0_, var7) == null ? new StructureNetherBridgePieces.Corridor3(p_175883_6_, p_175883_1_, var7, p_175883_5_) : null;
}
public boolean addComponentParts(World worldIn, Random p_74875_2_, StructureBoundingBox p_74875_3_)
{
int var4 = this.getMetadataWithOffset(Blocks.nether_brick_stairs, 2);
for (int var5 = 0; var5 <= 9; ++var5)
{
int var6 = Math.max(1, 7 - var5);
int var7 = Math.min(Math.max(var6 + 5, 14 - var5), 13);
int var8 = var5;
this.func_175804_a(worldIn, p_74875_3_, 0, 0, var5, 4, var6, var5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 1, var6 + 1, var5, 3, var7 - 1, var5, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
if (var5 <= 6)
{
this.func_175811_a(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(var4), 1, var6 + 1, var5, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(var4), 2, var6 + 1, var5, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(var4), 3, var6 + 1, var5, p_74875_3_);
}
this.func_175804_a(worldIn, p_74875_3_, 0, var7, var5, 4, var7, var5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, var6 + 1, var5, 0, var7 - 1, var5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 4, var6 + 1, var5, 4, var7 - 1, var5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
if ((var5 & 1) == 0)
{
this.func_175804_a(worldIn, p_74875_3_, 0, var6 + 2, var5, 0, var6 + 3, var5, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 4, var6 + 2, var5, 4, var6 + 3, var5, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
}
for (int var9 = 0; var9 <= 4; ++var9)
{
this.func_175808_b(worldIn, Blocks.nether_brick.getDefaultState(), var9, -1, var8, p_74875_3_);
}
}
return true;
}
}
public static class Corridor4 extends StructureNetherBridgePieces.Piece
{
private static final String __OBFID = "CL_00000458";
public Corridor4() {}
public Corridor4(int p_i45618_1_, Random p_i45618_2_, StructureBoundingBox p_i45618_3_, EnumFacing p_i45618_4_)
{
super(p_i45618_1_);
this.coordBaseMode = p_i45618_4_;
this.boundingBox = p_i45618_3_;
}
public void buildComponent(StructureComponent p_74861_1_, List p_74861_2_, Random p_74861_3_)
{
byte var4 = 1;
if (this.coordBaseMode == EnumFacing.WEST || this.coordBaseMode == EnumFacing.NORTH)
{
var4 = 5;
}
this.getNextComponentX((StructureNetherBridgePieces.Start)p_74861_1_, p_74861_2_, p_74861_3_, 0, var4, p_74861_3_.nextInt(8) > 0);
this.getNextComponentZ((StructureNetherBridgePieces.Start)p_74861_1_, p_74861_2_, p_74861_3_, 0, var4, p_74861_3_.nextInt(8) > 0);
}
public static StructureNetherBridgePieces.Corridor4 func_175880_a(List p_175880_0_, Random p_175880_1_, int p_175880_2_, int p_175880_3_, int p_175880_4_, EnumFacing p_175880_5_, int p_175880_6_)
{
StructureBoundingBox var7 = StructureBoundingBox.func_175897_a(p_175880_2_, p_175880_3_, p_175880_4_, -3, 0, 0, 9, 7, 9, p_175880_5_);
return isAboveGround(var7) && StructureComponent.findIntersecting(p_175880_0_, var7) == null ? new StructureNetherBridgePieces.Corridor4(p_175880_6_, p_175880_1_, var7, p_175880_5_) : null;
}
public boolean addComponentParts(World worldIn, Random p_74875_2_, StructureBoundingBox p_74875_3_)
{
this.func_175804_a(worldIn, p_74875_3_, 0, 0, 0, 8, 1, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 0, 8, 5, 8, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 6, 0, 8, 6, 5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 0, 2, 5, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 6, 2, 0, 8, 5, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 1, 3, 0, 1, 4, 0, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 7, 3, 0, 7, 4, 0, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 4, 8, 2, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 1, 1, 4, 2, 2, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 6, 1, 4, 7, 2, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 3, 8, 8, 3, 8, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 3, 6, 0, 3, 7, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 8, 3, 6, 8, 3, 7, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 3, 4, 0, 5, 5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 8, 3, 4, 8, 5, 5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 1, 3, 5, 2, 5, 5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 6, 3, 5, 7, 5, 5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 1, 4, 5, 1, 5, 5, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 7, 4, 5, 7, 5, 5, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
for (int var4 = 0; var4 <= 5; ++var4)
{
for (int var5 = 0; var5 <= 8; ++var5)
{
this.func_175808_b(worldIn, Blocks.nether_brick.getDefaultState(), var5, -1, var4, p_74875_3_);
}
}
return true;
}
}
public static class Corridor5 extends StructureNetherBridgePieces.Piece
{
private static final String __OBFID = "CL_00000462";
public Corridor5() {}
public Corridor5(int p_i45614_1_, Random p_i45614_2_, StructureBoundingBox p_i45614_3_, EnumFacing p_i45614_4_)
{
super(p_i45614_1_);
this.coordBaseMode = p_i45614_4_;
this.boundingBox = p_i45614_3_;
}
public void buildComponent(StructureComponent p_74861_1_, List p_74861_2_, Random p_74861_3_)
{
this.getNextComponentNormal((StructureNetherBridgePieces.Start)p_74861_1_, p_74861_2_, p_74861_3_, 1, 0, true);
}
public static StructureNetherBridgePieces.Corridor5 func_175877_a(List p_175877_0_, Random p_175877_1_, int p_175877_2_, int p_175877_3_, int p_175877_4_, EnumFacing p_175877_5_, int p_175877_6_)
{
StructureBoundingBox var7 = StructureBoundingBox.func_175897_a(p_175877_2_, p_175877_3_, p_175877_4_, -1, 0, 0, 5, 7, 5, p_175877_5_);
return isAboveGround(var7) && StructureComponent.findIntersecting(p_175877_0_, var7) == null ? new StructureNetherBridgePieces.Corridor5(p_175877_6_, p_175877_1_, var7, p_175877_5_) : null;
}
public boolean addComponentParts(World worldIn, Random p_74875_2_, StructureBoundingBox p_74875_3_)
{
this.func_175804_a(worldIn, p_74875_3_, 0, 0, 0, 4, 1, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 0, 4, 5, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 0, 0, 5, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 4, 2, 0, 4, 5, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 3, 1, 0, 4, 1, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 3, 3, 0, 4, 3, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 4, 3, 1, 4, 4, 1, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 4, 3, 3, 4, 4, 3, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
for (int var4 = 0; var4 <= 4; ++var4)
{
for (int var5 = 0; var5 <= 4; ++var5)
{
this.func_175808_b(worldIn, Blocks.nether_brick.getDefaultState(), var4, -1, var5, p_74875_3_);
}
}
return true;
}
}
public static class Crossing extends StructureNetherBridgePieces.Piece
{
private static final String __OBFID = "CL_00000468";
public Crossing() {}
public Crossing(int p_i45610_1_, Random p_i45610_2_, StructureBoundingBox p_i45610_3_, EnumFacing p_i45610_4_)
{
super(p_i45610_1_);
this.coordBaseMode = p_i45610_4_;
this.boundingBox = p_i45610_3_;
}
public void buildComponent(StructureComponent p_74861_1_, List p_74861_2_, Random p_74861_3_)
{
this.getNextComponentNormal((StructureNetherBridgePieces.Start)p_74861_1_, p_74861_2_, p_74861_3_, 2, 0, false);
this.getNextComponentX((StructureNetherBridgePieces.Start)p_74861_1_, p_74861_2_, p_74861_3_, 0, 2, false);
this.getNextComponentZ((StructureNetherBridgePieces.Start)p_74861_1_, p_74861_2_, p_74861_3_, 0, 2, false);
}
public static StructureNetherBridgePieces.Crossing func_175873_a(List p_175873_0_, Random p_175873_1_, int p_175873_2_, int p_175873_3_, int p_175873_4_, EnumFacing p_175873_5_, int p_175873_6_)
{
StructureBoundingBox var7 = StructureBoundingBox.func_175897_a(p_175873_2_, p_175873_3_, p_175873_4_, -2, 0, 0, 7, 9, 7, p_175873_5_);
return isAboveGround(var7) && StructureComponent.findIntersecting(p_175873_0_, var7) == null ? new StructureNetherBridgePieces.Crossing(p_175873_6_, p_175873_1_, var7, p_175873_5_) : null;
}
public boolean addComponentParts(World worldIn, Random p_74875_2_, StructureBoundingBox p_74875_3_)
{
this.func_175804_a(worldIn, p_74875_3_, 0, 0, 0, 6, 1, 6, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 0, 6, 7, 6, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 0, 1, 6, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 6, 1, 6, 6, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 5, 2, 0, 6, 6, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 5, 2, 6, 6, 6, 6, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 0, 0, 6, 1, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 5, 0, 6, 6, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 6, 2, 0, 6, 6, 1, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 6, 2, 5, 6, 6, 6, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 2, 6, 0, 4, 6, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 2, 5, 0, 4, 5, 0, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 2, 6, 6, 4, 6, 6, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 2, 5, 6, 4, 5, 6, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 6, 2, 0, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 5, 2, 0, 5, 4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 6, 6, 2, 6, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 6, 5, 2, 6, 5, 4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
for (int var4 = 0; var4 <= 6; ++var4)
{
for (int var5 = 0; var5 <= 6; ++var5)
{
this.func_175808_b(worldIn, Blocks.nether_brick.getDefaultState(), var4, -1, var5, p_74875_3_);
}
}
return true;
}
}
public static class Crossing2 extends StructureNetherBridgePieces.Piece
{
private static final String __OBFID = "CL_00000460";
public Crossing2() {}
public Crossing2(int p_i45616_1_, Random p_i45616_2_, StructureBoundingBox p_i45616_3_, EnumFacing p_i45616_4_)
{
super(p_i45616_1_);
this.coordBaseMode = p_i45616_4_;
this.boundingBox = p_i45616_3_;
}
public void buildComponent(StructureComponent p_74861_1_, List p_74861_2_, Random p_74861_3_)
{
this.getNextComponentNormal((StructureNetherBridgePieces.Start)p_74861_1_, p_74861_2_, p_74861_3_, 1, 0, true);
this.getNextComponentX((StructureNetherBridgePieces.Start)p_74861_1_, p_74861_2_, p_74861_3_, 0, 1, true);
this.getNextComponentZ((StructureNetherBridgePieces.Start)p_74861_1_, p_74861_2_, p_74861_3_, 0, 1, true);
}
public static StructureNetherBridgePieces.Crossing2 func_175878_a(List p_175878_0_, Random p_175878_1_, int p_175878_2_, int p_175878_3_, int p_175878_4_, EnumFacing p_175878_5_, int p_175878_6_)
{
StructureBoundingBox var7 = StructureBoundingBox.func_175897_a(p_175878_2_, p_175878_3_, p_175878_4_, -1, 0, 0, 5, 7, 5, p_175878_5_);
return isAboveGround(var7) && StructureComponent.findIntersecting(p_175878_0_, var7) == null ? new StructureNetherBridgePieces.Crossing2(p_175878_6_, p_175878_1_, var7, p_175878_5_) : null;
}
public boolean addComponentParts(World worldIn, Random p_74875_2_, StructureBoundingBox p_74875_3_)
{
this.func_175804_a(worldIn, p_74875_3_, 0, 0, 0, 4, 1, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 0, 4, 5, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 0, 0, 5, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 4, 2, 0, 4, 5, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 4, 0, 5, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 4, 2, 4, 4, 5, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
for (int var4 = 0; var4 <= 4; ++var4)
{
for (int var5 = 0; var5 <= 4; ++var5)
{
this.func_175808_b(worldIn, Blocks.nether_brick.getDefaultState(), var4, -1, var5, p_74875_3_);
}
}
return true;
}
}
public static class Crossing3 extends StructureNetherBridgePieces.Piece
{
private static final String __OBFID = "CL_00000454";
public Crossing3() {}
public Crossing3(int p_i45622_1_, Random p_i45622_2_, StructureBoundingBox p_i45622_3_, EnumFacing p_i45622_4_)
{
super(p_i45622_1_);
this.coordBaseMode = p_i45622_4_;
this.boundingBox = p_i45622_3_;
}
protected Crossing3(Random p_i2042_1_, int p_i2042_2_, int p_i2042_3_)
{
super(0);
this.coordBaseMode = EnumFacing.Plane.HORIZONTAL.random(p_i2042_1_);
switch (StructureNetherBridgePieces.SwitchEnumFacing.field_175888_a[this.coordBaseMode.ordinal()])
{
case 1:
case 2:
this.boundingBox = new StructureBoundingBox(p_i2042_2_, 64, p_i2042_3_, p_i2042_2_ + 19 - 1, 73, p_i2042_3_ + 19 - 1);
break;
default:
this.boundingBox = new StructureBoundingBox(p_i2042_2_, 64, p_i2042_3_, p_i2042_2_ + 19 - 1, 73, p_i2042_3_ + 19 - 1);
}
}
public void buildComponent(StructureComponent p_74861_1_, List p_74861_2_, Random p_74861_3_)
{
this.getNextComponentNormal((StructureNetherBridgePieces.Start)p_74861_1_, p_74861_2_, p_74861_3_, 8, 3, false);
this.getNextComponentX((StructureNetherBridgePieces.Start)p_74861_1_, p_74861_2_, p_74861_3_, 3, 8, false);
this.getNextComponentZ((StructureNetherBridgePieces.Start)p_74861_1_, p_74861_2_, p_74861_3_, 3, 8, false);
}
public static StructureNetherBridgePieces.Crossing3 func_175885_a(List p_175885_0_, Random p_175885_1_, int p_175885_2_, int p_175885_3_, int p_175885_4_, EnumFacing p_175885_5_, int p_175885_6_)
{
StructureBoundingBox var7 = StructureBoundingBox.func_175897_a(p_175885_2_, p_175885_3_, p_175885_4_, -8, -3, 0, 19, 10, 19, p_175885_5_);
return isAboveGround(var7) && StructureComponent.findIntersecting(p_175885_0_, var7) == null ? new StructureNetherBridgePieces.Crossing3(p_175885_6_, p_175885_1_, var7, p_175885_5_) : null;
}
public boolean addComponentParts(World worldIn, Random p_74875_2_, StructureBoundingBox p_74875_3_)
{
this.func_175804_a(worldIn, p_74875_3_, 7, 3, 0, 11, 4, 18, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 3, 7, 18, 4, 11, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 8, 5, 0, 10, 7, 18, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 5, 8, 18, 7, 10, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 7, 5, 0, 7, 5, 7, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 7, 5, 11, 7, 5, 18, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 11, 5, 0, 11, 5, 7, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 11, 5, 11, 11, 5, 18, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 5, 7, 7, 5, 7, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 11, 5, 7, 18, 5, 7, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 5, 11, 7, 5, 11, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 11, 5, 11, 18, 5, 11, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 7, 2, 0, 11, 2, 5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 7, 2, 13, 11, 2, 18, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 7, 0, 0, 11, 1, 3, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 7, 0, 15, 11, 1, 18, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
int var4;
int var5;
for (var4 = 7; var4 <= 11; ++var4)
{
for (var5 = 0; var5 <= 2; ++var5)
{
this.func_175808_b(worldIn, Blocks.nether_brick.getDefaultState(), var4, -1, var5, p_74875_3_);
this.func_175808_b(worldIn, Blocks.nether_brick.getDefaultState(), var4, -1, 18 - var5, p_74875_3_);
}
}
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 7, 5, 2, 11, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 13, 2, 7, 18, 2, 11, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 0, 7, 3, 1, 11, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 15, 0, 7, 18, 1, 11, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
for (var4 = 0; var4 <= 2; ++var4)
{
for (var5 = 7; var5 <= 11; ++var5)
{
this.func_175808_b(worldIn, Blocks.nether_brick.getDefaultState(), var4, -1, var5, p_74875_3_);
this.func_175808_b(worldIn, Blocks.nether_brick.getDefaultState(), 18 - var4, -1, var5, p_74875_3_);
}
}
return true;
}
}
public static class End extends StructureNetherBridgePieces.Piece
{
private int fillSeed;
private static final String __OBFID = "CL_00000455";
public End() {}
public End(int p_i45621_1_, Random p_i45621_2_, StructureBoundingBox p_i45621_3_, EnumFacing p_i45621_4_)
{
super(p_i45621_1_);
this.coordBaseMode = p_i45621_4_;
this.boundingBox = p_i45621_3_;
this.fillSeed = p_i45621_2_.nextInt();
}
public static StructureNetherBridgePieces.End func_175884_a(List p_175884_0_, Random p_175884_1_, int p_175884_2_, int p_175884_3_, int p_175884_4_, EnumFacing p_175884_5_, int p_175884_6_)
{
StructureBoundingBox var7 = StructureBoundingBox.func_175897_a(p_175884_2_, p_175884_3_, p_175884_4_, -1, -3, 0, 5, 10, 8, p_175884_5_);
return isAboveGround(var7) && StructureComponent.findIntersecting(p_175884_0_, var7) == null ? new StructureNetherBridgePieces.End(p_175884_6_, p_175884_1_, var7, p_175884_5_) : null;
}
protected void readStructureFromNBT(NBTTagCompound p_143011_1_)
{
super.readStructureFromNBT(p_143011_1_);
this.fillSeed = p_143011_1_.getInteger("Seed");
}
protected void writeStructureToNBT(NBTTagCompound p_143012_1_)
{
super.writeStructureToNBT(p_143012_1_);
p_143012_1_.setInteger("Seed", this.fillSeed);
}
public boolean addComponentParts(World worldIn, Random p_74875_2_, StructureBoundingBox p_74875_3_)
{
Random var4 = new Random((long)this.fillSeed);
int var5;
int var6;
int var7;
for (var5 = 0; var5 <= 4; ++var5)
{
for (var6 = 3; var6 <= 4; ++var6)
{
var7 = var4.nextInt(8);
this.func_175804_a(worldIn, p_74875_3_, var5, var6, 0, var5, var6, var7, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
}
}
var5 = var4.nextInt(8);
this.func_175804_a(worldIn, p_74875_3_, 0, 5, 0, 0, 5, var5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
var5 = var4.nextInt(8);
this.func_175804_a(worldIn, p_74875_3_, 4, 5, 0, 4, 5, var5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
for (var5 = 0; var5 <= 4; ++var5)
{
var6 = var4.nextInt(5);
this.func_175804_a(worldIn, p_74875_3_, var5, 2, 0, var5, 2, var6, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
}
for (var5 = 0; var5 <= 4; ++var5)
{
for (var6 = 0; var6 <= 1; ++var6)
{
var7 = var4.nextInt(3);
this.func_175804_a(worldIn, p_74875_3_, var5, var6, 0, var5, var6, var7, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
}
}
return true;
}
}
public static class Entrance extends StructureNetherBridgePieces.Piece
{
private static final String __OBFID = "CL_00000459";
public Entrance() {}
public Entrance(int p_i45617_1_, Random p_i45617_2_, StructureBoundingBox p_i45617_3_, EnumFacing p_i45617_4_)
{
super(p_i45617_1_);
this.coordBaseMode = p_i45617_4_;
this.boundingBox = p_i45617_3_;
}
public void buildComponent(StructureComponent p_74861_1_, List p_74861_2_, Random p_74861_3_)
{
this.getNextComponentNormal((StructureNetherBridgePieces.Start)p_74861_1_, p_74861_2_, p_74861_3_, 5, 3, true);
}
public static StructureNetherBridgePieces.Entrance func_175881_a(List p_175881_0_, Random p_175881_1_, int p_175881_2_, int p_175881_3_, int p_175881_4_, EnumFacing p_175881_5_, int p_175881_6_)
{
StructureBoundingBox var7 = StructureBoundingBox.func_175897_a(p_175881_2_, p_175881_3_, p_175881_4_, -5, -3, 0, 13, 14, 13, p_175881_5_);
return isAboveGround(var7) && StructureComponent.findIntersecting(p_175881_0_, var7) == null ? new StructureNetherBridgePieces.Entrance(p_175881_6_, p_175881_1_, var7, p_175881_5_) : null;
}
public boolean addComponentParts(World worldIn, Random p_74875_2_, StructureBoundingBox p_74875_3_)
{
this.func_175804_a(worldIn, p_74875_3_, 0, 3, 0, 12, 4, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 5, 0, 12, 13, 12, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 5, 0, 1, 12, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 11, 5, 0, 12, 12, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 2, 5, 11, 4, 12, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 8, 5, 11, 10, 12, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 5, 9, 11, 7, 12, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 2, 5, 0, 4, 12, 1, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 8, 5, 0, 10, 12, 1, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 5, 9, 0, 7, 12, 1, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 2, 11, 2, 10, 12, 10, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 5, 8, 0, 7, 8, 0, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
int var4;
for (var4 = 1; var4 <= 11; var4 += 2)
{
this.func_175804_a(worldIn, p_74875_3_, var4, 10, 0, var4, 11, 0, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, var4, 10, 12, var4, 11, 12, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 10, var4, 0, 11, var4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 12, 10, var4, 12, 11, var4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175811_a(worldIn, Blocks.nether_brick.getDefaultState(), var4, 13, 0, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick.getDefaultState(), var4, 13, 12, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick.getDefaultState(), 0, 13, var4, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick.getDefaultState(), 12, 13, var4, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_fence.getDefaultState(), var4 + 1, 13, 0, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_fence.getDefaultState(), var4 + 1, 13, 12, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_fence.getDefaultState(), 0, 13, var4 + 1, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_fence.getDefaultState(), 12, 13, var4 + 1, p_74875_3_);
}
this.func_175811_a(worldIn, Blocks.nether_brick_fence.getDefaultState(), 0, 13, 0, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_fence.getDefaultState(), 0, 13, 12, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_fence.getDefaultState(), 0, 13, 0, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_fence.getDefaultState(), 12, 13, 0, p_74875_3_);
for (var4 = 3; var4 <= 9; var4 += 2)
{
this.func_175804_a(worldIn, p_74875_3_, 1, 7, var4, 1, 8, var4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 11, 7, var4, 11, 8, var4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
}
this.func_175804_a(worldIn, p_74875_3_, 4, 2, 0, 8, 2, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 4, 12, 2, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 4, 0, 0, 8, 1, 3, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 4, 0, 9, 8, 1, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 0, 4, 3, 1, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 9, 0, 4, 12, 1, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
int var5;
for (var4 = 4; var4 <= 8; ++var4)
{
for (var5 = 0; var5 <= 2; ++var5)
{
this.func_175808_b(worldIn, Blocks.nether_brick.getDefaultState(), var4, -1, var5, p_74875_3_);
this.func_175808_b(worldIn, Blocks.nether_brick.getDefaultState(), var4, -1, 12 - var5, p_74875_3_);
}
}
for (var4 = 0; var4 <= 2; ++var4)
{
for (var5 = 4; var5 <= 8; ++var5)
{
this.func_175808_b(worldIn, Blocks.nether_brick.getDefaultState(), var4, -1, var5, p_74875_3_);
this.func_175808_b(worldIn, Blocks.nether_brick.getDefaultState(), 12 - var4, -1, var5, p_74875_3_);
}
}
this.func_175804_a(worldIn, p_74875_3_, 5, 5, 5, 7, 5, 7, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 6, 1, 6, 6, 4, 6, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
this.func_175811_a(worldIn, Blocks.nether_brick.getDefaultState(), 6, 0, 6, p_74875_3_);
this.func_175811_a(worldIn, Blocks.flowing_lava.getDefaultState(), 6, 5, 6, p_74875_3_);
BlockPos var6 = new BlockPos(this.getXWithOffset(6, 6), this.getYWithOffset(5), this.getZWithOffset(6, 6));
if (p_74875_3_.func_175898_b(var6))
{
worldIn.func_175637_a(Blocks.flowing_lava, var6, p_74875_2_);
}
return true;
}
}
public static class NetherStalkRoom extends StructureNetherBridgePieces.Piece
{
private static final String __OBFID = "CL_00000464";
public NetherStalkRoom() {}
public NetherStalkRoom(int p_i45612_1_, Random p_i45612_2_, StructureBoundingBox p_i45612_3_, EnumFacing p_i45612_4_)
{
super(p_i45612_1_);
this.coordBaseMode = p_i45612_4_;
this.boundingBox = p_i45612_3_;
}
public void buildComponent(StructureComponent p_74861_1_, List p_74861_2_, Random p_74861_3_)
{
this.getNextComponentNormal((StructureNetherBridgePieces.Start)p_74861_1_, p_74861_2_, p_74861_3_, 5, 3, true);
this.getNextComponentNormal((StructureNetherBridgePieces.Start)p_74861_1_, p_74861_2_, p_74861_3_, 5, 11, true);
}
public static StructureNetherBridgePieces.NetherStalkRoom func_175875_a(List p_175875_0_, Random p_175875_1_, int p_175875_2_, int p_175875_3_, int p_175875_4_, EnumFacing p_175875_5_, int p_175875_6_)
{
StructureBoundingBox var7 = StructureBoundingBox.func_175897_a(p_175875_2_, p_175875_3_, p_175875_4_, -5, -3, 0, 13, 14, 13, p_175875_5_);
return isAboveGround(var7) && StructureComponent.findIntersecting(p_175875_0_, var7) == null ? new StructureNetherBridgePieces.NetherStalkRoom(p_175875_6_, p_175875_1_, var7, p_175875_5_) : null;
}
public boolean addComponentParts(World worldIn, Random p_74875_2_, StructureBoundingBox p_74875_3_)
{
this.func_175804_a(worldIn, p_74875_3_, 0, 3, 0, 12, 4, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 5, 0, 12, 13, 12, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 5, 0, 1, 12, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 11, 5, 0, 12, 12, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 2, 5, 11, 4, 12, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 8, 5, 11, 10, 12, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 5, 9, 11, 7, 12, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 2, 5, 0, 4, 12, 1, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 8, 5, 0, 10, 12, 1, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 5, 9, 0, 7, 12, 1, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 2, 11, 2, 10, 12, 10, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
int var4;
for (var4 = 1; var4 <= 11; var4 += 2)
{
this.func_175804_a(worldIn, p_74875_3_, var4, 10, 0, var4, 11, 0, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, var4, 10, 12, var4, 11, 12, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 10, var4, 0, 11, var4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 12, 10, var4, 12, 11, var4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175811_a(worldIn, Blocks.nether_brick.getDefaultState(), var4, 13, 0, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick.getDefaultState(), var4, 13, 12, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick.getDefaultState(), 0, 13, var4, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick.getDefaultState(), 12, 13, var4, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_fence.getDefaultState(), var4 + 1, 13, 0, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_fence.getDefaultState(), var4 + 1, 13, 12, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_fence.getDefaultState(), 0, 13, var4 + 1, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_fence.getDefaultState(), 12, 13, var4 + 1, p_74875_3_);
}
this.func_175811_a(worldIn, Blocks.nether_brick_fence.getDefaultState(), 0, 13, 0, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_fence.getDefaultState(), 0, 13, 12, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_fence.getDefaultState(), 0, 13, 0, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_fence.getDefaultState(), 12, 13, 0, p_74875_3_);
for (var4 = 3; var4 <= 9; var4 += 2)
{
this.func_175804_a(worldIn, p_74875_3_, 1, 7, var4, 1, 8, var4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 11, 7, var4, 11, 8, var4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
}
var4 = this.getMetadataWithOffset(Blocks.nether_brick_stairs, 3);
int var5;
int var6;
int var7;
for (var5 = 0; var5 <= 6; ++var5)
{
var6 = var5 + 4;
for (var7 = 5; var7 <= 7; ++var7)
{
this.func_175811_a(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(var4), var7, 5 + var5, var6, p_74875_3_);
}
if (var6 >= 5 && var6 <= 8)
{
this.func_175804_a(worldIn, p_74875_3_, 5, 5, var6, 7, var5 + 4, var6, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
}
else if (var6 >= 9 && var6 <= 10)
{
this.func_175804_a(worldIn, p_74875_3_, 5, 8, var6, 7, var5 + 4, var6, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
}
if (var5 >= 1)
{
this.func_175804_a(worldIn, p_74875_3_, 5, 6 + var5, var6, 7, 9 + var5, var6, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
}
}
for (var5 = 5; var5 <= 7; ++var5)
{
this.func_175811_a(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(var4), var5, 12, 11, p_74875_3_);
}
this.func_175804_a(worldIn, p_74875_3_, 5, 6, 7, 5, 7, 7, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 7, 6, 7, 7, 7, 7, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 5, 13, 12, 7, 13, 12, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 2, 5, 2, 3, 5, 3, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 2, 5, 9, 3, 5, 10, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 2, 5, 4, 2, 5, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 9, 5, 2, 10, 5, 3, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 9, 5, 9, 10, 5, 10, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 10, 5, 4, 10, 5, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
var5 = this.getMetadataWithOffset(Blocks.nether_brick_stairs, 0);
var6 = this.getMetadataWithOffset(Blocks.nether_brick_stairs, 1);
this.func_175811_a(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(var6), 4, 5, 2, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(var6), 4, 5, 3, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(var6), 4, 5, 9, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(var6), 4, 5, 10, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(var5), 8, 5, 2, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(var5), 8, 5, 3, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(var5), 8, 5, 9, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(var5), 8, 5, 10, p_74875_3_);
this.func_175804_a(worldIn, p_74875_3_, 3, 4, 4, 4, 4, 8, Blocks.soul_sand.getDefaultState(), Blocks.soul_sand.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 8, 4, 4, 9, 4, 8, Blocks.soul_sand.getDefaultState(), Blocks.soul_sand.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 3, 5, 4, 4, 5, 8, Blocks.nether_wart.getDefaultState(), Blocks.nether_wart.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 8, 5, 4, 9, 5, 8, Blocks.nether_wart.getDefaultState(), Blocks.nether_wart.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 4, 2, 0, 8, 2, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 4, 12, 2, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 4, 0, 0, 8, 1, 3, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 4, 0, 9, 8, 1, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 0, 4, 3, 1, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 9, 0, 4, 12, 1, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
int var8;
for (var7 = 4; var7 <= 8; ++var7)
{
for (var8 = 0; var8 <= 2; ++var8)
{
this.func_175808_b(worldIn, Blocks.nether_brick.getDefaultState(), var7, -1, var8, p_74875_3_);
this.func_175808_b(worldIn, Blocks.nether_brick.getDefaultState(), var7, -1, 12 - var8, p_74875_3_);
}
}
for (var7 = 0; var7 <= 2; ++var7)
{
for (var8 = 4; var8 <= 8; ++var8)
{
this.func_175808_b(worldIn, Blocks.nether_brick.getDefaultState(), var7, -1, var8, p_74875_3_);
this.func_175808_b(worldIn, Blocks.nether_brick.getDefaultState(), 12 - var7, -1, var8, p_74875_3_);
}
}
return true;
}
}
abstract static class Piece extends StructureComponent
{
protected static final List field_111019_a = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.diamond, 0, 1, 3, 5), new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 5), new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 15), new WeightedRandomChestContent(Items.golden_sword, 0, 1, 1, 5), new WeightedRandomChestContent(Items.golden_chestplate, 0, 1, 1, 5), new WeightedRandomChestContent(Items.flint_and_steel, 0, 1, 1, 5), new WeightedRandomChestContent(Items.nether_wart, 0, 3, 7, 5), new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 10), new WeightedRandomChestContent(Items.golden_horse_armor, 0, 1, 1, 8), new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 5), new WeightedRandomChestContent(Items.diamond_horse_armor, 0, 1, 1, 3), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.obsidian), 0, 2, 4, 2)});
private static final String __OBFID = "CL_00000466";
public Piece() {}
protected Piece(int p_i2054_1_)
{
super(p_i2054_1_);
}
protected void readStructureFromNBT(NBTTagCompound p_143011_1_) {}
protected void writeStructureToNBT(NBTTagCompound p_143012_1_) {}
private int getTotalWeight(List p_74960_1_)
{
boolean var2 = false;
int var3 = 0;
StructureNetherBridgePieces.PieceWeight var5;
for (Iterator var4 = p_74960_1_.iterator(); var4.hasNext(); var3 += var5.field_78826_b)
{
var5 = (StructureNetherBridgePieces.PieceWeight)var4.next();
if (var5.field_78824_d > 0 && var5.field_78827_c < var5.field_78824_d)
{
var2 = true;
}
}
return var2 ? var3 : -1;
}
private StructureNetherBridgePieces.Piece func_175871_a(StructureNetherBridgePieces.Start p_175871_1_, List p_175871_2_, List p_175871_3_, Random p_175871_4_, int p_175871_5_, int p_175871_6_, int p_175871_7_, EnumFacing p_175871_8_, int p_175871_9_)
{
int var10 = this.getTotalWeight(p_175871_2_);
boolean var11 = var10 > 0 && p_175871_9_ <= 30;
int var12 = 0;
while (var12 < 5 && var11)
{
++var12;
int var13 = p_175871_4_.nextInt(var10);
Iterator var14 = p_175871_2_.iterator();
while (var14.hasNext())
{
StructureNetherBridgePieces.PieceWeight var15 = (StructureNetherBridgePieces.PieceWeight)var14.next();
var13 -= var15.field_78826_b;
if (var13 < 0)
{
if (!var15.func_78822_a(p_175871_9_) || var15 == p_175871_1_.theNetherBridgePieceWeight && !var15.field_78825_e)
{
break;
}
StructureNetherBridgePieces.Piece var16 = StructureNetherBridgePieces.func_175887_b(var15, p_175871_3_, p_175871_4_, p_175871_5_, p_175871_6_, p_175871_7_, p_175871_8_, p_175871_9_);
if (var16 != null)
{
++var15.field_78827_c;
p_175871_1_.theNetherBridgePieceWeight = var15;
if (!var15.func_78823_a())
{
p_175871_2_.remove(var15);
}
return var16;
}
}
}
}
return StructureNetherBridgePieces.End.func_175884_a(p_175871_3_, p_175871_4_, p_175871_5_, p_175871_6_, p_175871_7_, p_175871_8_, p_175871_9_);
}
private StructureComponent func_175870_a(StructureNetherBridgePieces.Start p_175870_1_, List p_175870_2_, Random p_175870_3_, int p_175870_4_, int p_175870_5_, int p_175870_6_, EnumFacing p_175870_7_, int p_175870_8_, boolean p_175870_9_)
{
if (Math.abs(p_175870_4_ - p_175870_1_.getBoundingBox().minX) <= 112 && Math.abs(p_175870_6_ - p_175870_1_.getBoundingBox().minZ) <= 112)
{
List var10 = p_175870_1_.primaryWeights;
if (p_175870_9_)
{
var10 = p_175870_1_.secondaryWeights;
}
StructureNetherBridgePieces.Piece var11 = this.func_175871_a(p_175870_1_, var10, p_175870_2_, p_175870_3_, p_175870_4_, p_175870_5_, p_175870_6_, p_175870_7_, p_175870_8_ + 1);
if (var11 != null)
{
p_175870_2_.add(var11);
p_175870_1_.field_74967_d.add(var11);
}
return var11;
}
else
{
return StructureNetherBridgePieces.End.func_175884_a(p_175870_2_, p_175870_3_, p_175870_4_, p_175870_5_, p_175870_6_, p_175870_7_, p_175870_8_);
}
}
protected StructureComponent getNextComponentNormal(StructureNetherBridgePieces.Start p_74963_1_, List p_74963_2_, Random p_74963_3_, int p_74963_4_, int p_74963_5_, boolean p_74963_6_)
{
if (this.coordBaseMode != null)
{
switch (StructureNetherBridgePieces.SwitchEnumFacing.field_175888_a[this.coordBaseMode.ordinal()])
{
case 1:
return this.func_175870_a(p_74963_1_, p_74963_2_, p_74963_3_, this.boundingBox.minX + p_74963_4_, this.boundingBox.minY + p_74963_5_, this.boundingBox.minZ - 1, this.coordBaseMode, this.getComponentType(), p_74963_6_);
case 2:
return this.func_175870_a(p_74963_1_, p_74963_2_, p_74963_3_, this.boundingBox.minX + p_74963_4_, this.boundingBox.minY + p_74963_5_, this.boundingBox.maxZ + 1, this.coordBaseMode, this.getComponentType(), p_74963_6_);
case 3:
return this.func_175870_a(p_74963_1_, p_74963_2_, p_74963_3_, this.boundingBox.minX - 1, this.boundingBox.minY + p_74963_5_, this.boundingBox.minZ + p_74963_4_, this.coordBaseMode, this.getComponentType(), p_74963_6_);
case 4:
return this.func_175870_a(p_74963_1_, p_74963_2_, p_74963_3_, this.boundingBox.maxX + 1, this.boundingBox.minY + p_74963_5_, this.boundingBox.minZ + p_74963_4_, this.coordBaseMode, this.getComponentType(), p_74963_6_);
}
}
return null;
}
protected StructureComponent getNextComponentX(StructureNetherBridgePieces.Start p_74961_1_, List p_74961_2_, Random p_74961_3_, int p_74961_4_, int p_74961_5_, boolean p_74961_6_)
{
if (this.coordBaseMode != null)
{
switch (StructureNetherBridgePieces.SwitchEnumFacing.field_175888_a[this.coordBaseMode.ordinal()])
{
case 1:
return this.func_175870_a(p_74961_1_, p_74961_2_, p_74961_3_, this.boundingBox.minX - 1, this.boundingBox.minY + p_74961_4_, this.boundingBox.minZ + p_74961_5_, EnumFacing.WEST, this.getComponentType(), p_74961_6_);
case 2:
return this.func_175870_a(p_74961_1_, p_74961_2_, p_74961_3_, this.boundingBox.minX - 1, this.boundingBox.minY + p_74961_4_, this.boundingBox.minZ + p_74961_5_, EnumFacing.WEST, this.getComponentType(), p_74961_6_);
case 3:
return this.func_175870_a(p_74961_1_, p_74961_2_, p_74961_3_, this.boundingBox.minX + p_74961_5_, this.boundingBox.minY + p_74961_4_, this.boundingBox.minZ - 1, EnumFacing.NORTH, this.getComponentType(), p_74961_6_);
case 4:
return this.func_175870_a(p_74961_1_, p_74961_2_, p_74961_3_, this.boundingBox.minX + p_74961_5_, this.boundingBox.minY + p_74961_4_, this.boundingBox.minZ - 1, EnumFacing.NORTH, this.getComponentType(), p_74961_6_);
}
}
return null;
}
protected StructureComponent getNextComponentZ(StructureNetherBridgePieces.Start p_74965_1_, List p_74965_2_, Random p_74965_3_, int p_74965_4_, int p_74965_5_, boolean p_74965_6_)
{
if (this.coordBaseMode != null)
{
switch (StructureNetherBridgePieces.SwitchEnumFacing.field_175888_a[this.coordBaseMode.ordinal()])
{
case 1:
return this.func_175870_a(p_74965_1_, p_74965_2_, p_74965_3_, this.boundingBox.maxX + 1, this.boundingBox.minY + p_74965_4_, this.boundingBox.minZ + p_74965_5_, EnumFacing.EAST, this.getComponentType(), p_74965_6_);
case 2:
return this.func_175870_a(p_74965_1_, p_74965_2_, p_74965_3_, this.boundingBox.maxX + 1, this.boundingBox.minY + p_74965_4_, this.boundingBox.minZ + p_74965_5_, EnumFacing.EAST, this.getComponentType(), p_74965_6_);
case 3:
return this.func_175870_a(p_74965_1_, p_74965_2_, p_74965_3_, this.boundingBox.minX + p_74965_5_, this.boundingBox.minY + p_74965_4_, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType(), p_74965_6_);
case 4:
return this.func_175870_a(p_74965_1_, p_74965_2_, p_74965_3_, this.boundingBox.minX + p_74965_5_, this.boundingBox.minY + p_74965_4_, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType(), p_74965_6_);
}
}
return null;
}
protected static boolean isAboveGround(StructureBoundingBox p_74964_0_)
{
return p_74964_0_ != null && p_74964_0_.minY > 10;
}
}
static class PieceWeight
{
public Class weightClass;
public final int field_78826_b;
public int field_78827_c;
public int field_78824_d;
public boolean field_78825_e;
private static final String __OBFID = "CL_00000467";
public PieceWeight(Class p_i2055_1_, int p_i2055_2_, int p_i2055_3_, boolean p_i2055_4_)
{
this.weightClass = p_i2055_1_;
this.field_78826_b = p_i2055_2_;
this.field_78824_d = p_i2055_3_;
this.field_78825_e = p_i2055_4_;
}
public PieceWeight(Class p_i2056_1_, int p_i2056_2_, int p_i2056_3_)
{
this(p_i2056_1_, p_i2056_2_, p_i2056_3_, false);
}
public boolean func_78822_a(int p_78822_1_)
{
return this.field_78824_d == 0 || this.field_78827_c < this.field_78824_d;
}
public boolean func_78823_a()
{
return this.field_78824_d == 0 || this.field_78827_c < this.field_78824_d;
}
}
public static class Stairs extends StructureNetherBridgePieces.Piece
{
private static final String __OBFID = "CL_00000469";
public Stairs() {}
public Stairs(int p_i45609_1_, Random p_i45609_2_, StructureBoundingBox p_i45609_3_, EnumFacing p_i45609_4_)
{
super(p_i45609_1_);
this.coordBaseMode = p_i45609_4_;
this.boundingBox = p_i45609_3_;
}
public void buildComponent(StructureComponent p_74861_1_, List p_74861_2_, Random p_74861_3_)
{
this.getNextComponentZ((StructureNetherBridgePieces.Start)p_74861_1_, p_74861_2_, p_74861_3_, 6, 2, false);
}
public static StructureNetherBridgePieces.Stairs func_175872_a(List p_175872_0_, Random p_175872_1_, int p_175872_2_, int p_175872_3_, int p_175872_4_, int p_175872_5_, EnumFacing p_175872_6_)
{
StructureBoundingBox var7 = StructureBoundingBox.func_175897_a(p_175872_2_, p_175872_3_, p_175872_4_, -2, 0, 0, 7, 11, 7, p_175872_6_);
return isAboveGround(var7) && StructureComponent.findIntersecting(p_175872_0_, var7) == null ? new StructureNetherBridgePieces.Stairs(p_175872_5_, p_175872_1_, var7, p_175872_6_) : null;
}
public boolean addComponentParts(World worldIn, Random p_74875_2_, StructureBoundingBox p_74875_3_)
{
this.func_175804_a(worldIn, p_74875_3_, 0, 0, 0, 6, 1, 6, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 0, 6, 10, 6, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 0, 1, 8, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 5, 2, 0, 6, 8, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 1, 0, 8, 6, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 6, 2, 1, 6, 8, 6, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 1, 2, 6, 5, 8, 6, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 3, 2, 0, 5, 4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 6, 3, 2, 6, 5, 2, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 6, 3, 4, 6, 5, 4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175811_a(worldIn, Blocks.nether_brick.getDefaultState(), 5, 2, 5, p_74875_3_);
this.func_175804_a(worldIn, p_74875_3_, 4, 2, 5, 4, 3, 5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 3, 2, 5, 3, 4, 5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 2, 2, 5, 2, 5, 5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 1, 2, 5, 1, 6, 5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 1, 7, 1, 5, 7, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 6, 8, 2, 6, 8, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 2, 6, 0, 4, 8, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 2, 5, 0, 4, 5, 0, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
for (int var4 = 0; var4 <= 6; ++var4)
{
for (int var5 = 0; var5 <= 6; ++var5)
{
this.func_175808_b(worldIn, Blocks.nether_brick.getDefaultState(), var4, -1, var5, p_74875_3_);
}
}
return true;
}
}
public static class Start extends StructureNetherBridgePieces.Crossing3
{
public StructureNetherBridgePieces.PieceWeight theNetherBridgePieceWeight;
public List primaryWeights;
public List secondaryWeights;
public List field_74967_d = Lists.newArrayList();
private static final String __OBFID = "CL_00000470";
public Start() {}
public Start(Random p_i2059_1_, int p_i2059_2_, int p_i2059_3_)
{
super(p_i2059_1_, p_i2059_2_, p_i2059_3_);
this.primaryWeights = Lists.newArrayList();
StructureNetherBridgePieces.PieceWeight[] var4 = StructureNetherBridgePieces.primaryComponents;
int var5 = var4.length;
int var6;
StructureNetherBridgePieces.PieceWeight var7;
for (var6 = 0; var6 < var5; ++var6)
{
var7 = var4[var6];
var7.field_78827_c = 0;
this.primaryWeights.add(var7);
}
this.secondaryWeights = Lists.newArrayList();
var4 = StructureNetherBridgePieces.secondaryComponents;
var5 = var4.length;
for (var6 = 0; var6 < var5; ++var6)
{
var7 = var4[var6];
var7.field_78827_c = 0;
this.secondaryWeights.add(var7);
}
}
protected void readStructureFromNBT(NBTTagCompound p_143011_1_)
{
super.readStructureFromNBT(p_143011_1_);
}
protected void writeStructureToNBT(NBTTagCompound p_143012_1_)
{
super.writeStructureToNBT(p_143012_1_);
}
}
public static class Straight extends StructureNetherBridgePieces.Piece
{
private static final String __OBFID = "CL_00000456";
public Straight() {}
public Straight(int p_i45620_1_, Random p_i45620_2_, StructureBoundingBox p_i45620_3_, EnumFacing p_i45620_4_)
{
super(p_i45620_1_);
this.coordBaseMode = p_i45620_4_;
this.boundingBox = p_i45620_3_;
}
public void buildComponent(StructureComponent p_74861_1_, List p_74861_2_, Random p_74861_3_)
{
this.getNextComponentNormal((StructureNetherBridgePieces.Start)p_74861_1_, p_74861_2_, p_74861_3_, 1, 3, false);
}
public static StructureNetherBridgePieces.Straight func_175882_a(List p_175882_0_, Random p_175882_1_, int p_175882_2_, int p_175882_3_, int p_175882_4_, EnumFacing p_175882_5_, int p_175882_6_)
{
StructureBoundingBox var7 = StructureBoundingBox.func_175897_a(p_175882_2_, p_175882_3_, p_175882_4_, -1, -3, 0, 5, 10, 19, p_175882_5_);
return isAboveGround(var7) && StructureComponent.findIntersecting(p_175882_0_, var7) == null ? new StructureNetherBridgePieces.Straight(p_175882_6_, p_175882_1_, var7, p_175882_5_) : null;
}
public boolean addComponentParts(World worldIn, Random p_74875_2_, StructureBoundingBox p_74875_3_)
{
this.func_175804_a(worldIn, p_74875_3_, 0, 3, 0, 4, 4, 18, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 1, 5, 0, 3, 7, 18, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 5, 0, 0, 5, 18, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 4, 5, 0, 4, 5, 18, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 0, 4, 2, 5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 13, 4, 2, 18, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 0, 0, 4, 1, 3, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 0, 15, 4, 1, 18, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
for (int var4 = 0; var4 <= 4; ++var4)
{
for (int var5 = 0; var5 <= 2; ++var5)
{
this.func_175808_b(worldIn, Blocks.nether_brick.getDefaultState(), var4, -1, var5, p_74875_3_);
this.func_175808_b(worldIn, Blocks.nether_brick.getDefaultState(), var4, -1, 18 - var5, p_74875_3_);
}
}
this.func_175804_a(worldIn, p_74875_3_, 0, 1, 1, 0, 4, 1, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 3, 4, 0, 4, 4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 3, 14, 0, 4, 14, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 1, 17, 0, 4, 17, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 4, 1, 1, 4, 4, 1, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 4, 3, 4, 4, 4, 4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 4, 3, 14, 4, 4, 14, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 4, 1, 17, 4, 4, 17, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
return true;
}
}
static final class SwitchEnumFacing
{
static final int[] field_175888_a = new int[EnumFacing.values().length];
private static final String __OBFID = "CL_00001997";
static
{
try
{
field_175888_a[EnumFacing.NORTH.ordinal()] = 1;
}
catch (NoSuchFieldError var4)
{
;
}
try
{
field_175888_a[EnumFacing.SOUTH.ordinal()] = 2;
}
catch (NoSuchFieldError var3)
{
;
}
try
{
field_175888_a[EnumFacing.WEST.ordinal()] = 3;
}
catch (NoSuchFieldError var2)
{
;
}
try
{
field_175888_a[EnumFacing.EAST.ordinal()] = 4;
}
catch (NoSuchFieldError var1)
{
;
}
}
}
public static class Throne extends StructureNetherBridgePieces.Piece
{
private boolean hasSpawner;
private static final String __OBFID = "CL_00000465";
public Throne() {}
public Throne(int p_i45611_1_, Random p_i45611_2_, StructureBoundingBox p_i45611_3_, EnumFacing p_i45611_4_)
{
super(p_i45611_1_);
this.coordBaseMode = p_i45611_4_;
this.boundingBox = p_i45611_3_;
}
protected void readStructureFromNBT(NBTTagCompound p_143011_1_)
{
super.readStructureFromNBT(p_143011_1_);
this.hasSpawner = p_143011_1_.getBoolean("Mob");
}
protected void writeStructureToNBT(NBTTagCompound p_143012_1_)
{
super.writeStructureToNBT(p_143012_1_);
p_143012_1_.setBoolean("Mob", this.hasSpawner);
}
public static StructureNetherBridgePieces.Throne func_175874_a(List p_175874_0_, Random p_175874_1_, int p_175874_2_, int p_175874_3_, int p_175874_4_, int p_175874_5_, EnumFacing p_175874_6_)
{
StructureBoundingBox var7 = StructureBoundingBox.func_175897_a(p_175874_2_, p_175874_3_, p_175874_4_, -2, 0, 0, 7, 8, 9, p_175874_6_);
return isAboveGround(var7) && StructureComponent.findIntersecting(p_175874_0_, var7) == null ? new StructureNetherBridgePieces.Throne(p_175874_5_, p_175874_1_, var7, p_175874_6_) : null;
}
public boolean addComponentParts(World worldIn, Random p_74875_2_, StructureBoundingBox p_74875_3_)
{
this.func_175804_a(worldIn, p_74875_3_, 0, 2, 0, 6, 7, 7, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 1, 0, 0, 5, 1, 7, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 1, 2, 1, 5, 2, 7, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 1, 3, 2, 5, 3, 7, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 1, 4, 3, 5, 4, 7, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 1, 2, 0, 1, 4, 2, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 5, 2, 0, 5, 4, 2, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 1, 5, 2, 1, 5, 3, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 5, 5, 2, 5, 5, 3, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 0, 5, 3, 0, 5, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 6, 5, 3, 6, 5, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 1, 5, 8, 5, 5, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false);
this.func_175811_a(worldIn, Blocks.nether_brick_fence.getDefaultState(), 1, 6, 3, p_74875_3_);
this.func_175811_a(worldIn, Blocks.nether_brick_fence.getDefaultState(), 5, 6, 3, p_74875_3_);
this.func_175804_a(worldIn, p_74875_3_, 0, 6, 3, 0, 6, 8, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 6, 6, 3, 6, 6, 8, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 1, 6, 8, 5, 7, 8, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
this.func_175804_a(worldIn, p_74875_3_, 2, 8, 8, 4, 8, 8, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false);
if (!this.hasSpawner)
{
BlockPos var4 = new BlockPos(this.getXWithOffset(3, 5), this.getYWithOffset(5), this.getZWithOffset(3, 5));
if (p_74875_3_.func_175898_b(var4))
{
this.hasSpawner = true;
worldIn.setBlockState(var4, Blocks.mob_spawner.getDefaultState(), 2);
TileEntity var5 = worldIn.getTileEntity(var4);
if (var5 instanceof TileEntityMobSpawner)
{
((TileEntityMobSpawner)var5).getSpawnerBaseLogic().setEntityName("Blaze");
}
}
}
for (int var6 = 0; var6 <= 6; ++var6)
{
for (int var7 = 0; var7 <= 6; ++var7)
{
this.func_175808_b(worldIn, Blocks.nether_brick.getDefaultState(), var6, -1, var7, p_74875_3_);
}
}
return true;
}
}
}
|
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.uiDesigner.projectView;
import com.intellij.ide.favoritesTreeView.FavoriteNodeProvider;
import com.intellij.ide.projectView.ViewSettings;
import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.JavaPsiFacade;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.uiDesigner.compiler.Utils;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
/**
* @author yole
*/
public class UIDesignerFavoriteNodeProvider extends FavoriteNodeProvider {
@Override
@Nullable
public Collection<AbstractTreeNode> getFavoriteNodes(DataContext context, final ViewSettings viewSettings) {
Project project = CommonDataKeys.PROJECT.getData(context);
if (project == null) return null;
Form[] forms = Form.DATA_KEY.getData(context);
if (forms != null) {
Collection<AbstractTreeNode> result = new ArrayList<>();
Set<PsiClass> bindClasses = new HashSet<>();
for (Form form: forms) {
final PsiClass classToBind = form.getClassToBind();
if (classToBind != null) {
if (bindClasses.contains(classToBind)) continue;
bindClasses.add(classToBind);
result.add(FormNode.constructFormNode(classToBind, project, viewSettings));
}
}
if (!result.isEmpty()) {
return result;
}
}
VirtualFile vFile = CommonDataKeys.VIRTUAL_FILE.getData(context);
if (vFile != null) {
final FileType fileType = vFile.getFileType();
if (fileType.equals(StdFileTypes.GUI_DESIGNER_FORM)) {
final PsiFile formFile = PsiManager.getInstance(project).findFile(vFile);
if (formFile == null) return null;
String text = formFile.getText();
String className;
try {
className = Utils.getBoundClassName(text);
}
catch (Exception e) {
return null;
}
if (className == null) return null;
final PsiClass classToBind = JavaPsiFacade.getInstance(project).findClass(className, GlobalSearchScope.allScope(project));
if (classToBind != null) {
Form form = new Form(classToBind);
final AbstractTreeNode node = new FormNode(project, form, viewSettings);
return Collections.singletonList(node);
}
}
}
return null;
}
@Override
public boolean elementContainsFile(final Object element, final VirtualFile vFile) {
if (element instanceof Form){
Form form = (Form) element;
return form.containsFile(vFile);
}
return false;
}
@Override
public int getElementWeight(final Object element, final boolean isSortByType) {
if (element instanceof Form) return 9;
return -1;
}
@Override
@Nullable
public String getElementLocation(final Object element) {
if (element instanceof Form) {
final PsiFile[] psiFiles = ((Form)element).getFormFiles();
VirtualFile vFile = null;
if (psiFiles.length > 0) {
vFile = psiFiles [0].getVirtualFile();
}
if (vFile != null) {
return vFile.getPresentableUrl();
}
}
return null;
}
@Override
public boolean isInvalidElement(Object element) {
if (element instanceof Form) {
return !((Form) element).isValid();
}
return false;
}
@Override
@NotNull @NonNls
public String getFavoriteTypeId() {
return "form";
}
@Override
@Nullable @NonNls
public String getElementUrl(Object element) {
if (element instanceof Form) {
Form form = (Form)element;
return form.getClassToBind().getQualifiedName();
}
return null;
}
@Override
public String getElementModuleName(final Object element) {
if (element instanceof Form) {
Form form = (Form)element;
final Module module = ModuleUtil.findModuleForPsiElement(form.getClassToBind());
return module != null ? module.getName() : null;
}
return null;
}
@Override
public Object[] createPathFromUrl(final Project project, final String url, final String moduleName) {
final PsiManager psiManager = PsiManager.getInstance(project);
final PsiClass classToBind = JavaPsiFacade.getInstance(psiManager.getProject()).findClass(url, GlobalSearchScope.allScope(project));
if (classToBind == null) return null;
return new Object[] { new Form(classToBind) };
}
}
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.bsf.engines.javascript;
import java.util.Iterator;
import java.util.Vector;
import org.apache.bsf.BSFDeclaredBean;
import org.apache.bsf.BSFException;
import org.apache.bsf.BSFManager;
import org.apache.bsf.util.BSFEngineImpl;
import org.apache.bsf.util.BSFFunctions;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.EvaluatorException;
import org.mozilla.javascript.Function;
import org.mozilla.javascript.ImporterTopLevel;
import org.mozilla.javascript.JavaScriptException;
import org.mozilla.javascript.NativeJavaObject;
import org.mozilla.javascript.Scriptable;
import org.mozilla.javascript.WrappedException;
import org.mozilla.javascript.Wrapper;
/**
* This is the interface to Netscape's Rhino (JavaScript) from the
* Bean Scripting Framework.
* <p>
* The original version of this code was first written by Adam Peller
* for use in LotusXSL. Sanjiva took his code and adapted it for BSF.
*
* @author Adam Peller <peller@lotus.com>
* @author Sanjiva Weerawarana
* @author Matthew J. Duftler
* @author Norris Boyd
*/
public class JavaScriptEngine extends BSFEngineImpl {
/**
* The global script object, where all embedded functions are defined,
* as well as the standard ECMA "core" objects.
*/
private Scriptable global;
/**
* Return an object from an extension.
* @param object Object on which to make the call (ignored).
* @param method The name of the method to call.
* @param args an array of arguments to be
* passed to the extension, which may be either
* Vectors of Nodes, or Strings.
*/
public Object call(final Object object, final String method, final Object[] args)
throws BSFException {
Object retval = null;
Context cx;
try {
cx = Context.enter();
// REMIND: convert arg list Vectors here?
final Object fun = global.get(method, global);
// NOTE: Source and line arguments are nonsense in a call().
// Any way to make these arguments *sensible?
if (fun == Scriptable.NOT_FOUND) {
throw new EvaluatorException("function " + method +
" not found.", "none", 0);
}
cx.setOptimizationLevel(-1);
cx.setGeneratingDebug(false);
cx.setGeneratingSource(false);
cx.setOptimizationLevel(0);
cx.setDebugger(null, null);
retval =
((Function) fun).call(cx, global, global, args);
// ScriptRuntime.call(cx, fun, global, args, global);
if (retval instanceof Wrapper) {
retval = ((Wrapper) retval).unwrap();
}
}
catch (final Throwable t) {
handleError(t);
}
finally {
Context.exit();
}
return retval;
}
public void declareBean(final BSFDeclaredBean bean) throws BSFException {
if ((bean.bean instanceof Number) ||
(bean.bean instanceof String) ||
(bean.bean instanceof Boolean)) {
global.put(bean.name, global, bean.bean);
}
else {
// Must wrap non-scriptable objects before presenting to Rhino
final Scriptable wrapped = Context.toObject(bean.bean, global);
global.put(bean.name, global, wrapped);
}
}
/**
* This is used by an application to evaluate a string containing
* some expression.
*/
public Object eval(final String source, final int lineNo, final int columnNo, final Object oscript)
throws BSFException {
final String scriptText = oscript.toString();
Object retval = null;
Context cx;
try {
cx = Context.enter();
cx.setOptimizationLevel(-1);
cx.setGeneratingDebug(false);
cx.setGeneratingSource(false);
cx.setOptimizationLevel(0);
cx.setDebugger(null, null);
retval = cx.evaluateString(global, scriptText,
source, lineNo,
null);
if (retval instanceof NativeJavaObject) {
retval = ((NativeJavaObject) retval).unwrap();
}
}
catch (final Throwable t) { // includes JavaScriptException, rethrows Errors
handleError(t);
}
finally {
Context.exit();
}
return retval;
}
private void handleError(Throwable t) throws BSFException {
if (t instanceof WrappedException) {
t = ((WrappedException) t).getWrappedException();
}
String message = null;
Throwable target = t;
if (t instanceof JavaScriptException) {
message = t.getLocalizedMessage();
// Is it an exception wrapped in a JavaScriptException?
final Object value = ((JavaScriptException) t).getValue();
if (value instanceof Throwable) {
// likely a wrapped exception from a LiveConnect call.
// Display its stack trace as a diagnostic
target = (Throwable) value;
}
}
else if (t instanceof EvaluatorException ||
t instanceof SecurityException) {
message = t.getLocalizedMessage();
}
else if (t instanceof RuntimeException) {
message = "Internal Error: " + t.toString();
}
else if (t instanceof StackOverflowError) {
message = "Stack Overflow";
}
if (message == null) {
message = t.toString();
}
if (t instanceof Error && !(t instanceof StackOverflowError)) {
// Re-throw Errors because we're supposed to let the JVM see it
// Don't re-throw StackOverflows, because we know we've
// corrected the situation by aborting the loop and
// a long stacktrace would end up on the user's console
throw (Error) t;
}
else {
throw new BSFException(BSFException.REASON_OTHER_ERROR,
"JavaScript Error: " + message,
target);
}
}
/**
* Initialize the engine.
* Put the manager into the context-manager
* map hashtable too.
*/
public void initialize(final BSFManager mgr, final String lang, final Vector declaredBeans)
throws BSFException {
super.initialize(mgr, lang, declaredBeans);
// Initialize context and global scope object
try {
final Context cx = Context.enter();
global = new ImporterTopLevel(cx);
final Scriptable bsf = Context.toObject(new BSFFunctions(mgr, this), global);
global.put("bsf", global, bsf);
for(final Iterator it = declaredBeans.iterator(); it.hasNext();) {
declareBean((BSFDeclaredBean) it.next());
}
}
catch (final Throwable t) {
}
finally {
Context.exit();
}
}
public void undeclareBean(final BSFDeclaredBean bean) throws BSFException {
global.delete(bean.name);
}
}
|
/*
* 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 br.com.cbi.enumerators;
/**
*
* @author Tiago
*/
public enum TIPO_ENDERECO {
RS("Residêncial"), CL("Comercial"), CB("Cobrança");
private final String valor;
private TIPO_ENDERECO(String valor) {
this.valor = valor;
}
public String getValor() {
return valor;
}
}
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.nifi.jasn1.convert.converters;
import com.beanit.asn1bean.ber.types.BerType;
import com.github.benmanes.caffeine.cache.LoadingCache;
import org.apache.nifi.jasn1.convert.JASN1Converter;
import org.apache.nifi.jasn1.convert.JASN1TypeAndValueConverter;
import org.apache.nifi.serialization.record.DataType;
import org.apache.nifi.serialization.record.MapRecord;
import org.apache.nifi.serialization.record.RecordField;
import org.apache.nifi.serialization.record.RecordFieldType;
import org.apache.nifi.serialization.record.RecordSchema;
import java.util.HashMap;
import java.util.function.Supplier;
import static org.apache.nifi.jasn1.JASN1Utils.invokeGetter;
import static org.apache.nifi.jasn1.JASN1Utils.toGetterMethod;
public class BerRecordConverter implements JASN1TypeAndValueConverter {
private final LoadingCache<Class, RecordSchema> schemaCache;
public BerRecordConverter(LoadingCache<Class, RecordSchema> schemaCache) {
this.schemaCache = schemaCache;
}
@Override
public boolean supportsType(Class<?> berType) {
// Needs to be the last to check
return true;
}
@Override
public DataType convertType(Class<?> berType, JASN1Converter converter) {
Supplier<RecordSchema> recordSchemaSupplier = () -> schemaCache.get(berType);
return RecordFieldType.RECORD.getRecordDataType(recordSchemaSupplier);
}
@Override
public boolean supportsValue(BerType value, DataType dataType) {
return RecordFieldType.RECORD.equals(dataType.getFieldType());
}
@Override
public Object convertValue(BerType berRecord, DataType dataType, JASN1Converter converter) {
final Class modelClass = berRecord.getClass();
final RecordSchema recordSchema = schemaCache.get(modelClass);
final MapRecord record = new MapRecord(recordSchema, new HashMap<>());
for (RecordField field : recordSchema.getFields()) {
String fieldName = field.getFieldName();
final Object value = invokeGetter(berRecord, toGetterMethod(fieldName));
if (value instanceof BerType) {
record.setValue(field, converter.convertValue((BerType) value, field.getDataType()));
}
}
return record;
}
}
|
/*
* Copyright 2020 bithon.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.bithon.server.sink.tracing.mapping;
import lombok.Data;
import java.util.Map;
/**
* Extract a user-defined transaction id on a given parameter to trace id
*
* - type: xxx
* - params:
*
* @author Frank Chen
* @date 10/12/21 3:08 PM
*/
@Data
public class TraceIdMappingConfig {
private String type;
private Map<String, Object> args;
}
|
/*******************************************************************************
* Copyright 2012 EMBL-EBI, Hinxton outstation
*
* 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 uk.ac.ebi.embl.flatfile.reader.genbank;
import uk.ac.ebi.embl.flatfile.FlatFileUtils;
import uk.ac.ebi.embl.flatfile.GenbankTag;
import uk.ac.ebi.embl.flatfile.reader.LineReader;
import uk.ac.ebi.embl.flatfile.reader.MultiLineBlockReader;
import uk.ac.ebi.embl.flatfile.reader.OrganismMatcher;
public class OrganismReader extends MultiLineBlockReader {
public OrganismReader(LineReader lineReader) {
super(lineReader, ConcatenateType.CONCATENATE_BREAK);
}
@Override
public String getTag() {
return GenbankTag.ORGANISM_TAG;
}
@Override
protected void read(String block) {
boolean isFirstLine = true;
StringBuilder str = new StringBuilder();
for (String line : FlatFileUtils.split(block, "\n")) {
if (isFirstLine) {
isFirstLine = false;
OrganismMatcher organismMatcher = new OrganismMatcher(this);
if (organismMatcher.match(line)) {
getCache().setScientificName(organismMatcher.getScientificName());
String commonName = organismMatcher.getCommonName();
if (commonName != null) {
getCache().setCommonName(commonName);
}
} else {
getCache().setScientificName(line);
}
}
else {
str.append(" ");
str.append(line);
}
}
String lineage = str.toString();
lineage = FlatFileUtils.trimLeft(lineage);
lineage = FlatFileUtils.trimRight(lineage, '.');
getCache().setLineage(lineage);
}
}
|
/**
* Created by goroyal on 10/27/2015.
*/
public class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(int x){
val = x;
}
}
|
/* Copyright 2002-2022 CS GROUP
* Licensed to CS GROUP (CS) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* CS licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.csgroup.examples.gnss;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.stream.Collectors;
import org.hipparchus.exception.LocalizedCoreFormats;
import org.hipparchus.geometry.euclidean.threed.Vector3D;
import org.hipparchus.ode.events.Action;
import org.hipparchus.util.FastMath;
import org.orekit.bodies.CelestialBody;
import org.orekit.bodies.CelestialBodyFactory;
import org.orekit.data.DataContext;
import org.orekit.data.DataProvidersManager;
import org.orekit.data.DataSource;
import org.orekit.data.DirectoryCrawler;
import org.orekit.data.UnixCompressFilter;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitMessages;
import org.orekit.files.sp3.SP3File;
import org.orekit.files.sp3.SP3File.SP3Ephemeris;
import org.orekit.files.sp3.SP3Parser;
import org.orekit.gnss.SatelliteSystem;
import org.orekit.gnss.antenna.AntexLoader;
import org.orekit.gnss.antenna.SatelliteAntenna;
import org.orekit.propagation.BoundedPropagator;
import org.orekit.propagation.SpacecraftState;
import org.orekit.propagation.events.AbstractDetector;
import org.orekit.propagation.events.AlignmentDetector;
import org.orekit.propagation.events.EventDetector;
import org.orekit.propagation.events.handlers.EventHandler;
import org.orekit.propagation.events.handlers.StopOnIncreasing;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.TimeScale;
import org.orekit.time.TimeScalesFactory;
import org.orekit.utils.Constants;
import org.orekit.utils.PVCoordinatesProvider;
import org.orekit.utils.TimeSpanMap;
public class FindBaseSamples {
/** Option for orekit data directory. */
private static final String OPTION_OREKIT_DATA_DIR = "-orekit-data-dir";
/** Option for SP3 files directory. */
private static final String OPTION_SP3_DIR = "-sp3-dir";
/** Option for output directory. */
private static final String OPTION_OUTPUT_DIR = "-output-dir";
/** Option for antex file. */
private static final String OPTION_ANTEX_FILE = "-antex";
public static void main(String[] args) {
try {
File orekitDataDir = null;
File sp3Dir = null;
File outputDir = null;
File antexDir = null;
String antexName = null;
for (int i = 0; i < args.length - 1; ++i) {
switch (args[i]) {
case OPTION_OREKIT_DATA_DIR :
orekitDataDir = new File(args[++i]);
break;
case OPTION_SP3_DIR :
sp3Dir = new File(args[++i]);
break;
case OPTION_OUTPUT_DIR :
outputDir = new File(args[++i]);
break;
case OPTION_ANTEX_FILE : {
final File fullPath = new File(args[++i]);
antexDir = fullPath.getParentFile();
antexName = fullPath.getName();
break;
}
default :
throw new OrekitException(LocalizedCoreFormats.SIMPLE_MESSAGE,
"unknown option " + args[i]);
}
}
if (orekitDataDir == null || sp3Dir == null || outputDir == null || antexDir == null) {
throw new OrekitException(LocalizedCoreFormats.SIMPLE_MESSAGE,
"usage: java fr.cs.examples.gnss.FindBaseSamples " +
OPTION_OREKIT_DATA_DIR + " <directory> " +
OPTION_SP3_DIR + " <directory> " +
OPTION_ANTEX_FILE + " <file>");
}
for (File directory : Arrays.asList(orekitDataDir, sp3Dir, outputDir, antexDir)) {
if (!directory.exists() || !directory.isDirectory()) {
throw new OrekitException(LocalizedCoreFormats.SIMPLE_MESSAGE,
directory + " does not exist or is not a directory");
}
}
final DataProvidersManager manager = DataContext.getDefault().getDataProvidersManager();
manager.addProvider(new DirectoryCrawler(orekitDataDir));
manager.addProvider(new DirectoryCrawler(antexDir));
final AntexLoader loader = new AntexLoader(antexName);
final CelestialBody sun = CelestialBodyFactory.getSun();
// find the available Unix-compressed sp3 files in lexicographic order
// (which is here chronological order too)
final List<String> sp3Names = Arrays.asList(sp3Dir.list()).
stream().
filter(name -> name.endsWith(".sp3.Z")).
collect(Collectors.toList());
Collections.sort(sp3Names);
final TimeSpanMap<File> sp3ByDate = new TimeSpanMap<File>(null);
final List<SampleMetaData> samples = new ArrayList<>();
for (String sp3Name : sp3Names) {
System.out.println(" " + sp3Name);
final File f = new File(sp3Dir, sp3Name);
final DataSource compressed = new DataSource(sp3Name, () -> new FileInputStream(f));
final DataSource uncompressed = new UnixCompressFilter().filter(compressed);
final SP3File sp3 = new SP3Parser().parse(uncompressed);
sp3ByDate.addValidAfter(f, sp3.getEpoch());
for (final Map.Entry<String, SP3Ephemeris> entry : sp3.getSatellites().entrySet()) {
final String sat = entry.getKey();
try {
final SatelliteSystem system = SatelliteSystem.parseSatelliteSystem(sat.substring(0, 1));
final TimeSpanMap<SatelliteAntenna> map =
loader.findSatelliteAntenna(system, Integer.parseInt(sat.substring(1)));
final SatelliteAntenna antenna = map.get(sp3.getEpoch());
final BoundedPropagator propagator = entry.getValue().getPropagator();
if ("BEIDOU-2M".equals(antenna.getType()) || "BEIDOU-2I".equals(antenna.getType())) {
// for Beidou MEO and IGSO, we are only interested in large β and (more importantly) in β = ±4°
propagator.addEventDetector(new BetaDetector(900.0, 1.0, sun, -19.0).
withHandler(new Handler<>(sun, antenna, -19.0, samples,
sat, "β≪0", 6 * Constants.JULIAN_DAY)));
propagator.addEventDetector(new BetaDetector(900.0, 1.0, sun, -4.0).
withHandler(new Handler<>(sun, antenna, -4.0, samples,
sat, "β<0", 6 * Constants.JULIAN_DAY)));
propagator.addEventDetector(new BetaDetector(900.0, 1.0, sun, +4.0).
withHandler(new Handler<>(sun, antenna, +4.0, samples,
sat, "β>0", 6 * Constants.JULIAN_DAY)));
propagator.addEventDetector(new BetaDetector(900.0, 1.0, sun, +30.0).
withHandler(new Handler<>(sun, antenna, +30.0, samples,
sat, "β≫0", 6 * Constants.JULIAN_DAY)));
} else {
// for other satellites, we are interested in noon/midnight turns
propagator.addEventDetector(new AlignmentDetector(900.0, 1.0, sun, 0.0).
withHandler(new Handler<>(sun, antenna, -19.0, samples,
sat, "β≪0", 90 * 60.0)));
propagator.addEventDetector(new AlignmentDetector(900.0, 1.0, sun, 0.0).
withHandler(new Handler<>(sun, antenna, -1.5, samples,
sat, "β<0", 90 * 60.0)));
propagator.addEventDetector(new AlignmentDetector(900.0, 1.0, sun, 0.0).
withHandler(new Handler<>(sun, antenna, 0.0, samples,
sat, "β≈0", 90 * 60.0)));
propagator.addEventDetector(new AlignmentDetector(900.0, 1.0, sun, 0.0).
withHandler(new Handler<>(sun, antenna, +1.5, samples,
sat, "β>0", 90 * 60.0)));
propagator.addEventDetector(new AlignmentDetector(900.0, 1.0, sun, 0.0).
withHandler(new Handler<>(sun, antenna, +30.0, samples,
sat, "β≫0", 90 * 60.0)));
}
propagator.propagate(propagator.getMinDate().shiftedBy( 10),
propagator.getMaxDate().shiftedBy(-10));
} catch (OrekitException oe) {
if (oe.getSpecifier() != OrekitMessages.CANNOT_FIND_SATELLITE_IN_SYSTEM) {
System.err.println("# unable to propagate " + sat);
}
}
}
}
final String csn = StandardCharsets.UTF_8.name();
try (PrintStream out = new PrintStream(new File(outputDir, "samples-meta-data.txt"), csn)) {
final TimeScale gps = TimeScalesFactory.getGPS();
out.format(Locale.US,
"# Id type satCode case" +
" start (GPS) end (GPS) SP3 files%n");
for (final SampleMetaData sample : samples) {
out.format(Locale.US, " %3s %-11s %-4s %s %s %s " ,
sample.id, sample.type, sample.satCode, sample.useCase,
sample.start.toString(gps), sample.end.toString(gps));
File previous = null;
for (AbsoluteDate date = sample.start;
date.compareTo(sample.end) <= 0;
date = date.shiftedBy(60.0)) {
File current = sp3ByDate.get(date);
if (current != null && !current.equals(previous)) {
out.format(Locale.US, " %s", current.getName());
}
previous = current;
}
out.format(Locale.US, "%n");
}
}
} catch (OrekitException | IOException e) {
System.err.println(e.getLocalizedMessage());
}
}
private static class BetaDetector extends AbstractDetector<BetaDetector> {
private final PVCoordinatesProvider sun;
private final double targetAngle;
BetaDetector(final double maxCheck, final double threshold,
final PVCoordinatesProvider sun,
final double targetAngleDeg) {
this(maxCheck, threshold, DEFAULT_MAX_ITER,
new StopOnIncreasing<BetaDetector>(),
sun, FastMath.toRadians(targetAngleDeg));
}
private BetaDetector(final double maxCheck, final double threshold,
final int maxIter, final EventHandler<? super BetaDetector> handler,
final PVCoordinatesProvider sun,
final double targetAngle) {
super(maxCheck, threshold, maxIter, handler);
this.sun = sun;
this.targetAngle = targetAngle;
}
/** {@inheritDoc} */
@Override
protected BetaDetector create(final double newMaxCheck, final double newThreshold,
final int newMaxIter, final EventHandler<? super BetaDetector> newHandler) {
return new BetaDetector(newMaxCheck, newThreshold, newMaxIter, newHandler, sun, targetAngle);
}
/** {@inheritDoc} */
@Override
public double g(final SpacecraftState s) {
final Vector3D pSun = sun.getPVCoordinates(s.getDate(), s.getFrame()).getPosition();
final Vector3D mSat = s.getPVCoordinates().getMomentum();
final double beta = 0.5 * FastMath.PI - Vector3D.angle(pSun, mSat);
return beta - targetAngle;
}
}
private static class Handler<T extends EventDetector> implements EventHandler<T> {
final CelestialBody sun;
final SatelliteAntenna antenna;
final double betaRef;
final List<SampleMetaData> samples;
final String sat;
final String useCase;
final double span;
Handler(final CelestialBody sun, final SatelliteAntenna antenna, final double betaRef,
final List<SampleMetaData> samples, final String sat, final String useCase,
final double span) {
this.sun = sun;
this.antenna = antenna;
this.betaRef = betaRef;
this.samples = samples;
this.sat = sat;
this.useCase = useCase;
this.span = span;
}
@Override
public Action eventOccurred(SpacecraftState s, T detector, boolean increasing) {
if (FastMath.abs(beta(s) - betaRef) < 0.5 &&
(beta(s.shiftedBy(-1800)) - betaRef) * (beta(s.shiftedBy(+1800)) - betaRef) <= 0) {
samples.add(new SampleMetaData(sat,
antenna.getType().replaceAll(" ", "-"),
sat.substring(0, 1) + antenna.getSatelliteCode(),
useCase,
s.getDate().shiftedBy(-0.5 * span),
s.getDate().shiftedBy(+0.5 * span)));
}
return Action.CONTINUE;
}
private double beta(final SpacecraftState s) {
final Vector3D pSun = sun.getPVCoordinates(s.getDate(), s.getFrame()).getPosition();
final Vector3D mSat = s.getPVCoordinates().getMomentum();
return FastMath.toDegrees(0.5 * FastMath.PI - Vector3D.angle(pSun, mSat));
}
}
private static class SampleMetaData {
private final String id;
private final String type;
private final String satCode;
private final String useCase;
private final AbsoluteDate start;
private final AbsoluteDate end;
SampleMetaData(final String id, final String type, final String satCode, final String useCase,
final AbsoluteDate start, final AbsoluteDate end) {
this.id = id;
this.type = type;
this.satCode = satCode;
this.useCase = useCase;
this.start = start;
this.end = end;
}
}
}
|
package com.young.share.model;
import cn.bmob.v3.BmobObject;
/**
* 评论、回复与分享信息的关系
* Created by Nearby Yang on 2015-10-16.
*/
public class Comment_HZ extends BmobObject {
private ShareMessage_HZ shMsgId;
private Message_HZ messageId;
private MyUser senderId;
private MyUser reveicerId;
public ShareMessage_HZ getShMsgId() {
return shMsgId;
}
public void setShMsgId(ShareMessage_HZ shMsgId) {
this.shMsgId = shMsgId;
}
public Message_HZ getMessageId() {
return messageId;
}
public void setMessageId(Message_HZ messageId) {
this.messageId = messageId;
}
public MyUser getSenderId() {
return senderId;
}
public void setSenderId(MyUser senderId) {
this.senderId = senderId;
}
public MyUser getReveicerId() {
return reveicerId;
}
public void setReveicerId(MyUser reveicerId) {
this.reveicerId = reveicerId;
}
}
|
/*
* 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 schedulemanagement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
/**
*
* @author shanu
*/
public class DbConnect {
protected Connection connection = null;
protected final String USERNAME = "krishan";
protected final String PASSWORD = "root";
protected PreparedStatement pst =null;
protected ResultSet rs = null;
protected String sq = "jdbc:mysql://localhost:3306/registeration_details";
//function is used to check if the user name and password matches with the database and then open the respective portal
public void check (String sql, String user, String pwd , JFrame port, JFrame current){
try {
connection = DriverManager.getConnection(sq,USERNAME,PASSWORD);
pst = connection.prepareStatement(sql);
pst.setString(1, user);
pst.setString(2,pwd );
rs = pst.executeQuery();
if(rs.next()){
port.setVisible(true);
current.dispose();
}
else {
JOptionPane.showMessageDialog(null, "Wrong Password Or Username");
}
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
}
}
}
|
package com.packtpub.mastering.selenium.steps;
import com.packtpub.mastering.selenium.pageobjects.Google;
import com.packtpub.mastering.selenium.pageobjects.TemperatureConverterPage;
import cucumber.annotation.After;
import cucumber.annotation.Before;
import cucumber.annotation.en.Given;
import cucumber.annotation.en.Then;
import cucumber.annotation.en.When;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import java.util.concurrent.TimeUnit;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
/**
* Created by Ripon on 11/26/2015.
*/
public class ConversionStepDefs {
private WebDriver driver;
public Google googlePage;
public TemperatureConverterPage temperatureConverterPage;
@Given("^I want to convert (\\d+).(\\d+) degree Fahrenheit to Celsius$")
public void I_want_to_convert_degree_Fahrenheit_to_Celsius(int arg1, int arg2) throws Throwable {
driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
googlePage = new Google(driver);
temperatureConverterPage = googlePage.goToTemperatureConversionPage();
}
@When("^I input the value of Fahrenheit as (\\d+).(\\d+) in text field$")
public void I_input_the_value_of_Fahrenheit_as_in_text_field(int arg1, int arg2) throws Throwable {
//input Fahrenheit value
temperatureConverterPage.inputFahrenheit(98.6);
}
@Then("^It should be converted to Celsius as (\\d+) degree$")
public void It_should_be_converted_to_Celsius_as_degree(int arg1) throws Throwable {
//assertion
assertEquals(temperatureConverterPage.actualResult(), temperatureConverterPage.expectedResult());
driver.quit();
}
}
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.pulsar.client.api;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
/**
* {@link ReaderBuilder} is used to configure and create instances of {@link Reader}.
*
* @see PulsarClient#newReader()
*
* @since 2.0.0
*/
public interface ReaderBuilder<T> extends Cloneable {
/**
* Finalize the creation of the {@link Reader} instance.
* <p>
* This method will block until the reader is created successfully or an exception is thrown.
*
* @return the reader instance
* @throws PulsarClientException
* if the reader creation fails
*/
Reader<T> create() throws PulsarClientException;
/**
* Finalize the creation of the {@link Reader} instance in asynchronous mode.
*
* <p>
* This method will return a {@link CompletableFuture} that can be used to access the instance when it's ready.
*
* @return the reader instance
* @throws PulsarClientException
* if the reader creation fails
*/
CompletableFuture<Reader<T>> createAsync();
/**
* Load the configuration from provided <tt>config</tt> map.
*
* <p>
* Example:
*
* <pre>{@code
* Map<String, Object> config = new HashMap<>();
* config.put("topicName", "test-topic");
* config.put("receiverQueueSize", 2000);
*
* ReaderBuilder<byte[]> builder = ...;
* builder = builder.loadConf(config);
*
* Reader<byte[]> reader = builder.create();
* }</pre>
*
* @param config
* configuration to load
* @return the reader builder instance
*/
ReaderBuilder<T> loadConf(Map<String, Object> config);
/**
* Create a copy of the current {@link ReaderBuilder}.
* <p>
* Cloning the builder can be used to share an incomplete configuration and specialize it multiple times. For
* example:
*
* <pre>{@code
* ReaderBuilder<String> builder = client.newReader(Schema.STRING)
* .readerName("my-reader")
* .receiverQueueSize(10);
*
* Reader<String> reader1 = builder.clone().topic("topic-1").create();
* Reader<String> reader2 = builder.clone().topic("topic-2").create();
* }</pre>
*
* @return a clone of the reader builder instance
*/
ReaderBuilder<T> clone();
/**
* Specify the topic this reader will read from.
* <p>
* This argument is required when constructing the reader.
*
* @param topicName
* the name of the topic
* @return the reader builder instance
*/
ReaderBuilder<T> topic(String topicName);
/**
* The initial reader positioning is done by specifying a message id. The options are:
* <ul>
* <li>{@link MessageId#earliest}: Start reading from the earliest message available in the topic</li>
* <li>{@link MessageId#latest}: Start reading from end of the topic. The first message read will be the one
* published <b>*after*</b> the creation of the builder</li>
* <li>{@link MessageId}: Position the reader on a particular message. The first message read will be the one
* immediately <b>*after*</b> the specified message</li>
* </ul>
*
* @param startMessageId the message id where the reader will be initially positioned on
* @return the reader builder instance
*/
ReaderBuilder<T> startMessageId(MessageId startMessageId);
/**
* Sets a {@link ReaderListener} for the reader
* <p>
* When a {@link ReaderListener} is set, application will receive messages through it. Calls to
* {@link Reader#readNext()} will not be allowed.
*
* @param readerListener
* the listener object
* @return the reader builder instance
*/
ReaderBuilder<T> readerListener(ReaderListener<T> readerListener);
/**
* Sets a {@link CryptoKeyReader} to decrypt the message payloads.
*
* @param cryptoKeyReader
* CryptoKeyReader object
* @return the reader builder instance
*/
ReaderBuilder<T> cryptoKeyReader(CryptoKeyReader cryptoKeyReader);
/**
* Sets the {@link ConsumerCryptoFailureAction} to specify
*
* @param action
* The action to take when the decoding fails
* @return the reader builder instance
*/
ReaderBuilder<T> cryptoFailureAction(ConsumerCryptoFailureAction action);
/**
* Sets the size of the consumer receive queue.
* <p>
* The consumer receive queue controls how many messages can be accumulated by the {@link Consumer} before the
* application calls {@link Consumer#receive()}. Using a higher value could potentially increase the consumer
* throughput at the expense of bigger memory utilization.
* <p>
* Default value is {@code 1000} messages and should be good for most use cases.
*
* @param receiverQueueSize
* the new receiver queue size value
* @return the reader builder instance
*/
ReaderBuilder<T> receiverQueueSize(int receiverQueueSize);
/**
* Specify a reader name.
* <p>
* The reader name is purely informational and can used to track a particular reader in the reported stats. By
* default a randomly generated name is used.
*
* @param readerName
* the name to use for the reader
* @return the reader builder instance
*/
ReaderBuilder<T> readerName(String readerName);
/**
* Set the subscription role prefix. The default prefix is "reader".
*
* @param subscriptionRolePrefix
* @return the reader builder instance
*/
ReaderBuilder<T> subscriptionRolePrefix(String subscriptionRolePrefix);
/**
* If enabled, the reader will read messages from the compacted topic rather than reading the full message backlog
* of the topic. This means that, if the topic has been compacted, the reader will only see the latest value for
* each key in the topic, up until the point in the topic message backlog that has been compacted. Beyond that
* point, the messages will be sent as normal.
* <p>
* readCompacted can only be enabled when reading from a persistent topic. Attempting to enable it on non-persistent
* topics will lead to the reader create call throwing a {@link PulsarClientException}.
*
* @param readCompacted
* whether to read from the compacted topic
* @return the reader builder instance
*/
ReaderBuilder<T> readCompacted(boolean readCompacted);
}
|
package rs.ac.uns.pmf.mis.restaurantguest.domain.model.employee;
public class EmployeeEntity {
private Employees employees;
public Employees getEmployees() {
return employees;
}
@Override
public String toString() {
return
"EmployeeEntity{" +
"employees = '" + employees + '\'' +
"}";
}
}
|
/*
* Copyright (c) 2010, grossmann
* 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 the jo-widgets.org 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 jo-widgets.org BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.jowidgets.impl.widgets.common.wrapper;
import org.jowidgets.common.widgets.ISplitCompositeCommon;
import org.jowidgets.spi.widgets.ISplitCompositeSpi;
public abstract class AbstractSplitCompositeSpiWrapper extends AbstractControlSpiWrapper implements ISplitCompositeCommon {
public AbstractSplitCompositeSpiWrapper(final ISplitCompositeSpi widget) {
super(widget);
}
@Override
public ISplitCompositeSpi getWidget() {
return (ISplitCompositeSpi) super.getWidget();
}
}
|
/*
* Copyright (c) 2020-2021. Clément Grennerat
* All rights reserved. You must refer to the licence Apache 2.
*/
package fr.clementgre.pdf4teachers.panel.sidebar.texts.TreeViewSections;
import fr.clementgre.pdf4teachers.document.editions.elements.TextElement;
import fr.clementgre.pdf4teachers.interfaces.windows.MainWindow;
import fr.clementgre.pdf4teachers.interfaces.windows.language.TR;
import fr.clementgre.pdf4teachers.panel.sidebar.texts.SortPanelTreeItem;
import fr.clementgre.pdf4teachers.panel.sidebar.texts.TextListItem;
import fr.clementgre.pdf4teachers.panel.sidebar.texts.TextTreeItem;
import fr.clementgre.pdf4teachers.panel.sidebar.texts.TextTreeView;
import fr.clementgre.pdf4teachers.utils.image.ImageUtils;
import fr.clementgre.pdf4teachers.utils.panes.PaneUtils;
import fr.clementgre.pdf4teachers.utils.sort.SortManager;
import fr.clementgre.pdf4teachers.utils.style.StyleManager;
import fr.clementgre.pdf4teachers.utils.svg.SVGPathIcons;
import javafx.geometry.Pos;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.ToggleButton;
import javafx.scene.control.TreeCell;
import javafx.scene.control.TreeItem;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.scene.text.Text;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@SuppressWarnings("unchecked")
public abstract class TextTreeSection extends TreeItem<String> {
public static final int FAVORITE_TYPE = 1;
public static final int LAST_TYPE = 2;
public static final int ONFILE_TYPE = 3;
// SORT
public SortManager sortManager;
public SortPanelTreeItem sortCell = new SortPanelTreeItem();
public ToggleButton sortToggleBtn = new ToggleButton("");
public String sectionName;
public int sectionType;
HBox pane = new HBox();
ContextMenu menu;
public static HashMap<String, ArrayList<TextListItem>> lists = new HashMap<>();
public TextTreeSection(String sectionName, int sectionType){
this.sectionName = sectionName;
this.sectionType = sectionType;
setup();
}
public void setup(){
sortToggleBtn.selectedProperty().addListener((observable, oldValue, newValue) -> {
if(newValue){
getChildren().add(0, sortCell);
setExpanded(true);
}else{
getChildren().remove(0);
}
});
sortManager = new SortManager((sortType, order) -> {
List<TextTreeItem> toSort = new ArrayList<>();
for(int i = 0; i < getChildren().size(); i++){
if(getChildren().get(i) instanceof TextTreeItem){
toSort.add((TextTreeItem) getChildren().get(i));
}
}
clearElements(false); // unlink = false because the element are just reordered, not replaced.
for(TextTreeItem item : TextTreeView.autoSortList(toSort, sortType, order)) getChildren().add(item);
}, null);
setupSortManager();
setExpanded(true);
}
public abstract void setupSortManager();
public void setupGraphics(){
PaneUtils.setPosition(sortToggleBtn, 0, 0, 30, 30, true);
sortToggleBtn.setGraphic(SVGPathIcons.generateImage(SVGPathIcons.SORT, "black", 0, 18, 18, ImageUtils.defaultDarkColorAdjust));
sortToggleBtn.setTooltip(PaneUtils.genWrappedToolTip(TR.tr("sorting.name")));
if(sortToggleBtn.isSelected()) sortToggleBtn.setStyle("");
else sortToggleBtn.setStyle("-fx-background-color: " + StyleManager.getHexAccentColor() + ";");
sortToggleBtn.selectedProperty().addListener((observable, oldValue, newValue) -> {
if(newValue) sortToggleBtn.setStyle("");
else sortToggleBtn.setStyle("-fx-background-color: " + StyleManager.getHexAccentColor() + ";");
});
pane.setAlignment(Pos.CENTER);
pane.setPrefHeight(18);
pane.setStyle("-fx-padding: -6 -6 -6 -4;");
Text name = new Text(sectionName);
name.setStyle("-fx-font-size: 13;");
pane.getChildren().add(name);
Region spacer = new Region();
HBox.setHgrow(spacer, Priority.ALWAYS);
pane.getChildren().add(spacer);
pane.getChildren().add(sortToggleBtn);
menu = TextTreeView.getCategoryMenu(this);
}
public void updateGraphics(){
if(sortToggleBtn.isSelected()) sortToggleBtn.setStyle("");
else sortToggleBtn.setStyle("-fx-background-color: " + StyleManager.getHexAccentColor() + ";");
sortManager.updateGraphics();
MainWindow.textTab.treeView.refresh();
}
public void updateCell(TreeCell cell){
cell.setOnMouseClicked(null);
cell.setPrefHeight(30);
cell.setMaxHeight(30);
cell.setStyle("-fx-padding: 6 6 6 2; -fx-background-color: " + StyleManager.getHexAccentColor() + ";");
cell.setContextMenu(menu);
cell.setGraphic(pane);
}
public void updateChildrenGraphics(){
for(Object item : getChildren()){
if(item instanceof TextTreeItem textTreeItem){
textTreeItem.updateGraphic(true);
}
}
}
public void clearElements(boolean unlink){
List<TreeItem<String>> items = getChildren();
for(int i = items.size() - 1; i >= 0; i--){
if(items.get(i) instanceof TextTreeItem textTreeItem){
items.remove(i);
if(unlink) textTreeItem.unLink(false);
}
}
}
public void addElement(TextTreeItem element){
if(!getChildren().contains(element)){
getChildren().add(element);
sortManager.simulateCall();
}
}
public void removeElement(TextTreeItem element){
getChildren().remove(element);
element.unLink(false);
sortManager.simulateCall();
}
public void removeElement(TextElement element){
List<TreeItem<String>> items = getChildren();
for(TreeItem<String> item : items){
if(item instanceof TextTreeItem textTreeItem){
if(textTreeItem.getCore() != null){
if(textTreeItem.getCore().equals(element)){
items.remove(item);
textTreeItem.unLink(false);
break;
}
}
}
}
}
public void unlinkAll(){
for(TreeItem<String> item : getChildren()){
if(item instanceof TextTreeItem textTreeItem){
textTreeItem.unLink(true);
}
}
}
}
|
// instantiated with jti.pl from ReferenceToMember
/****************************************************************************
Copyright 2001-2018 Sphenon GmbH
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.
*****************************************************************************/
// please do not modify this file directly
package com.sphenon.basics.space.tplinst;
import com.sphenon.basics.space.*;
import com.sphenon.basics.space.returncodes.*;
import com.sphenon.basics.space.exceptions.*;
import com.sphenon.basics.space.classes.*;
import com.sphenon.basics.space.factories.*;
import com.sphenon.basics.services.*;
import com.sphenon.basics.expression.*;
import com.sphenon.basics.many.*;
import com.sphenon.basics.metadata.*;
import com.sphenon.basics.data.*;
import com.sphenon.basics.locating.*;
import com.sphenon.basics.debug.*;
import com.sphenon.basics.metadata.Type;
import com.sphenon.basics.context.*;
import com.sphenon.basics.exception.*;
import com.sphenon.basics.reference.*;
import com.sphenon.basics.many.*;
public interface ReferenceToMember_Space_long_ReadOnlyVector_Space_long__
extends Reference_Space_
, ReferenceToMember<Space,ReadOnlyVector<Space>>
{
public ReadOnlyVector_Space_long_ getContainer(CallContext context);
public long getIndex (CallContext context);
}
|
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: compiler/ir/serialization.common/src/KotlinIr.proto
package org.jetbrains.kotlin.backend.common.serialization.proto;
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration}
*/
public final class IrDeclaration extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite implements
// @@protoc_insertion_point(message_implements:org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration)
IrDeclarationOrBuilder {
// Use IrDeclaration.newBuilder() to construct.
private IrDeclaration(org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private IrDeclaration(boolean noInit) { this.unknownFields = org.jetbrains.kotlin.protobuf.ByteString.EMPTY;}
private static final IrDeclaration defaultInstance;
public static IrDeclaration getDefaultInstance() {
return defaultInstance;
}
public IrDeclaration getDefaultInstanceForType() {
return defaultInstance;
}
private final org.jetbrains.kotlin.protobuf.ByteString unknownFields;
private IrDeclaration(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
org.jetbrains.kotlin.protobuf.ByteString.Output unknownFieldsOutput =
org.jetbrains.kotlin.protobuf.ByteString.newOutput();
org.jetbrains.kotlin.protobuf.CodedOutputStream unknownFieldsCodedOutput =
org.jetbrains.kotlin.protobuf.CodedOutputStream.newInstance(
unknownFieldsOutput);
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFieldsCodedOutput,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit.Builder subBuilder = null;
if (declaratorCase_ == 1) {
subBuilder = ((org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit) declarator_).toBuilder();
}
declarator_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit) declarator_);
declarator_ = subBuilder.buildPartial();
}
declaratorCase_ = 1;
break;
}
case 18: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrClass.Builder subBuilder = null;
if (declaratorCase_ == 2) {
subBuilder = ((org.jetbrains.kotlin.backend.common.serialization.proto.IrClass) declarator_).toBuilder();
}
declarator_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrClass.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((org.jetbrains.kotlin.backend.common.serialization.proto.IrClass) declarator_);
declarator_ = subBuilder.buildPartial();
}
declaratorCase_ = 2;
break;
}
case 26: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor.Builder subBuilder = null;
if (declaratorCase_ == 3) {
subBuilder = ((org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor) declarator_).toBuilder();
}
declarator_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor) declarator_);
declarator_ = subBuilder.buildPartial();
}
declaratorCase_ = 3;
break;
}
case 34: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry.Builder subBuilder = null;
if (declaratorCase_ == 4) {
subBuilder = ((org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry) declarator_).toBuilder();
}
declarator_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry) declarator_);
declarator_ = subBuilder.buildPartial();
}
declaratorCase_ = 4;
break;
}
case 42: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrField.Builder subBuilder = null;
if (declaratorCase_ == 5) {
subBuilder = ((org.jetbrains.kotlin.backend.common.serialization.proto.IrField) declarator_).toBuilder();
}
declarator_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrField.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((org.jetbrains.kotlin.backend.common.serialization.proto.IrField) declarator_);
declarator_ = subBuilder.buildPartial();
}
declaratorCase_ = 5;
break;
}
case 50: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction.Builder subBuilder = null;
if (declaratorCase_ == 6) {
subBuilder = ((org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction) declarator_).toBuilder();
}
declarator_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction) declarator_);
declarator_ = subBuilder.buildPartial();
}
declaratorCase_ = 6;
break;
}
case 58: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty.Builder subBuilder = null;
if (declaratorCase_ == 7) {
subBuilder = ((org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty) declarator_).toBuilder();
}
declarator_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty) declarator_);
declarator_ = subBuilder.buildPartial();
}
declaratorCase_ = 7;
break;
}
case 66: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter.Builder subBuilder = null;
if (declaratorCase_ == 8) {
subBuilder = ((org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter) declarator_).toBuilder();
}
declarator_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter) declarator_);
declarator_ = subBuilder.buildPartial();
}
declaratorCase_ = 8;
break;
}
case 74: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable.Builder subBuilder = null;
if (declaratorCase_ == 9) {
subBuilder = ((org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable) declarator_).toBuilder();
}
declarator_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable) declarator_);
declarator_ = subBuilder.buildPartial();
}
declaratorCase_ = 9;
break;
}
case 82: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter.Builder subBuilder = null;
if (declaratorCase_ == 10) {
subBuilder = ((org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter) declarator_).toBuilder();
}
declarator_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter) declarator_);
declarator_ = subBuilder.buildPartial();
}
declaratorCase_ = 10;
break;
}
case 90: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty.Builder subBuilder = null;
if (declaratorCase_ == 11) {
subBuilder = ((org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty) declarator_).toBuilder();
}
declarator_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty) declarator_);
declarator_ = subBuilder.buildPartial();
}
declaratorCase_ = 11;
break;
}
case 98: {
org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias.Builder subBuilder = null;
if (declaratorCase_ == 12) {
subBuilder = ((org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias) declarator_).toBuilder();
}
declarator_ = input.readMessage(org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias) declarator_);
declarator_ = subBuilder.buildPartial();
}
declaratorCase_ = 12;
break;
}
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
try {
unknownFieldsCodedOutput.flush();
} catch (java.io.IOException e) {
// Should not happen
} finally {
unknownFields = unknownFieldsOutput.toByteString();
}
makeExtensionsImmutable();
}
}
public static org.jetbrains.kotlin.protobuf.Parser<IrDeclaration> PARSER =
new org.jetbrains.kotlin.protobuf.AbstractParser<IrDeclaration>() {
public IrDeclaration parsePartialFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return new IrDeclaration(input, extensionRegistry);
}
};
@java.lang.Override
public org.jetbrains.kotlin.protobuf.Parser<IrDeclaration> getParserForType() {
return PARSER;
}
private int bitField0_;
private int declaratorCase_ = 0;
private java.lang.Object declarator_;
public enum DeclaratorCase
implements org.jetbrains.kotlin.protobuf.Internal.EnumLite {
IR_ANONYMOUS_INIT(1),
IR_CLASS(2),
IR_CONSTRUCTOR(3),
IR_ENUM_ENTRY(4),
IR_FIELD(5),
IR_FUNCTION(6),
IR_PROPERTY(7),
IR_TYPE_PARAMETER(8),
IR_VARIABLE(9),
IR_VALUE_PARAMETER(10),
IR_LOCAL_DELEGATED_PROPERTY(11),
IR_TYPE_ALIAS(12),
DECLARATOR_NOT_SET(0);
private int value = 0;
private DeclaratorCase(int value) {
this.value = value;
}
public static DeclaratorCase valueOf(int value) {
switch (value) {
case 1: return IR_ANONYMOUS_INIT;
case 2: return IR_CLASS;
case 3: return IR_CONSTRUCTOR;
case 4: return IR_ENUM_ENTRY;
case 5: return IR_FIELD;
case 6: return IR_FUNCTION;
case 7: return IR_PROPERTY;
case 8: return IR_TYPE_PARAMETER;
case 9: return IR_VARIABLE;
case 10: return IR_VALUE_PARAMETER;
case 11: return IR_LOCAL_DELEGATED_PROPERTY;
case 12: return IR_TYPE_ALIAS;
case 0: return DECLARATOR_NOT_SET;
default: throw new java.lang.IllegalArgumentException(
"Value is undefined for this oneof enum.");
}
}
public int getNumber() {
return this.value;
}
};
public DeclaratorCase
getDeclaratorCase() {
return DeclaratorCase.valueOf(
declaratorCase_);
}
public static final int IR_ANONYMOUS_INIT_FIELD_NUMBER = 1;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit ir_anonymous_init = 1;</code>
*/
public boolean hasIrAnonymousInit() {
return declaratorCase_ == 1;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit ir_anonymous_init = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit getIrAnonymousInit() {
if (declaratorCase_ == 1) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit.getDefaultInstance();
}
public static final int IR_CLASS_FIELD_NUMBER = 2;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass ir_class = 2;</code>
*/
public boolean hasIrClass() {
return declaratorCase_ == 2;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass ir_class = 2;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrClass getIrClass() {
if (declaratorCase_ == 2) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrClass) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrClass.getDefaultInstance();
}
public static final int IR_CONSTRUCTOR_FIELD_NUMBER = 3;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor ir_constructor = 3;</code>
*/
public boolean hasIrConstructor() {
return declaratorCase_ == 3;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor ir_constructor = 3;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor getIrConstructor() {
if (declaratorCase_ == 3) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor.getDefaultInstance();
}
public static final int IR_ENUM_ENTRY_FIELD_NUMBER = 4;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry ir_enum_entry = 4;</code>
*/
public boolean hasIrEnumEntry() {
return declaratorCase_ == 4;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry ir_enum_entry = 4;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry getIrEnumEntry() {
if (declaratorCase_ == 4) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry.getDefaultInstance();
}
public static final int IR_FIELD_FIELD_NUMBER = 5;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrField ir_field = 5;</code>
*/
public boolean hasIrField() {
return declaratorCase_ == 5;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrField ir_field = 5;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrField getIrField() {
if (declaratorCase_ == 5) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrField) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrField.getDefaultInstance();
}
public static final int IR_FUNCTION_FIELD_NUMBER = 6;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction ir_function = 6;</code>
*/
public boolean hasIrFunction() {
return declaratorCase_ == 6;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction ir_function = 6;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction getIrFunction() {
if (declaratorCase_ == 6) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction.getDefaultInstance();
}
public static final int IR_PROPERTY_FIELD_NUMBER = 7;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty ir_property = 7;</code>
*/
public boolean hasIrProperty() {
return declaratorCase_ == 7;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty ir_property = 7;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty getIrProperty() {
if (declaratorCase_ == 7) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty.getDefaultInstance();
}
public static final int IR_TYPE_PARAMETER_FIELD_NUMBER = 8;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter ir_type_parameter = 8;</code>
*/
public boolean hasIrTypeParameter() {
return declaratorCase_ == 8;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter ir_type_parameter = 8;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter getIrTypeParameter() {
if (declaratorCase_ == 8) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter.getDefaultInstance();
}
public static final int IR_VARIABLE_FIELD_NUMBER = 9;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable ir_variable = 9;</code>
*/
public boolean hasIrVariable() {
return declaratorCase_ == 9;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable ir_variable = 9;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable getIrVariable() {
if (declaratorCase_ == 9) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable.getDefaultInstance();
}
public static final int IR_VALUE_PARAMETER_FIELD_NUMBER = 10;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter ir_value_parameter = 10;</code>
*/
public boolean hasIrValueParameter() {
return declaratorCase_ == 10;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter ir_value_parameter = 10;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter getIrValueParameter() {
if (declaratorCase_ == 10) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter.getDefaultInstance();
}
public static final int IR_LOCAL_DELEGATED_PROPERTY_FIELD_NUMBER = 11;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty ir_local_delegated_property = 11;</code>
*/
public boolean hasIrLocalDelegatedProperty() {
return declaratorCase_ == 11;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty ir_local_delegated_property = 11;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty getIrLocalDelegatedProperty() {
if (declaratorCase_ == 11) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty.getDefaultInstance();
}
public static final int IR_TYPE_ALIAS_FIELD_NUMBER = 12;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias ir_type_alias = 12;</code>
*/
public boolean hasIrTypeAlias() {
return declaratorCase_ == 12;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias ir_type_alias = 12;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias getIrTypeAlias() {
if (declaratorCase_ == 12) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias.getDefaultInstance();
}
private void initFields() {
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (hasIrAnonymousInit()) {
if (!getIrAnonymousInit().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
if (hasIrClass()) {
if (!getIrClass().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
if (hasIrConstructor()) {
if (!getIrConstructor().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
if (hasIrEnumEntry()) {
if (!getIrEnumEntry().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
if (hasIrField()) {
if (!getIrField().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
if (hasIrFunction()) {
if (!getIrFunction().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
if (hasIrProperty()) {
if (!getIrProperty().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
if (hasIrTypeParameter()) {
if (!getIrTypeParameter().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
if (hasIrVariable()) {
if (!getIrVariable().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
if (hasIrValueParameter()) {
if (!getIrValueParameter().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
if (hasIrLocalDelegatedProperty()) {
if (!getIrLocalDelegatedProperty().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
if (hasIrTypeAlias()) {
if (!getIrTypeAlias().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(org.jetbrains.kotlin.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (declaratorCase_ == 1) {
output.writeMessage(1, (org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit) declarator_);
}
if (declaratorCase_ == 2) {
output.writeMessage(2, (org.jetbrains.kotlin.backend.common.serialization.proto.IrClass) declarator_);
}
if (declaratorCase_ == 3) {
output.writeMessage(3, (org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor) declarator_);
}
if (declaratorCase_ == 4) {
output.writeMessage(4, (org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry) declarator_);
}
if (declaratorCase_ == 5) {
output.writeMessage(5, (org.jetbrains.kotlin.backend.common.serialization.proto.IrField) declarator_);
}
if (declaratorCase_ == 6) {
output.writeMessage(6, (org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction) declarator_);
}
if (declaratorCase_ == 7) {
output.writeMessage(7, (org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty) declarator_);
}
if (declaratorCase_ == 8) {
output.writeMessage(8, (org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter) declarator_);
}
if (declaratorCase_ == 9) {
output.writeMessage(9, (org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable) declarator_);
}
if (declaratorCase_ == 10) {
output.writeMessage(10, (org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter) declarator_);
}
if (declaratorCase_ == 11) {
output.writeMessage(11, (org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty) declarator_);
}
if (declaratorCase_ == 12) {
output.writeMessage(12, (org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias) declarator_);
}
output.writeRawBytes(unknownFields);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (declaratorCase_ == 1) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(1, (org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit) declarator_);
}
if (declaratorCase_ == 2) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(2, (org.jetbrains.kotlin.backend.common.serialization.proto.IrClass) declarator_);
}
if (declaratorCase_ == 3) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(3, (org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor) declarator_);
}
if (declaratorCase_ == 4) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(4, (org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry) declarator_);
}
if (declaratorCase_ == 5) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(5, (org.jetbrains.kotlin.backend.common.serialization.proto.IrField) declarator_);
}
if (declaratorCase_ == 6) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(6, (org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction) declarator_);
}
if (declaratorCase_ == 7) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(7, (org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty) declarator_);
}
if (declaratorCase_ == 8) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(8, (org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter) declarator_);
}
if (declaratorCase_ == 9) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(9, (org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable) declarator_);
}
if (declaratorCase_ == 10) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(10, (org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter) declarator_);
}
if (declaratorCase_ == 11) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(11, (org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty) declarator_);
}
if (declaratorCase_ == 12) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(12, (org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias) declarator_);
}
size += unknownFields.size();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration parseFrom(
org.jetbrains.kotlin.protobuf.ByteString data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration parseFrom(
org.jetbrains.kotlin.protobuf.ByteString data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration parseFrom(byte[] data)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration parseFrom(
byte[] data,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration parseFrom(
java.io.InputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration parseDelimitedFrom(
java.io.InputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration parseFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
/**
* Protobuf type {@code org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration}
*/
public static final class Builder extends
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.Builder<
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration, Builder>
implements
// @@protoc_insertion_point(builder_implements:org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration)
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationOrBuilder {
// Construct using org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
declaratorCase_ = 0;
declarator_ = null;
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration getDefaultInstanceForType() {
return org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration.getDefaultInstance();
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration build() {
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration buildPartial() {
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration result = new org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (declaratorCase_ == 1) {
result.declarator_ = declarator_;
}
if (declaratorCase_ == 2) {
result.declarator_ = declarator_;
}
if (declaratorCase_ == 3) {
result.declarator_ = declarator_;
}
if (declaratorCase_ == 4) {
result.declarator_ = declarator_;
}
if (declaratorCase_ == 5) {
result.declarator_ = declarator_;
}
if (declaratorCase_ == 6) {
result.declarator_ = declarator_;
}
if (declaratorCase_ == 7) {
result.declarator_ = declarator_;
}
if (declaratorCase_ == 8) {
result.declarator_ = declarator_;
}
if (declaratorCase_ == 9) {
result.declarator_ = declarator_;
}
if (declaratorCase_ == 10) {
result.declarator_ = declarator_;
}
if (declaratorCase_ == 11) {
result.declarator_ = declarator_;
}
if (declaratorCase_ == 12) {
result.declarator_ = declarator_;
}
result.bitField0_ = to_bitField0_;
result.declaratorCase_ = declaratorCase_;
return result;
}
public Builder mergeFrom(org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration other) {
if (other == org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration.getDefaultInstance()) return this;
switch (other.getDeclaratorCase()) {
case IR_ANONYMOUS_INIT: {
mergeIrAnonymousInit(other.getIrAnonymousInit());
break;
}
case IR_CLASS: {
mergeIrClass(other.getIrClass());
break;
}
case IR_CONSTRUCTOR: {
mergeIrConstructor(other.getIrConstructor());
break;
}
case IR_ENUM_ENTRY: {
mergeIrEnumEntry(other.getIrEnumEntry());
break;
}
case IR_FIELD: {
mergeIrField(other.getIrField());
break;
}
case IR_FUNCTION: {
mergeIrFunction(other.getIrFunction());
break;
}
case IR_PROPERTY: {
mergeIrProperty(other.getIrProperty());
break;
}
case IR_TYPE_PARAMETER: {
mergeIrTypeParameter(other.getIrTypeParameter());
break;
}
case IR_VARIABLE: {
mergeIrVariable(other.getIrVariable());
break;
}
case IR_VALUE_PARAMETER: {
mergeIrValueParameter(other.getIrValueParameter());
break;
}
case IR_LOCAL_DELEGATED_PROPERTY: {
mergeIrLocalDelegatedProperty(other.getIrLocalDelegatedProperty());
break;
}
case IR_TYPE_ALIAS: {
mergeIrTypeAlias(other.getIrTypeAlias());
break;
}
case DECLARATOR_NOT_SET: {
break;
}
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
return this;
}
public final boolean isInitialized() {
if (hasIrAnonymousInit()) {
if (!getIrAnonymousInit().isInitialized()) {
return false;
}
}
if (hasIrClass()) {
if (!getIrClass().isInitialized()) {
return false;
}
}
if (hasIrConstructor()) {
if (!getIrConstructor().isInitialized()) {
return false;
}
}
if (hasIrEnumEntry()) {
if (!getIrEnumEntry().isInitialized()) {
return false;
}
}
if (hasIrField()) {
if (!getIrField().isInitialized()) {
return false;
}
}
if (hasIrFunction()) {
if (!getIrFunction().isInitialized()) {
return false;
}
}
if (hasIrProperty()) {
if (!getIrProperty().isInitialized()) {
return false;
}
}
if (hasIrTypeParameter()) {
if (!getIrTypeParameter().isInitialized()) {
return false;
}
}
if (hasIrVariable()) {
if (!getIrVariable().isInitialized()) {
return false;
}
}
if (hasIrValueParameter()) {
if (!getIrValueParameter().isInitialized()) {
return false;
}
}
if (hasIrLocalDelegatedProperty()) {
if (!getIrLocalDelegatedProperty().isInitialized()) {
return false;
}
}
if (hasIrTypeAlias()) {
if (!getIrTypeAlias().isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
org.jetbrains.kotlin.protobuf.CodedInputStream input,
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int declaratorCase_ = 0;
private java.lang.Object declarator_;
public DeclaratorCase
getDeclaratorCase() {
return DeclaratorCase.valueOf(
declaratorCase_);
}
public Builder clearDeclarator() {
declaratorCase_ = 0;
declarator_ = null;
return this;
}
private int bitField0_;
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit ir_anonymous_init = 1;</code>
*/
public boolean hasIrAnonymousInit() {
return declaratorCase_ == 1;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit ir_anonymous_init = 1;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit getIrAnonymousInit() {
if (declaratorCase_ == 1) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit.getDefaultInstance();
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit ir_anonymous_init = 1;</code>
*/
public Builder setIrAnonymousInit(org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit value) {
if (value == null) {
throw new NullPointerException();
}
declarator_ = value;
declaratorCase_ = 1;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit ir_anonymous_init = 1;</code>
*/
public Builder setIrAnonymousInit(
org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit.Builder builderForValue) {
declarator_ = builderForValue.build();
declaratorCase_ = 1;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit ir_anonymous_init = 1;</code>
*/
public Builder mergeIrAnonymousInit(org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit value) {
if (declaratorCase_ == 1 &&
declarator_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit.getDefaultInstance()) {
declarator_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit.newBuilder((org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit) declarator_)
.mergeFrom(value).buildPartial();
} else {
declarator_ = value;
}
declaratorCase_ = 1;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrAnonymousInit ir_anonymous_init = 1;</code>
*/
public Builder clearIrAnonymousInit() {
if (declaratorCase_ == 1) {
declaratorCase_ = 0;
declarator_ = null;
}
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass ir_class = 2;</code>
*/
public boolean hasIrClass() {
return declaratorCase_ == 2;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass ir_class = 2;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrClass getIrClass() {
if (declaratorCase_ == 2) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrClass) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrClass.getDefaultInstance();
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass ir_class = 2;</code>
*/
public Builder setIrClass(org.jetbrains.kotlin.backend.common.serialization.proto.IrClass value) {
if (value == null) {
throw new NullPointerException();
}
declarator_ = value;
declaratorCase_ = 2;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass ir_class = 2;</code>
*/
public Builder setIrClass(
org.jetbrains.kotlin.backend.common.serialization.proto.IrClass.Builder builderForValue) {
declarator_ = builderForValue.build();
declaratorCase_ = 2;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass ir_class = 2;</code>
*/
public Builder mergeIrClass(org.jetbrains.kotlin.backend.common.serialization.proto.IrClass value) {
if (declaratorCase_ == 2 &&
declarator_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrClass.getDefaultInstance()) {
declarator_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrClass.newBuilder((org.jetbrains.kotlin.backend.common.serialization.proto.IrClass) declarator_)
.mergeFrom(value).buildPartial();
} else {
declarator_ = value;
}
declaratorCase_ = 2;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrClass ir_class = 2;</code>
*/
public Builder clearIrClass() {
if (declaratorCase_ == 2) {
declaratorCase_ = 0;
declarator_ = null;
}
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor ir_constructor = 3;</code>
*/
public boolean hasIrConstructor() {
return declaratorCase_ == 3;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor ir_constructor = 3;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor getIrConstructor() {
if (declaratorCase_ == 3) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor.getDefaultInstance();
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor ir_constructor = 3;</code>
*/
public Builder setIrConstructor(org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor value) {
if (value == null) {
throw new NullPointerException();
}
declarator_ = value;
declaratorCase_ = 3;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor ir_constructor = 3;</code>
*/
public Builder setIrConstructor(
org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor.Builder builderForValue) {
declarator_ = builderForValue.build();
declaratorCase_ = 3;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor ir_constructor = 3;</code>
*/
public Builder mergeIrConstructor(org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor value) {
if (declaratorCase_ == 3 &&
declarator_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor.getDefaultInstance()) {
declarator_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor.newBuilder((org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor) declarator_)
.mergeFrom(value).buildPartial();
} else {
declarator_ = value;
}
declaratorCase_ = 3;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrConstructor ir_constructor = 3;</code>
*/
public Builder clearIrConstructor() {
if (declaratorCase_ == 3) {
declaratorCase_ = 0;
declarator_ = null;
}
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry ir_enum_entry = 4;</code>
*/
public boolean hasIrEnumEntry() {
return declaratorCase_ == 4;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry ir_enum_entry = 4;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry getIrEnumEntry() {
if (declaratorCase_ == 4) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry.getDefaultInstance();
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry ir_enum_entry = 4;</code>
*/
public Builder setIrEnumEntry(org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry value) {
if (value == null) {
throw new NullPointerException();
}
declarator_ = value;
declaratorCase_ = 4;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry ir_enum_entry = 4;</code>
*/
public Builder setIrEnumEntry(
org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry.Builder builderForValue) {
declarator_ = builderForValue.build();
declaratorCase_ = 4;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry ir_enum_entry = 4;</code>
*/
public Builder mergeIrEnumEntry(org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry value) {
if (declaratorCase_ == 4 &&
declarator_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry.getDefaultInstance()) {
declarator_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry.newBuilder((org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry) declarator_)
.mergeFrom(value).buildPartial();
} else {
declarator_ = value;
}
declaratorCase_ = 4;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrEnumEntry ir_enum_entry = 4;</code>
*/
public Builder clearIrEnumEntry() {
if (declaratorCase_ == 4) {
declaratorCase_ = 0;
declarator_ = null;
}
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrField ir_field = 5;</code>
*/
public boolean hasIrField() {
return declaratorCase_ == 5;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrField ir_field = 5;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrField getIrField() {
if (declaratorCase_ == 5) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrField) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrField.getDefaultInstance();
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrField ir_field = 5;</code>
*/
public Builder setIrField(org.jetbrains.kotlin.backend.common.serialization.proto.IrField value) {
if (value == null) {
throw new NullPointerException();
}
declarator_ = value;
declaratorCase_ = 5;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrField ir_field = 5;</code>
*/
public Builder setIrField(
org.jetbrains.kotlin.backend.common.serialization.proto.IrField.Builder builderForValue) {
declarator_ = builderForValue.build();
declaratorCase_ = 5;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrField ir_field = 5;</code>
*/
public Builder mergeIrField(org.jetbrains.kotlin.backend.common.serialization.proto.IrField value) {
if (declaratorCase_ == 5 &&
declarator_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrField.getDefaultInstance()) {
declarator_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrField.newBuilder((org.jetbrains.kotlin.backend.common.serialization.proto.IrField) declarator_)
.mergeFrom(value).buildPartial();
} else {
declarator_ = value;
}
declaratorCase_ = 5;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrField ir_field = 5;</code>
*/
public Builder clearIrField() {
if (declaratorCase_ == 5) {
declaratorCase_ = 0;
declarator_ = null;
}
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction ir_function = 6;</code>
*/
public boolean hasIrFunction() {
return declaratorCase_ == 6;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction ir_function = 6;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction getIrFunction() {
if (declaratorCase_ == 6) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction.getDefaultInstance();
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction ir_function = 6;</code>
*/
public Builder setIrFunction(org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction value) {
if (value == null) {
throw new NullPointerException();
}
declarator_ = value;
declaratorCase_ = 6;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction ir_function = 6;</code>
*/
public Builder setIrFunction(
org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction.Builder builderForValue) {
declarator_ = builderForValue.build();
declaratorCase_ = 6;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction ir_function = 6;</code>
*/
public Builder mergeIrFunction(org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction value) {
if (declaratorCase_ == 6 &&
declarator_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction.getDefaultInstance()) {
declarator_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction.newBuilder((org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction) declarator_)
.mergeFrom(value).buildPartial();
} else {
declarator_ = value;
}
declaratorCase_ = 6;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrFunction ir_function = 6;</code>
*/
public Builder clearIrFunction() {
if (declaratorCase_ == 6) {
declaratorCase_ = 0;
declarator_ = null;
}
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty ir_property = 7;</code>
*/
public boolean hasIrProperty() {
return declaratorCase_ == 7;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty ir_property = 7;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty getIrProperty() {
if (declaratorCase_ == 7) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty.getDefaultInstance();
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty ir_property = 7;</code>
*/
public Builder setIrProperty(org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty value) {
if (value == null) {
throw new NullPointerException();
}
declarator_ = value;
declaratorCase_ = 7;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty ir_property = 7;</code>
*/
public Builder setIrProperty(
org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty.Builder builderForValue) {
declarator_ = builderForValue.build();
declaratorCase_ = 7;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty ir_property = 7;</code>
*/
public Builder mergeIrProperty(org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty value) {
if (declaratorCase_ == 7 &&
declarator_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty.getDefaultInstance()) {
declarator_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty.newBuilder((org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty) declarator_)
.mergeFrom(value).buildPartial();
} else {
declarator_ = value;
}
declaratorCase_ = 7;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrProperty ir_property = 7;</code>
*/
public Builder clearIrProperty() {
if (declaratorCase_ == 7) {
declaratorCase_ = 0;
declarator_ = null;
}
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter ir_type_parameter = 8;</code>
*/
public boolean hasIrTypeParameter() {
return declaratorCase_ == 8;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter ir_type_parameter = 8;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter getIrTypeParameter() {
if (declaratorCase_ == 8) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter.getDefaultInstance();
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter ir_type_parameter = 8;</code>
*/
public Builder setIrTypeParameter(org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter value) {
if (value == null) {
throw new NullPointerException();
}
declarator_ = value;
declaratorCase_ = 8;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter ir_type_parameter = 8;</code>
*/
public Builder setIrTypeParameter(
org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter.Builder builderForValue) {
declarator_ = builderForValue.build();
declaratorCase_ = 8;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter ir_type_parameter = 8;</code>
*/
public Builder mergeIrTypeParameter(org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter value) {
if (declaratorCase_ == 8 &&
declarator_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter.getDefaultInstance()) {
declarator_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter.newBuilder((org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter) declarator_)
.mergeFrom(value).buildPartial();
} else {
declarator_ = value;
}
declaratorCase_ = 8;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeParameter ir_type_parameter = 8;</code>
*/
public Builder clearIrTypeParameter() {
if (declaratorCase_ == 8) {
declaratorCase_ = 0;
declarator_ = null;
}
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable ir_variable = 9;</code>
*/
public boolean hasIrVariable() {
return declaratorCase_ == 9;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable ir_variable = 9;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable getIrVariable() {
if (declaratorCase_ == 9) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable.getDefaultInstance();
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable ir_variable = 9;</code>
*/
public Builder setIrVariable(org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable value) {
if (value == null) {
throw new NullPointerException();
}
declarator_ = value;
declaratorCase_ = 9;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable ir_variable = 9;</code>
*/
public Builder setIrVariable(
org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable.Builder builderForValue) {
declarator_ = builderForValue.build();
declaratorCase_ = 9;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable ir_variable = 9;</code>
*/
public Builder mergeIrVariable(org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable value) {
if (declaratorCase_ == 9 &&
declarator_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable.getDefaultInstance()) {
declarator_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable.newBuilder((org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable) declarator_)
.mergeFrom(value).buildPartial();
} else {
declarator_ = value;
}
declaratorCase_ = 9;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrVariable ir_variable = 9;</code>
*/
public Builder clearIrVariable() {
if (declaratorCase_ == 9) {
declaratorCase_ = 0;
declarator_ = null;
}
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter ir_value_parameter = 10;</code>
*/
public boolean hasIrValueParameter() {
return declaratorCase_ == 10;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter ir_value_parameter = 10;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter getIrValueParameter() {
if (declaratorCase_ == 10) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter.getDefaultInstance();
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter ir_value_parameter = 10;</code>
*/
public Builder setIrValueParameter(org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter value) {
if (value == null) {
throw new NullPointerException();
}
declarator_ = value;
declaratorCase_ = 10;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter ir_value_parameter = 10;</code>
*/
public Builder setIrValueParameter(
org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter.Builder builderForValue) {
declarator_ = builderForValue.build();
declaratorCase_ = 10;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter ir_value_parameter = 10;</code>
*/
public Builder mergeIrValueParameter(org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter value) {
if (declaratorCase_ == 10 &&
declarator_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter.getDefaultInstance()) {
declarator_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter.newBuilder((org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter) declarator_)
.mergeFrom(value).buildPartial();
} else {
declarator_ = value;
}
declaratorCase_ = 10;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrValueParameter ir_value_parameter = 10;</code>
*/
public Builder clearIrValueParameter() {
if (declaratorCase_ == 10) {
declaratorCase_ = 0;
declarator_ = null;
}
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty ir_local_delegated_property = 11;</code>
*/
public boolean hasIrLocalDelegatedProperty() {
return declaratorCase_ == 11;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty ir_local_delegated_property = 11;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty getIrLocalDelegatedProperty() {
if (declaratorCase_ == 11) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty.getDefaultInstance();
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty ir_local_delegated_property = 11;</code>
*/
public Builder setIrLocalDelegatedProperty(org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty value) {
if (value == null) {
throw new NullPointerException();
}
declarator_ = value;
declaratorCase_ = 11;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty ir_local_delegated_property = 11;</code>
*/
public Builder setIrLocalDelegatedProperty(
org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty.Builder builderForValue) {
declarator_ = builderForValue.build();
declaratorCase_ = 11;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty ir_local_delegated_property = 11;</code>
*/
public Builder mergeIrLocalDelegatedProperty(org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty value) {
if (declaratorCase_ == 11 &&
declarator_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty.getDefaultInstance()) {
declarator_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty.newBuilder((org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty) declarator_)
.mergeFrom(value).buildPartial();
} else {
declarator_ = value;
}
declaratorCase_ = 11;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrLocalDelegatedProperty ir_local_delegated_property = 11;</code>
*/
public Builder clearIrLocalDelegatedProperty() {
if (declaratorCase_ == 11) {
declaratorCase_ = 0;
declarator_ = null;
}
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias ir_type_alias = 12;</code>
*/
public boolean hasIrTypeAlias() {
return declaratorCase_ == 12;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias ir_type_alias = 12;</code>
*/
public org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias getIrTypeAlias() {
if (declaratorCase_ == 12) {
return (org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias) declarator_;
}
return org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias.getDefaultInstance();
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias ir_type_alias = 12;</code>
*/
public Builder setIrTypeAlias(org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias value) {
if (value == null) {
throw new NullPointerException();
}
declarator_ = value;
declaratorCase_ = 12;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias ir_type_alias = 12;</code>
*/
public Builder setIrTypeAlias(
org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias.Builder builderForValue) {
declarator_ = builderForValue.build();
declaratorCase_ = 12;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias ir_type_alias = 12;</code>
*/
public Builder mergeIrTypeAlias(org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias value) {
if (declaratorCase_ == 12 &&
declarator_ != org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias.getDefaultInstance()) {
declarator_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias.newBuilder((org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias) declarator_)
.mergeFrom(value).buildPartial();
} else {
declarator_ = value;
}
declaratorCase_ = 12;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.backend.common.serialization.proto.IrTypeAlias ir_type_alias = 12;</code>
*/
public Builder clearIrTypeAlias() {
if (declaratorCase_ == 12) {
declaratorCase_ = 0;
declarator_ = null;
}
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration)
}
static {
defaultInstance = new IrDeclaration(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration)
}
|
package com.shivaot.forms.security;
import com.shivaot.forms.model.User;
import com.shivaot.forms.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
@Service
public class UserPrincipalDetailsService implements UserDetailsService {
@Autowired
private UserRepository userRepository;
public UserPrincipalDetailsService(UserRepository userRepository) {
this.userRepository = userRepository;
}
@Override
public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
User user = this.userRepository.findByUsername(s);
UserPrincipal userPrincipal = new UserPrincipal(user);
return userPrincipal;
}
}
|
/**
* Copyright 2009-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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 net.javacrumbs.jsonunit.assertj;
import net.javacrumbs.jsonunit.core.Configuration;
import net.javacrumbs.jsonunit.core.internal.Diff;
import net.javacrumbs.jsonunit.core.internal.Node;
import net.javacrumbs.jsonunit.core.internal.Path;
import org.assertj.core.api.MapAssert;
import org.assertj.core.internal.Failures;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Map;
import static org.assertj.core.error.ShouldContainValue.shouldContainValue;
import static org.assertj.core.error.ShouldNotContainValue.shouldNotContainValue;
class JsonMapAssert extends MapAssert<String, Object> {
private final Configuration configuration;
private final Path path;
private final Failures failures = Failures.instance();
JsonMapAssert(Map<String, Object> actual, Path path, Configuration configuration) {
super(actual);
this.path = path;
this.configuration = configuration;
usingComparator(new JsonComparator(configuration, path.asPrefix(), true));
}
@Override
@NotNull
public JsonMapAssert isEqualTo(@Nullable Object expected) {
return compare(expected, configuration);
}
@Override
@NotNull
public MapAssert<String, Object> containsValue(@Nullable Object expected) {
if (expected instanceof Node) {
if (!contains(expected)) {
throw failures.failure(info, shouldContainValue(actual, expected));
}
return this;
} else {
return super.containsValue(expected);
}
}
@Override
@NotNull
public MapAssert<String, Object> doesNotContainValue(@Nullable Object expected) {
if (expected instanceof Node) {
if (contains(expected)) {
throw failures.failure(info, shouldNotContainValue(actual, expected));
}
return this;
} else {
return super.doesNotContainValue(expected);
}
}
@Override
@NotNull
public JsonMapAssert isEqualToIgnoringGivenFields(@Nullable Object other, @NotNull String... propertiesOrFieldsToIgnore) {
return compare(other, configuration.whenIgnoringPaths(propertiesOrFieldsToIgnore));
}
@Override
@NotNull
public MapAssert<String, Object> isEqualToComparingOnlyGivenFields(@Nullable Object other, @NotNull String... propertiesOrFieldsUsedInComparison) {
throw unsupportedOperation();
}
@Override
@NotNull
public MapAssert<String, Object> isEqualToIgnoringNullFields(@Nullable Object other) {
throw unsupportedOperation();
}
@Override
@NotNull
public MapAssert<String, Object> isEqualToComparingFieldByField(@Nullable Object other) {
throw unsupportedOperation();
}
@Override
@NotNull
@Deprecated
public MapAssert<String, Object> isEqualToComparingFieldByFieldRecursively(@Nullable Object other) {
throw unsupportedOperation();
}
@NotNull
private UnsupportedOperationException unsupportedOperation() {
return new UnsupportedOperationException("Operation not supported for JSON documents");
}
@NotNull
private JsonMapAssert compare(@Nullable Object other, @NotNull Configuration configuration) {
describedAs(null);
Diff diff = Diff.create(other, actual, "fullJson", path, configuration);
diff.failIfDifferent();
return this;
}
private boolean contains(Object expected) {
return actual.entrySet().stream().anyMatch(kv -> Diff.create(expected, kv.getValue(), "fullJson", path.asPrefix(), configuration).similar());
}
}
|
package com.vikashkothary.life;
import com.vikashkothary.life.data.DataManager;
import com.vikashkothary.life.data.local.DatabaseHelper;
import com.vikashkothary.life.data.local.PreferencesHelper;
import com.vikashkothary.life.data.model.Ribot;
import com.vikashkothary.life.data.remote.RemindersService;
import com.vikashkothary.life.data.remote.RibotsService;
import com.vikashkothary.life.test.common.TestDataFactory;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentMatchers;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import java.util.Arrays;
import java.util.List;
import rx.Observable;
import rx.observers.TestSubscriber;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
/**
* This test class performs local unit tests without dependencies on the Android framework
* For testing methods in the DataManager follow this approach:
* 1. Stub mock helper classes that your method relies on. e.g. RetrofitServices or DatabaseHelper
* 2. Test the Observable using TestSubscriber
* 3. Optionally write a SEPARATE test that verifies that your method is calling the right helper
* using Mockito.verify()
*/
@RunWith(MockitoJUnitRunner.class)
public class DataManagerTest {
@Mock
DatabaseHelper mMockDatabaseHelper;
@Mock
PreferencesHelper mMockPreferencesHelper;
@Mock
RibotsService mMockRibotsService;
@Mock
RemindersService mMockRemindersService;
private DataManager mDataManager;
@Before
public void setUp() {
mDataManager = new DataManager(mMockRibotsService, mMockRemindersService, mMockPreferencesHelper,
mMockDatabaseHelper);
}
@Test
public void syncRibotsEmitsValues() {
List<Ribot> ribots = Arrays.asList(TestDataFactory.makeRibot("r1"),
TestDataFactory.makeRibot("r2"));
stubSyncRibotsHelperCalls(ribots);
TestSubscriber<Ribot> result = new TestSubscriber<>();
mDataManager.syncRibots().subscribe(result);
result.assertNoErrors();
result.assertReceivedOnNext(ribots);
}
@Test
public void syncRibotsCallsApiAndDatabase() {
List<Ribot> ribots = Arrays.asList(TestDataFactory.makeRibot("r1"),
TestDataFactory.makeRibot("r2"));
stubSyncRibotsHelperCalls(ribots);
mDataManager.syncRibots().subscribe();
// Verify right calls to helper methods
verify(mMockRibotsService).getRibots();
verify(mMockDatabaseHelper).setRibots(ribots);
}
@Test
public void syncRibotsDoesNotCallDatabaseWhenApiFails() {
when(mMockRibotsService.getRibots())
.thenReturn(Observable.<List<Ribot>>error(new RuntimeException()));
mDataManager.syncRibots().subscribe(new TestSubscriber<Ribot>());
// Verify right calls to helper methods
verify(mMockRibotsService).getRibots();
verify(mMockDatabaseHelper, never()).setRibots(ArgumentMatchers.<Ribot>anyList());
}
private void stubSyncRibotsHelperCalls(List<Ribot> ribots) {
// Stub calls to the ribot service and database helper.
when(mMockRibotsService.getRibots())
.thenReturn(Observable.just(ribots));
when(mMockDatabaseHelper.setRibots(ribots))
.thenReturn(Observable.from(ribots));
}
}
|
package com.ruoyi.common.bean.po;
public class SysJob extends SysJobKey {
/**
* 调用目标字符串 invoke_target
*/
private String invokeTarget;
/**
* cron执行表达式 cron_expression
*/
private String cronExpression;
/**
* 计划执行错误策略(1立即执行 2执行一次 3放弃执行) misfire_policy
*/
private String misfirePolicy;
/**
* 是否并发执行(0允许 1禁止) concurrent
*/
private String concurrent;
/**
* 状态(0正常 1暂停) status
*/
private String status;
/**
* 创建者 create_by
*/
private String createBy;
/**
* 创建时间 create_time
*/
private java.util.Date createTime;
/**
* 更新者 update_by
*/
private String updateBy;
/**
* 更新时间 update_time
*/
private java.util.Date updateTime;
/**
* 备注信息 remark
*/
private String remark;
/**
*
* @mbggenerated
*/
public SysJob(Long jobId, String jobName, String jobGroup, String invokeTarget, String cronExpression, String misfirePolicy, String concurrent, String status, String createBy, java.util.Date createTime, String updateBy, java.util.Date updateTime, String remark) {
super(jobId, jobName, jobGroup);
this.invokeTarget = invokeTarget;
this.cronExpression = cronExpression;
this.misfirePolicy = misfirePolicy;
this.concurrent = concurrent;
this.status = status;
this.createBy = createBy;
this.createTime = createTime;
this.updateBy = updateBy;
this.updateTime = updateTime;
this.remark = remark;
}
/**
*
* @mbggenerated
*/
public SysJob() {
super();
}
/**
* 调用目标字符串
* @return invoke_target 调用目标字符串
*/
public String getInvokeTarget() {
return invokeTarget;
}
/**
* 调用目标字符串
* @param invokeTarget 调用目标字符串
*/
public void setInvokeTarget(String invokeTarget) {
this.invokeTarget = invokeTarget == null ? null : invokeTarget.trim();
}
/**
* cron执行表达式
* @return cron_expression cron执行表达式
*/
public String getCronExpression() {
return cronExpression;
}
/**
* cron执行表达式
* @param cronExpression cron执行表达式
*/
public void setCronExpression(String cronExpression) {
this.cronExpression = cronExpression == null ? null : cronExpression.trim();
}
/**
* 计划执行错误策略(1立即执行 2执行一次 3放弃执行)
* @return misfire_policy 计划执行错误策略(1立即执行 2执行一次 3放弃执行)
*/
public String getMisfirePolicy() {
return misfirePolicy;
}
/**
* 计划执行错误策略(1立即执行 2执行一次 3放弃执行)
* @param misfirePolicy 计划执行错误策略(1立即执行 2执行一次 3放弃执行)
*/
public void setMisfirePolicy(String misfirePolicy) {
this.misfirePolicy = misfirePolicy == null ? null : misfirePolicy.trim();
}
/**
* 是否并发执行(0允许 1禁止)
* @return concurrent 是否并发执行(0允许 1禁止)
*/
public String getConcurrent() {
return concurrent;
}
/**
* 是否并发执行(0允许 1禁止)
* @param concurrent 是否并发执行(0允许 1禁止)
*/
public void setConcurrent(String concurrent) {
this.concurrent = concurrent == null ? null : concurrent.trim();
}
/**
* 状态(0正常 1暂停)
* @return status 状态(0正常 1暂停)
*/
public String getStatus() {
return status;
}
/**
* 状态(0正常 1暂停)
* @param status 状态(0正常 1暂停)
*/
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
/**
* 创建者
* @return create_by 创建者
*/
public String getCreateBy() {
return createBy;
}
/**
* 创建者
* @param createBy 创建者
*/
public void setCreateBy(String createBy) {
this.createBy = createBy == null ? null : createBy.trim();
}
/**
* 创建时间
* @return create_time 创建时间
*/
public java.util.Date getCreateTime() {
return createTime;
}
/**
* 创建时间
* @param createTime 创建时间
*/
public void setCreateTime(java.util.Date createTime) {
this.createTime = createTime;
}
/**
* 更新者
* @return update_by 更新者
*/
public String getUpdateBy() {
return updateBy;
}
/**
* 更新者
* @param updateBy 更新者
*/
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy == null ? null : updateBy.trim();
}
/**
* 更新时间
* @return update_time 更新时间
*/
public java.util.Date getUpdateTime() {
return updateTime;
}
/**
* 更新时间
* @param updateTime 更新时间
*/
public void setUpdateTime(java.util.Date updateTime) {
this.updateTime = updateTime;
}
/**
* 备注信息
* @return remark 备注信息
*/
public String getRemark() {
return remark;
}
/**
* 备注信息
* @param remark 备注信息
*/
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
}
|
package com.kk.taurus.avplayer.ui.fragment;
import android.content.res.Configuration;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
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 com.kk.taurus.avplayer.R;
import com.kk.taurus.avplayer.bean.VideoBean;
import com.kk.taurus.avplayer.ui.listplay.MultiListActivity;
import com.kk.taurus.avplayer.utils.DataUtils;
import com.kk.taurus.playerbase.entity.DataSource;
import com.kk.taurus.avplayer.adapter.ListAdapter;
import com.kk.taurus.avplayer.base.ISPayer;
import com.kk.taurus.avplayer.ui.DetailPlayActivity;
import com.kk.taurus.avplayer.play.ListPlayer;
import com.kk.taurus.playerbase.log.PLog;
public class VideoListFragment extends Fragment implements ListAdapter.OnListListener {
private static final String KEY_FRAG_INDEX = "frag_index";
private RecyclerView mRecycler;
private ListAdapter mListAdapter;
private int mFragIndex;
private boolean hasInit;
public static VideoListFragment create(int fragIndex){
VideoListFragment fragment = new VideoListFragment();
Bundle bundle = new Bundle();
bundle.putInt(KEY_FRAG_INDEX,fragIndex);
fragment.setArguments(bundle);
return fragment;
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_list, null);
mRecycler = root.findViewById(R.id.fragment_recycler);
return root;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Bundle bundle = getArguments();
if(bundle!=null){
mFragIndex = bundle.getInt(KEY_FRAG_INDEX);
}
mRecycler.setLayoutManager(new LinearLayoutManager(getContext(),LinearLayoutManager.VERTICAL,false));
mListAdapter = new ListAdapter(getContext(), mRecycler, DataUtils.getVideoList(mFragIndex*3, 3));
mListAdapter.setOnListListener(this);
mRecycler.setAdapter(mListAdapter);
hasInit = true;
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if(ListPlayer.get().getPlayPageIndex() != mFragIndex){
return;
}
if(newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
mRecycler.post(new Runnable() {
@Override
public void run() {
ListAdapter.VideoItemHolder currentHolder = mListAdapter.getCurrentHolder();
if(currentHolder!=null){
ListPlayer.get().setReceiverConfigState(getActivity(), ISPayer.RECEIVER_GROUP_CONFIG_LIST_STATE);
ListPlayer.get().attachContainer(currentHolder.layoutContainer, false);
}else{
PLog.e("VideoListFragment", "portrait itemHolder null");
}
}
});
}
}
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if(hasInit){
if(!getUserVisibleHint()){
mListAdapter.reset();
}
}
}
@Override
public void onTitleClick(ListAdapter.VideoItemHolder holder, VideoBean item, int position) {
((MultiListActivity)getActivity()).toDetail();
DetailPlayActivity.launch(getActivity(), mListAdapter.getPlayPosition()==position, item);
mListAdapter.reset();
}
@Override
public void playItem(ListAdapter.VideoItemHolder holder, VideoBean item, int position) {
ListPlayer.get().setReceiverConfigState(getActivity(), ISPayer.RECEIVER_GROUP_CONFIG_LIST_STATE);
ListPlayer.get().attachContainer(holder.layoutContainer);
ListPlayer.get().play(new DataSource(item.getPath()));
}
}
|
package mage.cards.r;
import java.util.UUID;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CounterUnlessPaysEffect;
import mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect;
import mage.abilities.keyword.AftermathAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.SplitCard;
import mage.constants.CardType;
import mage.constants.SpellAbilityType;
import mage.filter.common.FilterLandPermanent;
import mage.target.TargetPermanent;
import mage.target.TargetSpell;
/**
*
* @author fireshoes
*/
public final class ReduceRubble extends SplitCard {
public ReduceRubble(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, new CardType[]{CardType.SORCERY}, "{2}{U}", "{2}{R}", SpellAbilityType.SPLIT_AFTERMATH);
// Reduce
// Counter target spell unless its controller pays {3}.
getLeftHalfCard().getSpellAbility().addTarget(new TargetSpell());
getLeftHalfCard().getSpellAbility().addEffect(new CounterUnlessPaysEffect(new GenericManaCost(3)));
// Rubble
// Up to three target lands don't untap during their controller's next untap step.
((CardImpl) (getRightHalfCard())).addAbility(new AftermathAbility().setRuleAtTheTop(true));
Effect effect = new DontUntapInControllersNextUntapStepTargetEffect();
effect.setText("Up to three target lands don't untap during their controller's next untap step");
getRightHalfCard().getSpellAbility().addEffect(effect);
getRightHalfCard().getSpellAbility().addTarget(new TargetPermanent(0, 3, new FilterLandPermanent(), false));
}
public ReduceRubble(final ReduceRubble card) {
super(card);
}
@Override
public ReduceRubble copy() {
return new ReduceRubble(this);
}
}
|
/*
* Copyright (c) 2016 Torsten Krause, Markenwerk GmbH
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package net.markenwerk.utils.json.common.handler.replay.events;
import net.markenwerk.utils.json.handler.JsonHandler;
/**
* An {@link ArrayBeginJsonEvent} is a {@link JsonEvent} that represents a call
* to {@link JsonHandler#onArrayBegin()}.
*
* @author Torsten Krause (tk at markenwerk dot net)
* @since 1.0.0
*/
public final class ArrayBeginJsonEvent implements JsonEvent {
@Override
public JsonEventType getType() {
return JsonEventType.ARRAY_BEGIN;
}
@Override
public void onHandle(JsonHandler<?> handler) {
handler.onArrayBegin();
}
@Override
public int hashCode() {
return 25;
}
@Override
public boolean equals(Object object) {
return null != object && object instanceof ArrayBeginJsonEvent;
}
@Override
public String toString() {
return "ArrayBeginJsonEvent []";
}
}
|
/* Generated by camel build tools - do NOT edit this file! */
package org.apache.camel.component.aws2.eks;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.apache.camel.spi.EndpointUriFactory;
/**
* Generated by camel build tools - do NOT edit this file!
*/
public class EKS2EndpointUriFactory extends org.apache.camel.support.component.EndpointUriFactorySupport implements EndpointUriFactory {
private static final String BASE = ":label";
private static final Set<String> PROPERTY_NAMES;
private static final Set<String> SECRET_PROPERTY_NAMES;
static {
Set<String> props = new HashSet<>(13);
props.add("proxyProtocol");
props.add("secretKey");
props.add("synchronous");
props.add("label");
props.add("pojoRequest");
props.add("proxyHost");
props.add("trustAllCertificates");
props.add("proxyPort");
props.add("lazyStartProducer");
props.add("accessKey");
props.add("eksClient");
props.add("region");
props.add("operation");
PROPERTY_NAMES = Collections.unmodifiableSet(props);
Set<String> secretProps = new HashSet<>(2);
secretProps.add("secretKey");
secretProps.add("accessKey");
SECRET_PROPERTY_NAMES = Collections.unmodifiableSet(secretProps);
}
@Override
public boolean isEnabled(String scheme) {
return "aws2-eks".equals(scheme);
}
@Override
public String buildUri(String scheme, Map<String, Object> properties, boolean encode) throws URISyntaxException {
String syntax = scheme + BASE;
String uri = syntax;
Map<String, Object> copy = new HashMap<>(properties);
uri = buildPathParameter(syntax, uri, "label", null, true, copy);
uri = buildQueryParameters(uri, copy, encode);
return uri;
}
@Override
public Set<String> propertyNames() {
return PROPERTY_NAMES;
}
@Override
public Set<String> secretPropertyNames() {
return SECRET_PROPERTY_NAMES;
}
@Override
public boolean isLenientProperties() {
return false;
}
}
|
package wildlifetracker;
import org.junit.Rule;
import org.junit.Test;
import static org.junit.Assert.*;
public class RangerTest {
@Rule
public DatabaseRule database = new DatabaseRule();
@Test
public void ranger_instantiatesCorrectly_true() {
Ranger testranger = new Ranger("Cat", "2","2");
assertEquals(true, testranger instanceof Ranger);
}
@Test
public void getName_animalInstantiatesWithName_Henry() {
AnimalType testanimal = new AnimalType("cat", "canvore");
assertEquals("cat", testanimal.getName());
}
@Test
public void getType_animalInstantiatesWithType_String() {
AnimalType testanimal = new AnimalType("cat", "Canivore");
assertEquals("Canivore", testanimal.getType());
}
@Test
public void equals_returnsTrueIfNameAndType_true() {
AnimalType firstanimal = new AnimalType("cat", "carnovre");
AnimalType anotheranimal = new AnimalType("cat", "endegered");
assertTrue(firstanimal.equals(anotheranimal));
}
@Test
public void save_insertsObjectIntoDatabase_animal() {
AnimalType testanimal = new AnimalType("cat", "endegered");
testanimal.save();
assertTrue(AnimalType.all().get(0).equals(testanimal));
}
@Test
public void find_returnsanimalWithSameId_secondanimal() {
AnimalType firstanimal = new AnimalType("cat", "canvore");
firstanimal.save();
AnimalType secondanimal = new AnimalType("cow", "hebvore");
secondanimal.save();
assertEquals(AnimalType.find(secondanimal.getId()), secondanimal);
}
@Test
public void all_returnsAllInstancesOfAnimal_true() {
AnimalType firstanimal = new AnimalType("cow", "endegered");
firstanimal.save();
AnimalType secondanimal = new AnimalType("lion", "canvore");
secondanimal.save();
assertEquals(true, AnimalType.all().get(0).equals(firstanimal));
assertEquals(true, AnimalType.all().get(1).equals(secondanimal));
}
@Test
public void save_assignsIdToObject() {
AnimalType testanimal = new AnimalType("Henry", "henry@henry.com");
testanimal.save();
AnimalType savedanimal = AnimalType.all().get(0);
assertEquals(testanimal.getId(), savedanimal.getId());
}
}
|
package com.example.consumer2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ConsumerApplication {
public static void main(String[] args) {
SpringApplication.run(ConsumerApplication.class, args);
}
}
|
/*
* Copyright 2016 Mehmet Dilaveroğlu
*
* 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 co.dilaver.quoter.network;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;
public class QuoterRestClient {
public static final String QOD = "https://en.wikiquote.org/w/api.php?format=json&action=parse&page=Template:QoD&prop=text";
// public static final String POPULAR = "https://www.reddit.com/r/quotes.json";
public static final String POPULAR = "https://www.reddit.com/r/quotes/top.json";
private static final AsyncHttpClient client = new AsyncHttpClient();
public static void get(String url, RequestParams params, AsyncHttpResponseHandler responseHandler) {
client.get(url, params, responseHandler);
}
public static void post(String url, RequestParams params, AsyncHttpResponseHandler responseHandler) {
client.post(url, params, responseHandler);
}
}
|
package ai.labs.expressions.value;
import ai.labs.expressions.Expression;
/**
* @author ginccc
*/
public class AnyValue extends Expression {
public AnyValue() {
this.expressionName = "*";
}
}
|
package info.fetter.rrdclient.util;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import org.apache.log4j.Logger;
/*
* Copyright 2014 Didier Fetter
*
* 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.
*
*/
/**
*
* Abstract class used to mimic a real RRDTool server.
* Must be derived to respond to the different types of request.
*
* @author Didier Fetter
*
*/
public abstract class PseudoServer implements Runnable {
protected static Logger logger = Logger.getLogger(PseudoServer.class);
protected int port;
protected ServerSocketChannel serverChannel;
private Executor threadPool = Executors.newCachedThreadPool();
public PseudoServer(int port) throws IOException {
logger.debug("Creating new server instance");
this.port = port;
serverChannel = ServerSocketChannel.open();
serverChannel.socket().bind(new InetSocketAddress(port));
Thread acceptThread = new Thread(this,"accept-thread:port:"+port);
acceptThread.start();
}
public void run() {
while(true) {
try {
acceptLoop();
} catch (IOException e) {
if(logger.isDebugEnabled())
e.printStackTrace();
}
}
}
private void acceptLoop() throws IOException {
SocketChannel clientChannel = serverChannel.accept();
logger.debug("Connection established : " + clientChannel);
threadPool.execute(new Responder(clientChannel));
}
private class Responder implements Runnable {
private SocketChannel clientChannel;
public Responder(SocketChannel clientChannel) {
this.clientChannel = clientChannel;
}
public void run() {
try {
String request;
BufferedReader in = new BufferedReader(new InputStreamReader(clientChannel.socket().getInputStream()));
while((request = in.readLine()) != null) {
logger.debug("Received request : " + request);
ByteBuffer response = respond(request);
clientChannel.write(response);
logger.debug("Finished sending response : " + response.limit() + " bytes");
}
} catch(IOException e) {
logger.error(e.getMessage());
}
}
}
/**
* Used by subclasses. The request may be parsed before returning the response in the ByteBuffer.
*
* @param request The request received on the socket channel
* @return ByteBuffer containing the result of the command
*/
protected abstract ByteBuffer respond(String request);
}
|
/*
* 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.aliyuncs.domain.model.v20180129;
import com.aliyuncs.RpcAcsRequest;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.domain.Endpoint;
/**
* @author auto create
* @version
*/
public class SaveSingleTaskForModifyingDSRecordRequest extends RpcAcsRequest<SaveSingleTaskForModifyingDSRecordResponse> {
private Integer keyTag;
private String domainName;
private String userClientIp;
private Integer digestType;
private String digest;
private String lang;
private Integer algorithm;
public SaveSingleTaskForModifyingDSRecordRequest() {
super("Domain", "2018-01-29", "SaveSingleTaskForModifyingDSRecord", "domain");
setMethod(MethodType.POST);
try {
com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointMap").set(this, Endpoint.endpointMap);
com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointRegional").set(this, Endpoint.endpointRegionalType);
} catch (Exception e) {}
}
public Integer getKeyTag() {
return this.keyTag;
}
public void setKeyTag(Integer keyTag) {
this.keyTag = keyTag;
if(keyTag != null){
putQueryParameter("KeyTag", keyTag.toString());
}
}
public String getDomainName() {
return this.domainName;
}
public void setDomainName(String domainName) {
this.domainName = domainName;
if(domainName != null){
putQueryParameter("DomainName", domainName);
}
}
public String getUserClientIp() {
return this.userClientIp;
}
public void setUserClientIp(String userClientIp) {
this.userClientIp = userClientIp;
if(userClientIp != null){
putQueryParameter("UserClientIp", userClientIp);
}
}
public Integer getDigestType() {
return this.digestType;
}
public void setDigestType(Integer digestType) {
this.digestType = digestType;
if(digestType != null){
putQueryParameter("DigestType", digestType.toString());
}
}
public String getDigest() {
return this.digest;
}
public void setDigest(String digest) {
this.digest = digest;
if(digest != null){
putQueryParameter("Digest", digest);
}
}
public String getLang() {
return this.lang;
}
public void setLang(String lang) {
this.lang = lang;
if(lang != null){
putQueryParameter("Lang", lang);
}
}
public Integer getAlgorithm() {
return this.algorithm;
}
public void setAlgorithm(Integer algorithm) {
this.algorithm = algorithm;
if(algorithm != null){
putQueryParameter("Algorithm", algorithm.toString());
}
}
@Override
public Class<SaveSingleTaskForModifyingDSRecordResponse> getResponseClass() {
return SaveSingleTaskForModifyingDSRecordResponse.class;
}
}
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.arrow.consumers;
import java.io.IOException;
import org.apache.arrow.util.AutoCloseables;
import org.apache.arrow.vector.FieldVector;
import org.apache.arrow.vector.complex.StructVector;
import org.apache.avro.io.Decoder;
/**
* Consumer which consume nested record type values from avro decoder.
* Write the data to {@link org.apache.arrow.vector.complex.StructVector}.
*/
public class AvroStructConsumer extends BaseAvroConsumer<StructVector> {
private final Consumer[] delegates;
/**
* Instantiate a AvroStructConsumer.
*/
public AvroStructConsumer(StructVector vector, Consumer[] delegates) {
super(vector);
this.delegates = delegates;
}
@Override
public void consume(Decoder decoder) throws IOException {
ensureInnerVectorCapacity(currentIndex + 1);
for (int i = 0; i < delegates.length; i++) {
delegates[i].consume(decoder);
}
vector.setIndexDefined(currentIndex);
currentIndex++;
}
@Override
public void close() throws Exception {
super.close();
AutoCloseables.close(delegates);
}
@Override
public boolean resetValueVector(StructVector vector) {
for (int i = 0; i < delegates.length; i++) {
delegates[i].resetValueVector(vector.getChildrenFromFields().get(i));
}
return super.resetValueVector(vector);
}
void ensureInnerVectorCapacity(long targetCapacity) {
for (FieldVector v : vector.getChildrenFromFields()) {
while (v.getValueCapacity() < targetCapacity) {
v.reAlloc();
}
}
}
}
|
package org.knowm.xchange.kuna.service;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;
import org.knowm.xchange.Exchange;
import org.knowm.xchange.currency.Currency;
import org.knowm.xchange.dto.account.AccountInfo;
import org.knowm.xchange.dto.account.FundingRecord;
import org.knowm.xchange.exceptions.NotYetImplementedForExchangeException;
import org.knowm.xchange.service.account.AccountService;
import org.knowm.xchange.service.trade.params.TradeHistoryParams;
import org.knowm.xchange.service.trade.params.WithdrawFundsParams;
/** @author Dat Bui */
public class KunaAccountService extends KunaAccountServiceRaw implements AccountService {
/**
* Constructor.
*
* @param exchange
*/
public KunaAccountService(Exchange exchange) {
super(exchange);
}
@Override
public AccountInfo getAccountInfo() throws IOException {
throw new NotYetImplementedForExchangeException();
}
@Override
public String withdrawFunds(Currency currency, BigDecimal amount, String address)
throws IOException {
throw new NotYetImplementedForExchangeException();
}
@Override
public String withdrawFunds(WithdrawFundsParams params) throws IOException {
throw new NotYetImplementedForExchangeException();
}
@Override
public String requestDepositAddress(Currency currency, String... args) throws IOException {
throw new NotYetImplementedForExchangeException();
}
@Override
public TradeHistoryParams createFundingHistoryParams() {
throw new NotYetImplementedForExchangeException();
}
@Override
public List<FundingRecord> getFundingHistory(TradeHistoryParams params) throws IOException {
throw new NotYetImplementedForExchangeException();
}
}
|
/*
* Copyright 2019 The Closure Compiler 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.google.javascript.jscomp.disambiguate;
import static com.google.common.collect.ImmutableMap.toImmutableMap;
import static java.util.function.Function.identity;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSetMultimap;
import com.google.javascript.rhino.Node;
import java.util.Map;
import java.util.Objects;
import java.util.function.Consumer;
/** Applies renaming to property use sites following cluster computation. */
final class UseSiteRenamer {
private static final String INVALIDATED_NAME_VALUE = "<INVALIDATED>";
private final Consumer<Node> mutationCb;
private final ImmutableSetMultimap.Builder<String, String> renamingIndex =
ImmutableSetMultimap.builder();
UseSiteRenamer(Consumer<Node> mutationCb) {
this.mutationCb = mutationCb;
}
/**
* Renames all references to {@code prop}.
*
* <p>If {@code prop} is invalid or should otherwise not be renamed, the AST will not be changed.
*/
void renameUses(PropertyClustering prop) {
if (prop.isInvalidated()) {
this.renamingIndex.put(prop.getName(), INVALIDATED_NAME_VALUE);
return;
}
ImmutableMap<ColorGraphNode, String> clusterNames = createAllClusterNames(prop);
if (clusterNames.size() <= 1) {
/**
* Don't bother renaming clusters with a single element. Renaming won't actaully disambiguate
* anything in this case, so skip the work.
*/
this.renamingIndex.put(prop.getName(), prop.getName());
return;
}
this.renamingIndex.putAll(prop.getName(), clusterNames.values());
for (Map.Entry<Node, ColorGraphNode> usage : prop.getUseSites().entrySet()) {
Node site = usage.getKey();
ColorGraphNode flatRep = prop.getClusters().find(usage.getValue());
String newName = clusterNames.get(flatRep);
if (!Objects.equals(newName, site.getString())) {
site.setString(newName);
this.mutationCb.accept(site);
}
}
}
ImmutableSetMultimap<String, String> getRenamingIndex() {
return this.renamingIndex.build();
}
/**
* Creates a unique name for each cluster in {@code prop} and maps it to the cluster
* representative.
*/
private static ImmutableMap<ColorGraphNode, String> createAllClusterNames(
PropertyClustering prop) {
return prop.getClusters().allRepresentatives().stream()
.collect(toImmutableMap(identity(), (r) -> createClusterName(prop, r)));
}
private static String createClusterName(PropertyClustering prop, ColorGraphNode rep) {
if (Objects.equals(prop.getOriginalNameClusterRep(), rep)) {
return prop.getName();
}
return "JSC$" + rep.getIndex() + "_" + prop.getName();
}
}
|
package com.m3.ouath.service.data;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import com.m3.common.core.M3CoreHelper;
import com.m3.oauth.common.Client;
public class M3OAuthClient implements Client {
private static final long serialVersionUID = 1L;
private final String _id;
private final String _secret;
private final String _name;
private final String _redirect_url;
private final Confidentiality _confidentiality;
private final UserAgent _uagent;
private String _description;
private String _uagentdetail;
private final ConcurrentMap<String, List<ClientScope>> _scopes = new ConcurrentHashMap<String, List<ClientScope>>();
public M3OAuthClient(String thename, String theid, String thesecret, String redirect_url, String client_conf, String user_agent) {
if (client_conf == null || client_conf.length() < 6) {
throw new IllegalArgumentException("Invalid client confidentiality " + client_conf);
}
try {
_confidentiality = Confidentiality.valueOf(client_conf);
} catch (Throwable t) {
throw new IllegalArgumentException("Invalid client confidentiality " + client_conf, t);
}
if (user_agent == null || user_agent.length() < 5) {
throw new IllegalArgumentException("Invalid user agent " + user_agent);
}
try {
_uagent = UserAgent.valueOf(user_agent);
} catch (Throwable t) {
throw new IllegalArgumentException("Invalid user agent " + user_agent, t);
}
_id = theid;
_name = thename;
_secret = thesecret;
_redirect_url = redirect_url;
}
@Override
public String identifier() { return _id; }
@Override
public String secret() { return _secret; }
@Override
public String name() { return _name; }
@Override
public String description() { return _description; }
public void setDescription(String value) { _description = value; }
@Override
public String redirecturl() { return _redirect_url; }
@Override
public Confidentiality confidentiality() { return _confidentiality; }
@Override
public UserAgent userAgent() { return _uagent; }
public String userAgentDetail() { return _uagentdetail; }
public void userAgentDetail(String value) { _uagentdetail = value; }
@Override
public Map<String, List<ClientScope>> allscopes() {
Map<String, List<ClientScope>> retval = new HashMap<String, List<ClientScope>>();
_scopes.forEach((key, value) -> {
retval.put(key, Collections.unmodifiableList(value));
});
Map<String, List<ClientScope>> retval2 = Collections.unmodifiableMap(retval);
retval.clear();
return retval2;
}
@Override
public List<ClientScope> servicescopes(String aservice) {
return Collections.unmodifiableList(_scopes.get(aservice));
}
@Override
public List<ClientScope> matchingscopes(String aservice, Set<String> requestscopes) {
List<ClientScope> retval = Collections.unmodifiableList(_scopes.get(aservice));
for (ListIterator<ClientScope> it = retval.listIterator(); it.hasNext(); ) {
ClientScope scp = it.next();
for (String reqscp : requestscopes) {
if (!scp.scope.startsWith(reqscp)) {
it.remove();
}
}
}
return retval;
}
public ClientScope addScope(String aservice, String ascope) {
ClientScope scp = new ClientScope(aservice, ascope);
List<ClientScope> currscopes = _scopes.get(aservice);
if (currscopes == null) {
currscopes = new ArrayList<ClientScope>();
synchronized (_scopes) {
_scopes.put(aservice, currscopes);
}
}
synchronized (currscopes) {
currscopes.add(scp);
}
return scp;
}
String scopesAsString() {
if (_scopes.isEmpty()) return null;
synchronized (_scopes) {
StringBuilder sb = new StringBuilder();
boolean firsttime1 = true;
for (Map.Entry<String, List<ClientScope>> me : _scopes.entrySet()) {
if (firsttime1) firsttime1 = false;
else sb.append(",");
sb.append(me.getKey());
sb.append(":");
boolean firsttime2 = true;
for (ClientScope cs : me.getValue()) {
if (firsttime2) firsttime2 = false;
else sb.append(" ");
sb.append(cs.scope);
}
}
return sb.toString();
}
}
void setScopesFromString(String scopesstr) {
if (scopesstr != null && !scopesstr.isBlank()) {
_scopes.values().forEach(lscp -> lscp.clear());
_scopes.clear();
M3CoreHelper.convertDelimitedStringToMap(scopesstr, ",", ":", _scopes, this::parseCreateListScopes);
}
}
@Override
public int compareTo(Client o) {
return _id.compareTo(o.identifier());
}
public void setAdditionalInformation(String string) {
// TODO Auto-generated method stub
}
private List<ClientScope> parseCreateListScopes(String service, String delimscopestr) {
List<ClientScope> cltscopes = new ArrayList<ClientScope>();
M3CoreHelper.convertDelimitedStringToList(delimscopestr, " ", service, cltscopes, this::parseCreateClientScope);
return cltscopes;
}
private ClientScope parseCreateClientScope(String service, String scope) {
return new ClientScope(service, scope);
}
}
|
/*
* Copyright 2021 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
package io.flutter.editor;
import com.intellij.codeInsight.daemon.GutterName;
import com.intellij.codeInsight.daemon.LineMarkerInfo;
import com.intellij.codeInsight.daemon.LineMarkerProviderDescriptor;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.markup.GutterIconRenderer;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileVisitor;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.intellij.psi.impl.source.tree.AstBufferUtil;
import com.jetbrains.lang.dart.DartTokenTypes;
import com.jetbrains.lang.dart.psi.*;
import com.jetbrains.lang.dart.psi.impl.DartCallExpressionImpl;
import com.jetbrains.lang.dart.util.DartPsiImplUtil;
import com.jetbrains.lang.dart.util.DartResolveUtil;
import gnu.trove.THashSet;
import info.debatty.java.stringsimilarity.JaroWinkler;
import io.flutter.FlutterBundle;
import io.flutter.sdk.FlutterSdk;
import io.flutter.sdk.FlutterSdkUtil;
import io.flutter.utils.IconPreviewGenerator;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.VisibleForTesting;
import javax.swing.*;
import java.util.*;
import static io.flutter.dart.DartPsiUtil.*;
// Style note: Normally we put control flow changing statements on a separate line in a block.
// When working with PSI elements nearly everything can return null. There are a lot of null checks
// that could return null, but they seldom trigger, so the return is on the same line as the if statement.
public class FlutterIconLineMarkerProvider extends LineMarkerProviderDescriptor {
public static final Map<String, Set<String>> KnownPaths = new HashMap<>();
private static final Map<String, String> BuiltInPaths = new HashMap<>();
private static final Logger LOG = Logger.getInstance(FlutterIconLineMarkerProvider.class);
private static final String MaterialRelativeAssetPath = "/bin/cache/artifacts/material_fonts/MaterialIcons-Regular.otf";
private static final String MaterialRelativeIconsPath = "/packages/flutter/lib/src/material/icons.dart";
private static final String CupertinoRelativeAssetPath = "/assets/CupertinoIcons.ttf";
private static final String CupertinoRelativeIconsPath = "/packages/flutter/lib/src/cupertino/icons.dart";
static {
initialize();
}
public static void initialize() {
KnownPaths.clear();
KnownPaths.put("Icons", new THashSet<>(Collections.singleton("packages/flutter/lib/src/material")));
KnownPaths.put("IconData", new THashSet<>(Collections.singleton("packages/flutter/lib/src/widgets")));
KnownPaths.put("CupertinoIcons", new THashSet<>(Collections.singleton("packages/flutter/lib/src/cupertino")));
BuiltInPaths.clear();
BuiltInPaths.put("Icons", MaterialRelativeIconsPath);
BuiltInPaths.put("IconData", MaterialRelativeIconsPath);
BuiltInPaths.put("CupertinoIcons", CupertinoRelativeIconsPath);
}
@Nullable("null means disabled")
@Override
public @GutterName String getName() {
return FlutterBundle.message("flutter.icon.preview.title");
}
@Override
@Nullable
public LineMarkerInfo<?> getLineMarkerInfo(@NotNull PsiElement element) {
final FlutterSdk sdk = FlutterSdk.getFlutterSdk(element.getProject());
return sdk == null ? null : getLineMarkerInfo(element, sdk);
}
@VisibleForTesting
@Nullable
LineMarkerInfo<?> getLineMarkerInfo(@NotNull PsiElement element, @NotNull FlutterSdk sdk) {
if ((element.getNode() != null ? element.getNode().getElementType() : null) != DartTokenTypes.IDENTIFIER) return null;
final String name = element.getText();
assert name != null;
if (!KnownPaths.containsKey(name)) return null;
final PsiElement refExpr = topmostReferenceExpression(element);
if (refExpr == null) return null;
PsiElement parent = refExpr.getParent();
if (parent == null) return null;
String knownPath = null;
assert ApplicationManager.getApplication() != null;
if (!ApplicationManager.getApplication().isUnitTestMode()) {
// Resolve the class reference and check that it is one of the known, cached classes.
final PsiElement symbol = "IconData".equals(name) ? refExpr : refExpr.getFirstChild();
if (!(symbol instanceof DartReference)) return null;
final PsiElement result = ((DartReference)symbol).resolve();
if (result == null) return null;
assert result.getContainingFile() != null;
final List<VirtualFile> library = DartResolveUtil.findLibrary(result.getContainingFile());
for (VirtualFile file : library) {
assert file != null;
final VirtualFile dir = file.getParent();
assert dir != null;
if (dir.isInLocalFileSystem()) {
final String path = dir.getPath();
String trimmedPath = path;
if (!path.endsWith("lib")) {
final int index = path.indexOf("lib");
if (index >= 0) {
trimmedPath = path.substring(0, index + 3);
}
}
final Set<String> knownPaths = KnownPaths.get(name);
assert knownPaths != null; // Due to guard clause above.
if (knownPaths.contains(path) || knownPaths.contains(trimmedPath)) {
knownPath = file.getPath();
break;
}
for (String aPath : knownPaths) {
assert aPath != null;
if (path.endsWith(aPath) || aPath.contains(path) || trimmedPath.endsWith(aPath) || aPath.contains(trimmedPath)) {
knownPath = file.getPath();
break;
}
}
}
}
if (knownPath == null) return null;
}
final ASTNode parentNode = parent.getNode();
assert parentNode != null;
if (parentNode.getElementType() == DartTokenTypes.CALL_EXPRESSION) {
// Check font family and package
final DartArguments arguments = DartPsiImplUtil.getArguments((DartCallExpression)parent);
if (arguments == null) return null;
final String family = getValueOfNamedArgument(arguments, "fontFamily");
final PsiElement fontPackage = getNamedArgumentExpression(arguments, "fontPackage");
final String argument = getValueOfPositionalArgument(arguments, 0);
if (argument == null) return null;
final Icon icon = getIconFromPackage(fontPackage, family, argument, element.getProject(), sdk);
if (icon != null) {
return createLineMarker(element, icon);
}
}
else if (parentNode.getElementType() == DartTokenTypes.SIMPLE_TYPE) {
parent = getNewExprFromType(parent);
if (parent == null) return null;
final DartArguments arguments = DartPsiImplUtil.getArguments((DartNewExpression)parent);
if (arguments == null) return null;
final String family = getValueOfNamedArgument(arguments, "fontFamily");
final PsiElement fontPackage = getNamedArgumentExpression(arguments, "fontPackage");
final String argument = getValueOfPositionalArgument(arguments, 0);
if (argument == null) return null;
final Icon icon = getIconFromPackage(fontPackage, family, argument, element.getProject(), sdk);
if (icon != null) {
return createLineMarker(element, icon);
}
}
else {
final PsiElement idNode = refExpr.getFirstChild();
if (idNode == null) return null;
if (name.equals(idNode.getText())) {
final PsiElement selectorNode = refExpr.getLastChild();
if (selectorNode == null) return null;
assert selectorNode.getNode() != null;
final String selector = AstBufferUtil.getTextSkippingWhitespaceComments(selectorNode.getNode());
final Icon icon;
if (name.equals("Icons")) {
final IconInfo iconDef = findStandardDefinition(name, selector, element.getProject(), knownPath, sdk);
if (iconDef == null) return null;
// <flutter-sdk>/bin/cache/artifacts/material_fonts/MaterialIcons-Regular.otf
icon = findStandardIconFromDef(name, iconDef, sdk.getHomePath() + MaterialRelativeAssetPath);
}
else if (name.equals("CupertinoIcons")) {
final IconInfo iconDef = findStandardDefinition(name, selector, element.getProject(), knownPath, sdk);
if (iconDef == null) return null;
final String path = FlutterSdkUtil.getPathToCupertinoIconsPackage(element.getProject());
// <pub_cache>/hosted/pub.dartlang.org/cupertino_icons-v.m.n/assets/CupertinoIcons.ttf
icon = findStandardIconFromDef(name, iconDef, path + CupertinoRelativeAssetPath);
}
else {
// Note: I want to keep this code until I'm sure we won't use pubspec.yaml.
//final DartComponent result = DartResolveUtil.findReferenceAndComponentTarget(idNode);
//if (result != null) {
// final VirtualFile map = IconPreviewGenerator.findAssetMapFor(result);
// if (map == null) {
// return null;
// }
// final FileViewProvider provider = PsiManager.getInstance(result.getProject()).findViewProvider(map);
// if (provider != null) {
// final PsiFile psi = provider.getPsi(YAMLLanguage.INSTANCE);
// final YamlAssetMapVisitor visitor = new YamlAssetMapVisitor();
// psi.accept(visitor);
// final HashMap<String, String> assetMap = visitor.assetMap;
// }
//}
final PsiElement iconElement = refExpr.getLastChild();
if (iconElement == null) return null; // TODO check for instance creation with codepoint
final String iconName = iconElement.getText();
assert iconName != null;
assert knownPath != null;
final IconInfo iconDef = findDefinition(name, iconName, element.getProject(), knownPath);
if (iconDef == null) return null;
icon = findIconFromDef(name, iconDef, knownPath);
}
if (icon != null) {
return createLineMarker(element, icon);
}
}
}
return null;
}
@Nullable
private IconInfo findStandardDefinition(@NotNull String className, @NotNull String iconName, @NotNull Project project, @Nullable String path, @NotNull FlutterSdk sdk) {
if (path != null) {
return findDefinition(className, iconName, project, path);
}
assert Objects.requireNonNull(ApplicationManager.getApplication()).isUnitTestMode();
return findDefinition(className, iconName, project, sdk.getHomePath() + BuiltInPaths.get(className));
}
@Nullable
private Icon findStandardIconFromDef(@NotNull String name, @NotNull IconInfo iconDef, @NotNull String path) {
assert LocalFileSystem.getInstance() != null;
final VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByPath(path);
if (virtualFile == null) return null;
final IconPreviewGenerator generator = new IconPreviewGenerator(virtualFile.getPath());
return generator.convert(iconDef.codepoint);
}
// Note: package flutter_icons is not currently supported because it takes forever to analyze it.
@Nullable
private Icon getIconFromPackage(@Nullable PsiElement aPackage, @Nullable String family, @NotNull String argument, @NotNull Project project, @NotNull FlutterSdk sdk) {
final int code;
try {
code = parseLiteralNumber(argument);
}
catch (NumberFormatException ignored) {
return null;
}
family = family == null ? "MaterialIcons" : family;
if (aPackage == null) {
// Looking for IconData with no package -- package specification not currently supported.
final String relativeAssetPath = family.equals("MaterialIcons") ? MaterialRelativeAssetPath : CupertinoRelativeAssetPath;
// TODO Base path is wrong for cupertino -- is there a test for this branch (IconData with cupertino family)?
final IconPreviewGenerator generator = new IconPreviewGenerator(sdk.getHomePath() + relativeAssetPath);
return generator.convert(code);
}
return null;
}
@Nullable
private LineMarkerInfo<PsiElement> createLineMarker(@Nullable PsiElement element, @NotNull Icon icon) {
if (element == null) return null;
assert element.getTextRange() != null;
//noinspection MissingRecentApi
return new LineMarkerInfo<>(element, element.getTextRange(), icon, null, null,
GutterIconRenderer.Alignment.LEFT, () -> "");
}
@Nullable
private IconInfo findDefinition(@NotNull String className, @NotNull String iconName, @NotNull Project project, @NotNull String path) {
assert LocalFileSystem.getInstance() != null;
final VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByPath(path);
if (virtualFile == null) return null;
final PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
if (psiFile == null) {
return null;
}
final IconInfoVisitor visitor = new IconInfoVisitor(iconName);
psiFile.accept(visitor);
return visitor.info;
}
@Nullable
private Icon findIconFromDef(@NotNull String iconClassName, @NotNull IconInfo iconDef, @NotNull String path) {
assert LocalFileSystem.getInstance() != null;
final VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByPath(path);
if (virtualFile == null) return null;
VirtualFile parent = virtualFile;
while (parent != null && !parent.getName().equals("lib")) {
parent = parent.getParent();
}
if (parent != null) parent = parent.getParent(); // We have to search the entire project.
if (parent == null) {
return null;
}
final List<VirtualFile> ttfFiles = new ArrayList<>();
VfsUtilCore.visitChildrenRecursively(parent, new VirtualFileVisitor<Void>() {
@Override
public boolean visitFile(@NotNull VirtualFile file) {
final String ext = file.getExtension();
if ("ttf".equals(ext)) {
ttfFiles.add(file);
return false;
}
else {
return super.visitFile(file);
}
}
});
double match = -1;
final String family = iconDef.familyName;
VirtualFile bestFileMatch = null;
if (family != null) {
for (VirtualFile file : ttfFiles) {
assert file != null;
final double n = findPattern(file.getNameWithoutExtension(), family);
if (n > match) {
match = n;
bestFileMatch = file;
}
}
} // If the family is null we could do a search for font files named similar to the package.
if (bestFileMatch != null) {
final IconPreviewGenerator generator = new IconPreviewGenerator(bestFileMatch.getPath());
final Icon icon = generator.convert(iconDef.codepoint);
if (icon != null) return icon;
}
for (VirtualFile file : ttfFiles) {
assert file != null;
final IconPreviewGenerator generator = new IconPreviewGenerator(file.getPath());
final Icon icon = generator.convert(iconDef.codepoint);
if (icon != null) return icon;
}
return null;
}
public double findPattern(@NotNull String t, @NotNull String p) {
// This is from https://github.com/tdebatty/java-string-similarity
// It's MIT license file is: https://github.com/tdebatty/java-string-similarity/blob/master/LICENSE.md
final JaroWinkler jw = new JaroWinkler();
return jw.similarity(t, p);
}
static class IconInfo {
final @NotNull String iconName;
final @NotNull String className;
final @Nullable String familyName;
final @NotNull String codepoint;
IconInfo(@NotNull String className, @NotNull String iconName, @Nullable String familyName, @NotNull String codepoint) {
this.className = className;
this.iconName = iconName;
this.familyName = familyName;
this.codepoint = codepoint;
}
}
static class IconInfoVisitor extends DartRecursiveVisitor {
final HashMap<String, String> staticVars = new HashMap<>();
final String iconName;
IconInfo info;
IconInfoVisitor(String iconName) {
this.iconName = iconName;
}
@Nullable
private String findFamilyName(@Nullable PsiElement expression, @Nullable DartType type) {
if (expression == null && type != null) {
LOG.info("Check superclass constructor for font family: " + type.getName());
return null; // TODO Check superclass of <type> for a constructor that includes the family.
}
else if (expression instanceof DartStringLiteralExpression) {
//noinspection ConstantConditions
final Pair<String, TextRange> pair = DartPsiImplUtil.getUnquotedDartStringAndItsRange(expression.getText().trim());
return pair.first;
}
else {
if (expression != null) {
assert expression.getNode() != null;
if (expression.getNode().getElementType() == DartTokenTypes.REFERENCE_EXPRESSION) {
assert expression.getText() != null;
final Pair<String, TextRange> pair = DartPsiImplUtil.getUnquotedDartStringAndItsRange(expression.getText().trim());
final String varName = pair.first;
return staticVars.get(varName);
}
}
}
return null;
}
@Override
public void visitVarAccessDeclaration(@NotNull DartVarAccessDeclaration o) {
if (Objects.requireNonNull(o.getComponentName().getText()).trim().equals(iconName)) {
assert o.getParent() != null;
final DartVarInit init = (DartVarInit)o.getParent().getLastChild();
assert init != null;
final DartExpression expression = init.getExpression();
String className = null;
DartArguments arguments = null;
DartType type = null;
if (expression instanceof DartNewExpression) {
final DartNewExpression newExpr = (DartNewExpression)expression;
type = newExpr.getType();
if (type != null) {
className = type.getText();
arguments = newExpr.getArguments();
}
}
else if (expression instanceof DartCallExpression) {
// The Dart parser sometimes generates a call expression where we expect a new expression.
final DartCallExpressionImpl callExpr = (DartCallExpressionImpl)expression;
arguments = callExpr.getArguments();
className = callExpr.getExpression().getText();
}
if (KnownPaths.containsKey(className)) {
if (arguments != null) {
final DartArgumentList argumentList = arguments.getArgumentList();
if (argumentList != null) {
final List<DartExpression> list = argumentList.getExpressionList();
if (!list.isEmpty()) {
final DartExpression dartExpression = list.get(0);
assert dartExpression != null;
final String codepoint = dartExpression.getText();
final PsiElement family = getNamedArgumentExpression(arguments, "fontFamily");
final String familyName = findFamilyName(family, type);
assert className != null;
assert codepoint != null;
info = new IconInfo(className, iconName, familyName, codepoint);
}
}
}
}
}
else {
final PsiElement firstChild = o.getFirstChild();
assert firstChild != null;
assert firstChild.getText() != null;
if (firstChild.getText().trim().equals("static")) {
// Fortunately, in all packages checked so far, static variables defining font family and
// package names appear at the beginning of the file. So this simple visitor works, but it
// will fail if the static variables are defined at the end of the file.
final String varName = Objects.requireNonNull(o.getComponentName().getText()).trim();
assert o.getParent() != null;
final DartVarInit init = (DartVarInit)o.getParent().getLastChild();
assert init != null;
final DartExpression expression = init.getExpression();
if (expression instanceof DartStringLiteralExpression) {
assert expression.getText() != null;
final Pair<String, TextRange> pair = DartPsiImplUtil.getUnquotedDartStringAndItsRange(expression.getText());
staticVars.put(varName, pair.first);
}
}
}
}
}
//@Deprecated // This might be useful if we eliminate the preference pane that defines packages to analyze.
//static class YamlAssetMapVisitor extends YamlRecursivePsiElementVisitor {
// final HashMap<String, String> assetMap = new HashMap<>();
// final List<String> iconClassNames = new ArrayList<>();
//
// @Override
// public void visitCompoundValue(@NotNull YAMLCompoundValue compoundValue) {
// final PsiElement[] children = compoundValue.getChildren();
// if (children.length == 2 && Objects.requireNonNull(children[0].getFirstChild()).textMatches("asset")) {
// assert children[0].getLastChild() != null;
// final String fontFilePath = children[0].getLastChild().getText();
// assert children[1] != null;
// assert children[1].getLastChild() != null;
// final String className = children[1].getLastChild().getText();
// iconClassNames.add(className);
// assetMap.put(className, fontFilePath);
// }
// else {
// super.visitCompoundValue(compoundValue);
// }
// }
//
// @Override
// public void visitKeyValue(@NotNull YAMLKeyValue keyValue) {
// if (keyValue.getKeyText().equals("icons")) {
// iconClassNames.add(keyValue.getValueText());
// }
// else {
// super.visitKeyValue(keyValue);
// }
// }
//}
}
|
/*
* Copyright (c) 2012, United States Government, as represented by the Secretary of Health and Human Services.
* 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 the United States Government 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 UNITED STATES GOVERNMENT BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package gov.hhs.fha.nhinc.docsubmission.adapter.proxy.service;
import gov.hhs.fha.nhinc.adapterxdrsecured.AdapterXDRSecuredPortType;
import gov.hhs.fha.nhinc.messaging.service.port.ServicePortDescriptor;
/**
* @author akong
*
*/
public class AdapterDocSubmissionSecuredServicePortDescriptor implements ServicePortDescriptor<AdapterXDRSecuredPortType> {
/* (non-Javadoc)
* @see gov.hhs.fha.messaging.service.port.ServicePortDescriptor#getNamespaceUri()
*/
@Override
public String getNamespaceUri() {
return "urn:gov:hhs:fha:nhinc:adapterxdrsecured";
}
/* (non-Javadoc)
* @see gov.hhs.fha.messaging.service.port.ServicePortDescriptor#getServiceLocalPart()
*/
@Override
public String getServiceLocalPart() {
return "AdapterXDRSecured_Service";
}
/* (non-Javadoc)
* @see gov.hhs.fha.messaging.service.port.ServicePortDescriptor#getPortLocalPart()
*/
@Override
public String getPortLocalPart() {
return "AdapterXDRSecured_Port";
}
/* (non-Javadoc)
* @see gov.hhs.fha.messaging.service.port.ServicePortDescriptor#getWSDLFileName()
*/
@Override
public String getWSDLFileName() {
return "AdapterXDRSecured.wsdl";
}
/* (non-Javadoc)
* @see gov.hhs.fha.messaging.service.port.ServicePortDescriptor#getWSAddressingAction()
*/
@Override
public String getWSAddressingAction() {
return "urn:gov:hhs:fha:nhinc:adapterxdrsecured:ProvideAndRegisterDocumentSet-b";
}
/* (non-Javadoc)
* @see gov.hhs.fha.messaging.service.port.ServicePortDescriptor#getPortClass()
*/
@Override
public Class<AdapterXDRSecuredPortType> getPortClass() {
return AdapterXDRSecuredPortType.class;
}
}
|
package com.example.xinwin;
import java.util.List;
/**
* Created by 张翔宇 on 2018/4/8.
*/
public class news {
/**
* status : 0
* msg : ok
* result : {"channel":"头条","num":"1","list":[{"title":"日本\u201c第四自卫队\u201d呼之欲出 安倍野心又升级","time":"2018-04-08 09:35:12","src":"","category":"news","pic":"http://api.jisuapi.com/news/upload/201804/08110007_73784.jpg","content":" 原标题:\u201c第四自卫队\u201d呼之欲出 安倍野心又升级<\/p> 据媒体报道,上周日本自卫队成立了\u201c陆上总队\u201d,这使陆上自卫队在海外的行动能力得到强化,与海、空自卫队以及美军的协调实现一体化。为此,日本国会两院3月28日通过了2018财年预算,总额超过约97.71万亿日元。防务预算为5.19万亿日元,创下历史记录,其中部分为\u201c陆上总队\u201d总部建设费,相关工程于今年动工。而为满足安倍政府促进日美安保同盟关系,\u201c陆上总队\u201d司令部特意选在离驻日美军总部驻地不远的东京朝霞基地,编制规模为300人左右,目前先维持180人。\u201c陆上总队\u201d,将作为五个方面队北部、东北、东部、中部和西部的上级,还会成立\u201c日美共同部\u201d,与驻日美国陆军协调。目前,5个方面队,共有15个师团、旅团,含现役人员15.1万人,预备役人员0.8万人,同时也将直接指挥新设的\u201c水陆机动团\u201d以及第一空挺团等精锐部队,全面强化西南岛屿防卫的作战能力。\u201c陆上总队\u201d与海上自卫队的舰队和航空自卫队的总队平级,统一由防卫大臣调用。那么日本自卫队军改主要目的是什么?<\/p> 除了建立\u201c陆上总队\u201d,第二项就是建立负责岛屿防卫和登陆作战的\u201c水陆机动团\u201d。以2002年成立的陆上自卫队\u201c西部方面普通科连队\u201d为基础,而这个所谓的\u201c西普连\u201d正是针对我国钓鱼岛而成立的,拜美国海军陆战队为师,搞联合训练,夺岛强攻、侦察渗透、潜水训练等等特种作战。\u201c水陆机动团\u201d司令部设在九州地区的长崎县佐世保市相浦基地。不过目前,计划装备给\u201c水陆机动团\u201d的美军AAV-7水陆两栖战车推迟交付,V-22\u201c鱼鹰\u201d旋翼运输机故障频出,该部队的装备一时间尚无法全部到位。日本除了建新军,还为自卫队加强通信能力。据日本防卫省3月20日消息,为提高自卫队的情报通信,强化西南诸岛军事联络,要建立军用卫星通信网。将于下个月在南美法属圭亚那发射通信卫星\u201c煌-1\u201d号。\u201c煌-2\u201d号于去年1月发射升空并运用。那么为何日本不断加强针对西南军事力量?<\/p> 3月29日,日本安全保障法相关内容施行两周年。这两年,日本大幅度地扩大了日本自卫队可实施的任务。安倍上台后,日本战略重心由北转南,加强九州、冲绳地区军事实力,据《朝日新闻》报道,日本将向冲绳本岛部署\u201c12式\u201d地对舰导弹。作为日本\u201c88式\u201d反舰导弹的后继装备,全长5米,重约700公斤,最大射程200公里,是日本最新研制的反舰导弹。此举意在从宫古海峡两侧对通过宫古海峡的中国海军舰艇形成\u201c夹击\u201d,从而对宫古海峡形成火力全覆盖。日本的防务预算,以\u201c安保环境严峻\u201d为由持续增长理由,安倍政府决定列入22亿日元用于引进秉持专守防卫的巡航导弹,采购对象可能是挪威生产的射程500公里的联合打击导弹,包括美国产的射程900公里的反舰导弹和联合防区外空对地导弹。对于日本将要购置导弹一说,日本防卫大臣做出这样解释,\u201c为了击退无法抵达日本本土的所谓\u201c圈外威胁\u201d的敌方攻击,我们自己必须拥有远程导弹,\u201d而媒体认为第二种导弹用途明显是针对中国,而对西南诸岛采取的军事措施。安倍的野心是否又升级了?<\/p>","url":"http://news.sina.cn/gj/2018-04-08/detail-ifyvtmxc7560206.d.html?vt=4&pos=108","weburl":"http://news.sina.com.cn/w/2018-04-08/doc-ifyvtmxc7560206.shtml"}]}
*/
private String status;
private String msg;
private ResultBean result;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public ResultBean getResult() {
return result;
}
public void setResult(ResultBean result) {
this.result = result;
}
public static class ResultBean {
/**
* channel : 头条
* num : 1
* list : [{"title":"日本\u201c第四自卫队\u201d呼之欲出 安倍野心又升级","time":"2018-04-08 09:35:12","src":"","category":"news","pic":"http://api.jisuapi.com/news/upload/201804/08110007_73784.jpg","content":" 原标题:\u201c第四自卫队\u201d呼之欲出 安倍野心又升级<\/p> 据媒体报道,上周日本自卫队成立了\u201c陆上总队\u201d,这使陆上自卫队在海外的行动能力得到强化,与海、空自卫队以及美军的协调实现一体化。为此,日本国会两院3月28日通过了2018财年预算,总额超过约97.71万亿日元。防务预算为5.19万亿日元,创下历史记录,其中部分为\u201c陆上总队\u201d总部建设费,相关工程于今年动工。而为满足安倍政府促进日美安保同盟关系,\u201c陆上总队\u201d司令部特意选在离驻日美军总部驻地不远的东京朝霞基地,编制规模为300人左右,目前先维持180人。\u201c陆上总队\u201d,将作为五个方面队北部、东北、东部、中部和西部的上级,还会成立\u201c日美共同部\u201d,与驻日美国陆军协调。目前,5个方面队,共有15个师团、旅团,含现役人员15.1万人,预备役人员0.8万人,同时也将直接指挥新设的\u201c水陆机动团\u201d以及第一空挺团等精锐部队,全面强化西南岛屿防卫的作战能力。\u201c陆上总队\u201d与海上自卫队的舰队和航空自卫队的总队平级,统一由防卫大臣调用。那么日本自卫队军改主要目的是什么?<\/p> 除了建立\u201c陆上总队\u201d,第二项就是建立负责岛屿防卫和登陆作战的\u201c水陆机动团\u201d。以2002年成立的陆上自卫队\u201c西部方面普通科连队\u201d为基础,而这个所谓的\u201c西普连\u201d正是针对我国钓鱼岛而成立的,拜美国海军陆战队为师,搞联合训练,夺岛强攻、侦察渗透、潜水训练等等特种作战。\u201c水陆机动团\u201d司令部设在九州地区的长崎县佐世保市相浦基地。不过目前,计划装备给\u201c水陆机动团\u201d的美军AAV-7水陆两栖战车推迟交付,V-22\u201c鱼鹰\u201d旋翼运输机故障频出,该部队的装备一时间尚无法全部到位。日本除了建新军,还为自卫队加强通信能力。据日本防卫省3月20日消息,为提高自卫队的情报通信,强化西南诸岛军事联络,要建立军用卫星通信网。将于下个月在南美法属圭亚那发射通信卫星\u201c煌-1\u201d号。\u201c煌-2\u201d号于去年1月发射升空并运用。那么为何日本不断加强针对西南军事力量?<\/p> 3月29日,日本安全保障法相关内容施行两周年。这两年,日本大幅度地扩大了日本自卫队可实施的任务。安倍上台后,日本战略重心由北转南,加强九州、冲绳地区军事实力,据《朝日新闻》报道,日本将向冲绳本岛部署\u201c12式\u201d地对舰导弹。作为日本\u201c88式\u201d反舰导弹的后继装备,全长5米,重约700公斤,最大射程200公里,是日本最新研制的反舰导弹。此举意在从宫古海峡两侧对通过宫古海峡的中国海军舰艇形成\u201c夹击\u201d,从而对宫古海峡形成火力全覆盖。日本的防务预算,以\u201c安保环境严峻\u201d为由持续增长理由,安倍政府决定列入22亿日元用于引进秉持专守防卫的巡航导弹,采购对象可能是挪威生产的射程500公里的联合打击导弹,包括美国产的射程900公里的反舰导弹和联合防区外空对地导弹。对于日本将要购置导弹一说,日本防卫大臣做出这样解释,\u201c为了击退无法抵达日本本土的所谓\u201c圈外威胁\u201d的敌方攻击,我们自己必须拥有远程导弹,\u201d而媒体认为第二种导弹用途明显是针对中国,而对西南诸岛采取的军事措施。安倍的野心是否又升级了?<\/p>","url":"http://news.sina.cn/gj/2018-04-08/detail-ifyvtmxc7560206.d.html?vt=4&pos=108","weburl":"http://news.sina.com.cn/w/2018-04-08/doc-ifyvtmxc7560206.shtml"}]
*/
private String channel;
private String num;
private List<ListBean> list;
public String getChannel() {
return channel;
}
public void setChannel(String channel) {
this.channel = channel;
}
public String getNum() {
return num;
}
public void setNum(String num) {
this.num = num;
}
public List<ListBean> getList() {
return list;
}
public void setList(List<ListBean> list) {
this.list = list;
}
public static class ListBean {
/**
* title : 日本“第四自卫队”呼之欲出 安倍野心又升级
* time : 2018-04-08 09:35:12
* src :
* category : news
* pic : http://api.jisuapi.com/news/upload/201804/08110007_73784.jpg
* content : 原标题:“第四自卫队”呼之欲出 安倍野心又升级</p> 据媒体报道,上周日本自卫队成立了“陆上总队”,这使陆上自卫队在海外的行动能力得到强化,与海、空自卫队以及美军的协调实现一体化。为此,日本国会两院3月28日通过了2018财年预算,总额超过约97.71万亿日元。防务预算为5.19万亿日元,创下历史记录,其中部分为“陆上总队”总部建设费,相关工程于今年动工。而为满足安倍政府促进日美安保同盟关系,“陆上总队”司令部特意选在离驻日美军总部驻地不远的东京朝霞基地,编制规模为300人左右,目前先维持180人。“陆上总队”,将作为五个方面队北部、东北、东部、中部和西部的上级,还会成立“日美共同部”,与驻日美国陆军协调。目前,5个方面队,共有15个师团、旅团,含现役人员15.1万人,预备役人员0.8万人,同时也将直接指挥新设的“水陆机动团”以及第一空挺团等精锐部队,全面强化西南岛屿防卫的作战能力。“陆上总队”与海上自卫队的舰队和航空自卫队的总队平级,统一由防卫大臣调用。那么日本自卫队军改主要目的是什么?</p> 除了建立“陆上总队”,第二项就是建立负责岛屿防卫和登陆作战的“水陆机动团”。以2002年成立的陆上自卫队“西部方面普通科连队”为基础,而这个所谓的“西普连”正是针对我国钓鱼岛而成立的,拜美国海军陆战队为师,搞联合训练,夺岛强攻、侦察渗透、潜水训练等等特种作战。“水陆机动团”司令部设在九州地区的长崎县佐世保市相浦基地。不过目前,计划装备给“水陆机动团”的美军AAV-7水陆两栖战车推迟交付,V-22“鱼鹰”旋翼运输机故障频出,该部队的装备一时间尚无法全部到位。日本除了建新军,还为自卫队加强通信能力。据日本防卫省3月20日消息,为提高自卫队的情报通信,强化西南诸岛军事联络,要建立军用卫星通信网。将于下个月在南美法属圭亚那发射通信卫星“煌-1”号。“煌-2”号于去年1月发射升空并运用。那么为何日本不断加强针对西南军事力量?</p> 3月29日,日本安全保障法相关内容施行两周年。这两年,日本大幅度地扩大了日本自卫队可实施的任务。安倍上台后,日本战略重心由北转南,加强九州、冲绳地区军事实力,据《朝日新闻》报道,日本将向冲绳本岛部署“12式”地对舰导弹。作为日本“88式”反舰导弹的后继装备,全长5米,重约700公斤,最大射程200公里,是日本最新研制的反舰导弹。此举意在从宫古海峡两侧对通过宫古海峡的中国海军舰艇形成“夹击”,从而对宫古海峡形成火力全覆盖。日本的防务预算,以“安保环境严峻”为由持续增长理由,安倍政府决定列入22亿日元用于引进秉持专守防卫的巡航导弹,采购对象可能是挪威生产的射程500公里的联合打击导弹,包括美国产的射程900公里的反舰导弹和联合防区外空对地导弹。对于日本将要购置导弹一说,日本防卫大臣做出这样解释,“为了击退无法抵达日本本土的所谓“圈外威胁”的敌方攻击,我们自己必须拥有远程导弹,”而媒体认为第二种导弹用途明显是针对中国,而对西南诸岛采取的军事措施。安倍的野心是否又升级了?</p>
* url : http://news.sina.cn/gj/2018-04-08/detail-ifyvtmxc7560206.d.html?vt=4&pos=108
* weburl : http://news.sina.com.cn/w/2018-04-08/doc-ifyvtmxc7560206.shtml
*/
private String title;
private String time;
private String src;
private String category;
private String pic;
private String content;
private String url;
private String weburl;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getSrc() {
return src;
}
public void setSrc(String src) {
this.src = src;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getPic() {
return pic;
}
public void setPic(String pic) {
this.pic = pic;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getWeburl() {
return weburl;
}
public void setWeburl(String weburl) {
this.weburl = weburl;
}
}
}
}
|
package org.ajwcc.pduUtils.gsm3040;
import java.util.*;
import org.ajwcc.pduUtils.gsm3040.ie.*;
//PduUtils Library - A Java library for generating GSM 3040 Protocol Data Units (PDUs)
//
//Copyright (C) 2008, Ateneo Java Wireless Competency Center/Blueblade Technologies, Philippines.
//PduUtils is distributed under the terms of the Apache License version 2.0
//
//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.
public class PduParser
{
// ==================================================
// RAW PDU PARSER
// ==================================================
// increments as methods are called
private int position;
private byte[] pduByteArray;
// possible types of data
// BCD digits
// byte
// gsm-septets
// timestamp info
private int readByte()
{
// read 8-bits forward
int retVal = pduByteArray[position] & 0xFF;
position++;
return retVal;
}
private int readSwappedNibbleBCDByte()
{
// read 8-bits forward, swap the nibbles
int data = readByte();
data = PduUtils.swapNibbles((byte) data);
int retVal = 0;
retVal += ((data >>> 4) & 0xF) * 10;
retVal += ((data & 0xF));
return retVal;
}
private Calendar readTimeStamp()
{
// reads timestamp info
// 7 bytes in semi-octet(BCD) style
int year = readSwappedNibbleBCDByte();
int month = readSwappedNibbleBCDByte();
int day = readSwappedNibbleBCDByte();
int hour = readSwappedNibbleBCDByte();
int minute = readSwappedNibbleBCDByte();
int second = readSwappedNibbleBCDByte();
// special treatment for timezone due to sign bit
// swap nibbles, clear the sign bit, convert remaining bits to BCD
int timestamp = readByte();
boolean negative = (timestamp & 0x08) == 0x08; // check bit 3
int timezone = PduUtils.swapNibbles(timestamp) & 0x7F; // remove last bit since this is just a sign
// time zone computation
TimeZone tz = null;
if (negative)
{
// bit 3 of unswapped value represents the sign (1 == negative, 0 == positive)
// when swapped this will now be bit 7 (128)
int bcdTimeZone = 0;
bcdTimeZone += (((timezone >>> 4) & 0xF) * 10);
bcdTimeZone += ((timezone & 0xF));
timezone = bcdTimeZone;
int totalMinutes = timezone * 15;
int hours = totalMinutes / 60;
int minutes = totalMinutes % 60;
String gmtString = "GMT-" + hours + ":" + (minutes < 10 ? "0" : "") + minutes;
//System.out.println(gmtString);
tz = TimeZone.getTimeZone(gmtString);
}
else
{
int bcdTimeZone = 0;
bcdTimeZone += ((timezone >>> 4) & 0xF) * 10;
bcdTimeZone += ((timezone & 0xF));
timezone = bcdTimeZone;
int totalMinutes = timezone * 15;
int hours = totalMinutes / 60;
int minutes = totalMinutes % 60;
String gmtString = "GMT+" + hours + ":" + (minutes < 10 ? "0" : "") + minutes;
//System.out.println(gmtString);
tz = TimeZone.getTimeZone(gmtString);
}
Calendar cal = Calendar.getInstance(tz);
cal.set(Calendar.YEAR, year + 2000);
cal.set(Calendar.MONTH, month - 1);
cal.set(Calendar.DAY_OF_MONTH, day);
cal.set(Calendar.HOUR_OF_DAY, hour);
cal.set(Calendar.MINUTE, minute);
cal.set(Calendar.SECOND, second);
return cal;
}
private String readAddress(int addressLength, int addressType)
{
// NOTE: the max number of octets on an address is 12 octets
// this means that an address field need only be 12 octets long
// what about for 7-bit? This would be 13 chars at 12 octets?
if (addressLength > 0)
{
// length is a semi-octet count
int addressDataOctetLength = addressLength / 2 + ((addressLength % 2 == 1) ? 1 : 0);
// extract data and increment position
byte[] addressData = new byte[addressDataOctetLength];
System.arraycopy(pduByteArray, position, addressData, 0, addressDataOctetLength);
position = position + addressDataOctetLength;
switch (PduUtils.extractAddressType(addressType))
{
case PduUtils.ADDRESS_TYPE_ALPHANUMERIC:
// extract and process encoded bytes
byte[] uncompressed = PduUtils.encodedSeptetsToUnencodedSeptets(addressData);
int septets = addressLength * 4 / 7;
byte[] choppedAddressData = new byte[septets];
System.arraycopy(uncompressed, 0, choppedAddressData, 0, septets);
return PduUtils.unencodedSeptetsToString(choppedAddressData);
default:
// process BCD style data any other
return PduUtils.readBCDNumbers(addressLength, addressData);
}
}
return null;
}
private int readValidityPeriodInt()
{
// this will convert the VP to #MINUTES
int validity = readByte();
int minutes = 0;
if ((validity > 0) && (validity <= 143))
{
// groups of 5 min
minutes = (validity + 1) * 5;
}
else if ((validity > 143) && (validity <= 167))
{
// groups of 30 min + 12 hrs
minutes = (12 * 60) + (validity - 143) * 30;
}
else if ((validity > 167) && (validity <= 196))
{
// days
minutes = (validity - 166) * 24 * 60;
}
else if ((validity > 197) && (validity <= 255))
{
// weeks
minutes = (validity - 192) * 7 * 24 * 60;
}
return minutes;
}
public Pdu parsePdu(String rawPdu)
{
// encode pdu to byte[] for easier processing
pduByteArray = PduUtils.pduToBytes(rawPdu);
position = 0;
// parse start and determine what type of pdu it is
Pdu pdu = parseStart();
pdu.setRawPdu(rawPdu);
// parse depending on the pdu type
switch (pdu.getTpMti())
{
case PduUtils.TP_MTI_SMS_DELIVER:
parseSmsDeliverMessage((SmsDeliveryPdu) pdu);
break;
case PduUtils.TP_MTI_SMS_SUBMIT:
parseSmsSubmitMessage((SmsSubmitPdu) pdu);
break;
case PduUtils.TP_MTI_SMS_STATUS_REPORT:
parseSmsStatusReportMessage((SmsStatusReportPdu) pdu);
break;
}
return pdu;
}
private Pdu parseStart()
{
// SMSC info
// length
// address type
// smsc data
int addressLength = readByte();
Pdu pdu = null;
if (addressLength > 0)
{
int addressType = readByte();
String smscAddress = readAddress((addressLength - 1) * 2, addressType);
// first octet - determine how to parse and how to store
int firstOctet = readByte();
pdu = PduFactory.createPdu(firstOctet);
// generic methods
pdu.setSmscAddressType(addressType);
pdu.setSmscAddress(smscAddress);
pdu.setSmscInfoLength(addressLength);
}
else
{
// first octet - determine how to parse and how to store
int firstOctet = readByte();
pdu = PduFactory.createPdu(firstOctet);
}
return pdu;
}
private void parseUserData(Pdu pdu)
{
// ud length
// NOTE: - the udLength value is just stored, it is not used to determine the length
// of the remaining data (it may be a septet length not an octet length)
// - parser just assumes that the remaining PDU data is for the User-Data field
int udLength = readByte();
pdu.setUDLength(udLength);
// user data
// NOTE: UD Data does not contain the length octet
int udOctetLength = pduByteArray.length - position;
byte[] udData = new byte[udOctetLength];
System.arraycopy(pduByteArray, position, udData, 0, udOctetLength);
// save the UD data
pdu.setUDData(udData);
// user data header (if present)
// position is still at the start of the UD
if (pdu.hasTpUdhi())
{
// udh length
int udhLength = readByte();
// udh data (iterate till udh is consumed)
// iei id
// iei data length
// iei data
int endUdh = position + udhLength;
while (position < endUdh)
{
int iei = readByte();
int iedl = readByte();
byte[] ieData = new byte[iedl];
System.arraycopy(pduByteArray, position, ieData, 0, iedl);
InformationElement ie = InformationElementFactory.createInformationElement(iei, ieData);
pdu.addInformationElement(ie);
position = position + iedl;
if (position > endUdh)
{
// at the end, position after adding should be exactly at endUdh
throw new RuntimeException("UDH is shorter than expected endUdh=" + endUdh + ", position=" + position);
}
}
}
}
private void parseSmsDeliverMessage(SmsDeliveryPdu pdu)
{
// originator address info
// address length
// type of address
// address data
int addressLength = readByte();
int addressType = readByte();
String originatorAddress = readAddress(addressLength, addressType);
pdu.setAddressType(addressType);
if (originatorAddress != null) pdu.setAddress(originatorAddress);
// protocol id
int protocolId = readByte();
pdu.setProtocolIdentifier(protocolId);
// data coding scheme
int dcs = readByte();
pdu.setDataCodingScheme(dcs);
// timestamp
Calendar timestamp = readTimeStamp();
pdu.setTimestamp(timestamp);
// user data
parseUserData(pdu);
}
private void parseSmsStatusReportMessage(SmsStatusReportPdu pdu)
{
// message reference
int messageReference = readByte();
pdu.setMessageReference(messageReference);
// destination address info
int addressLength = readByte();
int addressType = readByte();
String destinationAddress = readAddress(addressLength, addressType);
pdu.setAddressType(addressType);
pdu.setAddress(destinationAddress);
// timestamp
Calendar timestamp = readTimeStamp();
pdu.setTimestamp(timestamp);
// discharge time(timestamp)
Calendar timestamp2 = readTimeStamp();
pdu.setDischargeTime(timestamp2);
// status
int status = readByte();
pdu.setStatus(status);
}
// NOTE: the following is just for validation of the PduGenerator
// - there is no normal scenario where this is used
private void parseSmsSubmitMessage(SmsSubmitPdu pdu)
{
// message reference
int messageReference = readByte();
pdu.setMessageReference(messageReference);
// destination address info
int addressLength = readByte();
int addressType = readByte();
String destinationAddress = readAddress(addressLength, addressType);
pdu.setAddressType(addressType);
pdu.setAddress(destinationAddress);
// protocol id
int protocolId = readByte();
pdu.setProtocolIdentifier(protocolId);
// data coding scheme
int dcs = readByte();
pdu.setDataCodingScheme(dcs);
// validity period
switch (pdu.getTpVpf())
{
case PduUtils.TP_VPF_NONE:
break;
case PduUtils.TP_VPF_INTEGER:
int validityInt = readValidityPeriodInt();
pdu.setValidityPeriod(validityInt / 60); // pdu assumes hours
break;
case PduUtils.TP_VPF_TIMESTAMP:
Calendar validityDate = readTimeStamp();
pdu.setValidityTimestamp(validityDate);
break;
}
parseUserData(pdu);
}
}
|
package com.stacksync.syncservice.test.benchmark;
import java.util.UUID;
public class Constants {
public static UUID USER = new UUID(1, 1);
public static UUID WORKSPACE_ID = new UUID(1, 1);
public static String REQUEST_ID = "Benchmark";
public static UUID DEVICE_ID = new UUID(1, 1);
public static Integer XMLRPC_PORT = com.stacksync.syncservice.util.Constants.XMLRPC_PORT;
}
|
/*
* Copyright 2012 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.openbidder.ui.notify;
import com.google.common.base.Function;
/**
* Message service topics.
*/
public enum Topic {
ALL_INSTANCES,
BALANCER,
BIDDER,
CAMPAIGN_DELETE,
CAMPAIGN_IMPORT,
FIREWALL,
FIREWALL_DELETE,
INSTANCE,
NETWORK,
NETWORK_DELETE,
NETWORK_CONFIG,
PROJECT,
RTB_REPORT_INDEX;
public static Function<String, Topic> FROM_STRING = new Function<String, Topic>() {
@Override public Topic apply(String topicName) {
return Topic.valueOf(topicName);
}};
}
|
package net.task.coordinator.request.message;
public class TaskInProgressMessage {
public TaskInProgressMessage() {
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getTaskId() {
return taskId;
}
public TaskInProgressMessage(String taskId) {
this.taskId = taskId;
}
private String taskId;
}
|
/*
* Copyright (c) 2010, Bart Kiers
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
package cg;
import java.awt.geom.Point2D;
import java.util.*;
import de.biomedical_imaging.traJ.TrajectoryUtil;
public final class RotatingCalipers {
protected enum Corner { UPPER_RIGHT, UPPER_LEFT, LOWER_LEFT, LOWER_RIGHT }
public static double getArea(Point2D.Double[] rectangle) {
double deltaXAB = rectangle[0].x - rectangle[1].x;
double deltaYAB = rectangle[0].y - rectangle[1].y;
double deltaXBC = rectangle[1].x - rectangle[2].x;
double deltaYBC = rectangle[1].y - rectangle[2].y;
double lengthAB = Math.sqrt((deltaXAB * deltaXAB) + (deltaYAB * deltaYAB));
double lengthBC = Math.sqrt((deltaXBC * deltaXBC) + (deltaYBC * deltaYBC));
return lengthAB * lengthBC;
}
public static List<Point2D.Double[]> getAllBoundingRectangles(int[] xs, int[] ys) throws IllegalArgumentException {
if(xs.length != ys.length) {
throw new IllegalArgumentException("xs and ys don't have the same size");
}
List<Point2D.Double> points = new ArrayList<Point2D.Double>();
for(int i = 0; i < xs.length; i++) {
points.add(new Point2D.Double(xs[i], ys[i]));
}
return getAllBoundingRectangles(points);
}
public static List<Point2D.Double[]> getAllBoundingRectangles(List<Point2D.Double> points) throws IllegalArgumentException {
List<Point2D.Double[]> rectangles = new ArrayList<Point2D.Double[]>();
List<Point2D.Double> convexHull = GrahamScan.getConvexHull(points);
Caliper I = new Caliper(convexHull, getIndex(convexHull, Corner.UPPER_RIGHT), 90);
Caliper J = new Caliper(convexHull, getIndex(convexHull, Corner.UPPER_LEFT), 180);
Caliper K = new Caliper(convexHull, getIndex(convexHull, Corner.LOWER_LEFT), 270);
Caliper L = new Caliper(convexHull, getIndex(convexHull, Corner.LOWER_RIGHT), 0);
while(L.currentAngle < 90.0) {
rectangles.add(new Point2D.Double[]{
L.getIntersection(I),
I.getIntersection(J),
J.getIntersection(K),
K.getIntersection(L)
});
double smallestTheta = getSmallestTheta(I, J, K, L);
I.rotateBy(smallestTheta);
J.rotateBy(smallestTheta);
K.rotateBy(smallestTheta);
L.rotateBy(smallestTheta);
}
return rectangles;
}
public static Point2D.Double[] getMinimumBoundingRectangle(int[] xs, int[] ys) throws IllegalArgumentException {
if(xs.length != ys.length) {
throw new IllegalArgumentException("xs and ys don't have the same size");
}
List<Point2D.Double> points = new ArrayList<Point2D.Double>();
for(int i = 0; i < xs.length; i++) {
points.add(new Point2D.Double(xs[i], ys[i]));
}
return getMinimumBoundingRectangle(points);
}
public static Point2D.Double[] getMinimumBoundingRectangle(List<Point2D.Double> points) throws IllegalArgumentException {
List<Point2D.Double[]> rectangles = getAllBoundingRectangles(points);
Point2D.Double[] minimum = null;
double area = Long.MAX_VALUE;
for (Point2D.Double[] rectangle : rectangles) {
double tempArea = getArea(rectangle);
if (minimum == null || tempArea < area) {
minimum = rectangle;
area = tempArea;
}
}
return minimum;
}
private static double getSmallestTheta(Caliper I, Caliper J, Caliper K, Caliper L) {
double thetaI = I.getDeltaAngleNextPoint();
double thetaJ = J.getDeltaAngleNextPoint();
double thetaK = K.getDeltaAngleNextPoint();
double thetaL = L.getDeltaAngleNextPoint();
if(thetaI <= thetaJ && thetaI <= thetaK && thetaI <= thetaL) {
return thetaI;
}
else if(thetaJ <= thetaK && thetaJ <= thetaL) {
return thetaJ;
}
else if(thetaK <= thetaL) {
return thetaK;
}
else {
return thetaL;
}
}
protected static int getIndex(List<Point2D.Double> convexHull, Corner corner) {
int index = 0;
Point2D.Double point= convexHull.get(index);
for(int i = 1; i < convexHull.size() - 1; i++) {
Point2D.Double temp = convexHull.get(i);
boolean change = false;
switch(corner) {
case UPPER_RIGHT:
change = (temp.x > point.x || (temp.x == point.x && temp.y > point.y));
break;
case UPPER_LEFT:
change = (temp.y > point.y || (temp.y == point.y && temp.x < point.x));
break;
case LOWER_LEFT:
change = (temp.x < point.x || (temp.x == point.x && temp.y < point.y));
break;
case LOWER_RIGHT:
change = (temp.y < point.y || (temp.y == point.y && temp.x > point.x));
break;
}
if(change) {
index = i;
point = temp;
}
}
return index;
}
protected static class Caliper {
final static double SIGMA = 0.00000000001;
final List<Point2D.Double> convexHull;
int pointIndex;
double currentAngle;
Caliper(List<Point2D.Double> convexHull, int pointIndex, double currentAngle) {
this.convexHull = convexHull;
this.pointIndex = pointIndex;
this.currentAngle = currentAngle;
}
double getAngleNextPoint() {
Point2D.Double p1 = convexHull.get(pointIndex);
Point2D.Double p2 = convexHull.get((pointIndex + 1) % convexHull.size());
double deltaX = p2.x - p1.x;
double deltaY = p2.y - p1.y;
double angle = Math.atan2(deltaY, deltaX) * 180 / Math.PI;
return angle < 0 ? 360 + angle : angle;
}
double getConstant() {
Point2D.Double p = convexHull.get(pointIndex);
return p.y - (getSlope() * p.x);
}
double getDeltaAngleNextPoint() {
double angle = getAngleNextPoint();
angle = angle < 0 ? 360 + angle - currentAngle : angle - currentAngle;
return angle < 0 ? 360 : angle;
}
Point2D.Double getIntersection(Caliper that) {
// the x-intercept of 'this' and 'that': x = ((c2 - c1) / (m1 - m2))
double x;
// the y-intercept of 'this' and 'that', given 'x': (m*x) + c
double y;
if(this.isVertical()) {
x = convexHull.get(pointIndex).x;
}
else if(this.isHorizontal()) {
x = that.convexHull.get(that.pointIndex).x;
}
else {
x = (that.getConstant() - this.getConstant()) / (this.getSlope() - that.getSlope());
}
if(this.isVertical()) {
y = that.getConstant();
}
else if(this.isHorizontal()) {
y = this.getConstant();
}
else {
y = (this.getSlope() * x) + this.getConstant();
}
return new Point2D.Double(x, y);
}
double getSlope() {
return Math.tan(Math.toRadians(currentAngle));
}
boolean isHorizontal() {
return (Math.abs(currentAngle) < SIGMA) || (Math.abs(currentAngle - 180.0) < SIGMA);
}
boolean isVertical() {
return (Math.abs(currentAngle - 90.0) < SIGMA) || (Math.abs(currentAngle - 270.0) < SIGMA);
}
void rotateBy(double angle) {
if(this.getDeltaAngleNextPoint() == angle) {
pointIndex++;
}
this.currentAngle += angle;
}
}
/**
* For a documented (and unit tested version) of the class below, see:
* <a href="https://github.com/bkiers/GrahamScan">github.com/bkiers/GrahamScan</a>
*/
private static class GrahamScan {
protected static enum Turn { CLOCKWISE, COUNTER_CLOCKWISE, COLLINEAR }
protected static boolean areAllCollinear(List<Point2D.Double> points) {
if(points.size() < 2) {
return true;
}
final Point2D.Double a = points.get(0);
final Point2D.Double b = points.get(1);
for(int i = 2; i < points.size(); i++) {
Point2D.Double c = points.get(i);
if(getTurn(a, b, c) != Turn.COLLINEAR) {
return false;
}
}
return true;
}
public static List<Point2D.Double> getConvexHull(List<Point2D.Double> points) throws IllegalArgumentException {
List<Point2D.Double> sorted = new ArrayList<Point2D.Double>(getSortedPointSet(points));
if(sorted.size() < 3) {
throw new IllegalArgumentException("can only create a convex hull of 3 or more unique points");
}
if(areAllCollinear(sorted)) {
throw new IllegalArgumentException("cannot create a convex hull from collinear points");
}
Stack<Point2D.Double> stack = new Stack<Point2D.Double>();
stack.push(sorted.get(0));
stack.push(sorted.get(1));
for (int i = 2; i < sorted.size(); i++) {
Point2D.Double head = sorted.get(i);
Point2D.Double middle = stack.pop();
Point2D.Double tail = stack.peek();
Turn turn = getTurn(tail, middle, head);
switch(turn) {
case COUNTER_CLOCKWISE:
stack.push(middle);
stack.push(head);
break;
case CLOCKWISE:
i--;
break;
case COLLINEAR:
stack.push(head);
break;
}
}
stack.push(sorted.get(0));
return new ArrayList<Point2D.Double>(stack);
}
protected static Point2D.Double getLowestPoint(List<Point2D.Double> points) {
Point2D.Double lowest = points.get(0);
for(int i = 1; i < points.size(); i++) {
Point2D.Double temp = points.get(i);
if(temp.y < lowest.y || (temp.y == lowest.y && temp.x < lowest.x)) {
lowest = temp;
}
}
return lowest;
}
protected static Set<Point2D.Double> getSortedPointSet(List<Point2D.Double> points) {
final Point2D.Double lowest = getLowestPoint(points);
TreeSet<Point2D.Double> set = new TreeSet<Point2D.Double>(new Comparator<Point2D.Double>() {
public int compare(Point2D.Double a, Point2D.Double b) {
if(TrajectoryUtil.isZero(a.distance(b))) {
return 0;
}
double thetaA = Math.atan2(a.y - lowest.y, a.x - lowest.x);
double thetaB = Math.atan2(b.y - lowest.y, b.x - lowest.x);
if(thetaA < thetaB) {
return -1;
}
else if(thetaA > thetaB) {
return 1;
}
else {
double distanceA = Math.sqrt(((lowest.x - a.x) * (lowest.x - a.x)) +
((lowest.y - a.y) * (lowest.y - a.y)));
double distanceB = Math.sqrt(((lowest.x - b.x) * (lowest.x - b.x)) +
((lowest.y - b.y) * (lowest.y - b.y)));
if(distanceA < distanceB) {
return -1;
}
else {
return 1;
}
}
}
});
set.addAll(points);
return set;
}
protected static Turn getTurn(Point2D.Double a, Point2D.Double b, Point2D.Double c) {
double crossProduct = ((b.x - a.x) * (c.y - a.y)) -
((b.y - a.y) * (c.x - a.x));
if(TrajectoryUtil.isZero(crossProduct)) {
return Turn.COLLINEAR;
}
if(crossProduct > 0) {
return Turn.COUNTER_CLOCKWISE;
}
else if(crossProduct < 0) {
return Turn.CLOCKWISE;
}
return Turn.COLLINEAR;
}
}
}
|
/*
* Copyright 2017 Alexandros Schillings
*
* 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 uk.co.alt236.floatinginfo.ui.activity.base;
import java.util.HashSet;
import java.util.Set;
import uk.co.alt236.floatinginfo.ui.activity.main.AppearancePreferenceFragment;
import uk.co.alt236.floatinginfo.ui.activity.main.EnabledInfoPreferenceFragment;
import uk.co.alt236.floatinginfo.ui.activity.main.InfoPreferenceFragment;
/*package*/ class ValidFragments {
private final Set<String> validClasses;
public ValidFragments() {
validClasses = new HashSet<>();
validClasses.add(AppearancePreferenceFragment.class.getName());
validClasses.add(EnabledInfoPreferenceFragment.class.getName());
validClasses.add(InfoPreferenceFragment.class.getName());
}
public boolean isValidFragment(final String name) {
return validClasses.contains(name);
}
}
|
/*
* Copyright 2017 StreamSets Inc.
*
* 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.streamsets.pipeline.stage.origin.http;
import com.streamsets.pipeline.api.Config;
import com.streamsets.pipeline.api.StageException;
import com.streamsets.pipeline.api.StageUpgrader;
import com.streamsets.pipeline.config.DataFormat;
import com.streamsets.pipeline.config.JsonMode;
import com.streamsets.pipeline.config.upgrade.UpgraderTestUtils;
import com.streamsets.pipeline.lib.http.AuthenticationType;
import com.streamsets.pipeline.lib.http.HttpMethod;
import com.streamsets.pipeline.lib.http.HttpProxyConfigBean;
import com.streamsets.pipeline.lib.http.OAuthConfigBean;
import com.streamsets.pipeline.lib.http.PasswordAuthConfigBean;
import com.streamsets.pipeline.lib.http.SslConfigBean;
import com.streamsets.pipeline.lib.http.logging.JulLogLevelChooserValues;
import com.streamsets.pipeline.lib.http.logging.RequestLoggingConfigBean;
import com.streamsets.pipeline.lib.http.logging.VerbosityChooserValues;
import com.streamsets.pipeline.stage.util.tls.TlsConfigBeanUpgraderTestUtil;
import com.streamsets.pipeline.upgrader.SelectorStageUpgrader;
import org.glassfish.jersey.client.RequestEntityProcessing;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
public class TestHttpClientSourceUpgrader {
private StageUpgrader upgrader;
private List<Config> configs;
private StageUpgrader.Context context;
@Before
public void setUp() {
URL yamlResource = ClassLoader.getSystemClassLoader().getResource("upgrader/HttpClientDSource.yaml");
upgrader = new SelectorStageUpgrader("stage", new HttpClientSourceUpgrader(), yamlResource);
configs = new ArrayList<>();
context = Mockito.mock(StageUpgrader.Context.class);
}
@Test
public void testV1toV2() throws StageException {
configs.add(new Config("dataFormat", DataFormat.JSON));
configs.add(new Config("resourceUrl", "stream.twitter.com/1.1/statuses/sample.json"));
configs.add(new Config("httpMethod", HttpMethod.GET));
configs.add(new Config("requestData", ""));
configs.add(new Config("requestTimeoutMillis", 1000L));
configs.add(new Config("httpMode", HttpClientMode.STREAMING));
configs.add(new Config("pollingInterval", 5000L));
configs.add(new Config("isOAuthEnabled", true));
configs.add(new Config("batchSize", 100));
configs.add(new Config("maxBatchWaitTime", 5000L));
configs.add(new Config("consumerKey", "MY_KEY"));
configs.add(new Config("consumerSecret", "MY_SECRET"));
configs.add(new Config("token", "MY_TOKEN"));
configs.add(new Config("tokenSecret", "MY_TOKEN_SECRET"));
configs.add(new Config("jsonMode", JsonMode.MULTIPLE_OBJECTS));
configs.add(new Config("entityDelimiter", "\n"));
Assert.assertEquals(16, configs.size());
HttpClientSourceUpgrader httpClientSourceUpgrader = new HttpClientSourceUpgrader();
httpClientSourceUpgrader.upgrade("a", "b", "c", 1, 2, configs);
Assert.assertEquals(17, configs.size());
Map<String, Object> configValues = getConfigsAsMap(configs);
assertTrue(configValues.containsKey("conf.dataFormat"));
Assert.assertEquals(DataFormat.JSON, configValues.get("conf.dataFormat"));
assertTrue(configValues.containsKey("conf.resourceUrl"));
Assert.assertEquals("stream.twitter.com/1.1/statuses/sample.json", configValues.get("conf.resourceUrl"));
assertTrue(configValues.containsKey("conf.httpMethod"));
Assert.assertEquals(HttpMethod.GET, configValues.get("conf.httpMethod"));
assertTrue(configValues.containsKey("conf.requestData"));
Assert.assertEquals("", configValues.get("conf.requestData"));
assertTrue(configValues.containsKey("conf.requestTimeoutMillis"));
Assert.assertEquals(1000L, configValues.get("conf.requestTimeoutMillis"));
assertTrue(configValues.containsKey("conf.httpMode"));
Assert.assertEquals(HttpClientMode.STREAMING, configValues.get("conf.httpMode"));
assertTrue(configValues.containsKey("conf.pollingInterval"));
Assert.assertEquals(5000L, configValues.get("conf.pollingInterval"));
assertTrue(configValues.containsKey("conf.entityDelimiter"));
Assert.assertEquals("\n", configValues.get("conf.entityDelimiter"));
assertTrue(configValues.containsKey("conf.authType"));
Assert.assertEquals(AuthenticationType.OAUTH, configValues.get("conf.authType"));
assertTrue(configValues.containsKey("conf.dataFormatConfig.jsonContent"));
Assert.assertEquals(JsonMode.MULTIPLE_OBJECTS, configValues.get("conf.dataFormatConfig.jsonContent"));
assertTrue(configValues.containsKey("conf.oauth.consumerKey"));
Assert.assertEquals("MY_KEY", configValues.get("conf.oauth.consumerKey"));
assertTrue(configValues.containsKey("conf.oauth.consumerKey"));
Assert.assertEquals("MY_SECRET", configValues.get("conf.oauth.consumerSecret"));
assertTrue(configValues.containsKey("conf.oauth.token"));
Assert.assertEquals("MY_TOKEN", configValues.get("conf.oauth.token"));
assertTrue(configValues.containsKey("conf.oauth.tokenSecret"));
Assert.assertEquals("MY_TOKEN_SECRET", configValues.get("conf.oauth.tokenSecret"));
assertTrue(configValues.containsKey("conf.basic.maxBatchSize"));
Assert.assertEquals(100, configValues.get("conf.basic.maxBatchSize"));
assertTrue(configValues.containsKey("conf.basic.maxWaitTime"));
Assert.assertEquals(5000L, configValues.get("conf.basic.maxWaitTime"));
assertTrue(configValues.containsKey("conf.dataFormatConfig.csvSkipStartLines"));
Assert.assertEquals(0, configValues.get("conf.dataFormatConfig.csvSkipStartLines"));
}
@Test
public void testV2ToV3() throws StageException {
HttpClientSourceUpgrader httpClientSourceUpgrader = new HttpClientSourceUpgrader();
httpClientSourceUpgrader.upgrade("a", "b", "c", 2, 3, configs);
Map<String, Object> configValues = getConfigsAsMap(configs);
assertTrue(configValues.containsKey("conf.useProxy"));
Assert.assertEquals(false, configValues.get("conf.useProxy"));
assertTrue(configValues.containsKey("conf.proxy.uri"));
Assert.assertEquals("", configValues.get("conf.proxy.uri"));
assertTrue(configValues.containsKey("conf.proxy.username"));
Assert.assertEquals("", configValues.get("conf.proxy.username"));
assertTrue(configValues.containsKey("conf.proxy.password"));
Assert.assertEquals("", configValues.get("conf.proxy.password"));
}
@Test
public void testV3ToV4() throws Exception {
configs.add(new Config("conf.authType", "BASIC"));
HttpClientSourceUpgrader httpClientSourceUpgrader = new HttpClientSourceUpgrader();
httpClientSourceUpgrader.upgrade("a", "b", "c", 3, 4, configs);
Map<String, Object> configValues = getConfigsAsMap(configs);
Assert.assertEquals(AuthenticationType.UNIVERSAL, configValues.get("conf.authType"));
}
@Test
public void testV4ToV5() throws Exception {
HttpClientSourceUpgrader httpClientSourceUpgrader = new HttpClientSourceUpgrader();
httpClientSourceUpgrader.upgrade("a", "b", "c", 4, 5, configs);
Map<String, Object> configValues = getConfigsAsMap(configs);
assertTrue(configValues.containsKey("conf.headers"));
Assert.assertEquals(Collections.EMPTY_LIST, configValues.get("conf.headers"));
}
@Test
public void testV5ToV6() throws Exception {
configs.add(new Config("conf.requestData", ""));
HttpClientSourceUpgrader upgrader = new HttpClientSourceUpgrader();
upgrader.upgrade("a", "b", "c", 5, 6, configs);
Map<String, Object> configValues = getConfigsAsMap(configs);
assertTrue(configValues.containsKey("conf.requestBody"));
Assert.assertFalse(configValues.containsKey("conf.requestData"));
Assert.assertEquals(1, configs.size());
}
@Test
public void testV6ToV7() throws Exception {
configs.add(new Config("conf.requestTimeoutMillis", 1000));
configs.add(new Config("conf.numThreads", 10));
configs.add(new Config("conf.authType", AuthenticationType.NONE));
configs.add(new Config("conf.oauth", new OAuthConfigBean()));
configs.add(new Config("conf.basicAuth", new PasswordAuthConfigBean()));
configs.add(new Config("conf.useProxy", false));
configs.add(new Config("conf.proxy", new HttpProxyConfigBean()));
configs.add(new Config("conf.sslConfig", new SslConfigBean()));
HttpClientSourceUpgrader upgrader = new HttpClientSourceUpgrader();
upgrader.upgrade("a", "b", "c", 6, 7, configs);
for (Config config : configs) {
switch (config.getName()) {
case "conf.client.requestTimeoutMillis":
Assert.assertEquals(1000, config.getValue());
break;
case "conf.client.authType":
Assert.assertEquals(AuthenticationType.NONE, config.getValue());
break;
case "conf.client.oauth":
Assert.assertTrue(config.getValue() instanceof OAuthConfigBean);
break;
case "conf.client.basicAuth":
Assert.assertTrue(config.getValue() instanceof PasswordAuthConfigBean);
break;
case "conf.client.useProxy":
Assert.assertEquals(false, config.getValue());
break;
case "conf.client.numThreads":
Assert.assertEquals(10, config.getValue());
break;
case "conf.client.proxy":
Assert.assertTrue(config.getValue() instanceof HttpProxyConfigBean);
break;
case "conf.client.sslConfig":
Assert.assertTrue(config.getValue() instanceof SslConfigBean);
break;
case "conf.client.transferEncoding":
Assert.assertEquals(RequestEntityProcessing.CHUNKED, config.getValue());
break;
default:
fail();
}
}
}
@Test
public void testV7ToV8() throws Exception {
configs.add(new Config("conf.entityDelimiter", "\\r\\n"));
configs.add(new Config("conf.client.requestTimeoutMillis", 1000));
HttpClientSourceUpgrader upgrader = new HttpClientSourceUpgrader();
upgrader.upgrade("a", "b", "c", 7, 8, configs);
Map<String, Object> configValues = getConfigsAsMap(configs);
for (Config config : configs) {
switch (config.getName()) {
case "conf.client.readTimeoutMillis":
assertTrue(configValues.containsKey("conf.client.readTimeoutMillis"));
Assert.assertEquals(1000, config.getValue());
break;
case "conf.client.connectTimeoutMillis":
assertTrue(configValues.containsKey("conf.client.connectTimeoutMillis"));
Assert.assertEquals(0, config.getValue());
break;
case "conf.pagination.mode":
assertTrue(configValues.containsKey("conf.pagination.mode"));
Assert.assertEquals(PaginationMode.NONE, config.getValue());
break;
case "conf.pagination.startAt":
assertTrue(configValues.containsKey("conf.pagination.startAt"));
Assert.assertEquals(0, config.getValue());
break;
case "conf.pagination.resultFieldPath":
assertTrue(configValues.containsKey("conf.pagination.resultFieldPath"));
Assert.assertEquals("", config.getValue());
break;
case "conf.pagination.rateLimit":
assertTrue(configValues.containsKey("conf.pagination.rateLimit"));
Assert.assertEquals(2000, config.getValue());
break;
default:
fail();
}
}
}
@Test
public void testV8ToV9() throws Exception {
configs.add(new Config("conf.dataFormatConfig.schemaInMessage", true));
HttpClientSourceUpgrader upgrader = new HttpClientSourceUpgrader();
upgrader.upgrade("a", "b", "c", 8, 9, configs);
Map<String, Object> configValues = getConfigsAsMap(configs);
assertTrue(configValues.containsKey("conf.dataFormatConfig.avroSchema"));
assertTrue(configValues.containsKey("conf.dataFormatConfig.avroSchemaSource"));
assertTrue(configValues.containsKey("conf.dataFormatConfig.schemaRegistryUrls"));
assertTrue(configValues.containsKey("conf.dataFormatConfig.schemaLookupMode"));
assertTrue(configValues.containsKey("conf.dataFormatConfig.subject"));
assertTrue(configValues.containsKey("conf.dataFormatConfig.schemaId"));
for (Config config : configs) {
switch (config.getName()) {
case "conf.dataFormatConfig.avroSchema":
assertNull(config.getValue());
break;
case "conf.dataFormatConfig.subject":
assertEquals("",config.getValue());
break;
case "conf.dataFormatConfig.avroSchemaSource":
assertEquals("SOURCE", config.getValue());
break;
case "conf.dataFormatConfig.schemaRegistryUrls":
assertEquals(new ArrayList<>(), config.getValue());
break;
case "conf.dataFormatConfig.schemaLookupMode":
assertEquals("AUTO", config.getValue());
break;
case "conf.dataFormatConfig.schemaId":
assertEquals(0, config.getValue());
break;
default:
fail();
}
}
}
@Test
public void testV9ToV10() throws Exception {
HttpClientSourceUpgrader httpClientSourceUpgrader = new HttpClientSourceUpgrader();
httpClientSourceUpgrader.upgrade("a", "b", "c", 9, 10, configs);
Map<String, Object> configValues = getConfigsAsMap(configs);
assertTrue(configValues.containsKey("conf.responseStatusActionConfigs"));
assertEquals(HttpResponseActionConfigBean.DEFAULT_MAX_NUM_RETRIES,
configValues.get("conf.responseTimeoutActionConfig.maxNumRetries"));
assertEquals(HttpResponseActionConfigBean.DEFAULT_BACKOFF_INTERVAL_MS,
configValues.get("conf.responseTimeoutActionConfig.backoffInterval"));
assertEquals(HttpTimeoutResponseActionConfigBean.DEFAULT_ACTION,
configValues.get("conf.responseTimeoutActionConfig.action"));
List<Map<String, Object>> statusActions =
(List<Map<String, Object>>) configValues.get("conf.responseStatusActionConfigs");
Assert.assertEquals(1, statusActions.size());
Map<String, Object> defaultStatusAction = statusActions.get(0);
assertEquals(HttpResponseActionConfigBean.DEFAULT_MAX_NUM_RETRIES, defaultStatusAction.get("maxNumRetries"));
assertEquals(HttpResponseActionConfigBean.DEFAULT_BACKOFF_INTERVAL_MS, defaultStatusAction.get("backoffInterval"));
assertEquals(HttpStatusResponseActionConfigBean.DEFAULT_ACTION, defaultStatusAction.get("action"));
assertEquals(HttpStatusResponseActionConfigBean.DEFAULT_STATUS_CODE, defaultStatusAction.get("statusCode"));
}
@Test
public void testV10ToV11() throws Exception {
HttpClientSourceUpgrader upgrader = new HttpClientSourceUpgrader();
upgrader.upgrade("a", "b", "c", 10, 11, configs);
Map<String, Object> configValues = getConfigsAsMap(configs);
assertTrue(configValues.containsKey("conf.client.useOAuth2"));
Assert.assertEquals(false, configValues.get("conf.client.useOAuth2"));
}
@Test
public void testV11ToV12() throws Exception {
HttpClientSourceUpgrader upgrader = new HttpClientSourceUpgrader();
upgrader.upgrade("a", "b", "c", 11, 12, configs);
Map<String, Object> configValues = getConfigsAsMap(configs);
assertTrue(configValues.containsKey("conf.pagination.keepAllFields"));
Assert.assertEquals(false, configValues.get("conf.pagination.keepAllFields"));
}
@Test
public void testV12ToV13() throws Exception {
TlsConfigBeanUpgraderTestUtil.testHttpSslConfigBeanToTlsConfigBeanUpgrade("conf.client.",
new HttpClientSourceUpgrader(),
13
);
}
@Test
public void testV13ToV14() throws Exception {
HttpClientSourceUpgrader httpClientSourceUpgrader = new HttpClientSourceUpgrader();
httpClientSourceUpgrader.upgrade("lib", "stage", "inst", 13, 14, configs);
UpgraderTestUtils.assertAllExist(configs,
"conf.client.requestLoggingConfig.enableRequestLogging",
"conf.client.requestLoggingConfig.logLevel",
"conf.client.requestLoggingConfig.verbosity",
"conf.client.requestLoggingConfig.maxEntitySize"
);
for (Config config : configs) {
switch (config.getName()) {
case "conf.client.requestLoggingConfig.enableRequestLogging":
Assert.assertEquals(false, config.getValue());
break;
case "conf.client.requestLoggingConfig.logLevel":
Assert.assertEquals(JulLogLevelChooserValues.DEFAULT_LEVEL, config.getValue());
break;
case "conf.client.requestLoggingConfig.verbosity":
Assert.assertEquals(VerbosityChooserValues.DEFAULT_VERBOSITY, config.getValue());
break;
case "conf.client.requestLoggingConfig.maxEntitySize":
Assert.assertEquals(RequestLoggingConfigBean.DEFAULT_MAX_ENTITY_SIZE, config.getValue());
break;
default:
fail();
}
}
}
@Test
public void testV14ToV15() {
Mockito.doReturn(14).when(context).getFromVersion();
Mockito.doReturn(15).when(context).getToVersion();
String dataFormatPrefix = "conf.dataFormatConfig.";
configs.add(new Config(dataFormatPrefix + "preserveRootElement", true));
configs = upgrader.upgrade(configs, context);
UpgraderTestUtils.assertExists(configs, dataFormatPrefix + "preserveRootElement", false);
}
private static Map<String, Object> getConfigsAsMap(List<Config> configs) {
HashMap<String, Object> map = new HashMap<>();
for (Config c : configs) {
map.put(c.getName(), c.getValue());
}
return map;
}
}
|
package seedu.smartlib.logic.commands;
import static java.util.Objects.requireNonNull;
import static seedu.smartlib.logic.parser.CliSyntax.PREFIX_AUTHOR;
import static seedu.smartlib.logic.parser.CliSyntax.PREFIX_BOOK;
import static seedu.smartlib.logic.parser.CliSyntax.PREFIX_GENRE;
import static seedu.smartlib.logic.parser.CliSyntax.PREFIX_ISBN;
import static seedu.smartlib.logic.parser.CliSyntax.PREFIX_PUBLISHER;
import java.util.ArrayList;
import java.util.Random;
import seedu.smartlib.commons.core.name.Name;
import seedu.smartlib.logic.commands.exceptions.CommandException;
import seedu.smartlib.model.Model;
import seedu.smartlib.model.book.Barcode;
import seedu.smartlib.model.book.Book;
/**
* Adds a book to the registered book base.
*/
public class AddBookCommand extends Command {
public static final String COMMAND_WORD = "addbook";
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a book to SmartLib's booklist.\n"
+ "Parameters: "
+ PREFIX_BOOK + "BOOKNAME "
+ PREFIX_AUTHOR + "AUTHOR "
+ PREFIX_PUBLISHER + "PUBLISHER "
+ PREFIX_ISBN + "ISBN "
+ PREFIX_GENRE + "GENRE\n"
+ "Example: " + COMMAND_WORD + " "
+ PREFIX_BOOK + "Great Expectations "
+ PREFIX_AUTHOR + "Charles Dickens "
+ PREFIX_PUBLISHER + "Chapman Hall "
+ PREFIX_ISBN + "9780194241748 "
+ PREFIX_GENRE + "Novel ";
public static final String MESSAGE_SUCCESS = "New book added: %1$s";
public static final String MESSAGE_DUPLICATE_BOOK = "This book already exists in the book base.";
public static final String MESSAGE_DUPLICATE_ISBN = "The ISBN you entered exists in the book base but it has "
+ "a different book name. Please ensure that you have keyed in the correct book name and ISBN.";
private final Book bookWithTempBarcode;
/**
* Creates an AddBookCommand to add the specified book.
*
* @param bookWithTempBarcode the book to be added to SmartLib's book base.
*/
public AddBookCommand(Book bookWithTempBarcode) {
requireNonNull(bookWithTempBarcode);
this.bookWithTempBarcode = bookWithTempBarcode;
}
/**
* Verifies information of the new book to add, especially its isbn.
*
* @param model {@code Model} checks for matching isbn of books with same title.
* @throws CommandException if books of the same title have different ISBN.
*/
private void verifyBookInfo(Model model) throws CommandException {
requireNonNull(model);
if (model.hasBook(bookWithTempBarcode)) {
throw new CommandException(MESSAGE_DUPLICATE_BOOK);
}
if (model.hasBook(bookWithTempBarcode.getIsbn())) {
ArrayList<Book> booksWithIsbn = model.getBooksByIsbn(bookWithTempBarcode.getIsbn());
Name bookName = bookWithTempBarcode.getName();
for (Book b : booksWithIsbn) {
if (!b.getName().equals(bookName)) {
throw new CommandException(MESSAGE_DUPLICATE_ISBN);
}
}
}
}
/**
* Executes the command and returns the result message.
*
* @param model {@code Model} which the command should operate on.
* @return feedback message of the operation result for display.
* @throws CommandException if an error occurs during command execution.
*/
@Override
public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);
verifyBookInfo(model);
Barcode barcode = generateBarcode(model);
Book book = new Book(bookWithTempBarcode.getName(), bookWithTempBarcode.getAuthor(),
bookWithTempBarcode.getPublisher(), bookWithTempBarcode.getIsbn(),
barcode, bookWithTempBarcode.getGenre());
model.addBook(book);
return new CommandResult(String.format(MESSAGE_SUCCESS, book));
}
/**
* Generates an barcode to to distinguish between each book.
*
* @param model to check if the newly generated barcode has already be taken up by some book in SmartLib.
*/
private Barcode generateBarcode(Model model) {
Random random = new Random();
int rv = random.nextInt(Barcode.MAX_VALUE - Barcode.MIN_VALUE) + Barcode.MIN_VALUE;
while (model.hasBookWithBarcode(new Barcode(rv))) {
rv = random.nextInt(Barcode.MAX_VALUE - Barcode.MIN_VALUE) + Barcode.MIN_VALUE;
}
return new Barcode(rv);
}
/**
* Checks if this AddBookCommand is equal to another AddBookCommand.
*
* @param other the other AddBookCommand to be compared.
* @return true if this AddBookCommand is equal to the other AddBookCommand, and false otherwise.
*/
@Override
public boolean equals(Object other) {
return other == this // short circuit if same object
|| (other instanceof AddBookCommand // instanceof handles nulls
&& bookWithTempBarcode.equals(((AddBookCommand) other).bookWithTempBarcode));
}
}
|
package com.codepath.apps.restclienttemplate.models;
import org.json.JSONException;
import org.json.JSONObject;
import org.parceler.Parcel;
@Parcel
public class User {
// list the attributes
public String name;
public long uid;
public String screenName;
public String profileImageUrl;
public User(){}
// deserialize the JSON
public static User fromJSON(JSONObject json) throws JSONException{
User user = new User();
// extract and fill the values
user.name = json.getString("name");
user.uid = json.getLong("id");
user.screenName = json.getString("screen_name");
user.profileImageUrl = json.getString("profile_image_url");
return user;
}
}
|
/*
* Licensed to ElasticSearch and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. ElasticSearch licenses this
* file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.test.unit.index.fielddata;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.Index;
import org.elasticsearch.index.fielddata.FieldDataType;
import org.elasticsearch.index.fielddata.IndexFieldData;
import org.elasticsearch.index.fielddata.IndexFieldDataService;
import org.elasticsearch.index.fielddata.plain.*;
import org.elasticsearch.index.mapper.ContentPath;
import org.elasticsearch.index.mapper.FieldMapper;
import org.elasticsearch.index.mapper.Mapper.BuilderContext;
import org.elasticsearch.index.mapper.core.*;
import org.elasticsearch.test.ElasticsearchTestCase;
import java.util.Arrays;
public class IndexFieldDataServiceTests extends ElasticsearchTestCase {
private static Settings DOC_VALUES_SETTINGS = ImmutableSettings.builder().put(FieldDataType.FORMAT_KEY, FieldDataType.DOC_VALUES_FORMAT_VALUE).build();
@SuppressWarnings("unchecked")
public void testGetForFieldDefaults() {
final IndexFieldDataService ifdService = new IndexFieldDataService(new Index("test"));
for (boolean docValues : Arrays.asList(true, false)) {
final BuilderContext ctx = new BuilderContext(null, new ContentPath(1));
final StringFieldMapper stringMapper = new StringFieldMapper.Builder("string").tokenized(false).fieldDataSettings(docValues ? DOC_VALUES_SETTINGS : ImmutableSettings.EMPTY).build(ctx);
ifdService.clear();
IndexFieldData<?> fd = ifdService.getForField(stringMapper);
if (docValues) {
assertTrue(fd instanceof SortedSetDVBytesIndexFieldData);
} else {
assertTrue(fd instanceof PagedBytesIndexFieldData);
}
for (FieldMapper<?> mapper : Arrays.asList(
new ByteFieldMapper.Builder("int").fieldDataSettings(docValues ? DOC_VALUES_SETTINGS : ImmutableSettings.EMPTY).build(ctx),
new ShortFieldMapper.Builder("int").fieldDataSettings(docValues ? DOC_VALUES_SETTINGS : ImmutableSettings.EMPTY).build(ctx),
new IntegerFieldMapper.Builder("int").fieldDataSettings(docValues ? DOC_VALUES_SETTINGS : ImmutableSettings.EMPTY).build(ctx),
new LongFieldMapper.Builder("long").fieldDataSettings(docValues ? DOC_VALUES_SETTINGS : ImmutableSettings.EMPTY).build(ctx)
)) {
ifdService.clear();
fd = ifdService.getForField(mapper);
if (docValues) {
assertTrue(fd instanceof SortedSetDVNumericIndexFieldData);
} else {
assertTrue(fd instanceof PackedArrayIndexFieldData);
}
}
final FloatFieldMapper floatMapper = new FloatFieldMapper.Builder("float").fieldDataSettings(docValues ? DOC_VALUES_SETTINGS : ImmutableSettings.EMPTY).build(ctx);
ifdService.clear();
fd = ifdService.getForField(floatMapper);
if (docValues) {
assertTrue(fd instanceof SortedSetDVNumericIndexFieldData);
} else {
assertTrue(fd instanceof FloatArrayIndexFieldData);
}
final DoubleFieldMapper doubleMapper = new DoubleFieldMapper.Builder("double").fieldDataSettings(docValues ? DOC_VALUES_SETTINGS : ImmutableSettings.EMPTY).build(ctx);
ifdService.clear();
fd = ifdService.getForField(doubleMapper);
if (docValues) {
assertTrue(fd instanceof SortedSetDVNumericIndexFieldData);
} else {
assertTrue(fd instanceof DoubleArrayIndexFieldData);
}
}
}
@SuppressWarnings("unchecked")
public void testByPassDocValues() {
final IndexFieldDataService ifdService = new IndexFieldDataService(new Index("test"));
final BuilderContext ctx = new BuilderContext(null, new ContentPath(1));
final StringFieldMapper stringMapper = new StringFieldMapper.Builder("string").tokenized(false).fieldDataSettings(DOC_VALUES_SETTINGS).fieldDataSettings(ImmutableSettings.builder().put("format", "fst").build()).build(ctx);
ifdService.clear();
IndexFieldData<?> fd = ifdService.getForField(stringMapper);
assertTrue(fd instanceof FSTBytesIndexFieldData);
final Settings fdSettings = ImmutableSettings.builder().put("format", "array").build();
for (FieldMapper<?> mapper : Arrays.asList(
new ByteFieldMapper.Builder("int").fieldDataSettings(DOC_VALUES_SETTINGS).fieldDataSettings(fdSettings).build(ctx),
new ShortFieldMapper.Builder("int").fieldDataSettings(DOC_VALUES_SETTINGS).fieldDataSettings(fdSettings).build(ctx),
new IntegerFieldMapper.Builder("int").fieldDataSettings(DOC_VALUES_SETTINGS).fieldDataSettings(fdSettings).build(ctx),
new LongFieldMapper.Builder("long").fieldDataSettings(DOC_VALUES_SETTINGS).fieldDataSettings(fdSettings).build(ctx)
)) {
ifdService.clear();
fd = ifdService.getForField(mapper);
assertTrue(fd instanceof PackedArrayIndexFieldData);
}
final FloatFieldMapper floatMapper = new FloatFieldMapper.Builder("float").fieldDataSettings(DOC_VALUES_SETTINGS).fieldDataSettings(fdSettings).build(ctx);
ifdService.clear();
fd = ifdService.getForField(floatMapper);
assertTrue(fd instanceof FloatArrayIndexFieldData);
final DoubleFieldMapper doubleMapper = new DoubleFieldMapper.Builder("double").fieldDataSettings(DOC_VALUES_SETTINGS).fieldDataSettings(fdSettings).build(ctx);
ifdService.clear();
fd = ifdService.getForField(doubleMapper);
assertTrue(fd instanceof DoubleArrayIndexFieldData);
}
}
|
/*
* Copyright 2017 TWO SIGMA OPEN SOURCE, LLC
*
* 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.twosigma.beakerx.kernel.magic.command;
import com.twosigma.beakerx.kernel.magic.command.functionality.MagicCommandUtils;
import com.twosigma.beakerx.kernel.magic.command.outcome.MagicCommandOutcomeItem;
public interface MagicCommandFunctionality {
String USAGE_ERROR_MSG = "UsageError: %s is a cell magic, but the cell body is empty.";
String WRONG_FORMAT_MSG = "Wrong format. ";
MagicCommandOutcomeItem execute(MagicCommandExecutionParam param);
String getMagicCommandName();
default boolean matchCommand(String command){
String[] commandParts = MagicCommandUtils.splitPath(command);
return commandParts.length > 0 &&
getMagicCommandName().equals(commandParts[0]);
}
}
|
/*
* Process Services Enterprise API
* Provides access to the complete features provided by Alfresco Process Services powered by Activiti. You can use this API to integrate Alfresco Process Services with external applications.
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package org.activiti.engine.remote.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
/**
* OptionRepresentation
*/
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2018-09-26T11:35:07.343+01:00")
public class OptionRepresentation {
@SerializedName("id")
private String id = null;
@SerializedName("name")
private String name = null;
public OptionRepresentation id(String id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
**/
@ApiModelProperty(value = "")
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public OptionRepresentation name(String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
**/
@ApiModelProperty(value = "")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
OptionRepresentation optionRepresentation = (OptionRepresentation) o;
return Objects.equals(this.id, optionRepresentation.id) &&
Objects.equals(this.name, optionRepresentation.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class OptionRepresentation {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
|
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package frc.robot.calibrations;
/**
* Add your docs here.
*/
public class K_COMP {
/**************************************************/
/* Robot Compressor Configuration Calibrations */
/**************************************************/
/** KeCOMP_b_DebugEnbl: Compressor System Enable
* Calibration to send data to dashbord to debug.
*/
public static final boolean KeCOMP_b_DebugEnbl = true;
}
|
package com.soonsoft.uranus.security.simple;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import com.soonsoft.uranus.security.config.properties.SecurityProperties;
import com.soonsoft.uranus.security.simple.config.SimpleSecutityConfiguration;
import org.springframework.context.annotation.Import;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
@Import(value = {SimpleSecutityConfiguration.class, SecurityProperties.class})
public @interface EnableSimpleSecurity {
}
|
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.gradle.importing;
import com.intellij.openapi.externalSystem.service.project.manage.SourceFolderManager;
import com.intellij.openapi.externalSystem.service.project.manage.SourceFolderManagerImpl;
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ContentEntry;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.SourceFolder;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.testFramework.PlatformTestUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.java.JavaSourceRootType;
import org.jetbrains.jps.model.module.JpsModuleSourceRootType;
import org.jetbrains.plugins.gradle.GradleManager;
import org.jetbrains.plugins.gradle.settings.GradleProjectSettings;
import org.jetbrains.plugins.gradle.settings.GradleSettings;
import org.jetbrains.plugins.gradle.tooling.annotation.TargetVersions;
import org.jetbrains.plugins.gradle.util.GradleConstants;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import static com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil.doWriteAction;
import static com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil.getManager;
/**
* @author Vladislav.Soroka
*/
public class GradleFoldersImportingTest extends GradleImportingTestCase {
@Test
public void testUnsupportedTypesInDsl() throws Exception {
importProject(
new GradleBuildScriptBuilderEx().addPostfix(
"import org.gradle.api.internal.FactoryNamedDomainObjectContainer;",
"import org.gradle.internal.reflect.Instantiator;",
"class MyObj implements Named {",
" String myName;",
" public MyObj(String name) {",
" myName = namse",
" }",
" ",
" public String getName() {",
" return myName",
" }",
"}",
"project.extensions.create(",
" \"sourceSets\",",
" FactoryNamedDomainObjectContainer,",
" MyObj,",
" services.get(Instantiator),",
" {action -> }",
" ) ",
"sourceSets {",
" println \"Hello World!\"",
"}"
).generate());
}
@Test
public void testBaseJavaProject() throws Exception {
getCurrentExternalProjectSettings().setDelegatedBuild(false);
createDefaultDirs();
importProject(
"apply plugin: 'java'"
);
assertNotDelegatedBaseJavaProject();
getCurrentExternalProjectSettings().setResolveModulePerSourceSet(false);
importProject();
assertNotDelegatedMergedBaseJavaProject();
getCurrentExternalProjectSettings().setDelegatedBuild(true);
importProject();
assertDelegatedMergedBaseJavaProject();
getCurrentExternalProjectSettings().setDelegatedBuild(false);
// subscribe to the GradleSettings changes topic
((GradleManager)getManager(GradleConstants.SYSTEM_ID)).runActivity(myProject);
GradleSettings.getInstance(myProject).getPublisher().onBuildDelegationChange(false, getProjectPath());
assertNotDelegatedMergedBaseJavaProject();
getCurrentExternalProjectSettings().setResolveModulePerSourceSet(true);
importProject();
assertNotDelegatedBaseJavaProject();
getCurrentExternalProjectSettings().setDelegatedBuild(true);
GradleSettings.getInstance(myProject).getPublisher().onBuildDelegationChange(true, getProjectPath());
assertDelegatedBaseJavaProject();
}
private void assertNotDelegatedBaseJavaProject() {
assertModules("project", "project.main", "project.test");
assertContentRoots("project", getProjectPath());
assertDefaultGradleJavaProjectFolders("project");
final String mainClassesOutputPath = "/out/production/classes";
assertModuleOutputs("project.main",
getProjectPath() + mainClassesOutputPath,
getProjectPath() + "/out/production/resources");
String testClassesOutputPath = "/out/test/classes";
assertModuleOutputs("project.test",
getProjectPath() + testClassesOutputPath,
getProjectPath() + "/out/test/resources");
assertModuleOutput("project.main", getProjectPath() + mainClassesOutputPath, "");
assertModuleOutput("project.test", "", getProjectPath() + testClassesOutputPath);
}
private void assertDelegatedBaseJavaProject() {
assertModules("project", "project.main", "project.test");
assertContentRoots("project", getProjectPath());
if (isGradleNewerOrSameThen("4.0")) {
assertModuleOutputs("project.main",
getProjectPath() + "/build/classes/java/main",
getProjectPath() + "/build/resources/main");
assertModuleOutput("project.main", getProjectPath() + "/build/classes/java/main", "");
assertModuleOutputs("project.test",
getProjectPath() + "/build/classes/java/test",
getProjectPath() + "/build/resources/test");
assertModuleOutput("project.test", "", getProjectPath() + "/build/classes/java/test");
} else {
assertModuleOutputs("project.main",
getProjectPath() + "/build/classes/main",
getProjectPath() + "/build/resources/main");
assertModuleOutput("project.main", getProjectPath() + "/build/classes/main", "");
assertModuleOutputs("project.test",
getProjectPath() + "/build/classes/test",
getProjectPath() + "/build/resources/test");
assertModuleOutput("project.test", "", getProjectPath() + "/build/classes/test");
}
}
private void assertNotDelegatedMergedBaseJavaProject() {
assertModules("project");
assertDefaultGradleJavaProjectFoldersForMergedModule("project");
assertModuleOutputs("project",
getProjectPath() + "/out/production/classes",
getProjectPath() + "/out/production/resources",
getProjectPath() + "/out/test/classes",
getProjectPath() + "/out/test/resources");
assertModuleOutput("project", getProjectPath() + "/out/production/classes", getProjectPath() + "/out/test/classes");
}
private void assertDelegatedMergedBaseJavaProject() {
if (isGradleNewerOrSameThen("4.0")) {
assertModuleOutputs("project",
getProjectPath() + "/build/classes/java/main",
getProjectPath() + "/build/resources/main",
getProjectPath() + "/build/classes/java/test",
getProjectPath() + "/build/resources/test");
} else {
assertModuleOutputs("project",
getProjectPath() + "/build/classes/main",
getProjectPath() + "/build/resources/main",
getProjectPath() + "/build/classes/test",
getProjectPath() + "/build/resources/test");
}
}
@Test
public void testCompileOutputPathCustomizedWithIdeaPlugin() throws Exception {
createDefaultDirs();
importProject(
"apply plugin: 'java'\n" +
"apply plugin: 'idea'\n" +
"idea {\n" +
" module {\n" +
" outputDir = file(buildDir)\n" +
" }\n" +
"}"
);
assertModules("project", "project.main", "project.test");
assertContentRoots("project", getProjectPath());
assertDefaultGradleJavaProjectFolders("project");
assertModuleOutput("project.main", getProjectPath() + "/build", "");
String testClassesOutputPath = isGradleNewerOrSameThen("4.0") ? "/build/classes/java/test" : "/build/classes/test";
assertModuleOutput("project.test", "", getProjectPath() + testClassesOutputPath);
importProjectUsingSingeModulePerGradleProject();
assertModules("project");
assertContentRoots("project", getProjectPath());
assertDefaultGradleJavaProjectFoldersForMergedModule("project");
assertModuleOutput("project", getProjectPath() + "/build", getProjectPath() + testClassesOutputPath);
}
@Test
@TargetVersions("2.2+")
public void testSourceGeneratedFoldersWithIdeaPlugin() throws Exception {
createDefaultDirs();
importProject(
"apply plugin: 'java'\n" +
"apply plugin: 'idea'\n" +
"idea {\n" +
" module {\n" +
" generatedSourceDirs += file('src/main/java')\n" +
" generatedSourceDirs += file('src/test/java')\n" +
" }\n" +
"}"
);
assertModules("project", "project.main", "project.test");
assertContentRoots("project", getProjectPath());
assertDefaultGradleJavaProjectFolders("project");
assertGeneratedSources("project.main", "java");
assertGeneratedTestSources("project.test", "java");
importProjectUsingSingeModulePerGradleProject();
assertModules("project");
assertContentRoots("project", getProjectPath());
assertDefaultGradleJavaProjectFoldersForMergedModule("project");
assertGeneratedSources("project", "src/main/java");
assertGeneratedTestSources("project", "src/test/java");
}
@Test
public void testCustomSourceSetsAreImported() throws Exception {
createDefaultDirs();
createProjectSubFile("src/generated/java/G.java");
importProject("" +
"apply plugin: 'java'\n" +
"apply plugin: 'idea'\n" +
"\n" +
"sourceSets {\n" +
" generated\n" +
"}");
assertModules("project", "project.main", "project.test", "project.generated");
importProjectUsingSingeModulePerGradleProject();
assertSources("project", "src/generated/java", "src/main/java");
assertTestSources("project", "src/test/java");
}
@Test
@TargetVersions("4.7+")
public void testResourceFoldersWithIdeaPlugin() throws Exception {
createProjectSubDirs("src/main/java",
"src/main/src2",
"src/main/resources",
"src/main/resources2",
"src/test/java",
"src/test/src2",
"src/test/resources",
"src/test/resources2");
importProject(
"apply plugin: 'java'\n" +
"apply plugin: 'idea'\n" +
"idea {\n" +
" module {\n" +
" sourceDirs += file('src/main/src2')\n" +
" resourceDirs += file('src/main/resources2')\n" +
" testSourceDirs += file('src/test/src2')\n" +
" testResourceDirs += file('src/test/resources2')\n" +
" }\n" +
"}"
);
assertModules("project", "project.main", "project.test");
assertContentRoots("project", getProjectPath());
assertExcludes("project", ".gradle", "build");
assertContentRoots("project.main", getProjectPath() + "/src/main");
assertSources("project.main", "java", "src2");
assertResources("project.main", "resources", "resources2");
assertContentRoots("project.test", getProjectPath() + "/src/test");
assertTestSources("project.test", "java", "src2");
assertTestResources("project.test", "resources", "resources2");
importProjectUsingSingeModulePerGradleProject();
assertModules("project");
assertContentRoots("project", getProjectPath());
assertExcludes("project", ".gradle", "build");
assertSources("project", "src/main/java", "src/main/src2");
assertResources("project", "src/main/resources", "src/main/resources2");
assertTestSources("project", "src/test/java", "src/test/src2");
assertTestResources("project", "src/test/resources", "src/test/resources2");
}
@Test
@TargetVersions("4.7+")
public void testSourceFoldersTypeAfterReimport() throws Exception {
createProjectSubDirs("src/main/java",
"src/main/resources",
"src/test/java",
"src/test/src2",
"src/test/resources",
"src/test/resources2",
"src/customSourceSet/java",
"src/customSourceSet/resources");
importProject(
"apply plugin: 'java'\n" +
"apply plugin: 'idea'\n" +
"sourceSets {\n" +
" customSourceSet\n" +
"}\n" +
"idea {\n" +
" module {\n" +
" testSourceDirs += file('src/test/src2')\n" +
" testResourceDirs += file('src/test/resources2')\n" +
" testSourceDirs += project.sourceSets.customSourceSet.java.srcDirs\n" +
" testResourceDirs += project.sourceSets.customSourceSet.resources.srcDirs\n" +
" }\n" +
"}"
);
Runnable check = () -> {
assertModules("project", "project.main", "project.test", "project.customSourceSet");
assertContentRoots("project", getProjectPath());
assertExcludes("project", ".gradle", "build");
assertContentRoots("project.main", getProjectPath() + "/src/main");
assertSources("project.main", "java");
assertResources("project.main", "resources");
assertContentRoots("project.test", getProjectPath() + "/src/test");
assertTestSources("project.test", "java", "src2");
assertTestResources("project.test", "resources", "resources2");
assertContentRoots("project.customSourceSet", getProjectPath() + "/src/customSourceSet");
assertTestSources("project.customSourceSet", "java");
assertTestResources("project.customSourceSet", "resources");
};
check.run();
markModuleSourceFolders("project.customSourceSet", JavaSourceRootType.SOURCE);
importProject();
check.run();
}
private void markModuleSourceFolders(@NotNull String moduleName, @NotNull JpsModuleSourceRootType<?> rootType) {
doWriteAction(() -> {
Module module = getModule(moduleName);
final ModifiableRootModel model = ModuleRootManager.getInstance(module).getModifiableModel();
ContentEntry[] contentEntries = model.getContentEntries();
for (ContentEntry contentEntry : contentEntries) {
final SourceFolder[] sourceFolders = contentEntry.getSourceFolders();
for (SourceFolder sourceFolder : sourceFolders) {
VirtualFile folderFile = sourceFolder.getFile();
contentEntry.removeSourceFolder(sourceFolder);
contentEntry.addSourceFolder(folderFile, rootType);
}
}
model.commit();
});
}
@Test
public void testProjectWithInheritedOutputDirs() throws Exception {
createDefaultDirs();
importProject(
"apply plugin: 'java'\n" +
"apply plugin: 'idea'\n" +
"idea {\n" +
" module {\n" +
" inheritOutputDirs = true\n" +
" }\n" +
"}"
);
assertModules("project", "project.main", "project.test");
assertContentRoots("project", getProjectPath());
assertDefaultGradleJavaProjectFolders("project");
assertModuleInheritedOutput("project");
assertModuleInheritedOutput("project.main");
assertModuleInheritedOutput("project.test");
importProjectUsingSingeModulePerGradleProject();
assertModules("project");
assertContentRoots("project", getProjectPath());
assertDefaultGradleJavaProjectFoldersForMergedModule("project");
assertModuleInheritedOutput("project");
}
@Test
public void testSourceFoldersMerge() throws Exception {
createDefaultDirs();
createProjectSubFile("src/B.java");
createProjectSubFile("src/resources/res.properties");
createProjectSubFile("test/BTest.java");
createProjectSubFile("test/resources/res_test.properties");
importProject(
"apply plugin: 'java'\n" +
"sourceSets {\n" +
" main {\n" +
" resources.srcDir 'src/resources'\n" +
" java.srcDir 'src'\n" +
" }\n" +
" test {\n" +
" resources.srcDir 'test/resources'\n" +
" java.srcDir 'test'\n" +
" }\n" +
"}"
);
assertModules("project", "project.main", "project.test");
assertContentRoots("project", getProjectPath());
assertExcludes("project", ".gradle", "build");
final String mainSourceSetModuleName = "project.main";
assertContentRoots(mainSourceSetModuleName, getProjectPath() + "/src");
assertSources(mainSourceSetModuleName, "", "main/java");
assertResources(mainSourceSetModuleName, "main/resources", "resources");
final String testSourceSetModuleName = "project.test";
assertContentRoots(testSourceSetModuleName, getProjectPath() + "/test", getProjectPath() + "/src/test");
assertTestSources(testSourceSetModuleName, "src/test/java", "test");
assertTestResources(testSourceSetModuleName, "src/test/resources", "test/resources");
importProjectUsingSingeModulePerGradleProject();
assertModules("project");
assertContentRoots("project", getProjectPath());
assertExcludes("project", ".gradle", "build");
assertSources("project", "src", "src/main/java");
assertResources("project", "src/main/resources", "src/resources");
assertTestSources("project", "src/test/java", "test");
assertTestResources("project", "src/test/resources", "test/resources");
}
@Test
public void testRootsAreNotCreatedIfFilesAreMissing() throws Exception {
createProjectSubFile("src/main/java/A.java");
createProjectSubFile("src/test/resources/res.properties");
importProjectUsingSingeModulePerGradleProject(
"apply plugin: 'java'\n" +
"apply plugin: 'idea'\n" +
"sourceSets.main.java.srcDirs file('src/generated/java')\n" +
"idea.module {\n" +
" generatedSourceDirs += file('src/generated/java')\n" +
"}"
);
assertModules("project");
assertExcludes("project", ".gradle", "build");
assertSources("project", "src/main/java");
assertResources("project");
assertTestSources("project");
assertGeneratedSources("project");
assertTestResources("project", "src/test/resources");
}
@Test
public void testRootsAreAddedWhenAFolderCreated() throws Exception {
createProjectSubFile("src/main/java/A.java");
importProjectUsingSingeModulePerGradleProject( "apply plugin: 'java'\n" +
"apply plugin: 'idea'\n" +
"sourceSets.main.java.srcDirs file('src/generated/java')\n" +
"idea.module {\n" +
" generatedSourceDirs += file('src/generated/java')\n" +
"}");
assertModules("project");
assertSources("project", "src/main/java");
assertTestSources("project");
createProjectSubFile("src/test/java/ATest.java");
waitForModulesUpdate();
assertTestSources("project", "src/test/java");
createProjectSubFile("src/main/resources/res.txt");
waitForModulesUpdate();
assertResources("project", "src/main/resources");
createProjectSubFile("src/generated/java/Generated.java");
waitForModulesUpdate();
assertGeneratedSources("project","src/generated/java");
}
@Test
public void testRootsListenersAreUpdatedWithProjectModel() throws Exception {
createProjectSubFile("src/main/java/A.java");
importProjectUsingSingeModulePerGradleProject("apply plugin: 'java'");
assertModules("project");
importProjectUsingSingeModulePerGradleProject(
"apply plugin: 'java'\n" +
"sourceSets {\n" +
" test {\n" +
" java.srcDirs = [file('test-src/java')]" +
" }\n" +
"}");
createProjectSubFile("src/test/java/ATest.java");
createProjectSubFile("test-src/java/BTest.java");
waitForModulesUpdate();
assertTestSources("project", "test-src/java");
}
@Test
public void testSourceAndResourceFoldersCollision() throws Exception {
createProjectSubFile("src/A.java");
createProjectSubFile("src/production.properties");
createProjectSubFile("test/Test.java");
createProjectSubFile("test/test.properties");
importProject("apply plugin: 'java'\n" +
"sourceSets {\n" +
" main {\n" +
" java {\n" +
" srcDir 'src'\n" +
" }\n" +
" resources {\n" +
" srcDir 'src'\n" +
" }\n" +
" }\n" +
" test {\n" +
" java {\n" +
" srcDir 'test'\n" +
" }\n" +
" resources {\n" +
" srcDir 'test'\n" +
" }\n" +
" }\n" +
"}\n");
assertModules("project", "project.main", "project.test");
assertSources("project.main", "");
// assert relative to linked project path because several content roots are created for "project.test" module
assertTestSources("project.test", "test");
importProjectUsingSingeModulePerGradleProject();
assertModules("project");
assertContentRoots("project", getProjectPath());
assertSources("project", "src");
assertTestSources("project", "test");
assertResources("project");
assertTestResources("project");
}
@Test
public void testModuleGroupingFollowGradleProjectStructure() throws Exception {
/*
- Gradle project hierarchy
project
\--- project1
\--- project2
\--- project3
- Folder hierarchy
project
\--- project1
| \--- project2
\--- project3
\--- src
\--- main
\--- test
*/
createProjectSubFile("settings.gradle"
, "include (':project1', ':project1:project2', ':project1:project3')\n" +
"project(':project1:project3').projectDir = file('project3')\n" +
"rootProject.name = 'rootName'");
createProjectSubFile("build.gradle",
"project(':').group = 'my.test.rootProject.group'\n" +
"project(':project1').group = 'my.test.project1.group'\n" +
"project(':project1:project2').group = 'my.test.project2.group'\n" +
"project(':project1:project3').group = 'my.test.project3.group'");
createProjectSubFile("project1/build.gradle");
createProjectSubFile("project1/project2/build.gradle");
createProjectSubFile("project3/build.gradle", "apply plugin: 'java'");
createProjectSubFile("project3/src/main/java/AClass.java");
createProjectSubFile("project3/src/test/java/AClassTest.java");
importProject();
assertModules("rootName",
"rootName.project1",
"rootName.project1.project2",
"rootName.project1.project3",
"rootName.project1.project3.main",
"rootName.project1.project3.test");
assertContentRoots("rootName.project1.project3",
FileUtil.toSystemIndependentName(new File(getProjectPath(), "project3").getAbsolutePath()));
getCurrentExternalProjectSettings().setUseQualifiedModuleNames(false);
importProject();
assertModules("rootName",
"project1",
"project2",
"project3",
"project3_main",
"project3_test");
assertContentRoots("project3",
FileUtil.toSystemIndependentName(new File(getProjectPath(), "project3").getAbsolutePath()));
assertModuleGroupPath("rootName", "rootName");
assertModuleGroupPath("project1", "rootName", "project1");
assertModuleGroupPath("project2", "rootName", "project1", "project2");
assertModuleGroupPath("project3", "rootName", "project1", "project3");
}
@Test
public void testSourceFoldersOutOfContentRootWithModuleResolving() throws Exception {
createProjectSubFile("src/main/java/A.java", "class A {}");
createProjectSubFile("../outer1/src/main/java/A.java", "class A {}");
createProjectSubFile("../outer1/src/main/kotlin/A.kt", "class A {}");
createProjectSubFile("../outer2/src/main/java/A.java", "class A {}");
createProjectSubFile("../outer3/A.java", "class A {}");
createProjectSubFile("build/generated/A.java", "class A {}");
createProjectSubFile("../outer4/generated/A.java", "class A {}");
GradleBuildScriptBuilder buildScript = new GradleBuildScriptBuilderEx()
.withJavaPlugin()
.withIdeaPlugin()
.addPrefix("sourceSets {")
.addPrefix(" generated.java.srcDirs += \"${buildDir}/generated\"")
.addPrefix(" generated.java.srcDirs += '../outer4/generated'")
.addPrefix(" main.java.srcDirs += '../outer1/src/main/java'")
.addPrefix(" main.java.srcDirs += '../outer1/src/main/kotlin'")
.addPrefix(" main.java.srcDirs += '../outer2/src/main/java'")
.addPrefix(" main.java.srcDirs += '../outer3'")
.addPrefix("}")
.addPrefix("idea {")
.addPrefix(" module {")
.addPrefix(" inheritOutputDirs = true")
.addPrefix(" generatedSourceDirs += file(\"${buildDir}/generated\")")
.addPrefix(" generatedSourceDirs += file('../outer4/generated')")
.addPrefix(" }")
.addPrefix("}");
importPerSourceSet(true);
importProject(buildScript.generate());
assertModules("project", "project.main", "project.test", "project.generated");
assertContentEntryExists("project", "");
assertContentEntryExists("project.main",
"../outer1",
"../outer2",
"../outer3");
assertContentEntryExists("project.generated",
"build/generated",
"../outer4");
assertSourceExists("project.main",
"src/main/java",
"../outer1/src/main/java",
"../outer1/src/main/kotlin",
"../outer2/src/main/java",
"../outer3");
assertSourceExists("project.generated",
"build/generated",
"../outer4/generated");
}
@Test
public void testSourceFoldersOutOfContentRootWithoutModuleResolving() throws Exception {
createProjectSubFile("src/main/java/A.java", "class A {}");
createProjectSubFile("../outer1/src/main/java/A.java", "class A {}");
createProjectSubFile("../outer1/src/main/kotlin/A.kt", "class A {}");
createProjectSubFile("../outer2/src/main/java/A.java", "class A {}");
createProjectSubFile("../outer3/A.java", "class A {}");
createProjectSubFile("build/generated/A.java", "class A {}");
createProjectSubFile("../outer4/generated/A.java", "class A {}");
GradleBuildScriptBuilder buildScript = new GradleBuildScriptBuilderEx()
.withJavaPlugin()
.withIdeaPlugin()
.addPrefix("sourceSets {")
.addPrefix(" generated.java.srcDirs += \"${buildDir}/generated\"")
.addPrefix(" generated.java.srcDirs += '../outer4/generated'")
.addPrefix(" main.java.srcDirs += '../outer1/src/main/java'")
.addPrefix(" main.java.srcDirs += '../outer1/src/main/kotlin'")
.addPrefix(" main.java.srcDirs += '../outer2/src/main/java'")
.addPrefix(" main.java.srcDirs += '../outer3'")
.addPrefix("}")
.addPrefix("idea {")
.addPrefix(" module {")
.addPrefix(" inheritOutputDirs = true")
.addPrefix(" generatedSourceDirs += file(\"${buildDir}/generated\")")
.addPrefix(" generatedSourceDirs += file('../outer4/generated')")
.addPrefix(" }")
.addPrefix("}");
importPerSourceSet(false);
importProject(buildScript.generate());
assertModules("project");
assertContentEntryExists("project",
"",
"../outer1/src/main/java",
"../outer1/src/main/kotlin",
"../outer2",
"../outer3",
"build/generated",
"../outer4");
assertSourceExists("project",
"src/main/java",
"../outer1/src/main/java",
"../outer1/src/main/kotlin",
"../outer2/src/main/java",
"../outer3",
"build/generated",
"../outer4/generated");
}
@Test
public void testSharedSourceFolders() throws Exception {
createProjectSubFile("settings.gradle", "include 'app1', 'app2'");
createProjectSubFile("shared/resources/resource.txt");
createProjectSubFile("app1/build.gradle", new GradleBuildScriptBuilderEx()
.withJavaPlugin()
.addPostfix(
"sourceSets {",
" main.resources.srcDir '../shared/resources'",
" }"
)
.generate());
createProjectSubFile("app2/build.gradle", new GradleBuildScriptBuilderEx()
.withJavaPlugin()
.addPostfix(
"sourceSets {",
" main.resources.srcDir '../shared/resources'",
" }"
)
.generate());
importPerSourceSet(false);
importProject("");
assertModules("project", "project.app1", "project.app2");
if (isGradleOlderThen("3.4")) {
assertResources("project.app1");
assertResources("project.app2", getProjectPath() + "/shared/resources");
} else {
assertResources("project.app1", getProjectPath() + "/shared/resources");
assertResources("project.app2");
}
}
protected void assertDefaultGradleJavaProjectFolders(@NotNull String mainModuleName) {
boolean isDelegatedBuild = GradleProjectSettings.isDelegatedBuildEnabled(myProject, getProjectPath());
String[] excludes = isDelegatedBuild ? new String[]{".gradle", "build"} : new String[]{".gradle", "build", "out"};
assertExcludes(mainModuleName, excludes);
final String mainSourceSetModuleName = mainModuleName + ".main";
assertContentRoots(mainSourceSetModuleName, getProjectPath() + "/src/main");
assertSources(mainSourceSetModuleName, "java");
assertResources(mainSourceSetModuleName, "resources");
final String testSourceSetModuleName = mainModuleName + ".test";
assertContentRoots(testSourceSetModuleName, getProjectPath() + "/src/test");
assertTestSources(testSourceSetModuleName, "java");
assertTestResources(testSourceSetModuleName, "resources");
}
protected void assertDefaultGradleJavaProjectFoldersForMergedModule(@NotNull String moduleName) {
assertContentRoots(moduleName, getProjectPath());
boolean isDelegatedBuild = GradleProjectSettings.isDelegatedBuildEnabled(myProject, getProjectPath());
String[] excludes = isDelegatedBuild ? new String[]{".gradle", "build"} : new String[]{".gradle", "build", "out"};
assertExcludes(moduleName, excludes);
assertSources(moduleName, "src/main/java");
assertResources(moduleName, "src/main/resources");
assertTestSources(moduleName, "src/test/java");
assertTestResources(moduleName, "src/test/resources");
}
private void createDefaultDirs() throws IOException {
createProjectSubFile("src/main/java/A.java");
createProjectSubFile("src/test/java/A.java");
createProjectSubFile("src/main/resources/resource.properties");
createProjectSubFile("src/test/resources/test_resource.properties");
}
private void assertTestSources(Project project, String moduleName, String... expected) {
final Module fooModule = getModule(project, moduleName);
final ContentEntry[] contentRoots = ModuleRootManager.getInstance(fooModule).getContentEntries();
String rootUrl = contentRoots.length > 1 ? ExternalSystemApiUtil.getExternalProjectPath(fooModule) : null;
doAssertContentFolders(rootUrl, contentRoots, JavaSourceRootType.TEST_SOURCE, expected);
}
@Nullable
protected ContentEntry findContentEntry(@NotNull String moduleName, @NotNull String contentPath) {
ModuleRootManager moduleRootManager = getRootManager(moduleName);
Module module = moduleRootManager.getModule();
String rootPath = getAbsolutePath(ExternalSystemApiUtil.getExternalProjectPath(module));
String expectedContentPath = getAbsolutePath(rootPath + "/" + contentPath);
ContentEntry[] contentEntries = moduleRootManager.getContentEntries();
for (ContentEntry contentEntry : contentEntries) {
String actualContentPath = getAbsolutePath(contentEntry.getUrl());
if (actualContentPath.equals(expectedContentPath)) return contentEntry;
}
return null;
}
protected void assertContentEntryExists(@NotNull String moduleName, String @NotNull ... contentPaths) {
for (String contentPath : contentPaths) {
ContentEntry contentEntry = findContentEntry(moduleName, contentPath);
assertNotNull("Content entry " + contentPath + " not found in module " + moduleName, contentEntry);
}
}
protected void assertSourceExists(@NotNull String moduleName, String @NotNull ... sourcePaths) {
for (String sourcePath : sourcePaths) {
SourceFolder sourceFolder = findSource(moduleName, sourcePath);
assertNotNull("Source folder " + sourcePath + " not found in module " + moduleName, sourceFolder);
}
}
protected void importPerSourceSet(boolean b) {
getCurrentExternalProjectSettings().setResolveModulePerSourceSet(b);
}
protected void waitForModulesUpdate() throws Exception {
edt(() -> {
((SourceFolderManagerImpl)SourceFolderManager.getInstance(myProject)).consumeBulkOperationsState(future -> {
PlatformTestUtil.waitForFuture(future, 1000);
return null;
});
});
}
}
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.phoenix.end2end;
import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.sql.Connection;
import java.sql.Date;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Properties;
import org.apache.phoenix.util.PropertiesUtil;
import org.junit.Test;
public class OrderByIT extends BaseOrderByIT {
@Test
public void testOrderByWithPosition() throws Exception {
Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
Connection conn = DriverManager.getConnection(getUrl(), props);
conn.setAutoCommit(false);
try {
String tableName = generateUniqueName();
String ddl = "CREATE TABLE " + tableName +
" (a_string varchar not null, col1 integer" +
" CONSTRAINT pk PRIMARY KEY (a_string))\n";
createTestTable(getUrl(), ddl);
String dml = "UPSERT INTO " + tableName + " VALUES(?, ?)";
PreparedStatement stmt = conn.prepareStatement(dml);
stmt.setString(1, "a");
stmt.setInt(2, 40);
stmt.execute();
stmt.setString(1, "b");
stmt.setInt(2, 20);
stmt.execute();
stmt.setString(1, "c");
stmt.setInt(2, 30);
stmt.execute();
conn.commit();
String query = "select count(*), col1 from " + tableName + " group by col1 order by 2";
ResultSet rs = conn.createStatement().executeQuery(query);
assertTrue(rs.next());
assertEquals(1,rs.getInt(1));
assertTrue(rs.next());
assertEquals(1,rs.getInt(1));
assertTrue(rs.next());
assertEquals(1,rs.getInt(1));
assertFalse(rs.next());
query = "select a_string x, col1 y from " + tableName + " order by x";
rs = conn.createStatement().executeQuery(query);
assertTrue(rs.next());
assertEquals("a",rs.getString(1));
assertEquals(40,rs.getInt(2));
assertTrue(rs.next());
assertEquals("b",rs.getString(1));
assertEquals(20,rs.getInt(2));
assertTrue(rs.next());
assertEquals("c",rs.getString(1));
assertEquals(30,rs.getInt(2));
assertFalse(rs.next());
query = "select * from " + tableName + " order by 2";
rs = conn.createStatement().executeQuery(query);
assertTrue(rs.next());
assertEquals("b",rs.getString(1));
assertEquals(20,rs.getInt(2));
assertTrue(rs.next());
assertEquals("c",rs.getString(1));
assertEquals(30,rs.getInt(2));
assertTrue(rs.next());
assertEquals("a",rs.getString(1));
assertEquals(40,rs.getInt(2));
assertFalse(rs.next());
} finally {
conn.close();
}
}
@Test
public void testOrderByWithJoin() throws Exception {
Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
Connection conn = DriverManager.getConnection(getUrl(), props);
conn.setAutoCommit(false);
try {
String tableName1 = generateUniqueName();
String ddl = "CREATE TABLE " + tableName1 +
" (a_string varchar not null, cf1.a integer, cf1.b varchar, col1 integer, cf2.c varchar, cf2.d integer " +
" CONSTRAINT pk PRIMARY KEY (a_string))\n";
createTestTable(getUrl(), ddl);
String dml = "UPSERT INTO " + tableName1 + " VALUES(?,?,?,?,?,?)";
PreparedStatement stmt = conn.prepareStatement(dml);
stmt.setString(1, "a");
stmt.setInt(2, 40);
stmt.setString(3, "aa");
stmt.setInt(4, 10);
stmt.setString(5, "bb");
stmt.setInt(6, 20);
stmt.execute();
stmt.setString(1, "c");
stmt.setInt(2, 30);
stmt.setString(3, "cc");
stmt.setInt(4, 50);
stmt.setString(5, "dd");
stmt.setInt(6, 60);
stmt.execute();
stmt.setString(1, "b");
stmt.setInt(2, 40);
stmt.setString(3, "bb");
stmt.setInt(4, 5);
stmt.setString(5, "aa");
stmt.setInt(6, 80);
stmt.execute();
conn.commit();
String tableName2 = generateUniqueName();
ddl = "CREATE TABLE " + tableName2 +
" (a_string varchar not null, col1 integer" +
" CONSTRAINT pk PRIMARY KEY (a_string))\n";
createTestTable(getUrl(), ddl);
dml = "UPSERT INTO " + tableName2 + " VALUES(?, ?)";
stmt = conn.prepareStatement(dml);
stmt.setString(1, "a");
stmt.setInt(2, 40);
stmt.execute();
stmt.setString(1, "b");
stmt.setInt(2, 20);
stmt.execute();
stmt.setString(1, "c");
stmt.setInt(2, 30);
stmt.execute();
conn.commit();
String query = "select t1.* from " + tableName1 + " t1 join " + tableName2 + " t2 on t1.a_string = t2.a_string order by 3";
ResultSet rs = conn.createStatement().executeQuery(query);
assertTrue(rs.next());
assertEquals("a",rs.getString(1));
assertEquals(40,rs.getInt(2));
assertEquals("aa",rs.getString(3));
assertEquals(10,rs.getInt(4));
assertEquals("bb",rs.getString(5));
assertEquals(20,rs.getInt(6));
assertTrue(rs.next());
assertEquals("b",rs.getString(1));
assertEquals(40,rs.getInt(2));
assertEquals("bb",rs.getString(3));
assertEquals(5,rs.getInt(4));
assertEquals("aa",rs.getString(5));
assertEquals(80,rs.getInt(6));
assertTrue(rs.next());
assertEquals("c",rs.getString(1));
assertEquals(30,rs.getInt(2));
assertEquals("cc",rs.getString(3));
assertEquals(50,rs.getInt(4));
assertEquals("dd",rs.getString(5));
assertEquals(60,rs.getInt(6));
assertFalse(rs.next());
query = "select t1.a_string, t2.col1 from " + tableName1 + " t1 join " + tableName2 + " t2 on t1.a_string = t2.a_string order by 2";
rs = conn.createStatement().executeQuery(query);
assertTrue(rs.next());
assertEquals("b",rs.getString(1));
assertEquals(20,rs.getInt(2));
assertTrue(rs.next());
assertEquals("c",rs.getString(1));
assertEquals(30,rs.getInt(2));
assertTrue(rs.next());
assertEquals("a",rs.getString(1));
assertEquals(40,rs.getInt(2));
assertFalse(rs.next());
} finally {
conn.close();
}
}
@Test
public void testOrderByWithUnionAll() throws Exception {
Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
Connection conn = DriverManager.getConnection(getUrl(), props);
conn.setAutoCommit(false);
try {
String tableName1 = generateUniqueName();
String ddl = "CREATE TABLE " + tableName1 +
" (a_string varchar not null, cf1.a integer, cf1.b varchar, col1 integer, cf2.c varchar, cf2.d integer " +
" CONSTRAINT pk PRIMARY KEY (a_string))\n";
createTestTable(getUrl(), ddl);
String dml = "UPSERT INTO " + tableName1 + " VALUES(?,?,?,?,?,?)";
PreparedStatement stmt = conn.prepareStatement(dml);
stmt.setString(1, "a");
stmt.setInt(2, 40);
stmt.setString(3, "aa");
stmt.setInt(4, 10);
stmt.setString(5, "bb");
stmt.setInt(6, 20);
stmt.execute();
stmt.setString(1, "c");
stmt.setInt(2, 30);
stmt.setString(3, "cc");
stmt.setInt(4, 50);
stmt.setString(5, "dd");
stmt.setInt(6, 60);
stmt.execute();
stmt.setString(1, "b");
stmt.setInt(2, 40);
stmt.setString(3, "bb");
stmt.setInt(4, 5);
stmt.setString(5, "aa");
stmt.setInt(6, 80);
stmt.execute();
conn.commit();
String tableName2 = generateUniqueName();
ddl = "CREATE TABLE " + tableName2 +
" (a_string varchar not null, col1 integer" +
" CONSTRAINT pk PRIMARY KEY (a_string))\n";
createTestTable(getUrl(), ddl);
dml = "UPSERT INTO " + tableName2 + " VALUES(?, ?)";
stmt = conn.prepareStatement(dml);
stmt.setString(1, "aa");
stmt.setInt(2, 40);
stmt.execute();
stmt.setString(1, "bb");
stmt.setInt(2, 10);
stmt.execute();
stmt.setString(1, "cc");
stmt.setInt(2, 30);
stmt.execute();
conn.commit();
String query = "select a_string, cf2.d from " + tableName1 + " union all select * from " + tableName2 + " order by 2";
ResultSet rs = conn.createStatement().executeQuery(query);
assertTrue(rs.next());
assertEquals("bb",rs.getString(1));
assertEquals(10,rs.getInt(2));
assertTrue(rs.next());
assertEquals("a",rs.getString(1));
assertEquals(20,rs.getInt(2));
assertTrue(rs.next());
assertEquals("cc",rs.getString(1));
assertEquals(30,rs.getInt(2));
assertTrue(rs.next());
assertEquals("aa",rs.getString(1));
assertEquals(40,rs.getInt(2));
assertTrue(rs.next());
assertEquals("c",rs.getString(1));
assertEquals(60,rs.getInt(2));
assertTrue(rs.next());
assertEquals("b",rs.getString(1));
assertEquals(80,rs.getInt(2));
assertFalse(rs.next());
} finally {
conn.close();
}
}
@Test
public void testOrderByWithExpression() throws Exception {
Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
Connection conn = DriverManager.getConnection(getUrl(), props);
conn.setAutoCommit(false);
try {
String tableName = generateUniqueName();
String ddl = "CREATE TABLE " + tableName +
" (a_string varchar not null, col1 integer, col2 integer, col3 timestamp, col4 varchar" +
" CONSTRAINT pk PRIMARY KEY (a_string))\n";
createTestTable(getUrl(), ddl);
Date date = new Date(System.currentTimeMillis());
String dml = "UPSERT INTO " + tableName + " VALUES(?, ?, ?, ?, ?)";
PreparedStatement stmt = conn.prepareStatement(dml);
stmt.setString(1, "a");
stmt.setInt(2, 40);
stmt.setInt(3, 20);
stmt.setDate(4, new Date(date.getTime()));
stmt.setString(5, "xxyy");
stmt.execute();
stmt.setString(1, "b");
stmt.setInt(2, 50);
stmt.setInt(3, 30);
stmt.setDate(4, new Date(date.getTime()-500));
stmt.setString(5, "yyzz");
stmt.execute();
stmt.setString(1, "c");
stmt.setInt(2, 60);
stmt.setInt(3, 20);
stmt.setDate(4, new Date(date.getTime()-300));
stmt.setString(5, "ddee");
stmt.execute();
conn.commit();
String query = "SELECT col1+col2, col4, a_string FROM " + tableName + " ORDER BY 1, 2";
ResultSet rs = conn.createStatement().executeQuery(query);
assertTrue(rs.next());
assertEquals("a", rs.getString(3));
assertTrue(rs.next());
assertEquals("c", rs.getString(3));
assertTrue(rs.next());
assertEquals("b", rs.getString(3));
assertFalse(rs.next());
} catch (SQLException e) {
} finally {
conn.close();
}
}
@Test
public void testOrderByRVC() throws Exception {
Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
Connection conn = DriverManager.getConnection(getUrl(), props);
String tableName = generateUniqueName();
String ddl = "create table " + tableName + " (testpk varchar not null primary key, l_quantity decimal(15,2), l_discount decimal(15,2))";
conn.createStatement().execute(ddl);
PreparedStatement stmt = conn.prepareStatement("upsert into " + tableName + " values ('a',0.1,0.9)");
stmt.execute();
stmt = conn.prepareStatement(" upsert into " + tableName + " values ('b',0.5,0.5)");
stmt.execute();
stmt = conn.prepareStatement(" upsert into " + tableName + " values ('c',0.9,0.1)");
stmt.execute();
conn.commit();
ResultSet rs;
stmt = conn.prepareStatement("select l_discount,testpk from " + tableName + " order by (l_discount,l_quantity)");
rs = stmt.executeQuery();
assertTrue(rs.next());
assertEquals(0.1, rs.getDouble(1), 0.01);
assertEquals("c", rs.getString(2));
assertTrue(rs.next());
assertEquals(0.5, rs.getDouble(1), 0.01);
assertEquals("b", rs.getString(2));
assertTrue(rs.next());
assertEquals(0.9, rs.getDouble(1), 0.01);
assertEquals("a", rs.getString(2));
}
@Test
public void testColumnFamily() throws Exception {
Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
Connection conn = DriverManager.getConnection(getUrl(), props);
conn.setAutoCommit(false);
try {
String tableName = generateUniqueName();
String ddl = "CREATE TABLE " + tableName +
" (a_string varchar not null, cf1.a integer, cf1.b varchar, col1 integer, cf2.c varchar, cf2.d integer, col2 integer" +
" CONSTRAINT pk PRIMARY KEY (a_string))\n";
createTestTable(getUrl(), ddl);
String dml = "UPSERT INTO " + tableName + " VALUES(?,?,?,?,?,?,?)";
PreparedStatement stmt = conn.prepareStatement(dml);
stmt.setString(1, "a");
stmt.setInt(2, 40);
stmt.setString(3, "aa");
stmt.setInt(4, 10);
stmt.setString(5, "bb");
stmt.setInt(6, 20);
stmt.setInt(7, 1);
stmt.execute();
stmt.setString(1, "c");
stmt.setInt(2, 30);
stmt.setString(3, "cc");
stmt.setInt(4, 50);
stmt.setString(5, "dd");
stmt.setInt(6, 60);
stmt.setInt(7, 3);
stmt.execute();
stmt.setString(1, "b");
stmt.setInt(2, 40);
stmt.setString(3, "bb");
stmt.setInt(4, 5);
stmt.setString(5, "aa");
stmt.setInt(6, 80);
stmt.setInt(7, 2);
stmt.execute();
conn.commit();
String query = "select * from " + tableName + " order by 2, 5";
ResultSet rs = conn.createStatement().executeQuery(query);
assertTrue(rs.next());
assertEquals("c",rs.getString(1));
assertEquals(30,rs.getInt(2));
assertEquals("cc",rs.getString(3));
assertEquals(50,rs.getInt(4));
assertEquals("dd",rs.getString(5));
assertEquals(60,rs.getInt(6));
assertEquals(3,rs.getInt(7));
assertTrue(rs.next());
assertEquals("b",rs.getString(1));
assertEquals(40,rs.getInt(2));
assertEquals("bb",rs.getString(3));
assertEquals(5,rs.getInt(4));
assertEquals("aa",rs.getString(5));
assertEquals(80,rs.getInt(6));
assertEquals(2,rs.getInt(7));
assertTrue(rs.next());
assertEquals("a",rs.getString(1));
assertEquals(40,rs.getInt(2));
assertEquals("aa",rs.getString(3));
assertEquals(10,rs.getInt(4));
assertEquals("bb",rs.getString(5));
assertEquals(20,rs.getInt(6));
assertEquals(1,rs.getInt(7));
assertFalse(rs.next());
query = "select * from " + tableName + " order by 7";
rs = conn.createStatement().executeQuery(query);
assertTrue(rs.next());
assertEquals("a",rs.getString(1));
assertEquals(40,rs.getInt(2));
assertEquals("aa",rs.getString(3));
assertEquals(10,rs.getInt(4));
assertEquals("bb",rs.getString(5));
assertEquals(20,rs.getInt(6));
assertEquals(1,rs.getInt(7));
assertTrue(rs.next());
assertEquals("b",rs.getString(1));
assertEquals(40,rs.getInt(2));
assertEquals("bb",rs.getString(3));
assertEquals(5,rs.getInt(4));
assertEquals("aa",rs.getString(5));
assertEquals(80,rs.getInt(6));
assertEquals(2,rs.getInt(7));
assertTrue(rs.next());
assertEquals("c",rs.getString(1));
assertEquals(30,rs.getInt(2));
assertEquals("cc",rs.getString(3));
assertEquals(50,rs.getInt(4));
assertEquals("dd",rs.getString(5));
assertEquals(60,rs.getInt(6));
assertEquals(3,rs.getInt(7));
assertFalse(rs.next());
} finally {
conn.close();
}
}
}
|
package com.goldze.mvvmhabit.ui.vp_frg;
import android.support.v4.app.Fragment;
import com.goldze.mvvmhabit.R;
import com.goldze.mvvmhabit.ui.base.fragment.BasePagerFragment;
import com.goldze.mvvmhabit.ui.network.NetWorkFragment;
import com.goldze.mvvmhabit.ui.tab_bar.fragment.ChatListFragment;
import com.goldze.mvvmhabit.ui.tab_bar.fragment.LeaveFragment;
import com.goldze.mvvmhabit.ui.tab_bar.fragment.my.MyFragment;
import java.util.ArrayList;
import java.util.List;
/**
* Create Author:goldze
* Create Date:2019/01/25
* Description:ViewPager+Fragment的实现
*/
public class ViewPagerGroupFragment extends BasePagerFragment {
@Override
protected List<Fragment> pagerFragment() {
List<Fragment> list = new ArrayList<>();
list.add(new LeaveFragment());
list.add(new ChatListFragment());
list.add(new MyFragment());
return list;
}
@Override
protected List<String> pagerTitleString() {
List<String> list = new ArrayList<>();
list.add("请假");
list.add("聊天");
list.add("我的");
return list;
}
@Override
protected List<Integer> pagerIcon() {
List<Integer> list = new ArrayList<>();
list.add(R.mipmap.leave_icon_bg);
list.add(R.mipmap.my_icon_bg);
list.add(R.mipmap.message_icon_g);
return list;
}
}
|
/*
* This file is part of yosql. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://creativecommons.org/publicdomain/zero/1.0/. No part of yosql,
* including this file, may be copied, modified, propagated, or distributed except according to the terms contained
* in the LICENSE file.
*/
package wtf.metio.yosql.codegen.api;
import com.squareup.javapoet.MethodSpec;
import wtf.metio.yosql.models.immutables.SqlConfiguration;
import wtf.metio.yosql.models.immutables.SqlStatement;
import java.util.List;
/**
* Generates Java 8 {@link java.util.stream.Stream} based methods.
*/
public interface Java8StreamMethodGenerator {
/**
* Creates an eager streaming method for reading data out of a database.
*
* @param configuration The configuration to use.
* @param vendorStatements The vendor statements to use.
* @return An eager streaming method.
*/
MethodSpec streamEagerMethod(SqlConfiguration configuration, List<SqlStatement> vendorStatements);
/**
* Creates a lazy streaming method for reading data out of a database.
*
* @param configuration The configuration to use.
* @param vendorStatements The vendor statements to use.
* @return A lazy streaming method.
*/
MethodSpec streamLazyMethod(SqlConfiguration configuration, List<SqlStatement> vendorStatements);
}
|
//package unit.tests;
//
//import org.apache.log4j.Logger;
//
//import static org.junit.Assert.fail;
//
//import org.junit.Before;
//import org.junit.Test;
//
//import nz.ac.auckland.model.VidevoxException;
//import nz.ac.auckland.model.VidevoxModel;
//
//public class TestModel {
//
// private static final Logger logger = Logger.getLogger(TestModel.class);
//
// private static VidevoxModel _model;
//
// @Before
// public void beforeTest() {
// // Reset model to empty model
// try {
// _model = new VidevoxModel();
// } catch (VidevoxException e) {
// fail(e.getMessage());
// }
// }
//
// @Test
// public void testEquals() {
//
// }
//
// @Test
// public void testToStringBasic() {
// String str = _model.toString();
// logger.trace(str);
// VidevoxModel newModel;
// try {
// newModel = new VidevoxModel(str);
// if (!_model.equals(newModel)) {
// fail("Not Equal");
// }
// } catch (VidevoxException e) {
// fail(e.getMessage());
// }
//
// }
//
//}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.