List of usage examples for java.lang Integer equals
public boolean equals(Object obj)
From source file:gov.va.vinci.leo.descriptors.LeoAEDescriptorTest.java
@Test public void testSetParameterStringArgs() throws Exception { String name = "myOptTestparam"; LeoAEDescriptor fd = new LeoAEDescriptor("desc.gov.va.vinci.leo.ae.WhitespaceTokenizerDescriptor", true); fd.addParameterSetting(name, false, false, ConfigurationParameter.TYPE_INTEGER, 2); fd.setParameterSetting(name, 16);//from w ww. j av a2 s. c om Integer i = (Integer) fd.getParameterValue(name); assertTrue((i != null) && (i.equals(new Integer(16)))); }
From source file:edu.umich.robot.metamap.MetamapFactory.java
private void gateways(WallDir dir, RectArea.Builder current, Door door) { // create a gateway at the midpoint of the <dir> wall of this room. Gateway gw = current.gateway(dir, door); logger.debug(dir + ": " + gw); for (Integer toId : gw.getTo()) { if (toId.equals(current.getId())) continue; logger.trace("telling " + toId); // Tell connected room about the gateway idsMap.get(toId).gateway(gw);/*from www . jav a 2 s .c o m*/ } }
From source file:org.bozzo.ipplan.web.SubnetController.java
@RequestMapping(method = RequestMethod.POST) public HttpEntity<SubnetResource> addSubnet(@PathVariable @NotNull Integer infraId, @RequestBody @NotNull Subnet subnet) { Preconditions.checkArgument(infraId.equals(subnet.getInfraId())); logger.info("add new subnet: {}", subnet); if (!Netmask.isValidNetmask(subnet.getSize())) { throw new ApiException(ApiError.BAD_NETMASK); } else if (!IpAddress.isNetworkAddress(subnet.getIp(), subnet.getSize())) { throw new ApiException(ApiError.BAD_NETWORK); }//from ww w. j a v a 2 s . c o m Subnet sub = service.save(subnet); return new ResponseEntity<>(assembler.toResource(sub), HttpStatus.CREATED); }
From source file:com.aurel.track.admin.customize.category.CategoryBL.java
/** * Gets the replacement string for delete * @param node/* ww w . jav a 2 s .com*/ * @param errorMessage * @param locale * @return */ static String getReplacementString(String node, String errorMessage, TPersonBean personBean, Locale locale) { CategoryTokens categoryTokens = CategoryTokens.decodeNode(node); String categoryType = categoryTokens.getCategoryType(); Integer repository = categoryTokens.getRepository(); boolean excludePrivate = false; if (repository != null && repository.intValue() != REPOSITORY_TYPE.PRIVATE) { //replacing a non-private only with a non-private: mostly correct although by user specific automail assignments the privat notification filters should not be excluded excludePrivate = true; } Integer type = categoryTokens.getType(); Integer objectID = categoryTokens.getObjectID(); String filterName = null; String replacementWarningLabel = null; String replacementFieldLabel = LocalizeUtil .getLocalizedTextFromApplicationResources("admin.customize.automail.filter.lblReplace", locale); CategoryBaseFacade categoryBaseFacade; if (type.equals(Integer.valueOf(TYPE.LEAF))) { categoryBaseFacade = CategoryFacadeFactory.getInstance().getLeafFacade(categoryType); replacementWarningLabel = replacementFieldLabel; } else { categoryBaseFacade = CategoryFacadeFactory.getInstance().getCategoryFacade(categoryType); replacementWarningLabel = LocalizeUtil.getParametrizedString("common.lbl.below", new Object[] { replacementFieldLabel, LocalizeUtil.getLocalizedTextFromApplicationResources( "admin.customize.queryFilter.lbl.category", locale), }, locale); } ILabelBean labelBean = categoryBaseFacade.getByKey(objectID); Integer projectID = null; if (repository != null && repository.intValue() == REPOSITORY_TYPE.PROJECT) { projectID = categoryBaseFacade.getProjectID(labelBean); } if (labelBean != null) { filterName = labelBean.getLabel(); } List<TreeNode> categoryTree = CategoryPickerBL.getPickerNodesEager(personBean, excludePrivate, false, null, true, projectID, objectID, locale, categoryType); return JSONUtility.createReplacementTreeJSON(true, filterName, replacementWarningLabel, replacementFieldLabel, JSONUtility.getTreeHierarchyJSON(categoryTree, false, true), errorMessage, locale); }
From source file:org.bozzo.ipplan.web.RangeController.java
@RequestMapping(method = RequestMethod.POST, produces = { MediaType.APPLICATION_JSON_VALUE }) public HttpEntity<RangeResource> addRange(@PathVariable Integer infraId, @PathVariable Long zoneId, @RequestBody @NotNull Range range) { Preconditions.checkArgument(infraId.equals(range.getInfraId())); Preconditions.checkArgument(zoneId.equals(range.getZoneId())); if (!Netmask.isValidNetmask(range.getSize())) { throw new ApiException(ApiError.BAD_NETMASK); } else if (!IpAddress.isNetworkAddress(range.getIp(), range.getSize())) { throw new ApiException(ApiError.BAD_NETWORK); }//from w w w. jav a 2 s . c o m logger.info("add new range: {}", range); Range rang = service.save(range); return new ResponseEntity<>(assembler.toResource(rang), HttpStatus.CREATED); }
From source file:ch.ralscha.extdirectspring.provider.RemoteProviderMetadata.java
@ExtDirectMethod(value = ExtDirectMethodType.STORE_READ, group = "metadata") public ExtDirectStoreResult<Row> method5(ExtDirectStoreReadRequest request, Locale locale, @MetadataParam(value = "id", required = false, defaultValue = "20") Integer id) { assertThat(request.getParams().isEmpty()).isTrue(); if (!id.equals(20)) { assertThat(id).isEqualTo(10);/*from w ww . j av a 2s . c o m*/ } else { assertThat(id).isEqualTo(20); } assertThat(locale).isEqualTo(Locale.ENGLISH); return RemoteProviderStoreRead.createExtDirectStoreResult(request, ":" + id + ";" + locale); }
From source file:edu.sjsu.cmpe275.project.service.SearchRoomAvailability.java
public List<Room> query(Date checkinDate, Date checkoutDate, int roomNum, Integer roomType, Boolean smoking) { List<Room> result = new LinkedList<Room>(); //TODO//from w w w.j a v a 2 s. c o m List<Room> rooms = roomDao.getAllRoom(); for (Room r : rooms) { if (roomType != null && !roomType.equals(r.getRoomType())) { continue; } if (smoking != null && !smoking.equals(r.getSmoking())) { continue; } if (isAvailable(r, checkinDate, checkoutDate)) { result.add(r); } } if (result.size() < roomNum) { //No enough vacant room for this query return null; } return result; }
From source file:de.iteratec.iteraplan.model.attribute.EnumAT.java
/** * Retrieves the {@link EnumAV} from the attribute values associated with this enumeration * attribute type specified by the given ID. If no such value exists, {@code null} is returned. * /*from www. ja va 2s. c o m*/ * @param id * The ID of the attribute value to be returned. * @return See method description. */ public EnumAV getAttributeValueById(Integer id) { for (EnumAV av : this.getAttributeValues()) { if (id.equals(av.getId())) { return av; } } return null; }
From source file:ru.codemine.ccms.dao.SalesDAOImpl.java
@Override public Double getMidPriceValueByPeriod(Shop shop, LocalDate startDate, LocalDate endDate) { Double v = getValueByPeriod(shop, startDate, endDate); Integer cq = getCqcountValueByPeriod(shop, startDate, endDate); return cq.equals(0) ? 0.0 : v / cq; }
From source file:gov.va.vinci.leo.descriptors.LeoAEDescriptorTest.java
@Test public void testAddParameterSetting() { LeoAEDescriptor fd = null;// w w w. j ava2 s .c o m try { fd = new LeoAEDescriptor("desc.gov.va.vinci.leo.ae.WhitespaceTokenizerDescriptor", true); } catch (Exception e) { fail("testAddParameterSetting failed creating LeoAEDescriptor" + e.getMessage()); } if (fd != null) { try { String name = "myOptTestparam"; fd.addParameterSetting(name, false, false, ConfigurationParameter.TYPE_INTEGER, 2); Integer i = (Integer) fd.getParameterValue(name); assertTrue((i != null) && (i.equals(new Integer(2)))); fd.addParameterSetting(name, true, true, ConfigurationParameter.TYPE_STRING, 3); i = (Integer) fd.getParameterValue(name); assertTrue((i != null) && (i.equals(new Integer(3)))); } catch (Exception e) { fail("Adding a new parameter failed: " + e.getMessage()); } } //if }