public void startElement(String uri, String localName, String qName, Attributes atts) { logger.log( LogService.LOG_DEBUG, "Here is DesignateHandler:startElement():" //$NON-NLS-1$ + qName); if (!_isParsedDataValid) return; String name = getName(localName, qName); if (name.equalsIgnoreCase(OBJECT)) { ObjectHandler objectHandler = new ObjectHandler(this); objectHandler.init(name, atts); if (objectHandler._isParsedDataValid) { _ocdref = objectHandler._ocdref; } } else { logger.log( LogService.LOG_WARNING, NLS.bind( MetaTypeMsg.UNEXPECTED_ELEMENT, new Object[] { name, atts.getValue(ID), _dp_url, _dp_bundle.getBundleId(), _dp_bundle.getSymbolicName() })); } }
@Override public T get(int objectId) { T object = _cache.get(objectId); if (object != null && _outboundHandler != null && _outboundHandler.getEnabled()) { _outboundHandler.process(object); } return object; }
@Override public boolean set(int objectId, T object, long scn) throws Exception { if (object != null && _inboundHandler != null && _inboundHandler.getEnabled()) { _inboundHandler.process(object); } synchronized (_cache) { return _cache.set(objectId, object, scn); } }
@Override protected void onPositionChanged() { super.onPositionChanged(); final float x = this.getX(); final float y = this.getY(); if (x < 0 || x > GameActivity.WORLD_WIDTH || y < 0 || y > GameActivity.WORLD_HEIGHT) { explosionSoundEvent.set(Sounds.explosion1, x, y); EventBus.dispatch(explosionSoundEvent); explosionEvent.set(x, y); EventBus.dispatch(explosionEvent); ObjectHandler.recycleItem(this); } }
void fireEvent(String key, JsonValue oldVal, JValue newVal, boolean isInit) { assert isInit || (oldVal != null && newVal == null) || (oldVal == null && newVal != null) || !oldVal.toJson().equals(newVal.toString()); ArrayOf<ObjectHandler> handlers = getHandlers(); if (handlers != null && !handlers.isEmpty()) { for (int i = 0, len = handlers.length(); i < len; i++) { ObjectHandler handler = handlers.get(i); if (isInit) { handler.setValue(this); handler.render(this); continue; } if (oldVal == null) { handler.onAdded(key, newVal); } else if (newVal == null) { handler.onRemoved(key, oldVal); } else { handler.onUpdated(key, oldVal, newVal); } } } }
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { tags.add(qName); if (debug) { System.out.println("Start Element: " + qName + " parent: " + getParent()); } dumpAttrs(attributes); lastText = ""; if (qName.equalsIgnoreCase("object") && (getParent().equals("model") || getParent().equals("component"))) { pushHandler(new ObjectHandler(isService)); } else if (qName.equalsIgnoreCase(ParamHandler.TOP_TAG) && getParent().equals("object") && !isAnyChildOf("profile")) { ObjectHandler oh = (ObjectHandler) getHandler(); pushHandler(new ParamHandler((oh != null ? oh.getParam().getName() : ""))); } else if (qName.equalsIgnoreCase(DatatypeHandler.TOP_TAG) && getParent().equals("dm:document")) { pushHandler(new DatatypeHandler()); } else if (qName.equalsIgnoreCase(BibiliographyHandler.TOP_TAG) && getParent().equals("dm:document")) { pushHandler(new BibiliographyHandler()); } else if (qName.equalsIgnoreCase("component")) { if (getParent().equals("import")) { String n = attributes.getValue("name"); dumpTags(); if (n != null) { // TODO really import or maybe do nothing } } else if (getParent().equals("model")) { dumpTags(); String path = attributes.getValue("path"); String ref = attributes.getValue("ref"); if (ref != null && path != null) { List<Parameter> cs = components.get(ref); if (cs != null) { for (Parameter p : cs) { // copy parameters Parameter pc = p.clone(); pc.setName(path + pc.getName()); Parameter.Add(pc); } } } } else { dumpTags(); currentComponent = attributes.getValue("name"); pushHandler(new ComponentHandler()); } } else if (qName.equalsIgnoreCase("model")) { try { isService = attributes.getValue("isService").equals("true"); } catch (NullPointerException e) { } Model.setName(attributes.getValue("name")); } else if (qName.equalsIgnoreCase("import")) { String fname = attributes.getValue("file"); InputStream is = streamProvider.getStream(dirDefault + fname); if (is == null) { String fnameBase = fname.substring(0, fname.length() - 4); fname = fnameBase + "-0.xml"; is = streamProvider.getStream(dirDefault + fname); } try { Parse(is, fname); } catch (Exception e) { e.printStackTrace(); System.out.println("EXCEPTION: (import " + fname + ") " + e.getMessage()); } } else if (qName.equalsIgnoreCase("profile")) { pushHandler(new NullHandler(qName)); } else if (getParent().equals("")) { handlers.clear(); } else { } DefaultHandler h = getHandler(); if (h != null) { h.startElement(uri, localName, qName, attributes); } }
/* */ public void visitCorpus(ObjectHandler<E> handler) /* */ { /* 314 */ for (Iterator i$ = this.mItemList.iterator(); i$.hasNext(); ) { Object e = i$.next(); /* 315 */ handler.handle(e); /* */ } /* */ }
/* */ private void handle(ObjectHandler<E> handler, int start, int end) { /* 359 */ for (int i = start; i < end; i++) /* 360 */ handler.handle(this.mItemList.get(i)); /* */ }