List of usage examples for java.lang Integer intValue
@HotSpotIntrinsicCandidate public int intValue()
From source file:MyCounter.java
public int read(String name) { Integer cval = (Integer) counters.get(name); return (cval == null) ? 0 : cval.intValue(); }
From source file:MyCounter.java
public void incr(org.apache.xalan.extensions.XSLProcessorContext context, org.w3c.dom.Element elem) { String name = elem.getAttribute("name"); Integer cval = (Integer) counters.get(name); int nval = (cval == null) ? 0 : (cval.intValue() + 1); counters.put(name, new Integer(nval)); }
From source file:SimpleTableModel.java
public Main() { this.setDefaultCloseOperation(EXIT_ON_CLOSE); JTable table = new JTable(new SimpleTableModel()); TableRowSorter sorter = new TableRowSorter(table.getModel()); table.setRowSorter(sorter);/*from ww w. ja v a2s .c o m*/ RowFilter<SimpleTableModel, Integer> IDFilter = new RowFilter<SimpleTableModel, Integer>() { @Override public boolean include(Entry<? extends SimpleTableModel, ? extends Integer> entry) { SimpleTableModel model = entry.getModel(); int rowIndex = entry.getIdentifier().intValue(); Integer ID = (Integer) model.getValueAt(rowIndex, 0); if (ID.intValue() <= 100) { return false; // Do not show rows with an ID <= 100 } return true; } }; sorter.setRowFilter(IDFilter); Container contentPane = this.getContentPane(); contentPane.add(new JScrollPane(table), BorderLayout.CENTER); }
From source file:com.topsec.tsm.common.message.CommandHandlerUtil.java
public static Serializable handleGetUserRule(Serializable obj, EventRuleService eventRuleService, EventResponseService eventResponseService) { try {/*from w w w . ja v a2 s .c o m*/ List<EventRule> eventRules = eventRuleService.getEnableRuleInRuleGroup(); if (eventRules != null && eventRules.size() != 0) { final List<EventRuleGroup> eventRuleGroups = eventRuleService.getEnableRuleGroup(); final List<EventRuleDispatch> eventRuleGroupDispatchs = eventRuleService .getEnableEventRuleDispatch(); final List<EventRuleGroupResp> ruleGroupResps = eventRuleService.getAllRuleGroupResp(); final CorrRuleBuilder groupBuilder = new CorrRuleBuilder(); final EventResponseService responseService = eventResponseService; RuleBuilder ruleBuilder = new RuleBuilder() { @Override public Response getReponse(String responseId) { return responseService.getResponse(responseId); } @Override public Rule convertXMLRule(EventRule eventRule) { Rule rule = super.convertXMLRule(eventRule); List<Group> groups = new ArrayList<Group>(); Map<String, Integer> sizeMap = new HashMap<String, Integer>(); if (eventRuleGroups != null) { for (EventRuleDispatch eventRuleDispatch : eventRuleGroupDispatchs) { Integer ruleId = eventRule.getId(); Integer groupId = eventRuleDispatch.getGroupId(); Integer count = sizeMap.get(groupId.toString()); sizeMap.put(groupId.toString(), (count == null ? 1 : ++count)); if (ruleId.intValue() == eventRuleDispatch.getRuleId().intValue()) { Integer order = eventRuleDispatch.getOrder(); String groupName = null; Integer alarmState = 0; Integer priority = 0; String category1 = null; String category2 = null; String desc = null; long timeout = 0; for (EventRuleGroup eventRuleGroup : eventRuleGroups) { if (eventRuleGroup.getGroupId().intValue() == groupId.intValue()) { groupName = eventRuleGroup.getGroupName(); alarmState = eventRuleGroup.getAlarmState(); timeout = eventRuleGroup.getTimeout(); priority = eventRuleGroup.getPriority(); category1 = eventRuleGroup.getCat1id(); category2 = eventRuleGroup.getCat2id(); desc = eventRuleGroup.getDesc(); break; } } if (groupName != null) { groupBuilder.setDispatch(eventRuleDispatch); Integer dtimeout = eventRuleDispatch.getTimeout(); State state = new State(dtimeout); Group group = new Group(groupId.toString(), groupName, order, alarmState, state); group.setTimeout(timeout); group.setPriority(priority == null ? -1 : priority); group.setDesc(desc); groupBuilder.rebuild(group); List<String> respIdList = new ArrayList<String>(); for (EventRuleGroupResp eventRuleGroupResp : ruleGroupResps) { if (eventRuleGroupResp.getGroupId().intValue() == groupId.intValue()) { String responseId = eventRuleGroupResp.getResponseId(); respIdList.add(responseId); } } if (category1 != null) { group.setCategory1(category1); } if (category2 != null) { group.setCategory2(category2); } String[] responseIds = new String[respIdList.size()]; respIdList.toArray(responseIds); group.setResponseIds(responseIds); String[] responsecfgkeys = new String[respIdList.size()]; String[] responsecfgNames = new String[respIdList.size()]; for (int i = 0; i < responseIds.length; i++) { Response response = this.getReponse(responseIds[i]); if (response != null) { responsecfgkeys[i] = response.getCfgKey(); responsecfgNames[i] = response.getName(); } } group.setResponsecfgkeys(responsecfgkeys); group.setResponsecfgNames(responsecfgNames); groups.add(group); } } } for (Group group : groups) { String groupId = group.getGroupId(); Integer size = sizeMap.get(groupId); if (size.intValue() < group.getOrder()) { throw new RuntimeException("![groupId=" + groupId + "],[size=" + size + "],[order=" + group.getOrder() + "]"); } group.setSize(size); } rule.setBelongGroups(groups); } return rule; } }; EventRule[] ruleEventRules = new EventRule[eventRules.size()]; eventRules.toArray(ruleEventRules); ruleBuilder.rebuildEventRule(ruleEventRules); } else { return new ArrayList<EventRule>(); } return (Serializable) eventRules; } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } }
From source file:com.aurel.track.fieldType.fieldChange.converter.StringSetterConverter.java
/** * Convert the string to object value after load * @param value//from ww w . j a v a 2 s . c o m * @param setter * @return */ @Override public Object getActualValueFromStoredString(String value, Integer setter) { if (setter != null) { switch (setter.intValue()) { case FieldChangeSetters.SET_TO: case FieldChangeSetters.ADD_TEXT_TO_BEGIN: case FieldChangeSetters.ADD_TEXT_TO_END: case FieldChangeSetters.ADD_COMMENT: case FieldChangeSetters.REMOVE_TEXT: if (value != null) { return StringEscapeUtils.unescapeXml(value); } } } return null; }
From source file:com.opengamma.analytics.math.function.special.KroneckerDeltaFunction.java
@Override public Integer evaluate(Integer i, Integer j) { Validate.notNull(i, "i"); Validate.notNull(j, "j"); return i.intValue() == j.intValue() ? 1 : 0; }
From source file:com.aurel.track.item.ItemDetailBL.java
private static boolean isTextHistory(Integer fieldID) { boolean result = false; if (fieldID == null) { return false; }/* www . java 2 s.c o m*/ if (fieldID.intValue() == TFieldChangeBean.COMPOUND_HISTORY_FIELD) { result = true; } else { if (fieldID > 0) { IFieldTypeRT fieldTypeRT = FieldTypeManager.getFieldTypeRT(fieldID); if (fieldTypeRT != null && (fieldTypeRT.getValueType() == ValueType.TEXT || fieldTypeRT.getValueType() == ValueType.TEXT)) { result = true; } } } return result; }
From source file:freemarker.GoodsController.java
@RequestMapping(value = "/goods/{id}", method = RequestMethod.DELETE) @ResponseBody//from w ww . j a v a2 s.c o m public List<Good> delete(@PathVariable("id") Integer id) { goods.remove(id.intValue()); return goods; }
From source file:com.pureinfo.srm.project.CardIdGeneratorForNongsheAndGaoxinban.java
protected String[] getTokens(Object[] _params) throws PureException { String sCampus = (String) _params[0]; Integer iOrgId = (Integer) _params[1]; int nOrgId = iOrgId.intValue(); IOrganizationMgr mgr = (IOrganizationMgr) ArkContentHelper.getContentMgrOf(Organization.class); Organization org = (Organization) mgr.lookupById(nOrgId); String sOrgCode = org.getCode(); sOrgCode = StringUtils.rightPad(sOrgCode, 5, '0'); String sPrjType = (String) _params[2]; return new String[] { sCampus, sOrgCode, sPrjType }; }
From source file:freemarker.GoodsController.java
@RequestMapping(value = "/goods/{id}", method = RequestMethod.GET) @ResponseBody//from ww w . jav a 2 s . c o m public Good getOne(@PathVariable("id") Integer id) { return goods.get(id.intValue()); }