blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
132
path
stringlengths
2
382
src_encoding
stringclasses
34 values
length_bytes
int64
9
3.8M
score
float64
1.5
4.94
int_score
int64
2
5
detected_licenses
listlengths
0
142
license_type
stringclasses
2 values
text
stringlengths
9
3.8M
download_success
bool
1 class
440a602b779d6673a992ed059fc678adc404f97d
Java
pabllo007/cpes
/Relatorio/CAPESRelatorioEJB/src/main/java/br/com/sicoob/capes/relatorio/negocio/delegates/CAPESRelatorioFabricaDelegates.java
UTF-8
6,956
2.40625
2
[]
no_license
package br.com.sicoob.capes.relatorio.negocio.delegates; import br.com.bancoob.negocio.delegates.BancoobFabricaDelegates; import br.com.sicoob.capes.cadastro.negocio.delegates.GrupoCompartilhamentoDelegate; import br.com.sicoob.capes.cadastro.negocio.delegates.PessoaCompartilhamentoDelegate; import br.com.sicoob.capes.cadastro.negocio.delegates.TipoAnotacaoDelegate; import br.com.sicoob.capes.cadastro.negocio.delegates.TipoEmailDelegate; import br.com.sicoob.capes.cadastro.negocio.delegates.TipoEnderecoDelegate; import br.com.sicoob.capes.cadastro.negocio.delegates.TipoFonteRendaDelegate; import br.com.sicoob.capes.cadastro.negocio.delegates.TipoTelefoneDelegate; /** * Fabrica dos business delegates a serem usados pelo Sistema CAPESRelatorio. * * @author Stefanini IT Solutions */ public final class CAPESRelatorioFabricaDelegates extends BancoobFabricaDelegates { /** Instancia do Fabrica de Delegates. */ private static CAPESRelatorioFabricaDelegates fabrica; /** * Retorna a fabrica de delegates a ser utilizada. * * @return a fabrica de delegates a ser utilizada. */ public static CAPESRelatorioFabricaDelegates getInstance() { if (fabrica == null) { synchronized (CAPESRelatorioFabricaDelegates.class) { if (fabrica == null) { fabrica = new CAPESRelatorioFabricaDelegates(); } } } return fabrica; } /** * Construtor privado no-args da classe */ private CAPESRelatorioFabricaDelegates() { super(); } /** * Cria instancia de RelatorioAnotacaoDelegate. * * @return o delegate solicitado * @see RelatorioAnotacaoDelegate */ public RelatorioAnotacaoDelegate criarRelatorioAnotacaoDelegate() { return new RelatorioAnotacaoDelegate(); } /** * Cria instancia de RelatorioProvaVidaDelegate. * * @return o delegate solicitado * @see RelatorioProvaVidaDelegate */ public RelatorioProvaVidaDelegate criarRelatorioProvaVidaDelegate() { return new RelatorioProvaVidaDelegate(); } /** * Cria instancia de RelatorioFichaCadastralDelegate. * * @return o delegate solicitado * @see RelatorioFichaCadastralDelegate */ public RelatorioFichaCadastralDelegate criarRelatorioFichaCadastralDelegate() { return new RelatorioFichaCadastralDelegate(); } /** * Cria instancia de RelatorioFichaCadastralEmBrancoDelegate. * * @return o delegate solicitado * @see RelatorioFichaCadastralEmBrancoDelegate */ public RelatorioFichaCadastralEmBrancoDelegate criarRelatorioFichaCadastralEmBrancoDelegate() { return new RelatorioFichaCadastralEmBrancoDelegate(); } /** * Cria instancia de RelCompartilhamentoDelegate. * * @return o delegate solicitado * @see RelCompartilhamentoDelegate */ public RelatorioCompartilhamentoDelegate criarRelCompartilhamentoDelegate() { return new RelatorioCompartilhamentoDelegate(); } /** * Cria instancia de RelatorioCadastroCompartilhadoDelegate. * * @return o delegate solicitado * @see RelatorioCadastroCompartilhadoDelegate */ public RelatorioCadastroCompartilhadoDelegate criarRelatorioCadastroCompartilhado() { return new RelatorioCadastroCompartilhadoDelegate(); } /** * Cria instancia de RelVencimentoCadastroDelegate. * * @return o delegate solicitado * @see RelVencimentoCadastroDelegate */ public RelatorioVencimentoCadastroDelegate criarRelVencimentoCadastroDelegate() { return new RelatorioVencimentoCadastroDelegate(); } /** * Cria instancia de TipoAnotacaoDelegate. * * @return o delegate solicitado * @see TipoAnotacaoDelegate */ public RelatorioTipoAnotacaoDelegate criarTipoAnotacaoDelegate() { return new RelatorioTipoAnotacaoDelegate(); } /** * Cria instancia de TipoEmailDelegate. * * @return o delegate solicitado * @see TipoEmailDelegate */ public RelatorioTipoEmailDelegate criarTipoEmailDelegate() { return new RelatorioTipoEmailDelegate(); } /** * Cria instancia de TipoEnderecoDelegate. * * @return o delegate solicitado * @see TipoEnderecoDelegate */ public RelatorioTipoEnderecoDelegate criarTipoEnderecoDelegate() { return new RelatorioTipoEnderecoDelegate(); } /** * Cria instancia de TipoTelefoneDelegate. * * @return o delegate solicitado * @see TipoTelefoneDelegate */ public RelatorioTipoTelefoneDelegate criarTipoTelefoneDelegate() { return new RelatorioTipoTelefoneDelegate(); } /** * Cria instancia de TipoFonteRendaDelegate. * * @return o delegate solicitado * @see TipoFonteRendaDelegate */ public RelatorioTipoFonteRendaDelegate criarTipoFonteRendaDelegate() { return new RelatorioTipoFonteRendaDelegate(); } /** * Cria instancia de FichaCadastralDelegate. * * @return o delegate solicitado * @see FichaCadastralDelegate */ public FichaCadastralDelegate criarFichaCadastralDelegate() { return new FichaCadastralDelegate(); } /** * Cria instancia de GrupoCompartilhamentoDelegate. * * @return o delegate solicitado * @see GrupoCompartilhamentoDelegate */ public RelatorioGrupoCompartilhamentoDelegate criarGrupoCompartilhamentoDelegate(){ return new RelatorioGrupoCompartilhamentoDelegate(); } /** * Cria instancia de RelatorioGrupoEconomicoDelegate. * * @return o delegate solicitado * @see RelatorioGrupoEconomicoDelegate */ public RelatorioGrupoEconomicoDelegate criarRelatorioGrupoEconomicoDelegate(){ return new RelatorioGrupoEconomicoDelegate(); } /** * Cria instancia de TipoRelacionamentoDelegate. * * @return o delegate solicitado * @see TipoRelacionamentoDelegate */ public RelatorioTipoRelacionamentoPessoaDelegate criarTipoRelacionamentoDelegate() { return new RelatorioTipoRelacionamentoPessoaDelegate(); } /** * Cria instancia de PessoaCompartilhamentoDelegate. * * @return o delegate solicitado * @see PessoaCompartilhamentoDelegate */ public RelatorioPessoaCompartilhamentoDelegate criarPessoaCompartilhamentoDelegate(){ return new RelatorioPessoaCompartilhamentoDelegate(); } /** * Cria instancia de RelatorioValidacaoCadastralDelegate. * * @return o delegate solicitado * @see RelatorioValidacaoCadastralDelegate */ public RelatorioValidacaoCadastralDelegate criarRelatorioValidacaoCadastralDelegate() { return new RelatorioValidacaoCadastralDelegate(); } /** * Cria instancia de RelatorioTributacaoDelegate. * * @return o delegate solicitado * @see RelatorioTributacaoDelegate */ public RelatorioTributacaoDelegate criarRelatorioTributacaoDelegate() { return new RelatorioTributacaoDelegate(); } /** * Cria instancia de RelatorioDeclaracaoPropositoDelegate. * * @return o delegate solicitado * @see RelatorioDeclaracaoPropositoDelegate */ public RelatorioDeclaracaoPropositoDelegate criarRelatorioDeclaracaoPropositoDelegate() { return new RelatorioDeclaracaoPropositoDelegate(); } public FormularioVisitaDelegate criarFormularioVisitaDelegate(){ return new FormularioVisitaDelegate(); } }
true
3da3320e4cbc597bc15469ed755edbd120cac124
Java
zhouxhhn/purchase
/sipin-sales-cloud-backend-purchase-service/src/main/java/cn/sipin/sales/cloud/purchase/service/controller/backend/BackendPurchaseOrderController.java
UTF-8
12,427
1.914063
2
[]
no_license
package cn.sipin.sales.cloud.purchase.service.controller.backend; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.plugins.Page; import org.apache.commons.lang.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.ArrayList; import java.util.List; import java.util.Objects; import cn.sipin.sales.cloud.pojo.PurchaseOrder; import cn.sipin.sales.cloud.pojo.PurchaseOrderConsignee; import cn.sipin.sales.cloud.pojo.PurchaseOrderExpress; import cn.sipin.sales.cloud.purchase.service.config.ErpConfig; import cn.sipin.sales.cloud.purchase.service.feign.impl.SalesUserServiceImpl; import cn.sipin.sales.cloud.purchase.service.service.PurchaseOrderConsigneeServiceContract; import cn.sipin.sales.cloud.purchase.service.service.PurchaseOrderExpressServiceContract; import cn.sipin.sales.cloud.purchase.service.service.PurchaseOrderServiceContract; import cn.sipin.sales.cloud.request.PurchaseAddMaterialRequest; import cn.sipin.sales.cloud.request.PurchaseOrderListRequest; import cn.sipin.sales.cloud.request.PurchaseUpdateMaterialRequest; import cn.sipin.sales.cloud.response.AgencyCodeResponse; import cn.sipin.sales.cloud.response.PurchaseOrderDetailResponse; import cn.sipin.sales.cloud.response.PurchaseOrderExpressResponse; import cn.sipin.sales.cloud.response.PurchaseOrderResponse; import cn.sipin.sales.cloud.response.vo.OrderConsigneeVo; import cn.siyue.platform.base.ResponseData; import cn.siyue.platform.constants.ResponseBackCode; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; /** * <p> * 采购单 控制器 * </p> */ @RestController @Api(tags = "后台采购订单") @RequestMapping(path = "/backend/purchase-order", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public class BackendPurchaseOrderController { private PurchaseOrderServiceContract purchaseOrderService; private SalesUserServiceImpl salesUserService; private PurchaseOrderConsigneeServiceContract purchaseOrderConsigneeService; private PurchaseOrderExpressServiceContract purchaseOrderExpressService; private ErpConfig erpConfig; public BackendPurchaseOrderController( PurchaseOrderServiceContract purchaseOrderService, SalesUserServiceImpl salesUserService, PurchaseOrderConsigneeServiceContract purchaseOrderConsigneeService, PurchaseOrderExpressServiceContract purchaseOrderExpressService, ErpConfig erpConfig ) { this.purchaseOrderService = purchaseOrderService; this.salesUserService = salesUserService; this.purchaseOrderConsigneeService = purchaseOrderConsigneeService; this.purchaseOrderExpressService = purchaseOrderExpressService; this.erpConfig = erpConfig; } @PostMapping(value = "/list") @ApiOperation(nickname = "backendGetPurchaseOrders", value = "后台获取门店采购单列表") public ResponseData<Page<PurchaseOrderResponse>> index( @RequestParam(value = "page", required = false, defaultValue = "1") int page, @RequestParam(value = "size", required = false, defaultValue = "15") int size, @RequestBody PurchaseOrderListRequest request ) { // 得到经销商信息 AgencyCodeResponse agencyInfoVo = salesUserService.getUserByToken(); Page<PurchaseOrderResponse> orderVoPage = new Page<>(page, size); if (StringUtils.isBlank(agencyInfoVo.getShopCode())) { // 如果门店为空或者空字符串,则是斯品内部管理员,可查询所有采购订单 orderVoPage = purchaseOrderService.selectOrderPage(null, orderVoPage, request,false); return new ResponseData<Page<PurchaseOrderResponse>>( ResponseBackCode.SUCCESS.getValue(), ResponseBackCode.SUCCESS.getMessage(), orderVoPage ); } PurchaseOrder purchaseOrder = new PurchaseOrder(); purchaseOrder.setAgencyCode(agencyInfoVo.getAgencyCode()); purchaseOrder.setShopCode(agencyInfoVo.getShopCode()); if (!Objects.isNull(request.getShopCode())) { purchaseOrder.setShopCode(request.getShopCode()); } orderVoPage = purchaseOrderService.selectOrderPage(purchaseOrder, orderVoPage, request,false); return new ResponseData<Page<PurchaseOrderResponse>>( ResponseBackCode.SUCCESS.getValue(), ResponseBackCode.SUCCESS.getMessage(), orderVoPage ); } @ApiOperation(nickname = "showPurchaseOrder", value = "获取采购单详情") @GetMapping("/{orderNo}") public ResponseData<PurchaseOrderResponse> show(@PathVariable String orderNo) { if (StringUtils.isBlank(orderNo)) { return new ResponseData<PurchaseOrderResponse>( ResponseBackCode.ERROR_PARAM_INVALID.getValue(), ResponseBackCode.ERROR_PARAM_INVALID.getMessage() ); } // 得到经销商信息 AgencyCodeResponse agencyInfoVo = salesUserService.getUserByToken(); PurchaseOrder purchaseOrder = new PurchaseOrder(); purchaseOrder.setNo(orderNo); if (StringUtils.isNotBlank(agencyInfoVo.getShopCode())) { // 如果门店为空或者空字符串,则是斯品内部管理员,可查询所有采购订单详情 // 否则 为经销商管理员可查 只能查自己门店订单 purchaseOrder.setAgencyCode(agencyInfoVo.getAgencyCode()); purchaseOrder.setShopCode(agencyInfoVo.getShopCode()); } purchaseOrder = purchaseOrderService.selectOne(new EntityWrapper<>(purchaseOrder)); List<PurchaseOrderDetailResponse> detailVos = purchaseOrderService.selectOrderDetail(purchaseOrder.getId()); PurchaseOrderResponse orderVo = new PurchaseOrderResponse(); // FIXME 需要获取经销商信息 把经销商code和管理员ID换成名称 BeanUtils.copyProperties(purchaseOrder, orderVo); orderVo.setAgencyName(erpConfig.getAllAgencyAndShopNameAndSourceMap().get(purchaseOrder.getAgencyCode())); orderVo.setShopName(erpConfig.getAllAgencyAndShopNameAndSourceMap().get(purchaseOrder.getShopCode())); orderVo.setDetailVos(detailVos); // 地址信息 PurchaseOrderConsignee consignee = purchaseOrderConsigneeService.selectOne(new EntityWrapper<>(new PurchaseOrderConsignee(purchaseOrder.getId()))); OrderConsigneeVo orderConsignee = new OrderConsigneeVo(); BeanUtils.copyProperties(consignee, orderConsignee); orderVo.setOrderConsignee(orderConsignee); PurchaseOrderExpress express = new PurchaseOrderExpress(); express.setOrderNo(purchaseOrder.getNo()); List<PurchaseOrderExpress> expressList = purchaseOrderExpressService.selectList(new EntityWrapper<>(express)); List<PurchaseOrderExpressResponse> orderExpressesResponse; if (expressList.size() > 0) { orderExpressesResponse = new ArrayList<>(expressList.size()); expressList.forEach(it -> { PurchaseOrderExpressResponse response = new PurchaseOrderExpressResponse(); BeanUtils.copyProperties(it, response); orderExpressesResponse.add(response); }); orderVo.setOrderExpressList(orderExpressesResponse); } else { orderVo.setOrderExpressList(new ArrayList<>(0)); } return new ResponseData<PurchaseOrderResponse>( ResponseBackCode.SUCCESS.getValue(), ResponseBackCode.SUCCESS.getMessage(), orderVo ); } @GetMapping("/materialDetail/{orderNo}") public ResponseData<Page<PurchaseOrderDetailResponse>> materialDetail(@PathVariable String orderNo) { // 得到经销商信息 AgencyCodeResponse agencyInfoVo = salesUserService.getUserByToken(); PurchaseOrder purchaseOrder = new PurchaseOrder(); purchaseOrder.setNo(orderNo); if (StringUtils.isNotBlank(agencyInfoVo.getShopCode())) { // 如果门店为空或者空字符串,则是斯品内部管理员,可查询所有采购订单详情 // 否则 为经销商管理员可查 只能查自己门店订单 purchaseOrder.setAgencyCode(agencyInfoVo.getAgencyCode()); purchaseOrder.setShopCode(agencyInfoVo.getShopCode()); } purchaseOrder = purchaseOrderService.selectOne(new EntityWrapper<>(purchaseOrder)); List<PurchaseOrderDetailResponse> detailVos = purchaseOrderService.selectOrderDetail(purchaseOrder.getId()); Page<PurchaseOrderDetailResponse> orderDetailResponsePage = new Page<>(); if(detailVos != null && !detailVos.isEmpty()){ orderDetailResponsePage.setSize(detailVos.size()); orderDetailResponsePage.setTotal(detailVos.size()); orderDetailResponsePage.setSize(detailVos.size()); } orderDetailResponsePage.setRecords(detailVos); return new ResponseData<>(ResponseBackCode.SUCCESS.getValue(),ResponseBackCode.SUCCESS.getMessage(),orderDetailResponsePage); } /** * 新增采购订单中的商品 */ @PostMapping(value = "/addMaterial") public ResponseData addMaterial(@RequestBody PurchaseAddMaterialRequest request) { return purchaseOrderService.addMaterial(request); } /** * 新增采购订单中的商品 */ @PutMapping(value = "/deleteMaterial/{orderNo}") public ResponseData deleteMaterial(@PathVariable String orderNo) { return purchaseOrderService.deleteMaterial(orderNo); } /** * 新增采购订单中的商品 */ @PutMapping(value = "/updateMaterial/{orderNo}") public ResponseData updateMaterial(@PathVariable String orderNo,@RequestBody PurchaseUpdateMaterialRequest request) { return purchaseOrderService.updateMaterial(orderNo,request); } @PostMapping(value = "/exportExcel") @ApiOperation(nickname = "backendExportExcelPurchaseOrders", value = "后台导出门店采购单列表") public ResponseData index(@RequestBody PurchaseOrderListRequest request) { // 得到经销商信息 AgencyCodeResponse agencyInfoVo = salesUserService.getUserByToken(); Page<PurchaseOrderResponse> orderVoPage = new Page<>(); if (StringUtils.isBlank(agencyInfoVo.getShopCode())) { // 如果门店为空或者空字符串,则是斯品内部管理员,可查询所有采购订单 orderVoPage = purchaseOrderService.selectOrderPage(null, orderVoPage, request,true); getExpressList(orderVoPage); return ResponseData.build( ResponseBackCode.SUCCESS.getValue(), ResponseBackCode.SUCCESS.getMessage(), orderVoPage.getRecords()); } PurchaseOrder purchaseOrder = new PurchaseOrder(); purchaseOrder.setAgencyCode(agencyInfoVo.getAgencyCode()); purchaseOrder.setShopCode(agencyInfoVo.getShopCode()); if (!Objects.isNull(request.getShopCode())) { purchaseOrder.setShopCode(request.getShopCode()); } orderVoPage = purchaseOrderService.selectOrderPage(purchaseOrder, orderVoPage, request,true); getExpressList(orderVoPage); return ResponseData.build( ResponseBackCode.SUCCESS.getValue(), ResponseBackCode.SUCCESS.getMessage(), orderVoPage.getRecords() ); } /** * 设置物流信息 */ private void getExpressList(Page<PurchaseOrderResponse> orderVoPage ){ if(orderVoPage.getRecords() != null && !orderVoPage.getRecords().isEmpty()){ List<PurchaseOrderResponse> purchaseOrderResponseList = orderVoPage.getRecords(); for (int i = 0,size = purchaseOrderResponseList.size(); i < size; i++) { PurchaseOrderResponse response = purchaseOrderResponseList.get(i); List<PurchaseOrderExpress> expressList = purchaseOrderExpressService.selectList( new EntityWrapper<>( new PurchaseOrderExpress(response.getNo()))); List<PurchaseOrderExpressResponse> purchaseOrderDetailResponseList = new ArrayList<>(expressList.size()); expressList.forEach(sourceDetail -> { PurchaseOrderExpressResponse targetDetailVo = new PurchaseOrderExpressResponse(); BeanUtils.copyProperties(sourceDetail, targetDetailVo); purchaseOrderDetailResponseList.add(targetDetailVo); }); response.setOrderExpressList(purchaseOrderDetailResponseList); } } } }
true
ac2e897eef6814e288cdd9421a6b663f90c91ac8
Java
eryiyi/YuejiulaManager
/src/main/java/com/liangxunwang/unimanager/model/ManagerEmp.java
UTF-8
1,450
1.953125
2
[]
no_license
package com.liangxunwang.unimanager.model; /** * Created by zhl on 2015/2/4. * 会员禁用记录 */ public class ManagerEmp { private String id; private String empId; private String admin; private String start; private String end; private String dateline; private String empIdTwo; private String countJF; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getEmpId() { return empId; } public void setEmpId(String empId) { this.empId = empId; } public String getAdmin() { return admin; } public void setAdmin(String admin) { this.admin = admin; } public String getStart() { return start; } public void setStart(String start) { this.start = start; } public String getEnd() { return end; } public void setEnd(String end) { this.end = end; } public String getDateline() { return dateline; } public void setDateline(String dateline) { this.dateline = dateline; } public String getEmpIdTwo() { return empIdTwo; } public void setEmpIdTwo(String empIdTwo) { this.empIdTwo = empIdTwo; } public String getCountJF() { return countJF; } public void setCountJF(String countJF) { this.countJF = countJF; } }
true
0406125dc86f878c099da9cd2b45a9ad54d24ed0
Java
cckmit/sakai-contrib
/assignment2/tool/src/java/org/sakaiproject/assignment2/tool/entity/ViewSubmissionEntityProvider.java
UTF-8
5,298
1.664063
2
[ "LicenseRef-scancode-public-domain" ]
permissive
/********************************************************************************** * $URL: https://source.sakaiproject.org/contrib/assignment2/trunk/impl/src/java/org/sakaiproject/assignment2/logic/impl/ImportExportLogicImpl.java $ * $Id: ImportExportLogicImpl.java 67172 2010-04-14 19:33:06Z bahollad@indiana.edu $ *********************************************************************************** * * Copyright (c) 2007 The Sakai Foundation. * * Licensed under the Educational Community License, Version 1.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.opensource.org/licenses/ecl1.php * * 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.sakaiproject.assignment2.tool.entity; import java.util.HashMap; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.sakaiproject.assignment2.logic.AssignmentSubmissionLogic; import org.sakaiproject.assignment2.model.AssignmentSubmission; import org.sakaiproject.assignment2.model.constants.AssignmentConstants; import org.sakaiproject.assignment2.tool.LocalCacheLogic; import org.sakaiproject.assignment2.tool.params.AssignmentDetailsViewParams; import org.sakaiproject.assignment2.tool.params.ViewSubmissionParams; import org.sakaiproject.assignment2.tool.producers.ViewAssignmentProducer; import org.sakaiproject.assignment2.tool.producers.ViewStudentSubmissionProducer; import org.sakaiproject.entitybroker.EntityReference; import org.sakaiproject.entitybroker.entityprovider.CoreEntityProvider; import org.sakaiproject.entitybroker.entityprovider.capabilities.RequestStorable; import org.sakaiproject.entitybroker.entityprovider.extension.RequestStorage; import org.sakaiproject.entitybroker.util.AbstractEntityProvider; import org.sakaiproject.rsf.entitybroker.EntityViewParamsInferrer; import uk.org.ponder.rsf.viewstate.ViewParameters; /** * Entity Provider for view an Assignment2 submission * */ public class ViewSubmissionEntityProvider extends AbstractEntityProvider implements CoreEntityProvider, EntityViewParamsInferrer, RequestStorable { private static Log log = LogFactory.getLog(ViewSubmissionEntityProvider.class); public static final String ENTITY_PREFIX="view-assignment2-submission"; public boolean entityExists(String id) { return true; } public String getEntityPrefix() { return ENTITY_PREFIX; } public String[] getHandledPrefixes() { return new String[] {ENTITY_PREFIX}; } public ViewParameters inferDefaultViewParameters(String reference) { EntityReference ref = new EntityReference(reference); Long submissionId = Long.parseLong(ref.getId()); // if the request includes a tagReference, we need to pass it along // in case it gives expanded permissions for viewing the submission String tagReference = (String) requestStorage.getStoredValue("tagReference"); String tagDecoWrapper = (String) requestStorage.getStoredValue("tagDecoWrapper"); Map<String, Object> optionalParams = new HashMap<String, Object>(); optionalParams.put(AssignmentConstants.TAGGABLE_REF_KEY, tagReference); // now we need to derive the assignmentid and userid from the submission AssignmentSubmission sub = submissionLogic.getAssignmentSubmissionById(submissionId, optionalParams); // if we made it this far, we have permission to view the submission. in case the // tag ref is overriding default permissions, we may need to also override // security on any attachments if (tagReference != null && !"".equals(tagReference)) { localCacheLogic.addAssignmentAttachmentsToCache(sub.getAssignment().getId(), optionalParams); localCacheLogic.addSubmittedAttachmentsToCache(sub.getAssignment().getId(), sub.getUserId(), optionalParams); // we also need to add a SecurityAdvisor to the session for use when the user clicks the attach link localCacheLogic.addAttachmentCacheSecurityAdvisor(); } return new ViewSubmissionParams(ViewStudentSubmissionProducer.VIEW_ID, sub.getAssignment().getId(), sub.getUserId(), tagReference, tagDecoWrapper); } private RequestStorage requestStorage; public void setRequestStorage(RequestStorage requestStorage) { this.requestStorage = requestStorage; } private AssignmentSubmissionLogic submissionLogic; public void setAssignmentSubmissionLogic(AssignmentSubmissionLogic submissionLogic) { this.submissionLogic = submissionLogic; } private LocalCacheLogic localCacheLogic; public void setLocalCacheLogic(LocalCacheLogic localCacheLogic) { this.localCacheLogic = localCacheLogic; } }
true
519422fdf973b0d778e9b498c9a6718223d2e11d
Java
GokulId1234/GokRepository
/scp_sort/src/main/java/com/scp/sort/dao/SortNumbersDAO.java
UTF-8
377
1.679688
2
[]
no_license
/** * */ package com.scp.sort.dao; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.scp.sort.model.SortNumbers; /** * Class to invoke database through JPA repository * @author Gokul */ @Repository public interface SortNumbersDAO extends JpaRepository<SortNumbers, Long> { }
true
4226cf43a075875c50e89c1101ec2dda6d2a4bec
Java
amaoxia/iSwap-Common
/iSwap-Common/src/com/common/utils/json/CustomDateSerializer.java
UTF-8
1,087
2.28125
2
[]
no_license
/* * @(#)CustomDateSerializer.java * * Copyright (C) 2005, zgcworld All right reserved. * see the site: http://www.zgcworld.com */ package com.common.utils.json; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import org.codehaus.jackson.JsonGenerator; import org.codehaus.jackson.JsonProcessingException; import org.codehaus.jackson.map.JsonSerializer; import org.codehaus.jackson.map.SerializerProvider; /** * jackson 序列化时间 处理时间输出问题 * @author zhangx * @since 2011-1-17 下午02:16:29 * @name com.common.utils.json.CustomDateSerializer.java * @version 1.0 */ public class CustomDateSerializer extends JsonSerializer<Date> { @Override public void serialize(Date value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); String formattedDate = formatter.format(value); jgen.writeString(formattedDate); } }
true
d0632924a57abcff51b9cb4b1b557fb732a495c5
Java
henrylv206/UCFCloudPortal
/src/main/java/com/skycloud/management/portal/webservice/databackup/po/DBListVolumesCommandPo.java
UTF-8
2,602
2.265625
2
[]
no_license
package com.skycloud.management.portal.webservice.databackup.po; import org.apache.commons.lang.StringUtils; import com.skycloud.management.portal.common.utils.JsonUtil; import com.skycloud.management.portal.common.utils.ServiceException; import com.skycloud.management.portal.front.command.impl.QueryCommand; import com.skycloud.management.portal.front.task.util.BaseCommandPo; /** * 中软接口获取Elaster卷列表信息命令对象实体类 *<dl> *<dt>类名:DBListVolumes</dt> *<dd>描述: </dd> *<dd>公司: 天云科技有限公司</dd> *<dd>创建时间:2012-1-12 下午02:29:11</dd> *<dd>创建人: 刘江宁</dd> *</dl> */ public class DBListVolumesCommandPo extends BaseCommandPo{ public static final String COMMAND = "listVolumes"; public static final String ID = "id"; public static final String VIRTUALMACHINEID = "virtualmachineid"; private static final String TYPE = "type"; private String id; private String virtualmachineid ; private String type ; public DBListVolumesCommandPo(){ super(COMMAND); } public String getType() { return type; } public void setType(String type) { this.type = type; this.setParameter(TYPE, type); } public String getId() { return id; } public void setId(String id) { this.id = id; this.setParameter(ID, id); } public String getVirtualmachineid() { return virtualmachineid; } public void setVirtualmachineid(String virtualmachineid) { this.virtualmachineid = virtualmachineid; this.setParameter(VIRTUALMACHINEID, virtualmachineid); } @Override public String getCOMMAND() { // TODO Auto-generated method stub return COMMAND; } @Override public String getParameter(BaseCommandPo po) { // TODO Auto-generated method stub return super.fromPoToJsonStr(po); } protected QueryCommand fromJsonToOperatePo (String jsonStr){ try{ if(StringUtils.isBlank(jsonStr)){ throw new ServiceException("解析Json传失败[CreateVolume]方法fromJsonToOperatePo:传入参数为空"); } String tempJson = ""; tempJson = fromJsonToMap(jsonStr).get(COMMAND).toString(); DBListVolumesCommandPo po = (DBListVolumesCommandPo)JsonUtil.getObject4JsonString(tempJson, DBListVolumesCommandPo.class); return po; }catch(Exception e){ logger.error("解析Json传失败[DBListVolumes]方法fromJsonToOperatePo:",e); throw new RuntimeException("解析Json传失败[DBListVolumes]方法fromJsonToOperatePo:"+e.getMessage()); } } }
true
b85cebed29d46128516985c438c755f315166798
Java
Gnuhry/student-alarm
/app/src/main/java/com/example/studentalarm/receiver/AlarmOffReceiver.java
UTF-8
1,074
2
2
[ "Apache-2.0" ]
permissive
package com.example.studentalarm.receiver; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; import com.example.studentalarm.alarm.AlarmManager; import com.example.studentalarm.save.PreferenceKeys; import androidx.annotation.NonNull; import androidx.core.app.NotificationManagerCompat; import androidx.preference.PreferenceManager; import static com.example.studentalarm.MainActivity.ALARM_BROADCAST; public class AlarmOffReceiver extends BroadcastReceiver { /** * triggered when alarm should be turn off */ @Override public void onReceive(@NonNull Context context, Intent intent) { Log.d("ALARM", "OFF"); AlarmManager.setNextAlarm(context); NotificationManagerCompat.from(context).cancel(AlarmReceiver.NOTIFICATION_ID); PreferenceManager.getDefaultSharedPreferences(context).edit().putInt(PreferenceKeys.ALARM_MODE, 0).apply(); AlarmReceiver.stopRingtone(); context.sendBroadcast(new Intent(ALARM_BROADCAST)); } }
true
64264b81eacdf63c75f8e4431eab074fbe5f2027
Java
tanghongbin/RefreshView
/app/src/main/java/com/publishproject/events/DownloadBaseEvent.java
UTF-8
930
2.125
2
[]
no_license
package com.publishproject.events; import java.io.File; /** * @author Android客户端组-tanghongbin * @Title: DownloadBaseEvent * @Package com.publishproject.core.commonconfig.netconfigs.callbacks * Copyright: Copyright (c) 2016 * Company: 成都壹柒互动科技有限公司 * @date 2016/12/14 17:04 * @Description: TODO */ public class DownloadBaseEvent<ERROR extends ErrorEvent> extends JudgeResultEvent{ private File file; private ERROR error; public DownloadBaseEvent() { } public DownloadBaseEvent(File file) { this.file = file; } public File getFile() { return file; } public void setFile(File file) { this.file = file; } public ERROR getError() { return error; } public void setError(ERROR error) { this.error = error; } @Override public boolean isSuccess() { return error == null; } }
true
ca18390ed2413ae735e3c1349df4a4c1dd5ffd0c
Java
fengwutianya/LearnJava
/src/algorithms/offer/SubTree.java
UTF-8
1,160
3.5
4
[]
no_license
package algorithms.offer; /** * Created by xuan on 2017/8/13 0013. */ public class SubTree { public boolean HasSubtree(TreeNode root1,TreeNode root2) { if (root1 == null || root2 == null) return false; return hasSubtree(root1, root2); } private boolean hasSubtree(TreeNode root1, TreeNode root2) { if (root2 == null) return true; if (root1 == null) return false; if (root1.val == root2.val) { if (isSubTree(root1.left, root2.left) && isSubTree(root1.right, root2.right)) { return true; } } return hasSubtree(root1.left, root2) || hasSubtree(root1.right, root2); } private boolean isSubTree(TreeNode root1, TreeNode root2) { if (root2 == null) return true; if (root1 == null) return false; if (root2.val != root1.val) return false; return isSubTree(root1.left, root2.left) && isSubTree(root1.right, root2.right); } public static void main(String[] args) { TreeNode root1 = new TreeNode(2), root2 = new TreeNode(2); System.out.println(new SubTree().HasSubtree(root1, root2)); } }
true
7ce68f42ddfbcebc13bab359a246b0e62ebaccda
Java
davidcampelo/PublicOpenSpaceToolApp
/app/src/main/java/org/davidcampelo/post/model/Project.java
UTF-8
2,748
2.40625
2
[ "Apache-2.0" ]
permissive
package org.davidcampelo.post.model; import android.os.Parcel; import android.os.Parcelable; import com.google.android.gms.maps.model.LatLng; import java.util.ArrayList; /** * Created by davidcampelo on 8/18/16. */ public class Project implements Parcelable { long id = 0; String name; String desc; ArrayList<LatLng> polygonPoints; ArrayList<PublicOpenSpace> publicOpenSpaces; long dateCreation; public Project(String name, String desc, ArrayList<LatLng> polygonPoints) { this(0, name, desc, polygonPoints, null, 0); } Project(long id, String name, String desc, ArrayList<LatLng> polygonPoints, ArrayList<PublicOpenSpace> publicOpenSpaces, long dateCreation) { this.id = id; this.name = name; this.desc = desc; this.polygonPoints = polygonPoints; this.publicOpenSpaces = publicOpenSpaces; this.dateCreation = dateCreation; } public Project(long id) { this(id, null, null, null, null, 0); } public Project() { } protected Project(Parcel in) { id = in.readLong(); name = in.readString(); desc = in.readString(); polygonPoints = in.createTypedArrayList(LatLng.CREATOR); publicOpenSpaces = in.createTypedArrayList(PublicOpenSpace.CREATOR); dateCreation = in.readLong(); } public static final Creator<Project> CREATOR = new Creator<Project>() { @Override public Project createFromParcel(Parcel in) { return new Project(in); } @Override public Project[] newArray(int size) { return new Project[size]; } }; public long getId() { return id; } public String getName() { return name; } public String getDesc() { return desc; } public ArrayList<LatLng> getPolygonPoints() { return polygonPoints; } public ArrayList<PublicOpenSpace> getPublicOpenSpaces() { return publicOpenSpaces; } public long getDateCreation() { return dateCreation; } public void setPolygonPoints(ArrayList<LatLng> polygonPoints) { this.polygonPoints = polygonPoints; } public void setName(String name) { this.name = name; } public void setDesc(String desc) { this.desc = desc; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel parcel, int i) { parcel.writeLong(id); parcel.writeString(name); parcel.writeString(desc); parcel.writeTypedList(polygonPoints); parcel.writeTypedList(publicOpenSpaces); parcel.writeLong(dateCreation); } }
true
e91401a5dad0d3fd1d4dc994eff8115358ec1628
Java
ekareem/ENCRYPT_SMS
/app/src/main/java/com/dogne/sms4/firebase/Authenticate.java
UTF-8
3,454
2.390625
2
[]
no_license
package com.dogne.sms4.firebase; import android.os.Build; import android.text.TextUtils; import android.util.Log; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatActivity; import com.dogne.sms4.constant.Constant; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import java.util.Objects; import static android.content.ContentValues.TAG; public class Authenticate { public static void signUp(final AppCompatActivity authActivity, final String alias, final String email, String password) { final FirebaseAuth auth = FirebaseAuth.getInstance(); if (TextUtils.isEmpty(email) || TextUtils.isEmpty(password) || TextUtils.isEmpty(alias)) Toast.makeText(authActivity, "Fields are empty", Toast.LENGTH_LONG).show(); else auth.createUserWithEmailAndPassword(email, password) .addOnCompleteListener(authActivity, new OnCompleteListener<AuthResult>() { @RequiresApi(api = Build.VERSION_CODES.O) @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { // Sign in success, update UI with the signed-in user's information Toast.makeText(authActivity,Constant.USER_CREATED_SUCCESS, Toast.LENGTH_SHORT).show(); Database.onUserCreated(authActivity,alias,email); } else { // If sign in fails, display a message to the user. Toast.makeText(authActivity, Objects.requireNonNull(task.getException()).getMessage(), Toast.LENGTH_SHORT).show(); } } }); } public static void signIn(final AppCompatActivity authActivity, final String email, final String password) { final FirebaseAuth auth = FirebaseAuth.getInstance(); if (TextUtils.isEmpty(email) || TextUtils.isEmpty(password)) Toast.makeText(authActivity, "Fields are empty", Toast.LENGTH_LONG).show(); else auth.signInWithEmailAndPassword(email, password) .addOnCompleteListener(authActivity, new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { // Sign in success, update UI with the signed-in user's information Toast.makeText(authActivity, Constant.LOGIN_SUCCESS, Toast.LENGTH_SHORT).show(); } else { // If sign in fails, display a message to the user. //Log.w(TAG, "Log in failure", ); Toast.makeText(authActivity, Objects.requireNonNull(task.getException()).getMessage(), Toast.LENGTH_SHORT).show(); } } }); } }
true
2267c0722d7f7904d7eff490509dcffc16dd4613
Java
rohitksingh/SpringBootJavaBrains
/src/main/java/com/rohitksingh/springbootjavabrains/CouseAPPAPI.java
UTF-8
517
1.828125
2
[]
no_license
package com.rohitksingh.springbootjavabrains; import com.rohitksingh.springbootjavabrains.topic.TopicService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class CouseAPPAPI { @Autowired private static TopicService topicService; public static void main(String[] args) { SpringApplication.run(CouseAPPAPI.class, args); } }
true
c00c6c41329a16a7a08ede02febcf903c92b0ff9
Java
ramiro314/ToSHelper
/app/src/main/java/com/nullaxis/tos/adapters/BuildsAdapter.java
UTF-8
1,952
2.4375
2
[]
no_license
package com.nullaxis.tos.adapters; import android.content.Context; import android.content.Intent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import com.nullaxis.tos.R; import com.nullaxis.tos.activities.BuildActivity; import com.nullaxis.tos.models.Build; import java.util.List; public class BuildsAdapter extends ArrayAdapter<Build>{ public BuildsAdapter(Context context, List<Build> objects) { super(context, -1, objects); } @Override public View getView(int position, View convertView, ViewGroup parent) { final Build build = getItem(position); if (convertView == null) { LayoutInflater inflater = (LayoutInflater) getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.row_build, parent, false); } ImageView icon = (ImageView) convertView.findViewById(R.id.buildIcon); TextView name = (TextView) convertView.findViewById(R.id.buildName); Button editButton = (Button) convertView.findViewById(R.id.editBuildButton); icon.setImageResource(build.getIcon_resource_id()); name.setText(build.getName()); editButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent mIntent = new Intent(getContext(), BuildActivity.class); mIntent.putExtra("build_id", build.getId()); mIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); getContext().startActivity(mIntent); } } ); return convertView; } }
true
1fa72db0a50b07dec28e0a1fc9c3821315c19615
Java
ougonna/Summative-2-NetflixXJava
/Summative-2-Ugonna-Brown-Taylor-Abdul/src/test/java/com/company/Summative2UgonnaBrownTaylorAbdul/model/AuthorDaoTest.java
UTF-8
4,157
2.546875
3
[]
no_license
package com.company.Summative2UgonnaBrownTaylorAbdul.model; import com.company.Summative2UgonnaBrownTaylorAbdul.dao.AuthorDao; import com.company.Summative2UgonnaBrownTaylorAbdul.dao.BookDao; import com.company.Summative2UgonnaBrownTaylorAbdul.dao.PublisherDao; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest public class AuthorDaoTest { @Autowired AuthorDao authorDao; @Autowired BookDao bookDao; @Autowired PublisherDao publisherDao; @Before public void setUp() throws Exception { //clean out the db List<Author> aList = authorDao.getAllAuthors(); for (Author a : aList) { authorDao.deleteAuthor(a.getAuthorID()); } List<Publisher> pList = publisherDao.getAllPublishers(); for (Publisher p : pList) { publisherDao.deletePublisher(p.getId()); } List<Book> dList = bookDao.getAllBooks(); for (Book d : dList) { bookDao.deleteBook(d.getBookID()); } } @Test public void addGetDeleteAuthor(){ //Arrange Author auth = new Author(); auth.setFirstName("BookFirst"); auth.setLastName("BookLast"); auth.setEmail("last@gmail.com"); auth.setPhone("3334445678"); auth.setCity("Norfolk"); auth.setState("VA"); auth.setStreet("700 park ave"); auth.setPostalCode("34509"); //act auth = authorDao.addAuthor(auth); Author auth2 = authorDao.getAuthor(auth.getAuthorID()); //Assert assertEquals(auth, auth2); //Act authorDao.deleteAuthor(auth.getAuthorID()); auth2 = authorDao.getAuthor(auth.getAuthorID()); //Assert assertNull(auth2); } @Test public void getALlAuthors(){ //Arrange: arranging first Author Author auth = new Author(); auth.setFirstName("BookSecond"); auth.setLastName("BookSecondLast"); auth.setEmail("seclast@gmail.com"); auth.setPhone("2224445678"); auth.setCity("Norfolk"); auth.setState("PA"); auth.setStreet("700 park road"); auth.setPostalCode("34456"); //Act authorDao.addAuthor(auth); //Arrange: Arrange second author auth = new Author(); auth.setFirstName("BookFirstLast"); auth.setLastName("BookLastLast"); auth.setEmail("lastlast@gmail.com"); auth.setPhone("3335555678"); auth.setCity("Washington"); auth.setState("DC"); auth.setStreet("700 road ave"); auth.setPostalCode("34510"); //Act authorDao.addAuthor(auth); List<Author> authorList = authorDao.getAllAuthors(); //gets all authors //Assert assertEquals(authorList.size(), 2); } @Test public void updateAuthors(){ //Arrange Author auth = new Author(); auth.setFirstName("UpdateName"); auth.setLastName("UpdateLast"); auth.setEmail("Updatelast@gmail.com"); auth.setPhone("99944455467"); auth.setCity("Manassas"); auth.setState("VA"); auth.setStreet("Update 700 park ave"); auth.setPostalCode("33450"); //Act auth = authorDao.addAuthor(auth); auth.setFirstName("Update2Name"); auth.setLastName("Update2Last"); auth.setEmail("Updatelast2@gmail.com"); //Act authorDao.updateAuthor(auth); //updates db with new information Author auth2 = authorDao.getAuthor(auth.getAuthorID()); //creates another author //gets id of the author created above and assign to auth2 //Assert assertEquals(auth2, auth); } }
true
37c5d885adf4b3cf56c229ebb0a3202923415f5a
Java
aeritherie/GROUP6TSM3ECASESTUDY
/StudentInformation.java
UTF-8
376
2.703125
3
[ "Apache-2.0" ]
permissive
public class StudentInformation { private String Fname; private String Mname; public void getFname(String Fname) { this.Fname = Fname; } public String showFname() { return Fname; } public void getMname(String Mname) { this.Mname = Mname; } public String showMname() { return Mname; } }
true
5e6b1b4ca8dc70ad822f83d1c2700bbe23bbe2d6
Java
hpdcj/PCJ
/src/main/java/org/pcj/RegisterStorage.java
UTF-8
1,183
1.984375
2
[ "BSD-3-Clause" ]
permissive
/* * Copyright (c) 2011-2022, PCJ Library, Marek Nowicki * All rights reserved. * * Licensed under New BSD License (3-clause license). * * See the file "LICENSE" for the full license governing this code. */ package org.pcj; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Repeatable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.pcj.internal.RegisterStorageRepeatableContainer; /** * Annotation for class implementing StartPoint interface. * <p> * It tells which storage should be automatically register on start up of class implementing * StartPoint interface. * <p> * When value is omitted, all enums annotated with {@literal @}Storage in StartPoint class will be registered. * <p> * Can be used multiple times per StartPoint class. * * @author Marek Nowicki (faramir@mat.umk.pl) */ @Repeatable(RegisterStorageRepeatableContainer.class) @Documented @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface RegisterStorage { Class<? extends Enum<?>>[] value() default {}; }
true
cee36ead4d8857fffb3db9e8301ebb8fa708ccdf
Java
Simonnnnnnnn/JVM
/chapter08/src/com/infocore/java/SimpleHeap.java
UTF-8
587
3.125
3
[]
no_license
package com.infocore.java; /** * @author XiangZhang * @date 2020/6/15 - 17:05 */ public class SimpleHeap { private int id; public SimpleHeap(int id) { this.id = id; } public void show(){ System.out.println("My ID is" + id); } public static void main(String[] args) { SimpleHeap h1 = new SimpleHeap(1); SimpleHeap h2 = new SimpleHeap(2); //注意,当方法执行完弹栈了,这两个对象不是马上就被GC回收的 // int[] arr = new int[10]; // // Object[] arr1 = new Object[10]; } }
true
8542e37af696fb7bfc19006421a1f7c1ff832dd3
Java
saesas/SaeFinal
/src/main/java/com/sae/persistence/dao/FiguraSolucionJpaController.java
UTF-8
8,272
2.1875
2
[]
no_license
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.sae.persistence.dao; import com.sae.persistence.util.JpaUtil; import com.sae.persistence.dao.exceptions.NonexistentEntityException; import com.sae.persistence.dao.exceptions.PreexistingEntityException; import java.io.Serializable; import javax.persistence.Query; import javax.persistence.EntityNotFoundException; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Root; import com.sae.persistence.domain.SolucionProceso; import com.sae.persistence.domain.Figura; import com.sae.persistence.domain.FiguraSolucion; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; /** * * @author SAE2 */ public class FiguraSolucionJpaController implements Serializable { public FiguraSolucionJpaController() { this.emf = JpaUtil.getEmf(); } private EntityManagerFactory emf = null; public EntityManager getEntityManager() { return emf.createEntityManager(); } public void create(FiguraSolucion figuraSolucion) throws PreexistingEntityException, Exception { EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); SolucionProceso idSolucion = figuraSolucion.getIdSolucion(); if (idSolucion != null) { idSolucion = em.getReference(idSolucion.getClass(), idSolucion.getId()); figuraSolucion.setIdSolucion(idSolucion); } Figura idFigura = figuraSolucion.getIdFigura(); if (idFigura != null) { idFigura = em.getReference(idFigura.getClass(), idFigura.getId()); figuraSolucion.setIdFigura(idFigura); } em.persist(figuraSolucion); if (idSolucion != null) { idSolucion.getFiguraSolucionList().add(figuraSolucion); idSolucion = em.merge(idSolucion); } if (idFigura != null) { idFigura.getFiguraSolucionList().add(figuraSolucion); idFigura = em.merge(idFigura); } em.getTransaction().commit(); } catch (Exception ex) { if (findFiguraSolucion(figuraSolucion.getId()) != null) { throw new PreexistingEntityException("FiguraSolucion " + figuraSolucion + " already exists.", ex); } throw ex; } finally { if (em != null) { em.close(); } } } public void edit(FiguraSolucion figuraSolucion) throws NonexistentEntityException, Exception { EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); FiguraSolucion persistentFiguraSolucion = em.find(FiguraSolucion.class, figuraSolucion.getId()); SolucionProceso idSolucionOld = persistentFiguraSolucion.getIdSolucion(); SolucionProceso idSolucionNew = figuraSolucion.getIdSolucion(); Figura idFiguraOld = persistentFiguraSolucion.getIdFigura(); Figura idFiguraNew = figuraSolucion.getIdFigura(); if (idSolucionNew != null) { idSolucionNew = em.getReference(idSolucionNew.getClass(), idSolucionNew.getId()); figuraSolucion.setIdSolucion(idSolucionNew); } if (idFiguraNew != null) { idFiguraNew = em.getReference(idFiguraNew.getClass(), idFiguraNew.getId()); figuraSolucion.setIdFigura(idFiguraNew); } figuraSolucion = em.merge(figuraSolucion); if (idSolucionOld != null && !idSolucionOld.equals(idSolucionNew)) { idSolucionOld.getFiguraSolucionList().remove(figuraSolucion); idSolucionOld = em.merge(idSolucionOld); } if (idSolucionNew != null && !idSolucionNew.equals(idSolucionOld)) { idSolucionNew.getFiguraSolucionList().add(figuraSolucion); idSolucionNew = em.merge(idSolucionNew); } if (idFiguraOld != null && !idFiguraOld.equals(idFiguraNew)) { idFiguraOld.getFiguraSolucionList().remove(figuraSolucion); idFiguraOld = em.merge(idFiguraOld); } if (idFiguraNew != null && !idFiguraNew.equals(idFiguraOld)) { idFiguraNew.getFiguraSolucionList().add(figuraSolucion); idFiguraNew = em.merge(idFiguraNew); } em.getTransaction().commit(); } catch (Exception ex) { String msg = ex.getLocalizedMessage(); if (msg == null || msg.length() == 0) { Integer id = figuraSolucion.getId(); if (findFiguraSolucion(id) == null) { throw new NonexistentEntityException("The figuraSolucion with id " + id + " no longer exists."); } } throw ex; } finally { if (em != null) { em.close(); } } } public void destroy(Integer id) throws NonexistentEntityException { EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); FiguraSolucion figuraSolucion; try { figuraSolucion = em.getReference(FiguraSolucion.class, id); figuraSolucion.getId(); } catch (EntityNotFoundException enfe) { throw new NonexistentEntityException("The figuraSolucion with id " + id + " no longer exists.", enfe); } SolucionProceso idSolucion = figuraSolucion.getIdSolucion(); if (idSolucion != null) { idSolucion.getFiguraSolucionList().remove(figuraSolucion); idSolucion = em.merge(idSolucion); } Figura idFigura = figuraSolucion.getIdFigura(); if (idFigura != null) { idFigura.getFiguraSolucionList().remove(figuraSolucion); idFigura = em.merge(idFigura); } em.remove(figuraSolucion); em.getTransaction().commit(); } finally { if (em != null) { em.close(); } } } public List<FiguraSolucion> findFiguraSolucionEntities() { return findFiguraSolucionEntities(true, -1, -1); } public List<FiguraSolucion> findFiguraSolucionEntities(int maxResults, int firstResult) { return findFiguraSolucionEntities(false, maxResults, firstResult); } private List<FiguraSolucion> findFiguraSolucionEntities(boolean all, int maxResults, int firstResult) { EntityManager em = getEntityManager(); try { CriteriaQuery cq = em.getCriteriaBuilder().createQuery(); cq.select(cq.from(FiguraSolucion.class)); Query q = em.createQuery(cq); if (!all) { q.setMaxResults(maxResults); q.setFirstResult(firstResult); } return q.getResultList(); } finally { em.close(); } } public FiguraSolucion findFiguraSolucion(Integer id) { EntityManager em = getEntityManager(); try { return em.find(FiguraSolucion.class, id); } finally { em.close(); } } public int getFiguraSolucionCount() { EntityManager em = getEntityManager(); try { CriteriaQuery cq = em.getCriteriaBuilder().createQuery(); Root<FiguraSolucion> rt = cq.from(FiguraSolucion.class); cq.select(em.getCriteriaBuilder().count(rt)); Query q = em.createQuery(cq); return ((Long) q.getSingleResult()).intValue(); } finally { em.close(); } } }
true
0034b872ab826bbfe73db5c996f6f0708da24223
Java
haihanyin/springbootexamples
/jdbc/src/test/java/com/github/hh/sbes/jdbc/isolation/FilmServiceTest.java
UTF-8
1,848
2.15625
2
[ "Apache-2.0" ]
permissive
package com.github.hh.sbes.jdbc.isolation; import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.util.List; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = com.github.hh.sbes.jdbc.isolation.FilmServiceTest.TestConfiguration.class) public class FilmServiceTest { @Configuration @ComponentScan(basePackages = "com.github.hh.sbes.jdbc.isolation") static class TestConfiguration { } @Autowired private FilmWriteService filmWriteService; @Autowired private FilmReadService filmReadService; @Autowired private FilmDao filmDao; @After public void checkDataBase() { System.out.println("Database status:"); filmDao.findAllFilms().forEach(System.out::println); } @Test public void addReadUncommitted() { new Thread(() -> filmWriteService.updateFilm("xman", 99)).start(); filmReadService.listAllFilmsReadUncommitted(); } @Test public void addReadCommitted() { new Thread(() -> filmWriteService.updateFilm("xman", 99)).start(); filmReadService.listAllFilmsReadcommitted(); } @Test public void addReadRepeatableRead() { new Thread(() -> filmWriteService.updateFilm("xman", 89)).start(); filmReadService.listAllFilmsRepeatableRead(); } @Test public void addReadSerializable() { new Thread(() -> filmWriteService.updateFilm("xman", 99)).start(); filmReadService.listAllFilmsSerializable(); } }
true
7b37fa17109d9144a6f7749e478dfc77189d3df4
Java
SagarDep/HappiPlay
/app/src/main/java/com/example/mac/myapplication/ui/fragment/TabHosts.java
UTF-8
1,350
2.09375
2
[]
no_license
package com.example.mac.myapplication.ui.fragment; import com.example.mac.myapplication.R; public enum TabHosts { HOME(0, R.string.home, R.drawable.indicator_home_selector, MoneyFragment.class), BEAUTY(1, R.string.nearby, R.drawable.indicator_nearby_selector, NearbyFragment.class), ACTIVITY(2, R.string.activity, R.drawable.indicator_box_selector, BoxFragment.class), USER(3, R.string.user, R.drawable.indicator_me_selector, MeFragment.class); private int index; private int resName; private int resIcon; private Class<?> clz; TabHosts(int index, int resName, int resIcon, Class<?> clz) { this.index = index; this.resName = resName; this.resIcon = resIcon; this.clz = clz; } public int getIndex() { return index; } public void setIndex(int index) { this.index = index; } public int getResName() { return resName; } public void setResName(int resName) { this.resName = resName; } public int getResIcon() { return resIcon; } public void setResIcon(int resIcon) { this.resIcon = resIcon; } public Class<?> getClz() { return clz; } public void setClz(Class<?> clz) { this.clz = clz; } }
true
0cee2bd8bc51ea085ede24f6b5f45ee51bdc6f7b
Java
AbdallahRehab/Bus_Management
/src/sample/Registration.java
UTF-8
3,582
2.390625
2
[]
no_license
package sample; import Model.user; import com.jfoenix.controls.JFXPasswordField; import com.jfoenix.controls.JFXTextField; import javafx.application.Platform; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Alert; import utilities.DBConnection; import javax.swing.*; import java.io.IOException; import java.net.URL; import java.sql.*; import java.util.ResourceBundle; public class Registration implements Initializable { public JFXTextField First_Name_For_emp; public JFXTextField last_Name_For_emp; public JFXTextField email_emp; public JFXPasswordField Password_emp; public JFXPasswordField Comfirm_Password; @FXML public void close_app(){ Platform.exit(); } @FXML public void onBackClicked() throws IOException { Controller.registrationStage.close(); Main.sampleStage.show(); } @Override public void initialize(URL location, ResourceBundle resources) { /*user.currentUser = new user(sldkfsd); user.currentUser.getEmail();*/ try { Connection connection = DBConnection.getConnection(); // PreparedStatement ss=connection.prepareStatement("drop emp_info"); // ss.executeUpdate(); // PreparedStatement statement = connection.prepareStatement("insert into emp_info (First_name,Last_name,Salary,job) values (?,?,?,?)"); // statement.setString(1,"abdo"); // statement.setString(2,"re"); // statement.setString(3,"2346"); // statement.setString(4,"man"); // statement.executeUpdate(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } } public void register_emp(ActionEvent actionEvent) { boolean found_emp=false; try { Connection connection = DBConnection.getConnection(); if(!First_Name_For_emp.getText().isEmpty()&&!last_Name_For_emp.getText().isEmpty()&&!email_emp.getText().isEmpty() &&!Password_emp.getText().isEmpty()&&!Comfirm_Password.getText().isEmpty()){ // String s ="insert into loging (first_name,last_name,user_name,password)values ('"+First_Name_For_emp.getText()+"','"+last_Name_For_emp.getText()+"','"+email_emp.getText()+"','"+Comfirm_Password.getText()"')"; PreparedStatement statement = connection.prepareStatement("insert into loging (first_name,last_name,user_name,password)values ('"+First_Name_For_emp.getText()+"','"+last_Name_For_emp.getText()+"','"+email_emp.getText()+"','"+Comfirm_Password.getText()+"')"); found_emp=true; System.out.println("sdff"); showAlert(Alert.AlertType.INFORMATION, "Form Error!", "Successfully!, "); statement.executeUpdate(); } } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } if(!found_emp){ showAlert(Alert.AlertType.ERROR, "Form Error!", "Please enter a password"); } } private void showAlert(Alert.AlertType alertType, String title, String message) { Alert alert = new Alert(alertType); alert.setTitle(title); alert.setHeaderText(null); alert.setContentText(message); alert.show(); } }
true
4f444b3a8cc97e2c5d536a1c94813c293bf45b54
Java
VitorPinheiro/ICarePatient
/app/src/main/java/br/pucrio/inf/lac/mhub/injection/module/ApplicationModule.java
UTF-8
448
2.109375
2
[]
no_license
package br.pucrio.inf.lac.mhub.injection.module; import android.app.Application; import android.content.Context; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; @Module public class ApplicationModule { private final Application mApp; public ApplicationModule( Application app ) { mApp = app; } @Provides @Singleton public Context providesApplication(){ return mApp; } }
true
c2bf78f1bd25f70cc9b8d234b4630cab39f6d027
Java
visualkhh/book-visualkhh
/it/java/java NIO server_client 고성능 비동기식 서버만들기 자바/자바 IO NIO 네트워크프로그래밍 source/4장/src/ByteArrayInputOutputTest.java
UHC
1,640
3.40625
3
[]
no_license
import java.io.*; public class ByteArrayInputOutputTest { public static void main(String[] args) { if(args.length != 1){ System.out.println(" : java ByteArrayInputOutputTest ̸"); System.exit(0); } // if end FileInputStream fis = null; ByteArrayInputStream bais = null; ByteArrayOutputStream baos = null; try{ fis = new FileInputStream(args[0]); baos = new ByteArrayOutputStream(); byte[] buffer = new byte[512]; int readcount = 0; // Ϸ о byte迭 ByteArrayOutputStream . while((readcount = fis.read(buffer)) != -1){ baos.write(buffer, 0, readcount); } // ByteArrayOutputStream Ʈ 迭 ȯѴ. byte[] fileArray = baos.toByteArray(); System.out.println(" о鿩 byte[] ϴ."); System.out.println("о byte :" + fileArray.length); // byte[] о̴ ByteArrayInputStrem Ѵ. bais = new ByteArrayInputStream(fileArray); // ByteArrayInputStream Ͽ о byte迭 ǥ ġ() // Ѵ. while((readcount = bais.read(buffer)) != -1){ System.out.write(buffer, 0, readcount); } System.out.println("\n\n"); System.out.println("о Ͽϴ."); }catch(Exception ex){ System.out.println(ex); }finally{ try{ fis.close(); bais.close(); baos.close(); }catch(IOException ioe){ System.out.println(ioe); } } } }
true
07feaf88facddca9d47690cc360af4225304a1d4
Java
cygni/texas-holdem-botgame
/common/src/main/java/se/cygni/texasholdem/game/exception/InvalidNameException.java
UTF-8
545
2.21875
2
[]
no_license
package se.cygni.texasholdem.game.exception; public class InvalidNameException extends GameException { private static final long serialVersionUID = 5009842166127191132L; public InvalidNameException() { super(); } public InvalidNameException(final String message, final Throwable cause) { super(message, cause); } public InvalidNameException(final String message) { super(message); } public InvalidNameException(final Throwable cause) { super(cause); } }
true
43b647913cad30cf996f64eb372efaccc98d1303
Java
igor-buzhinsky/indin2015_source
/fb/src/fb/rt/waterprocess/System_NoOutput__Composite.java
UTF-8
188,722
1.53125
2
[]
no_license
package fb.rt.waterprocess; import fb.rt.*; import fb.rt.net.*; import fb.datatype.*; public class System_NoOutput__Composite { private final System_NoOutput instance = new System_NoOutput(); public void event_INIT(float IA_L101_, float IA_L201_, float IA_L301_, float IA_L401_, float IA_T100_, float IA_F100_, float IA_F200_, float IA_T300_, float IA_P300_, boolean ID_L100_, boolean ID_L102_, boolean ID_L200_, boolean ID_L202_, boolean ID_L300_, boolean ID_L302_, boolean ID_L400_, boolean ID_L402_) { instance.IA_L101.value = IA_L101_; instance.IA_L201.value = IA_L201_; instance.IA_L301.value = IA_L301_; instance.IA_L401.value = IA_L401_; instance.IA_T100.value = IA_T100_; instance.IA_F100.value = IA_F100_; instance.IA_F200.value = IA_F200_; instance.IA_T300.value = IA_T300_; instance.IA_P300.value = IA_P300_; instance.ID_L100.value = ID_L100_; instance.ID_L102.value = ID_L102_; instance.ID_L200.value = ID_L200_; instance.ID_L202.value = ID_L202_; instance.ID_L300.value = ID_L300_; instance.ID_L302.value = ID_L302_; instance.ID_L400.value = ID_L400_; instance.ID_L402.value = ID_L402_; instance.INIT.serviceEvent(instance); } public void event_REQ(float IA_L101_, float IA_L201_, float IA_L301_, float IA_L401_, float IA_T100_, float IA_F100_, float IA_F200_, float IA_T300_, float IA_P300_, boolean ID_L100_, boolean ID_L102_, boolean ID_L200_, boolean ID_L202_, boolean ID_L300_, boolean ID_L302_, boolean ID_L400_, boolean ID_L402_) { instance.IA_L101.value = IA_L101_; instance.IA_L201.value = IA_L201_; instance.IA_L301.value = IA_L301_; instance.IA_L401.value = IA_L401_; instance.IA_T100.value = IA_T100_; instance.IA_F100.value = IA_F100_; instance.IA_F200.value = IA_F200_; instance.IA_T300.value = IA_T300_; instance.IA_P300.value = IA_P300_; instance.ID_L100.value = ID_L100_; instance.ID_L102.value = ID_L102_; instance.ID_L200.value = ID_L200_; instance.ID_L202.value = ID_L202_; instance.ID_L300.value = ID_L300_; instance.ID_L302.value = ID_L302_; instance.ID_L400.value = ID_L400_; instance.ID_L402.value = ID_L402_; instance.REQ.serviceEvent(instance); } /* Copyright (c)2015 nxtControl GmbH. All rights reserved. */ /** FUNCTION_BLOCK System_NoOutput * @author Администратор * @version 20150208/Администратор */ private class System_NoOutput extends FBInstance { /** VAR IA_L101 */ public REAL IA_L101 = new REAL(); /** VAR IA_L201 */ public REAL IA_L201 = new REAL(); /** VAR IA_L301 */ public REAL IA_L301 = new REAL(); /** VAR IA_L401 */ public REAL IA_L401 = new REAL(); /** VAR IA_T100 */ public REAL IA_T100 = new REAL(); /** VAR IA_F100 */ public REAL IA_F100 = new REAL(); /** VAR IA_F200 */ public REAL IA_F200 = new REAL(); /** VAR IA_T300 */ public REAL IA_T300 = new REAL(); /** VAR IA_P300 */ public REAL IA_P300 = new REAL(); /** VAR ID_L100 */ public BOOL ID_L100 = new BOOL(); /** VAR ID_L102 */ public BOOL ID_L102 = new BOOL(); /** VAR ID_L200 */ public BOOL ID_L200 = new BOOL(); /** VAR ID_L202 */ public BOOL ID_L202 = new BOOL(); /** VAR ID_L300 */ public BOOL ID_L300 = new BOOL(); /** VAR ID_L302 */ public BOOL ID_L302 = new BOOL(); /** VAR ID_L400 */ public BOOL ID_L400 = new BOOL(); /** VAR ID_L402 */ public BOOL ID_L402 = new BOOL(); /** EVENT INIT */ public EventOutput INIT = new EventOutput(); /** EVENT REQ */ public EventOutput REQ = new EventOutput(); /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ /** {@inheritDoc} * @param ivName {@inheritDoc} * @param newIV {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ /** Connect the given variable to the input variable IA_L101 * @param newIV The variable to connect * @throws FBRManagementException An internal connection failed. */ /** Connect the given variable to the input variable IA_L201 * @param newIV The variable to connect * @throws FBRManagementException An internal connection failed. */ /** Connect the given variable to the input variable IA_L301 * @param newIV The variable to connect * @throws FBRManagementException An internal connection failed. */ /** Connect the given variable to the input variable IA_L401 * @param newIV The variable to connect * @throws FBRManagementException An internal connection failed. */ /** Connect the given variable to the input variable IA_T100 * @param newIV The variable to connect * @throws FBRManagementException An internal connection failed. */ /** Connect the given variable to the input variable IA_F100 * @param newIV The variable to connect * @throws FBRManagementException An internal connection failed. */ /** Connect the given variable to the input variable IA_F200 * @param newIV The variable to connect * @throws FBRManagementException An internal connection failed. */ /** Connect the given variable to the input variable IA_T300 * @param newIV The variable to connect * @throws FBRManagementException An internal connection failed. */ /** Connect the given variable to the input variable IA_P300 * @param newIV The variable to connect * @throws FBRManagementException An internal connection failed. */ /** Connect the given variable to the input variable ID_L100 * @param newIV The variable to connect * @throws FBRManagementException An internal connection failed. */ /** Connect the given variable to the input variable ID_L102 * @param newIV The variable to connect * @throws FBRManagementException An internal connection failed. */ /** Connect the given variable to the input variable ID_L200 * @param newIV The variable to connect * @throws FBRManagementException An internal connection failed. */ /** Connect the given variable to the input variable ID_L202 * @param newIV The variable to connect * @throws FBRManagementException An internal connection failed. */ /** Connect the given variable to the input variable ID_L300 * @param newIV The variable to connect * @throws FBRManagementException An internal connection failed. */ /** Connect the given variable to the input variable ID_L302 * @param newIV The variable to connect * @throws FBRManagementException An internal connection failed. */ /** Connect the given variable to the input variable ID_L400 * @param newIV The variable to connect * @throws FBRManagementException An internal connection failed. */ /** Connect the given variable to the input variable ID_L402 * @param newIV The variable to connect * @throws FBRManagementException An internal connection failed. */ /** FB T100WaterLevel */ protected Service_ADIMeasure T100WaterLevel = new Service_ADIMeasure() ; /** FB T200WaterLevel */ protected Service_ADIMeasure T200WaterLevel = new Service_ADIMeasure() ; /** FB T300WaterLevel */ protected Service_ADIMeasure T300WaterLevel = new Service_ADIMeasure() ; /** FB T400WaterLevel */ protected Service_ADIMeasure T400WaterLevel = new Service_ADIMeasure() ; /** FB T100Temperature */ protected Service_AIMeasure T100Temperature = new Service_AIMeasure() ; /** FB F100Flow */ protected Service_AIMeasure F100Flow = new Service_AIMeasure() ; /** FB F200Flow */ protected Service_AIMeasure F200Flow = new Service_AIMeasure() ; /** FB T300Temperature */ protected Service_AIMeasure T300Temperature = new Service_AIMeasure() ; /** FB P300Pressure */ protected Service_AIMeasure P300Pressure = new Service_AIMeasure() ; /** FB T100TankControl */ protected FB_TankControl T100TankControl = new FB_TankControl() ; /** FB T200TankControl */ protected FB_TankControl T200TankControl = new FB_TankControl() ; /** FB T300TankControl */ protected FB_TankControl T300TankControl = new FB_TankControl() ; /** FB T400TankControl */ protected FB_TankControl T400TankControl = new FB_TankControl() ; /** FB M100PumpPIDControl */ protected FB_PIDControl M100PumpPIDControl = new FB_PIDControl() ; /** FB M200PumpPIDControl */ protected FB_PIDControl M200PumpPIDControl = new FB_PIDControl() ; /** FB WaterProcessSequenceControl */ protected FB_SequenceControl WaterProcessSequenceControl = new FB_SequenceControl() ; /** FB WaterProcessInterlockControl */ protected FB_InterlockControl WaterProcessInterlockControl = new FB_InterlockControl() ; /** FB E100HeaterControl */ protected FB_HeaterControl E100HeaterControl = new FB_HeaterControl() ; /** FB M100PumpControl */ protected FB_PumpControl M100PumpControl = new FB_PumpControl() ; /** FB M200PumpControl */ protected FB_PumpControl M200PumpControl = new FB_PumpControl() ; /** FB Y101ValveControl */ protected FB_ValveControl Y101ValveControl = new FB_ValveControl() ; /** FB Y102ValveControl */ protected FB_ValveControl Y102ValveControl = new FB_ValveControl() ; /** FB Y103ValveControl */ protected FB_ValveControl Y103ValveControl = new FB_ValveControl() ; /** FB Y105ValveControl */ protected FB_ValveControl Y105ValveControl = new FB_ValveControl() ; /** FB Y201ValveControl */ protected FB_ValveControl Y201ValveControl = new FB_ValveControl() ; /** FB Y202ValveControl */ protected FB_ValveControl Y202ValveControl = new FB_ValveControl() ; /** FB Y203ValveControl */ protected FB_ValveControl Y203ValveControl = new FB_ValveControl() ; /** FB Y204ValveControl */ protected FB_ValveControl Y204ValveControl = new FB_ValveControl() ; /** FB Y501ValveControl */ protected FB_ValveControl Y501ValveControl = new FB_ValveControl() ; /** FB Y404ValveControl */ protected FB_ValveControl Y404ValveControl = new FB_ValveControl() ; /** FB Y401ValveControl */ protected FB_ValveControl Y401ValveControl = new FB_ValveControl() ; /** FB Y303ValveControl */ protected FB_ValveControl Y303ValveControl = new FB_ValveControl() ; /** FB Y403ValveControl */ protected FB_ValveControl Y403ValveControl = new FB_ValveControl() ; /** FB Y402ValveControl */ protected FB_ValveControl Y402ValveControl = new FB_ValveControl() ; /** FB Y305ValveControl */ protected FB_ValveControl Y305ValveControl = new FB_ValveControl() ; /** FB Y302ValveControl */ protected FB_ValveControl Y302ValveControl = new FB_ValveControl() ; /** FB Y301ValveControl */ protected FB_ValveControl Y301ValveControl = new FB_ValveControl() ; /** FB M100Control */ protected Service_AOControl M100Control = new Service_AOControl() ; /** FB M200Control */ protected Service_AOControl M200Control = new Service_AOControl() ; /** FB Y102Control */ protected Service_AOControl Y102Control = new Service_AOControl() ; /** FB Y201Control */ protected Service_AOControl Y201Control = new Service_AOControl() ; /** FB E100Control */ protected Service_DOControl E100Control = new Service_DOControl() ; /** FB Y101Control */ protected Service_DOControl Y101Control = new Service_DOControl() ; /** FB Y103Control */ protected Service_DOControl Y103Control = new Service_DOControl() ; /** FB Y105Control */ protected Service_DOControl Y105Control = new Service_DOControl() ; /** FB Y202Control */ protected Service_DOControl Y202Control = new Service_DOControl() ; /** FB Y203Control */ protected Service_DOControl Y203Control = new Service_DOControl() ; /** FB Y204Control */ protected Service_DOControl Y204Control = new Service_DOControl() ; /** FB Y301Control */ protected Service_DOControl Y301Control = new Service_DOControl() ; /** FB Y302Control */ protected Service_DOControl Y302Control = new Service_DOControl() ; /** FB Y303Control */ protected Service_DOControl Y303Control = new Service_DOControl() ; /** FB Y305Control */ protected Service_DOControl Y305Control = new Service_DOControl() ; /** FB Y401Control */ protected Service_DOControl Y401Control = new Service_DOControl() ; /** FB Y402Control */ protected Service_DOControl Y402Control = new Service_DOControl() ; /** FB Y403Control */ protected Service_DOControl Y403Control = new Service_DOControl() ; /** FB Y404Control */ protected Service_DOControl Y404Control = new Service_DOControl() ; /** FB Y501Control */ protected Service_DOControl Y501Control = new Service_DOControl() ; /** FB FB1 */ protected NOT1 FB1 = new NOT1() ; /** FB FB6 */ protected NOT2 FB6 = new NOT2() ; /** FB FB5 */ protected NOT3 FB5 = new NOT3() ; /** FB FB7 */ protected NOT1 FB7 = new NOT1() ; /** FB FB8 */ protected NOT1 FB8 = new NOT1() ; /** FB FB11 */ protected NOT10 FB11 = new NOT10() ; /** FB FB9 */ protected NOT16 FB9 = new NOT16() ; /** The default constructor. */ public System_NoOutput() { super(); T100WaterLevel.INITO.connectTo(T200WaterLevel.INIT); T100WaterLevel.CNF.connectTo(T200WaterLevel.REQ); T200WaterLevel.INITO.connectTo(T300WaterLevel.INIT); T300WaterLevel.INITO.connectTo(T400WaterLevel.INIT); T200WaterLevel.CNF.connectTo(T300WaterLevel.REQ); T300WaterLevel.CNF.connectTo(T400WaterLevel.REQ); T400WaterLevel.INITO.connectTo(T100Temperature.INIT); T400WaterLevel.CNF.connectTo(T100Temperature.REQ); T100Temperature.INITO.connectTo(F100Flow.INIT); T100Temperature.CNF.connectTo(F100Flow.REQ); F100Flow.INITO.connectTo(F200Flow.INIT); F100Flow.CNF.connectTo(F200Flow.REQ); F200Flow.INITO.connectTo(T300Temperature.INIT); F200Flow.CNF.connectTo(T300Temperature.REQ); T300Temperature.INITO.connectTo(P300Pressure.INIT); T300Temperature.CNF.connectTo(P300Pressure.REQ); P300Pressure.INITO.connectTo(T100TankControl.INIT); P300Pressure.CNF.connectTo(FB6.REQ); FB6.CNF.connectTo(T100TankControl.REQ); T100TankControl.INITO.connectTo(T200TankControl.INIT); T200TankControl.INITO.connectTo(T300TankControl.INIT); T300TankControl.INITO.connectTo(T400TankControl.INIT); T100TankControl.CNF.connectTo(FB1.REQ); T200TankControl.CNF.connectTo(FB5.REQ); FB5.CNF.connectTo(T300TankControl.REQ); T300TankControl.CNF.connectTo(FB7.REQ); FB7.CNF.connectTo(T400TankControl.REQ); T400TankControl.INITO.connectTo(M100PumpPIDControl.INIT); T400TankControl.CNF.connectTo(M100PumpPIDControl.REQ); M100PumpPIDControl.INITO.connectTo(M200PumpPIDControl.INIT); M100PumpPIDControl.CNF.connectTo(M200PumpPIDControl.REQ); M200PumpPIDControl.INITO.connectTo(WaterProcessSequenceControl.INIT); WaterProcessSequenceControl.INITO.connectTo(WaterProcessInterlockControl.INIT); WaterProcessInterlockControl.INITO.connectTo(E100HeaterControl.INIT); WaterProcessInterlockControl.CNF.connectTo(E100HeaterControl.REQ); E100HeaterControl.INITO.connectTo(M100PumpControl.INIT); E100HeaterControl.CNF.connectTo(M100PumpControl.REQ); M100PumpControl.INITO.connectTo(M200PumpControl.INIT); M100PumpControl.CNF.connectTo(M200PumpControl.REQ); M200PumpControl.INITO.connectTo(Y101ValveControl.INIT); M200PumpControl.CNF.connectTo(Y101ValveControl.REQ); Y101ValveControl.INITO.connectTo(Y102ValveControl.INIT); Y101ValveControl.CNF.connectTo(Y102ValveControl.REQ); Y102ValveControl.INITO.connectTo(Y103ValveControl.INIT); Y102ValveControl.CNF.connectTo(Y103ValveControl.REQ); Y103ValveControl.INITO.connectTo(Y105ValveControl.INIT); Y103ValveControl.CNF.connectTo(Y105ValveControl.REQ); Y105ValveControl.INITO.connectTo(Y201ValveControl.INIT); Y105ValveControl.CNF.connectTo(Y201ValveControl.REQ); Y201ValveControl.INITO.connectTo(Y202ValveControl.INIT); Y201ValveControl.CNF.connectTo(Y202ValveControl.REQ); Y202ValveControl.INITO.connectTo(Y203ValveControl.INIT); Y202ValveControl.CNF.connectTo(Y203ValveControl.REQ); Y203ValveControl.INITO.connectTo(Y204ValveControl.INIT); Y203ValveControl.CNF.connectTo(Y204ValveControl.REQ); Y204ValveControl.INITO.connectTo(Y301ValveControl.INIT); Y204ValveControl.CNF.connectTo(Y301ValveControl.REQ); Y301ValveControl.INITO.connectTo(Y302ValveControl.INIT); Y301ValveControl.CNF.connectTo(Y302ValveControl.REQ); Y302ValveControl.INITO.connectTo(Y303ValveControl.INIT); Y302ValveControl.CNF.connectTo(Y303ValveControl.REQ); Y303ValveControl.INITO.connectTo(Y305ValveControl.INIT); Y303ValveControl.CNF.connectTo(Y305ValveControl.REQ); Y305ValveControl.INITO.connectTo(Y401ValveControl.INIT); Y305ValveControl.CNF.connectTo(Y401ValveControl.REQ); Y401ValveControl.INITO.connectTo(Y402ValveControl.INIT); Y401ValveControl.CNF.connectTo(Y402ValveControl.REQ); Y402ValveControl.INITO.connectTo(Y403ValveControl.INIT); Y402ValveControl.CNF.connectTo(Y403ValveControl.REQ); Y403ValveControl.INITO.connectTo(Y404ValveControl.INIT); Y403ValveControl.CNF.connectTo(Y404ValveControl.REQ); Y404ValveControl.INITO.connectTo(Y501ValveControl.INIT); Y404ValveControl.CNF.connectTo(Y501ValveControl.REQ); M200PumpPIDControl.CNF.connectTo(FB11.REQ); FB11.CNF.connectTo(WaterProcessSequenceControl.REQ); WaterProcessSequenceControl.CNF.connectTo(FB9.REQ); FB9.CNF.connectTo(FB8.REQ); FB8.CNF.connectTo(WaterProcessInterlockControl.REQ); Y501ValveControl.INITO.connectTo(M100Control.INIT); Y501ValveControl.CNF.connectTo(M100Control.REQ); M100Control.INITO.connectTo(M200Control.INIT); M100Control.CNF.connectTo(M200Control.REQ); M200Control.INITO.connectTo(Y102Control.INIT); M200Control.CNF.connectTo(Y102Control.REQ); Y102Control.INITO.connectTo(Y201Control.INIT); Y102Control.CNF.connectTo(Y201Control.REQ); Y201Control.INITO.connectTo(E100Control.INIT); Y201Control.CNF.connectTo(E100Control.REQ); Y204Control.INITO.connectTo(Y301Control.INIT); Y204Control.CNF.connectTo(Y301Control.REQ); E100Control.INITO.connectTo(Y101Control.INIT); E100Control.CNF.connectTo(Y101Control.REQ); Y101Control.INITO.connectTo(Y103Control.INIT); Y101Control.CNF.connectTo(Y103Control.REQ); Y103Control.INITO.connectTo(Y105Control.INIT); Y103Control.CNF.connectTo(Y105Control.REQ); Y105Control.INITO.connectTo(Y202Control.INIT); Y105Control.CNF.connectTo(Y202Control.REQ); Y202Control.INITO.connectTo(Y203Control.INIT); Y202Control.CNF.connectTo(Y203Control.REQ); Y203Control.INITO.connectTo(Y204Control.INIT); Y203Control.CNF.connectTo(Y204Control.REQ); Y301Control.INITO.connectTo(Y302Control.INIT); Y301Control.CNF.connectTo(Y302Control.REQ); Y302Control.INITO.connectTo(Y303Control.INIT); Y302Control.CNF.connectTo(Y303Control.REQ); Y303Control.INITO.connectTo(Y305Control.INIT); Y303Control.CNF.connectTo(Y305Control.REQ); Y305Control.INITO.connectTo(Y401Control.INIT); Y305Control.CNF.connectTo(Y401Control.REQ); Y401Control.INITO.connectTo(Y402Control.INIT); Y401Control.CNF.connectTo(Y402Control.REQ); Y402Control.INITO.connectTo(Y403Control.INIT); Y402Control.CNF.connectTo(Y403Control.REQ); Y403Control.INITO.connectTo(Y404Control.INIT); Y403Control.CNF.connectTo(Y404Control.REQ); Y404Control.INITO.connectTo(Y501Control.INIT); Y404Control.CNF.connectTo(Y501Control.REQ); INIT.connectTo(T100WaterLevel.INIT); FB1.CNF.connectTo(T200TankControl.REQ); REQ.connectTo(T100WaterLevel.REQ); T100WaterLevel.connectIVNoException("DIH",ID_L100); T100WaterLevel.connectIVNoException("DIL",ID_L102); T200WaterLevel.connectIVNoException("DIH",ID_L200); T200WaterLevel.connectIVNoException("DIL",ID_L202); T300WaterLevel.connectIVNoException("DIH",ID_L300); T300WaterLevel.connectIVNoException("DIL",ID_L302); T400WaterLevel.connectIVNoException("DIH",ID_L400); T400WaterLevel.connectIVNoException("DIL",ID_L402); F100Flow.connectIVNoException("AI",IA_F100); F200Flow.connectIVNoException("AI",IA_F200); FB6.connectIVNoException("IN1",T100WaterLevel.ovNamedNoException("SensorFault")); FB6.connectIVNoException("IN2",T100Temperature.ovNamedNoException("SensorFault")); T100TankControl.connectIVNoException("WaterLevelSensorHighHealthy",FB6.ovNamedNoException("OUT1")); T100TankControl.connectIVNoException("TempSensorHealthy",FB6.ovNamedNoException("OUT2")); T100TankControl.connectIVNoException("WaterLevelSensorLLAlarm",T100WaterLevel.ovNamedNoException("AlarmLL")); T100TankControl.connectIVNoException("WaterLevelSensorLowHealthy",FB6.ovNamedNoException("OUT1")); FB1.connectIVNoException("IN1",T200WaterLevel.ovNamedNoException("SensorFault")); T200TankControl.connectIVNoException("WaterLevelSensorHighHealthy",FB1.ovNamedNoException("OUT1")); T200TankControl.connectIVNoException("WaterLevelSensorLowHealthy",FB1.ovNamedNoException("OUT1")); T200TankControl.connectIVNoException("WaterLevelSensorHHAlarm",T200WaterLevel.ovNamedNoException("AlarmHH")); T200TankControl.connectIVNoException("WaterLevelSensorLLAlarm",T200WaterLevel.ovNamedNoException("AlarmLL")); FB5.connectIVNoException("IN1",T300WaterLevel.ovNamedNoException("SensorFault")); T300TankControl.connectIVNoException("WaterLevelSensorHighHealthy",FB5.ovNamedNoException("OUT1")); T300TankControl.connectIVNoException("WaterLevelSensorLowHealthy",FB5.ovNamedNoException("OUT1")); FB5.connectIVNoException("IN2",T300Temperature.ovNamedNoException("SensorFault")); T300TankControl.connectIVNoException("TempSensorHealthy",FB5.ovNamedNoException("OUT2")); FB5.connectIVNoException("IN3",P300Pressure.ovNamedNoException("SensorFault")); T300TankControl.connectIVNoException("PressureSensorHealthy",FB5.ovNamedNoException("OUT3")); T300TankControl.connectIVNoException("TempSensorHHAlarm",T300Temperature.ovNamedNoException("AlarmHH")); T300TankControl.connectIVNoException("PressureSensorHHAlarm",P300Pressure.ovNamedNoException("AlarmHH")); T300TankControl.connectIVNoException("WaterLevelSensorHHAlarm",T300WaterLevel.ovNamedNoException("AlarmHH")); T300TankControl.connectIVNoException("WaterLevelSensorLLAlarm",T300WaterLevel.ovNamedNoException("AlarmLL")); FB7.connectIVNoException("IN1",T400WaterLevel.ovNamedNoException("SensorFault")); T400TankControl.connectIVNoException("WaterLevelSensorHighHealthy",FB7.ovNamedNoException("OUT1")); T400TankControl.connectIVNoException("WaterLevelSensorLowHealthy",FB7.ovNamedNoException("OUT1")); T100TankControl.connectIVNoException("WaterLevelSensorHHAlarm",T100WaterLevel.ovNamedNoException("AlarmHH")); T100TankControl.connectIVNoException("TempSensorHHAlarm",T100Temperature.ovNamedNoException("AlarmHH")); T400TankControl.connectIVNoException("WaterLevelSensorHHAlarm",T400WaterLevel.ovNamedNoException("AlarmHH")); T400TankControl.connectIVNoException("WaterLevelSensorLLAlarm",T400WaterLevel.ovNamedNoException("AlarmLL")); M100PumpPIDControl.connectIVNoException("PV",IA_F100); M200PumpPIDControl.connectIVNoException("PV",IA_F200); WaterProcessSequenceControl.connectIVNoException("T300_OverPressure",T300TankControl.ovNamedNoException("OverPresuure")); FB11.connectIVNoException("IN1",T100TankControl.ovNamedNoException("InfeedEnabled")); FB11.connectIVNoException("IN2",T100TankControl.ovNamedNoException("OutfeedEnabled")); FB11.connectIVNoException("IN3",T100TankControl.ovNamedNoException("HeatEnabled")); FB11.connectIVNoException("IN4",T200TankControl.ovNamedNoException("InfeedEnabled")); FB11.connectIVNoException("IN5",T200TankControl.ovNamedNoException("OutfeedEnabled")); FB11.connectIVNoException("IN6",T300TankControl.ovNamedNoException("InfeedEnabled")); FB11.connectIVNoException("IN7",T300TankControl.ovNamedNoException("OutfeedEnabled")); FB11.connectIVNoException("IN8",T300TankControl.ovNamedNoException("HeatEnabled")); WaterProcessSequenceControl.connectIVNoException("T100_Overflow",FB11.ovNamedNoException("OUT1")); WaterProcessSequenceControl.connectIVNoException("T100_Underflow",FB11.ovNamedNoException("OUT2")); WaterProcessSequenceControl.connectIVNoException("T100_Overheat",FB11.ovNamedNoException("OUT3")); WaterProcessSequenceControl.connectIVNoException("T200_Overflow",FB11.ovNamedNoException("OUT4")); WaterProcessSequenceControl.connectIVNoException("T200_Underflow",FB11.ovNamedNoException("OUT5")); WaterProcessSequenceControl.connectIVNoException("T300_Overflow",FB11.ovNamedNoException("OUT6")); WaterProcessSequenceControl.connectIVNoException("T300_Underflow",FB11.ovNamedNoException("OUT7")); WaterProcessSequenceControl.connectIVNoException("T300_Overheat",FB11.ovNamedNoException("OUT8")); FB11.connectIVNoException("IN9",T400TankControl.ovNamedNoException("InfeedEnabled")); WaterProcessSequenceControl.connectIVNoException("T400_Overflow",FB11.ovNamedNoException("OUT9")); FB11.connectIVNoException("IN10",T400TankControl.ovNamedNoException("OutfeedEnabled")); WaterProcessSequenceControl.connectIVNoException("T400_Underflow",FB11.ovNamedNoException("OUT10")); Y101ValveControl.connectIVNoException("RequestStart",WaterProcessSequenceControl.ovNamedNoException("Y101_Open")); Y102ValveControl.connectIVNoException("RequestStart",WaterProcessSequenceControl.ovNamedNoException("Y102_Open")); Y103ValveControl.connectIVNoException("RequestStart",WaterProcessSequenceControl.ovNamedNoException("Y103_Open")); Y105ValveControl.connectIVNoException("RequestStart",WaterProcessSequenceControl.ovNamedNoException("Y105_Open")); Y201ValveControl.connectIVNoException("RequestStart",WaterProcessSequenceControl.ovNamedNoException("Y201_Open")); Y202ValveControl.connectIVNoException("RequestStart",WaterProcessSequenceControl.ovNamedNoException("Y202_Open")); Y203ValveControl.connectIVNoException("RequestStart",WaterProcessSequenceControl.ovNamedNoException("Y203_Open")); Y204ValveControl.connectIVNoException("RequestStart",WaterProcessSequenceControl.ovNamedNoException("Y204_Open")); Y301ValveControl.connectIVNoException("RequestStart",WaterProcessSequenceControl.ovNamedNoException("Y301_Open")); Y302ValveControl.connectIVNoException("RequestStart",WaterProcessSequenceControl.ovNamedNoException("Y302_Open")); Y303ValveControl.connectIVNoException("RequestStart",WaterProcessSequenceControl.ovNamedNoException("Y303_Open")); Y305ValveControl.connectIVNoException("RequestStart",WaterProcessSequenceControl.ovNamedNoException("Y305_Open")); Y401ValveControl.connectIVNoException("RequestStart",WaterProcessSequenceControl.ovNamedNoException("Y401_Open")); Y402ValveControl.connectIVNoException("RequestStart",WaterProcessSequenceControl.ovNamedNoException("Y402_Open")); Y403ValveControl.connectIVNoException("RequestStart",WaterProcessSequenceControl.ovNamedNoException("Y403_Open")); Y404ValveControl.connectIVNoException("RequestStart",WaterProcessSequenceControl.ovNamedNoException("Y404_Open")); Y501ValveControl.connectIVNoException("RequestStart",WaterProcessSequenceControl.ovNamedNoException("Y501_Open")); E100HeaterControl.connectIVNoException("RequestStart",WaterProcessSequenceControl.ovNamedNoException("E100_On")); M100PumpControl.connectIVNoException("RequestStart",WaterProcessSequenceControl.ovNamedNoException("M100_On")); M200PumpControl.connectIVNoException("RequestStart",WaterProcessSequenceControl.ovNamedNoException("M200_On")); WaterProcessInterlockControl.connectIVNoException("T300_OverPressure",T300TankControl.ovNamedNoException("OverPresuure")); FB9.connectIVNoException("IN1",T100TankControl.ovNamedNoException("InfeedEnabled")); FB9.connectIVNoException("IN2",T100TankControl.ovNamedNoException("OutfeedEnabled")); FB9.connectIVNoException("IN3",T100TankControl.ovNamedNoException("HeatEnabled")); FB9.connectIVNoException("IN4",T200TankControl.ovNamedNoException("InfeedEnabled")); FB9.connectIVNoException("IN5",T200TankControl.ovNamedNoException("OutfeedEnabled")); FB9.connectIVNoException("IN6",T300TankControl.ovNamedNoException("InfeedEnabled")); FB9.connectIVNoException("IN7",T300TankControl.ovNamedNoException("OutfeedEnabled")); FB9.connectIVNoException("IN8",T300TankControl.ovNamedNoException("HeatEnabled")); FB9.connectIVNoException("IN9",T400TankControl.ovNamedNoException("InfeedEnabled")); FB9.connectIVNoException("IN10",T400TankControl.ovNamedNoException("OutfeedEnabled")); FB9.connectIVNoException("IN11",Y102ValveControl.ovNamedNoException("ValveOn")); WaterProcessInterlockControl.connectIVNoException("T100_Overflow",FB9.ovNamedNoException("OUT1")); WaterProcessInterlockControl.connectIVNoException("T100_Underflow",FB9.ovNamedNoException("OUT2")); WaterProcessInterlockControl.connectIVNoException("T100_Overheat",FB9.ovNamedNoException("OUT3")); WaterProcessInterlockControl.connectIVNoException("T200_Overflow",FB9.ovNamedNoException("OUT4")); WaterProcessInterlockControl.connectIVNoException("T200_Underflow",FB9.ovNamedNoException("OUT5")); WaterProcessInterlockControl.connectIVNoException("T300_Overflow",FB9.ovNamedNoException("OUT6")); WaterProcessInterlockControl.connectIVNoException("T300_Underflow",FB9.ovNamedNoException("OUT7")); WaterProcessInterlockControl.connectIVNoException("T300_Overheat",FB9.ovNamedNoException("OUT8")); WaterProcessInterlockControl.connectIVNoException("T400_Overflow",FB9.ovNamedNoException("OUT9")); WaterProcessInterlockControl.connectIVNoException("T400_Underflow",FB9.ovNamedNoException("OUT10")); WaterProcessInterlockControl.connectIVNoException("Y102_Closed",FB9.ovNamedNoException("OUT11")); FB9.connectIVNoException("IN12",Y201ValveControl.ovNamedNoException("ValveOn")); WaterProcessInterlockControl.connectIVNoException("Y201_Closed",FB9.ovNamedNoException("OUT12")); FB9.connectIVNoException("IN13",Y203ValveControl.ovNamedNoException("ValveOn")); WaterProcessInterlockControl.connectIVNoException("Y203_Closed",FB9.ovNamedNoException("OUT13")); FB9.connectIVNoException("IN15",Y301ValveControl.ovNamedNoException("ValveOn")); WaterProcessInterlockControl.connectIVNoException("Y301_Closed",FB9.ovNamedNoException("OUT15")); FB9.connectIVNoException("IN16",Y303ValveControl.ovNamedNoException("ValveOn")); WaterProcessInterlockControl.connectIVNoException("Y303_Closed",FB9.ovNamedNoException("OUT16")); WaterProcessInterlockControl.connectIVNoException("Y403_Closed",FB8.ovNamedNoException("OUT1")); FB8.connectIVNoException("IN1",Y403ValveControl.ovNamedNoException("ValveOn")); E100HeaterControl.connectIVNoException("ReadyToStart",WaterProcessInterlockControl.ovNamedNoException("E100_On")); M100PumpControl.connectIVNoException("ReadyToStart",WaterProcessInterlockControl.ovNamedNoException("M100_On")); M200PumpControl.connectIVNoException("ReadyToStart",WaterProcessInterlockControl.ovNamedNoException("M200_On")); M100PumpControl.connectIVNoException("RequestValue",M100PumpPIDControl.ovNamedNoException("OUT")); M200PumpControl.connectIVNoException("RequestValue",M200PumpPIDControl.ovNamedNoException("OUT")); Y101ValveControl.connectIVNoException("ReadyToStart",WaterProcessInterlockControl.ovNamedNoException("Y101_Open")); Y102ValveControl.connectIVNoException("ReadyToStart",WaterProcessInterlockControl.ovNamedNoException("Y102_Open")); Y103ValveControl.connectIVNoException("ReadyToStart",WaterProcessInterlockControl.ovNamedNoException("Y103_Open")); Y105ValveControl.connectIVNoException("ReadyToStart",WaterProcessInterlockControl.ovNamedNoException("Y105_Open")); Y201ValveControl.connectIVNoException("ReadyToStart",WaterProcessInterlockControl.ovNamedNoException("Y201_Open")); Y202ValveControl.connectIVNoException("ReadyToStart",WaterProcessInterlockControl.ovNamedNoException("Y202_Open")); Y203ValveControl.connectIVNoException("ReadyToStart",WaterProcessInterlockControl.ovNamedNoException("Y203_Open")); Y204ValveControl.connectIVNoException("ReadyToStart",WaterProcessInterlockControl.ovNamedNoException("Y204_Open")); Y301ValveControl.connectIVNoException("ReadyToStart",WaterProcessInterlockControl.ovNamedNoException("Y301_Open")); Y302ValveControl.connectIVNoException("ReadyToStart",WaterProcessInterlockControl.ovNamedNoException("Y302_Open")); Y303ValveControl.connectIVNoException("ReadyToStart",WaterProcessInterlockControl.ovNamedNoException("Y303_Open")); Y305ValveControl.connectIVNoException("ReadyToStart",WaterProcessInterlockControl.ovNamedNoException("Y305_Open")); Y401ValveControl.connectIVNoException("ReadyToStart",WaterProcessInterlockControl.ovNamedNoException("Y401_Open")); Y402ValveControl.connectIVNoException("ReadyToStart",WaterProcessInterlockControl.ovNamedNoException("Y402_Open")); Y403ValveControl.connectIVNoException("ReadyToStart",WaterProcessInterlockControl.ovNamedNoException("Y403_Open")); Y404ValveControl.connectIVNoException("ReadyToStart",WaterProcessInterlockControl.ovNamedNoException("Y404_Open")); Y501ValveControl.connectIVNoException("ReadyToStart",WaterProcessInterlockControl.ovNamedNoException("Y501_Open")); Y102ValveControl.connectIVNoException("RequestValue",M100PumpPIDControl.ovNamedNoException("OUT")); Y201ValveControl.connectIVNoException("RequestValue",M200PumpPIDControl.ovNamedNoException("OUT")); E100Control.connectIVNoException("CMD_ON",E100HeaterControl.ovNamedNoException("HeaterOn")); M100Control.connectIVNoException("AOValue",M100PumpControl.ovNamedNoException("PumpValue")); M200Control.connectIVNoException("AOValue",M200PumpControl.ovNamedNoException("PumpValue")); Y102Control.connectIVNoException("AOValue",Y102ValveControl.ovNamedNoException("ValveValue")); Y201Control.connectIVNoException("AOValue",Y201ValveControl.ovNamedNoException("ValveValue")); Y101Control.connectIVNoException("CMD_ON",Y101ValveControl.ovNamedNoException("ValveOn")); Y103Control.connectIVNoException("CMD_ON",Y103ValveControl.ovNamedNoException("ValveOn")); Y105Control.connectIVNoException("CMD_ON",Y105ValveControl.ovNamedNoException("ValveOn")); Y202Control.connectIVNoException("CMD_ON",Y202ValveControl.ovNamedNoException("ValveOn")); Y203Control.connectIVNoException("CMD_ON",Y203ValveControl.ovNamedNoException("ValveOn")); Y204Control.connectIVNoException("CMD_ON",Y204ValveControl.ovNamedNoException("ValveOn")); Y301Control.connectIVNoException("CMD_ON",Y301ValveControl.ovNamedNoException("ValveOn")); Y302Control.connectIVNoException("CMD_ON",Y302ValveControl.ovNamedNoException("ValveOn")); Y303Control.connectIVNoException("CMD_ON",Y303ValveControl.ovNamedNoException("ValveOn")); Y305Control.connectIVNoException("CMD_ON",Y305ValveControl.ovNamedNoException("ValveOn")); Y401Control.connectIVNoException("CMD_ON",Y401ValveControl.ovNamedNoException("ValveOn")); Y402Control.connectIVNoException("CMD_ON",Y402ValveControl.ovNamedNoException("ValveOn")); Y403Control.connectIVNoException("CMD_ON",Y403ValveControl.ovNamedNoException("ValveOn")); Y404Control.connectIVNoException("CMD_ON",Y404ValveControl.ovNamedNoException("ValveOn")); Y501Control.connectIVNoException("CMD_ON",Y501ValveControl.ovNamedNoException("ValveOn")); T100WaterLevel.connectIVNoException("AI",IA_L101); T200WaterLevel.connectIVNoException("AI",IA_L201); T300WaterLevel.connectIVNoException("AI",IA_L301); T400WaterLevel.connectIVNoException("AI",IA_L401); T100Temperature.connectIVNoException("AI",IA_T100); T300Temperature.connectIVNoException("AI",IA_T300); P300Pressure.connectIVNoException("AI",IA_P300); T100WaterLevel.PRESET_HH.initializeNoException("270.0"); T100WaterLevel.PRESET_H.initializeNoException("240.0"); T100WaterLevel.PRESET_L.initializeNoException("180.0"); T100WaterLevel.PRESET_LL.initializeNoException("160.0"); T100WaterLevel.PRESET_MINAI.initializeNoException("848.0"); T100WaterLevel.PRESET_MAXAI.initializeNoException("17844.0"); T200WaterLevel.PRESET_HH.initializeNoException("285.0"); T200WaterLevel.PRESET_H.initializeNoException("255.0"); T200WaterLevel.PRESET_L.initializeNoException("70.0"); T200WaterLevel.PRESET_LL.initializeNoException("40.0"); T200WaterLevel.PRESET_MINAI.initializeNoException("0"); T200WaterLevel.PRESET_MAXAI.initializeNoException("300.0"); T300WaterLevel.PRESET_HH.initializeNoException("285.0"); T300WaterLevel.PRESET_H.initializeNoException("255.0"); T300WaterLevel.PRESET_L.initializeNoException("70.0"); T300WaterLevel.PRESET_LL.initializeNoException("40.0"); T300WaterLevel.PRESET_MINAI.initializeNoException("0.0"); T300WaterLevel.PRESET_MAXAI.initializeNoException("300.0"); T400WaterLevel.PRESET_HH.initializeNoException("285.0"); T400WaterLevel.PRESET_H.initializeNoException("255.0"); T400WaterLevel.PRESET_L.initializeNoException("70.0"); T400WaterLevel.PRESET_LL.initializeNoException("40.0"); T400WaterLevel.PRESET_MINAI.initializeNoException("892.0"); T400WaterLevel.PRESET_MAXAI.initializeNoException("17723.0"); T100Temperature.PRESET_HH.initializeNoException("45.0"); T100Temperature.PRESET_H.initializeNoException("40.0"); T100Temperature.PRESET_L.initializeNoException("25.0"); T100Temperature.PRESET_LL.initializeNoException("20.0"); T100Temperature.PRESET_MINAI.initializeNoException("0.0"); T100Temperature.PRESET_MAXAI.initializeNoException("100.0"); F100Flow.PRESET_HH.initializeNoException("2.0"); F100Flow.PRESET_H.initializeNoException("1.95"); F100Flow.PRESET_L.initializeNoException("0.1"); F100Flow.PRESET_LL.initializeNoException("0.0"); F100Flow.PRESET_MINAI.initializeNoException("0.0"); F100Flow.PRESET_MAXAI.initializeNoException("2.5"); F200Flow.PRESET_HH.initializeNoException("2.0"); F200Flow.PRESET_H.initializeNoException("1.95"); F200Flow.PRESET_L.initializeNoException("0.1"); F200Flow.PRESET_LL.initializeNoException("0.0"); F200Flow.PRESET_MINAI.initializeNoException("0.0"); F200Flow.PRESET_MAXAI.initializeNoException("2.5"); T300Temperature.PRESET_HH.initializeNoException("45.0"); T300Temperature.PRESET_H.initializeNoException("40.0"); T300Temperature.PRESET_L.initializeNoException("25.0"); T300Temperature.PRESET_LL.initializeNoException("20.0"); T300Temperature.PRESET_MINAI.initializeNoException("0.0"); T300Temperature.PRESET_MAXAI.initializeNoException("100.0"); P300Pressure.PRESET_HH.initializeNoException("0.25"); P300Pressure.PRESET_H.initializeNoException("0.2"); P300Pressure.PRESET_L.initializeNoException("0.1"); P300Pressure.PRESET_LL.initializeNoException("0.0"); P300Pressure.PRESET_MINAI.initializeNoException("0"); P300Pressure.PRESET_MAXAI.initializeNoException("0.25"); T100TankControl.TempSensorIsConfigured.initializeNoException("TRUE"); T100TankControl.PressureSensorIsConfigured.initializeNoException("FALSE"); T100TankControl.PressureSensorHHAlarm.initializeNoException("FALSE"); T100TankControl.PressureSensorHealthy.initializeNoException("FALSE"); T100TankControl.WaterLevelSensorHighIsConfigured.initializeNoException("TRUE"); T100TankControl.WaterLevelSensorLowIsConfigured.initializeNoException("TRUE"); T100TankControl.WaterLevelSensorOverflowIsConfigured.initializeNoException("FALSE"); T100TankControl.WaterLevelSensorOverflowAlarm.initializeNoException("FALSE"); T100TankControl.WaterLevelSensorOverflowHealthy.initializeNoException("FALSE"); T200TankControl.WaterLevelSensorHighIsConfigured.initializeNoException("TRUE"); T200TankControl.WaterLevelSensorLowIsConfigured.initializeNoException("TRUE"); T200TankControl.TempSensorIsConfigured.initializeNoException("FALSE"); T200TankControl.TempSensorHHAlarm.initializeNoException("FALSE"); T200TankControl.TempSensorHealthy.initializeNoException("FALSE"); T200TankControl.PressureSensorIsConfigured.initializeNoException("FALSE"); T200TankControl.PressureSensorHHAlarm.initializeNoException("FALSE"); T200TankControl.PressureSensorHealthy.initializeNoException("FALSE"); T200TankControl.WaterLevelSensorOverflowIsConfigured.initializeNoException("FALSE"); T200TankControl.WaterLevelSensorOverflowAlarm.initializeNoException("FALSE"); T200TankControl.WaterLevelSensorOverflowHealthy.initializeNoException("FALSE"); T300TankControl.TempSensorIsConfigured.initializeNoException("TRUE"); T300TankControl.PressureSensorIsConfigured.initializeNoException("TRUE"); T300TankControl.WaterLevelSensorHighIsConfigured.initializeNoException("TRUE"); T300TankControl.WaterLevelSensorLowIsConfigured.initializeNoException("TRUE"); T300TankControl.WaterLevelSensorOverflowIsConfigured.initializeNoException("FALSE"); T300TankControl.WaterLevelSensorOverflowAlarm.initializeNoException("FALSE"); T300TankControl.WaterLevelSensorOverflowHealthy.initializeNoException("FALSE"); T400TankControl.WaterLevelSensorLowIsConfigured.initializeNoException("TRUE"); T400TankControl.PressureSensorHealthy.initializeNoException("FALSE"); T400TankControl.TempSensorIsConfigured.initializeNoException("FALSE"); T400TankControl.TempSensorHHAlarm.initializeNoException("FALSE"); T400TankControl.TempSensorHealthy.initializeNoException("FALSE"); T400TankControl.PressureSensorIsConfigured.initializeNoException("FALSE"); T400TankControl.PressureSensorHHAlarm.initializeNoException("FALSE"); T400TankControl.WaterLevelSensorHighIsConfigured.initializeNoException("TRUE"); T400TankControl.WaterLevelSensorOverflowIsConfigured.initializeNoException("FALSE"); T400TankControl.WaterLevelSensorOverflowAlarm.initializeNoException("FALSE"); T400TankControl.WaterLevelSensorOverflowHealthy.initializeNoException("FALSE"); M100PumpPIDControl.AutoMode.initializeNoException("TRUE"); M100PumpPIDControl.SP.initializeNoException("2.0"); M100PumpPIDControl.gain.initializeNoException("1.0"); M100PumpPIDControl.rate.initializeNoException("1.0"); M100PumpPIDControl.reset.initializeNoException("1.0"); M100PumpPIDControl.sample.initializeNoException("1.5"); M200PumpPIDControl.AutoMode.initializeNoException("TRUE"); M200PumpPIDControl.SP.initializeNoException("2.0"); M200PumpPIDControl.gain.initializeNoException("1.0"); M200PumpPIDControl.rate.initializeNoException("1.0"); M200PumpPIDControl.reset.initializeNoException("1.0"); M200PumpPIDControl.sample.initializeNoException("1.5"); WaterProcessSequenceControl.FillingSeqEnable.initializeNoException("FALSE"); WaterProcessSequenceControl.StartSeqEnable.initializeNoException("FALSE"); WaterProcessSequenceControl.ShutdownSeqEnable.initializeNoException("FALSE"); WaterProcessSequenceControl.EmptyingSeqEnable.initializeNoException("FALSE"); M100PumpControl.RangeOutMin.initializeNoException("0.0"); M100PumpControl.RangeOutMax.initializeNoException("100.0"); M200PumpControl.RangeOutMin.initializeNoException("0.0"); M200PumpControl.RangeOutMax.initializeNoException("100.0"); Y101ValveControl.IsControlValve.initializeNoException("FALSE"); Y101ValveControl.RangeOutMin.initializeNoException("0.0"); Y101ValveControl.RangeOutMax.initializeNoException("0.0"); Y101ValveControl.RequestValue.initializeNoException("0.0"); Y102ValveControl.RangeOutMin.initializeNoException("0.0"); Y102ValveControl.IsControlValve.initializeNoException("TRUE"); Y102ValveControl.RangeOutMax.initializeNoException("25630.0"); Y103ValveControl.IsControlValve.initializeNoException("FALSE"); Y103ValveControl.RangeOutMin.initializeNoException("0.0"); Y103ValveControl.RangeOutMax.initializeNoException("0.0"); Y103ValveControl.RequestValue.initializeNoException("0.0"); Y105ValveControl.IsControlValve.initializeNoException("FALSE"); Y105ValveControl.RangeOutMin.initializeNoException("0.0"); Y105ValveControl.RangeOutMax.initializeNoException("0.0"); Y105ValveControl.RequestValue.initializeNoException("0.0"); Y201ValveControl.IsControlValve.initializeNoException("TRUE"); Y201ValveControl.RangeOutMin.initializeNoException("0.0"); Y201ValveControl.RangeOutMax.initializeNoException("25630.0"); Y202ValveControl.IsControlValve.initializeNoException("FALSE"); Y202ValveControl.RangeOutMin.initializeNoException("0.0"); Y202ValveControl.RangeOutMax.initializeNoException("0.0"); Y202ValveControl.RequestValue.initializeNoException("0.0"); Y203ValveControl.IsControlValve.initializeNoException("FALSE"); Y203ValveControl.RangeOutMin.initializeNoException("0.0"); Y203ValveControl.RangeOutMax.initializeNoException("0.0"); Y203ValveControl.RequestValue.initializeNoException("0.0"); Y204ValveControl.IsControlValve.initializeNoException("FALSE"); Y204ValveControl.RangeOutMin.initializeNoException("0.0"); Y204ValveControl.RangeOutMax.initializeNoException("0.0"); Y204ValveControl.RequestValue.initializeNoException("0.0"); Y501ValveControl.IsControlValve.initializeNoException("FALSE"); Y501ValveControl.RangeOutMin.initializeNoException("0.0"); Y501ValveControl.RangeOutMax.initializeNoException("0.0"); Y501ValveControl.RequestValue.initializeNoException("0.0"); Y404ValveControl.IsControlValve.initializeNoException("FALSE"); Y404ValveControl.RangeOutMin.initializeNoException("0.0"); Y404ValveControl.RangeOutMax.initializeNoException("0.0"); Y404ValveControl.RequestValue.initializeNoException("0.0"); Y401ValveControl.IsControlValve.initializeNoException("FALSE"); Y401ValveControl.RangeOutMin.initializeNoException("0.0"); Y401ValveControl.RangeOutMax.initializeNoException("0.0"); Y401ValveControl.RequestValue.initializeNoException("0.0"); Y303ValveControl.IsControlValve.initializeNoException("FALSE"); Y303ValveControl.RangeOutMin.initializeNoException("0.0"); Y303ValveControl.RangeOutMax.initializeNoException("0.0"); Y303ValveControl.RequestValue.initializeNoException("0.0"); Y403ValveControl.IsControlValve.initializeNoException("FALSE"); Y403ValveControl.RangeOutMin.initializeNoException("0.0"); Y403ValveControl.RangeOutMax.initializeNoException("0.0"); Y403ValveControl.RequestValue.initializeNoException("0.0"); Y402ValveControl.IsControlValve.initializeNoException("FALSE"); Y402ValveControl.RangeOutMin.initializeNoException("0.0"); Y402ValveControl.RangeOutMax.initializeNoException("0.0"); Y402ValveControl.RequestValue.initializeNoException("0.0"); Y305ValveControl.IsControlValve.initializeNoException("FALSE"); Y305ValveControl.RangeOutMin.initializeNoException("0.0"); Y305ValveControl.RangeOutMax.initializeNoException("0.0"); Y305ValveControl.RequestValue.initializeNoException("0.0"); Y302ValveControl.IsControlValve.initializeNoException("FALSE"); Y302ValveControl.RangeOutMin.initializeNoException("0.0"); Y302ValveControl.RangeOutMax.initializeNoException("0.0"); Y302ValveControl.RequestValue.initializeNoException("0.0"); Y301ValveControl.IsControlValve.initializeNoException("FALSE"); Y301ValveControl.RangeOutMin.initializeNoException("0.0"); Y301ValveControl.RangeOutMax.initializeNoException("0.0"); Y301ValveControl.RequestValue.initializeNoException("0.0"); M100Control.OM.initializeNoException("FALSE"); M100Control.OM_Value.initializeNoException("0.0"); M200Control.OM.initializeNoException("FALSE"); M200Control.OM_Value.initializeNoException("0.0"); Y102Control.OM.initializeNoException("FALSE"); Y102Control.OM_Value.initializeNoException("0.0"); Y201Control.OM.initializeNoException("FALSE"); Y201Control.OM_Value.initializeNoException("0.0"); E100Control.OM.initializeNoException("FALSE"); E100Control.OM_ON.initializeNoException("FALSE"); Y101Control.OM.initializeNoException("FALSE"); Y101Control.OM_ON.initializeNoException("FALSE"); Y103Control.OM.initializeNoException("FALSE"); Y103Control.OM_ON.initializeNoException("FALSE"); Y105Control.OM.initializeNoException("FALSE"); Y105Control.OM_ON.initializeNoException("FALSE"); Y202Control.OM.initializeNoException("FALSE"); Y202Control.OM_ON.initializeNoException("FALSE"); Y203Control.OM.initializeNoException("FALSE"); Y203Control.OM_ON.initializeNoException("FALSE"); Y204Control.OM.initializeNoException("FALSE"); Y204Control.OM_ON.initializeNoException("FALSE"); Y301Control.OM.initializeNoException("FALSE"); Y301Control.OM_ON.initializeNoException("FALSE"); Y302Control.OM.initializeNoException("FALSE"); Y302Control.OM_ON.initializeNoException("FALSE"); Y303Control.OM.initializeNoException("FALSE"); Y303Control.OM_ON.initializeNoException("FALSE"); Y305Control.OM.initializeNoException("FALSE"); Y305Control.OM_ON.initializeNoException("FALSE"); Y401Control.OM.initializeNoException("FALSE"); Y401Control.OM_ON.initializeNoException("FALSE"); Y402Control.OM.initializeNoException("FALSE"); Y402Control.OM_ON.initializeNoException("FALSE"); Y403Control.OM.initializeNoException("FALSE"); Y403Control.OM_ON.initializeNoException("FALSE"); Y404Control.OM.initializeNoException("FALSE"); Y404Control.OM_ON.initializeNoException("FALSE"); Y501Control.OM.initializeNoException("FALSE"); Y501Control.OM_ON.initializeNoException("FALSE"); } /** {@inheritDoc} * @param fbName {@inheritDoc} * @param r {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ /** Start the FB instances. */ /** Stop the FB instances. */ } /* Copyright (c)2015 nxtControl GmbH. All rights reserved. */ /** FUNCTION_BLOCK Service_ADIMeasure * @author wildai * @version 20150208/wildai */ private class Service_ADIMeasure extends FBInstance { /** VAR AI */ public REAL AI = new REAL(); /** VAR DIH */ public BOOL DIH = new BOOL(); /** VAR DIL */ public BOOL DIL = new BOOL(); /** VAR PRESET_HH */ public REAL PRESET_HH = new REAL(); /** VAR PRESET_H */ public REAL PRESET_H = new REAL(); /** VAR PRESET_L */ public REAL PRESET_L = new REAL(); /** VAR PRESET_LL */ public REAL PRESET_LL = new REAL(); /** VAR PRESET_MINAI */ public REAL PRESET_MINAI = new REAL(); /** VAR PRESET_MAXAI */ public REAL PRESET_MAXAI = new REAL(); /** VAR AlarmHH */ public BOOL AlarmHH = new BOOL(); /** VAR AlarmH */ public BOOL AlarmH = new BOOL(); /** VAR AlarmL */ public BOOL AlarmL = new BOOL(); /** VAR AlarmLL */ public BOOL AlarmLL = new BOOL(); /** VAR SensorFault */ public BOOL SensorFault = new BOOL(); /** Initialization Request */ public EventServer INIT = new EventInput(this); /** Normal Execution Request */ public EventServer REQ = new EventInput(this); /** Initialization Confirm */ public EventOutput INITO = new EventOutput(); /** Execution Confirmation */ public EventOutput CNF = new EventOutput(); /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public ANY ovNamed(String s) throws FBRManagementException { if ("AlarmHH".equals(s)) return AlarmHH; if ("AlarmH".equals(s)) return AlarmH; if ("AlarmL".equals(s)) return AlarmL; if ("AlarmLL".equals(s)) return AlarmLL; if ("SensorFault".equals(s)) return SensorFault; return super.ovNamed(s);} /** {@inheritDoc} * @param ivName {@inheritDoc} * @param newIV {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public void connectIV(String ivName, ANY newIV) throws FBRManagementException { if ("AI".equals(ivName)) connect_AI((REAL) newIV); else if ("DIH".equals(ivName)) connect_DIH((BOOL) newIV); else if ("DIL".equals(ivName)) connect_DIL((BOOL) newIV); else if ("PRESET_HH".equals(ivName)) connect_PRESET_HH((REAL) newIV); else if ("PRESET_H".equals(ivName)) connect_PRESET_H((REAL) newIV); else if ("PRESET_L".equals(ivName)) connect_PRESET_L((REAL) newIV); else if ("PRESET_LL".equals(ivName)) connect_PRESET_LL((REAL) newIV); else if ("PRESET_MINAI".equals(ivName)) connect_PRESET_MINAI((REAL) newIV); else if ("PRESET_MAXAI".equals(ivName)) connect_PRESET_MAXAI((REAL) newIV); else super.connectIV(ivName, newIV); } /** Connect the given variable to the input variable AI * @param newIV The variable to connect */ public void connect_AI(REAL newIV) { AI = newIV; } /** Connect the given variable to the input variable DIH * @param newIV The variable to connect */ public void connect_DIH(BOOL newIV) { DIH = newIV; } /** Connect the given variable to the input variable DIL * @param newIV The variable to connect */ public void connect_DIL(BOOL newIV) { DIL = newIV; } /** Connect the given variable to the input variable PRESET_HH * @param newIV The variable to connect */ public void connect_PRESET_HH(REAL newIV) { PRESET_HH = newIV; } /** Connect the given variable to the input variable PRESET_H * @param newIV The variable to connect */ public void connect_PRESET_H(REAL newIV) { PRESET_H = newIV; } /** Connect the given variable to the input variable PRESET_L * @param newIV The variable to connect */ public void connect_PRESET_L(REAL newIV) { PRESET_L = newIV; } /** Connect the given variable to the input variable PRESET_LL * @param newIV The variable to connect */ public void connect_PRESET_LL(REAL newIV) { PRESET_LL = newIV; } /** Connect the given variable to the input variable PRESET_MINAI * @param newIV The variable to connect */ public void connect_PRESET_MINAI(REAL newIV) { PRESET_MINAI = newIV; } /** Connect the given variable to the input variable PRESET_MAXAI * @param newIV The variable to connect */ public void connect_PRESET_MAXAI(REAL newIV) { PRESET_MAXAI = newIV; } private static final int index_START = 0; private void state_START() { eccState = index_START; } private static final int index_INIT = 1; private void state_INIT() { eccState = index_INIT; alg_INIT(); INITO.serviceEvent(this); state_START(); transition_Service_ADIMeasure_0(); } private static final int index_REQ = 2; private void state_REQ() { eccState = index_REQ; alg_REQ(); CNF.serviceEvent(this); state_START(); transition_Service_ADIMeasure_1(); } /** The default constructor. */ public Service_ADIMeasure() { super(); } /** {@inheritDoc} * @param e {@inheritDoc} */ public void serviceEvent(EventServer e) { if (e == INIT) service_INIT(); else if (e == REQ) service_REQ(); } /** Services the INIT event. */ public void service_INIT() { if ((eccState == index_START)) { state_INIT(); transition_Service_ADIMeasure_2(); } } /** Services the REQ event. */ public void service_REQ() { if ((eccState == index_START)) { state_REQ(); transition_Service_ADIMeasure_3(); } } /** ALGORITHM INIT IN ST*/ public void alg_INIT() { ; SensorFault.value = false; AlarmHH.value = false; AlarmH.value = false; AlarmL.value = false; AlarmLL.value = false; } /** ALGORITHM REQ IN ST*/ public void alg_REQ() { ; if (((DIH.value & DIL.value) | (AI.value >= PRESET_HH.value & !DIH.value) | (AI.value <= PRESET_LL.value & !DIL.value) | (AI.value > PRESET_MAXAI.value) | (AI.value < PRESET_MINAI.value))) { SensorFault.value = true; AlarmHH.value = false; AlarmH.value = false; AlarmL.value = false; AlarmLL.value = false; } else { SensorFault.value = false; if (AI.value >= PRESET_HH.value | DIH.value) { AlarmHH.value = true; AlarmH.value = false; AlarmL.value = false; AlarmLL.value = false; } else if (AI.value < PRESET_H.value & AI.value >= PRESET_H.value) { AlarmHH.value = false; AlarmH.value = true; AlarmL.value = false; AlarmLL.value = false; } else if (AI.value <= PRESET_L.value & AI.value > PRESET_LL.value) { AlarmHH.value = false; AlarmH.value = false; AlarmL.value = true; AlarmLL.value = false; } else if (AI.value <= PRESET_LL.value | DIL.value) { AlarmHH.value = false; AlarmH.value = false; AlarmL.value = false; AlarmLL.value = true; } else { AlarmHH.value = false; AlarmH.value = false; AlarmL.value = false; AlarmLL.value = false; }; }; } } private void transition_Service_ADIMeasure_0() { } private void transition_Service_ADIMeasure_1() { } private void transition_Service_ADIMeasure_2() { } private void transition_Service_ADIMeasure_3() { } /* Copyright (c)2015 nxtControl GmbH. All rights reserved. */ /** FUNCTION_BLOCK Service_AIMeasure * @author wildai * @version 20150208/wildai */ private class Service_AIMeasure extends FBInstance { /** VAR AI */ public REAL AI = new REAL(); /** VAR PRESET_HH */ public REAL PRESET_HH = new REAL(); /** VAR PRESET_H */ public REAL PRESET_H = new REAL(); /** VAR PRESET_L */ public REAL PRESET_L = new REAL(); /** VAR PRESET_LL */ public REAL PRESET_LL = new REAL(); /** VAR PRESET_MINAI */ public REAL PRESET_MINAI = new REAL(); /** VAR PRESET_MAXAI */ public REAL PRESET_MAXAI = new REAL(); /** VAR AlarmHH */ public BOOL AlarmHH = new BOOL(); /** VAR AlarmH */ public BOOL AlarmH = new BOOL(); /** VAR AlarmL */ public BOOL AlarmL = new BOOL(); /** VAR AlarmLL */ public BOOL AlarmLL = new BOOL(); /** VAR SensorFault */ public BOOL SensorFault = new BOOL(); /** Initialization Request */ public EventServer INIT = new EventInput(this); /** Normal Execution Request */ public EventServer REQ = new EventInput(this); /** Initialization Confirm */ public EventOutput INITO = new EventOutput(); /** Execution Confirmation */ public EventOutput CNF = new EventOutput(); /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public ANY ovNamed(String s) throws FBRManagementException { if ("AlarmHH".equals(s)) return AlarmHH; if ("AlarmH".equals(s)) return AlarmH; if ("AlarmL".equals(s)) return AlarmL; if ("AlarmLL".equals(s)) return AlarmLL; if ("SensorFault".equals(s)) return SensorFault; return super.ovNamed(s);} /** {@inheritDoc} * @param ivName {@inheritDoc} * @param newIV {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public void connectIV(String ivName, ANY newIV) throws FBRManagementException { if ("AI".equals(ivName)) connect_AI((REAL) newIV); else if ("PRESET_HH".equals(ivName)) connect_PRESET_HH((REAL) newIV); else if ("PRESET_H".equals(ivName)) connect_PRESET_H((REAL) newIV); else if ("PRESET_L".equals(ivName)) connect_PRESET_L((REAL) newIV); else if ("PRESET_LL".equals(ivName)) connect_PRESET_LL((REAL) newIV); else if ("PRESET_MINAI".equals(ivName)) connect_PRESET_MINAI((REAL) newIV); else if ("PRESET_MAXAI".equals(ivName)) connect_PRESET_MAXAI((REAL) newIV); else super.connectIV(ivName, newIV); } /** Connect the given variable to the input variable AI * @param newIV The variable to connect */ public void connect_AI(REAL newIV) { AI = newIV; } /** Connect the given variable to the input variable PRESET_HH * @param newIV The variable to connect */ public void connect_PRESET_HH(REAL newIV) { PRESET_HH = newIV; } /** Connect the given variable to the input variable PRESET_H * @param newIV The variable to connect */ public void connect_PRESET_H(REAL newIV) { PRESET_H = newIV; } /** Connect the given variable to the input variable PRESET_L * @param newIV The variable to connect */ public void connect_PRESET_L(REAL newIV) { PRESET_L = newIV; } /** Connect the given variable to the input variable PRESET_LL * @param newIV The variable to connect */ public void connect_PRESET_LL(REAL newIV) { PRESET_LL = newIV; } /** Connect the given variable to the input variable PRESET_MINAI * @param newIV The variable to connect */ public void connect_PRESET_MINAI(REAL newIV) { PRESET_MINAI = newIV; } /** Connect the given variable to the input variable PRESET_MAXAI * @param newIV The variable to connect */ public void connect_PRESET_MAXAI(REAL newIV) { PRESET_MAXAI = newIV; } private static final int index_START = 0; private void state_START() { eccState = index_START; } private static final int index_INIT = 1; private void state_INIT() { eccState = index_INIT; alg_INIT(); INITO.serviceEvent(this); state_START(); transition_Service_AIMeasure_0(); } private static final int index_REQ = 2; private void state_REQ() { eccState = index_REQ; alg_REQ(); CNF.serviceEvent(this); state_START(); transition_Service_AIMeasure_1(); } /** The default constructor. */ public Service_AIMeasure() { super(); } /** {@inheritDoc} * @param e {@inheritDoc} */ public void serviceEvent(EventServer e) { if (e == INIT) service_INIT(); else if (e == REQ) service_REQ(); } /** Services the INIT event. */ public void service_INIT() { if ((eccState == index_START)) { state_INIT(); transition_Service_AIMeasure_2(); } } /** Services the REQ event. */ public void service_REQ() { if ((eccState == index_START)) { state_REQ(); transition_Service_AIMeasure_3(); } } /** ALGORITHM INIT IN ST*/ public void alg_INIT() { ; SensorFault.value = false; AlarmHH.value = false; AlarmH.value = false; AlarmL.value = false; AlarmLL.value = false; } /** ALGORITHM REQ IN ST*/ public void alg_REQ() { ; if (AI.value < PRESET_MINAI.value | AI.value > PRESET_MAXAI.value) { SensorFault.value = true; AlarmHH.value = false; AlarmH.value = false; AlarmL.value = false; AlarmLL.value = false; } else { SensorFault.value = false; if (AI.value >= PRESET_HH.value) { AlarmHH.value = true; AlarmH.value = false; AlarmL.value = false; AlarmLL.value = false; } else if (AI.value < PRESET_H.value & AI.value >= PRESET_H.value) { AlarmHH.value = false; AlarmH.value = true; AlarmL.value = false; AlarmLL.value = false; } else if (AI.value <= PRESET_L.value & AI.value > PRESET_LL.value) { AlarmHH.value = false; AlarmH.value = false; AlarmL.value = true; AlarmLL.value = false; } else if (AI.value <= PRESET_LL.value) { AlarmHH.value = false; AlarmH.value = false; AlarmL.value = false; AlarmLL.value = true; } else { AlarmHH.value = false; AlarmH.value = false; AlarmL.value = false; AlarmLL.value = false; }; }; } } private void transition_Service_AIMeasure_0() { } private void transition_Service_AIMeasure_1() { } private void transition_Service_AIMeasure_2() { } private void transition_Service_AIMeasure_3() { } /* Copyright (c)2015 nxtControl GmbH. All rights reserved. */ /** FUNCTION_BLOCK FB_TankControl * @author wildai * @version 20150208/wildai */ private class FB_TankControl extends FBInstance { /** VAR TempSensorIsConfigured */ public BOOL TempSensorIsConfigured = new BOOL(); /** VAR TempSensorHHAlarm */ public BOOL TempSensorHHAlarm = new BOOL(); /** VAR TempSensorHealthy */ public BOOL TempSensorHealthy = new BOOL(); /** VAR PressureSensorIsConfigured */ public BOOL PressureSensorIsConfigured = new BOOL(); /** VAR PressureSensorHHAlarm */ public BOOL PressureSensorHHAlarm = new BOOL(); /** VAR PressureSensorHealthy */ public BOOL PressureSensorHealthy = new BOOL(); /** VAR WaterLevelSensorHighIsConfigured */ public BOOL WaterLevelSensorHighIsConfigured = new BOOL(); /** VAR WaterLevelSensorHHAlarm */ public BOOL WaterLevelSensorHHAlarm = new BOOL(); /** VAR WaterLevelSensorHighHealthy */ public BOOL WaterLevelSensorHighHealthy = new BOOL(); /** VAR WaterLevelSensorOverflowIsConfigured */ public BOOL WaterLevelSensorOverflowIsConfigured = new BOOL(); /** VAR WaterLevelSensorOverflowAlarm */ public BOOL WaterLevelSensorOverflowAlarm = new BOOL(); /** VAR WaterLevelSensorOverflowHealthy */ public BOOL WaterLevelSensorOverflowHealthy = new BOOL(); /** VAR WaterLevelSensorLowIsConfigured */ public BOOL WaterLevelSensorLowIsConfigured = new BOOL(); /** VAR WaterLevelSensorLLAlarm */ public BOOL WaterLevelSensorLLAlarm = new BOOL(); /** VAR WaterLevelSensorLowHealthy */ public BOOL WaterLevelSensorLowHealthy = new BOOL(); /** VAR Ready */ public BOOL Ready = new BOOL(); /** VAR OverPresuure */ public BOOL OverPresuure = new BOOL(); /** VAR InfeedEnabled */ public BOOL InfeedEnabled = new BOOL(); /** VAR OutfeedEnabled */ public BOOL OutfeedEnabled = new BOOL(); /** VAR HeatEnabled */ public BOOL HeatEnabled = new BOOL(); /** Initialization Request */ public EventServer INIT = new EventInput(this); /** Normal Execution Request */ public EventServer REQ = new EventInput(this); /** Initialization Confirm */ public EventOutput INITO = new EventOutput(); /** Execution Confirmation */ public EventOutput CNF = new EventOutput(); /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public ANY ovNamed(String s) throws FBRManagementException { if ("Ready".equals(s)) return Ready; if ("OverPresuure".equals(s)) return OverPresuure; if ("InfeedEnabled".equals(s)) return InfeedEnabled; if ("OutfeedEnabled".equals(s)) return OutfeedEnabled; if ("HeatEnabled".equals(s)) return HeatEnabled; return super.ovNamed(s);} /** {@inheritDoc} * @param ivName {@inheritDoc} * @param newIV {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public void connectIV(String ivName, ANY newIV) throws FBRManagementException { if ("TempSensorIsConfigured".equals(ivName)) connect_TempSensorIsConfigured((BOOL) newIV); else if ("TempSensorHHAlarm".equals(ivName)) connect_TempSensorHHAlarm((BOOL) newIV); else if ("TempSensorHealthy".equals(ivName)) connect_TempSensorHealthy((BOOL) newIV); else if ("PressureSensorIsConfigured".equals(ivName)) connect_PressureSensorIsConfigured((BOOL) newIV); else if ("PressureSensorHHAlarm".equals(ivName)) connect_PressureSensorHHAlarm((BOOL) newIV); else if ("PressureSensorHealthy".equals(ivName)) connect_PressureSensorHealthy((BOOL) newIV); else if ("WaterLevelSensorHighIsConfigured".equals(ivName)) connect_WaterLevelSensorHighIsConfigured((BOOL) newIV); else if ("WaterLevelSensorHHAlarm".equals(ivName)) connect_WaterLevelSensorHHAlarm((BOOL) newIV); else if ("WaterLevelSensorHighHealthy".equals(ivName)) connect_WaterLevelSensorHighHealthy((BOOL) newIV); else if ("WaterLevelSensorOverflowIsConfigured".equals(ivName)) connect_WaterLevelSensorOverflowIsConfigured((BOOL) newIV); else if ("WaterLevelSensorOverflowAlarm".equals(ivName)) connect_WaterLevelSensorOverflowAlarm((BOOL) newIV); else if ("WaterLevelSensorOverflowHealthy".equals(ivName)) connect_WaterLevelSensorOverflowHealthy((BOOL) newIV); else if ("WaterLevelSensorLowIsConfigured".equals(ivName)) connect_WaterLevelSensorLowIsConfigured((BOOL) newIV); else if ("WaterLevelSensorLLAlarm".equals(ivName)) connect_WaterLevelSensorLLAlarm((BOOL) newIV); else if ("WaterLevelSensorLowHealthy".equals(ivName)) connect_WaterLevelSensorLowHealthy((BOOL) newIV); else super.connectIV(ivName, newIV); } /** Connect the given variable to the input variable TempSensorIsConfigured * @param newIV The variable to connect */ public void connect_TempSensorIsConfigured(BOOL newIV) { TempSensorIsConfigured = newIV; } /** Connect the given variable to the input variable TempSensorHHAlarm * @param newIV The variable to connect */ public void connect_TempSensorHHAlarm(BOOL newIV) { TempSensorHHAlarm = newIV; } /** Connect the given variable to the input variable TempSensorHealthy * @param newIV The variable to connect */ public void connect_TempSensorHealthy(BOOL newIV) { TempSensorHealthy = newIV; } /** Connect the given variable to the input variable PressureSensorIsConfigured * @param newIV The variable to connect */ public void connect_PressureSensorIsConfigured(BOOL newIV) { PressureSensorIsConfigured = newIV; } /** Connect the given variable to the input variable PressureSensorHHAlarm * @param newIV The variable to connect */ public void connect_PressureSensorHHAlarm(BOOL newIV) { PressureSensorHHAlarm = newIV; } /** Connect the given variable to the input variable PressureSensorHealthy * @param newIV The variable to connect */ public void connect_PressureSensorHealthy(BOOL newIV) { PressureSensorHealthy = newIV; } /** Connect the given variable to the input variable WaterLevelSensorHighIsConfigured * @param newIV The variable to connect */ public void connect_WaterLevelSensorHighIsConfigured(BOOL newIV) { WaterLevelSensorHighIsConfigured = newIV; } /** Connect the given variable to the input variable WaterLevelSensorHHAlarm * @param newIV The variable to connect */ public void connect_WaterLevelSensorHHAlarm(BOOL newIV) { WaterLevelSensorHHAlarm = newIV; } /** Connect the given variable to the input variable WaterLevelSensorHighHealthy * @param newIV The variable to connect */ public void connect_WaterLevelSensorHighHealthy(BOOL newIV) { WaterLevelSensorHighHealthy = newIV; } /** Connect the given variable to the input variable WaterLevelSensorOverflowIsConfigured * @param newIV The variable to connect */ public void connect_WaterLevelSensorOverflowIsConfigured(BOOL newIV) { WaterLevelSensorOverflowIsConfigured = newIV; } /** Connect the given variable to the input variable WaterLevelSensorOverflowAlarm * @param newIV The variable to connect */ public void connect_WaterLevelSensorOverflowAlarm(BOOL newIV) { WaterLevelSensorOverflowAlarm = newIV; } /** Connect the given variable to the input variable WaterLevelSensorOverflowHealthy * @param newIV The variable to connect */ public void connect_WaterLevelSensorOverflowHealthy(BOOL newIV) { WaterLevelSensorOverflowHealthy = newIV; } /** Connect the given variable to the input variable WaterLevelSensorLowIsConfigured * @param newIV The variable to connect */ public void connect_WaterLevelSensorLowIsConfigured(BOOL newIV) { WaterLevelSensorLowIsConfigured = newIV; } /** Connect the given variable to the input variable WaterLevelSensorLLAlarm * @param newIV The variable to connect */ public void connect_WaterLevelSensorLLAlarm(BOOL newIV) { WaterLevelSensorLLAlarm = newIV; } /** Connect the given variable to the input variable WaterLevelSensorLowHealthy * @param newIV The variable to connect */ public void connect_WaterLevelSensorLowHealthy(BOOL newIV) { WaterLevelSensorLowHealthy = newIV; } private static final int index_START = 0; private void state_START() { eccState = index_START; } private static final int index_INIT = 1; private void state_INIT() { eccState = index_INIT; alg_INIT(); INITO.serviceEvent(this); state_START(); transition_FB_TankControl_0(); } private static final int index_REQ = 2; private void state_REQ() { eccState = index_REQ; alg_REQ(); CNF.serviceEvent(this); state_START(); transition_FB_TankControl_1(); } /** The default constructor. */ public FB_TankControl() { super(); } /** {@inheritDoc} * @param e {@inheritDoc} */ public void serviceEvent(EventServer e) { if (e == INIT) service_INIT(); else if (e == REQ) service_REQ(); } /** Services the INIT event. */ public void service_INIT() { if ((eccState == index_START)) { state_INIT(); transition_FB_TankControl_2(); } } /** Services the REQ event. */ public void service_REQ() { if ((eccState == index_START)) { state_REQ(); transition_FB_TankControl_3(); } } /** ALGORITHM INIT IN ST*/ public void alg_INIT() { ; Ready.value = false; OverPresuure.value = false; InfeedEnabled.value = false; OutfeedEnabled.value = false; HeatEnabled.value = false; } /** ALGORITHM REQ IN ST*/ public void alg_REQ() { ; if (((TempSensorIsConfigured.value & !TempSensorHealthy.value) | (PressureSensorIsConfigured.value & !PressureSensorHealthy.value) | (WaterLevelSensorHighIsConfigured.value & !WaterLevelSensorHighHealthy.value) | (WaterLevelSensorOverflowIsConfigured.value & !WaterLevelSensorOverflowHealthy.value) | (WaterLevelSensorLowIsConfigured.value & !WaterLevelSensorLowHealthy.value))) { Ready.value = false; } else { Ready.value = true; }; if (((TempSensorIsConfigured.value & !TempSensorHHAlarm.value) & Ready.value)) { HeatEnabled.value = true; } else { HeatEnabled.value = false; }; if ((PressureSensorIsConfigured.value & PressureSensorHHAlarm.value)) { OverPresuure.value = true; } else { OverPresuure.value = false; }; if (((WaterLevelSensorHighIsConfigured.value & WaterLevelSensorHHAlarm.value) | (WaterLevelSensorOverflowIsConfigured.value & WaterLevelSensorOverflowAlarm.value) | !Ready.value | (!WaterLevelSensorHighIsConfigured.value & !WaterLevelSensorOverflowIsConfigured.value))) { InfeedEnabled.value = false; } else { InfeedEnabled.value = true; }; if (((WaterLevelSensorLowIsConfigured.value & !WaterLevelSensorLLAlarm.value) & Ready.value)) { OutfeedEnabled.value = true; } else { OutfeedEnabled.value = false; }; } } private void transition_FB_TankControl_0() { } private void transition_FB_TankControl_1() { } private void transition_FB_TankControl_2() { } private void transition_FB_TankControl_3() { } /* Copyright (c)2015 nxtControl GmbH. All rights reserved. */ /** FUNCTION_BLOCK FB_PIDControl * @author wildai * @version 20150208/wildai */ private class FB_PIDControl extends FBInstance { /** VAR AutoMode */ public BOOL AutoMode = new BOOL(); /** VAR PV */ public REAL PV = new REAL(); /** VAR SP */ public REAL SP = new REAL(); /** VAR gain */ public REAL gain = new REAL(); /** VAR rate */ public REAL rate = new REAL(); /** VAR reset */ public REAL reset = new REAL(); /** VAR sample */ public REAL sample = new REAL(); /** VAR Mode */ public BOOL Mode = new BOOL(); /** VAR OUT */ public REAL OUT = new REAL(); /** VAR SPin */ public REAL SPin = new REAL(); /** VAR PVscl */ public REAL PVscl = new REAL(); /** VAR SPscl */ public REAL SPscl = new REAL(); /** VAR OUTscl */ public REAL OUTscl = new REAL(); /** VAR error */ public REAL error = new REAL(); /** VAR bias */ public REAL bias = new REAL(); /** VAR PVold */ public REAL PVold = new REAL(); /** VAR I_Coeff */ public REAL I_Coeff = new REAL(); /** VAR D_Coeff */ public REAL D_Coeff = new REAL(); /** VAR curMode */ public BOOL curMode = new BOOL(); /** VAR firstCycle */ public BOOL firstCycle = new BOOL(); /** VAR Mp */ public REAL Mp = new REAL(); /** VAR Mi */ public REAL Mi = new REAL(); /** VAR Md */ public REAL Md = new REAL(); /** VAR Ma */ public REAL Ma = new REAL(); /** Initialization Request */ public EventServer INIT = new EventInput(this); /** Normal Execution Request */ public EventServer REQ = new EventInput(this); /** Initialization Confirm */ public EventOutput INITO = new EventOutput(); /** Execution Confirmation */ public EventOutput CNF = new EventOutput(); /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public ANY ovNamed(String s) throws FBRManagementException { if ("Mode".equals(s)) return Mode; if ("OUT".equals(s)) return OUT; return super.ovNamed(s);} /** {@inheritDoc} * @param ivName {@inheritDoc} * @param newIV {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public void connectIV(String ivName, ANY newIV) throws FBRManagementException { if ("AutoMode".equals(ivName)) connect_AutoMode((BOOL) newIV); else if ("PV".equals(ivName)) connect_PV((REAL) newIV); else if ("SP".equals(ivName)) connect_SP((REAL) newIV); else if ("gain".equals(ivName)) connect_gain((REAL) newIV); else if ("rate".equals(ivName)) connect_rate((REAL) newIV); else if ("reset".equals(ivName)) connect_reset((REAL) newIV); else if ("sample".equals(ivName)) connect_sample((REAL) newIV); else super.connectIV(ivName, newIV); } /** Connect the given variable to the input variable AutoMode * @param newIV The variable to connect */ public void connect_AutoMode(BOOL newIV) { AutoMode = newIV; } /** Connect the given variable to the input variable PV * @param newIV The variable to connect */ public void connect_PV(REAL newIV) { PV = newIV; } /** Connect the given variable to the input variable SP * @param newIV The variable to connect */ public void connect_SP(REAL newIV) { SP = newIV; } /** Connect the given variable to the input variable gain * @param newIV The variable to connect */ public void connect_gain(REAL newIV) { gain = newIV; } /** Connect the given variable to the input variable rate * @param newIV The variable to connect */ public void connect_rate(REAL newIV) { rate = newIV; } /** Connect the given variable to the input variable reset * @param newIV The variable to connect */ public void connect_reset(REAL newIV) { reset = newIV; } /** Connect the given variable to the input variable sample * @param newIV The variable to connect */ public void connect_sample(REAL newIV) { sample = newIV; } private static final int index_START = 0; private void state_START() { eccState = index_START; } private static final int index_INIT = 1; private void state_INIT() { eccState = index_INIT; alg_INIT(); INITO.serviceEvent(this); state_START(); transition_FB_PIDControl_0(); } private static final int index_REQ = 2; private void state_REQ() { eccState = index_REQ; alg_REQ(); CNF.serviceEvent(this); state_START(); transition_FB_PIDControl_1(); } /** The default constructor. */ public FB_PIDControl() { super(); } /** {@inheritDoc} * @param e {@inheritDoc} */ public void serviceEvent(EventServer e) { if (e == INIT) service_INIT(); else if (e == REQ) service_REQ(); } /** Services the INIT event. */ public void service_INIT() { if ((eccState == index_START)) { state_INIT(); transition_FB_PIDControl_2(); } } /** Services the REQ event. */ public void service_REQ() { if ((eccState == index_START)) { state_REQ(); transition_FB_PIDControl_3(); } } /** ALGORITHM INIT IN ST*/ public void alg_INIT() { ; Mode.value = false; OUT.value = (float) (0.0); } /** ALGORITHM REQ IN ST*/ public void alg_REQ() { ; /*PrecalculatePIDcofeeicients*/ I_Coeff.value = (float) (0.0); SPin.value = (float) (SP.value); if (reset.value != 0) { I_Coeff.value = (float) (sample.value / reset.value); }; D_Coeff.value = (float) (rate.value / sample.value); /*MultiplyI,Dcofficeintsbygain.valueif(gain.valueisused*/ if (gain.value != 0) { I_Coeff.value = (float) (I_Coeff.value * gain.value); D_Coeff.value = (float) (D_Coeff.value * gain.value); }; /*Auto->ManualTransition*/ if (((!AutoMode.value) & curMode.value)) { firstCycle.value = true; curMode.value = false; Mode.value = false; /*Manual->AutoTransition*/ } else if ((AutoMode.value & (!curMode.value))) { bias.value = (float) (OUT.value / 27648); SPin.value = (float) (PV.value); firstCycle.value = true; curMode.value = true; Mode.value = true; }; if (curMode.value) { /*ScalePV.valueif(>100%){clampat100%,if(PV.value<0%){clamp; .value<=0%*/ if (PV.value <= 0) { PVscl.value = (float) (0.0); } else if (PV.value > 27648) { PVscl.value = (float) (1.0); } else { PVscl.value = (float) (PV.value / 27648); }; /*ScaleSetpointif(SP.value>100%){clamp; .value<=100%,if(SP.value<0%){clamp; .value<=0%*/ if (SPin.value < 0) { SPscl.value = (float) (0.0); } else if (SPin.value >= 27648) { SPscl.value = (float) (1.0); } else { SPscl.value = (float) (SPin.value / 27648); }; /*CalculateError*/ error.value = (float) (SPin.value - PV.value); /*CalculatePIDterms*/ Mp.value = (float) (gain.value * error.value); Mi.value = (float) (bias.value + (I_Coeff.value * error.value)); Md.value = (float) (0.0); /*if(derivativeused){calculateMd.value*/ if (((rate.value != 0) & (!firstCycle.value))) { Md.value = (float) (D_Coeff.value * (PVold.value - PV.value)); }; /*Calcuulateprovisionaloutput(beforebias.valueclamping)*/ PVold.value = (float) (PVscl.value); Ma.value = (float) (Mp.value + Md.value); OUT.value = (float) (Ma.value + Mi.value); /*BiasClamping:if(Output>100%,clamp&backcalculatebias.value*/ if (OUT.value > 1) { OUTscl.value = (float) (1.0); Mi.value = (float) (1.0 - Ma.value); } else if (OUT.value < 0) { OUTscl.value = (float) (0.0); Mi.value = (float) (0.0 - Ma.value); }; /*Clampbias.value; .value<=0; .value<=1range*/ if (I_Coeff.value != 0.0) { if (Mi.value > 1.0) { Mi.value = (float) (1.0); } else if (Mi.value < 0.0) { Mi.value = (float) (0.0); } else { bias.value = (float) (Mi.value); }; }; /*Resetfirstcycleflag&unscaleoutput*/ firstCycle.value = false; OUT.value = (float) (OUTscl.value * 27648); }; } } private void transition_FB_PIDControl_0() { } private void transition_FB_PIDControl_1() { } private void transition_FB_PIDControl_2() { } private void transition_FB_PIDControl_3() { } /* Copyright (c)2015 nxtControl GmbH. All rights reserved. */ /** FUNCTION_BLOCK FB_SequenceControl * @author wildai * @version 20150208/wildai */ private class FB_SequenceControl extends FBInstance { /** VAR T100_Overflow */ public BOOL T100_Overflow = new BOOL(); /** VAR T100_Underflow */ public BOOL T100_Underflow = new BOOL(); /** VAR T100_Overheat */ public BOOL T100_Overheat = new BOOL(); /** VAR T200_Overflow */ public BOOL T200_Overflow = new BOOL(); /** VAR T200_Underflow */ public BOOL T200_Underflow = new BOOL(); /** VAR T300_Overflow */ public BOOL T300_Overflow = new BOOL(); /** VAR T300_Underflow */ public BOOL T300_Underflow = new BOOL(); /** VAR T300_Overheat */ public BOOL T300_Overheat = new BOOL(); /** VAR T300_OverPressure */ public BOOL T300_OverPressure = new BOOL(); /** VAR T400_Overflow */ public BOOL T400_Overflow = new BOOL(); /** VAR T400_Underflow */ public BOOL T400_Underflow = new BOOL(); /** VAR FillingSeqEnable */ public BOOL FillingSeqEnable = new BOOL(); /** VAR StartSeqEnable */ public BOOL StartSeqEnable = new BOOL(); /** VAR ShutdownSeqEnable */ public BOOL ShutdownSeqEnable = new BOOL(); /** VAR EmptyingSeqEnable */ public BOOL EmptyingSeqEnable = new BOOL(); /** VAR Y101_Open */ public BOOL Y101_Open = new BOOL(); /** VAR Y102_Open */ public BOOL Y102_Open = new BOOL(); /** VAR Y103_Open */ public BOOL Y103_Open = new BOOL(); /** VAR Y105_Open */ public BOOL Y105_Open = new BOOL(); /** VAR Y201_Open */ public BOOL Y201_Open = new BOOL(); /** VAR Y202_Open */ public BOOL Y202_Open = new BOOL(); /** VAR Y203_Open */ public BOOL Y203_Open = new BOOL(); /** VAR Y204_Open */ public BOOL Y204_Open = new BOOL(); /** VAR Y301_Open */ public BOOL Y301_Open = new BOOL(); /** VAR Y302_Open */ public BOOL Y302_Open = new BOOL(); /** VAR Y303_Open */ public BOOL Y303_Open = new BOOL(); /** VAR Y305_Open */ public BOOL Y305_Open = new BOOL(); /** VAR Y401_Open */ public BOOL Y401_Open = new BOOL(); /** VAR Y402_Open */ public BOOL Y402_Open = new BOOL(); /** VAR Y403_Open */ public BOOL Y403_Open = new BOOL(); /** VAR Y404_Open */ public BOOL Y404_Open = new BOOL(); /** VAR Y501_Open */ public BOOL Y501_Open = new BOOL(); /** VAR E100_On */ public BOOL E100_On = new BOOL(); /** VAR M100_On */ public BOOL M100_On = new BOOL(); /** VAR M200_On */ public BOOL M200_On = new BOOL(); /** VAR FillingSeqComplete */ public BOOL FillingSeqComplete = new BOOL(); /** VAR StartSeqComplete */ public BOOL StartSeqComplete = new BOOL(); /** VAR EmptyingComplete */ public BOOL EmptyingComplete = new BOOL(); /** Initialization Request */ public EventServer INIT = new EventInput(this); /** Normal Execution Request */ public EventServer REQ = new EventInput(this); /** Initialization Confirm */ public EventOutput INITO = new EventOutput(); /** Execution Confirmation */ public EventOutput CNF = new EventOutput(); /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public ANY ovNamed(String s) throws FBRManagementException { if ("Y101_Open".equals(s)) return Y101_Open; if ("Y102_Open".equals(s)) return Y102_Open; if ("Y103_Open".equals(s)) return Y103_Open; if ("Y105_Open".equals(s)) return Y105_Open; if ("Y201_Open".equals(s)) return Y201_Open; if ("Y202_Open".equals(s)) return Y202_Open; if ("Y203_Open".equals(s)) return Y203_Open; if ("Y204_Open".equals(s)) return Y204_Open; if ("Y301_Open".equals(s)) return Y301_Open; if ("Y302_Open".equals(s)) return Y302_Open; if ("Y303_Open".equals(s)) return Y303_Open; if ("Y305_Open".equals(s)) return Y305_Open; if ("Y401_Open".equals(s)) return Y401_Open; if ("Y402_Open".equals(s)) return Y402_Open; if ("Y403_Open".equals(s)) return Y403_Open; if ("Y404_Open".equals(s)) return Y404_Open; if ("Y501_Open".equals(s)) return Y501_Open; if ("E100_On".equals(s)) return E100_On; if ("M100_On".equals(s)) return M100_On; if ("M200_On".equals(s)) return M200_On; return super.ovNamed(s);} /** {@inheritDoc} * @param ivName {@inheritDoc} * @param newIV {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public void connectIV(String ivName, ANY newIV) throws FBRManagementException { if ("T100_Overflow".equals(ivName)) connect_T100_Overflow((BOOL) newIV); else if ("T100_Underflow".equals(ivName)) connect_T100_Underflow((BOOL) newIV); else if ("T100_Overheat".equals(ivName)) connect_T100_Overheat((BOOL) newIV); else if ("T200_Overflow".equals(ivName)) connect_T200_Overflow((BOOL) newIV); else if ("T200_Underflow".equals(ivName)) connect_T200_Underflow((BOOL) newIV); else if ("T300_Overflow".equals(ivName)) connect_T300_Overflow((BOOL) newIV); else if ("T300_Underflow".equals(ivName)) connect_T300_Underflow((BOOL) newIV); else if ("T300_Overheat".equals(ivName)) connect_T300_Overheat((BOOL) newIV); else if ("T300_OverPressure".equals(ivName)) connect_T300_OverPressure((BOOL) newIV); else if ("T400_Overflow".equals(ivName)) connect_T400_Overflow((BOOL) newIV); else if ("T400_Underflow".equals(ivName)) connect_T400_Underflow((BOOL) newIV); else if ("FillingSeqEnable".equals(ivName)) connect_FillingSeqEnable((BOOL) newIV); else if ("StartSeqEnable".equals(ivName)) connect_StartSeqEnable((BOOL) newIV); else if ("ShutdownSeqEnable".equals(ivName)) connect_ShutdownSeqEnable((BOOL) newIV); else if ("EmptyingSeqEnable".equals(ivName)) connect_EmptyingSeqEnable((BOOL) newIV); else super.connectIV(ivName, newIV); } /** Connect the given variable to the input variable T100_Overflow * @param newIV The variable to connect */ public void connect_T100_Overflow(BOOL newIV) { T100_Overflow = newIV; } /** Connect the given variable to the input variable T100_Underflow * @param newIV The variable to connect */ public void connect_T100_Underflow(BOOL newIV) { T100_Underflow = newIV; } /** Connect the given variable to the input variable T100_Overheat * @param newIV The variable to connect */ public void connect_T100_Overheat(BOOL newIV) { T100_Overheat = newIV; } /** Connect the given variable to the input variable T200_Overflow * @param newIV The variable to connect */ public void connect_T200_Overflow(BOOL newIV) { T200_Overflow = newIV; } /** Connect the given variable to the input variable T200_Underflow * @param newIV The variable to connect */ public void connect_T200_Underflow(BOOL newIV) { T200_Underflow = newIV; } /** Connect the given variable to the input variable T300_Overflow * @param newIV The variable to connect */ public void connect_T300_Overflow(BOOL newIV) { T300_Overflow = newIV; } /** Connect the given variable to the input variable T300_Underflow * @param newIV The variable to connect */ public void connect_T300_Underflow(BOOL newIV) { T300_Underflow = newIV; } /** Connect the given variable to the input variable T300_Overheat * @param newIV The variable to connect */ public void connect_T300_Overheat(BOOL newIV) { T300_Overheat = newIV; } /** Connect the given variable to the input variable T300_OverPressure * @param newIV The variable to connect */ public void connect_T300_OverPressure(BOOL newIV) { T300_OverPressure = newIV; } /** Connect the given variable to the input variable T400_Overflow * @param newIV The variable to connect */ public void connect_T400_Overflow(BOOL newIV) { T400_Overflow = newIV; } /** Connect the given variable to the input variable T400_Underflow * @param newIV The variable to connect */ public void connect_T400_Underflow(BOOL newIV) { T400_Underflow = newIV; } /** Connect the given variable to the input variable FillingSeqEnable * @param newIV The variable to connect */ public void connect_FillingSeqEnable(BOOL newIV) { FillingSeqEnable = newIV; } /** Connect the given variable to the input variable StartSeqEnable * @param newIV The variable to connect */ public void connect_StartSeqEnable(BOOL newIV) { StartSeqEnable = newIV; } /** Connect the given variable to the input variable ShutdownSeqEnable * @param newIV The variable to connect */ public void connect_ShutdownSeqEnable(BOOL newIV) { ShutdownSeqEnable = newIV; } /** Connect the given variable to the input variable EmptyingSeqEnable * @param newIV The variable to connect */ public void connect_EmptyingSeqEnable(BOOL newIV) { EmptyingSeqEnable = newIV; } private static final int index_START = 0; private void state_START() { eccState = index_START; } private static final int index_INIT = 1; private void state_INIT() { eccState = index_INIT; alg_INIT(); INITO.serviceEvent(this); state_START(); transition_FB_SequenceControl_0(); } private static final int index_FillingSeq = 2; private void state_FillingSeq() { eccState = index_FillingSeq; alg_FillingSeq_Action(); CNF.serviceEvent(this); } private static final int index_WAIT = 3; private void state_WAIT() { eccState = index_WAIT; alg_Wait_Action(); CNF.serviceEvent(this); } private static final int index_StartupSeq = 4; private void state_StartupSeq() { eccState = index_StartupSeq; alg_StartupSeq_Action(); CNF.serviceEvent(this); } private static final int index_SupplySeq = 5; private void state_SupplySeq() { eccState = index_SupplySeq; alg_SupplySeq_Action(); CNF.serviceEvent(this); } private static final int index_ShutdownSeq = 6; private void state_ShutdownSeq() { eccState = index_ShutdownSeq; alg_ShutdownSeq_Action(); CNF.serviceEvent(this); } private static final int index_EmptyingSeq = 7; private void state_EmptyingSeq() { eccState = index_EmptyingSeq; alg_EmptyingSeq_Action(); CNF.serviceEvent(this); } /** The default constructor. */ public FB_SequenceControl() { super(); } /** {@inheritDoc} * @param e {@inheritDoc} */ public void serviceEvent(EventServer e) { if (e == INIT) service_INIT(); else if (e == REQ) service_REQ(); } /** Services the INIT event. */ public void service_INIT() { if ((eccState == index_START)) { state_INIT(); transition_FB_SequenceControl_1(); } } /** Services the REQ event. */ public void service_REQ() { if ((eccState == index_START) && (FillingSeqEnable.value)) { state_FillingSeq(); transition_FB_SequenceControl_2(); } else if ((eccState == index_FillingSeq) && (FillingSeqComplete.value)) { state_WAIT(); transition_FB_SequenceControl_3(); } else if ((eccState == index_WAIT) && (StartSeqEnable.value)) { state_StartupSeq(); transition_FB_SequenceControl_4(); } else if ((eccState == index_StartupSeq) && (StartSeqComplete.value)) { state_SupplySeq(); transition_FB_SequenceControl_5(); } else if ((eccState == index_SupplySeq) && (ShutdownSeqEnable.value)) { state_ShutdownSeq(); transition_FB_SequenceControl_6(); } else if ((eccState == index_ShutdownSeq) && (EmptyingSeqEnable.value)) { state_EmptyingSeq(); transition_FB_SequenceControl_7(); } else if ((eccState == index_EmptyingSeq) && (EmptyingComplete.value)) { state_START(); transition_FB_SequenceControl_8(); } } /** ALGORITHM INIT IN ST*/ public void alg_INIT() { ; Y101_Open.value = false; Y102_Open.value = false; Y103_Open.value = false; Y105_Open.value = false; Y201_Open.value = false; Y202_Open.value = false; Y203_Open.value = false; Y204_Open.value = true;/*for(OverPressure*/ Y301_Open.value = false; Y302_Open.value = false; Y303_Open.value = false; Y305_Open.value = false; Y401_Open.value = false; Y402_Open.value = false; Y403_Open.value = false; Y404_Open.value = false; Y501_Open.value = false; E100_On.value = false; M100_On.value = false; M200_On.value = false; } /** ALGORITHM FillingSeq_Action IN ST*/ public void alg_FillingSeq_Action() { ; Y101_Open.value = true; Y102_Open.value = true; M100_On.value = true; Y203_Open.value = true; Y201_Open.value = true; M200_On.value = true; Y303_Open.value = true; Y301_Open.value = true; FillingSeqComplete.value = !(T100_Underflow.value | T200_Underflow.value | T300_Underflow.value | T400_Underflow.value); } /** ALGORITHM EmptyingSeq_Action IN ST*/ public void alg_EmptyingSeq_Action() { ; if (!T400_Underflow.value) { Y105_Open.value = true; }; if (!T200_Underflow.value) { Y201_Open.value = true; M200_On.value = true; Y303_Open.value = true; Y301_Open.value = true; }; if (!T300_Underflow.value) { Y305_Open.value = true; Y501_Open.value = true; } if (!T400_Underflow.value) { Y101_Open.value = true; }; EmptyingComplete.value = T100_Underflow.value & T200_Underflow.value & T300_Underflow.value & T400_Underflow.value; } /** ALGORITHM ShutdownSeq_Action IN ST*/ public void alg_ShutdownSeq_Action() { ; Y501_Open.value = false; E100_On.value = false; Y102_Open.value = false; M100_On.value = false; Y203_Open.value = false; Y201_Open.value = false; M200_On.value = false; Y303_Open.value = false; Y301_Open.value = false; Y305_Open.value = false; } /** ALGORITHM StartupSeq_Action IN ST*/ public void alg_StartupSeq_Action() { ; Y101_Open.value = false; Y102_Open.value = false; Y103_Open.value = false; Y105_Open.value = false; Y201_Open.value = false; Y202_Open.value = false; Y203_Open.value = false; Y204_Open.value = true;/*for(OverPressure*/ Y301_Open.value = false; Y302_Open.value = false; Y303_Open.value = false; Y305_Open.value = false; Y401_Open.value = false; Y402_Open.value = false; Y403_Open.value = false; Y404_Open.value = false; Y501_Open.value = false; E100_On.value = false; M100_On.value = false; M200_On.value = false; } /** ALGORITHM SupplySeq_Action IN ST*/ public void alg_SupplySeq_Action() { ; Y501_Open.value = true; } /** ALGORITHM Wait_Action IN ST*/ public void alg_Wait_Action() { ; Y101_Open.value = false; Y102_Open.value = false; M100_On.value = false; Y203_Open.value = false; Y201_Open.value = false; M200_On.value = false; Y303_Open.value = false; Y301_Open.value = false; } } private void transition_FB_SequenceControl_0() { } private void transition_FB_SequenceControl_1() { } private void transition_FB_SequenceControl_2() { } private void transition_FB_SequenceControl_3() { } private void transition_FB_SequenceControl_4() { } private void transition_FB_SequenceControl_5() { } private void transition_FB_SequenceControl_6() { } private void transition_FB_SequenceControl_7() { } private void transition_FB_SequenceControl_8() { } /* Copyright (c)2015 nxtControl GmbH. All rights reserved. */ /** FUNCTION_BLOCK FB_InterlockControl * @author wildai * @version 20150208/wildai */ private class FB_InterlockControl extends FBInstance { /** VAR T100_Overflow */ public BOOL T100_Overflow = new BOOL(); /** VAR T100_Underflow */ public BOOL T100_Underflow = new BOOL(); /** VAR T100_Overheat */ public BOOL T100_Overheat = new BOOL(); /** VAR T200_Overflow */ public BOOL T200_Overflow = new BOOL(); /** VAR T200_Underflow */ public BOOL T200_Underflow = new BOOL(); /** VAR T300_Overflow */ public BOOL T300_Overflow = new BOOL(); /** VAR T300_Underflow */ public BOOL T300_Underflow = new BOOL(); /** VAR T300_Overheat */ public BOOL T300_Overheat = new BOOL(); /** VAR T300_OverPressure */ public BOOL T300_OverPressure = new BOOL(); /** VAR T400_Overflow */ public BOOL T400_Overflow = new BOOL(); /** VAR T400_Underflow */ public BOOL T400_Underflow = new BOOL(); /** VAR Y102_Closed */ public BOOL Y102_Closed = new BOOL(); /** VAR Y201_Closed */ public BOOL Y201_Closed = new BOOL(); /** VAR Y203_Closed */ public BOOL Y203_Closed = new BOOL(); /** VAR Y301_Closed */ public BOOL Y301_Closed = new BOOL(); /** VAR Y303_Closed */ public BOOL Y303_Closed = new BOOL(); /** VAR Y403_Closed */ public BOOL Y403_Closed = new BOOL(); /** VAR Y101_Open */ public BOOL Y101_Open = new BOOL(); /** VAR Y102_Open */ public BOOL Y102_Open = new BOOL(); /** VAR Y103_Open */ public BOOL Y103_Open = new BOOL(); /** VAR Y105_Open */ public BOOL Y105_Open = new BOOL(); /** VAR Y201_Open */ public BOOL Y201_Open = new BOOL(); /** VAR Y202_Open */ public BOOL Y202_Open = new BOOL(); /** VAR Y203_Open */ public BOOL Y203_Open = new BOOL(); /** VAR Y204_Open */ public BOOL Y204_Open = new BOOL(); /** VAR Y301_Open */ public BOOL Y301_Open = new BOOL(); /** VAR Y302_Open */ public BOOL Y302_Open = new BOOL(); /** VAR Y303_Open */ public BOOL Y303_Open = new BOOL(); /** VAR Y305_Open */ public BOOL Y305_Open = new BOOL(); /** VAR Y401_Open */ public BOOL Y401_Open = new BOOL(); /** VAR Y402_Open */ public BOOL Y402_Open = new BOOL(); /** VAR Y403_Open */ public BOOL Y403_Open = new BOOL(); /** VAR Y404_Open */ public BOOL Y404_Open = new BOOL(); /** VAR Y501_Open */ public BOOL Y501_Open = new BOOL(); /** VAR E100_On */ public BOOL E100_On = new BOOL(); /** VAR M100_On */ public BOOL M100_On = new BOOL(); /** VAR M200_On */ public BOOL M200_On = new BOOL(); /** Initialization Request */ public EventServer INIT = new EventInput(this); /** Normal Execution Request */ public EventServer REQ = new EventInput(this); /** Initialization Confirm */ public EventOutput INITO = new EventOutput(); /** Execution Confirmation */ public EventOutput CNF = new EventOutput(); /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public ANY ovNamed(String s) throws FBRManagementException { if ("Y101_Open".equals(s)) return Y101_Open; if ("Y102_Open".equals(s)) return Y102_Open; if ("Y103_Open".equals(s)) return Y103_Open; if ("Y105_Open".equals(s)) return Y105_Open; if ("Y201_Open".equals(s)) return Y201_Open; if ("Y202_Open".equals(s)) return Y202_Open; if ("Y203_Open".equals(s)) return Y203_Open; if ("Y204_Open".equals(s)) return Y204_Open; if ("Y301_Open".equals(s)) return Y301_Open; if ("Y302_Open".equals(s)) return Y302_Open; if ("Y303_Open".equals(s)) return Y303_Open; if ("Y305_Open".equals(s)) return Y305_Open; if ("Y401_Open".equals(s)) return Y401_Open; if ("Y402_Open".equals(s)) return Y402_Open; if ("Y403_Open".equals(s)) return Y403_Open; if ("Y404_Open".equals(s)) return Y404_Open; if ("Y501_Open".equals(s)) return Y501_Open; if ("E100_On".equals(s)) return E100_On; if ("M100_On".equals(s)) return M100_On; if ("M200_On".equals(s)) return M200_On; return super.ovNamed(s);} /** {@inheritDoc} * @param ivName {@inheritDoc} * @param newIV {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public void connectIV(String ivName, ANY newIV) throws FBRManagementException { if ("T100_Overflow".equals(ivName)) connect_T100_Overflow((BOOL) newIV); else if ("T100_Underflow".equals(ivName)) connect_T100_Underflow((BOOL) newIV); else if ("T100_Overheat".equals(ivName)) connect_T100_Overheat((BOOL) newIV); else if ("T200_Overflow".equals(ivName)) connect_T200_Overflow((BOOL) newIV); else if ("T200_Underflow".equals(ivName)) connect_T200_Underflow((BOOL) newIV); else if ("T300_Overflow".equals(ivName)) connect_T300_Overflow((BOOL) newIV); else if ("T300_Underflow".equals(ivName)) connect_T300_Underflow((BOOL) newIV); else if ("T300_Overheat".equals(ivName)) connect_T300_Overheat((BOOL) newIV); else if ("T300_OverPressure".equals(ivName)) connect_T300_OverPressure((BOOL) newIV); else if ("T400_Overflow".equals(ivName)) connect_T400_Overflow((BOOL) newIV); else if ("T400_Underflow".equals(ivName)) connect_T400_Underflow((BOOL) newIV); else if ("Y102_Closed".equals(ivName)) connect_Y102_Closed((BOOL) newIV); else if ("Y201_Closed".equals(ivName)) connect_Y201_Closed((BOOL) newIV); else if ("Y203_Closed".equals(ivName)) connect_Y203_Closed((BOOL) newIV); else if ("Y301_Closed".equals(ivName)) connect_Y301_Closed((BOOL) newIV); else if ("Y303_Closed".equals(ivName)) connect_Y303_Closed((BOOL) newIV); else if ("Y403_Closed".equals(ivName)) connect_Y403_Closed((BOOL) newIV); else super.connectIV(ivName, newIV); } /** Connect the given variable to the input variable T100_Overflow * @param newIV The variable to connect */ public void connect_T100_Overflow(BOOL newIV) { T100_Overflow = newIV; } /** Connect the given variable to the input variable T100_Underflow * @param newIV The variable to connect */ public void connect_T100_Underflow(BOOL newIV) { T100_Underflow = newIV; } /** Connect the given variable to the input variable T100_Overheat * @param newIV The variable to connect */ public void connect_T100_Overheat(BOOL newIV) { T100_Overheat = newIV; } /** Connect the given variable to the input variable T200_Overflow * @param newIV The variable to connect */ public void connect_T200_Overflow(BOOL newIV) { T200_Overflow = newIV; } /** Connect the given variable to the input variable T200_Underflow * @param newIV The variable to connect */ public void connect_T200_Underflow(BOOL newIV) { T200_Underflow = newIV; } /** Connect the given variable to the input variable T300_Overflow * @param newIV The variable to connect */ public void connect_T300_Overflow(BOOL newIV) { T300_Overflow = newIV; } /** Connect the given variable to the input variable T300_Underflow * @param newIV The variable to connect */ public void connect_T300_Underflow(BOOL newIV) { T300_Underflow = newIV; } /** Connect the given variable to the input variable T300_Overheat * @param newIV The variable to connect */ public void connect_T300_Overheat(BOOL newIV) { T300_Overheat = newIV; } /** Connect the given variable to the input variable T300_OverPressure * @param newIV The variable to connect */ public void connect_T300_OverPressure(BOOL newIV) { T300_OverPressure = newIV; } /** Connect the given variable to the input variable T400_Overflow * @param newIV The variable to connect */ public void connect_T400_Overflow(BOOL newIV) { T400_Overflow = newIV; } /** Connect the given variable to the input variable T400_Underflow * @param newIV The variable to connect */ public void connect_T400_Underflow(BOOL newIV) { T400_Underflow = newIV; } /** Connect the given variable to the input variable Y102_Closed * @param newIV The variable to connect */ public void connect_Y102_Closed(BOOL newIV) { Y102_Closed = newIV; } /** Connect the given variable to the input variable Y201_Closed * @param newIV The variable to connect */ public void connect_Y201_Closed(BOOL newIV) { Y201_Closed = newIV; } /** Connect the given variable to the input variable Y203_Closed * @param newIV The variable to connect */ public void connect_Y203_Closed(BOOL newIV) { Y203_Closed = newIV; } /** Connect the given variable to the input variable Y301_Closed * @param newIV The variable to connect */ public void connect_Y301_Closed(BOOL newIV) { Y301_Closed = newIV; } /** Connect the given variable to the input variable Y303_Closed * @param newIV The variable to connect */ public void connect_Y303_Closed(BOOL newIV) { Y303_Closed = newIV; } /** Connect the given variable to the input variable Y403_Closed * @param newIV The variable to connect */ public void connect_Y403_Closed(BOOL newIV) { Y403_Closed = newIV; } private static final int index_START = 0; private void state_START() { eccState = index_START; } private static final int index_INIT = 1; private void state_INIT() { eccState = index_INIT; alg_INIT(); INITO.serviceEvent(this); state_START(); transition_FB_InterlockControl_0(); } private static final int index_REQ = 2; private void state_REQ() { eccState = index_REQ; alg_REQ(); CNF.serviceEvent(this); state_START(); transition_FB_InterlockControl_1(); } /** The default constructor. */ public FB_InterlockControl() { super(); } /** {@inheritDoc} * @param e {@inheritDoc} */ public void serviceEvent(EventServer e) { if (e == INIT) service_INIT(); else if (e == REQ) service_REQ(); } /** Services the INIT event. */ public void service_INIT() { if ((eccState == index_START)) { state_INIT(); transition_FB_InterlockControl_2(); } } /** Services the REQ event. */ public void service_REQ() { if ((eccState == index_START)) { state_REQ(); transition_FB_InterlockControl_3(); } } /** ALGORITHM INIT IN ST*/ public void alg_INIT() { ; Y101_Open.value = true; Y102_Open.value = true; Y103_Open.value = true; Y105_Open.value = true; Y201_Open.value = true; Y202_Open.value = true; Y203_Open.value = true; Y204_Open.value = true; Y301_Open.value = true; Y302_Open.value = true; Y303_Open.value = true; Y305_Open.value = true; Y401_Open.value = true; Y402_Open.value = true; Y403_Open.value = false; Y404_Open.value = true; Y501_Open.value = true; E100_On.value = true; M100_On.value = true; M200_On.value = true; } /** ALGORITHM REQ IN ST*/ public void alg_REQ() { ; /*Interlocksfor(Valve,Heater&Pump*/ Y101_Open.value = true; Y102_Open.value = true; Y103_Open.value = true; Y105_Open.value = true; Y201_Open.value = true; Y202_Open.value = true; Y203_Open.value = true; Y204_Open.value = true; Y301_Open.value = true; Y302_Open.value = true; Y303_Open.value = true; Y305_Open.value = true; Y401_Open.value = true; Y402_Open.value = true; Y403_Open.value = false; Y404_Open.value = true; Y501_Open.value = true; E100_On.value = true; M100_On.value = true; M200_On.value = true; if (T100_Overflow.value | T400_Underflow.value) { Y101_Open.value = false; }; if (T100_Underflow.value) { Y102_Open.value = false; }; if (T100_Underflow.value | T300_Overflow.value) { Y103_Open.value = false; }; if (T100_Underflow.value) { Y105_Open.value = false; }; if (T200_Underflow.value) { Y201_Open.value = false; }; if (T200_Underflow.value) { Y202_Open.value = false; }; if (T200_Overflow.value) { Y203_Open.value = false; }; if (T200_Overflow.value | T300_Underflow.value) { Y204_Open.value = false; }; if (T300_OverPressure.value) { Y204_Open.value = true; }; if (T300_Overflow.value) { Y301_Open.value = false; }; if (T300_Overflow.value) { Y302_Open.value = false; }; if (T300_Underflow.value) { Y305_Open.value = false; }; if (T300_Underflow.value) { Y401_Open.value = false; }; if (T200_Underflow.value | T400_Overflow.value) { Y402_Open.value = false; }; if (T400_Underflow.value) { Y404_Open.value = false; }; if (T100_Overflow.value) { Y501_Open.value = false; }; if (T100_Overheat.value | T100_Underflow.value) { E100_On.value = false; }; if (Y102_Closed.value | (Y203_Closed.value & Y403_Closed.value)) { M100_On.value = false; }; if (Y301_Closed.value | Y303_Closed.value | Y201_Closed.value) { M200_On.value = false; }; } } private void transition_FB_InterlockControl_0() { } private void transition_FB_InterlockControl_1() { } private void transition_FB_InterlockControl_2() { } private void transition_FB_InterlockControl_3() { } /* Copyright (c)2015 nxtControl GmbH. All rights reserved. */ /** FUNCTION_BLOCK FB_HeaterControl * @author wildai * @version 20150208/wildai */ private class FB_HeaterControl extends FBInstance { /** VAR RequestStart */ public BOOL RequestStart = new BOOL(); /** VAR ReadyToStart */ public BOOL ReadyToStart = new BOOL(); /** Output event qualifier */ public BOOL HeaterOn = new BOOL(); /** Initialization Request */ public EventServer INIT = new EventInput(this); /** Normal Execution Request */ public EventServer REQ = new EventInput(this); /** Initialization Confirm */ public EventOutput INITO = new EventOutput(); /** Execution Confirmation */ public EventOutput CNF = new EventOutput(); /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public ANY ovNamed(String s) throws FBRManagementException { if ("HeaterOn".equals(s)) return HeaterOn; return super.ovNamed(s);} /** {@inheritDoc} * @param ivName {@inheritDoc} * @param newIV {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public void connectIV(String ivName, ANY newIV) throws FBRManagementException { if ("RequestStart".equals(ivName)) connect_RequestStart((BOOL) newIV); else if ("ReadyToStart".equals(ivName)) connect_ReadyToStart((BOOL) newIV); else super.connectIV(ivName, newIV); } /** Connect the given variable to the input variable RequestStart * @param newIV The variable to connect */ public void connect_RequestStart(BOOL newIV) { RequestStart = newIV; } /** Connect the given variable to the input variable ReadyToStart * @param newIV The variable to connect */ public void connect_ReadyToStart(BOOL newIV) { ReadyToStart = newIV; } private static final int index_START = 0; private void state_START() { eccState = index_START; } private static final int index_INIT = 1; private void state_INIT() { eccState = index_INIT; alg_INIT(); INITO.serviceEvent(this); state_START(); transition_FB_HeaterControl_0(); } private static final int index_REQ = 2; private void state_REQ() { eccState = index_REQ; alg_REQ(); CNF.serviceEvent(this); state_START(); transition_FB_HeaterControl_1(); } /** The default constructor. */ public FB_HeaterControl() { super(); } /** {@inheritDoc} * @param e {@inheritDoc} */ public void serviceEvent(EventServer e) { if (e == INIT) service_INIT(); else if (e == REQ) service_REQ(); } /** Services the INIT event. */ public void service_INIT() { if ((eccState == index_START)) { state_INIT(); transition_FB_HeaterControl_2(); } } /** Services the REQ event. */ public void service_REQ() { if ((eccState == index_START)) { state_REQ(); transition_FB_HeaterControl_3(); } } /** ALGORITHM INIT IN ST*/ public void alg_INIT() { ; HeaterOn.value = false; } /** ALGORITHM REQ IN ST*/ public void alg_REQ() { ; if (RequestStart.value & ReadyToStart.value) { HeaterOn.value = true; } else { HeaterOn.value = false; }; } } private void transition_FB_HeaterControl_0() { } private void transition_FB_HeaterControl_1() { } private void transition_FB_HeaterControl_2() { } private void transition_FB_HeaterControl_3() { } /* Copyright (c)2015 nxtControl GmbH. All rights reserved. */ /** FUNCTION_BLOCK FB_PumpControl * @author wildai * @version 20150208/wildai */ private class FB_PumpControl extends FBInstance { /** VAR RangeOutMin */ public REAL RangeOutMin = new REAL(); /** VAR RangeOutMax */ public REAL RangeOutMax = new REAL(); /** VAR RequestStart */ public BOOL RequestStart = new BOOL(); /** VAR ReadyToStart */ public BOOL ReadyToStart = new BOOL(); /** VAR RequestValue */ public REAL RequestValue = new REAL(); /** Output event qualifier */ public BOOL PumpOn = new BOOL(); /** VAR InvalidRange */ public BOOL InvalidRange = new BOOL(); /** VAR PumpValue */ public REAL PumpValue = new REAL(); /** Initialization Request */ public EventServer INIT = new EventInput(this); /** Normal Execution Request */ public EventServer REQ = new EventInput(this); /** Initialization Confirm */ public EventOutput INITO = new EventOutput(); /** Execution Confirmation */ public EventOutput CNF = new EventOutput(); /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public ANY ovNamed(String s) throws FBRManagementException { if ("PumpOn".equals(s)) return PumpOn; if ("InvalidRange".equals(s)) return InvalidRange; if ("PumpValue".equals(s)) return PumpValue; return super.ovNamed(s);} /** {@inheritDoc} * @param ivName {@inheritDoc} * @param newIV {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public void connectIV(String ivName, ANY newIV) throws FBRManagementException { if ("RangeOutMin".equals(ivName)) connect_RangeOutMin((REAL) newIV); else if ("RangeOutMax".equals(ivName)) connect_RangeOutMax((REAL) newIV); else if ("RequestStart".equals(ivName)) connect_RequestStart((BOOL) newIV); else if ("ReadyToStart".equals(ivName)) connect_ReadyToStart((BOOL) newIV); else if ("RequestValue".equals(ivName)) connect_RequestValue((REAL) newIV); else super.connectIV(ivName, newIV); } /** Connect the given variable to the input variable RangeOutMin * @param newIV The variable to connect */ public void connect_RangeOutMin(REAL newIV) { RangeOutMin = newIV; } /** Connect the given variable to the input variable RangeOutMax * @param newIV The variable to connect */ public void connect_RangeOutMax(REAL newIV) { RangeOutMax = newIV; } /** Connect the given variable to the input variable RequestStart * @param newIV The variable to connect */ public void connect_RequestStart(BOOL newIV) { RequestStart = newIV; } /** Connect the given variable to the input variable ReadyToStart * @param newIV The variable to connect */ public void connect_ReadyToStart(BOOL newIV) { ReadyToStart = newIV; } /** Connect the given variable to the input variable RequestValue * @param newIV The variable to connect */ public void connect_RequestValue(REAL newIV) { RequestValue = newIV; } private static final int index_START = 0; private void state_START() { eccState = index_START; } private static final int index_INIT = 1; private void state_INIT() { eccState = index_INIT; alg_INIT(); INITO.serviceEvent(this); state_START(); transition_FB_PumpControl_0(); } private static final int index_REQ = 2; private void state_REQ() { eccState = index_REQ; alg_REQ(); CNF.serviceEvent(this); state_START(); transition_FB_PumpControl_1(); } /** The default constructor. */ public FB_PumpControl() { super(); } /** {@inheritDoc} * @param e {@inheritDoc} */ public void serviceEvent(EventServer e) { if (e == INIT) service_INIT(); else if (e == REQ) service_REQ(); } /** Services the INIT event. */ public void service_INIT() { if ((eccState == index_START)) { state_INIT(); transition_FB_PumpControl_2(); } } /** Services the REQ event. */ public void service_REQ() { if ((eccState == index_START)) { state_REQ(); transition_FB_PumpControl_3(); } } /** ALGORITHM INIT IN ST*/ public void alg_INIT() { ; PumpOn.value = false; InvalidRange.value = false; PumpValue.value = (float) (0.0); } /** ALGORITHM REQ IN ST*/ public void alg_REQ() { ; if (RequestStart.value & ReadyToStart.value) { if (RequestValue.value >= RangeOutMin.value & RequestValue.value <= RangeOutMax.value) { PumpValue.value = (float) (RequestValue.value); InvalidRange.value = false; PumpOn.value = true; } else { PumpValue.value = (float) (0.0); InvalidRange.value = true; PumpOn.value = false; }; } else { PumpOn.value = false; PumpValue.value = (float) (0.0); }; } } private void transition_FB_PumpControl_0() { } private void transition_FB_PumpControl_1() { } private void transition_FB_PumpControl_2() { } private void transition_FB_PumpControl_3() { } /* Copyright (c)2015 nxtControl GmbH. All rights reserved. */ /** FUNCTION_BLOCK FB_ValveControl * @author wildai * @version 20150208/wildai */ private class FB_ValveControl extends FBInstance { /** Input event qualifier */ public BOOL IsControlValve = new BOOL(); /** VAR RangeOutMin */ public REAL RangeOutMin = new REAL(); /** VAR RangeOutMax */ public REAL RangeOutMax = new REAL(); /** VAR RequestStart */ public BOOL RequestStart = new BOOL(); /** VAR ReadyToStart */ public BOOL ReadyToStart = new BOOL(); /** VAR RequestValue */ public REAL RequestValue = new REAL(); /** Output event qualifier */ public BOOL ValveOn = new BOOL(); /** VAR InvalidRange */ public BOOL InvalidRange = new BOOL(); /** VAR ValveValue */ public REAL ValveValue = new REAL(); /** Initialization Request */ public EventServer INIT = new EventInput(this); /** Normal Execution Request */ public EventServer REQ = new EventInput(this); /** Initialization Confirm */ public EventOutput INITO = new EventOutput(); /** Execution Confirmation */ public EventOutput CNF = new EventOutput(); /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public ANY ovNamed(String s) throws FBRManagementException { if ("ValveOn".equals(s)) return ValveOn; if ("InvalidRange".equals(s)) return InvalidRange; if ("ValveValue".equals(s)) return ValveValue; return super.ovNamed(s);} /** {@inheritDoc} * @param ivName {@inheritDoc} * @param newIV {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public void connectIV(String ivName, ANY newIV) throws FBRManagementException { if ("IsControlValve".equals(ivName)) connect_IsControlValve((BOOL) newIV); else if ("RangeOutMin".equals(ivName)) connect_RangeOutMin((REAL) newIV); else if ("RangeOutMax".equals(ivName)) connect_RangeOutMax((REAL) newIV); else if ("RequestStart".equals(ivName)) connect_RequestStart((BOOL) newIV); else if ("ReadyToStart".equals(ivName)) connect_ReadyToStart((BOOL) newIV); else if ("RequestValue".equals(ivName)) connect_RequestValue((REAL) newIV); else super.connectIV(ivName, newIV); } /** Connect the given variable to the input variable IsControlValve * @param newIV The variable to connect */ public void connect_IsControlValve(BOOL newIV) { IsControlValve = newIV; } /** Connect the given variable to the input variable RangeOutMin * @param newIV The variable to connect */ public void connect_RangeOutMin(REAL newIV) { RangeOutMin = newIV; } /** Connect the given variable to the input variable RangeOutMax * @param newIV The variable to connect */ public void connect_RangeOutMax(REAL newIV) { RangeOutMax = newIV; } /** Connect the given variable to the input variable RequestStart * @param newIV The variable to connect */ public void connect_RequestStart(BOOL newIV) { RequestStart = newIV; } /** Connect the given variable to the input variable ReadyToStart * @param newIV The variable to connect */ public void connect_ReadyToStart(BOOL newIV) { ReadyToStart = newIV; } /** Connect the given variable to the input variable RequestValue * @param newIV The variable to connect */ public void connect_RequestValue(REAL newIV) { RequestValue = newIV; } private static final int index_START = 0; private void state_START() { eccState = index_START; } private static final int index_INIT = 1; private void state_INIT() { eccState = index_INIT; alg_INIT(); INITO.serviceEvent(this); state_START(); transition_FB_ValveControl_0(); } private static final int index_REQ = 2; private void state_REQ() { eccState = index_REQ; alg_REQ(); CNF.serviceEvent(this); state_START(); transition_FB_ValveControl_1(); } /** The default constructor. */ public FB_ValveControl() { super(); } /** {@inheritDoc} * @param e {@inheritDoc} */ public void serviceEvent(EventServer e) { if (e == INIT) service_INIT(); else if (e == REQ) service_REQ(); } /** Services the INIT event. */ public void service_INIT() { if ((eccState == index_START)) { state_INIT(); transition_FB_ValveControl_2(); } } /** Services the REQ event. */ public void service_REQ() { if ((eccState == index_START)) { state_REQ(); transition_FB_ValveControl_3(); } } /** ALGORITHM INIT IN ST*/ public void alg_INIT() { ; ValveOn.value = false; InvalidRange.value = false; ValveValue.value = (float) (0.0); } /** ALGORITHM REQ IN ST*/ public void alg_REQ() { ; if (IsControlValve.value & RequestStart.value & ReadyToStart.value) { if (RequestValue.value >= RangeOutMin.value & RequestValue.value <= RangeOutMax.value) { ValveValue.value = (float) (RequestValue.value); InvalidRange.value = false; ValveOn.value = true; } else { ValveValue.value = (float) (0.0); InvalidRange.value = true; ValveOn.value = false; }; } else { ValveOn.value = false; ValveValue.value = (float) (0.0); }; } } private void transition_FB_ValveControl_0() { } private void transition_FB_ValveControl_1() { } private void transition_FB_ValveControl_2() { } private void transition_FB_ValveControl_3() { } /* Copyright (c)2015 nxtControl GmbH. All rights reserved. */ /** FUNCTION_BLOCK Service_AOControl * @author wildai * @version 20150208/wildai */ private class Service_AOControl extends FBInstance { /** VAR AOValue */ public REAL AOValue = new REAL(); /** VAR OM */ public BOOL OM = new BOOL(); /** VAR OM_Value */ public REAL OM_Value = new REAL(); /** VAR AO */ public REAL AO = new REAL(); /** Initialization Request */ public EventServer INIT = new EventInput(this); /** Normal Execution Request */ public EventServer REQ = new EventInput(this); /** Initialization Confirm */ public EventOutput INITO = new EventOutput(); /** Execution Confirmation */ public EventOutput CNF = new EventOutput(); /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public ANY ovNamed(String s) throws FBRManagementException { if ("AO".equals(s)) return AO; return super.ovNamed(s);} /** {@inheritDoc} * @param ivName {@inheritDoc} * @param newIV {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public void connectIV(String ivName, ANY newIV) throws FBRManagementException { if ("AOValue".equals(ivName)) connect_AOValue((REAL) newIV); else if ("OM".equals(ivName)) connect_OM((BOOL) newIV); else if ("OM_Value".equals(ivName)) connect_OM_Value((REAL) newIV); else super.connectIV(ivName, newIV); } /** Connect the given variable to the input variable AOValue * @param newIV The variable to connect */ public void connect_AOValue(REAL newIV) { AOValue = newIV; } /** Connect the given variable to the input variable OM * @param newIV The variable to connect */ public void connect_OM(BOOL newIV) { OM = newIV; } /** Connect the given variable to the input variable OM_Value * @param newIV The variable to connect */ public void connect_OM_Value(REAL newIV) { OM_Value = newIV; } private static final int index_START = 0; private void state_START() { eccState = index_START; } private static final int index_INIT = 1; private void state_INIT() { eccState = index_INIT; alg_INIT(); INITO.serviceEvent(this); state_START(); transition_Service_AOControl_0(); } private static final int index_REQ = 2; private void state_REQ() { eccState = index_REQ; alg_REQ(); CNF.serviceEvent(this); state_START(); transition_Service_AOControl_1(); } /** The default constructor. */ public Service_AOControl() { super(); } /** {@inheritDoc} * @param e {@inheritDoc} */ public void serviceEvent(EventServer e) { if (e == INIT) service_INIT(); else if (e == REQ) service_REQ(); } /** Services the INIT event. */ public void service_INIT() { if ((eccState == index_START)) { state_INIT(); transition_Service_AOControl_2(); } } /** Services the REQ event. */ public void service_REQ() { if ((eccState == index_START)) { state_REQ(); transition_Service_AOControl_3(); } } /** ALGORITHM INIT IN ST*/ public void alg_INIT() { ; AO.value = (float) (0.0); } /** ALGORITHM REQ IN ST*/ public void alg_REQ() { ; if (OM.value) { AO.value = (float) (OM_Value.value); } else { AO.value = (float) (AOValue.value); }; } } private void transition_Service_AOControl_0() { } private void transition_Service_AOControl_1() { } private void transition_Service_AOControl_2() { } private void transition_Service_AOControl_3() { } /* Copyright (c)2015 nxtControl GmbH. All rights reserved. */ /** FUNCTION_BLOCK Service_DOControl * @author wildai * @version 20150208/wildai */ private class Service_DOControl extends FBInstance { /** VAR CMD_ON */ public BOOL CMD_ON = new BOOL(); /** VAR OM */ public BOOL OM = new BOOL(); /** VAR OM_ON */ public BOOL OM_ON = new BOOL(); /** VAR OUTPUT */ public BOOL OUTPUT = new BOOL(); /** Initialization Request */ public EventServer INIT = new EventInput(this); /** Normal Execution Request */ public EventServer REQ = new EventInput(this); /** Initialization Confirm */ public EventOutput INITO = new EventOutput(); /** Execution Confirmation */ public EventOutput CNF = new EventOutput(); /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public ANY ovNamed(String s) throws FBRManagementException { if ("OUTPUT".equals(s)) return OUTPUT; return super.ovNamed(s);} /** {@inheritDoc} * @param ivName {@inheritDoc} * @param newIV {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public void connectIV(String ivName, ANY newIV) throws FBRManagementException { if ("CMD_ON".equals(ivName)) connect_CMD_ON((BOOL) newIV); else if ("OM".equals(ivName)) connect_OM((BOOL) newIV); else if ("OM_ON".equals(ivName)) connect_OM_ON((BOOL) newIV); else super.connectIV(ivName, newIV); } /** Connect the given variable to the input variable CMD_ON * @param newIV The variable to connect */ public void connect_CMD_ON(BOOL newIV) { CMD_ON = newIV; } /** Connect the given variable to the input variable OM * @param newIV The variable to connect */ public void connect_OM(BOOL newIV) { OM = newIV; } /** Connect the given variable to the input variable OM_ON * @param newIV The variable to connect */ public void connect_OM_ON(BOOL newIV) { OM_ON = newIV; } private static final int index_START = 0; private void state_START() { eccState = index_START; } private static final int index_INIT = 1; private void state_INIT() { eccState = index_INIT; alg_INIT(); INITO.serviceEvent(this); state_START(); transition_Service_DOControl_0(); } private static final int index_REQ = 2; private void state_REQ() { eccState = index_REQ; alg_REQ(); CNF.serviceEvent(this); state_START(); transition_Service_DOControl_1(); } /** The default constructor. */ public Service_DOControl() { super(); } /** {@inheritDoc} * @param e {@inheritDoc} */ public void serviceEvent(EventServer e) { if (e == INIT) service_INIT(); else if (e == REQ) service_REQ(); } /** Services the INIT event. */ public void service_INIT() { if ((eccState == index_START)) { state_INIT(); transition_Service_DOControl_2(); } } /** Services the REQ event. */ public void service_REQ() { if ((eccState == index_START)) { state_REQ(); transition_Service_DOControl_3(); } } /** ALGORITHM INIT IN ST*/ public void alg_INIT() { ; OUTPUT.value = false; } /** ALGORITHM REQ IN ST*/ public void alg_REQ() { ; if (((CMD_ON.value & !OM.value) | (OM.value & OM_ON.value))) { OUTPUT.value = true; } else { OUTPUT.value = false; }; } } private void transition_Service_DOControl_0() { } private void transition_Service_DOControl_1() { } private void transition_Service_DOControl_2() { } private void transition_Service_DOControl_3() { } /* Copyright (c)2015 nxtControl GmbH. All rights reserved. */ /** FUNCTION_BLOCK NOT1 * @author Администратор * @version 20150208/Администратор */ private class NOT1 extends FBInstance { /** Input event qualifier */ public BOOL IN1 = new BOOL(); /** Output event qualifier */ public BOOL OUT1 = new BOOL(); /** Normal Execution Request */ public EventServer REQ = new EventInput(this); /** Execution Confirmation */ public EventOutput CNF = new EventOutput(); /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public ANY ovNamed(String s) throws FBRManagementException { if ("OUT1".equals(s)) return OUT1; return super.ovNamed(s);} /** {@inheritDoc} * @param ivName {@inheritDoc} * @param newIV {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public void connectIV(String ivName, ANY newIV) throws FBRManagementException { if ("IN1".equals(ivName)) connect_IN1((BOOL) newIV); else super.connectIV(ivName, newIV); } /** Connect the given variable to the input variable IN1 * @param newIV The variable to connect */ public void connect_IN1(BOOL newIV) { IN1 = newIV; } private static final int index_START = 0; private void state_START() { eccState = index_START; } private static final int index_REQ = 1; private void state_REQ() { eccState = index_REQ; alg_REQ(); CNF.serviceEvent(this); state_START(); transition_NOT1_0(); } /** The default constructor. */ public NOT1() { super(); } /** {@inheritDoc} * @param e {@inheritDoc} */ public void serviceEvent(EventServer e) { if (e == REQ) service_REQ(); } /** Services the REQ event. */ public void service_REQ() { if ((eccState == index_START)) { state_REQ(); transition_NOT1_1(); } } /** ALGORITHM REQ IN ST*/ public void alg_REQ() { OUT1.value = !IN1.value;} } private void transition_NOT1_0() { } private void transition_NOT1_1() { } /* Copyright (c)2015 nxtControl GmbH. All rights reserved. */ /** FUNCTION_BLOCK NOT2 * @author Администратор * @version 20150208/Администратор */ private class NOT2 extends FBInstance { /** Input event qualifier */ public BOOL IN1 = new BOOL(); /** VAR IN2 */ public BOOL IN2 = new BOOL(); /** Output event qualifier */ public BOOL OUT1 = new BOOL(); /** VAR OUT2 */ public BOOL OUT2 = new BOOL(); /** Normal Execution Request */ public EventServer REQ = new EventInput(this); /** Execution Confirmation */ public EventOutput CNF = new EventOutput(); /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public ANY ovNamed(String s) throws FBRManagementException { if ("OUT1".equals(s)) return OUT1; if ("OUT2".equals(s)) return OUT2; return super.ovNamed(s);} /** {@inheritDoc} * @param ivName {@inheritDoc} * @param newIV {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public void connectIV(String ivName, ANY newIV) throws FBRManagementException { if ("IN1".equals(ivName)) connect_IN1((BOOL) newIV); else if ("IN2".equals(ivName)) connect_IN2((BOOL) newIV); else super.connectIV(ivName, newIV); } /** Connect the given variable to the input variable IN1 * @param newIV The variable to connect */ public void connect_IN1(BOOL newIV) { IN1 = newIV; } /** Connect the given variable to the input variable IN2 * @param newIV The variable to connect */ public void connect_IN2(BOOL newIV) { IN2 = newIV; } private static final int index_START = 0; private void state_START() { eccState = index_START; } private static final int index_REQ = 1; private void state_REQ() { eccState = index_REQ; alg_REQ(); CNF.serviceEvent(this); state_START(); transition_NOT2_0(); } /** The default constructor. */ public NOT2() { super(); } /** {@inheritDoc} * @param e {@inheritDoc} */ public void serviceEvent(EventServer e) { if (e == REQ) service_REQ(); } /** Services the REQ event. */ public void service_REQ() { if ((eccState == index_START)) { state_REQ(); transition_NOT2_1(); } } /** ALGORITHM REQ IN ST*/ public void alg_REQ() { OUT1.value = !IN1.value; OUT2.value = !IN2.value;} } private void transition_NOT2_0() { } private void transition_NOT2_1() { } /* Copyright (c)2015 nxtControl GmbH. All rights reserved. */ /** FUNCTION_BLOCK NOT3 * @author Администратор * @version 20150208/Администратор */ private class NOT3 extends FBInstance { /** Input event qualifier */ public BOOL IN1 = new BOOL(); /** VAR IN2 */ public BOOL IN2 = new BOOL(); /** VAR IN3 */ public BOOL IN3 = new BOOL(); /** Output event qualifier */ public BOOL OUT1 = new BOOL(); /** VAR OUT2 */ public BOOL OUT2 = new BOOL(); /** VAR OUT3 */ public BOOL OUT3 = new BOOL(); /** Normal Execution Request */ public EventServer REQ = new EventInput(this); /** Execution Confirmation */ public EventOutput CNF = new EventOutput(); /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public ANY ovNamed(String s) throws FBRManagementException { if ("OUT1".equals(s)) return OUT1; if ("OUT2".equals(s)) return OUT2; if ("OUT3".equals(s)) return OUT3; return super.ovNamed(s);} /** {@inheritDoc} * @param ivName {@inheritDoc} * @param newIV {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public void connectIV(String ivName, ANY newIV) throws FBRManagementException { if ("IN1".equals(ivName)) connect_IN1((BOOL) newIV); else if ("IN2".equals(ivName)) connect_IN2((BOOL) newIV); else if ("IN3".equals(ivName)) connect_IN3((BOOL) newIV); else super.connectIV(ivName, newIV); } /** Connect the given variable to the input variable IN1 * @param newIV The variable to connect */ public void connect_IN1(BOOL newIV) { IN1 = newIV; } /** Connect the given variable to the input variable IN2 * @param newIV The variable to connect */ public void connect_IN2(BOOL newIV) { IN2 = newIV; } /** Connect the given variable to the input variable IN3 * @param newIV The variable to connect */ public void connect_IN3(BOOL newIV) { IN3 = newIV; } private static final int index_START = 0; private void state_START() { eccState = index_START; } private static final int index_REQ = 1; private void state_REQ() { eccState = index_REQ; alg_REQ(); CNF.serviceEvent(this); state_START(); transition_NOT3_0(); } /** The default constructor. */ public NOT3() { super(); } /** {@inheritDoc} * @param e {@inheritDoc} */ public void serviceEvent(EventServer e) { if (e == REQ) service_REQ(); } /** Services the REQ event. */ public void service_REQ() { if ((eccState == index_START)) { state_REQ(); transition_NOT3_1(); } } /** ALGORITHM REQ IN ST*/ public void alg_REQ() { OUT1.value = IN1.value; OUT2.value = IN2.value; OUT3.value = IN3.value;} } private void transition_NOT3_0() { } private void transition_NOT3_1() { } /* Copyright (c)2015 nxtControl GmbH. All rights reserved. */ /** FUNCTION_BLOCK NOT10 * @author Администратор * @version 20150208/Администратор */ private class NOT10 extends FBInstance { /** Input event qualifier */ public BOOL IN1 = new BOOL(); /** VAR IN2 */ public BOOL IN2 = new BOOL(); /** VAR IN3 */ public BOOL IN3 = new BOOL(); /** VAR IN4 */ public BOOL IN4 = new BOOL(); /** VAR IN5 */ public BOOL IN5 = new BOOL(); /** VAR IN6 */ public BOOL IN6 = new BOOL(); /** VAR IN7 */ public BOOL IN7 = new BOOL(); /** VAR IN8 */ public BOOL IN8 = new BOOL(); /** VAR IN9 */ public BOOL IN9 = new BOOL(); /** VAR IN10 */ public BOOL IN10 = new BOOL(); /** Output event qualifier */ public BOOL OUT1 = new BOOL(); /** VAR OUT2 */ public BOOL OUT2 = new BOOL(); /** VAR OUT3 */ public BOOL OUT3 = new BOOL(); /** VAR OUT4 */ public BOOL OUT4 = new BOOL(); /** VAR OUT5 */ public BOOL OUT5 = new BOOL(); /** VAR OUT6 */ public BOOL OUT6 = new BOOL(); /** VAR OUT7 */ public BOOL OUT7 = new BOOL(); /** VAR OUT8 */ public BOOL OUT8 = new BOOL(); /** VAR OUT9 */ public BOOL OUT9 = new BOOL(); /** VAR OUT10 */ public BOOL OUT10 = new BOOL(); /** Normal Execution Request */ public EventServer REQ = new EventInput(this); /** Execution Confirmation */ public EventOutput CNF = new EventOutput(); /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public ANY ovNamed(String s) throws FBRManagementException { if ("OUT1".equals(s)) return OUT1; if ("OUT2".equals(s)) return OUT2; if ("OUT3".equals(s)) return OUT3; if ("OUT4".equals(s)) return OUT4; if ("OUT5".equals(s)) return OUT5; if ("OUT6".equals(s)) return OUT6; if ("OUT7".equals(s)) return OUT7; if ("OUT8".equals(s)) return OUT8; if ("OUT9".equals(s)) return OUT9; if ("OUT10".equals(s)) return OUT10; return super.ovNamed(s);} /** {@inheritDoc} * @param ivName {@inheritDoc} * @param newIV {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public void connectIV(String ivName, ANY newIV) throws FBRManagementException { if ("IN1".equals(ivName)) connect_IN1((BOOL) newIV); else if ("IN2".equals(ivName)) connect_IN2((BOOL) newIV); else if ("IN3".equals(ivName)) connect_IN3((BOOL) newIV); else if ("IN4".equals(ivName)) connect_IN4((BOOL) newIV); else if ("IN5".equals(ivName)) connect_IN5((BOOL) newIV); else if ("IN6".equals(ivName)) connect_IN6((BOOL) newIV); else if ("IN7".equals(ivName)) connect_IN7((BOOL) newIV); else if ("IN8".equals(ivName)) connect_IN8((BOOL) newIV); else if ("IN9".equals(ivName)) connect_IN9((BOOL) newIV); else if ("IN10".equals(ivName)) connect_IN10((BOOL) newIV); else super.connectIV(ivName, newIV); } /** Connect the given variable to the input variable IN1 * @param newIV The variable to connect */ public void connect_IN1(BOOL newIV) { IN1 = newIV; } /** Connect the given variable to the input variable IN2 * @param newIV The variable to connect */ public void connect_IN2(BOOL newIV) { IN2 = newIV; } /** Connect the given variable to the input variable IN3 * @param newIV The variable to connect */ public void connect_IN3(BOOL newIV) { IN3 = newIV; } /** Connect the given variable to the input variable IN4 * @param newIV The variable to connect */ public void connect_IN4(BOOL newIV) { IN4 = newIV; } /** Connect the given variable to the input variable IN5 * @param newIV The variable to connect */ public void connect_IN5(BOOL newIV) { IN5 = newIV; } /** Connect the given variable to the input variable IN6 * @param newIV The variable to connect */ public void connect_IN6(BOOL newIV) { IN6 = newIV; } /** Connect the given variable to the input variable IN7 * @param newIV The variable to connect */ public void connect_IN7(BOOL newIV) { IN7 = newIV; } /** Connect the given variable to the input variable IN8 * @param newIV The variable to connect */ public void connect_IN8(BOOL newIV) { IN8 = newIV; } /** Connect the given variable to the input variable IN9 * @param newIV The variable to connect */ public void connect_IN9(BOOL newIV) { IN9 = newIV; } /** Connect the given variable to the input variable IN10 * @param newIV The variable to connect */ public void connect_IN10(BOOL newIV) { IN10 = newIV; } private static final int index_START = 0; private void state_START() { eccState = index_START; } private static final int index_REQ = 1; private void state_REQ() { eccState = index_REQ; alg_REQ(); CNF.serviceEvent(this); state_START(); transition_NOT10_0(); } /** The default constructor. */ public NOT10() { super(); } /** {@inheritDoc} * @param e {@inheritDoc} */ public void serviceEvent(EventServer e) { if (e == REQ) service_REQ(); } /** Services the REQ event. */ public void service_REQ() { if ((eccState == index_START)) { state_REQ(); transition_NOT10_1(); } } /** ALGORITHM REQ IN ST*/ public void alg_REQ() { OUT1.value = !IN1.value; OUT2.value = !IN2.value; OUT3.value = !IN3.value; OUT4.value = !IN4.value; OUT5.value = !IN5.value; OUT6.value = !IN6.value; OUT7.value = !IN7.value; OUT8.value = !IN8.value; OUT9.value = !IN9.value; OUT10.value = !IN10.value;} } private void transition_NOT10_0() { } private void transition_NOT10_1() { } /* Copyright (c)2015 nxtControl GmbH. All rights reserved. */ /** FUNCTION_BLOCK NOT16 * @author Администратор * @version 20150208/Администратор */ private class NOT16 extends FBInstance { /** OUT1 := NOT IN1; */ public BOOL IN1 = new BOOL(); /** VAR IN2 */ public BOOL IN2 = new BOOL(); /** VAR IN3 */ public BOOL IN3 = new BOOL(); /** VAR IN4 */ public BOOL IN4 = new BOOL(); /** VAR IN5 */ public BOOL IN5 = new BOOL(); /** VAR IN6 */ public BOOL IN6 = new BOOL(); /** VAR IN7 */ public BOOL IN7 = new BOOL(); /** VAR IN8 */ public BOOL IN8 = new BOOL(); /** VAR IN9 */ public BOOL IN9 = new BOOL(); /** VAR IN10 */ public BOOL IN10 = new BOOL(); /** VAR IN11 */ public BOOL IN11 = new BOOL(); /** VAR IN12 */ public BOOL IN12 = new BOOL(); /** VAR IN13 */ public BOOL IN13 = new BOOL(); /** VAR IN14 */ public BOOL IN14 = new BOOL(); /** VAR IN15 */ public BOOL IN15 = new BOOL(); /** VAR IN16 */ public BOOL IN16 = new BOOL(); /** Output event qualifier */ public BOOL OUT1 = new BOOL(); /** VAR OUT2 */ public BOOL OUT2 = new BOOL(); /** VAR OUT3 */ public BOOL OUT3 = new BOOL(); /** VAR OUT4 */ public BOOL OUT4 = new BOOL(); /** VAR OUT5 */ public BOOL OUT5 = new BOOL(); /** VAR OUT6 */ public BOOL OUT6 = new BOOL(); /** VAR OUT7 */ public BOOL OUT7 = new BOOL(); /** VAR OUT8 */ public BOOL OUT8 = new BOOL(); /** VAR OUT9 */ public BOOL OUT9 = new BOOL(); /** VAR OUT10 */ public BOOL OUT10 = new BOOL(); /** VAR OUT11 */ public BOOL OUT11 = new BOOL(); /** VAR OUT12 */ public BOOL OUT12 = new BOOL(); /** VAR OUT13 */ public BOOL OUT13 = new BOOL(); /** VAR OUT14 */ public BOOL OUT14 = new BOOL(); /** VAR OUT15 */ public BOOL OUT15 = new BOOL(); /** VAR OUT16 */ public BOOL OUT16 = new BOOL(); /** Normal Execution Request */ public EventServer REQ = new EventInput(this); /** Execution Confirmation */ public EventOutput CNF = new EventOutput(); /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ /** {@inheritDoc} * @param s {@inheritDoc} * @return {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public ANY ovNamed(String s) throws FBRManagementException { if ("OUT1".equals(s)) return OUT1; if ("OUT2".equals(s)) return OUT2; if ("OUT3".equals(s)) return OUT3; if ("OUT4".equals(s)) return OUT4; if ("OUT5".equals(s)) return OUT5; if ("OUT6".equals(s)) return OUT6; if ("OUT7".equals(s)) return OUT7; if ("OUT8".equals(s)) return OUT8; if ("OUT9".equals(s)) return OUT9; if ("OUT10".equals(s)) return OUT10; if ("OUT11".equals(s)) return OUT11; if ("OUT12".equals(s)) return OUT12; if ("OUT13".equals(s)) return OUT13; if ("OUT14".equals(s)) return OUT14; if ("OUT15".equals(s)) return OUT15; if ("OUT16".equals(s)) return OUT16; return super.ovNamed(s);} /** {@inheritDoc} * @param ivName {@inheritDoc} * @param newIV {@inheritDoc} * @throws FBRManagementException {@inheritDoc} */ public void connectIV(String ivName, ANY newIV) throws FBRManagementException { if ("IN1".equals(ivName)) connect_IN1((BOOL) newIV); else if ("IN2".equals(ivName)) connect_IN2((BOOL) newIV); else if ("IN3".equals(ivName)) connect_IN3((BOOL) newIV); else if ("IN4".equals(ivName)) connect_IN4((BOOL) newIV); else if ("IN5".equals(ivName)) connect_IN5((BOOL) newIV); else if ("IN6".equals(ivName)) connect_IN6((BOOL) newIV); else if ("IN7".equals(ivName)) connect_IN7((BOOL) newIV); else if ("IN8".equals(ivName)) connect_IN8((BOOL) newIV); else if ("IN9".equals(ivName)) connect_IN9((BOOL) newIV); else if ("IN10".equals(ivName)) connect_IN10((BOOL) newIV); else if ("IN11".equals(ivName)) connect_IN11((BOOL) newIV); else if ("IN12".equals(ivName)) connect_IN12((BOOL) newIV); else if ("IN13".equals(ivName)) connect_IN13((BOOL) newIV); else if ("IN14".equals(ivName)) connect_IN14((BOOL) newIV); else if ("IN15".equals(ivName)) connect_IN15((BOOL) newIV); else if ("IN16".equals(ivName)) connect_IN16((BOOL) newIV); else super.connectIV(ivName, newIV); } /** Connect the given variable to the input variable IN1 * @param newIV The variable to connect */ public void connect_IN1(BOOL newIV) { IN1 = newIV; } /** Connect the given variable to the input variable IN2 * @param newIV The variable to connect */ public void connect_IN2(BOOL newIV) { IN2 = newIV; } /** Connect the given variable to the input variable IN3 * @param newIV The variable to connect */ public void connect_IN3(BOOL newIV) { IN3 = newIV; } /** Connect the given variable to the input variable IN4 * @param newIV The variable to connect */ public void connect_IN4(BOOL newIV) { IN4 = newIV; } /** Connect the given variable to the input variable IN5 * @param newIV The variable to connect */ public void connect_IN5(BOOL newIV) { IN5 = newIV; } /** Connect the given variable to the input variable IN6 * @param newIV The variable to connect */ public void connect_IN6(BOOL newIV) { IN6 = newIV; } /** Connect the given variable to the input variable IN7 * @param newIV The variable to connect */ public void connect_IN7(BOOL newIV) { IN7 = newIV; } /** Connect the given variable to the input variable IN8 * @param newIV The variable to connect */ public void connect_IN8(BOOL newIV) { IN8 = newIV; } /** Connect the given variable to the input variable IN9 * @param newIV The variable to connect */ public void connect_IN9(BOOL newIV) { IN9 = newIV; } /** Connect the given variable to the input variable IN10 * @param newIV The variable to connect */ public void connect_IN10(BOOL newIV) { IN10 = newIV; } /** Connect the given variable to the input variable IN11 * @param newIV The variable to connect */ public void connect_IN11(BOOL newIV) { IN11 = newIV; } /** Connect the given variable to the input variable IN12 * @param newIV The variable to connect */ public void connect_IN12(BOOL newIV) { IN12 = newIV; } /** Connect the given variable to the input variable IN13 * @param newIV The variable to connect */ public void connect_IN13(BOOL newIV) { IN13 = newIV; } /** Connect the given variable to the input variable IN14 * @param newIV The variable to connect */ public void connect_IN14(BOOL newIV) { IN14 = newIV; } /** Connect the given variable to the input variable IN15 * @param newIV The variable to connect */ public void connect_IN15(BOOL newIV) { IN15 = newIV; } /** Connect the given variable to the input variable IN16 * @param newIV The variable to connect */ public void connect_IN16(BOOL newIV) { IN16 = newIV; } private static final int index_START = 0; private void state_START() { eccState = index_START; } private static final int index_REQ = 1; private void state_REQ() { eccState = index_REQ; alg_REQ(); CNF.serviceEvent(this); state_START(); transition_NOT16_0(); } /** The default constructor. */ public NOT16() { super(); } /** {@inheritDoc} * @param e {@inheritDoc} */ public void serviceEvent(EventServer e) { if (e == REQ) service_REQ(); } /** Services the REQ event. */ public void service_REQ() { if ((eccState == index_START)) { state_REQ(); transition_NOT16_1(); } } /** ALGORITHM REQ IN ST*/ public void alg_REQ() { OUT1.value = !IN1.value; OUT2.value = !IN2.value; OUT3.value = !IN3.value; OUT4.value = !IN4.value; OUT5.value = !IN5.value; OUT6.value = !IN6.value; OUT7.value = !IN7.value; OUT8.value = !IN8.value; OUT9.value = !IN9.value; OUT10.value = !IN10.value; OUT11.value = !IN11.value; OUT12.value = !IN12.value; OUT13.value = !IN13.value; OUT14.value = !IN14.value; OUT15.value = !IN15.value; OUT16.value = !IN16.value;} } private void transition_NOT16_0() { } private void transition_NOT16_1() { } }
true
671118daedd48073c9f98c36a801a78192f22815
Java
emiho4870/androidJava
/java06/배열응용/배열정렬2.java
UTF-8
2,085
3.640625
4
[ "MIT" ]
permissive
package 배열응용; import javax.swing.text.StyledEditorKit.ForegroundAction; public class 배열정렬2 { public static void main(String[] args) { // TODO Auto-generated method stub /* * 과목명 String형 점수 int형 */ String[] 과목 = { "국어", "수학", "과학", "컴퓨터", "영어" }; int[] 점수 = { 100, 99, 77, 87, 66 }; int[] 점수2 = 점수.clone(); // 점수배열 clone복제 int sum = 0; int sum2 = 0; /* * 1학기 점수 */ System.out.println("1학기 점수"); for (int x : 점수) { System.out.println(x + ""); } for (int i = 0; i < 점수.length; i++) { //sum = sum + 점수[i]; sum += 점수[i]; } System.out.println("1학기 평균은" + sum / 5 + "입니다"); System.out.println("----------------------------"); /* * 변경할 '점수2[i]'배열에 점수 저장 */ 점수2[2] = 44; 점수2[4] = 55; /* * clone함수로 변경된 점수 확인 */ System.out.println("2학기 점수"); for (int x : 점수2) { System.out.println(x + ""); } for (int i = 0; i < 점수2.length; i++) { //sum2 = sum2 + 점수2[i]; sum2 += 점수2[i]; } System.out.println("2학기 평균은" + sum2 / 5 + "입니다"); System.out.println("----------------------------"); if (sum == sum2) { System.out.println("1학기 2학기 평균이 같습니다"); } else if (sum < sum2) { System.out.println("2학기 평균이 더 높습니다"); } else { System.out.println("1학기 평균이 더 높습니다"); } /* * 점수배열과 점수2배열에서 다른값 찾기 */ int count = 0; for (int i = 0; i < 점수.length; i++) { // 0~4 까지 순차비교점검 : FOR > if if (점수[i] != 점수2[i]) { System.out.println("점수가 변경된 과목의 수는" + count + "과목 입니다"); count++; //count } } System.out.println("점수가 변경된 과목명은" + 과목[2] + "과" + 과목[3] + "입니다");//함수사용print } }
true
777f118f9d5e57bc06a801299f67056e4887f8af
Java
NerminLapic/Hibernate
/Hibernate Assigment 2/Hibernate Assigment 1/src/main.java
UTF-8
1,042
2.203125
2
[]
no_license
import java.sql.SQLException; import java.util.ArrayList; import java.util.Iterator; import javax.swing.JScrollBar; import javax.swing.JScrollPane; import javax.swing.JTable; import model.HibernateUtil; import org.hibernate.Session; /* * 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. */ /** * * @author Nermin */ public class main { /** * @param args the command line arguments * @throws java.sql.SQLException */ public static void main(String[] args) throws SQLException { FormUposlenici forma=new FormUposlenici(); forma.setTitle("Uposlenici"); Baza bazaUposlenih=new Baza(); // Baza.Connect(); ArrayList<Uposlenik> zaposleni=Baza.sviUposlenici(); ModelTabelaUposlenika Model=new ModelTabelaUposlenika(zaposleni); forma.tableUposlenici.setModel(Model); forma.setVisible(true); } }
true
3777b755f24e8bfddcb780b70a29bc8a98ad836a
Java
AlexRuppert/While2JasminCompiler
/src/parser/Grammar.java
UTF-8
6,194
2.875
3
[]
no_license
package parser; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import lexer.LexerGenerator.Token; public abstract class Grammar { public static enum NonTerminal implements Alphabet{ start, program, statement, declaration, assignment, out, branch, loop, expr, subexpr, guard, subguard, relation, S1, S, A, B, E, T, F } protected Map<NonTerminal, List<List<Alphabet>>> rules; public Map<NonTerminal, Set<Alphabet>> first; public Map<NonTerminal, Set<Alphabet>> follow; /** * Given (implicitly as the class' attribute) the rules of the grammar, * compute the first set for each non-terminal. */ void computeFirst(){ /* * 1. If X is terminal, then FIRST(X) is {X}. 2. If X -> e is a production, then add e to FIRST(X). (e stands for epsilon here) 3. If X is nonterminal and X -> Y1 Y2 ... Yk. is a production, then place a in FIRST(X) if for some i, a is in FIRST(Yi), and e is in all of FIRST(Y1), ... , FIRST(Yi-1); that is, Y1, ... ,Yi-1 => e. If e is in FIRST(Yj) for all j = 1, 2, ... , k, then add e to FIRST(X). For example, everything in FIRST(Y1) is surely in FIRST(X). If Y1 does not derive e, then we add nothing more to FIRST(X), but if Y1 => e, then we add FIRST(Y2) and so on. */ first = new HashMap<NonTerminal, Set<Alphabet>>(); for(NonTerminal nonTerminal : NonTerminal.values()){ if(rules.containsKey(nonTerminal)){ Set<Alphabet> s = computeFirst(getRules(nonTerminal), new HashSet<NonTerminal>()); first.put(nonTerminal, s); } } } private Set<Alphabet> computeFirst(List<Rule> list, Set<NonTerminal> visited){ Set<Alphabet> result = new HashSet<Alphabet>(); if(!visited.contains(list.get(0).getLhs())){ for(Rule rule : list){ //The case that the right hand side of a rule is epsilon is ignored as we use epsilon free grammars by assumption if(rule.getRhs()[0] instanceof Token){ //if first symbol to the right is a terminal, take that result.add(rule.getRhs()[0]); } else{ //if first symbol to the right is a non-terminal take the first set of that //ignore the rest as we assume there are no epsilon productions assert(rule.getRhs()[0] instanceof NonTerminal); NonTerminal nonTerminal = (NonTerminal)rule.getRhs()[0]; //the visited set avoids the following infinite looping for A->B...|...; B->A...|... visited.add(rule.getLhs()); result.addAll(computeFirst(getRules(nonTerminal), visited)); } } } return result; } /** * Given (implicitly as the class' attribute) the rules of the grammar, * compute the follow set for each non-terminal. */ void computeFollow(){ /* * 1. Place $ in FOLLOW(S), where S is the start symbol and $ is the input right endmarker. 2. If there is a production A -> aBb, then everything in FIRST(b), except for e, is placed in FOLLOW(B). 3. If there is a production A -> aB, or a production A -> aBb where FIRST(b) contains e (i.e., b => e), then everything in FOLLOW(A) is in FOLLOW(B). */ follow = new HashMap<NonTerminal, Set<Alphabet>>(); for(NonTerminal nonTerminal : NonTerminal.values()){ if(rules.containsKey(nonTerminal)){ Set<Alphabet> s = computeFollow(nonTerminal, new HashSet<NonTerminal>()); follow.put(nonTerminal, s); } } } private Set<Alphabet> computeFollow(NonTerminal nonTerminal, Set<NonTerminal> visited){ Set<Alphabet> result = new HashSet<Alphabet>(); if(!visited.contains(nonTerminal)){ for(Rule rule : getRules()){ int index = Arrays.asList(rule.getRhs()).indexOf(nonTerminal); if(index > -1){ //either there is something to the right of the nonTerminal and we take the first-set of that if(index < rule.getRhs().length-1){ index++;//consider the symbol to the right if(rule.getRhs()[index] instanceof Token){ Token token = (Token)rule.getRhs()[index]; result.add(token); } else{ assert(rule.getRhs()[index] instanceof NonTerminal); NonTerminal nt = (NonTerminal)rule.getRhs()[index]; result.addAll(first.get(nt)); } } //... or the nonTerminal is the rightmost symbol of the production in which case we take the // follow-set of the left hand side else{ assert(index == rule.getRhs().length-1); visited.add(nonTerminal); result.addAll(computeFollow(rule.getLhs(), visited)); } } } } return result; } /** * Given a non-terminal X return all productions (Rule objects) with X on the left hand side. * @param NonTerminal object * @return List of Rules for given non-terminal */ public List<Rule> getRules(NonTerminal name){ List<Rule> result = new ArrayList<Rule>(); if(rules.containsKey(name)){ for(List<Alphabet> rhs : rules.get(name)){ result.add(new Rule(name, rhs)); } } else{ System.out.println("No rules for "+name); } return result; } /** * @return a list of all productions of this grammar */ public List<Rule> getRules(){ List<Rule> result = new ArrayList<Rule>(); for(NonTerminal nonTerminal : rules.keySet()){ for(List<Alphabet> rhs : rules.get(nonTerminal)){ result.add(new Rule(nonTerminal, rhs)); } } return result; } public String toString(){ StringBuilder result = new StringBuilder(); Iterator<NonTerminal> lhs = rules.keySet().iterator(); while(lhs.hasNext()){ NonTerminal rule = lhs.next(); result.append(rule); result.append(" -> "); Iterator<List<Alphabet>> alternatives = rules.get(rule).iterator(); while(alternatives.hasNext()){ List<Alphabet> alternative = alternatives.next(); Iterator<Alphabet> character = alternative.iterator(); while(character.hasNext()){ result.append(character.next()); if(character.hasNext()) result.append(" "); } if(alternatives.hasNext()) result.append(" | "); } result.append("\n"); } return result.toString(); } }
true
2c7818d9e005526aa2fa1f779ddb64f75c4a2f44
Java
wangxiaofan/new_baza
/baza-bzb-app-android/app/src/main/java/com/baza/android/bzw/bean/resume/AudioLinkBean.java
UTF-8
168
1.53125
2
[]
no_license
package com.baza.android.bzw.bean.resume; /** * Created by Vincent.Lei on 2019/9/9. * Title: * Note: */ public class AudioLinkBean { public String link; }
true
ac456b679e40df386059dad317efef58e46c9638
Java
jiegeaini/bookManagement
/src/main/java/com/book/pojo/User_role.java
UTF-8
839
2.375
2
[]
no_license
package com.book.pojo; /** * @author jiege * @explain 管理员与角色关联实体类 * @time 2019/3/15 0:31 */ public class User_role { /**管理员与角色关联id*/ private int id; /**关联的管理员*/ private User user; /**关联的角色*/ private Role role; /** * @return the id */ public int getId() { return id; } /** * @param id the id to set */ public void setId(int id) { this.id = id; } /** * @return the user */ public User getUser() { return user; } /** * @param user the user to set */ public void setUser(User user) { this.user = user; } /** * @return the role */ public Role getRole() { return role; } /** * @param role the role to set */ public void setRole(Role role) { this.role = role; } }
true
dbc4e4c40d605af8e8422aaf7b5b820d7df544ca
Java
ManuelMonteiro24/POO_Blackjack
/src/videopoker/evaluators/FourToInStraightNoHC.java
UTF-8
533
2.859375
3
[]
no_license
package videopoker.evaluators; /** * Subclass of Evaluator * * Checks if the are 4 cards in hand that could make a Straight */ class FourToInStraightNoHC extends Evaluator{ /** * Creates an instance of class FourToInStraightNoHC */ FourToInStraightNoHC(){} /** * Method that checks if the are 4 cards in hand that could make a Straight */ @Override public int[] evaluate(){ int[] indexes; if((indexes = fourToIStraight()) != null) return indexes; return null; } }
true
492f10e9ca1771943fe13f8d49f770dd52313e95
Java
tgyhlsb/asbasket-website
/eclipse_project/src/com/servlet/GetJoueurFromEquipeServlet.java
ISO-8859-1
1,472
2.296875
2
[ "Apache-2.0" ]
permissive
package com.servlet; import static com.googlecode.objectify.ObjectifyService.ofy; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.googlecode.objectify.ObjectifyService; import com.objects.Equipe; import com.objects.Joueur; import com.objects.Saison; public class GetJoueurFromEquipeServlet extends HttpServlet { // Enregistrement de la classe persistable auprs d'Objectify static { ObjectifyService.register(Saison.class); ObjectifyService.register(Equipe.class); ObjectifyService.register(Joueur.class); } public void doGet(HttpServletRequest req, HttpServletResponse resp) { try { // Requte Objectify String sEquipeId = req.getParameter("equipe"); if (sEquipeId != null) { Long lEquipeId = Long.parseLong(sEquipeId); Equipe equipe = ofy().load().type(Equipe.class).id(lEquipeId).now(); req.setAttribute("joueurs", equipe.getJoueurs()); this.getServletContext().getRequestDispatcher("/WEB-INF/ajax/getJoueurFromEquipe.jsp").forward(req, resp); } } catch (ServletException e) { } catch (IOException e) { e.printStackTrace(); } } public void doPost(HttpServletRequest req, HttpServletResponse resp) { } }
true
0e817e524ac60dbf79fbafb23d16f1dd9ef83666
Java
ShurikuS57/GitHub-Viewer
/app/src/mock/java/com/taptm/shurikus/githubviewer/data/source/RepositoryModule.java
UTF-8
633
1.960938
2
[]
no_license
package com.taptm.shurikus.githubviewer.data.source; import android.content.Context; import com.taptm.shurikus.githubviewer.data.FakeRemoteDataSource; import com.taptm.shurikus.githubviewer.data.source.local.LocalDataSource; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; @Module public class RepositoryModule { @Singleton @Provides @Local DataSource provideLocalDataSource(Context context) { return new LocalDataSource(context); } @Singleton @Provides @Remote DataSource provideRemoteDataSource() { return new FakeRemoteDataSource(); } }
true
167f9a048d16a67f5422e501ebf4b9517400f321
Java
dleonard0/fitnesse
/src/fitnesse/wiki/MockXmlizerPageHandler.java
UTF-8
665
2.140625
2
[]
no_license
// Copyright (C) 2003-2009 by Object Mentor, Inc. All rights reserved. // Released under the terms of the CPL Common Public License version 1.0. package fitnesse.wiki; import java.util.Date; import java.util.LinkedList; import java.util.List; public class MockXmlizerPageHandler implements XmlizerPageHandler { public List<String> handledPages = new LinkedList<String>(); public List<Date> modDates = new LinkedList<Date>(); public int exits = 0; public void enterChildPage(WikiPage newPage, Date lastModified) throws Exception { handledPages.add(newPage.getName()); modDates.add(lastModified); } public void exitPage() { exits++; } }
true
2aa38214299a45ea485773113fbb4b25ee58dff2
Java
rockyfire/Gym
/src/com/gymsystem/vo/EquipmentReturnVo.java
UTF-8
331
1.765625
2
[]
no_license
package com.gymsystem.vo; import java.util.Date; public class EquipmentReturnVo { private String equipmentRepairNumber; private String equipmentName; private Date equipmentRenturnTime; private int equipmentNumber; private long pay; private String description; //器材归还描述 是否有损坏或者是否有丢失 }
true
871c075393ca3b5777cad23867bf2a4f884db3b9
Java
fzeglen/crud-port-adapter
/src/main/java/com/example/portadapter/api/services/rest/controllers/PaymentController.java
UTF-8
603
1.921875
2
[]
no_license
package com.example.portadapter.api.services.rest.controllers; import com.example.portadapter.api.domain.controllers.PaymentSessionController; import com.example.portadapter.api.domain.model.PaymentSession; import com.example.portadapter.api.domain.services.PaymentSessionService; import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("payment-session") public class PaymentController extends PaymentSessionController<PaymentSession<String>,String> { public PaymentController(PaymentSessionService paymentSessionService) { super(paymentSessionService); } }
true
6e257fc43e6908e83284d95702933d1b522e8f25
Java
Kotov-Roman/epam_tasks
/src/main/java/sea_battle/Computer.java
UTF-8
12,738
3.25
3
[]
no_license
package sea_battle; import sea_battle.battle_map.AbstractBattleMap; import sea_battle.ship.AbstractShip; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.Set; public class Computer { private SetShipsOnMapService computerSetShipsOnMapService = new SetShipsOnMapService(); AbstractBattleMap computerRealMap = computerSetShipsOnMapService.getMapWithShips(); ArrayList<AbstractShip> computerListOfShips = computerSetShipsOnMapService.getInitialListOfShips(); ArrayList<int[]> computerShootList = new ArrayList<>(); private boolean isKilled = false; private boolean isHurted = false; private int[] computerShootCoordinatesToShow = new int[2]; private boolean isAnyShipHurted = false; private int[] computerLastHit = new int[2]; private int[] computerFirsHit = new int[2]; private int direction = 1; Computer() { } /** * Computer's turn method * * @return 0 in case to pass turn or 1 in case to repeat turn */ public int computerTurn(ArrayList<AbstractShip> playerListOfShips) {// return 1 | 0 | return shootWithLogic(playerListOfShips); } /** * Computer's method with shoot logic * * @return 0 in case to pass turn or 1 in case to repeat turn */ private int shootWithLogic(ArrayList<AbstractShip> playerListOfShips) { if (isAnyShipHurted) { return tryToKillShip(playerListOfShips); } else { int[] shootCoordinates = usualShootWithRepeatCheck(); computerShootCoordinatesToShow = shootCoordinates; if (isShootHurtTheDeck(shootCoordinates, playerListOfShips)) { computerFirsHit = shootCoordinates; computerLastHit = shootCoordinates; isShipKilled(shootCoordinates, playerListOfShips); return repeatTurn(); } else { return passTurnToPlayer(); } } } /** * Computer's turn logic in case if player have any hurt ship. * Logic shoots near the hurt ship coordinates, attempting to kill it * * @return 0 in case to pass turn or 1 in case to repeat turn */ private int tryToKillShip(ArrayList<AbstractShip> playerListOfShips) { int x = computerLastHit[0]; int y = computerLastHit[1]; if (direction == 1) { if (x - 1 >= 0 & isShootable(x - 1, y)) { usualShoot(x - 1, y); computerShootCoordinatesToShow = new int[]{x - 1, y}; if (isShootHurtTheDeck(new int[]{x - 1, y}, playerListOfShips)) { if (isShipKilled(new int[]{x - 1, y}, playerListOfShips)) { isAnyShipHurted = false; direction = 1; return repeatTurn(); } computerLastHit = new int[]{x - 1, y}; return repeatTurn(); } else { computerLastHit = computerFirsHit; direction = 2; return passTurnToPlayer(); } } else { computerLastHit = computerFirsHit; direction = 2; } } if (direction == 2) { if (x + 1 < 10 & isShootable(x + 1, y)) { usualShoot(x + 1, y); computerShootCoordinatesToShow = new int[]{x + 1, y}; if (isShootHurtTheDeck(new int[]{x + 1, y}, playerListOfShips)) { if (isShipKilled(new int[]{x + 1, y}, playerListOfShips)) { isAnyShipHurted = false; direction = 1; return repeatTurn(); } computerLastHit = new int[]{x + 1, y}; return repeatTurn(); } else { computerLastHit = computerFirsHit; direction = 3; return passTurnToPlayer(); } } else { computerLastHit = computerFirsHit; direction = 3; } } if (direction == 3) { if (y - 1 >= 0 & isShootable(x, y - 1)) { usualShoot(x, y - 1); computerShootCoordinatesToShow = new int[]{x, y - 1}; if (isShootHurtTheDeck(new int[]{x, y - 1}, playerListOfShips)) { if (isShipKilled(new int[]{x, y - 1}, playerListOfShips)) { isAnyShipHurted = false; direction = 1; return repeatTurn(); } computerLastHit = new int[]{x, y - 1}; return repeatTurn(); } else { computerLastHit = computerFirsHit; direction = 4; return passTurnToPlayer(); } } else { computerLastHit = computerFirsHit; direction = 4; } } if (direction == 4) { if (y + 1 < 10 & isShootable(x, y + 1)) { usualShoot(x, y + 1); computerShootCoordinatesToShow = new int[]{x, y + 1}; if (isShootHurtTheDeck(new int[]{x, y + 1}, playerListOfShips)) { if (isShipKilled(new int[]{x, y + 1}, playerListOfShips)) { isAnyShipHurted = false; direction = 1; return repeatTurn(); } computerLastHit = new int[]{x, y + 1}; return repeatTurn(); } else { computerLastHit = computerFirsHit; direction = 1; return passTurnToPlayer(); } } else { direction = 1; return passTurnToPlayer(); } } else { return passTurnToPlayer(); } } /** * Make usual computer shot and add it to shootList * * @param x coordinate * @param y coordinate */ private void usualShoot(int x, int y) { getComputerShootList().add(new int[]{x, y}); } /** * Check for sense to shoot at specified coordinates * * @param x coordinate * @param y coordinate * @return true if it have sense */ private boolean isShootable(int x, int y) { for (int[] coordinatesFromList : getComputerShootList()) { if (Arrays.equals(coordinatesFromList, new int[]{x, y})) { return false; } } return true; } /** * Check if ship killed * * @return true if ship killed */ private boolean isShipKilled(int[] computerShoot, ArrayList<AbstractShip> playerListOfShips) { for (AbstractShip playerShip : playerListOfShips) { for (int[] shipDeckCoordinates : playerShip.getShipCoordinatesList()) { if (Arrays.equals(shipDeckCoordinates, computerShoot)) { if (playerShip.shipLife == 0) { flagKilledShipArea(playerShip); playerListOfShips.remove(playerShip); isHurted = true; isKilled = true; isAnyShipHurted = false; return true; } } } } isAnyShipHurted = true; return false; } /** * Flag area of killed ship on map */ private void flagKilledShipArea(AbstractShip enemyShip) { ArrayList<int[]> shipArea = new ArrayList<>(); for (int[] coordinates : enemyShip.getAllCoordinatesList()) { ArrayList<int[]> listToadd = flagDeck(coordinates); shipArea.addAll(listToadd); } computerShootList.addAll(shipArea); ArrayList<int[]> listToAdd; listToAdd = useKostil(computerShootList); computerShootList = listToAdd; } /** * returns list with coordinates to flag as shooted * * @return list */ private ArrayList<int[]> flagDeck(int[] coordinates) { return getInts(coordinates); } /** * returns list with coordinates to flag as shooted * * @return list */ public static ArrayList<int[]> getInts(int[] coordinates) { ArrayList<int[]> listOfFlags = new ArrayList<>(); int x = coordinates[0]; int y = coordinates[1]; int xHelper = -1; for (int i = 0; i < 3; i++) { int yHelper = -1; if (x + xHelper >= 0 & x + xHelper < 10) { for (int j = 0; j < 3; j++) { if (y + yHelper >= 0 & y + yHelper < 10) { listOfFlags.add(new int[]{x + xHelper, y + yHelper}); } yHelper++; } } xHelper++; } return listOfFlags; } /** * Metgod helps to returns ArrayList with elements int [] wich are nt repeated * * @return list with unique elements */ private ArrayList<int[]> useKostil(ArrayList<int[]> listToEdit) { ArrayList<String> listWithStrings = new ArrayList<>(); for (int[] coordinates : listToEdit) { int x = coordinates[0]; int y = coordinates[1]; String s = x + "" + y; listWithStrings.add(s); } Set<String> set = new HashSet<>(listWithStrings); ArrayList<int[]> result = new ArrayList<>(); for (String stringFromSet : set) { int[] arr = new int[2]; arr[0] = Character.getNumericValue(stringFromSet.charAt(0)); arr[1] = Character.getNumericValue(stringFromSet.charAt(1)); result.add(arr); } return result; } /** * generate random shoot coordinates and check it for repeat * * @return array of coordinates which are nor repeated */ private int[] usualShootWithRepeatCheck() { int[] usualShootCoordinates = new int[2]; while (true) { int x = (int) (Math.random() * 10); int y = (int) (Math.random() * 10); usualShootCoordinates[0] = x; usualShootCoordinates[1] = y; try { Thread.sleep(2); } catch (InterruptedException e) { e.printStackTrace(); } if (isUniqueShoot(usualShootCoordinates)) { break; } } computerShootList.add(usualShootCoordinates); return usualShootCoordinates; } /** * check of shoot damaged any deck * * @return true in case when ship damaged */ private boolean isShootHurtTheDeck(int[] computerShoot, ArrayList<AbstractShip> playerListOfShips) { for (AbstractShip playerShip : playerListOfShips) { for (int[] shipDeckCoordinates : playerShip.getShipCoordinatesList()) { if (Arrays.equals(shipDeckCoordinates, computerShoot)) { playerShip.shipLife--; isHurted = true; return true; } } } return false; } /** * Check for shoot repeat * * @return true in case it is not repeated */ private boolean isUniqueShoot(int[] shootCoordinates) { for (int[] shootFromList : getComputerShootList()) { if (Arrays.equals(shootCoordinates, shootFromList)) { return false; } } return true; } /** * displays shoot result */ public void showLastShootCoordinates() { System.out.println("Computer's shoot coordinates : " + Arrays.toString(computerShootCoordinatesToShow)); if (isKilled) { System.out.println("Ship is killed by computer"); isKilled = false; isHurted = false; } else { if (isHurted) { System.out.println("Ship is damaged by computer"); isHurted = false; } else { System.out.println("Computer missed"); } } } private int passTurnToPlayer() { return 0; } private int repeatTurn() { return 1; } public ArrayList<AbstractShip> getComputerListOfShips() { return computerListOfShips; } private ArrayList<int[]> getComputerShootList() { return computerShootList; } }
true
6983132f8481b36fbfc34a8142f63486822341d3
Java
SiliconHoller/gc-code
/graphcut/src/edu/ohio/graphcuts/analysis/FeatureExtraction.java
UTF-8
275
1.601563
2
[]
no_license
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package edu.ohio.graphcuts.analysis; /** * * @author david */ public interface FeatureExtraction { public int numFeatures(); public double[][] getFeatures(); }
true
b906a6f4b51369ef4cf2fee83d1252d8969da35f
Java
ABK7997/Outer-Station
/src/party/weapons/Hack_Device.java
UTF-8
275
2.25
2
[]
no_license
package party.weapons; public class Hack_Device extends Weapon { public Hack_Device() { name = "Hacking Device"; cost = 1000; index = 12; description = "A small device capable of attacking mechanical organs"; modifier = 1.0; type = "Pistol"; effect = "Hack"; } }
true
f7729d46bab8a4547b6ffa8a9d5fbcead78f438e
Java
apifest/apifest
/apifest-api/src/main/java/com/apifest/api/MappingEndpointDocumentation.java
UTF-8
6,785
1.640625
2
[]
no_license
/* * Copyright 2013-2015, ApiFest project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.apifest.api; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; import com.apifest.api.params.ExceptionDocumentation; import com.apifest.api.params.RequestParamDocumentation; import com.apifest.api.params.ResultParamDocumentation; /** * A wrapper type that holds all the documentation an endpoint. * @author Ivan Georgiev * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "endpoint_documentation") public class MappingEndpointDocumentation implements Serializable { private static final long serialVersionUID = 4130570229846556297L; @XmlAttribute(name = "scope", required = false) private String scope; @XmlAttribute(name = "method", required = true) private String method; @XmlAttribute(name = "endpoint", required = true) private String endpoint; @XmlAttribute(name = "description", required = true) private String description; @XmlAttribute(name = "paramsDescription", required = true) private String paramsDescription; @XmlAttribute(name = "resultsDescription", required = true) private String resultsDescription; @XmlAttribute(name = "summary", required = true) private String summary; @XmlAttribute(name = "group", required = true) private String group; @XmlTransient private int order; @XmlElement(name = "requestParams", type = RequestParamDocumentation.class) private List<RequestParamDocumentation> requestParamsDocumentation; @XmlElement(name = "resultParams", type = RequestParamDocumentation.class) private List<ResultParamDocumentation> resultParamsDocumentation; @XmlElement(name = "exceptions", type = ExceptionDocumentation.class) private List<ExceptionDocumentation> exceptionsDocumentation; @XmlElement(name="exampleRequest") private String exampleRequest; @XmlElement(name="exampleResult") private String exampleResult; @XmlTransient private boolean hidden; // support for multiple vars? @XmlAttribute(name = "varExpression") private String varExpression; @XmlAttribute(name = "varName") private String varName; @XmlAttribute(name = "customProperties") private Map<String, String> customProperties; public MappingEndpointDocumentation() { this.requestParamsDocumentation = new ArrayList<RequestParamDocumentation>(); } public String getScope() { return scope; } public void setScope(String scope) { this.scope = scope; } public String getMethod() { return method; } public void setMethod(String method) { this.method = method; } public String getEndpoint() { return endpoint; } public void setEndpoint(String endpoint) { this.endpoint = endpoint; } public List<RequestParamDocumentation> getRequestParamsDocumentation() { return requestParamsDocumentation; } public void setRequestParamsDocumentation(List<RequestParamDocumentation> requestParamsDocumentation) { this.requestParamsDocumentation = requestParamsDocumentation; } public List<ResultParamDocumentation> getResultParamsDocumentation() { return resultParamsDocumentation; } public void setResultParamsDocumentation(List<ResultParamDocumentation> resultParamsDocumentation) { this.resultParamsDocumentation = resultParamsDocumentation; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getParamsDescription() { return paramsDescription; } public void setParamsDescription(String paramsDescription) { this.paramsDescription = paramsDescription; } public String getResultsDescription() { return resultsDescription; } public void setResultsDescription(String resultsDescription) { this.resultsDescription = resultsDescription; } public String getSummary() { return summary; } public void setSummary(String summary) { this.summary = summary; } public String getGroup() { return group; } public void setGroup(String group) { this.group = group; } public int getOrder() { return order; } public void setOrder(int order) { this.order = order; } public boolean isHidden() { return hidden; } public void setHidden(boolean hidden) { this.hidden = hidden; } public List<ExceptionDocumentation> getExceptionsDocumentation() { return exceptionsDocumentation; } public void setExceptionsDocumentation(List<ExceptionDocumentation> exceptionsDocumentation) { this.exceptionsDocumentation = exceptionsDocumentation; } public String getExampleRequest() { return exampleRequest; } public void setExampleRequest(String exampleRequest) { this.exampleRequest = exampleRequest; } public String getExampleResult() { return exampleResult; } public void setExampleResult(String exampleResult) { this.exampleResult = exampleResult; } public String getVarExpression() { return varExpression; } public void setVarExpression(String varExpression) { this.varExpression = varExpression; } public String getVarName() { return varName; } public void setVarName(String varName) { this.varName = varName; } public Map<String, String> getCustomProperties() { return customProperties; } public void setCustomProperties(Map<String, String> customProperties) { this.customProperties = customProperties; } }
true
9439d525858e4043d3aeab63ee5a5a63c473a5a1
Java
jimmyygit/TourneyMaker
/Program/src/FileHandler.java
UTF-8
9,086
3.0625
3
[]
no_license
import java.awt.*; import java.awt.image.*; import javax.imageio.*; import javax.swing.*; import javax.swing.event.*; import java.io.*; import java.util.*; public class FileHandler { private static BufferedWriter writer; private static BufferedReader reader; public static boolean addTourney(String fileName, String newName, String[] stats) throws Exception { reader = new BufferedReader(new FileReader(fileName)); ArrayList<String> tourList = new ArrayList<String>(); String lineOfText = reader.readLine(); while (lineOfText != null) { tourList.add(lineOfText); lineOfText = reader.readLine(); } reader.close(); if (tourList.contains(newName)) { JOptionPane.showMessageDialog(null, "Name already in use. Please enter a new name.", "Name Already Used", JOptionPane.WARNING_MESSAGE); } else if (newName.equals("")) { JOptionPane.showMessageDialog(null, "Empty name. Please enter a name.", "Empty Name", JOptionPane.WARNING_MESSAGE); } else if (stats[0].trim().equals("")) { JOptionPane.showMessageDialog(null, "No statistics. Please enter at least " + "one statistic to record.", "Empty Name", JOptionPane.WARNING_MESSAGE); } else { writer = new BufferedWriter(new FileWriter(fileName, true)); writer.write(newName); writer.newLine(); writer.close(); return true; } return false; } public static void addTourneyFile(String name, boolean isRobin, boolean isSize4, String[] stats) throws IOException{ writer = new BufferedWriter(new FileWriter(name + ".txt")); if (isRobin) writer.write("robin 0"); else { if (isSize4) writer.write("playoff 0/4"); else writer.write("playoff 0/8"); } writer.newLine(); writer.write(stats.length + ""); writer.newLine(); for (String stat : stats) { writer.write(stat); writer.newLine(); } writer.close(); } public static String[] getTourneyList(String tourneyName) throws IOException { String[] tourneyList; reader = new BufferedReader(new FileReader(tourneyName)); ArrayList<String> tourList = new ArrayList<String>(); String lineOfText = reader.readLine(); while (lineOfText != null) { tourList.add(lineOfText); lineOfText = reader.readLine(); } reader.close(); tourneyList = tourList.toArray(new String[tourList.size()]); return tourneyList; } public static String getTeamNumber(String tourneyName) throws IOException { reader = new BufferedReader(new FileReader(tourneyName+".txt")); String[] type = reader.readLine().split(" "); reader.close(); return type[1]; } public static String getTourneyType(String tourneyName) throws IOException { reader = new BufferedReader(new FileReader(tourneyName+".txt")); String[] type = reader.readLine().split(" "); reader.close(); return type[0]; } public static boolean addTeam(String tourneyName, String teamName, String imagePath) throws IOException{ reader = new BufferedReader(new FileReader(tourneyName+".txt")); ArrayList<String> teamList = new ArrayList<String>(); String lineOfText = reader.readLine(); while (lineOfText != null) { teamList.add(lineOfText); lineOfText = reader.readLine(); } reader.close(); if (teamList.contains(teamName + " " + teamName+".png") || teamList.contains(teamName + " defaultTeam.png")) { JOptionPane.showMessageDialog(null, "Name already in use. Please enter a new name.", "Name Already Used", JOptionPane.WARNING_MESSAGE); } else if (teamName.equals("")) { JOptionPane.showMessageDialog(null, "Empty name. Please enter a name.", "Empty Name", JOptionPane.WARNING_MESSAGE); } else { writer = new BufferedWriter(new FileWriter(tourneyName+".txt")); String[] type = teamList.get(0).split(" "); if (type[0].equals("robin")) { int size = Integer.parseInt(type[1]); writer.write("robin " + (size+1)); writer.newLine(); } else { String size = type[1]; String newLine = "playoff "+ (Integer.parseInt(size.charAt(0)+"")+1) +"/"+size.charAt(2); writer.write(newLine); writer.newLine(); } //write all stats for (int i = 1; i < teamList.size(); i++) { writer.write(teamList.get(i)); writer.newLine(); } //write team with image path if (imagePath != null) { BufferedImage image = ImageIO.read(new File(imagePath)); Image tempImg = image.getScaledInstance(50, 50, Image.SCALE_SMOOTH); BufferedImage teamImage = new BufferedImage(50, 50, BufferedImage.TYPE_INT_RGB); teamImage.getGraphics().drawImage(tempImg, 0, 0, null); ImageIO.write(teamImage, "png", new File(teamName+".png")); writer.write(teamName + " " + teamName+".png"); } else { writer.write(teamName + " defaultTeam.png"); } writer.newLine(); writer.close(); // create team file writer = new BufferedWriter(new FileWriter(tourneyName+" "+teamName+".txt")); writer.close(); return true; } return false; } public static ArrayList<String> getTeamList(String tourneyName) throws IOException { reader = new BufferedReader(new FileReader(tourneyName+".txt")); ArrayList<String> teamList = new ArrayList<String>(); String lineOfText = reader.readLine(); int size = Integer.parseInt(lineOfText.split(" ")[1].charAt(0)+""); lineOfText = reader.readLine(); int numStats = Integer.parseInt(lineOfText); for (int i = 0; i < numStats; i++) { lineOfText = reader.readLine(); } for (int i = 0; i < size; i++) { lineOfText = reader.readLine(); teamList.add(lineOfText); } reader.close(); return teamList; } public static void updateMatchList(String tourneyName) throws IOException{ reader = new BufferedReader(new FileReader(tourneyName+".txt")); String lineOfText = reader.readLine(); lineOfText = reader.readLine(); int numStats = Integer.parseInt(lineOfText); reader.close(); ArrayList<String> teamList = getTeamList(tourneyName); for (int i = 0; i < teamList.size(); i++) { teamList.set(i, teamList.get(i).split(" ")[0]); } for (int i = 0; i < teamList.size(); i++) { String curName = teamList.get(i); writer = new BufferedWriter(new FileWriter(tourneyName+" "+curName+".txt")); for (int j = 0; j < teamList.size(); j++) { if (i != j) { writer.write(teamList.get(j)+" "); for (int k = 0; k < numStats; k++) { writer.write("0 "); } writer.newLine(); } } writer.close(); } } public static String[] getStatLine(String tourneyName, String team1, String team2) throws IOException{ reader = new BufferedReader(new FileReader(tourneyName+" "+team1+".txt")); String[] statLine; String lineOfText = reader.readLine(); while (lineOfText != null) { statLine = lineOfText.split(" "); if (statLine[0].equals(team2)) { reader.close(); return Arrays.copyOfRange(statLine, 1, statLine.length); } lineOfText = reader.readLine(); } reader.close(); return new String[1]; } public static String[] getStatNames(String tourneyName) throws IOException { reader = new BufferedReader(new FileReader(tourneyName+".txt")); String lineOfText = reader.readLine(); lineOfText = reader.readLine(); int numStats = Integer.parseInt(lineOfText); String[] statNames = new String[numStats]; for (int i = 0; i < numStats; i++) { statNames[i] = reader.readLine(); } reader.close(); return statNames; } public static void updateStats(String tourneyName, String team1, String team2, String[] statLine) throws IOException { reader = new BufferedReader(new FileReader(tourneyName+" "+team1+".txt")); ArrayList<String> lineHistory = new ArrayList<String>(); String lineOfText = reader.readLine(); while (lineOfText != null) { lineHistory.add(lineOfText); lineOfText = reader.readLine(); } reader.close(); writer = new BufferedWriter(new FileWriter(tourneyName+" "+team1+".txt")); for (String line : lineHistory) { if (team2.equals(line.split(" ")[0])) { writer.write(team2+" "); for(int i = 0; i < statLine.length; i++) { writer.write(statLine[i]+" "); } } else { writer.write(line); } writer.newLine(); } writer.close(); } }
true
65eee582630e7840d046e26932f31830599402af
Java
phong9x/webbook
/server/src/main/java/org/trams/webbook/data/repository/jpa/VisitorJpaRepository.java
UTF-8
883
2.03125
2
[]
no_license
package org.trams.webbook.data.repository.jpa; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.trams.webbook.bean.jpa.VisitorEntity; /** * Repository : Visitor. */ public interface VisitorJpaRepository extends PagingAndSortingRepository<VisitorEntity, Integer> { @Query( "Select u From VisitorEntity u " ) Page<VisitorEntity> listPaging(Pageable pageable); @Query( value="Update book set HITS_WEEKLY=0,INTERESTED_WEEKLY=0,RECOMMENDATION_WEEKLY=0 where HITS_WEEKLY>0 or INTERESTED_WEEKLY>0 or RECOMMENDATION_WEEKLY>0 and IS_DELETE=0",nativeQuery = true ) Integer totalSumAmountUser(Integer year, Integer month); }
true
2ad0ee809e290e0bc5deda53f12369f7b9e4f576
Java
cjl-df/test
/src/main/java/com/books/sf/chapter1/section3/unionconnection/WeightedQuickUion.java
UTF-8
1,004
3.25
3
[]
no_license
package com.books.sf.chapter1.section3.unionconnection; /** * 加权路径,优化连接算法 */ public class WeightedQuickUion { private int ids[]; private int size[]; private int count; public WeightedQuickUion(int N){ count = N; ids = new int[count]; for(int i = 0;i < size.length; i++) ids[i] = i; size = new int[count]; for(int i=0; i< size.length; i++ ) size[i] = 1; } public int count(){ return count; } public int find(int p){ while(p != ids[p]) p= ids[p]; return p; } public boolean connect(int p,int q) { return find(p) == find(q); } public void union(int p,int q){ int i = find(p); int j = find(q); if( i == j ) return; if(size[i] < size[j]){ ids[i] = j; size[i] += size[j]; }else { ids[j] = i; size[j] += size[i]; } count--; } }
true
ecabc8202c003148e28ce89f23a672b241454ef3
Java
MaafiHanene/Design-Pattern-Project
/src/src_Problem01/IStockStoreObject_.java
UTF-8
394
2.078125
2
[]
no_license
package src_Problem01; //serialization import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; public interface IStockStoreObject_{ public void sauvegarder(Object object,String file); public Object charger(String file); }
true
516c8f1ba881e1251dcf0b28072cd2cbc45171d5
Java
siuvan478/myRep
/src/main/java/com/asgab/service/CannotLoginException.java
UTF-8
449
2.046875
2
[]
no_license
package com.asgab.service; import org.apache.shiro.authc.AccountException; public class CannotLoginException extends AccountException { public CannotLoginException() { } public CannotLoginException(String message) { super(message); } public CannotLoginException(Throwable cause) { super(cause); } public CannotLoginException(String message, Throwable cause) { super(message, cause); } }
true
2126c087fde2e0f6d3e0250108b710be61ade9bc
Java
alexisfasquel/led-strip-controller
/src/com/aleks/letstrip/ScanActivity.java
UTF-8
3,759
2.09375
2
[]
no_license
package com.aleks.letstrip; import android.app.Activity; import android.content.Intent; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.View; import android.widget.*; import com.aleks.letstrip.Arduino.BluetoothService; public class ScanActivity extends Activity { private ListView mClientList; private BtListFiller mFiller; private BluetoothService mService; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mService = ((App)getApplication()).mBlutoothService; setContentView(R.layout.activity_scan); mClientList = (ListView) findViewById(R.id.bt_list_view); mClientList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { final TextView toater = (TextView)findViewById(R.id.toaster_scan); toater.setText("Connecting"); final TextView tv = (TextView)view.findViewById(R.id.device_name); new Thread(new Runnable() { @Override public void run() { final ImageView loading = (ImageView) findViewById(R.id.loading_scan); if(mService.connect(tv.getText().toString())) { runOnUiThread(new Runnable() { @Override public void run() { Intent resultIntent = new Intent(); setResult(Activity.RESULT_OK, resultIntent); finish(); } }); } else { runOnUiThread(new Runnable() { @Override public void run() { loading.setImageDrawable(getResources().getDrawable(R.drawable.loading_4)); toater.setText("Failed!"); toater.setTextColor(R.color.red); mClientList.setEnabled(false); } }); try { Thread.sleep(2000); } catch (InterruptedException e) {} runOnUiThread(new Runnable() { @Override public void run() { loading.setImageDrawable(getResources().getDrawable(R.drawable.loading_animation)); toater.setText("Scanning"); toater.setTextColor(R.color.grey); mClientList.setEnabled(true); } }); } } }).start(); } }); ImageButton back = (ImageButton) findViewById(R.id.back_button); back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent resultIntent = new Intent(); setResult(Activity.RESULT_CANCELED, resultIntent); finish(); } }); mFiller = new BtListFiller(this, mClientList, mService); mFiller.execute(); } @Override protected void onPause() { super.onPause(); mFiller.cancel(true); } }
true
49597e78b3b9c8ddbddd58d8cda405106433ce01
Java
JavaSensei/samples
/enums/src/ru/kpfu/itis/group11506/enums/Color.java
UTF-8
298
2.546875
3
[]
no_license
package ru.kpfu.itis.group11506.enums; public enum Color { RED("Красный"), GREEN("Зеленый"), BLUE("Синий"); private String description; private Color(String description) { this.description = description; } public String getDescription() { return description; } }
true
50a986fd2ac12fa53858bf7fa891608963c40e56
Java
PickledChris/Acme
/test/acceptance-tests/SystemUnderTest.java
UTF-8
1,553
2.1875
2
[]
no_license
import acme.telecom.fakes.FakeCustomerDatabase; import acme.telecom.fakes.FakeTariffLibrary; import acme.telecom.fakes.SimplePrinter; import com.acmetelecom.billcalculator.PeakPeriodDatasource; import com.acmetelecom.billcalculator.TariffCallCostCalculator; import com.acmetelecom.billcalculator.peak.PeakPeriodManager; import com.acmetelecom.billgenerator.TelecomBillGenerator; import com.acmetelecom.billingsystem.BillGenerator; import com.acmetelecom.billingsystem.BillingSystem; import com.acmetelecom.billingsystem.CallCostCalculator; import com.acmetelecom.billingsystem.CallManager; import com.acmetelecom.callmanager.SingleReceiverCallManager; public class SystemUnderTest { public static final FakeTariffLibrary tariffLibrary = new FakeTariffLibrary(); public static final FakeCustomerDatabase customerDatabase = new FakeCustomerDatabase(); public static final SimplePrinter simplePrinter = new SimplePrinter(); public static final PeakPeriodDatasource peakPeriodManager = new PeakPeriodManager(); public static final CallCostCalculator costCalculator = new TariffCallCostCalculator(tariffLibrary, peakPeriodManager); public static final BillGenerator billGenerator = new TelecomBillGenerator(simplePrinter); public static BillingSystem billingSystem; public static CallManager callManager = new SingleReceiverCallManager(); public static void reset() { simplePrinter.clearOutput(); billingSystem = new BillingSystem(customerDatabase, costCalculator, callManager, billGenerator); } }
true
05d37bef16b64e24c9f0fe6c023ca403c46dc839
Java
Dzhey/DroidWorker
/droidworker/src/main/java/com/be/android/library/worker/handlers/JobEventDispatcher.java
UTF-8
15,358
1.890625
2
[ "MIT" ]
permissive
package com.be.android.library.worker.handlers; import android.annotation.TargetApi; import android.content.Context; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.text.TextUtils; import android.util.Log; import com.be.android.library.worker.base.HierarchyViewer; import com.be.android.library.worker.base.InvocationHandler; import com.be.android.library.worker.base.JobCancelInvocationHandlerProvider; import com.be.android.library.worker.base.JobEvent; import com.be.android.library.worker.base.JobEventInvocationHandlerProvider; import com.be.android.library.worker.base.JobFailureInvocationHandlerProvider; import com.be.android.library.worker.base.JobResultInvocationHandlerProvider; import com.be.android.library.worker.base.JobSuccessInvocationHandlerProvider; import com.be.android.library.worker.controllers.JobManager; import com.be.android.library.worker.interfaces.Job; import com.be.android.library.worker.util.JobSelector; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.Set; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; public class JobEventDispatcher implements JobEventHandlerInterface { public static final String LOG_TAG = JobEventDispatcher.class.getSimpleName(); private static final String KEY_PENDING_JOBS = "JobEventHandler_pending_jobs"; private static final String KEY_FINISH_LISTENER_TAG = "JobEventHandler_listener_tag"; private static final String THREAD_NAME = "JobEventDispatcher_Thread"; private static Executor sAsyncExecutor; private final LinkedList<ListenerEntry> mListeners; private final Set<Integer> mPendingJobs; private final Handler mHandler; private final String mListenerTag; private final HierarchyViewer mHierarchyViewer; private final JobManager mJobManager; private final ConcurrentLinkedQueue<WeakReference<Object>> mPendingListeners; private boolean mIsFlushEnabled; private final CachedJobEventListener mJobFinishedListener = new CachedJobEventListener() { @Override public boolean onJobEventImpl(final JobEvent event) { if (mPendingJobs.contains(event.getJobId())) { mHandler.post(new Runnable() { @Override public void run() { handleJobEvent(event); } }); return false; } return true; } }; public JobEventDispatcher(Context context, String listenerName) { this(context, JobManager.getInstance(), listenerName); } public JobEventDispatcher(Context context) { this(context, JobManager.getInstance(), context.getClass().getSimpleName()); } public JobEventDispatcher(Context context, JobManager jobManager) { this(context, jobManager, context.getClass().getSimpleName()); } public JobEventDispatcher(Context context, JobManager jobManager, String listenerName) { mJobManager = jobManager; if (TextUtils.isEmpty(listenerName)) { throw new IllegalArgumentException("listenerName may not be empty"); } mListeners = new LinkedList<ListenerEntry>(); mPendingJobs = new HashSet<Integer>(); mHandler = new Handler(Looper.getMainLooper()); mListenerTag = String.format(Locale.US, "%s_%d_%d", listenerName, getClass().hashCode(), System.currentTimeMillis()); mPendingListeners = new ConcurrentLinkedQueue<WeakReference<Object>>(); mHierarchyViewer = new HierarchyViewer(context); mHierarchyViewer.registerInvocationHandlerProvider(new JobEventInvocationHandlerProvider()); mHierarchyViewer.registerInvocationHandlerProvider(new JobResultInvocationHandlerProvider()); mHierarchyViewer.registerInvocationHandlerProvider(new JobSuccessInvocationHandlerProvider()); mHierarchyViewer.registerInvocationHandlerProvider(new JobFailureInvocationHandlerProvider()); mHierarchyViewer.registerInvocationHandlerProvider(new JobCancelInvocationHandlerProvider()); } /** * Register previously submitted job to be pending by this handler * @param job job to register * @return true if successfully registered; false if no assigned job found * or job is already finished */ public boolean addPendingJob(Job job) { if (job == null || job.isFinished()) { return false; } addPendingJobImpl(job.getJobId()); return true; } /** * Register previously submitted job to be pending by this handler * @param jobId job id to register * @return true if successfully registered; false if no assigned job found * or job is already finished */ public boolean addPendingJob(int jobId) { Job job = mJobManager.findJob(jobId); return addPendingJob(job); } public boolean removePendingJob(int jobId) { final boolean removed = mPendingJobs.remove(jobId); if (mPendingJobs.isEmpty()) { mJobManager.removeJobEventListener(mJobFinishedListener); } return removed; } public void removePendingJobs() { mPendingJobs.clear(); mJobManager.removeJobEventListener(mJobFinishedListener); } private void addPendingJobImpl(int jobId) { if (mPendingJobs.isEmpty()) { mJobManager.addJobEventListener(mListenerTag, mJobFinishedListener); } mPendingJobs.add(jobId); } public boolean isPending(int jobId) { return mPendingJobs.contains(jobId); } public boolean isPending(JobSelector selector) { Job job = mJobManager.findJob(selector); if (job == null) return false; return mPendingJobs.contains(job.getJobId()); } public boolean isPendingAll(JobSelector selector) { List<Job> jobs = mJobManager.findAll(selector); for (Job job : jobs) { if (mPendingJobs.contains(job.getJobId()) == false) { return false; } } return true; } public int[] getPendingJobs() { int i = 0; int[] ids = new int[mPendingJobs.size()]; for (int jobId : mPendingJobs) { ids[i] = jobId; i++; } return ids; } public List<Integer> getPendingJobList() { return new ArrayList<Integer>(mPendingJobs); } public void saveState(Bundle outState) { if (outState == null) { throw new IllegalArgumentException("outState is null"); } outState.putIntArray(KEY_PENDING_JOBS, getPendingJobs()); outState.putString(KEY_FINISH_LISTENER_TAG, mListenerTag); } public void restoreState(Bundle savedInstanceState) { if (savedInstanceState == null || savedInstanceState.containsKey(KEY_PENDING_JOBS) == false) { return; } int[] ids = savedInstanceState.getIntArray(KEY_PENDING_JOBS); if (ids != null) { mPendingJobs.clear(); for (int id : ids) { addPendingJobImpl(id); } if (!mIsFlushEnabled) { return; } String cachedListenerTag = savedInstanceState.getString(KEY_FINISH_LISTENER_TAG); if (cachedListenerTag != null) { flushJobEvents(cachedListenerTag); } } } private void flushJobEvents(String cachedListenerTag) { if (!mIsFlushEnabled) { return; } for (int jobId : mPendingJobs) { final JobEvent event = mJobFinishedListener.getLastJobEvent(jobId); if (event != null) { mHandler.post(new Runnable() { @Override public void run() { handleJobEvent(event); } }); } } } public boolean isFlushEnabled() { return mIsFlushEnabled; } public void setFlushEnabled(boolean isFlushEnabled) { mIsFlushEnabled = isFlushEnabled; } public int submitJob(Job job) { int jobId = mJobManager.submitJob(job); addPendingJobImpl(jobId); return jobId; } public void register(Object listener) { if (listener == null) { throw new IllegalArgumentException("listener should not be null"); } List<InvocationHandler> registry = mHierarchyViewer.fetchInvocationHandlers(listener.getClass()); ListenerEntry entry = new ListenerEntry(new WeakReference<Object>(listener), registry); registerImpl(listener, entry); } private void registerImpl(Object listener, ListenerEntry listenerEntry) { if (listener == null) { throw new IllegalArgumentException("listener should not be null"); } if (listenerEntry == null) { throw new IllegalArgumentException("listener entry should not be null"); } removePendingListener(listener); for (ListenerEntry entry : mListeners) { Object ref = entry.getListenerObjectRef().get(); if (ref != null && ref == listener) { Log.w(LOG_TAG, String.format("detected attempt to subscribe event " + "listener multiple times ('%s')", listener)); return; } } mListeners.add(listenerEntry); flushJobEvents(mListenerTag); } public void registerAsync(final Object listener) { mPendingListeners.add(new WeakReference<Object>(listener)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { registerAsyncApi11(listener); return; } newRegisterTask(listener).execute(); } @TargetApi(Build.VERSION_CODES.HONEYCOMB) protected void registerAsyncApi11(final Object listener) { if (sAsyncExecutor == null) { synchronized (this) { if (sAsyncExecutor == null) { sAsyncExecutor = Executors.newSingleThreadExecutor(new ThreadFactory() { @Override public Thread newThread(Runnable r) { return new Thread(r, THREAD_NAME); } }); } } } newRegisterTask(listener).executeOnExecutor(sAsyncExecutor); } private AsyncTask<Void, Void, Void> newRegisterTask(final Object listener) { return new AsyncTask<Void, Void, Void>() { private ListenerEntry mListenerEntry; @Override protected Void doInBackground(Void... params) { if (hasPendingListener(listener)) { mListenerEntry = new ListenerEntry( new WeakReference<Object>(listener), mHierarchyViewer.fetchInvocationHandlers(listener.getClass())); } return null; } @Override protected void onPostExecute(Void aVoid) { if (mListenerEntry != null) { registerImpl(listener, mListenerEntry); } } }; } public void unregister(Object listener) { if (listener == null) return; removePendingListener(listener); Iterator<ListenerEntry> iter = mListeners.iterator(); while (iter.hasNext()) { ListenerEntry entry = iter.next(); Object ref = entry.getListenerObjectRef().get(); if (ref == null) { iter.remove(); continue; } if (ref.equals(listener)) { iter.remove(); return; } } } private void handleJobEvent(JobEvent jobEvent) { final int jobId = jobEvent.getJobId(); if (dispatchJobEvent(jobEvent)) { if (jobEvent.isJobFinished()) { mPendingJobs.remove(jobId); if (mPendingJobs.isEmpty()) { mJobManager.removeJobEventListener(mJobFinishedListener); } } mJobFinishedListener.consumeEvent(jobEvent); } } private boolean dispatchJobEvent(JobEvent jobEvent) { if (mListeners.isEmpty()) { return false; } boolean isDispatched = false; Iterator<ListenerEntry> iter = mListeners.iterator(); while (iter.hasNext()) { ListenerEntry entry = iter.next(); Object listener = entry.getListenerObjectRef().get(); if (listener == null) { iter.remove(); continue; } isDispatched = sendJobEvent(listener, entry.getInvocationHandlers(), jobEvent) || isDispatched; } return isDispatched; } private boolean sendJobEvent(Object listener, List<InvocationHandler> handlers, JobEvent event) { try { for (InvocationHandler handler : handlers) { if (!handler.isFitEvent(listener, event)) { continue; } handler.apply(listener, event); return true; } for (InvocationHandler handler : handlers) { if (!handler.canApply(listener, event)) { continue; } handler.apply(listener, event); return true; } } catch (IllegalAccessException e) { throw new RuntimeException("unable to invoke job result event handler", e); } catch (Exception e) { throw new RuntimeException(String.format( "job result event handler threw an exception '%s'", e.toString()), e); } return false; } private void removePendingListener(Object listener) { if (mPendingListeners.isEmpty()) { return; } final Iterator<WeakReference<Object>> it = mPendingListeners.iterator(); while (it.hasNext()) { final WeakReference<Object> ref = it.next(); final Object object = ref.get(); if (object == null || object == listener) { it.remove(); } } } private boolean hasPendingListener(Object listener) { if (mPendingListeners.isEmpty()) { return false; } final Iterator<WeakReference<Object>> it = mPendingListeners.iterator(); while (it.hasNext()) { final WeakReference<Object> ref = it.next(); final Object object = ref.get(); if (object == listener) { return true; } } return false; } }
true
c63b5baacad02c0a8d1dfba623368982abf568d2
Java
Geczy/SAS2006
/Server/src/server/org/world/map/C.java
UTF-8
922
2.65625
3
[]
no_license
package server.org.world.map; import java.util.ArrayList; import java.util.Iterator; public class C { public C( ArrayList arraylist, int i ) { I = new ArrayList(); I.clear(); Z = i; int j; for( Iterator iterator = arraylist.iterator(); iterator.hasNext(); I.add( Integer.valueOf( j ) ) ) { j = ( ( Integer )iterator.next() ).intValue(); } } @Override public final int hashCode() { int i = 1; i = 31 * i + ( I != null ? I.hashCode(): 0 ); return i; } @Override public final boolean equals( Object obj ) { if( this == obj ) { return true; } if( obj == null ) { return false; } if( getClass() != obj.getClass() ) { return false; } C c = ( C )obj; if( I == null ) { if( c.I != null ) { return false; } } else if( ! I.equals( c.I ) ) { return false; } return true; } @SuppressWarnings( "unchecked" ) public ArrayList I; public int Z; }
true
1ed55c9b95e5c6696905ba1dcb7d7e26f45198ab
Java
Vaskill/Amazing_Car_Race
/Gui.java
UTF-8
2,636
3.15625
3
[]
no_license
package Amazing_Car_Race; //Fred Dolan //its a gui import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Gui extends JFrame{ private Race race; public static int XS; public static int YS; private JButton sb; private JPanel sc; private JPanel game; private JFrame app; private Graphics g; public Gui() { //resolution XS = 800; YS = 600; //creating the race object //int xSize, int ySize, int minSpeed, int maxSpeed, int nStops, int nCars, int nDinos race = new Race(XS,YS,2,8,5,7,2); app = new JFrame(); app.setSize(800,600); sc = new JPanel(); sc.setLayout(new BoxLayout(sc,BoxLayout.PAGE_AXIS)); sb = new JButton("Start Game"); game = new JPanel(); sc.setSize(800,600); sc.setVisible(true); app.setVisible(true); sb.setVisible(true); sb.setAlignmentX(CENTER_ALIGNMENT); ButtonListener bl = new ButtonListener(); sb.addActionListener(bl); game.setSize(XS, YS); game.setVisible(true); app.add(sc); sc.add(sb); app.add(game); } private class ButtonListener implements ActionListener{ @Override public void actionPerformed (ActionEvent event){ if(event.getSource()== sb){ sc.setVisible(false); //sb.setVisible(false); //app.setVisible(false); //game.setVisible(true); startGame(); g.clearRect(0,0,XS,YS); g.setColor(Color.BLACK); race.draw(g); repaint(); } } } public void startGame(){ int ind = 0; while(!race.getOver()){ race.go(); try { //the tick rate Thread.sleep(100); } catch(InterruptedException ex) { Thread.currentThread().interrupt(); System.out.println("Everything's broken cry"); } repaint(); ind++; //System.out.println(ind); } } @Override public void paint(Graphics g) { g.clearRect(0,0,XS,YS); g.setColor(Color.BLACK); race.draw(g); } public static void main(String argv[]) { // StartScreen sc = new StartScreen(); Gui c = new Gui(); } }
true
ae6f23ef6ef69d70b8a900d0c58c59c5776a84e5
Java
z4444a/AIM
/backend/service/src/main/java/ru/relex/aim/service/service/ICommentService.java
UTF-8
598
2.171875
2
[]
no_license
package ru.relex.aim.service.service; import ru.relex.aim.service.model.create.CommentCreateDto; import ru.relex.aim.service.model.get.CommentGetDto; import javax.validation.constraints.NotNull; /** * Approve or reject {@link ru.relex.aim.repository.entity.Comment}. * * @author Sorokin Georgy */ public interface ICommentService { /** * Creates an instance in database with information provided in DTO. * * @param createDto DTO that holds information about entity to save May never be null. * @return saved entity. */ CommentGetDto create(@NotNull CommentCreateDto createDto); }
true
b137c6d2b9223892d0c7d2a50b6eaa8491ccc00c
Java
biprodas/OJ-Solutions
/ProjectEuler/pe097 - Large non-Mersenne prime.java
UTF-8
370
3.046875
3
[]
no_license
import java.util.*; import java.math.BigInteger; class PE_097 { public static void main (String[] args) { BigInteger mod = new BigInteger("10000000000"); BigInteger n = BigInteger.valueOf(2).modPow(BigInteger.valueOf(7830457), mod); n = n.multiply(BigInteger.valueOf(28433)).add(BigInteger.ONE).mod(mod); System.out.println(n); } } /* Answer : 8739992577 */
true
bd3817e11c8a1b6539f4528424f431283cfb49f5
Java
Brielleowl/SE452Project
/LuggageEye/demo/src/main/java/edu/depaul/cdm/se452/demo/passenger/Passenger.java
UTF-8
426
2.125
2
[]
no_license
package edu.depaul.cdm.se452.demo.passenger; import lombok.Data; import javax.persistence.*; import javax.validation.constraints.Size; @Data @Entity @Table(name="PASSENGER") public class Passenger { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private long id; @Size(min = 3, max = 25) private String name; public void selfCheckIn(){ } public void payForLuggage() { } }
true
48046e5d22b66eefac4a18cae2a8bef8c0168715
Java
vfg7/RESERVANDO
/hotelchain/src/main/java/com/project/hotel/chain/repository/ReservationRepository.java
UTF-8
416
1.929688
2
[]
no_license
package com.project.hotel.chain.repository; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.project.hotel.chain.model.*; @Repository public interface ReservationRepository extends JpaRepository<Reservation, Long>{ List <Reservation> findByGuest(Guest guest); List <Reservation> findByHotel (Hotel hotel); }
true
50c3583629fcd6e6d06612126714b7e0647b3e8a
Java
Bisharp/AppliedJava
/DigIt3/src/com/dig/www/npc/TutorialWizard2.java
UTF-8
4,458
2.578125
3
[]
no_license
package com.dig.www.npc; import javax.swing.ImageIcon; import com.dig.www.character.GameCharacter; import com.dig.www.start.Board; import com.dig.www.util.Statics; public class TutorialWizard2 extends AnimatedMoveNPC{ private boolean readyForNext=false; private int nextInt; public TutorialWizard2(int x, int y, Board owner, String location) { super(x, y, "images/characters/wizard/", owner, new String[]{"Hello! Do you require my assistance?"}, NPC.WIZARD, location, new NPCOption[]{ new NPCOption("How do we get to Botanus?", "You need to collect Key Crystals and put them in this Dimensional Key.", new String[]{"How do we get to Botanus?","How do I get to Botanus?","...","How do we get to Botanus?"}, false, new NPCOption[]{new NPCOption("Is that a Key Crystal?", "Yes. There is another one across this pit. Grab it and continue!(KC is for Key Crystals)", new String[]{"Is that a Key Crystal?","Is that thing a Key Crystal?","...","Is that shiny thing a Key Crystal?"}, true, new NPCOption[]{}, owner)}, owner)}, new MovePoint[]{new MovePoint(x+200, y, true),new MovePoint(x+200, y-200, false),new MovePoint(x+500, y-200, false),new MovePoint(x+800, y+500, false),new MovePoint(x+1400, y+950, false),new MovePoint(x+2000, y+900, true),new MovePoint(x+2900, y-300, false),new MovePoint(x+2900, y-500, true)}, 0,6); } public void setCantExit(boolean set){ cantExit=set; } public void next() { readyForNext = false; nextInt++; cantExit = false; hasWaited(); if(nextInt==1){ //options=new NPCOption[]{new NPCOption("How do we get to Botanus?", "You need to collect Key Crystals and put them in this Dimensional Key.", new String[]{"How do we get to Botanus?","How do I get to Botanus?","...","How do we get to Botanus?"}, false, new NPCOption[]{}, owner)}; }else if(nextInt==2){ options = new NPCOption[]{new NPCOption("What do I do?", "Get the special Key Crystal and then continue onward.", new String[]{"What do I do?","What do I do?","...","What do we do?"}, owner)}; }else if(nextInt==3){ options=new NPCOption[]{new NPCOption("That's a weird portal?", "That is a boss portal. You must use the Dimensional Key and Key Crystals to enter it and defeat Botanus.", new String[]{"That is a weird portal.","What's up with that portal.","...","Ooh! That portal looks different. I'm not sure I like it though."},false, new NPCOption[]{new NPCOption("Is that a Key Crystal?", "Yes. That rare Key Crystal is worth five normal ones.", new String[]{"Is that a Key Crystal too?","Is that thing a Key Crystal?","...","Ooh! Is that thing a Key Crystal too?"}, false,new NPCOption[]{new NPCOption("I'm ready.", "Good! I'll give you a spell to make you invincible! Oh no... My wand is out of battery.", new String[]{"OK. I'm ready.","I'm ready to beat up this Botanus.","...","I'm ready!"}, true, owner)}, owner)}, owner)}; } else { options = new NPCOption[0]; } resetCurrentOptions(); } @Override protected String getFarewell() { if(nextInt==3) switch (owner.getCharacter().getType()) { case CLUB: return "Magic... *Right|..."; case DIAMOND: return "..."; case HEART: return "Oh no."; default: return "Um..."; } switch(owner.getCharacter().getType()){ case CLUB: return "I'm done talking to you."; case DIAMOND: return "..."; case HEART: return "Bye!"; default: return "Thanks.";} } @Override protected String getGreeting() { switch(owner.getCharacter().getType()){ case CLUB: return "Hey weird wizard."; case DIAMOND: return "..."; case HEART: return "Hello!"; default: return "Hello again.";} } @Override public void act(NPCOption option) { if(GameCharacter.storyInt==5){ owner.addAction("added","images/DK.png"); GameCharacter.storyInt++; options=new NPCOption[]{new NPCOption("How do we get to Botanus?", "You need to collect Key Crystals and put them in this Dimensional Key.", new String[]{"How do we get to Botanus?","How do I get to Botanus?","...","How do we get to Botanus?"}, false, new NPCOption[]{}, owner)};} cantExit = false; //readyForNext = true; //options = new NPCOption[0]; } @Override public String exitLine() { if(nextInt==3) return "I'm sure you'll do fine without it! Good luck!"; return "Ask me if you need any more help. Good luck!"; } @Override public String getShowName() { return "The Wizard"; } }
true
0ac25971ee330f685c38e7f7596fe4507851939a
Java
gabrielrtakeda/web-comprar-passagens-aereas
/src/main/java/br/com/gabrielrtakeda/controller/CadastroAeronave.java
UTF-8
2,073
2.109375
2
[]
no_license
// package controller; // import java.io.IOException; // import javax.servlet.ServletException; // import javax.servlet.annotation.WebServlet; // import javax.servlet.http.HttpServlet; // import javax.servlet.http.HttpServletRequest; // import javax.servlet.http.HttpServletResponse; // import model.AeronaveModel; // import to.AeronaveTO; // @WebServlet("/cadastro-aeronave") // public class CadastroAeronave extends HttpServlet { // private static final long serialVersionUID = 1L; // /** // * @see HttpServlet#HttpServlet() // */ // public CadastroAeronave() { // super(); // // TODO Auto-generated constructor stub // } // /** // * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) // */ // protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // doPost(request,response); // } // /** // * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) // */ // protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // String codigo = request.getParameter("codigo"); // String nome = request.getParameter("nome"); // int quantidade = Integer.parseInt(request.getParameter("quantidade")); // AeronaveTO to = new AeronaveTO() // .setCodigo(codigo) // .setNome(nome) // .setQuantidadePassageiros(quantidade); // AeronaveAeronaveDAO dao = new AeronaveAeronaveDAO(); // dao.insert(to); // AeronaveModel model = new AeronaveModel(); // model.insert(nome, codigo, quantidade); // //int perfil = (int)request.getSession().getAttribute("PerfilAcesso"); // //aeroto.setPerfil(perfil); // request.getSession().setAttribute("Status", aeroto.getStatus()); // request.setAttribute("status", 1); // response.sendRedirect("aeronave/cadastrar.jsp"); // } // }
true
95b5b9541e4b43f689b46ace36639554a571c36a
Java
tani-smurova/booking
/src/main/java/com/task/booking/service/UserService.java
UTF-8
2,487
2.390625
2
[]
no_license
package com.task.booking.service; import com.task.booking.models.Role; import com.task.booking.models.User; import com.task.booking.repo.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.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; import java.util.Collections; import java.util.List; import java.util.UUID; @Service public class UserService implements UserDetailsService { @Autowired private UserRepository userRepository; @Autowired private MailSender mailSender; @Autowired private PasswordEncoder passwordEncoder; @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { return userRepository.findByUsername(username); } public boolean addUser(User user){ User userFromDb = userRepository.findByUsername(user.getUsername()); if (userFromDb != null){ return false; } user.setActive(false); user.setRoles(Collections.singleton(Role.USER)); user.setActivationCode(UUID.randomUUID().toString()); user.setPassword(passwordEncoder.encode(user.getPassword())); userRepository.save(user); if (!StringUtils.isEmpty(user.getEmail())){ String message = String.format( "Привет, %s! \n" + "Добро пожаловать в сервис бронирования. Для активации аккаунта перейдите по ссылке: http://localhost:8080/activate/%s", user.getUsername(), user.getActivationCode() ); mailSender.send(user.getEmail(), "Activation code", message); } return true; } public boolean activateUser(String code) { User user = userRepository.findByActivationCode(code); if (user == null){ return false; } user.setActivationCode(null); user.setActive(true); userRepository.save(user); return true; } public List<User> findAll() { return userRepository.findAll(); } }
true
31fbf0816d92c5b99a52c825e2795124b8ad57d1
Java
DiegoRiofrio/apaw-ep-Robinson-Ganchala-Diego-Riofrio
/src/main/java/es/upm/miw/apaw_contest/dtos/GuitarPlayerCreationDto.java
UTF-8
2,298
2.734375
3
[ "MIT" ]
permissive
package es.upm.miw.apaw_contest.dtos; import es.upm.miw.apaw_contest.documents.GuitarPlayer; import es.upm.miw.apaw_contest.exceptions.BadRequestException; import javax.validation.constraints.NotNull; public class GuitarPlayerCreationDto { private String id; private String name; private String surname; private Boolean hasOwnGuitar; private Integer phone; public GuitarPlayerCreationDto() { // Empty for framework } public GuitarPlayerCreationDto(String name, String surname, Boolean hasOwnGuitar, Integer phone) { this.name = name; this.surname = surname; this.hasOwnGuitar = hasOwnGuitar; this.phone = phone; } public GuitarPlayerCreationDto(GuitarPlayer guitarPlayer) { this.id = guitarPlayer.getId(); this.name = guitarPlayer.getName(); this.surname = guitarPlayer.getSurname(); this.hasOwnGuitar = guitarPlayer.getHasOwnGuitar(); this.phone = guitarPlayer.getPhone(); } public String getId() { return id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSurname() { return surname; } public void setSurname(String surname) { this.surname = surname; } @NotNull public Boolean getHasOwnGuitar() { return hasOwnGuitar; } public Integer getPhone() { return phone; } public void validate() { if (this.name == null || this.name.isEmpty() || this.surname == null || this.surname.isEmpty() || this.hasOwnGuitar == null || this.phone == null) { throw new BadRequestException("Incomplete GuitarPlayerCreationDto"); } } public void validateSurname() { if (this.surname == null || this.surname.isEmpty()) { throw new BadRequestException("Incomplete, lost Surname"); } } @Override public String toString() { return "GuitarPlayerCreationDto{" + "id='" + id + '\'' + ", name='" + name + '\'' + ", surname='" + surname + '\'' + ", hasOwnGuitar=" + hasOwnGuitar + ", phone=" + phone + '}'; } }
true
5a73ff1c70f05b8af203c336eb2b6ce6e040ff44
Java
Gildor17/Bank_Info
/BankInfo/src/BankInfo/AddLoan.java
UTF-8
2,926
2.765625
3
[]
no_license
package BankInfo; import BankInfo.*; import java.util.ArrayList; /** * Created by Admin on 19.06.2017. */ public class AddLoan { public static Loan lite = new Loan("Легка", 100, 2000, 4, 12, 3, 0.4); public static Loan optimal = new Loan("Оптимальна", 1000, 10000, 6, 24, 2, 0.25); public static Loan extra1 = new Loan("Екстра-1", 2000, 12000, 12, 36, 4, 0.3); public static Loan extra2 = new Loan("Екстра-2", 3000, 25000, 8, 48, 5, 0.2); public static Loan widesize = new Loan("Обширна", 1000, 50000, 6, 36, 7, 0.5); public static ArrayList<Loan> volodia1AvailableLoans = new ArrayList<>(); public static ArrayList<Loan> tatiana1AvailableLoans = new ArrayList<>(); public static ArrayList<Loan> iruna1AvailableLoans = new ArrayList<>(); public static ArrayList<Loan> ivan1AvailableLoans = new ArrayList<>(); public static ArrayList<CurrentLoan> volodia1CurrentLoans = new ArrayList<>(); public static ArrayList<CurrentLoan> tatiana1CurrentLoans = new ArrayList<>(); public static ArrayList<CurrentLoan> iruna1CurrentLoans = new ArrayList<>(); public static ArrayList<CurrentLoan> ivan1CurrentLoans = new ArrayList<>(); public static void addAvailableLoans () { volodia1AvailableLoans.add(lite); volodia1AvailableLoans.add(extra1); volodia1AvailableLoans.add(extra2); tatiana1AvailableLoans.add(lite); tatiana1AvailableLoans.add(optimal); tatiana1AvailableLoans.add(extra1); iruna1AvailableLoans.add(lite); iruna1AvailableLoans.add(optimal); iruna1AvailableLoans.add(extra1); iruna1AvailableLoans.add(extra2); iruna1AvailableLoans.add(widesize); ivan1AvailableLoans.add(extra2); ivan1AvailableLoans.add(widesize); } public static CurrentLoan volodiaCurrentLoan1 = new CurrentLoan ("volodia1", 7200, 6, 17, 1200, 1.5); public static CurrentLoan tatianaCurrentLoan1 = new CurrentLoan ("tatiana1", 5000, 5, 25, 1000, 1); public static CurrentLoan tatianaCurrentLoan2 = new CurrentLoan ("tatiana2", 800, 2, 8, 400, 2); public static CurrentLoan irunaCurrentLoan1 = new CurrentLoan ("iruna1", 4800, 3, 18, 1600, 0.7); public static CurrentLoan ivanCurrentLoan1 = new CurrentLoan ("ivan1", 1500, 3, 12, 500, 1); public static CurrentLoan ivanCurrentLoan2 = new CurrentLoan ("ivan2", 8000, 4, 17, 2000, 1.2); public static void addCurrentLoans () { volodia1CurrentLoans.add(volodiaCurrentLoan1); tatiana1CurrentLoans.add(tatianaCurrentLoan1); tatiana1CurrentLoans.add(tatianaCurrentLoan2); iruna1CurrentLoans.add(irunaCurrentLoan1); ivan1CurrentLoans.add(ivanCurrentLoan1); ivan1CurrentLoans.add(ivanCurrentLoan2); } }
true
eb8b37316c7122d71dc4355ca28a5a3a423db8d1
Java
xiong-ming/first-java-study
/se/extend/src/抽象方法抽象类的注意事项/Demo1/Animal.java
UTF-8
172
2.734375
3
[]
no_license
package 抽象方法抽象类的注意事项.Demo1; //最高抽象父类 public abstract class Animal { public abstract void sleep(); public abstract void eat(); }
true
3df7d9e6b404fbc5095558f6284e03b0e14ff1e8
Java
claudiomenghi/TACK
/checker/src/main/java/tack/TackFisherScalability.java
UTF-8
3,998
1.976563
2
[]
no_license
package tack; import java.io.FileInputStream; import java.io.PrintStream; import java.nio.file.Files; import java.nio.file.Paths; import org.antlr.v4.runtime.ANTLRFileStream; import org.antlr.v4.runtime.ANTLRInputStream; import org.antlr.v4.runtime.CommonTokenStream; import com.google.common.base.Preconditions; import formulae.cltloc.CLTLocFormula; import formulae.cltloc.atoms.Constant; import formulae.cltloc.atoms.Variable; import formulae.cltloc.operators.unary.CLTLocGlobally; import formulae.cltloc.relations.CLTLocRelation; import formulae.cltloc.relations.Relation; import formulae.mitli.MITLIFormula; import formulae.mitli.parser.MITLILexer; import formulae.mitli.parser.MITLIParser; import ta.SystemDecl; import ta.parser.TALexer; import ta.parser.TAParser; import ta.visitors.TANetwork2CLTLocRC; import tack.checker.SystemChecker; public class TackFisherScalability { public static void main(String[] args) throws Exception { PrintStream out = System.out; /*PrintStream out = new PrintStream(ByteStreams.nullOutputStream()); */ out.println("------------------------------------------------------------------------------------------------------------------------------------------------------------"); out.println("TACK - Timed Automata ChecKer"); out.println("v. 0.0.1 - 18/06/2017\n"); out.println("------------------------------------------------------------------------------------------------------------------------------------------------------------"); Preconditions.checkArgument(args.length >= 3, "you must specify the file that contains the MITLI formula and the bound to be used"); String modelFile = args[0]; String propertyFile = args[1]; String bound=args[2]; int exampleNumber=Integer.parseInt(args[3]); Preconditions.checkArgument(Files.exists(Paths.get(modelFile)), "The file: " + modelFile + " containing the model does not exist"); Preconditions.checkArgument(Files.exists(Paths.get(propertyFile)), "The file: " + propertyFile + " containing the property does not exist"); out.println("Loading the property: "+propertyFile); // loading the property ANTLRInputStream input = new ANTLRInputStream(new FileInputStream(propertyFile)); MITLILexer lexer = new MITLILexer(input); CommonTokenStream tokens = new CommonTokenStream(lexer); MITLIParser parser = new MITLIParser(tokens); parser.setBuildParseTree(true); MITLIFormula formula = parser.mitli().formula; out.println("Property loaded"+modelFile); // loading the model out.println("Loading the model"); ANTLRInputStream tainput = new ANTLRFileStream(modelFile); TALexer talexer = new TALexer(tainput); CommonTokenStream tatokens = new CommonTokenStream(talexer); TAParser taparser = new TAParser(tatokens); taparser.setBuildParseTree(true); SystemDecl system = taparser.ta().systemret; out.println("Model loaded"); SystemChecker checker = new SystemChecker(system, formula, Integer.parseInt(bound), new TANetwork2CLTLocRC(), System.out); CLTLocFormula f=CLTLocFormula.FALSE; for(int i=1; i<=exampleNumber; i++){ f=CLTLocFormula.getOr(f, new CLTLocRelation(new Variable("id"), new Constant(i), Relation.EQ)); } boolean result = checker.check(CLTLocGlobally.create(f)); out.println(); out.println(); out.println("------------------------------------------------------------------------------------------------------------------------------------------------------------"); out.println("The property of interest is : "+((result) ? "satisfied" : "not satisfied")); out.println(((result) ? "" : "check the file output.hist.smt.txt to see the violating trace")); out.println(((result) ? "" : "the mapping between the elements of the model and the used id can be found in the file elementsIDmap.txt")); out.println("------------------------------------------------------------------------------------------------------------------------------------------------------------"); } }
true
7f24925dee4e5dfc92b7e7ff81f9c2a98ce4b554
Java
TakahiroKinebuchi/JavaBasic
/Practice/src/practice10/PTra10_06.java
UTF-8
2,036
3.796875
4
[]
no_license
package practice10; /* * PTra10_06.java * 作成 LIKEIT 2017 *------------------------------------------------------------ * Copyright(c) Rhizome Inc. All Rights Reserved. */ import java.util.Scanner; public class PTra10_06 { /* * PTra10_05で作成したCarクラスを使用します */ public static void main(String[] args) { /* * carインスタンスを3件作成し、それぞれの色、ガソリンを入力して決定してください * 各carインスタンスのrunメソッドを実行して、それぞれ「目的地にまでn時間かかりました。残りのガソリンは、xリットルです」を出力してください。 */ //車の製造 Scanner scanner = new Scanner(System.in); Car[] car = new Car[3]; for(int i = 0;i < car.length;i++) { System.out.println("----------------------------------------------------------------------"); System.out.println((i+1) + "台目"); car[i] = new Car(); System.out.println("シリアルナンバー(5桁の数字)、車体カラー、ガソリン量(2桁の数字)をカンマ区切りで入力して下さい。"); String line = scanner.nextLine(); String[] inputInfo = line.split(",",0); car[i].serialNo = Integer.parseInt(inputInfo[0]); car[i].color = inputInfo[1]; car[i].gasoline = Integer.parseInt(inputInfo[2]); } //それぞれの車を走らせる int distance = 300; int[] count = new int[car.length]; for(int i = 0;i < car.length;i++) { int move = 0; while(distance - move > 0) { int ret = car[i].run(); if(ret == -1) { count[i] = -1; break; } move += ret; count[i]++; } } //出力 for(int i = 0;i < count.length;i++) { if(count[i] == -1) { System.out.println("目的地に到達できませんでした。"); }else { System.out.println((i+1) + "台目は目的地にまで" + count[i] + "時間かかりました。残りのガソリンは、" + car[i].gasoline + "リットルです。"); } } } }
true
acf509f49c0a1ba8ae46d0a8d4256c86536711cc
Java
syfxlin/code
/100-days-of-code/java/src/main/java/me/ixk/days/day7/AsyncResult.java
UTF-8
1,683
2.9375
3
[ "MIT" ]
permissive
/* * Copyright (c) 2020, Otstar Lin (syfxlin@gmail.com). All Rights Reserved. */ package me.ixk.days.day7; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; /** * 异步调用返回值 * * @author Otstar Lin * @date 2020/11/26 上午 11:21 */ public class AsyncResult<V> implements Future<V> { private final V value; private final Throwable exception; public AsyncResult(V value) { this(value, null); } public AsyncResult(V value, Throwable exception) { this.value = value; this.exception = exception; } public static <V> AsyncResult<V> of(V value) { return new AsyncResult<>(value); } public static <V> AsyncResult<V> of(Throwable exception) { return new AsyncResult<>(null, exception); } @Override public boolean cancel(boolean mayInterruptIfRunning) { return false; } @Override public boolean isCancelled() { return false; } @Override public boolean isDone() { return true; } @Override public V get() throws InterruptedException, ExecutionException { if (this.exception != null) { throw ( this.exception instanceof ExecutionException ? (ExecutionException) this.exception : new ExecutionException(this.exception) ); } return this.value; } @Override public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { return get(); } }
true
164fbc824beca1c48faee4f6d8ded731e5249706
Java
Rwuyao/ssm_graduateProject
/src/main/java/com/fs/mapper/UserMapper.java
UTF-8
1,540
1.992188
2
[]
no_license
package com.fs.mapper; import java.util.List; import org.apache.ibatis.annotations.Param; import org.apache.shiro.crypto.hash.Md5Hash; import com.fs.model.Customer; import com.fs.model.Order; import com.fs.model.User; public interface UserMapper { int deleteByPrimaryKey(Integer userId); int insert(User record); int insertSelective(User record); User selectByPrimaryKey(Integer userId); int updateByPrimaryKeySelective(User record); int updateByPrimaryKey(User record); User getUserByUserName(String username); List<String> searchRole(String userName); /************************************/ //显示员工列表 List<User> queryAllUser(); //新增员工信息 int addEmployee(@Param("userId")int userId, @Param("username")String username, @Param("md5")String md5, @Param("name")String name, @Param("depId")Integer depId, @Param("email")String email, @Param("tel")String tel, @Param("address")String address); //动用数据库,删除对应id 的员工 int deleteEmployeeById(@Param("userId")int userId); //修改员工信息 int updateEmployee(@Param("updateuserId")int updateuserId, @Param("updateusername")String updateusername, @Param("updatename")String updatename, @Param("updatedepId")int updatedepId, @Param("updatetelephone")String updatetelephone,@Param("updateemail") String updateemail, @Param("updateadress")String updateadress); //查询员工信息 List<User> queryEmployee(String keyword); //自动搜索提示 List<String> queryName(); }
true
c522999be193be81564a6f158a65448c1657da79
Java
DarkSoul-SP/souls-net
/src/main/java/ua/darksoul/testprojects/soulsnet/domain/Message.java
UTF-8
1,302
2.0625
2
[ "Apache-2.0" ]
permissive
package ua.darksoul.testprojects.soulsnet.domain; import com.fasterxml.jackson.annotation.*; import lombok.*; import javax.persistence.*; import java.time.LocalDateTime; import java.util.Set; @Entity @Table @Data @NoArgsConstructor @EqualsAndHashCode(of = "id") @JsonIdentityInfo( property = "id", generator = ObjectIdGenerators.PropertyGenerator.class ) public class Message { @Id @GeneratedValue(strategy = GenerationType.AUTO) @JsonView(Views.Id.class) private Long id; @JsonView(Views.IdName.class) @NonNull private String text; @Column(updatable = false) @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") @JsonView(Views.FullMessage.class) private LocalDateTime creationDate; @ManyToOne @JoinColumn(name = "user_id") @JsonView(Views.FullMessage.class) private User author; @OneToMany(mappedBy = "message", orphanRemoval = true) @JsonView(Views.FullMessage.class) private Set<Comment> comments; @JsonView(Views.FullMessage.class) private String link; @JsonView(Views.FullMessage.class) private String linkTitle; @JsonView(Views.FullMessage.class) private String linkDescription; @JsonView(Views.FullMessage.class) private String linkCover; }
true
301f588eee12cf0043ab4bfef9a8578ae64beeff
Java
serkangurbuz/dal
/dal/src/com/Argeloji/DataMapper/VeliHibernateDataMapper.java
UTF-8
1,935
2.484375
2
[]
no_license
package com.Argeloji.DataMapper; import java.util.ArrayList; import java.util.List; import com.Argeloji.Api.VeliDataMapper; import com.Argeloji.Domain.Kullanici; import com.Argeloji.Domain.Veli; import com.Argeloji.Service.Dao; public class VeliHibernateDataMapper implements VeliDataMapper{ private final Dao dao; public VeliHibernateDataMapper(Dao dao) { this.dao = dao; } public void save(Veli veli) throws Exception { try { dao.begin(); dao.getSession().saveOrUpdate(veli); dao.commit(); dao.close(); } catch (Exception e) { dao.rollback(); throw new Exception("...HATA: Veli nesnesini veritabanına ekleyemedi..." +veli.getKullaniciKod(), e); // TODO: handle exception } } public void deleteVeli(Veli veli){ dao.begin(); dao.getSession().delete(veli); dao.commit(); dao.close(); } public ArrayList<Veli> getListOfVeli(){ ArrayList<Veli> veliler=null; dao.begin(); veliler = (ArrayList) dao.getSession().createQuery("FROM Veli").list(); dao.commit(); dao.close(); return veliler; } public Veli getVeliByKod(int kod){ dao.begin(); Veli veli=(Veli) dao.getSession().get(Veli.class, kod); dao.commit(); dao.close(); return veli; } public List<Veli> getVeliByKullanici(Kullanici kullanici){ dao.begin(); List list= dao.getSession().createQuery("FROM Veli where kullaniciKod=:kullanici_kod") .setParameter("kullanici_kod",kullanici.getKod()).list(); dao.commit(); dao.close(); return list; } public void updateVeli(Veli veli) throws Exception{ try { dao.begin(); dao.getSession().update(veli); dao.commit(); dao.close(); } catch (Exception e) { dao.rollback(); throw new Exception("...HATA: Veli nesnesini veritabaninda Güncellenemedi..."); // TODO: handle exception } } }
true
23d6493ecfff94b6672ed4d85ea871dfd5e83496
Java
dee342/ops-board-app
/src/main/java/gov/nyc/dsny/smart/opsboard/services/AdminService.java
UTF-8
14,652
1.507813
2
[]
no_license
package gov.nyc.dsny.smart.opsboard.services; import static net.logstash.logback.marker.Markers.appendEntries; import gov.nyc.dsny.smart.opsboard.OpsBoardError; import gov.nyc.dsny.smart.opsboard.cache.equipment.DownCodeCache; import gov.nyc.dsny.smart.opsboard.cache.equipment.MaterialTypeCache; import gov.nyc.dsny.smart.opsboard.cache.equipment.SubTypeCache; import gov.nyc.dsny.smart.opsboard.cache.factories.BoardKeyFactory; import gov.nyc.dsny.smart.opsboard.cache.gf.BoardEquipmentCacheService; import gov.nyc.dsny.smart.opsboard.cache.gf.BoardPersonnelCacheService; import gov.nyc.dsny.smart.opsboard.cache.gf.EquipmentCacheService; import gov.nyc.dsny.smart.opsboard.cache.gf.PersonnelCacheService; import gov.nyc.dsny.smart.opsboard.cache.gf.board.BoardCacheService; import gov.nyc.dsny.smart.opsboard.cache.gf.reference.BoardQuotaCache; import gov.nyc.dsny.smart.opsboard.cache.gf.reference.BoardTypeCache; import gov.nyc.dsny.smart.opsboard.cache.gf.reference.LocationCache; import gov.nyc.dsny.smart.opsboard.cache.gf.reference.QuotaCache; import gov.nyc.dsny.smart.opsboard.cache.gf.reference.SubcategoryCache; import gov.nyc.dsny.smart.opsboard.cache.gf.service.CategoryCacheService; import gov.nyc.dsny.smart.opsboard.cache.gf.service.MdaTypeCacheService; import gov.nyc.dsny.smart.opsboard.cache.gf.service.OfficerPositionTypeCacheService; import gov.nyc.dsny.smart.opsboard.cache.gf.service.SeriesCacheService; import gov.nyc.dsny.smart.opsboard.cache.gf.service.ShiftCacheService; import gov.nyc.dsny.smart.opsboard.cache.gf.service.SpecialPositionTypeCacheService; import gov.nyc.dsny.smart.opsboard.cache.gf.service.UnavailabilityTypeCacheService; import gov.nyc.dsny.smart.opsboard.commands.admin.CommandEnterMaintenance; import gov.nyc.dsny.smart.opsboard.commands.admin.CommandExitMaintenance; import gov.nyc.dsny.smart.opsboard.commands.admin.CommandRefreshCaches; import gov.nyc.dsny.smart.opsboard.domain.ApplicationSettings; import gov.nyc.dsny.smart.opsboard.domain.board.BoardKey; import gov.nyc.dsny.smart.opsboard.misc.AdminCommandMessage; import gov.nyc.dsny.smart.opsboard.misc.ConsumerSimpleMessageListenerContainer; import gov.nyc.dsny.smart.opsboard.persistence.repos.ApplicationSettingsRepository; import gov.nyc.dsny.smart.opsboard.utils.LocationUtils; import gov.nyc.dsny.smart.opsboard.utils.LogContext; import java.util.LinkedHashMap; import javax.annotation.PostConstruct; import net.logstash.logback.encoder.org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.amqp.core.AmqpAdmin; import org.springframework.amqp.core.Binding; import org.springframework.amqp.core.Binding.DestinationType; import org.springframework.amqp.core.Queue; import org.springframework.amqp.rabbit.connection.ConnectionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.web.context.WebApplicationContext; import com.fasterxml.jackson.databind.ObjectMapper; /** * A service that listens for multi-board commands that act on locations that the server handles and then processes * them. * * When an Operations Board is loaded for the first time, the Location Service binds itself to a new AMQP queue on * RabbitMQ server for the board location. Any multi-board commands that are sent to the location are picked up by the * Location Service and processed for each live board in the server's cache that matches this location. * * Processing entails executing the command against the board in the server cache and if successful, then sending a new * board command off to all of the board's clients. */ public class AdminService{ private static final Logger log = LoggerFactory.getLogger(AdminService.class); @Autowired private AmqpAdmin amqpAdmin; /** * Caches */ @Autowired private BoardCacheService boardsCache; @Autowired private EquipmentCacheService equipmentCache; @Autowired private PersonnelCacheService personnelCache; @Autowired private BoardPersonnelCacheService boardPersonnelCache; @Autowired private BoardEquipmentCacheService boardEquipmentCache; @Autowired private LocationCache locationCache; @Autowired private BoardTypeCache boardTypeCache; @Autowired private DownCodeCache downCodeCache; @Autowired private MaterialTypeCache materialTypeCache; @Autowired private CategoryCacheService categoryCacheService; @Autowired private MdaTypeCacheService mdaTypeCacheService; @Autowired private SpecialPositionTypeCacheService specialPositionTypeCacheService; @Autowired private OfficerPositionTypeCacheService officerPositionTypeCacheService; @Autowired private UnavailabilityTypeCacheService unavailabilityTypeCacheService; @Autowired private QuotaCache quotaCache; @Autowired private BoardQuotaCache boardQuotaCache; @Autowired private ShiftCacheService shiftCacheService; @Autowired private SubcategoryCache subcategoryCache; @Autowired private SubTypeCache subTypeCache; @Autowired private SeriesCacheService seriesCacheService; @Autowired private ConnectionFactory connectionFactory; @Autowired private WebApplicationContext appContext; @Autowired private ApplicationSettingsRepository appSettingRepository; @Qualifier("adminListenerContainer") @Autowired private ConsumerSimpleMessageListenerContainer listener; @Autowired private LogContext logContext; @Autowired private BoardKeyFactory boardKeyFactory; @Qualifier("adminQueue") @Autowired private Queue adminQueue; @Qualifier("broadCastQueue") @Autowired private Queue broadCastQueue; public static String getBroaddCastQueueName(){ return "broadcast." + LocationUtils.GetAppServerName(); } public static String getQueueName(){ return "admin-messages." + LocationUtils.GetAppServerName(); } public void createMessageBroadCastConsumer(){ if(listener==null){ log.error("listener is null"); return; } Binding b = new Binding(getBroaddCastQueueName(), DestinationType.QUEUE, "amq.topic", "broadcast", null); amqpAdmin.deleteQueue(getBroaddCastQueueName()); amqpAdmin.declareQueue(broadCastQueue); amqpAdmin.declareBinding(b); try { listener.startConsumer(); log.info(appendEntries(logContext), "************************************createMessageConsumerOnAdmin - RabbitMQ listener '{}' has been created.", getQueueName()); } catch (Exception e) { log.error(appendEntries(logContext), "createMessageConsumerOnAdmin - RabbitMQ listener '{}' can't be created.", e); } } /** * Creates a new location queue on the Rabbit MQ Server and binds itself to it in order to listen for commands. * * @param location * board location to listen for commands */ @PostConstruct public void createMessageConsumerOnLocation() { createMessageBroadCastConsumer(); if(listener==null){ log.error("admin listener is null"); return; } Binding b = new Binding(getQueueName(), DestinationType.QUEUE, "amq.topic", "admin.messages", null); amqpAdmin.deleteQueue(getQueueName()); amqpAdmin.declareQueue(adminQueue); amqpAdmin.declareBinding(b); try { listener.startConsumer(); log.info(appendEntries(logContext), "************************************createMessageConsumerOnAdmin - RabbitMQ listener '{}' has been created.", getQueueName()); } catch (Exception e) { log.error(appendEntries(logContext), "createMessageConsumerOnAdmin - RabbitMQ listener '{}' can't be created.", e); } } public void deleteListener() { if (listener != null) { try { listener.stop(); listener.destroy(); } catch (Exception e) { log.error(appendEntries(logContext), "deleteListener, stopping listener caused an error (" + e.getMessage() + ").", e); } } amqpAdmin.deleteQueue("admin-messages"); } /** * @return the map of all location listeners. */ public ConsumerSimpleMessageListenerContainer getListener() { return listener; } /** * Receives a command from the server that is destined for a specific location this service handles and process is * accordingly. * * Processing entails converting the message into the specific multi-board command and executing the command against * all live boards in the server meet the command's matching algorithm. If successful executed on a board, the * server then constructs an equivalent board command and sends it off to all of the board's active clients. * * @param message * location command message */ public void receiveMessage(byte[] message) { ObjectMapper mapper = new ObjectMapper(); try { AdminCommandMessage commandMessage = mapper.readValue(message, AdminCommandMessage.class); logContext.enrichLogContext(commandMessage); log.info(appendEntries(logContext), "receiveMessage - Received command: {}.", commandMessage); if(StringUtils.equalsIgnoreCase(CommandRefreshCaches.COMMAND_REFRESH_CACHES, commandMessage.getCommandName())) { LinkedHashMap<String, Object> content = (LinkedHashMap<String, Object>) commandMessage.getCommandContent(); String cacheName = (String) content.get(CommandRefreshCaches.CACHE_NAME_KEY); processCacheRefreshCommand(cacheName); } else if(StringUtils.equalsIgnoreCase(CommandEnterMaintenance.COMMAND_NAME, commandMessage.getCommandName())){ processAppModeChangeCommand(commandMessage); } } catch (Exception e) { log.error(appendEntries(logContext), "receiveMessage error: {}.", e.getMessage(), e); } } private void processAppModeChangeCommand(AdminCommandMessage commandMessage) throws OpsBoardError, InterruptedException{ if(commandMessage.getKey().equalsIgnoreCase(CommandEnterMaintenance.COMMAND_KEY)){ appContext.getServletContext().setAttribute(ApplicationSettings.APPLICATION_MODE, ApplicationSettings.APPLICATION_MODE_MAINTENANCE); clearAndStoreActiveBoards(); } else if(commandMessage.getKey().equalsIgnoreCase(CommandExitMaintenance.COMMAND_KEY)){ restorePreviouseActiveBoards(); appContext.getServletContext().setAttribute(ApplicationSettings.APPLICATION_MODE, ApplicationSettings.APPLICATION_MODE_NORMAL); } } private void processCacheRefreshCommand(String cacheName) throws OpsBoardError { if(CommandRefreshCaches.BOARD_CACHES.equals(cacheName)) { personnelCache.clear(); boardPersonnelCache.clear(); equipmentCache.clear(); boardEquipmentCache.clear(); boardsCache.refresh(); } else { refreshReferenceDataCache(cacheName); } } private void restorePreviouseActiveBoards() throws OpsBoardError{ ApplicationSettings appModeSetting = appSettingRepository.findByName(LocationUtils.GetAppServerName() + ApplicationSettings.SUFFIX_ACTIVE_BOARD_IDS); if ( appModeSetting != null && appModeSetting.getValue() != null) { for(String boardID : appModeSetting.getValue().split(",")){ String[] boardIDArray = boardID.split("_"); if(boardIDArray.length ==2){ try { BoardKey key = boardKeyFactory.createBoardKey(boardIDArray[1], boardIDArray[0]); boardsCache.get(key); log.info("Board {}-{} was loaded into cache while exitting maintenance mode", boardIDArray[1], boardIDArray[0]); } catch (Exception e) { log.warn("Couldn't load board {}-{} into cache while exitting maintenance mode", e, boardIDArray[1], boardIDArray[0]); } } } } else { log.info("No boards were loaded onto cache on {} server while exitting maintenance mode", LocationUtils.GetAppServerName()); } } private void clearAndStoreActiveBoards() throws OpsBoardError{ StringBuilder sb = new StringBuilder(); boardsCache.getBoardsMap().keySet().stream().forEach(b -> sb.append(",").append(b)); ApplicationSettings appModeSetting = appSettingRepository.findByName(LocationUtils.GetAppServerName() + ApplicationSettings.SUFFIX_ACTIVE_BOARD_IDS); if(appModeSetting == null){ appModeSetting = new ApplicationSettings(); appModeSetting.setName(LocationUtils.GetAppServerName() + ApplicationSettings.SUFFIX_ACTIVE_BOARD_IDS); } appModeSetting.setValue(sb.toString()); appSettingRepository.save(appModeSetting); personnelCache.clear(); boardPersonnelCache.clear(); equipmentCache.clear(); boardEquipmentCache.clear(); boardsCache.clear(); refreshReferenceDataCache(CommandRefreshCaches.ALL_CACHES); } private void refreshReferenceDataCache(String cacheName) throws OpsBoardError { if(CommandRefreshCaches.BOARD_TYPE_CACHE.equals(cacheName) || CommandRefreshCaches.ALL_CACHES.equals(cacheName)) boardTypeCache.refresh(); if(CommandRefreshCaches.LOCATION_CACHE.equals(cacheName) || CommandRefreshCaches.ALL_CACHES.equals(cacheName)) locationCache.refresh(); if(CommandRefreshCaches.DOWN_CODE_CACHE.equals(cacheName) || CommandRefreshCaches.ALL_CACHES.equals(cacheName)) downCodeCache.refresh(); if(CommandRefreshCaches.MATERIAL_TYPE_CACHE.equals(cacheName) || CommandRefreshCaches.ALL_CACHES.equals(cacheName)) materialTypeCache.refresh(); if(CommandRefreshCaches.CATEGORY_CACHE.equals(cacheName) || CommandRefreshCaches.ALL_CACHES.equals(cacheName)) categoryCacheService.refresh(); if(CommandRefreshCaches.MDA_CACHE.equals(cacheName) || CommandRefreshCaches.ALL_CACHES.equals(cacheName)) mdaTypeCacheService.refresh(); if(CommandRefreshCaches.QUOTA_CACHE.equals(cacheName) || CommandRefreshCaches.ALL_CACHES.equals(cacheName)){ quotaCache.refresh(); boardQuotaCache.refresh(); } if(CommandRefreshCaches.SHIFT_CACHE.equals(cacheName) || CommandRefreshCaches.ALL_CACHES.equals(cacheName)) shiftCacheService.refresh(); if(CommandRefreshCaches.SUBCATEGORY_CACHE.equals(cacheName) || CommandRefreshCaches.ALL_CACHES.equals(cacheName)) subcategoryCache.refresh(); if(CommandRefreshCaches.SUB_TYPE_CACHE.equals(cacheName) || CommandRefreshCaches.ALL_CACHES.equals(cacheName)) subTypeCache.refresh(); if(CommandRefreshCaches.SERIES_CACHE.equals(cacheName) || CommandRefreshCaches.ALL_CACHES.equals(cacheName)) seriesCacheService.refresh(); if(CommandRefreshCaches.SPECIAL_POSITION_CACHE.equals(cacheName) || CommandRefreshCaches.ALL_CACHES.equals(cacheName)) specialPositionTypeCacheService.refresh(); if(CommandRefreshCaches.OFFICER_POSITION_CACHE.equals(cacheName) || CommandRefreshCaches.ALL_CACHES.equals(cacheName)) officerPositionTypeCacheService.refresh(); if(CommandRefreshCaches.UNAVAILABILITY_TYPE_CACHE.equals(cacheName) || CommandRefreshCaches.ALL_CACHES.equals(cacheName)) unavailabilityTypeCacheService.refresh(); } }
true
0434f0f93f71fc5e60676236d3ddd99f9f3bcaa0
Java
AmeerJ97/Autonomous-Search-and-Recover-Robot
/ringhandling/RingRetrieval.java
UTF-8
9,000
2.59375
3
[]
no_license
package ringHandling; import ca.mcgill.ecse211.project.DesignProjectMain; import lejos.hardware.Sound; import lejos.hardware.ev3.LocalEV3; import lejos.hardware.motor.EV3LargeRegulatedMotor; import lejos.hardware.port.Port; import lejos.hardware.sensor.EV3ColorSensor; import lejos.robotics.SampleProvider; import odometer.Odometer; /** * "RingRetrieval" class is responsible of retrieving the a ring from the tree, identifying the color of that ring * and unloading the retrieved ring * * @author Maxime Cardinal * @dateCreated Thursday 8th November 2018 * @version 1.5 * @editHistory Maxime Cardinal - Creation of the class and reachRingSet() and ringGrab() methods (08/11/2018) (1.0) * Maxime Cardinal - Addition of the color identification (10/11/2018) (1.1) * Maxime Cardinal - Improvment of JavaDoc and comments (11/11/2018) (1.2) * Maxime Cardinal - Modification of the ring retrieval speed (13/11/2018) (1.3) * Maxime cardinal - Modification of the class architecture (thread -> class) (19/11/2018) (1.4) * Maxime Cardinal - Addition of the ringUnloading() method (19/11/2018) (1.5) * */ public class RingRetrieval{ //Odometer and motors declaration private static Odometer odometer; //motors static EV3LargeRegulatedMotor leftMotor; static EV3LargeRegulatedMotor rightMotor; static EV3LargeRegulatedMotor leftClawMotor; static EV3LargeRegulatedMotor rightClawMotor; //Initiate variables and constants private static final double WHEEL_RAD = DesignProjectMain.WHEEL_RAD; private static final double retrievalDistance = 15.5; private static final int clawControl = 90; private static final int ROTATE_SPEED = 100; //initiate all mean values (normalized) static double blueRingRedMean = 0.2139; static double blueRingGreenMean = 0.6483; static double blueRingBlueMean = 0.7307; static double greenRingRedMean = 0.4814; static double greenRingGreenMean = 0.8662; static double greenRingBlueMean = 0.1340; static double yellowRingRedMean = 0.8624; static double yellowRingGreenMean = 0.4922; static double yellowRingBlueMean = 0.1176; static double orangeRingRedMean = 0.9626; static double orangeRingGreenMean = 0.2564; static double orangeRingBlueMean = 0.0879; //initiate samples static double redSample = 0.0; static double greenSample = 0.0; static double blueSample = 0.0; //initiate normalized samples static double normalizedRedSample; static double normalizedGreenSample; static double normalizedBlueSample; //initiate colors detection static double blueRingDetector; static double greenRingDetector; static double yellowRingDetector; static double orangeRingDetector; static double detectionRange = 0.15; //initiate the sensor used for color identification private static Port lsPort = LocalEV3.get().getPort("S3"); private static EV3ColorSensor lightSensor; //Constructor of the class public RingRetrieval(Odometer odo, EV3LargeRegulatedMotor leftClawMotor1, EV3LargeRegulatedMotor rightClawMotor1) { odometer = odo; leftMotor = odometer.leftMotor; rightMotor = odometer.rightMotor; leftClawMotor = leftClawMotor1; rightClawMotor = rightClawMotor1; } /** * This method opens the robot's claws and * moves the robot forward up to the ring tree */ public static void reachRingSet() { //open the arms of the robot leftClawMotor.rotate(-clawControl,true); rightClawMotor.rotate(-clawControl,false); setSpeed(ROTATE_SPEED); //move forward to the retrievement position leftMotor.rotate(convertDistance(WHEEL_RAD, retrievalDistance), true); rightMotor.rotate(convertDistance(WHEEL_RAD, retrievalDistance), false); } /** * This method converts a distance to the total rotation that each * wheel needs to perform * * @param radius: Wheel radius * @param distance: Distance to travel * @return: integer */ private static int convertDistance(double radius, double distance) { return (int) ((180.0 * distance) / (Math.PI * radius)); } /** * This method controls the claws to grab a ring */ public static void ringGrab() { sleep(100); setClawSpeed(ROTATE_SPEED); //close the arms of the robot leftClawMotor.rotate(clawControl,true); rightClawMotor.rotate(clawControl,false); setSpeed(100); //move backward to its initial position leftMotor.rotate(-convertDistance(WHEEL_RAD, retrievalDistance), true); rightMotor.rotate(-convertDistance(WHEEL_RAD, retrievalDistance), false); } /** * this method is responsible for unloading the retrieved ring * at the origin */ public static void ringUnloading() { sleep(100); leftClawMotor.rotate(-clawControl,true); rightClawMotor.rotate(-clawControl,false); sleep(100); leftMotor.rotate(convertDistance(WHEEL_RAD,-3),true); rightMotor.rotate(convertDistance(WHEEL_RAD,-3),false); } /** * This method changes the rotation speed of the wheels' motors * * @param wheelSpeed: Rotation speed of the wheels */ private static void setClawSpeed(int wheelSpeed) { stopMotors(); leftMotor.setAcceleration(1000); rightMotor.setAcceleration(1000); leftClawMotor.setSpeed(wheelSpeed); rightClawMotor.setSpeed(wheelSpeed); sleep(100); } /** * This method changes the rotation speed of the wheels' motors * * @param wheelSpeed: Speed of rotation of the wheels */ private static void setSpeed(int wheelSpeed) { stopMotors(); leftMotor.setAcceleration(1000); rightMotor.setAcceleration(1000); leftMotor.setSpeed(wheelSpeed); rightMotor.setSpeed(wheelSpeed); sleep(100); } /** * This method is responsible for identifying the color * of the ring retrieved */ public static void colorIdentification() { //initiate light sensor for detection lightSensor = new EV3ColorSensor(lsPort); lightSensor.setCurrentMode("RGB"); SampleProvider colorSensor = lightSensor.getRGBMode(); float[] rgb=new float[colorSensor.sampleSize()]; boolean keepGoing = true; int counter = 0; //if there is no ring detected, it will be used to break the while and move on to the next tasks while(keepGoing && counter<10) { colorSensor.fetchSample(rgb, 0); //get samplpe from sensor redSample = rgb[0]; greenSample = rgb[1]; blueSample = rgb[2]; //denominator calculation of the normalization double normalizationDivider = Math.sqrt(redSample*redSample+greenSample*greenSample+blueSample*blueSample); //normalize the samples normalizedRedSample = redSample / normalizationDivider; normalizedGreenSample = greenSample / normalizationDivider; normalizedBlueSample = blueSample / normalizationDivider; blueRingDetector = Math.sqrt(Math.pow((normalizedRedSample-blueRingRedMean), 2) +Math.pow((normalizedGreenSample-blueRingGreenMean), 2) +Math.pow((normalizedBlueSample-blueRingBlueMean), 2)); greenRingDetector = Math.sqrt(Math.pow((normalizedRedSample-greenRingRedMean), 2) +Math.pow((normalizedGreenSample-greenRingGreenMean), 2) +Math.pow((normalizedBlueSample-greenRingBlueMean), 2)); yellowRingDetector = Math.sqrt(Math.pow((normalizedRedSample-yellowRingRedMean), 2) +Math.pow((normalizedGreenSample-yellowRingGreenMean), 2) +Math.pow((normalizedBlueSample-yellowRingBlueMean), 2)); orangeRingDetector = Math.sqrt(Math.pow((normalizedRedSample-orangeRingRedMean), 2) +Math.pow((normalizedGreenSample-orangeRingGreenMean), 2) +Math.pow((normalizedBlueSample-orangeRingBlueMean), 2)); //check which ring has been detected if(blueRingDetector<detectionRange) { //blue ring is detected Sound.beep(); keepGoing = false; } else if(greenRingDetector<detectionRange) { //green ring is detected Sound.beep(); Sound.beep(); keepGoing = false; } else if(yellowRingDetector<detectionRange) { //yellow ring is detected Sound.beep(); Sound.beep(); Sound.beep(); keepGoing = false; } else if(orangeRingDetector<detectionRange) { //orange ring is detected Sound.beep(); Sound.beep(); Sound.beep(); Sound.beep(); keepGoing = false; } else { //no ring is detected counter++; } } if(counter == 10) { System.out.println("No ring detected"); } } static void stopMotors() { leftMotor.stop(); rightMotor.stop(); } static void sleep(int a) { try { Thread.sleep(a); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
true
5c623224324f0f138b1a75f54bcf98ec1c49a22b
Java
divyajnu08/mse
/src/main/java/com/virtue/csr/constants/MESSAGE_TYPES.java
UTF-8
233
1.820313
2
[]
no_license
package com.virtue.csr.constants; public interface MESSAGE_TYPES { public String DEBUG = "debug"; public String INFO = "info"; public String WARN = "warn"; public String ERROR = "error"; public String CRITICAL = "critical"; }
true
9aa7ef95c72d4d918596417e73314d8aabc40240
Java
bsamray/nwb-case-study
/src/main/java/uk/co/nwb/tech/nwb/datastore/InmemoryDataStore.java
UTF-8
1,130
2.53125
3
[]
no_license
package uk.co.nwb.tech.nwb.datastore; import org.springframework.stereotype.Service; import uk.co.nwb.tech.nwb.exception.BankAccountNotFoundException; import uk.co.nwb.tech.nwb.model.Account; import java.util.ArrayList; import java.util.List; @Service public class InmemoryDataStore implements DataStore { private List<Account> accounts = new ArrayList<>(); @Override public void upsert(Account account) { boolean found = false; for (int i = 0; i < accounts.size(); i++) { if (accounts.get(i).getAccount().equals(account.getAccount())) { accounts.set(i, account); found = true; break; } } if (!found) { accounts.add(account); } } @Override public Account getAccount(String accountId) { return accounts.stream().filter(account -> accountId.equals(account.getAccount())).findFirst() .orElseThrow(() -> new BankAccountNotFoundException("Account not found")); } @Override public List<Account> getAccounts() { return accounts; } }
true
98a5e5e341c0e192c035bc8e2cc3c2ec23a64168
Java
siragezeynu/TraficAccident
/src/main/java/com/restapi1/demo/model/Vehicle.java
UTF-8
1,448
2.296875
2
[]
no_license
package com.restapi1.demo.model; import java.util.Set; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; @Entity public class Vehicle { @Id @GeneratedValue private Long id; private String make; private String color; private String modle; private String vehicleidentification; @ManyToOne @JoinColumn(name="accident_id",nullable=false) private Accident accident; @OneToMany(mappedBy = "vehicle") private Set<Moterist> moterist; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getMake() { return make; } public void setMake(String make) { this.make = make; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } public String getModle() { return modle; } public void setModle(String modle) { this.modle = modle; } public String getVehicleidentification() { return vehicleidentification; } public void setVehicleidentification(String vehicleidentification) { this.vehicleidentification = vehicleidentification; } public Accident getAccident() { return accident; } public void setAccident(Accident accident) { this.accident = accident; } public Set<Moterist> getMoterist() { return moterist; } public void setMoterist(Set<Moterist> moterist) { this.moterist = moterist; } }
true
7eebff6d317d7d1465304537f5b3a7c4f1de61f6
Java
sinotopia/sinotopia
/sinotopia-fundamental/sinotopia-fundamental-database-parent/sinotopia-fundamental-database/src/main/java/com/sinotopia/fundamental/database/TransactionManager.java
UTF-8
3,223
2.59375
3
[ "MIT" ]
permissive
package com.sinotopia.fundamental.database; import com.sinotopia.fundamental.api.data.ResultEx; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.TransactionException; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.support.CallbackPreferringPlatformTransactionManager; import org.springframework.transaction.support.TransactionCallback; /** * 自定义数据库事物管理器,根据执行方法后的返回结果进行回滚 */ @SuppressWarnings("serial") public class TransactionManager extends DataSourceTransactionManager implements CallbackPreferringPlatformTransactionManager { private final Logger logger = LoggerFactory.getLogger(TransactionManager.class); @SuppressWarnings("unchecked") public <T> T execute(TransactionDefinition definition, TransactionCallback<T> callback) throws TransactionException { long tid = Thread.currentThread().getId(); logger.debug("start transaction.[" + tid + "]"); TransactionStatus status = getTransaction(definition);//获得事务的状态 try { Object result = callback.doInTransaction(status);//执行逻辑处理 if (result == null) { logger.debug("check returned value null.[" + tid + "]"); } else { logger.debug("check returned value " + result.toString() + ".[" + tid + "]"); } if (!status.isCompleted()) {//事务还没有完成 if (status.isRollbackOnly()) { logger.debug("rollbacking transaction due to code requested.[" + tid + "]");//代码中手动回滚 rollback(status); } else { if ((result != null) && ((result instanceof ResultEx))) {//判断返回结果是否为空,及其类型是否正确 if (((ResultEx) result).isFailed()) {//根据返回对象的isFailed方法判断逻辑处理结果是否成功 logger.error("rollbacking transaction due to failed result.[" + tid + "]"); rollback(status);//返回失败的结果执行事务回滚 } else { logger.debug("committing transaction due to succeeded result.[" + tid + "]"); commit(status);//返回成功的结果执行事务提交 } } else { logger.debug("committing transaction on unknown result.[" + tid + "]"); commit(status);//未知结果类型提交事务 } } } return (T) result;//将底层的返回值作为代理的返回值 } catch (RuntimeException e) { if (!status.isCompleted()) {//发生异常执行事务回滚 logger.error("rollbacking transaction due to runtime exception.[" + tid + "]"); rollback(status); } throw e; } } }
true
34d130f42893b45a33e432613613953bf7f72cbc
Java
Pa1sathvik/DataStructures
/DataStructures/src/com/longest/BinarySearchRecursive.java
UTF-8
630
3.875
4
[]
no_license
package com.longest; public class BinarySearchRecursive { public static void main(String args[]) { int a[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; int low = 0; int high = a.length - 1; int search = 2; System.out.println("Element is present at "+(findElementInBS(low, high, a, search)+1) +"th position"); } private static int findElementInBS(int low, int high, int[] a, int search) { int mid = (high + low) / 2; if (a[mid] == search) { return mid; } else if (a[mid] < search) { return findElementInBS(mid + 1, high, a, search); } else { return findElementInBS(low, mid - 1, a, search); } } }
true
390ff024156f1a175cc2c0adfe487782cef27623
Java
deepthikamaraj/javaCode
/opserv-sp-core/src/main/java/com/cognizant/opserv/sp/core/dao/TTblSchMapDAOImpl.java
UTF-8
10,916
1.820313
2
[]
no_license
package com.cognizant.opserv.sp.core.dao; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.cognizant.opserv.sp.core.entity.TDsStg; import com.cognizant.opserv.sp.core.entity.TTblSchMap; import com.cognizant.peg.core.common.LogicalOperatorEnum; import com.cognizant.peg.core.common.OperatorInfo; import com.cognizant.peg.core.common.PaginationInfo; import com.cognizant.peg.core.common.SearchFilter; import com.cognizant.peg.core.dao.GenericDAO; import com.cognizant.peg.core.logger.OpservLogger; import com.cognizant.peg.core.logger.OpservLoggerFactory; import com.cognizant.peg.core.util.JPAQuery; /** * Class provides API implementation for TTblSchMapDAO. * * @author JCoE team * @version 1.0 */ @Repository("tTblSchMapDAO") public class TTblSchMapDAOImpl implements TTblSchMapDAO { /** * instantiate Logger Object */ private static final OpservLogger LOGGER = OpservLoggerFactory.getOpservLogger(TTblSchMapDAOImpl.class); @Autowired private GenericDAO genericDAO; public GenericDAO getGenericDAO() { return genericDAO; } public void setGenericDAO(final GenericDAO genericDAO) { this.genericDAO = genericDAO; } private static final String TDSSTG = "tDsStg"; private final Class<TTblSchMap> clazz; public Class<TTblSchMap> getClazz() { return clazz; } /** * @generated */ public TTblSchMapDAOImpl() { super(); this.clazz = TTblSchMap.class; } private static final String JPAQL = "select tTblSchMapentity from TTblSchMap tTblSchMapentity"; private static final String JPACOUNTQL = "select count(tTblSchMapentity) from TTblSchMap tTblSchMapentity"; private static final String[] RESTRICTIONS = { "tTblSchMapentity.mappingId like '#{tTblSchMapentity.getMappingId}%'", "tTblSchMapentity.stgIp like '#{tTblSchMapentity.getStgIp}%'", "tTblSchMapentity.stgDb like '#{tTblSchMapentity.getStgDb}%'", "tTblSchMapentity.stgTblName like '#{tTblSchMapentity.getStgTblName}%'", "tTblSchMapentity.stgColumnName like '#{tTblSchMapentity.getStgColumnName}%'", "tTblSchMapentity.stgDataType like '#{tTblSchMapentity.getStgDataType}%'", "tTblSchMapentity.stgColumnLength like '#{tTblSchMapentity.getStgColumnLength}%'", "tTblSchMapentity.stgNullOption like '#{tTblSchMapentity.getStgNullOption}%'", "tTblSchMapentity.prdIp like '#{tTblSchMapentity.getPrdIp}%'", "tTblSchMapentity.prdDb like '#{tTblSchMapentity.getPrdDb}%'", "tTblSchMapentity.prdTblName like '#{tTblSchMapentity.getPrdTblName}%'", "tTblSchMapentity.prdColumnName like '#{tTblSchMapentity.getPrdColumnName}%'", "Date(tTblSchMapentity.mapDtTm) = '#{tTblSchMapentity.getMapDtTm}'", "tTblSchMapentity.createdBy = #{tTblSchMapentity.getCreatedBy}", "Date(tTblSchMapentity.createDt) = '#{tTblSchMapentity.getCreateDt}'", "tTblSchMapentity.updatedBy = #{tTblSchMapentity.getUpdatedBy}", "Date(tTblSchMapentity.updateDt) = '#{tTblSchMapentity.getUpdateDt}'", "tTblSchMapentity.tenantId = #{tTblSchMapentity.getTenantId}", "tTblSchMapentity.colTrnsform like '#{tTblSchMapentity.getColTrnsform}%'", "tTblSchMapentity.stgKeyCol = #{tTblSchMapentity.getStgKeyCol}", "tTblSchMapentity.stgUnqCol = #{tTblSchMapentity.getStgUnqCol}", "tTblSchMapentity.startPos = #{tTblSchMapentity.getStartPos}", "tTblSchMapentity.endPos = #{tTblSchMapentity.getEndPos}", "tTblSchMapentity.tDsStg.dsId = #{tTblSchMapentity.tDsStg.getDsId}" }; /** * Stores a new TTblSchMap entity object in to the persistent store * * @param tTblSchMap * TTblSchMap Entity object to be persisted * @return tTblSchMap Persisted TTblSchMap object */ public TTblSchMap createTTblSchMap(final TTblSchMap tTblSchMap) { LOGGER.info("=========== Create TTblSchMap ==========="); TTblSchMap tblRow = genericDAO.store(tTblSchMap); return tblRow; } /** * Deletes a TTblSchMap entity object from the persistent store * * @param tTblSchMap * TTblSchMap Entity object to be deleted */ public void deleteTTblSchMap(final String mappingId) { LOGGER.info("=========== Delete TTblSchMap ==========="); final TTblSchMap tTblSchMap = genericDAO.get(clazz, mappingId); genericDAO.remove(tTblSchMap); } /** * Updates a TTblSchMap entity object in to the persistent store * * @param tTblSchMap * TTblSchMap Entity object to be updated * @return tTblSchMap Persisted TTblSchMap object */ public TTblSchMap updateTTblSchMap(final TTblSchMap tTblSchMap) { LOGGER.info("=========== Update TTblSchMap ==========="); return genericDAO.update(tTblSchMap); } /** * Retrieve an TTblSchMap object based on given TTblSchMap mappingId. * * @param tTblSchMapId * the primary key value of the TTblSchMap Entity. * @return an Object if it exists against given primary key. Returns null of * not found */ public TTblSchMap findTTblSchMapById(final Long tTblSchMapId) { LOGGER.info("find TTblSchMap instance with mappingId: " + tTblSchMapId); return genericDAO.get(clazz, tTblSchMapId); } /** * Retrieve TTblSchMap based on given search criteria using Dynamic JPAQL. * * @param searchFilter * The query criteria and search filter conditions are set * @return List<TTblSchMap> list of TTblSchMap if it exists against given criteria. * Returns null if not found */ public List<TTblSchMap> findTTblSchMaps(final SearchFilter<TTblSchMap> searchFilter) { LOGGER.info("=========== Find TTblSchMaps ==========="); final PaginationInfo paginationInfo = searchFilter.getPaginationInfo(); final OperatorInfo operatorInfo = searchFilter.getOperatorInfo(); final TTblSchMap tTblSchMap = searchFilter.getEntityClass(); final int maxresult = paginationInfo.getMaxRows(); final int index = paginationInfo.getStartIndex(); //int maxresult = 3; //int index=0; final LogicalOperatorEnum logOpEnum = operatorInfo.getLogicalOperator(); final JPAQuery jpaQuery = new JPAQuery("tTblSchMapentity", tTblSchMap); if (tTblSchMap.getTDsStg() == null) { jpaQuery.bind(TDSSTG, new TDsStg()); } else { LOGGER.info("tDsStg {}"+ tTblSchMap.getTDsStg()); jpaQuery.bind(TDSSTG, tTblSchMap.getTDsStg()); } jpaQuery.setJPAql(JPAQL); jpaQuery.setRestrictionExpressionStrings(RESTRICTIONS); jpaQuery.setLogicalOperatorEnum(logOpEnum); return genericDAO.findEntities(jpaQuery, index, maxresult); } /** * Fetch count of records for TTblSchMaps. * * @return an Object if it exists against given primary key. Returns null if * not found */ public Object countTTblSchMaps(final SearchFilter<TTblSchMap> searchFilter) { LOGGER.info("=========== Count TTblSchMap ==========="); final OperatorInfo operatorInfo = searchFilter.getOperatorInfo(); final TTblSchMap tTblSchMap = searchFilter.getEntityClass(); final LogicalOperatorEnum logOpEnum = operatorInfo.getLogicalOperator(); final JPAQuery jpaCountQuery = new JPAQuery("tTblSchMapentity", tTblSchMap); if (tTblSchMap.getTDsStg() == null) { jpaCountQuery.bind(TDSSTG, new TDsStg()); } else { LOGGER.info("tDsStg {}"+ tTblSchMap.getTDsStg()); jpaCountQuery.bind(TDSSTG, tTblSchMap.getTDsStg()); } jpaCountQuery.setJPAql(JPACOUNTQL); jpaCountQuery.setRestrictionExpressionStrings(RESTRICTIONS); jpaCountQuery.setLogicalOperatorEnum(logOpEnum); return genericDAO.findEntities(jpaCountQuery, -1, -1); } /** * Retrieve TTblSchMap based on given search criteria using JPA named Query. * The search criteria is of TDsStg type. * * @param searchFilter * The query criteria and search filter conditions are set * @return List<TTblSchMap> list of TTblSchMaps if it exists against given * criteria. Returns null if not found */ public List<TTblSchMap> getTTblSchMapsByTDsStg(final SearchFilter<TDsStg> searchFilter) { final PaginationInfo paginationInfo = searchFilter.getPaginationInfo(); List<Object> queryParam=new ArrayList<Object> (); queryParam.add(searchFilter.getEntityClass()); final int maxresult = paginationInfo.getMaxRows(); final int index = paginationInfo.getStartIndex(); return genericDAO.findEntitiesByNamedQueryMultiCond("FindTTblSchMapByTDsStg", queryParam, index, maxresult); } /** * Count TTblSchMap based on given search criteria using JPA named Query. * The search criteria is of TDsStg type. * * @param searchFilter * The query criteria and search filter conditions are set * @return a Object indicating the count */ public Object countTTblSchMapsByTDsStg(final SearchFilter<TDsStg> searchFilter) { List<Object> queryParam=new ArrayList<Object> (); queryParam.add(searchFilter.getEntityClass()); return genericDAO.findEntitiesByNamedQuery("CountTTblSchMapsByTDsStg", queryParam); } /** * Retrieve All TPrdTblSch using JPA named Query. * * @return List<TPrdTblSch> list of TPrdTblSch if it exists. * Returns null if not found * */ @Override public List<TTblSchMap> getAllTTblSchMap() { List<TTblSchMap> tTblSchMapList = genericDAO.findEntitiesByNamedQuery("FindAllTTblSchMaps"); return tTblSchMapList; } @SuppressWarnings("unchecked") @Override public List<TTblSchMap> findTTblSchMapByTDsStgAndKeyCol( SearchFilter<TTblSchMap> searchFilter,Character compKey) { int index = searchFilter.getPaginationInfo().getStartIndex(); int maxresult = searchFilter.getPaginationInfo().getMaxRows(); final TTblSchMap tTblSchMap = searchFilter.getEntityClass(); final Character prdKelCol = tTblSchMap.getPrdKeyCol(); final TDsStg tDsStg = tTblSchMap.gettDsStg(); @SuppressWarnings("rawtypes") List paramList = new ArrayList<>(); paramList.add(tDsStg); paramList.add(prdKelCol); paramList.add(compKey); List<TTblSchMap> tTblSchMapList = genericDAO.findEntitiesByNamedQueryMultiCond("FindTTblSchMapByTDsStgAndKeyCol", paramList, index, maxresult); return tTblSchMapList; } @Override public int updateTable(String query) { int status = genericDAO.executeNativeQuery(query); return status; } @Override @SuppressWarnings({ "unchecked", "rawtypes" }) public List<TTblSchMap> getTTblSchMapsByTDsStgAndTenantAndTableName(SearchFilter<TTblSchMap> searchFilter){ int index = searchFilter.getPaginationInfo().getStartIndex(); int maxresult = searchFilter.getPaginationInfo().getMaxRows(); final TTblSchMap tTblSchMap = searchFilter.getEntityClass(); final TDsStg tDsStg = tTblSchMap.gettDsStg(); List paramList = new ArrayList<>(); paramList.add(tDsStg); paramList.add(tTblSchMap.getStgTblName()); paramList.add(tTblSchMap.getTenantId()); List<TTblSchMap> tTblSchMapList = genericDAO.findEntitiesByNamedQueryMultiCond("GetTTblSchMapsByTDsStgAndTenantAndTableName", paramList, index, maxresult); return tTblSchMapList; } }
true
53a88cdd33e92769434b085d18859bf404c23756
Java
18321473057/scrms
/src/main/java/com/tn/scrms/controller/ocr/IOcrQrCodeService.java
UTF-8
326
1.703125
2
[]
no_license
package com.tn.scrms.controller.ocr; import java.io.IOException; /** * @Author: yangcs * @Date: 2020/7/23 13:59 * @Description: ocr 二维码识别服务 */ public interface IOcrQrCodeService { /** * @Description 电池二维码图文识别 * * */ void coventImage() throws IOException; }
true
cce9bc302d552c59eb0d9a89345854bdb4c4253b
Java
barneyb/el-tag-graph
/src/main/java/com/barneyb/eventlog/taggraph/suggest/PageRanked.java
UTF-8
2,913
2.453125
2
[]
no_license
package com.barneyb.eventlog.taggraph.suggest; import org.graphstream.algorithm.PageRank; import org.graphstream.graph.Edge; import org.graphstream.graph.Graph; import org.graphstream.graph.Node; import org.graphstream.graph.implementations.MultiGraph; import java.util.*; import static com.barneyb.eventlog.taggraph.Constants.ATTR_TYPE; import static com.barneyb.eventlog.taggraph.Constants.TYPE_EVENT; public class PageRanked implements Suggester { public Graph ranked; public PageRanked(Graph raw) { int counter = 0; ranked = new MultiGraph(raw.getId() + "-ranked"); Set<Node> visited = new HashSet<>(); for (Node tn : raw.getEachNode()) { if (TYPE_EVENT.equals(tn.getAttribute(ATTR_TYPE))) continue; if (!visited.add(tn)) continue; Node rtn = ranked.addNode(tn.getId()); rtn.addAttribute("ui.label", tn.getId()); for (Edge e1 : tn.getEachEdge()) { Node en = e1.getOpposite(tn); for (Edge e2 : en.getEachEdge()) { Node otn = e2.getOpposite(en); if (tn == otn) continue; Node rotn; if (visited.add(otn)) { rotn = ranked.addNode(otn.getId()); rotn.addAttribute("ui.label", otn.getId()); } else { rotn = ranked.getNode(otn.getId()); } ranked.addEdge("" + counter++, rtn, rotn); } } } PageRank pageRank = new PageRank(); pageRank.init(ranked); pageRank.compute(); for (Node n : ranked) { n.setAttribute("ui.label", String.format("%s (%.3f)", n.getId(), n.getAttribute(PageRank.DEFAULT_RANK_ATTRIBUTE))); } } @Override public List<WeightedTag> suggestions(Set<String> tags, int count) { SortedSet<WeightedTag> byWeight = new TreeSet<>(Comparator.comparingDouble((WeightedTag t) -> t.weight).reversed()); for (Node tn : ranked.getEachNode()) { if (TYPE_EVENT.equals(tn.getAttribute(ATTR_TYPE))) continue; if (tags.contains(tn.getId())) continue; if (! tags.isEmpty()) { boolean found = false; for (Edge e : tn.getEachEdge()) { if (tags.contains(e.getOpposite(tn).getId())) { found = true; break; } } if (! found) continue; } byWeight.add(new WeightedTag(tn.getId(), tn.getAttribute(PageRank.DEFAULT_RANK_ATTRIBUTE))); } List<WeightedTag> suggs = new ArrayList<>(); for (WeightedTag wt : byWeight) { if (suggs.size() >= count) break; suggs.add(wt); } return suggs; } }
true
dfadd5f952aa48658d2b90dc1414bb0c4f15c084
Java
1261189570/MyJavaDemo
/src/main/java/com/cykj/myuitl/test.java
UTF-8
1,592
3.234375
3
[]
no_license
package com.cykj.myuitl; import com.cykj.bean.User; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class test { public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException { //第一种 Class<?> user = Class.forName("com.cykj.bean.User"); //第二种 Class<?> userClass = User.class; //第三种 Class<?> user2 = new User().getClass(); //通过Class对象的newInstance方法获取这个类对象 Object o = userClass.newInstance(); //通过Constructor对象,来获取类对象 Constructor<?> constructor = userClass.getConstructor(String.class,Integer.class); //拿到类实例 Object o1 = constructor.newInstance("李四",2); //获取这个类所有的方法(不包括系统默认方法) Method[] methods=userClass.getDeclaredMethods(); for (Method method : methods) { method.setAccessible(true); Object invoke = method.invoke(o); System.out.println("返回值: "+method.getName()); } //获取这个类所有public方法(包括系统默认方法) Method[] methods2=userClass.getMethods(); //获取这个类的指定方法 Method methods3=userClass.getDeclaredMethod("iii",String.class); Object invoke = methods3.invoke(o1,"555"); System.out.println(invoke); } }
true
a000ec7f11bf9bdf7c2752c554cb60529da52f61
Java
AleksandraVysitska/Java-Tests
/tests/src/main/java/com/tests/mockito/dao/UserDaoImpl.java
UTF-8
804
2.859375
3
[]
no_license
/** * */ package com.tests.mockito.dao; import java.util.Arrays; import java.util.List; import com.tests.mockito.model.User; /** * @author aleksandra * */ public class UserDaoImpl implements UserDao { private List<User> users; public UserDaoImpl() { this.users = Arrays.asList( new User ("olga", "GUEST"), new User ("kirill", "USER"), new User ("maia", "ADMIN") ); } @Override public User getUserByUsername(String username) throws Exception { return users.stream().filter( u -> u.getUsername().equals(username)) .findAny() //findAny() ritorna optional, cioè User può essere trovato o meno, .orElse(null); //perciò bisogna specificare cosa fare se User non verrà trovato } @Override public List <User> findAllUsers(){ return users; } }
true
d0db465980711b39bd8ed7e9ffbf11c0286d0692
Java
jstolorz/clean-arch-2-8-2-master
/clean-arch-2-8-2-master/src/main/java/com/smalaca/rentalapplication/query/hotel/SpringJpaQueryHotelRepository.java
UTF-8
207
1.59375
2
[]
no_license
package com.smalaca.rentalapplication.query.hotel; import org.springframework.data.repository.CrudRepository; interface SpringJpaQueryHotelRepository { //extends CrudRepository<HotelReadModel, String> { }
true
26c2c2223fc35c282d89cb8c98af83d6b080c7ff
Java
dizzarg/java-multithreading
/src/main/java/ru/dkadyrov/multithreading/locks/SynchronizedCounterApplication.java
UTF-8
982
3.78125
4
[]
no_license
package ru.dkadyrov.multithreading.locks; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; /** * Example of counter with synchronized keyword. */ class SynchronizedCounter { private int value = 0; public synchronized void increment() { value++; } public synchronized void decrement() { value--; } public synchronized int get() { return value; } } public class SynchronizedCounterApplication { public static void main(String[] args) throws InterruptedException { var counter = new SynchronizedCounter(); var cachedThreadPool = Executors.newCachedThreadPool(); for (int i = 0; i < 123_456; i++) { cachedThreadPool.execute(counter::increment); } cachedThreadPool.shutdown(); cachedThreadPool.awaitTermination(20, TimeUnit.SECONDS); System.out.println("Result should be 123456: Actual result is: " + counter.get()); } }
true
ff4989b2537ce1fd56e66364fe78293d2e2ced71
Java
echoukse/MulticoreProject
/monitor/src/util/Symbols.java
UTF-8
250
1.578125
2
[]
no_license
/* * Classname * * Version info * * Copyright notice */ package util; public class Symbols { public static final boolean isDebug = false; public static int MAX_SPIN = 32 * 128; public static long PARK_TIMEOUT_NANO = 100000000; }
true
93f0845b2afcbf322408b140854812c0faa99112
Java
antonioorodungao/TextFieldandLabels
/src/gui/MessagePanel.java
UTF-8
5,035
2.84375
3
[]
no_license
package gui; import controller.MessageServer; import model.Message; import javax.swing.*; import javax.swing.event.CellEditorListener; import javax.swing.event.ChangeEvent; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.TreeSelectionModel; import java.awt.*; import java.util.Set; import java.util.TreeSet; /** * Copyrights 2002-2011 Webb Fontaine * Developer: Antonio Oro Dungao * Date: 10/18/13 * This software is the proprietary information of Webb Fontaine. * Its use is subject to License terms. */ class ServerInfo{ private String name; private int id; private boolean checked; public ServerInfo(String name, int id, boolean checked){ this.name = name; this.id = id; this.checked = checked; } public int getId(){ return id; } public String toString(){ return name; } public boolean isChecked(){ return checked; } public void setChecked(boolean checked){ this.checked = checked; } } public class MessagePanel extends JPanel { private JTree serverTree; private ServerTreeCellRenderer treeCellRenderer; private ServerTreeCellEditor serverTreeCellEditor; private Set<Integer> selectedServers; private MessageServer messageServer; public MessagePanel(){ selectedServers = new TreeSet<Integer>(); selectedServers.add(0); selectedServers.add(1); selectedServers.add(4); serverTree = new JTree(createTree()); treeCellRenderer = new ServerTreeCellRenderer(); serverTreeCellEditor = new ServerTreeCellEditor(); serverTree.setEditable(true); messageServer = new MessageServer(); serverTree.setCellRenderer(treeCellRenderer); serverTree.setCellEditor(serverTreeCellEditor); serverTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); serverTreeCellEditor.addCellEditorListener(new CellEditorListener() { public void editingStopped(ChangeEvent e) { System.out.println("Editing stopped.."); ServerInfo info = (ServerInfo) serverTreeCellEditor.getCellEditorValue(); int serverId = info.getId(); if(info.isChecked()){ selectedServers.add(serverId); System.out.println("ID added " + serverId); }else{ selectedServers.remove(serverId); System.out.println("ID removed " + serverId); } messageServer.setSelectedServers(selectedServers); System.out.println("Info: " + info.getId() + " is checked: " + info.isChecked()); System.out.println("Messages waiting: " + messageServer.getMessageCount()); for(Message message: messageServer){ System.out.println(message.getTitle()); } } public void editingCanceled(ChangeEvent e) { System.out.println("Editing Cancelled"); } }); //Will tell you if the node is selected or not //removing since we are not concerned anymore with selection. // serverTree.addTreeSelectionListener(new TreeSelectionListener() { // public void valueChanged(TreeSelectionEvent e) { // DefaultMutableTreeNode dmt = (DefaultMutableTreeNode)serverTree.getLastSelectedPathComponent(); // Object userObject = dmt.getUserObject(); // System.out.println(userObject); // } // }); setLayout(new BorderLayout()); add(new JScrollPane(serverTree), BorderLayout.CENTER); } private DefaultMutableTreeNode createTree(){ DefaultMutableTreeNode top = new DefaultMutableTreeNode("Servers"); DefaultMutableTreeNode branch1 = new DefaultMutableTreeNode("USA"); DefaultMutableTreeNode server1 = new DefaultMutableTreeNode(new ServerInfo("New York", 0, selectedServers.contains(0))); DefaultMutableTreeNode server2 = new DefaultMutableTreeNode(new ServerInfo("Boston", 1, selectedServers.contains(1))); DefaultMutableTreeNode server3 = new DefaultMutableTreeNode(new ServerInfo("Los Angeles", 2, selectedServers.contains(2))); branch1.add(server1); branch1.add(server2); branch1.add(server3); DefaultMutableTreeNode branch2 = new DefaultMutableTreeNode("UK"); DefaultMutableTreeNode server4 = new DefaultMutableTreeNode(new ServerInfo("London",3, selectedServers.contains(3))); DefaultMutableTreeNode server5 = new DefaultMutableTreeNode(new ServerInfo("Edinburgh",4, selectedServers.contains(4))); branch2.add(server4); branch2.add(server5); top.add(branch1); top.add(branch2); return top; } }
true
430dceebd11aca2bbaf37cc63830fae7fb41c673
Java
dinislam-nur/orm
/src/main/java/ru/iteco/first_adapter/factory/OrmFactoryImpl.java
UTF-8
1,060
2.34375
2
[]
no_license
package ru.iteco.first_adapter.factory; import ru.iteco.first_adapter.Db; import ru.iteco.first_adapter.DbUserEntity; import ru.iteco.first_adapter.DbUserInfoEntity; import ru.iteco.first_adapter.orm.first.FirstOrm; import ru.iteco.first_adapter.orm.first.FirstOrmImpl; import ru.iteco.first_adapter.orm.second.SecondOrm; import ru.iteco.first_adapter.orm.second.SecondOrmImpl; public class OrmFactoryImpl implements OrmFactory { private final Db<DbUserEntity> userDb; private final Db<DbUserInfoEntity> userInfoDb; public OrmFactoryImpl(Db<DbUserEntity> userDb, Db<DbUserInfoEntity> userInfoDb) { this.userDb = userDb; this.userInfoDb = userInfoDb; } @Override public FirstOrm<DbUserEntity> createUserFirstOrm() { return new FirstOrmImpl<>(userDb); } @Override public FirstOrm<DbUserInfoEntity> createUserInfoFirstOrm() { return new FirstOrmImpl<>(userInfoDb); } @Override public SecondOrm createSecondOrm() { return new SecondOrmImpl(userDb, userInfoDb); } }
true
99f52de84d698b6480bf3f59a98a9daa53b73a02
Java
Team-1111/bankbankatm
/Code/NetworkToBank.java
UTF-8
776
2.515625
3
[]
no_license
public class NetworkToBank { private Log log; private InetAddress bankAddress; /** * * @param log * @param bankAddress */ public NetworkToBank(Log log, InetAddress bankAddress) { // TODO - implement NetworkToBank.NetworkToBank throw new UnsupportedOperationException(); } public void openConnection() { // TODO - implement NetworkToBank.openConnection throw new UnsupportedOperationException(); } public void closeConnection() { // TODO - implement NetworkToBank.closeConnection throw new UnsupportedOperationException(); } /** * * @param message * @param balances */ public Status sendMessage(Message message, Balances balances) { // TODO - implement NetworkToBank.sendMessage throw new UnsupportedOperationException(); } }
true
dddc391f4a766be728ffb63a05f075d5d3a56205
Java
Sapna12pandey/Loops
/Loops/src/maxmin.java
UTF-8
205
2.40625
2
[]
no_license
import java.util.*; public class maxmin { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int max=0,min=0; while(true) { } } }
true
e8d7c1acdb7827a57248f3c2624717ee45d363c5
Java
jordanbonaldi/Linaris-GameAPI
/src/net/neferett/gameapi/modules/scoreboard/ScoreBoardModule.java
UTF-8
496
2.453125
2
[]
no_license
package net.neferett.gameapi.modules.scoreboard; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import net.neferett.gameapi.Game; public abstract class ScoreBoardModule { Game game; public ScoreBoardModule(Game game) { this.game = game; } public void update() { onUpdate(); for (Player p : Bukkit.getOnlinePlayers()) onUpdate(p); } public Game getGame() { return game; } public abstract void onUpdate(); public abstract void onUpdate(Player p); }
true
081cec23f45d30697f58d565fae937ca4dac039c
Java
ividito/SWE4403Project
/src/ui/OpenFileCommand.java
UTF-8
1,486
2.875
3
[]
no_license
import javax.swing.*; import java.io.File; import java.io.IOException; import java.util.NoSuchElementException; import java.util.Scanner; public class OpenFileCommand implements Command { private static final Logger logger = Logger.getInstance(); private Window window; private DocumentModelFacade facade; public OpenFileCommand(Window parent, DocumentModelFacade facade) { this.window = parent; this.facade = facade; } @Override public void execute() { JFileChooser fileChooser = new JFileChooser(); Integer returnValue = fileChooser.showOpenDialog(window); if(returnValue == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); Scanner scanner = null; String result = ""; logger.log(OpenFileCommand.class, "Chose file: " + file.getName()); try { scanner = new Scanner(file).useDelimiter("\\Z"); result = scanner.next(); } catch(IOException e) { logger.log(OpenFileCommand.class, "Unable to read file: " + e.getMessage()); } catch(NoSuchElementException e) { logger.log(OpenFileCommand.class, "Empty file! " + e.getMessage()); } finally { if(scanner != null) { scanner.close(); } } facade.clearEditHistory(); facade.setFileSaveLocation(file); facade.update(result, true); } else { logger.log(OpenFileCommand.class, "Open file operation aborted."); } } }
true
9d442e14bcffab77cce951c0ae7f396d55edd058
Java
MedRepOITBS/Android_FinalCode
/app/src/main/java/com/app/util/JSONParser.java
UTF-8
3,870
2.65625
3
[]
no_license
package com.app.util; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.google.gson.Gson; import android.util.Log; /** * Created by Kishore on 9/26/2015. */ public class JSONParser { private static JSONArray jsonArray = null; private static String json = ""; /** * Method sends request to the given url. * * Note: URL should be complete. * * @param url * @return * @throws IOException */ public JSONArray getJSON_Response(String url) { try { URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); // optional default is GET con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); System.out.println("\nSending 'GET' request to URL : " + url + "response code: " + responseCode); System.out.println("Response Code : " + responseCode); BufferedReader reader = new BufferedReader(new InputStreamReader( con.getInputStream())); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line); } json = sb.toString(); } catch (IOException e) { Log.e("Buffer Error", "Error converting result " + e.toString()); e.printStackTrace(); } // try parse the string to a JSON object try { if (!json.equals("null")) { jsonArray = new JSONArray(json); Log.d("jsonArray:: ", jsonArray + ""); } else { jsonArray = null; } } catch (JSONException e) { Log.e("JSON Parser", "Error parsing data " + e.toString()); } // return JSON String return jsonArray; } /** * Method sends request to the given url. * * Note: URL should be complete. * * @param url * @return * @throws IOException */ public JSONObject getJSON_Response(String url, boolean isResultJSONObj) { try { URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); // optional default is GET con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); System.out.println("\nSending 'GET' request to URL : " + url + "response code: " + responseCode); System.out.println("Response Code : " + responseCode); BufferedReader reader = new BufferedReader(new InputStreamReader( con.getInputStream())); StringBuilder sb = new StringBuilder(); String line = null; System.out.println("about to execute while loop"); while ((line = reader.readLine()) != null) { System.out.println("Inside while loop line: " + line); sb.append(line); } System.out.println("Result : " + sb.toString()); return new JSONObject(sb.toString()); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } return null; } public ArrayList jsonParser(JSONArray jsonArray, Class myClass, ArrayList data) { System.out.println("coming here to convert josn"); Gson g = new Gson(); JSONArray ja = jsonArray; try { for (int i = 0; i < ja.length(); i++) { System.out.println("coming here to convert josn" + i); Log.i(ja.getString(i), myClass.toString()); data.add(g.fromJson(ja.getString(i), myClass)); // listener.loading(i,ja.length()); } } catch (JSONException e) { e.printStackTrace(); } return data; } public Object jsonParser(JSONObject jsonObject, Class myClass) throws JSONException { Gson g = new Gson(); if(jsonObject != null) return g.fromJson(jsonObject.toString(), myClass); return null; } }
true
fd43d8deb0aa5410c086eaadd24755c598d4ab1e
Java
chenchen12382/blog
/src/main/java/com/chenchen/exception/ParamException.java
UTF-8
487
2.25
2
[]
no_license
package com.chenchen.exception; @SuppressWarnings("serial") public class ParamException extends RuntimeException { private int errorCode; public ParamException() { } public ParamException(String message) { super(message); } public ParamException(int errorCode, String message) { super(message); this.errorCode = errorCode; } public int getErrorCode() { return errorCode; } public void setErrorCode(int errorCode) { this.errorCode = errorCode; } }
true
f5211b705e45a05bd809f162734254051d38a30e
Java
abhiptl/design-patterns-gof
/src/com/abhishek/behavioral/chainofresponsibility/ChainOfResponsibilityMain.java
UTF-8
1,107
3.25
3
[]
no_license
package com.abhishek.behavioral.chainofresponsibility; /** * Created by AbhishekPatel on 9/27/2017. */ public class ChainOfResponsibilityMain { private LogAppenderChain rootChain; private LogAppenderChain nextAppender; public ChainOfResponsibilityMain() { LogAppenderChain log2 = new FileLogAppender(); LogAppenderChain log3 = new DBLogAppender(); // Root chain rootChain = new ConsoleLogAppender(); // Set Chain of Responsibility rootChain.setNextChain(log2); log2.setNextChain(log3); } public void logMessage(String message) { if(nextAppender == null) { nextAppender = rootChain; } else { nextAppender = nextAppender.getNextChain(); } if(nextAppender.appendLog(message)) { logMessage(message); } else { return; } } public static void main(String[] args) { ChainOfResponsibilityMain chainOfResponsibilityMain = new ChainOfResponsibilityMain(); chainOfResponsibilityMain.logMessage("Message"); } }
true
f6cee1383c8edaef2a0f645a35effa54366af2b3
Java
BihanZhuang/super-game-engine
/src/model/Boundary.java
UTF-8
1,927
2.84375
3
[ "MIT" ]
permissive
package model; import java.io.Serializable; import engine.physicsStrategies.DefaultStrategy; import engine.physicsStrategies.IPhysicsStrategy; import javafx.geometry.BoundingBox; import javafx.geometry.Bounds; @SuppressWarnings("serial") public class Boundary implements Serializable { private double myX, myY, myWidth, myHeight; private IPhysicsStrategy myPhysicsStrategy; public Boundary(double x, double y, double width, double height) { myX = x; myY = y; myWidth = width; myHeight = height; myPhysicsStrategy = new DefaultStrategy(false, false, false); } public double getMinX() { return myX; } public double getMinY() { return myY; } public double getMaxX() { return myX + myWidth; } public double getMaxY() { return myY + myHeight; } public double getWidth() { return myWidth; } public double getHeight() { return myHeight; } public Bounds getBounds() { return new BoundingBox(myX, myY, myWidth, myHeight); } public IPhysicsStrategy getPhysicsStrategy() { return myPhysicsStrategy; } public void setMinX(double x) { myX = x; } public void setMinY(double y) { myY = y; } public void setMaxX(double x) { myWidth = x - myX; } public void setMaxY(double y) { myHeight = y - myY; } public void setWidth(double width) { myWidth = width; } public void setHeight(double height) { myHeight = height; } public void setPhysicsStrategy(IPhysicsStrategy physicsStrategy) { myPhysicsStrategy = physicsStrategy; } public boolean in(double x, double y) { return x >= myX && y >= myY && x < myX + myWidth && y < myY + myHeight; } }
true
cc350f7defc195d7cfcb174a9dc740c7eff272d7
Java
henriquemem/farma-fx-view
/farma-FX-view/src/main/java/br/com/datarey/est/produto/ProdutoForm.java
UTF-8
325
2.109375
2
[]
no_license
package br.com.datarey.est.produto; import br.com.datarey.frame.crud.BaseForm; import br.com.datarey.model.est.Produto; public class ProdutoForm extends BaseForm<Produto> { public ProdutoForm() { super(ProdutoForm.class.getResource("produtoForm.fxml")); setWidth(500); setHeight(300); } }
true
f73df91747b68ba3d9ca9305d42ef6f039a68767
Java
avshabanov/examples
/src/hiber-jpa-demo/src/main/java/com/mysite/hiberjpa/service/AppServiceImpl.java
UTF-8
804
2.1875
2
[]
no_license
package com.mysite.hiberjpa.service; import com.mysite.hiberjpa.dao.AppDao; import com.mysite.hiberjpa.model.Book; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import java.util.List; public final class AppServiceImpl implements AppService { private AppDao dao; public void setDao(AppDao dao) { this.dao = dao; } @Transactional(readOnly = false, propagation = Propagation.REQUIRED) public void deleteAll() { dao.deleteAll(); } @Transactional(readOnly = false, propagation = Propagation.REQUIRED) public void save(Book book) { dao.save(book); } @Transactional(readOnly = true) public List<Book> getBooks() { return dao.getBooks(); } }
true
f2c0b4cab502eecaea87779ab9c606a054f8d1b4
Java
ChaitanyaInfo/ChaitanyaTestInfo
/RestAPI/src/com/user/operations/RetrievalDataOperations.java
UTF-8
4,250
2.40625
2
[]
no_license
package com.user.operations; import java.util.ArrayList; import java.util.List; import org.hibernate.SQLQuery; import com.apartment.database.DatabaseSession; import com.apartment.database.DatabaseSessionFactory; import com.apartment.database.operations.DBOperations; import com.apartment.database.tables.Announcement; import com.apartment.database.tables.Apartment; import java.util.Date; public class RetrievalDataOperations { private static DatabaseSessionFactory sessionFactory = DatabaseSessionFactory .getInstance(); public static List<Integer> getRecordedMessages(Apartment apartment,List<String> userXmlQueries,String paginationQry,String expirationQry) { StringBuffer queryBuffer = new StringBuffer(); Date d1 = new Date(); System.out.println("Start Time : " + d1); queryBuffer.append("anmntA.ApartmentId=" + apartment.getId()); if (userXmlQueries.size() > 0) { queryBuffer.append(" and ("); for (int i = 0; i < userXmlQueries.size(); i++) { String query = userXmlQueries.get(i); if (i != 0) queryBuffer.append(" or "); queryBuffer.append("(anmntA.usergroups LIKE '%" + query + "%')"); } queryBuffer.append(")"); } DatabaseSession session = sessionFactory.newDatabaseSession(); String annSQL = "select anmntA.rootannouncementid from announcement anmntA , announcement anmntB where anmntA.rootannouncementid = anmntB.id and anmntB.promotion = false and anmntB.media=true and " + queryBuffer.toString() + " and anmntB.approval=true and anmntB.approvaldate is not null and anmntB.disable=false "+ expirationQry +" order by anmntB.PostedDate DESC" + paginationQry; /*SQLQuery sqlQuery = session .createSQLQuery("select {anmntA.rootannouncementid} from announcement anmntA , announcement anmntB where anmntA.rootannouncementid = anmntB.id and anmntB.promotion = false and anmntB.media=true and " + queryBuffer.toString() + " and anmntB.approval=true and anmntB.approvaldate is not null and anmntB.disable=false "+ expirationQry +" order by anmntB.PostedDate DESC" + paginationQry);*/ /*SQLQuery sqlQuery = session .createSQLQuery("select {anmntA.RootAnnouncementId} from announcement anmntA , announcement anmntB where anmntA.id = anmntB.rootannouncementid and " + queryBuffer.toString() );*/ /*SQLQuery sqlQuery = session.createSQLQuery(annSQL); List<Announcement> list=null; if (sqlQuery != null) { list= (List<Announcement>) sqlQuery.list(); // System.out.println("Returning follow count list Size : " + // list.size()); session.close(); }*/ System.out .println("Announcement query for user:" + annSQL); List<Integer> list=null; try{ SQLQuery results = session.createSQLQuery(annSQL); list = (List<Integer>) results.list(); session.close(); ///sqlQuery.addEntity("anmntA", Announcement.class); //list = (List<Integer>) sqlQuery.list(); //session.close(); System.out.println("Announcement list before iterating:"+list.size()); }catch(Exception e){ e.printStackTrace(); } /*List<Announcement> finallist = new ArrayList<Announcement>(); /*if(list!=null && list.isEmpty()==false){ System.out.println("Announcement list after iterating:"+list.size()); for(Announcement a:list){ String qry= expirationQry + " order by enddate DESC "; System.out.println("Qry:"+qry); Announcement ann = (Announcement) DBOperations.getSingleDatabaseObject(Announcement.class, "rootannouncementid= "+a.getRootAnnouncement().getId()); if(ann.isPromotion()==false && ann.isMedia()==true && ann.isDisable()==false && ann.isApproval()==true && ann.getApprovalDate()!=null){ Announcement finalAnn = (Announcement) DBOperations.getSingleDatabaseObject(Announcement.class, "rootannouncementid="+ann.getRootAnnouncement().getId()+qry); if(finalAnn!=null){ finallist.add(finalAnn); System.out.println("Value id:"+finalAnn.getId()+"Adding size:"+finallist.size()); } } } } System.out.println("Announcement list final:"+finallist.size()); Date d2 = new Date(); System.out.println("End Time : " + d2); System.out.println("Processing Time : " + (d2.getTime() - d1.getTime()) / 1000 + " Secs"); return finallist; */ return list; } }
true
6e8deb71ac1b0e4f28c5fa76113cbbf1406dc209
Java
Lipdroid/GomipoiAndroid-master
/app/src/main/java/app/animation/button/ButtonAnimationInterpolator.java
UTF-8
732
2.734375
3
[]
no_license
package app.animation.button; import android.view.animation.Interpolator; /** * ボタンアニメーションのInterpolatorクラス */ public class ButtonAnimationInterpolator implements Interpolator { // ------------------------------ // Override // ------------------------------ @Override public float getInterpolation(float input) { if (input < 0.4f) { return (float) ((Math.cos((2.5f * input + 1f) * Math.PI) / 2.0f) + 0.5f) * 2f; } else if (input < 0.8f) { return (float) ((Math.cos((2.5f * input + 1f) * Math.PI) / 2.0f) + 0.5f) * 1.5f + 0.5f; } return (float) ((Math.cos((2.5f * input + 1f) * Math.PI) / 2.0f) + 0.5f) * 1f + 0.5f; } }
true
29c6dadf33eafc13443b7ca04ffb1b0296e9cec7
Java
adolfoiglesias/oraclecertifiedjse
/src/chapter4/nestedclasses/types/innerclass/Circle.java
UTF-8
1,294
4.28125
4
[]
no_license
/** * */ package chapter4.nestedclasses.types.innerclass; /** * @author Adolfo Miguel Iglesias * */ public class Circle { // define Point as an inner class within Circle class class Point { private int xPos; private int yPos; // you can provide constructor for an inner class like this public Point(int x, int y) { xPos = x; yPos = y; System.out.println(radius); //--> si se peude acceder a los atributos de la clase de afuera } // the inner class is like any other class - you can override methods // here public String toString() { return "(" + xPos + "," + yPos + ")"; } } // make use of the inner class for private Point center; private int radius; public Circle(int x, int y, int r) { // note how to make use of center = this.new Point(x, y); // Constructor de Inner class radius = r; System.out.println(xPos); // -> No se peude acceder a atributos de una inner class } public String toString() { System.out.println(center.xPos + " " + center.yPos); // si se peude acceder a los atributos privados pero siempre a atraves de una objeto return "mid point = " + center + " and radius = " + radius; } public static void main(String[] s) { System.out.println(new Circle(10, 10, 20)); } // other methods such as area are elided }
true
6f8cd87130f516e2f63ff4dfd3f781b0a7748fce
Java
AkashMen10/AndroidProjects
/src/com/kh/assignment/parser/DataParser.java
UTF-8
4,713
2.34375
2
[]
no_license
package com.kh.assignment.parser; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.time.Month; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import com.kh.assignment.utils.FileUtils; public class DataParser { public static List<String> urlList; public void parseData(String url,String dir) { String outputString; try { outputString = FileUtils.saveFileFromUrlWithJavaIO(dir, url); Document doc = Jsoup.parse(outputString); String countries[] = { "UK", "England","Wales","Scotland" }; String param[] = { "Tmax", "Tmin", "Tmean", "Sunshine", "Rainfall" }; urlList = new ArrayList<String>(); for (int countryCnt = 0; countryCnt < countries.length; countryCnt++) { for (int paramCnt = 0; paramCnt < param.length; paramCnt++) { Elements eles = doc.getElementsByAttributeValue("title", countries[countryCnt] + " Date " + param[paramCnt]); Element link = eles.get(0); if (link.attr("href") != null) { urlList.add(link.attr("href")); } } } } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } private static final String NEWLINE = "\n"; private static final String COMMA = ","; public void saveData() { FileOutputStream fos; DataOutputStream dos; BufferedReader bufferedReader = null; BufferedInputStream bis=null; try { fos = new FileOutputStream(new File(FileUtils.dirName+File.separator+"weather.csv")); dos = new DataOutputStream(fos); for (String url : DataParser.urlList) { String downloadedPath = FileUtils.downloadFile(url); File file = new File(downloadedPath); FileInputStream fis = new FileInputStream(file); // DataInputStream bis = new DataInputStream(fis); bis = new BufferedInputStream(fis); bufferedReader = new BufferedReader(new InputStreamReader(bis)); boolean readData = false; String line = ""; line = bufferedReader.readLine(); String param = ""; if (line.contains("Maximum Temperature")) { param = "Max temp"; } else if (line.contains("Minimum Temperature")) { param="Min Temp"; } else if (line.contains("Mean Temperature")) { param="Mean Temp"; } else if (line.contains("Rainfall")) { param="Rainfall"; } else if (line.contains("Sunshine")) { param="Sunshine"; } while ((line = bufferedReader.readLine()) != null) { if (readData) { String columns[]; if(param.contains("Sunshine") || param.contains("Rainfall")) columns = line.split(" "); else columns = line.split(" "); String region = file.getName().split("\\.")[0]; Pattern p = Pattern.compile("-?[\\d.\\d]+"); Matcher m = p.matcher(line.substring(5)); int i = 1; while (m.find()) { StringBuilder record = new StringBuilder(region); record.append(COMMA); record.append(param); record.append(COMMA); record.append(columns[0]); record.append(COMMA); if (i > 12) { break; } String value = m.group().trim(); if (value.equals("")) { value = "NA"; } record.append(Month.of(i).toString().substring(0, 3)).append(COMMA).append(value); dos.writeBytes(record.toString() + NEWLINE); i++; } } else if (line.trim().equals("") || line.trim() == null) { line = bufferedReader.readLine(); if (line.trim().startsWith("Year")) { readData = true; } } } } if(bufferedReader!=null) bufferedReader.close(); if(bis!=null) bis.close(); dos.close(); fos.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
true
99b8ec40fe86da2ce8b73a2e8badf94ca77e898e
Java
hminah0215/java_study
/day1203/Sum.java
UHC
369
3.171875
3
[]
no_license
import java.util.Scanner; class Sum{ public static void main(String []args){ int one; int two; Scanner sc = new Scanner (System.in); System.out.println("ù° ڸ Էϼ."); one = sc.nextInt(); System.out.println("ι° ڸ Էϼ."); two = sc.nextInt(); System.out.println(" " +(one+two)+ "Դϴ."); } }
true