code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { private void findErrorMessages(FacesContext context) { if (context.getMessageList().isEmpty() || context.isValidationFailed()) { return; } for (FacesMessage msg : context.getMessageList()) { if (msg.getSeverity().equals(FacesMessage.SEVERITY_ERROR) || msg.getSeverity().equals(FacesMessage.SEVERITY_FATAL)) { validationFailed(context); break; } } } }
public class class_name { private void findErrorMessages(FacesContext context) { if (context.getMessageList().isEmpty() || context.isValidationFailed()) { return; // depends on control dependency: [if], data = [none] } for (FacesMessage msg : context.getMessageList()) { if (msg.getSeverity().equals(FacesMessage.SEVERITY_ERROR) || msg.getSeverity().equals(FacesMessage.SEVERITY_FATAL)) { validationFailed(context); // depends on control dependency: [if], data = [none] break; } } } }
public class class_name { public UNode toDoc() { // Root node is called "doc". UNode result = UNode.createMapNode("doc"); // Each child of "doc" is a simple VALUE node. for (String fieldName : m_resultFields.keySet()) { // In XML, we want the element name to be "field" when the node name is "_ID". if (fieldName.equals(OBJECT_ID)) { result.addValueNode(fieldName, m_resultFields.get(fieldName), "field"); } else { result.addValueNode(fieldName, m_resultFields.get(fieldName)); } } return result; } }
public class class_name { public UNode toDoc() { // Root node is called "doc". UNode result = UNode.createMapNode("doc"); // Each child of "doc" is a simple VALUE node. for (String fieldName : m_resultFields.keySet()) { // In XML, we want the element name to be "field" when the node name is "_ID". if (fieldName.equals(OBJECT_ID)) { result.addValueNode(fieldName, m_resultFields.get(fieldName), "field"); // depends on control dependency: [if], data = [none] } else { result.addValueNode(fieldName, m_resultFields.get(fieldName)); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { public void initialise() { if (log.isDebugEnabled()) { log.debug("now initialising conf"); } initDecodeUsing(decodeUsing); boolean rulesOk = true; for (int i = 0; i < rules.size(); i++) { final Rule rule = (Rule) rules.get(i); if (!rule.initialise(context)) { // if we failed to initialise anything set the status to bad rulesOk = false; } } for (int i = 0; i < outboundRules.size(); i++) { final OutboundRule outboundRule = (OutboundRule) outboundRules.get(i); if (!outboundRule.initialise(context)) { // if we failed to initialise anything set the status to bad rulesOk = false; } } for (int i = 0; i < catchElems.size(); i++) { final CatchElem catchElem = (CatchElem) catchElems.get(i); if (!catchElem.initialise(context)) { // if we failed to initialise anything set the status to bad rulesOk = false; } } if (rulesOk) { ok = true; } if (log.isDebugEnabled()) { log.debug("conf status " + ok); } } }
public class class_name { public void initialise() { if (log.isDebugEnabled()) { log.debug("now initialising conf"); // depends on control dependency: [if], data = [none] } initDecodeUsing(decodeUsing); boolean rulesOk = true; for (int i = 0; i < rules.size(); i++) { final Rule rule = (Rule) rules.get(i); if (!rule.initialise(context)) { // if we failed to initialise anything set the status to bad rulesOk = false; // depends on control dependency: [if], data = [none] } } for (int i = 0; i < outboundRules.size(); i++) { final OutboundRule outboundRule = (OutboundRule) outboundRules.get(i); if (!outboundRule.initialise(context)) { // if we failed to initialise anything set the status to bad rulesOk = false; // depends on control dependency: [if], data = [none] } } for (int i = 0; i < catchElems.size(); i++) { final CatchElem catchElem = (CatchElem) catchElems.get(i); if (!catchElem.initialise(context)) { // if we failed to initialise anything set the status to bad rulesOk = false; // depends on control dependency: [if], data = [none] } } if (rulesOk) { ok = true; // depends on control dependency: [if], data = [none] } if (log.isDebugEnabled()) { log.debug("conf status " + ok); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void deleteElement(Object parent, String name) { Element element = getElement(parent, name); if (element != null) { Element group = (Element) element.getParentElement(); if (group != null) { deleteRecursively(group, element); } } } }
public class class_name { public void deleteElement(Object parent, String name) { Element element = getElement(parent, name); if (element != null) { Element group = (Element) element.getParentElement(); if (group != null) { deleteRecursively(group, element); // depends on control dependency: [if], data = [(group] } } } }
public class class_name { public static Vector2dfx convert(Tuple2D<?> tuple) { if (tuple instanceof Vector2dfx) { return (Vector2dfx) tuple; } return new Vector2dfx(tuple.getX(), tuple.getY()); } }
public class class_name { public static Vector2dfx convert(Tuple2D<?> tuple) { if (tuple instanceof Vector2dfx) { return (Vector2dfx) tuple; // depends on control dependency: [if], data = [none] } return new Vector2dfx(tuple.getX(), tuple.getY()); } }
public class class_name { public final void registerSession(Session session, EventType event) { if (session.isClosed() && event != EventType.UNREGISTER) { return; } Reactor reactor = (Reactor) session.getAttribute(REACTOR_ATTRIBUTE); if (reactor == null) { reactor = nextReactor(); final Reactor oldReactor = (Reactor) session.setAttributeIfAbsent( REACTOR_ATTRIBUTE, reactor); if (oldReactor != null) { reactor = oldReactor; } } reactor.registerSession(session, event); } }
public class class_name { public final void registerSession(Session session, EventType event) { if (session.isClosed() && event != EventType.UNREGISTER) { return; // depends on control dependency: [if], data = [none] } Reactor reactor = (Reactor) session.getAttribute(REACTOR_ATTRIBUTE); if (reactor == null) { reactor = nextReactor(); // depends on control dependency: [if], data = [none] final Reactor oldReactor = (Reactor) session.setAttributeIfAbsent( REACTOR_ATTRIBUTE, reactor); if (oldReactor != null) { reactor = oldReactor; // depends on control dependency: [if], data = [none] } } reactor.registerSession(session, event); } }
public class class_name { public static int getIsolationLevel(SynchronizationRegistryUOWScope txKey) { ContainerTx ctx = (ContainerTx) txKey.getResource(containerTxResourceKey); if (ctx == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) Tr.event(tc, "ContainerTx is null, returning default"); return com.ibm.websphere.csi.Defaults.DEFAULT_ISOLATION_LEVEL; } else { int isolationLevel = ctx.getIsolationLevel(); // The new code may return NONE, so convert to old default. d107762 if (isolationLevel == java.sql.Connection.TRANSACTION_NONE) isolationLevel = com.ibm.websphere.csi.Defaults.DEFAULT_ISOLATION_LEVEL; return isolationLevel; } } }
public class class_name { public static int getIsolationLevel(SynchronizationRegistryUOWScope txKey) { ContainerTx ctx = (ContainerTx) txKey.getResource(containerTxResourceKey); if (ctx == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) Tr.event(tc, "ContainerTx is null, returning default"); return com.ibm.websphere.csi.Defaults.DEFAULT_ISOLATION_LEVEL; // depends on control dependency: [if], data = [none] } else { int isolationLevel = ctx.getIsolationLevel(); // The new code may return NONE, so convert to old default. d107762 if (isolationLevel == java.sql.Connection.TRANSACTION_NONE) isolationLevel = com.ibm.websphere.csi.Defaults.DEFAULT_ISOLATION_LEVEL; return isolationLevel; // depends on control dependency: [if], data = [none] } } }
public class class_name { public Iterator<E> iterator () { // the crazy sanity checks if (_size < 0 || _size > _entries.length || (_size > 0 && _entries[_size-1] == null)) { log.warning("DSet in a bad way", "size", _size, "entries", _entries, new Exception()); } return new Iterator<E>() { public boolean hasNext () { checkComodification(); return (_index < _size); } public E next () { checkComodification(); return _entries[_index++]; } public void remove () { throw new UnsupportedOperationException(); } protected void checkComodification () { if (_modCount != _expectedModCount) { throw new ConcurrentModificationException(); } if (_ssize != _size) { log.warning("Size changed during iteration", "ssize", _ssize, "nsize", _size, "entries", _entries, new Exception()); } } protected int _index = 0; protected int _ssize = _size; protected int _expectedModCount = _modCount; }; } }
public class class_name { public Iterator<E> iterator () { // the crazy sanity checks if (_size < 0 || _size > _entries.length || (_size > 0 && _entries[_size-1] == null)) { log.warning("DSet in a bad way", "size", _size, "entries", _entries, new Exception()); // depends on control dependency: [if], data = [none] } return new Iterator<E>() { public boolean hasNext () { checkComodification(); return (_index < _size); } public E next () { checkComodification(); return _entries[_index++]; } public void remove () { throw new UnsupportedOperationException(); } protected void checkComodification () { if (_modCount != _expectedModCount) { throw new ConcurrentModificationException(); } if (_ssize != _size) { log.warning("Size changed during iteration", "ssize", _ssize, "nsize", _size, "entries", _entries, new Exception()); // depends on control dependency: [if], data = [none] } } protected int _index = 0; protected int _ssize = _size; protected int _expectedModCount = _modCount; }; } }
public class class_name { @SuppressWarnings("unchecked") protected void initBroadcastInputReaders() throws Exception { final int numBroadcastInputs = this.config.getNumBroadcastInputs(); final MutableReader<?>[] broadcastInputReaders = new MutableReader[numBroadcastInputs]; for (int i = 0; i < this.config.getNumBroadcastInputs(); i++) { // ---------------- create the input readers --------------------- // in case where a logical input unions multiple physical inputs, create a union reader final int groupSize = this.config.getBroadcastGroupSize(i); if (groupSize == 1) { // non-union case broadcastInputReaders[i] = new MutableRecordReader<IOReadableWritable>(this); } else if (groupSize > 1){ // union case MutableRecordReader<IOReadableWritable>[] readers = new MutableRecordReader[groupSize]; for (int j = 0; j < groupSize; ++j) { readers[j] = new MutableRecordReader<IOReadableWritable>(this); } broadcastInputReaders[i] = new MutableUnionRecordReader<IOReadableWritable>(readers); } else { throw new Exception("Illegal input group size in task configuration: " + groupSize); } } this.broadcastInputReaders = broadcastInputReaders; } }
public class class_name { @SuppressWarnings("unchecked") protected void initBroadcastInputReaders() throws Exception { final int numBroadcastInputs = this.config.getNumBroadcastInputs(); final MutableReader<?>[] broadcastInputReaders = new MutableReader[numBroadcastInputs]; for (int i = 0; i < this.config.getNumBroadcastInputs(); i++) { // ---------------- create the input readers --------------------- // in case where a logical input unions multiple physical inputs, create a union reader final int groupSize = this.config.getBroadcastGroupSize(i); if (groupSize == 1) { // non-union case broadcastInputReaders[i] = new MutableRecordReader<IOReadableWritable>(this); } else if (groupSize > 1){ // union case MutableRecordReader<IOReadableWritable>[] readers = new MutableRecordReader[groupSize]; for (int j = 0; j < groupSize; ++j) { readers[j] = new MutableRecordReader<IOReadableWritable>(this); // depends on control dependency: [for], data = [j] } broadcastInputReaders[i] = new MutableUnionRecordReader<IOReadableWritable>(readers); } else { throw new Exception("Illegal input group size in task configuration: " + groupSize); } } this.broadcastInputReaders = broadcastInputReaders; } }
public class class_name { public UpdateTableRequest withGlobalSecondaryIndexUpdates(GlobalSecondaryIndexUpdate... globalSecondaryIndexUpdates) { if (this.globalSecondaryIndexUpdates == null) { setGlobalSecondaryIndexUpdates(new java.util.ArrayList<GlobalSecondaryIndexUpdate>(globalSecondaryIndexUpdates.length)); } for (GlobalSecondaryIndexUpdate ele : globalSecondaryIndexUpdates) { this.globalSecondaryIndexUpdates.add(ele); } return this; } }
public class class_name { public UpdateTableRequest withGlobalSecondaryIndexUpdates(GlobalSecondaryIndexUpdate... globalSecondaryIndexUpdates) { if (this.globalSecondaryIndexUpdates == null) { setGlobalSecondaryIndexUpdates(new java.util.ArrayList<GlobalSecondaryIndexUpdate>(globalSecondaryIndexUpdates.length)); // depends on control dependency: [if], data = [none] } for (GlobalSecondaryIndexUpdate ele : globalSecondaryIndexUpdates) { this.globalSecondaryIndexUpdates.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { @Deprecated public OPropertyImpl dropIndexes() { getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_DELETE); acquireSchemaReadLock(); try { final OIndexManager indexManager = getDatabase().getMetadata().getIndexManager(); final ArrayList<OIndex<?>> relatedIndexes = new ArrayList<OIndex<?>>(); for (final OIndex<?> index : indexManager.getClassIndexes(owner.getName())) { final OIndexDefinition definition = index.getDefinition(); if (OCollections.indexOf(definition.getFields(), globalRef.getName(), new OCaseInsentiveComparator()) > -1) { if (definition instanceof OPropertyIndexDefinition) { relatedIndexes.add(index); } else { throw new IllegalArgumentException( "This operation applicable only for property indexes. " + index.getName() + " is " + index.getDefinition()); } } } for (final OIndex<?> index : relatedIndexes) getDatabase().getMetadata().getIndexManager().dropIndex(index.getName()); return this; } finally { releaseSchemaReadLock(); } } }
public class class_name { @Deprecated public OPropertyImpl dropIndexes() { getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_DELETE); acquireSchemaReadLock(); try { final OIndexManager indexManager = getDatabase().getMetadata().getIndexManager(); final ArrayList<OIndex<?>> relatedIndexes = new ArrayList<OIndex<?>>(); for (final OIndex<?> index : indexManager.getClassIndexes(owner.getName())) { final OIndexDefinition definition = index.getDefinition(); if (OCollections.indexOf(definition.getFields(), globalRef.getName(), new OCaseInsentiveComparator()) > -1) { if (definition instanceof OPropertyIndexDefinition) { relatedIndexes.add(index); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException( "This operation applicable only for property indexes. " + index.getName() + " is " + index.getDefinition()); } } } for (final OIndex<?> index : relatedIndexes) getDatabase().getMetadata().getIndexManager().dropIndex(index.getName()); return this; } finally { releaseSchemaReadLock(); } } }
public class class_name { public ChannelWrapper getChannel(String nodeGroup, NodeType nodeType, String identity) { List<ChannelWrapper> channelWrappers = getChannels(nodeGroup, nodeType); if (channelWrappers != null && channelWrappers.size() != 0) { for (ChannelWrapper channelWrapper : channelWrappers) { if (channelWrapper.getIdentity().equals(identity)) { return channelWrapper; } } } return null; } }
public class class_name { public ChannelWrapper getChannel(String nodeGroup, NodeType nodeType, String identity) { List<ChannelWrapper> channelWrappers = getChannels(nodeGroup, nodeType); if (channelWrappers != null && channelWrappers.size() != 0) { for (ChannelWrapper channelWrapper : channelWrappers) { if (channelWrapper.getIdentity().equals(identity)) { return channelWrapper; // depends on control dependency: [if], data = [none] } } } return null; } }
public class class_name { public void saveAndLeave(final Command leaveCommand) { if (hasPageChanged()) { CmsRpcAction<Long> action = new CmsRpcAction<Long>() { /** * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute() */ @Override public void execute() { if (getData().getDetailContainerPage() != null) { getContainerpageService().saveDetailContainers( getData().getDetailId(), getData().getDetailContainerPage(), getPageContent(), this); } else { getContainerpageService().saveContainerpage( CmsCoreProvider.get().getStructureId(), getPageContent(), this); } } /** * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object) */ @Override protected void onResponse(Long result) { setLoadTime(result); CmsNotification.get().send(Type.NORMAL, Messages.get().key(Messages.GUI_NOTIFICATION_PAGE_SAVED_0)); CmsContainerpageController.get().fireEvent(new CmsContainerpageEvent(EventType.pageSaved)); setPageChanged(false, true); leaveCommand.execute(); } }; action.execute(); } } }
public class class_name { public void saveAndLeave(final Command leaveCommand) { if (hasPageChanged()) { CmsRpcAction<Long> action = new CmsRpcAction<Long>() { /** * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute() */ @Override public void execute() { if (getData().getDetailContainerPage() != null) { getContainerpageService().saveDetailContainers( getData().getDetailId(), getData().getDetailContainerPage(), getPageContent(), this); // depends on control dependency: [if], data = [none] } else { getContainerpageService().saveContainerpage( CmsCoreProvider.get().getStructureId(), getPageContent(), this); // depends on control dependency: [if], data = [none] } } /** * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object) */ @Override protected void onResponse(Long result) { setLoadTime(result); CmsNotification.get().send(Type.NORMAL, Messages.get().key(Messages.GUI_NOTIFICATION_PAGE_SAVED_0)); CmsContainerpageController.get().fireEvent(new CmsContainerpageEvent(EventType.pageSaved)); setPageChanged(false, true); leaveCommand.execute(); } }; action.execute(); // depends on control dependency: [if], data = [none] } } }
public class class_name { static public SimpleUnit factory(String name) { try { return factoryWithExceptions(name); } catch (Exception e) { if (debugParse) System.out.println("Parse " + name + " got Exception " + e); return null; } } }
public class class_name { static public SimpleUnit factory(String name) { try { return factoryWithExceptions(name); // depends on control dependency: [try], data = [none] } catch (Exception e) { if (debugParse) System.out.println("Parse " + name + " got Exception " + e); return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public EEnum getServerState() { if (serverStateEEnum == null) { serverStateEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(44); } return serverStateEEnum; } }
public class class_name { @Override public EEnum getServerState() { if (serverStateEEnum == null) { serverStateEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(44); // depends on control dependency: [if], data = [none] } return serverStateEEnum; } }
public class class_name { void write_attribute_reply(int timeout) { DevError[] errors = null; try { if (timeout==NO_TIMEOUT) dev.write_attribute_reply(id); else dev.write_attribute_reply(id, 0); } catch(AsynReplyNotArrived e) { errors = e.errors; } catch(DevFailed e) { errors = e.errors; } cb.attr_written(new AttrWrittenEvent(dev, names, errors)); } }
public class class_name { void write_attribute_reply(int timeout) { DevError[] errors = null; try { if (timeout==NO_TIMEOUT) dev.write_attribute_reply(id); else dev.write_attribute_reply(id, 0); } catch(AsynReplyNotArrived e) { errors = e.errors; } // depends on control dependency: [catch], data = [none] catch(DevFailed e) { errors = e.errors; } // depends on control dependency: [catch], data = [none] cb.attr_written(new AttrWrittenEvent(dev, names, errors)); } }
public class class_name { public static void writeString(String value, ByteBuffer buf) { if (value == null) { buf.putInt(VoltType.NULL_STRING_LENGTH); return; } byte[] strbytes = value.getBytes(Constants.UTF8ENCODING); int len = strbytes.length; buf.putInt(len); buf.put(strbytes); } }
public class class_name { public static void writeString(String value, ByteBuffer buf) { if (value == null) { buf.putInt(VoltType.NULL_STRING_LENGTH); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } byte[] strbytes = value.getBytes(Constants.UTF8ENCODING); int len = strbytes.length; buf.putInt(len); buf.put(strbytes); } }
public class class_name { public java.util.List<String> getAllocationIds() { if (allocationIds == null) { allocationIds = new com.amazonaws.internal.SdkInternalList<String>(); } return allocationIds; } }
public class class_name { public java.util.List<String> getAllocationIds() { if (allocationIds == null) { allocationIds = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none] } return allocationIds; } }
public class class_name { @Override public final boolean isValid(final String pvalue, final ConstraintValidatorContext pcontext) { if (StringUtils.isEmpty(pvalue)) { return true; } try { // execute regular expression, result doesn't matter "x".matches(pvalue); return true; } catch (final Exception pexception) { // regular expression is invalid return false; } } }
public class class_name { @Override public final boolean isValid(final String pvalue, final ConstraintValidatorContext pcontext) { if (StringUtils.isEmpty(pvalue)) { return true; // depends on control dependency: [if], data = [none] } try { // execute regular expression, result doesn't matter "x".matches(pvalue); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (final Exception pexception) { // regular expression is invalid return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public DescribeRecordResult withRecordOutputs(RecordOutput... recordOutputs) { if (this.recordOutputs == null) { setRecordOutputs(new java.util.ArrayList<RecordOutput>(recordOutputs.length)); } for (RecordOutput ele : recordOutputs) { this.recordOutputs.add(ele); } return this; } }
public class class_name { public DescribeRecordResult withRecordOutputs(RecordOutput... recordOutputs) { if (this.recordOutputs == null) { setRecordOutputs(new java.util.ArrayList<RecordOutput>(recordOutputs.length)); // depends on control dependency: [if], data = [none] } for (RecordOutput ele : recordOutputs) { this.recordOutputs.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static String getProcessPid( Session session, String userName, String grep1, String grep2 ) throws JSchException, IOException { String command = "ps aux | grep \"" + grep1 + "\" | grep -v grep"; String remoteResponseStr = launchACommand(session, command); if (remoteResponseStr.length() == 0) { return null; } List<String> pidsList = new ArrayList<>(); String[] linesSplit = remoteResponseStr.split("\n"); for( String line : linesSplit ) { if (!line.contains(grep2)) { continue; } String[] psSplit = line.split("\\s+"); if (psSplit.length < 3) { throw new JSchException("Could not retrieve process data. Result was: " + line); } String user = psSplit[0]; if (userName != null && !user.equals(userName)) { continue; } String pid = psSplit[1]; try { Integer.parseInt(pid); } catch (Exception e) { throw new JSchException("The pid is invalid: " + pid); } pidsList.add(pid); } if (pidsList.size() > 1) { throw new JSchException("More than one process was identified with the given filters. Check your filters."); } else if (pidsList.size() == 0) { return null; } return pidsList.get(0); } }
public class class_name { public static String getProcessPid( Session session, String userName, String grep1, String grep2 ) throws JSchException, IOException { String command = "ps aux | grep \"" + grep1 + "\" | grep -v grep"; String remoteResponseStr = launchACommand(session, command); if (remoteResponseStr.length() == 0) { return null; } List<String> pidsList = new ArrayList<>(); String[] linesSplit = remoteResponseStr.split("\n"); for( String line : linesSplit ) { if (!line.contains(grep2)) { continue; } String[] psSplit = line.split("\\s+"); if (psSplit.length < 3) { throw new JSchException("Could not retrieve process data. Result was: " + line); } String user = psSplit[0]; if (userName != null && !user.equals(userName)) { continue; } String pid = psSplit[1]; try { Integer.parseInt(pid); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new JSchException("The pid is invalid: " + pid); } // depends on control dependency: [catch], data = [none] pidsList.add(pid); } if (pidsList.size() > 1) { throw new JSchException("More than one process was identified with the given filters. Check your filters."); } else if (pidsList.size() == 0) { return null; } return pidsList.get(0); } }
public class class_name { @Override public EClass getIfcFurniture() { if (ifcFurnitureEClass == null) { ifcFurnitureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(298); } return ifcFurnitureEClass; } }
public class class_name { @Override public EClass getIfcFurniture() { if (ifcFurnitureEClass == null) { ifcFurnitureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(298); // depends on control dependency: [if], data = [none] } return ifcFurnitureEClass; } }
public class class_name { public EClass getIfcElementComponent() { if (ifcElementComponentEClass == null) { ifcElementComponentEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(198); } return ifcElementComponentEClass; } }
public class class_name { public EClass getIfcElementComponent() { if (ifcElementComponentEClass == null) { ifcElementComponentEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(198); // depends on control dependency: [if], data = [none] } return ifcElementComponentEClass; } }
public class class_name { private Set<String> getAllComponentClasses(DeploymentUnit deploymentUnit, CompositeIndex index, WarMetaData metaData, TldsMetaData tldsMetaData) { final Set<String> classes = new HashSet<String>(); getAllComponentClasses(metaData.getMergedJBossWebMetaData(), classes); if (tldsMetaData == null) return classes; if (tldsMetaData.getSharedTlds(deploymentUnit) != null) for (TldMetaData tldMetaData : tldsMetaData.getSharedTlds(deploymentUnit)) { getAllComponentClasses(tldMetaData, classes); } if (tldsMetaData.getTlds() != null) for (Map.Entry<String, TldMetaData> tldMetaData : tldsMetaData.getTlds().entrySet()) { getAllComponentClasses(tldMetaData.getValue(), classes); } getAllAsyncListenerClasses(index, classes); return classes; } }
public class class_name { private Set<String> getAllComponentClasses(DeploymentUnit deploymentUnit, CompositeIndex index, WarMetaData metaData, TldsMetaData tldsMetaData) { final Set<String> classes = new HashSet<String>(); getAllComponentClasses(metaData.getMergedJBossWebMetaData(), classes); if (tldsMetaData == null) return classes; if (tldsMetaData.getSharedTlds(deploymentUnit) != null) for (TldMetaData tldMetaData : tldsMetaData.getSharedTlds(deploymentUnit)) { getAllComponentClasses(tldMetaData, classes); // depends on control dependency: [for], data = [tldMetaData] } if (tldsMetaData.getTlds() != null) for (Map.Entry<String, TldMetaData> tldMetaData : tldsMetaData.getTlds().entrySet()) { getAllComponentClasses(tldMetaData.getValue(), classes); // depends on control dependency: [for], data = [tldMetaData] } getAllAsyncListenerClasses(index, classes); return classes; } }
public class class_name { @RequestMapping(value = "/{notificationId}/events", method = RequestMethod.POST) @ResponseStatus(HttpStatus.CREATED) @ResponseBody public EventDTO createEvent(HttpServletRequest req, HttpServletResponse resp, @PathVariable("notificationId") long notificationId, @RequestBody EventDTO event) { EventDTO dto = restService.createEvent(notificationId, event); if (dto == null) { resp.setStatus(HttpStatus.NOT_FOUND.value()); return null; } String url = getSingleNotificationRESTUrl(req, notificationId) + "/state/" + dto.getId(); resp.addHeader("Location", url); return dto; } }
public class class_name { @RequestMapping(value = "/{notificationId}/events", method = RequestMethod.POST) @ResponseStatus(HttpStatus.CREATED) @ResponseBody public EventDTO createEvent(HttpServletRequest req, HttpServletResponse resp, @PathVariable("notificationId") long notificationId, @RequestBody EventDTO event) { EventDTO dto = restService.createEvent(notificationId, event); if (dto == null) { resp.setStatus(HttpStatus.NOT_FOUND.value()); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } String url = getSingleNotificationRESTUrl(req, notificationId) + "/state/" + dto.getId(); resp.addHeader("Location", url); return dto; } }
public class class_name { Node getNode(Node root) { if (isRoot()) { return root; } Node startNode = root; Matcher pathMatcher = dotWithPreviousChar.matcher(path); int pos = 0; while (pathMatcher.find()) { String step = path.substring(pos, pathMatcher.end() - 1); pos = pathMatcher.end(); startNode = doStep(step, startNode); } startNode = doStep(path.substring(pos), startNode); return startNode; } }
public class class_name { Node getNode(Node root) { if (isRoot()) { return root; // depends on control dependency: [if], data = [none] } Node startNode = root; Matcher pathMatcher = dotWithPreviousChar.matcher(path); int pos = 0; while (pathMatcher.find()) { String step = path.substring(pos, pathMatcher.end() - 1); pos = pathMatcher.end(); // depends on control dependency: [while], data = [none] startNode = doStep(step, startNode); // depends on control dependency: [while], data = [none] } startNode = doStep(path.substring(pos), startNode); return startNode; } }
public class class_name { private boolean commentLinesBefore( String content, int line ) { int offset = _root.getElement( line ).getStartOffset(); // Start of comment not found, nothing to do int startDelimiter = lastIndexOf( content, getStartDelimiter(), offset - 2 ); if( startDelimiter < 0 ) { return false; } // Matching start/end of comment found, nothing to do int endDelimiter = indexOf( content, getEndDelimiter(), startDelimiter ); if( endDelimiter < offset & endDelimiter != -1 ) { return false; } // End of comment not found, highlight the lines setCharacterAttributes( startDelimiter, offset - startDelimiter + 1, _comment, false ); return true; } }
public class class_name { private boolean commentLinesBefore( String content, int line ) { int offset = _root.getElement( line ).getStartOffset(); // Start of comment not found, nothing to do int startDelimiter = lastIndexOf( content, getStartDelimiter(), offset - 2 ); if( startDelimiter < 0 ) { return false; // depends on control dependency: [if], data = [none] } // Matching start/end of comment found, nothing to do int endDelimiter = indexOf( content, getEndDelimiter(), startDelimiter ); if( endDelimiter < offset & endDelimiter != -1 ) { return false; // depends on control dependency: [if], data = [none] } // End of comment not found, highlight the lines setCharacterAttributes( startDelimiter, offset - startDelimiter + 1, _comment, false ); return true; } }
public class class_name { public static final byte[] getBytes(String input) { byte output[] = null; try { if (input != null) { output = input.getBytes("UTF-8"); } } catch (UnsupportedEncodingException e) { // This should not happen. // If it happens, it would be some runtime or operating system issue, so just give up and return null. // ffdc data will be logged automatically. } return output; } }
public class class_name { public static final byte[] getBytes(String input) { byte output[] = null; try { if (input != null) { output = input.getBytes("UTF-8"); // depends on control dependency: [if], data = [none] } } catch (UnsupportedEncodingException e) { // This should not happen. // If it happens, it would be some runtime or operating system issue, so just give up and return null. // ffdc data will be logged automatically. } // depends on control dependency: [catch], data = [none] return output; } }
public class class_name { static final byte[] toHllByteArray(final AbstractHllArray impl, final boolean compact) { int auxBytes = 0; if (impl.tgtHllType == TgtHllType.HLL_4) { final AuxHashMap auxHashMap = impl.getAuxHashMap(); if (auxHashMap != null) { auxBytes = (compact) ? auxHashMap.getCompactSizeBytes() : auxHashMap.getUpdatableSizeBytes(); } else { auxBytes = (compact) ? 0 : 4 << LG_AUX_ARR_INTS[impl.lgConfigK]; } } final int totBytes = HLL_BYTE_ARR_START + impl.getHllByteArrBytes() + auxBytes; final byte[] byteArr = new byte[totBytes]; final WritableMemory wmem = WritableMemory.wrap(byteArr); insertHll(impl, wmem, compact); return byteArr; } }
public class class_name { static final byte[] toHllByteArray(final AbstractHllArray impl, final boolean compact) { int auxBytes = 0; if (impl.tgtHllType == TgtHllType.HLL_4) { final AuxHashMap auxHashMap = impl.getAuxHashMap(); if (auxHashMap != null) { auxBytes = (compact) ? auxHashMap.getCompactSizeBytes() : auxHashMap.getUpdatableSizeBytes(); // depends on control dependency: [if], data = [none] } else { auxBytes = (compact) ? 0 : 4 << LG_AUX_ARR_INTS[impl.lgConfigK]; // depends on control dependency: [if], data = [none] } } final int totBytes = HLL_BYTE_ARR_START + impl.getHllByteArrBytes() + auxBytes; final byte[] byteArr = new byte[totBytes]; final WritableMemory wmem = WritableMemory.wrap(byteArr); insertHll(impl, wmem, compact); return byteArr; } }
public class class_name { @Nullable private TableReportEntry convertToTableReportEntry(Map<String, Object> map, Predicate<String> placementFilter, Predicate<Boolean> droppedFilter, Predicate<Boolean> facadeFilter) { if (Intrinsic.isDeleted(map)) { return null; } final String tableName = Intrinsic.getId(map); List<TableReportEntryTable> tables = Lists.newArrayListWithExpectedSize(map.size()); for (Map.Entry<String, Object> entry : toMap(map.get("tables")).entrySet()) { TableReportEntryTable entryTable = convertToTableReportEntryTable(entry.getKey(), toMap(entry.getValue()), placementFilter, droppedFilter, facadeFilter); if (entryTable != null) { tables.add(entryTable); } } // If all tables were filtered then return null if (tables.isEmpty()) { return null; } return new TableReportEntry(tableName, tables); } }
public class class_name { @Nullable private TableReportEntry convertToTableReportEntry(Map<String, Object> map, Predicate<String> placementFilter, Predicate<Boolean> droppedFilter, Predicate<Boolean> facadeFilter) { if (Intrinsic.isDeleted(map)) { return null; // depends on control dependency: [if], data = [none] } final String tableName = Intrinsic.getId(map); List<TableReportEntryTable> tables = Lists.newArrayListWithExpectedSize(map.size()); for (Map.Entry<String, Object> entry : toMap(map.get("tables")).entrySet()) { TableReportEntryTable entryTable = convertToTableReportEntryTable(entry.getKey(), toMap(entry.getValue()), placementFilter, droppedFilter, facadeFilter); if (entryTable != null) { tables.add(entryTable); // depends on control dependency: [if], data = [(entryTable] } } // If all tables were filtered then return null if (tables.isEmpty()) { return null; // depends on control dependency: [if], data = [none] } return new TableReportEntry(tableName, tables); } }
public class class_name { public String getLocationStr() { if (locationStr == null && location != null) { locationStr = location.toString(); } return locationStr; } }
public class class_name { public String getLocationStr() { if (locationStr == null && location != null) { locationStr = location.toString(); // depends on control dependency: [if], data = [none] } return locationStr; } }
public class class_name { @Override public StateConnection service() { try { StateConnection nextState = _state.service(this); //return StateConnection.CLOSE; return nextState; /* if (_invocation == null && getRequestHttp().parseInvocation()) { if (_invocation == null) { return NextState.CLOSE; } return _invocation.service(this, getResponse()); } else if (_upgrade != null) { return _upgrade.service(); } else if (_invocation != null) { return _invocation.service(this); } else { return StateConnection.CLOSE; } */ } catch (Throwable e) { log.warning(e.toString()); log.log(Level.FINER, e.toString(), e); //e.printStackTrace(); toClose(); return StateConnection.CLOSE_READ_A; } } }
public class class_name { @Override public StateConnection service() { try { StateConnection nextState = _state.service(this); //return StateConnection.CLOSE; return nextState; // depends on control dependency: [try], data = [none] /* if (_invocation == null && getRequestHttp().parseInvocation()) { if (_invocation == null) { return NextState.CLOSE; } return _invocation.service(this, getResponse()); } else if (_upgrade != null) { return _upgrade.service(); } else if (_invocation != null) { return _invocation.service(this); } else { return StateConnection.CLOSE; } */ } catch (Throwable e) { log.warning(e.toString()); log.log(Level.FINER, e.toString(), e); //e.printStackTrace(); toClose(); return StateConnection.CLOSE_READ_A; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private long grow(PrintStream out, List<ItemSet> list, TotalSupportTree ttree, FPTree fptree, int[] itemset, int[] localItemSupport, int[] prefixItemset) { if (fptree == T0) { int nprocs = MulticoreExecutor.getThreadPoolSize(); List<List<HeaderTableItem>> headers = new ArrayList<>(); for (int i = 0; i < 2*nprocs; i++) { headers.add(new ArrayList<>()); } for (int i = fptree.headerTable.length; i-- > 0;) { headers.get(i % headers.size()).add(fptree.headerTable[i]); } List<FPGrowthTask> tasks = new ArrayList<>(); // Loop through header table from end to start, item by item for (int i = 0; i < headers.size(); i++) { // process trail of links from header table element tasks.add(new FPGrowthTask(headers.get(i), out, list, ttree)); } long n = 0; try { List<Long> results = MulticoreExecutor.run(tasks); for (long i : results) { n += i; } } catch (Exception e) { logger.error("Failed to run FPGrowth on multi-core", e); } return n; } else { long n = 0; // Loop through header table from end to start, item by item for (int i = fptree.headerTable.length; i-- > 0;) { n += grow(out, list, ttree, fptree.headerTable[i], itemset, localItemSupport, prefixItemset); } return n; } } }
public class class_name { private long grow(PrintStream out, List<ItemSet> list, TotalSupportTree ttree, FPTree fptree, int[] itemset, int[] localItemSupport, int[] prefixItemset) { if (fptree == T0) { int nprocs = MulticoreExecutor.getThreadPoolSize(); List<List<HeaderTableItem>> headers = new ArrayList<>(); for (int i = 0; i < 2*nprocs; i++) { headers.add(new ArrayList<>()); // depends on control dependency: [for], data = [none] } for (int i = fptree.headerTable.length; i-- > 0;) { headers.get(i % headers.size()).add(fptree.headerTable[i]); // depends on control dependency: [for], data = [i] } List<FPGrowthTask> tasks = new ArrayList<>(); // Loop through header table from end to start, item by item for (int i = 0; i < headers.size(); i++) { // process trail of links from header table element tasks.add(new FPGrowthTask(headers.get(i), out, list, ttree)); // depends on control dependency: [for], data = [i] } long n = 0; try { List<Long> results = MulticoreExecutor.run(tasks); for (long i : results) { n += i; // depends on control dependency: [for], data = [i] } } catch (Exception e) { logger.error("Failed to run FPGrowth on multi-core", e); } // depends on control dependency: [catch], data = [none] return n; // depends on control dependency: [if], data = [none] } else { long n = 0; // Loop through header table from end to start, item by item for (int i = fptree.headerTable.length; i-- > 0;) { n += grow(out, list, ttree, fptree.headerTable[i], itemset, localItemSupport, prefixItemset); // depends on control dependency: [for], data = [i] } return n; // depends on control dependency: [if], data = [none] } } }
public class class_name { public com.google.protobuf.ByteString getCallerIpBytes() { java.lang.Object ref = callerIp_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); callerIp_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } }
public class class_name { public com.google.protobuf.ByteString getCallerIpBytes() { java.lang.Object ref = callerIp_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); callerIp_ = b; // depends on control dependency: [if], data = [none] return b; // depends on control dependency: [if], data = [none] } else { return (com.google.protobuf.ByteString) ref; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void generateError(String response) { final String errorInString = extractParameter(response, ERROR_REGEX_PATTERN, true); final String errorDescription = extractParameter(response, ERROR_DESCRIPTION_REGEX_PATTERN, false); OAuth2Error errorCode; try { errorCode = OAuth2Error.parseFrom(errorInString); } catch (IllegalArgumentException iaE) { //non oauth standard error code errorCode = null; } throw new OAuth2AccessTokenErrorResponse(errorCode, errorDescription, null, response); } }
public class class_name { @Override public void generateError(String response) { final String errorInString = extractParameter(response, ERROR_REGEX_PATTERN, true); final String errorDescription = extractParameter(response, ERROR_DESCRIPTION_REGEX_PATTERN, false); OAuth2Error errorCode; try { errorCode = OAuth2Error.parseFrom(errorInString); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException iaE) { //non oauth standard error code errorCode = null; } // depends on control dependency: [catch], data = [none] throw new OAuth2AccessTokenErrorResponse(errorCode, errorDescription, null, response); } }
public class class_name { public static double getMaskingValueFromConfig(Map<String, Object> layerConfig, KerasLayerConfiguration conf) throws InvalidKerasConfigurationException { Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf); double maskValue = 0.0; if (innerConfig.containsKey(conf.getLAYER_FIELD_MASK_VALUE())) { try { maskValue = (double) innerConfig.get(conf.getLAYER_FIELD_MASK_VALUE()); } catch (Exception e) { log.warn("Couldn't read masking value, default to 0.0"); } } else { throw new InvalidKerasConfigurationException("No mask value found, field " + conf.getLAYER_FIELD_MASK_VALUE()); } return maskValue; } }
public class class_name { public static double getMaskingValueFromConfig(Map<String, Object> layerConfig, KerasLayerConfiguration conf) throws InvalidKerasConfigurationException { Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf); double maskValue = 0.0; if (innerConfig.containsKey(conf.getLAYER_FIELD_MASK_VALUE())) { try { maskValue = (double) innerConfig.get(conf.getLAYER_FIELD_MASK_VALUE()); // depends on control dependency: [try], data = [none] } catch (Exception e) { log.warn("Couldn't read masking value, default to 0.0"); } // depends on control dependency: [catch], data = [none] } else { throw new InvalidKerasConfigurationException("No mask value found, field " + conf.getLAYER_FIELD_MASK_VALUE()); } return maskValue; } }
public class class_name { public static Color valueOf(String color) { Objects.requireNonNull(color, "color"); Throwable cause = null; try { Color hexColor = parseHexString(color); if (hexColor != null) { return hexColor; } else { String upperColor = BasicHelper.toUpperCase(color); Color namedColor = NAME_TO_COLOR_MAP.get(upperColor); if (namedColor != null) { return namedColor; } else if (upperColor.startsWith(ColorModel.RGB.toString())) { Color rgbColor = parseRgb(upperColor); if (rgbColor != null) { return rgbColor; } } else { return GenericColor.valueOf(color).toColor(); } } } catch (NumberFormatException e) { cause = e; } throw new IllegalArgumentException(color, cause); } }
public class class_name { public static Color valueOf(String color) { Objects.requireNonNull(color, "color"); Throwable cause = null; try { Color hexColor = parseHexString(color); if (hexColor != null) { return hexColor; // depends on control dependency: [if], data = [none] } else { String upperColor = BasicHelper.toUpperCase(color); Color namedColor = NAME_TO_COLOR_MAP.get(upperColor); if (namedColor != null) { return namedColor; // depends on control dependency: [if], data = [none] } else if (upperColor.startsWith(ColorModel.RGB.toString())) { Color rgbColor = parseRgb(upperColor); if (rgbColor != null) { return rgbColor; // depends on control dependency: [if], data = [none] } } else { return GenericColor.valueOf(color).toColor(); // depends on control dependency: [if], data = [none] } } } catch (NumberFormatException e) { cause = e; } // depends on control dependency: [catch], data = [none] throw new IllegalArgumentException(color, cause); } }
public class class_name { private static Date parse(String date) { for (int i = 0; i < fmt.length; i++) { try { SimpleDateFormat df = new SimpleDateFormat(fmt[i]); return df.parse(date); } catch (ParseException E) { // keep trying } } throw new IllegalArgumentException(date); } }
public class class_name { private static Date parse(String date) { for (int i = 0; i < fmt.length; i++) { try { SimpleDateFormat df = new SimpleDateFormat(fmt[i]); return df.parse(date); // depends on control dependency: [try], data = [none] } catch (ParseException E) { // keep trying } // depends on control dependency: [catch], data = [none] } throw new IllegalArgumentException(date); } }
public class class_name { private static void validateTags(String[] tagList, ArrayList<String> validList, ArrayList<String> invalidList) { for (String tag : tagList) { tag = tag.trim(); if (tag.contains("\\") || tag.contains(" ") || tag.contains("\n") || tag.contains("-") || tag.equals("")) { invalidList.add(tag); } else { validList.add(tag); } } } }
public class class_name { private static void validateTags(String[] tagList, ArrayList<String> validList, ArrayList<String> invalidList) { for (String tag : tagList) { tag = tag.trim(); // depends on control dependency: [for], data = [tag] if (tag.contains("\\") || tag.contains(" ") || tag.contains("\n") || tag.contains("-") || tag.equals("")) { invalidList.add(tag); // depends on control dependency: [if], data = [none] } else { validList.add(tag); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public Page<T> findAll(final Pageable pageable) { if (pageable == null) { LOGGER.debug("Pageable in findAll(Pageable) is null"); } final ArangoCursor<T> result = findAllInternal(pageable, null, new HashMap<>()); final List<T> content = result.asListRemaining(); return new PageImpl<>(content, pageable, result.getStats().getFullCount()); } }
public class class_name { @Override public Page<T> findAll(final Pageable pageable) { if (pageable == null) { LOGGER.debug("Pageable in findAll(Pageable) is null"); // depends on control dependency: [if], data = [none] } final ArangoCursor<T> result = findAllInternal(pageable, null, new HashMap<>()); final List<T> content = result.asListRemaining(); return new PageImpl<>(content, pageable, result.getStats().getFullCount()); } }
public class class_name { @Override public String[] split(String str) { Matcher matcher = pattern.matcher(str); String[] strings = { "" }; if (matcher.matches()) { int groupCount = matcher.groupCount(); strings = new String[groupCount]; for (int i = 1; i <= groupCount; i++) { strings[i - 1] = matcher.group(i); } } return strings; } }
public class class_name { @Override public String[] split(String str) { Matcher matcher = pattern.matcher(str); String[] strings = { "" }; if (matcher.matches()) { int groupCount = matcher.groupCount(); strings = new String[groupCount]; // depends on control dependency: [if], data = [none] for (int i = 1; i <= groupCount; i++) { strings[i - 1] = matcher.group(i); // depends on control dependency: [for], data = [i] } } return strings; } }
public class class_name { public static LocalCall<Map<String, Xor<Info, List<Info>>>> infoInstalledAllVersions( List<String> attributes, boolean reportErrors, String... packages) { LinkedHashMap<String, Object> kwargs = new LinkedHashMap<>(); kwargs.put("attr", attributes.stream().collect(Collectors.joining(","))); kwargs.put("all_versions", true); if (reportErrors) { kwargs.put("errors", "report"); } return new LocalCall<>("pkg.info_installed", Optional.of(Arrays.asList(packages)), Optional.of(kwargs), new TypeToken<Map<String, Xor<Info, List<Info>>>>(){}); } }
public class class_name { public static LocalCall<Map<String, Xor<Info, List<Info>>>> infoInstalledAllVersions( List<String> attributes, boolean reportErrors, String... packages) { LinkedHashMap<String, Object> kwargs = new LinkedHashMap<>(); kwargs.put("attr", attributes.stream().collect(Collectors.joining(","))); kwargs.put("all_versions", true); if (reportErrors) { kwargs.put("errors", "report"); // depends on control dependency: [if], data = [none] } return new LocalCall<>("pkg.info_installed", Optional.of(Arrays.asList(packages)), Optional.of(kwargs), new TypeToken<Map<String, Xor<Info, List<Info>>>>(){}); } }
public class class_name { public void setResponseTimeRootCauses(java.util.Collection<ResponseTimeRootCause> responseTimeRootCauses) { if (responseTimeRootCauses == null) { this.responseTimeRootCauses = null; return; } this.responseTimeRootCauses = new java.util.ArrayList<ResponseTimeRootCause>(responseTimeRootCauses); } }
public class class_name { public void setResponseTimeRootCauses(java.util.Collection<ResponseTimeRootCause> responseTimeRootCauses) { if (responseTimeRootCauses == null) { this.responseTimeRootCauses = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.responseTimeRootCauses = new java.util.ArrayList<ResponseTimeRootCause>(responseTimeRootCauses); } }
public class class_name { public final void setTemplate() { template = new HashMap(); if (isEventExist()) { template.putAll(events.get(next)); } template.put("event", eventType); } }
public class class_name { public final void setTemplate() { template = new HashMap(); if (isEventExist()) { template.putAll(events.get(next)); // depends on control dependency: [if], data = [none] } template.put("event", eventType); } }
public class class_name { public static boolean validate(Controller controller, String userInputString) { String captchaKey = controller.getCookie(captchaName); if (validate(captchaKey, userInputString)) { controller.removeCookie(captchaName); return true; } return false; } }
public class class_name { public static boolean validate(Controller controller, String userInputString) { String captchaKey = controller.getCookie(captchaName); if (validate(captchaKey, userInputString)) { controller.removeCookie(captchaName); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public void publish(String message, Level level) { try { publish(new LogRecord(level, message)); } catch(BadLocationException e) { throw new RuntimeException("Error writing a log-like message.", e); } } }
public class class_name { public void publish(String message, Level level) { try { publish(new LogRecord(level, message)); // depends on control dependency: [try], data = [none] } catch(BadLocationException e) { throw new RuntimeException("Error writing a log-like message.", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public AstNode parse( final String ddl, final String fileName ) throws ParsingException { CheckArg.isNotEmpty(ddl, "ddl"); RuntimeException firstException = null; // Go through each parser and score the DDL content final Map<DdlParser, Integer> scoreMap = new HashMap<DdlParser, Integer>(this.parsers.size()); final DdlParserScorer scorer = new DdlParserScorer(); for (final DdlParser parser : this.parsers) { try { parser.score(ddl, fileName, scorer); scoreMap.put(parser, scorer.getScore()); } catch (RuntimeException e) { if (firstException == null) { firstException = e; } } finally { scorer.reset(); } } if (scoreMap.isEmpty()) { if (firstException == null) { throw new ParsingException(Position.EMPTY_CONTENT_POSITION, DdlSequencerI18n.errorParsingDdlContent.text(this.parsers.size())); } throw firstException; } // sort the scores final List<Entry<DdlParser, Integer>> scoredParsers = new ArrayList<Entry<DdlParser, Integer>>(scoreMap.entrySet()); Collections.sort(scoredParsers, SORTER); firstException = null; AstNode astRoot = null; for (final Entry<DdlParser, Integer> scoredParser : scoredParsers) { try { final DdlParser parser = scoredParser.getKey(); // create DDL root node astRoot = createDdlStatementsContainer(parser.getId()); // parse parser.parse(ddl, astRoot, null); return astRoot; // successfully parsed } catch (final RuntimeException e) { if (astRoot != null) { astRoot.removeFromParent(); } if (firstException == null) { firstException = e; } } } if (firstException == null) { throw new ParsingException(Position.EMPTY_CONTENT_POSITION, DdlSequencerI18n.errorParsingDdlContent.text()); } throw firstException; } }
public class class_name { public AstNode parse( final String ddl, final String fileName ) throws ParsingException { CheckArg.isNotEmpty(ddl, "ddl"); RuntimeException firstException = null; // Go through each parser and score the DDL content final Map<DdlParser, Integer> scoreMap = new HashMap<DdlParser, Integer>(this.parsers.size()); final DdlParserScorer scorer = new DdlParserScorer(); for (final DdlParser parser : this.parsers) { try { parser.score(ddl, fileName, scorer); // depends on control dependency: [try], data = [none] scoreMap.put(parser, scorer.getScore()); // depends on control dependency: [try], data = [none] } catch (RuntimeException e) { if (firstException == null) { firstException = e; // depends on control dependency: [if], data = [none] } } finally { // depends on control dependency: [catch], data = [none] scorer.reset(); } } if (scoreMap.isEmpty()) { if (firstException == null) { throw new ParsingException(Position.EMPTY_CONTENT_POSITION, DdlSequencerI18n.errorParsingDdlContent.text(this.parsers.size())); } throw firstException; } // sort the scores final List<Entry<DdlParser, Integer>> scoredParsers = new ArrayList<Entry<DdlParser, Integer>>(scoreMap.entrySet()); Collections.sort(scoredParsers, SORTER); firstException = null; AstNode astRoot = null; for (final Entry<DdlParser, Integer> scoredParser : scoredParsers) { try { final DdlParser parser = scoredParser.getKey(); // create DDL root node astRoot = createDdlStatementsContainer(parser.getId()); // parse parser.parse(ddl, astRoot, null); return astRoot; // successfully parsed } catch (final RuntimeException e) { if (astRoot != null) { astRoot.removeFromParent(); } if (firstException == null) { firstException = e; } } } if (firstException == null) { throw new ParsingException(Position.EMPTY_CONTENT_POSITION, DdlSequencerI18n.errorParsingDdlContent.text()); } throw firstException; } }
public class class_name { public void startServer() { server = new Server(httpPort); server.setHandler(wrapHandlers()); if (isWebSocketInClassPath()) { setupForWebSocket(); } try { server.start(); log().info("server started"); Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownRunnable())); if (useStdInShutdown) { // generally for use in IDE via JettyRun, Use CTRL-D in IDE console to shutdown BufferedReader systemIn = new BufferedReader(new InputStreamReader(System.in, "UTF-8")); while((systemIn.readLine()) != null) { // ignore anything except CTRL-D by itself } System.out.println("Shutdown via CTRL-D"); System.exit(0); } } catch (Exception e) { e.printStackTrace(); System.exit(100); } } }
public class class_name { public void startServer() { server = new Server(httpPort); server.setHandler(wrapHandlers()); if (isWebSocketInClassPath()) { setupForWebSocket(); // depends on control dependency: [if], data = [none] } try { server.start(); // depends on control dependency: [try], data = [none] log().info("server started"); // depends on control dependency: [try], data = [none] Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownRunnable())); // depends on control dependency: [try], data = [none] if (useStdInShutdown) { // generally for use in IDE via JettyRun, Use CTRL-D in IDE console to shutdown BufferedReader systemIn = new BufferedReader(new InputStreamReader(System.in, "UTF-8")); while((systemIn.readLine()) != null) { // ignore anything except CTRL-D by itself } System.out.println("Shutdown via CTRL-D"); // depends on control dependency: [if], data = [none] System.exit(0); // depends on control dependency: [if], data = [none] } } catch (Exception e) { e.printStackTrace(); System.exit(100); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private IndexSession getSession(String index, String... columns) throws PersistenceException { IndexSession session = null; String sessionKey = index + Arrays.hashCode(columns); // both index and columns play a role in opening a session try { if (hsClient == null) { hsClient = new HSClientImpl(handlerSocketHost, port, poolSize); } session = indexSessions.get(sessionKey); if (session == null) { session = hsClient.openIndexSession(database, this.getSqlNameForClassName(getEntityClassName()), index, columns); indexSessions.put(sessionKey, session); } return session; } catch (Exception e) { throw new PersistenceException(e); } } }
public class class_name { private IndexSession getSession(String index, String... columns) throws PersistenceException { IndexSession session = null; String sessionKey = index + Arrays.hashCode(columns); // both index and columns play a role in opening a session try { if (hsClient == null) { hsClient = new HSClientImpl(handlerSocketHost, port, poolSize); // depends on control dependency: [if], data = [none] } session = indexSessions.get(sessionKey); // depends on control dependency: [try], data = [none] if (session == null) { session = hsClient.openIndexSession(database, this.getSqlNameForClassName(getEntityClassName()), index, columns); // depends on control dependency: [if], data = [none] indexSessions.put(sessionKey, session); // depends on control dependency: [if], data = [(session] } return session; // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new PersistenceException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { static void parseSkeleton(String skeleton, int[] skeletonFieldWidth) { int PATTERN_CHAR_BASE = 0x41; for ( int i = 0; i < skeleton.length(); ++i ) { ++skeletonFieldWidth[skeleton.charAt(i) - PATTERN_CHAR_BASE]; } } }
public class class_name { static void parseSkeleton(String skeleton, int[] skeletonFieldWidth) { int PATTERN_CHAR_BASE = 0x41; for ( int i = 0; i < skeleton.length(); ++i ) { ++skeletonFieldWidth[skeleton.charAt(i) - PATTERN_CHAR_BASE]; // depends on control dependency: [for], data = [i] } } }
public class class_name { public static Subject getSubject() { if (SUBJECT.get() != null) { return SUBJECT.get().peek(); } else { AccessControlContext acc = AccessController.getContext(); if (System.getSecurityManager() == null) { return Subject.getSubject(acc); } else { return AccessController.doPrivileged((PrivilegedAction<Subject>) () -> Subject.getSubject(acc)); } } } }
public class class_name { public static Subject getSubject() { if (SUBJECT.get() != null) { return SUBJECT.get().peek(); // depends on control dependency: [if], data = [none] } else { AccessControlContext acc = AccessController.getContext(); if (System.getSecurityManager() == null) { return Subject.getSubject(acc); // depends on control dependency: [if], data = [none] } else { return AccessController.doPrivileged((PrivilegedAction<Subject>) () -> Subject.getSubject(acc)); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void changeState(Class<? extends State> next) { Check.notNull(next); final State from = current; if (current != null) { last = current.getClass(); current.exit(); } if (!states.containsKey(next)) { final State state = create(next); states.put(next, state); } current = states.get(next); current.enter(); listeners.forEach(l -> l.notifyStateTransition(from != null ? from.getClass() : null, next)); } }
public class class_name { public void changeState(Class<? extends State> next) { Check.notNull(next); final State from = current; if (current != null) { last = current.getClass(); // depends on control dependency: [if], data = [none] current.exit(); // depends on control dependency: [if], data = [none] } if (!states.containsKey(next)) { final State state = create(next); states.put(next, state); // depends on control dependency: [if], data = [none] } current = states.get(next); current.enter(); listeners.forEach(l -> l.notifyStateTransition(from != null ? from.getClass() : null, next)); } }
public class class_name { @Override public DMatrixRMaj getT(DMatrixRMaj T ) { T = UtilDecompositons_DDRM.checkZeros(T,N,N); T.data[0] = QT.data[0]; for( int i = 1; i < N; i++ ) { T.set(i,i, QT.get(i,i)); double a = QT.get(i-1,i); T.set(i-1,i,a); T.set(i,i-1,a); } if( N > 1 ) { T.data[(N-1)*N+N-1] = QT.data[(N-1)*N+N-1]; T.data[(N-1)*N+N-2] = QT.data[(N-2)*N+N-1]; } return T; } }
public class class_name { @Override public DMatrixRMaj getT(DMatrixRMaj T ) { T = UtilDecompositons_DDRM.checkZeros(T,N,N); T.data[0] = QT.data[0]; for( int i = 1; i < N; i++ ) { T.set(i,i, QT.get(i,i)); // depends on control dependency: [for], data = [i] double a = QT.get(i-1,i); T.set(i-1,i,a); // depends on control dependency: [for], data = [i] T.set(i,i-1,a); // depends on control dependency: [for], data = [i] } if( N > 1 ) { T.data[(N-1)*N+N-1] = QT.data[(N-1)*N+N-1]; // depends on control dependency: [if], data = [none] T.data[(N-1)*N+N-2] = QT.data[(N-2)*N+N-1]; // depends on control dependency: [if], data = [none] } return T; } }
public class class_name { private boolean hasPrintedPackageIndex(PackageElement pkg) { for (PackageElement printedPkg : printedPackageHeaders) { if (utils.getPackageName(pkg).startsWith(utils.parsePackageName(printedPkg))) { return true; } } return false; } }
public class class_name { private boolean hasPrintedPackageIndex(PackageElement pkg) { for (PackageElement printedPkg : printedPackageHeaders) { if (utils.getPackageName(pkg).startsWith(utils.parsePackageName(printedPkg))) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public int intVal(String newVal, int curVal, String name) { int newInt; try { newInt = Integer.parseInt(newVal); } catch (Exception e) { valErrors.add(new IntValError(name, newVal)); newInt = curVal; } return newInt; } }
public class class_name { public int intVal(String newVal, int curVal, String name) { int newInt; try { newInt = Integer.parseInt(newVal); // depends on control dependency: [try], data = [none] } catch (Exception e) { valErrors.add(new IntValError(name, newVal)); newInt = curVal; } // depends on control dependency: [catch], data = [none] return newInt; } }
public class class_name { private static boolean isCallTo(Node n, Node targetMethod) { if (!n.isCall()) { return false; } Node method = n.getFirstChild(); return method.isGetProp() && method.matchesQualifiedName(targetMethod); } }
public class class_name { private static boolean isCallTo(Node n, Node targetMethod) { if (!n.isCall()) { return false; // depends on control dependency: [if], data = [none] } Node method = n.getFirstChild(); return method.isGetProp() && method.matchesQualifiedName(targetMethod); } }
public class class_name { private static String annotateMessage(String message, int pos) { StringBuilder sb = new StringBuilder(message); sb.append('\n'); for (int i = 0; i < pos; i++) { sb.append('-'); } sb.append('^'); return sb.toString(); } }
public class class_name { private static String annotateMessage(String message, int pos) { StringBuilder sb = new StringBuilder(message); sb.append('\n'); for (int i = 0; i < pos; i++) { sb.append('-'); // depends on control dependency: [for], data = [none] } sb.append('^'); return sb.toString(); } }
public class class_name { public static int getfd(FileDescriptor descriptor) { try { return field.getInt(descriptor); } catch (IllegalArgumentException | IllegalAccessException e) { log.warn("Unable to read fd field from java.io.FileDescriptor"); } return -1; } }
public class class_name { public static int getfd(FileDescriptor descriptor) { try { return field.getInt(descriptor); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException | IllegalAccessException e) { log.warn("Unable to read fd field from java.io.FileDescriptor"); } // depends on control dependency: [catch], data = [none] return -1; } }
public class class_name { public Set<K> getUnmatchedKeys() { stateLock.readLock().lock(); try { return new HashSet<K>(this.actualIndices.keySet()); } finally { stateLock.readLock().unlock(); } } }
public class class_name { public Set<K> getUnmatchedKeys() { stateLock.readLock().lock(); try { return new HashSet<K>(this.actualIndices.keySet()); // depends on control dependency: [try], data = [none] } finally { stateLock.readLock().unlock(); } } }
public class class_name { public void add(final D data) { this.container.add(data); // if the size of data is known add the value to the task size if (data instanceof ISizeable) { this.byteSize += ((ISizeable) data).byteSize(); } } }
public class class_name { public void add(final D data) { this.container.add(data); // if the size of data is known add the value to the task size if (data instanceof ISizeable) { this.byteSize += ((ISizeable) data).byteSize(); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected int search(char[] chs, int offset, int tailLen) { if(tailLen == 0) { return -1; } CharNode cn = dic.head(chs[offset]); return search(cn, chs, offset, tailLen); } }
public class class_name { protected int search(char[] chs, int offset, int tailLen) { if(tailLen == 0) { return -1; // depends on control dependency: [if], data = [none] } CharNode cn = dic.head(chs[offset]); return search(cn, chs, offset, tailLen); } }
public class class_name { public java.util.List<String> getEgressOnlyInternetGatewayIds() { if (egressOnlyInternetGatewayIds == null) { egressOnlyInternetGatewayIds = new com.amazonaws.internal.SdkInternalList<String>(); } return egressOnlyInternetGatewayIds; } }
public class class_name { public java.util.List<String> getEgressOnlyInternetGatewayIds() { if (egressOnlyInternetGatewayIds == null) { egressOnlyInternetGatewayIds = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none] } return egressOnlyInternetGatewayIds; } }
public class class_name { private <T> List<T> readCSVByMapHandler(InputStream is, Class<T> clazz) throws IOException, Excel4JException { List<T> records = new ArrayList<>(); List<ExcelHeader> headers = Utils.getHeaderList(clazz); if (null == headers || headers.size() <= 0) { throw new Excel4jReadException("[" + clazz + "] must configuration @ExcelFiled"); } String[] csvHeaders = new String[headers.size()]; for (int i = 0; i < headers.size(); i++) { csvHeaders[i] = headers.get(i).getTitle(); } CSVFormat format = CSVFormat.EXCEL.withHeader(csvHeaders).withSkipHeaderRecord(true); try (Reader read = new InputStreamReader(is, StandardCharsets.UTF_8); CSVParser parser = new CSVParser(read, format)) { for (CSVRecord _parser : parser) { T obj; try { obj = clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new Excel4jReadException(e); } for (ExcelHeader header : headers) { String value = _parser.get(header.getTitle()); Object objectVal; String filed = header.getFiled(); // 读取转换器 if (null != header.getReadConverter() && header.getReadConverter().getClass() != DefaultConvertible.class) { objectVal = header.getReadConverter().execRead(value); } else { // 默认转换 objectVal = Utils.str2TargetClass(value, header.getFiledClazz()); } Utils.copyProperty(obj, filed, objectVal); } records.add(obj); } } return records; } }
public class class_name { private <T> List<T> readCSVByMapHandler(InputStream is, Class<T> clazz) throws IOException, Excel4JException { List<T> records = new ArrayList<>(); List<ExcelHeader> headers = Utils.getHeaderList(clazz); if (null == headers || headers.size() <= 0) { throw new Excel4jReadException("[" + clazz + "] must configuration @ExcelFiled"); } String[] csvHeaders = new String[headers.size()]; for (int i = 0; i < headers.size(); i++) { csvHeaders[i] = headers.get(i).getTitle(); } CSVFormat format = CSVFormat.EXCEL.withHeader(csvHeaders).withSkipHeaderRecord(true); try (Reader read = new InputStreamReader(is, StandardCharsets.UTF_8); CSVParser parser = new CSVParser(read, format)) { for (CSVRecord _parser : parser) { T obj; try { obj = clazz.newInstance(); // depends on control dependency: [try], data = [none] } catch (InstantiationException | IllegalAccessException e) { throw new Excel4jReadException(e); } // depends on control dependency: [catch], data = [none] for (ExcelHeader header : headers) { String value = _parser.get(header.getTitle()); Object objectVal; String filed = header.getFiled(); // 读取转换器 if (null != header.getReadConverter() && header.getReadConverter().getClass() != DefaultConvertible.class) { objectVal = header.getReadConverter().execRead(value); // depends on control dependency: [if], data = [none] } else { // 默认转换 objectVal = Utils.str2TargetClass(value, header.getFiledClazz()); // depends on control dependency: [if], data = [none] } Utils.copyProperty(obj, filed, objectVal); // depends on control dependency: [for], data = [none] } records.add(obj); // depends on control dependency: [for], data = [none] } } return records; } }
public class class_name { public void addValue (int value) { if (value < _minValue) { _buckets[0]++; } else if (value >= _maxValue) { _buckets[_buckets.length-1]++; } else { _buckets[(value-_minValue)/_bucketWidth]++; } _count++; } }
public class class_name { public void addValue (int value) { if (value < _minValue) { _buckets[0]++; // depends on control dependency: [if], data = [none] } else if (value >= _maxValue) { _buckets[_buckets.length-1]++; // depends on control dependency: [if], data = [none] } else { _buckets[(value-_minValue)/_bucketWidth]++; // depends on control dependency: [if], data = [(value] } _count++; } }
public class class_name { public final void rollbackRemoteTransaction(GlobalTransaction gtx) { RpcManager rpcManager = cache.getRpcManager(); CommandsFactory factory = cache.getComponentRegistry().getCommandsFactory(); try { RollbackCommand rollbackCommand = factory.buildRollbackCommand(gtx); rollbackCommand.setTopologyId(rpcManager.getTopologyId()); CompletionStage<Void> cs = rpcManager .invokeCommandOnAll(rollbackCommand, validOnly(), rpcManager.getSyncRpcOptions()); factory.initializeReplicableCommand(rollbackCommand, false); rollbackCommand.invokeAsync().join(); cs.toCompletableFuture().join(); } catch (Throwable throwable) { throw Util.rewrapAsCacheException(throwable); } finally { forgetTransaction(gtx, rpcManager, factory); } } }
public class class_name { public final void rollbackRemoteTransaction(GlobalTransaction gtx) { RpcManager rpcManager = cache.getRpcManager(); CommandsFactory factory = cache.getComponentRegistry().getCommandsFactory(); try { RollbackCommand rollbackCommand = factory.buildRollbackCommand(gtx); rollbackCommand.setTopologyId(rpcManager.getTopologyId()); // depends on control dependency: [try], data = [none] CompletionStage<Void> cs = rpcManager .invokeCommandOnAll(rollbackCommand, validOnly(), rpcManager.getSyncRpcOptions()); factory.initializeReplicableCommand(rollbackCommand, false); // depends on control dependency: [try], data = [none] rollbackCommand.invokeAsync().join(); // depends on control dependency: [try], data = [none] cs.toCompletableFuture().join(); // depends on control dependency: [try], data = [none] } catch (Throwable throwable) { throw Util.rewrapAsCacheException(throwable); } finally { // depends on control dependency: [catch], data = [none] forgetTransaction(gtx, rpcManager, factory); } } }
public class class_name { public void setSettingsRef(String settingsRef) { if (GitTaskUtils.isNullOrBlankString(settingsRef)) { throw new BuildException("Can't set blank git settings reference."); } // no override if (this.settingsRef == null) { this.settingsRef = settingsRef; } } }
public class class_name { public void setSettingsRef(String settingsRef) { if (GitTaskUtils.isNullOrBlankString(settingsRef)) { throw new BuildException("Can't set blank git settings reference."); } // no override if (this.settingsRef == null) { this.settingsRef = settingsRef; // depends on control dependency: [if], data = [none] } } }
public class class_name { protected StringBuilder processLine(String nextElement) { StringBuilder sb = new StringBuilder(nextElement.length() * 2); // this is for the worse case where all elements have to be escaped. for (int j = 0; j < nextElement.length(); j++) { char nextChar = nextElement.charAt(j); processCharacter(sb, nextChar); } return sb; } }
public class class_name { protected StringBuilder processLine(String nextElement) { StringBuilder sb = new StringBuilder(nextElement.length() * 2); // this is for the worse case where all elements have to be escaped. for (int j = 0; j < nextElement.length(); j++) { char nextChar = nextElement.charAt(j); processCharacter(sb, nextChar); // depends on control dependency: [for], data = [none] } return sb; } }
public class class_name { public static void reverse(double[] array, int fromIndex, int toIndex) { checkNotNull(array); checkPositionIndexes(fromIndex, toIndex, array.length); for (int i = fromIndex, j = toIndex - 1; i < j; i++, j--) { double tmp = array[i]; array[i] = array[j]; array[j] = tmp; } } }
public class class_name { public static void reverse(double[] array, int fromIndex, int toIndex) { checkNotNull(array); checkPositionIndexes(fromIndex, toIndex, array.length); for (int i = fromIndex, j = toIndex - 1; i < j; i++, j--) { double tmp = array[i]; array[i] = array[j]; // depends on control dependency: [for], data = [i] array[j] = tmp; // depends on control dependency: [for], data = [none] } } }
public class class_name { public static Driver loadDriver(final URL jarUrl) { final URLClassLoader driverCl = URLClassLoader. newInstance(new URL[] { jarUrl }, null); final Iterator<Driver> iter = ServiceLoader. load(Driver.class, driverCl).iterator(); if (!iter.hasNext()) { System.err.println("No JDBC driver found: " + jarUrl); return null; } // end of if // --- Driver d; while (iter.hasNext()) { d = iter.next(); if (driverCl.equals(d.getClass().getClassLoader())) { return d; // Ignore driver at system classloader // e.g. sun.jdbc.odbc.JdbcOdbcDriver } // end of if } // end of while return null; } }
public class class_name { public static Driver loadDriver(final URL jarUrl) { final URLClassLoader driverCl = URLClassLoader. newInstance(new URL[] { jarUrl }, null); final Iterator<Driver> iter = ServiceLoader. load(Driver.class, driverCl).iterator(); if (!iter.hasNext()) { System.err.println("No JDBC driver found: " + jarUrl); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } // end of if // --- Driver d; while (iter.hasNext()) { d = iter.next(); // depends on control dependency: [while], data = [none] if (driverCl.equals(d.getClass().getClassLoader())) { return d; // Ignore driver at system classloader // depends on control dependency: [if], data = [none] // e.g. sun.jdbc.odbc.JdbcOdbcDriver } // end of if } // end of while return null; } }
public class class_name { static <A> int swap(final TreeNode<A> that, final TreeNode<A> other) { assert that != null; assert other != null; final Random random = RandomRegistry.getRandom(); final ISeq<TreeNode<A>> seq1 = that.breadthFirstStream() .collect(ISeq.toISeq()); final ISeq<TreeNode<A>> seq2 = other.breadthFirstStream() .collect(ISeq.toISeq()); final int changed; if (seq1.length() > 1 && seq2.length() > 1) { final TreeNode<A> n1 = seq1.get(random.nextInt(seq1.length() - 1) + 1); final TreeNode<A> p1 = n1.getParent().orElseThrow(AssertionError::new); final TreeNode<A> n2 = seq2.get(random.nextInt(seq2.length() - 1) + 1); final TreeNode<A> p2 = n2.getParent().orElseThrow(AssertionError::new); final int i1 = p1.getIndex(n1); final int i2 = p2.getIndex(n2); p1.insert(i1, n2.detach()); p2.insert(i2, n1.detach()); changed = 2; } else { changed = 0; } return changed; } }
public class class_name { static <A> int swap(final TreeNode<A> that, final TreeNode<A> other) { assert that != null; assert other != null; final Random random = RandomRegistry.getRandom(); final ISeq<TreeNode<A>> seq1 = that.breadthFirstStream() .collect(ISeq.toISeq()); final ISeq<TreeNode<A>> seq2 = other.breadthFirstStream() .collect(ISeq.toISeq()); final int changed; if (seq1.length() > 1 && seq2.length() > 1) { final TreeNode<A> n1 = seq1.get(random.nextInt(seq1.length() - 1) + 1); final TreeNode<A> p1 = n1.getParent().orElseThrow(AssertionError::new); final TreeNode<A> n2 = seq2.get(random.nextInt(seq2.length() - 1) + 1); final TreeNode<A> p2 = n2.getParent().orElseThrow(AssertionError::new); final int i1 = p1.getIndex(n1); final int i2 = p2.getIndex(n2); p1.insert(i1, n2.detach()); // depends on control dependency: [if], data = [none] p2.insert(i2, n1.detach()); // depends on control dependency: [if], data = [none] changed = 2; // depends on control dependency: [if], data = [none] } else { changed = 0; // depends on control dependency: [if], data = [none] } return changed; } }
public class class_name { public static synchronized List<Class< ? >> locateAll(final String serviceName) { if ( serviceName == null ) { throw new IllegalArgumentException( "serviceName cannot be null" ); } List<Class< ? >> classes = new ArrayList<Class< ? >>(); if ( factories != null ) { List<Callable<Class< ? >>> l = factories.get( serviceName ); if ( l != null ) { for ( Callable<Class< ? >> c : l ) { try { classes.add( c.call() ); } catch ( Exception e ) { } } } } return classes; } }
public class class_name { public static synchronized List<Class< ? >> locateAll(final String serviceName) { if ( serviceName == null ) { throw new IllegalArgumentException( "serviceName cannot be null" ); } List<Class< ? >> classes = new ArrayList<Class< ? >>(); if ( factories != null ) { List<Callable<Class< ? >>> l = factories.get( serviceName ); // depends on control dependency: [if], data = [none] if ( l != null ) { for ( Callable<Class< ? >> c : l ) { try { classes.add( c.call() ); // depends on control dependency: [try], data = [none] } catch ( Exception e ) { } // depends on control dependency: [catch], data = [none] } } } return classes; } }
public class class_name { @Override public String getSignature() { String signature = super.getSignature(); if (signature.indexOf('(') == -1) { return signature; } if (LOGGER.isDebugEnabled()) { LOGGER.debug("Condensing signature [{}]", signature); } int returnTypeSpace = signature.indexOf(" "); StringBuilder sb = new StringBuilder(100); sb.append(signature.substring(0, returnTypeSpace + 1)); // Have to replace ".." to "." for classes generated by guice. e.g. // Object com.cerner.beadledom.health.resource.AvailabilityResource..FastClassByGuice..77b09000.newInstance(int, Object[]) String[] parts = signature.replaceAll("\\.\\.", ".").substring(returnTypeSpace + 1).split("\\."); for (int i = 0; i < parts.length - 2; i++) { // Shorten each package name to only include the first character sb.append(parts[i].charAt(0)).append("."); } sb.append(parts[parts.length - 2]).append(".").append(parts[parts.length - 1]); return sb.toString(); } }
public class class_name { @Override public String getSignature() { String signature = super.getSignature(); if (signature.indexOf('(') == -1) { return signature; // depends on control dependency: [if], data = [none] } if (LOGGER.isDebugEnabled()) { LOGGER.debug("Condensing signature [{}]", signature); } int returnTypeSpace = signature.indexOf(" "); // depends on control dependency: [if], data = [none] StringBuilder sb = new StringBuilder(100); sb.append(signature.substring(0, returnTypeSpace + 1)); // depends on control dependency: [if], data = [none] // Have to replace ".." to "." for classes generated by guice. e.g. // Object com.cerner.beadledom.health.resource.AvailabilityResource..FastClassByGuice..77b09000.newInstance(int, Object[]) String[] parts = signature.replaceAll("\\.\\.", ".").substring(returnTypeSpace + 1).split("\\."); for (int i = 0; i < parts.length - 2; i++) { // Shorten each package name to only include the first character sb.append(parts[i].charAt(0)).append("."); // depends on control dependency: [for], data = [i] } sb.append(parts[parts.length - 2]).append(".").append(parts[parts.length - 1]); // depends on control dependency: [if], data = [none] return sb.toString(); // depends on control dependency: [if], data = [none] } }
public class class_name { public ResultMatcher isObject() { return new AbstractResultMatcher(path, configuration) { public void doMatch(Object actual) { isPresent(actual); Node node = getNode(actual); if (node.getNodeType() != OBJECT) { failOnType(node, "an object"); } } }; } }
public class class_name { public ResultMatcher isObject() { return new AbstractResultMatcher(path, configuration) { public void doMatch(Object actual) { isPresent(actual); Node node = getNode(actual); if (node.getNodeType() != OBJECT) { failOnType(node, "an object"); // depends on control dependency: [if], data = [none] } } }; } }
public class class_name { @SafeVarargs public static <T> T[] deleteAll(final T[] a, int... indices) { N.checkArgNotNull(a, "a"); if (N.isNullOrEmpty(indices)) { return a.clone(); } else if (indices.length == 1) { return delete(a, indices[0]); } indices = indices.clone(); N.sort(indices); return deleteAllBySortedIndices(a, indices); } }
public class class_name { @SafeVarargs public static <T> T[] deleteAll(final T[] a, int... indices) { N.checkArgNotNull(a, "a"); if (N.isNullOrEmpty(indices)) { return a.clone(); // depends on control dependency: [if], data = [none] } else if (indices.length == 1) { return delete(a, indices[0]); // depends on control dependency: [if], data = [none] } indices = indices.clone(); N.sort(indices); return deleteAllBySortedIndices(a, indices); } }
public class class_name { public static <U extends Aggregate> List<Batch<U>> getBatches(List<U> list, int partitionSize) { DataType c = null; for (val u:list) { for (val a:u.getArguments()) { // we'll be comparing to the first array if (c == null && a != null) c = a.dataType(); if (a != null && c != null) Preconditions.checkArgument(c == a.dataType(), "All arguments must have same data type"); } } if (c == null) throw new ND4JIllegalStateException("Can't infer data type from arguments"); List<List<U>> partitions = Lists.partition(list, partitionSize); List<Batch<U>> split = new ArrayList<>(); for (List<U> partition : partitions) { split.add(new Batch<U>(partition)); } return split; } }
public class class_name { public static <U extends Aggregate> List<Batch<U>> getBatches(List<U> list, int partitionSize) { DataType c = null; for (val u:list) { for (val a:u.getArguments()) { // we'll be comparing to the first array if (c == null && a != null) c = a.dataType(); if (a != null && c != null) Preconditions.checkArgument(c == a.dataType(), "All arguments must have same data type"); } } if (c == null) throw new ND4JIllegalStateException("Can't infer data type from arguments"); List<List<U>> partitions = Lists.partition(list, partitionSize); List<Batch<U>> split = new ArrayList<>(); for (List<U> partition : partitions) { split.add(new Batch<U>(partition)); // depends on control dependency: [for], data = [partition] } return split; } }
public class class_name { @Override public void storeCalendar(String name, Calendar calendar, boolean replaceExisting, boolean updateTriggers, JedisCluster jedis) throws JobPersistenceException { final String calendarHashKey = redisSchema.calendarHashKey(name); if (!replaceExisting && jedis.exists(calendarHashKey)) { throw new ObjectAlreadyExistsException(String.format("Calendar with key %s already exists.", calendarHashKey)); } Map<String, String> calendarMap = new HashMap<>(); calendarMap.put(CALENDAR_CLASS, calendar.getClass().getName()); try { calendarMap.put(CALENDAR_JSON, mapper.writeValueAsString(calendar)); } catch (JsonProcessingException e) { throw new JobPersistenceException("Unable to serialize calendar.", e); } jedis.hmset(calendarHashKey, calendarMap); jedis.sadd(redisSchema.calendarsSet(), calendarHashKey); if (updateTriggers) { final String calendarTriggersSetKey = redisSchema.calendarTriggersSetKey(name); Set<String> triggerHashKeys = jedis.smembers(calendarTriggersSetKey); for (String triggerHashKey : triggerHashKeys) { OperableTrigger trigger = retrieveTrigger(redisSchema.triggerKey(triggerHashKey), jedis); long removed = jedis.zrem(redisSchema.triggerStateKey(RedisTriggerState.WAITING), triggerHashKey); trigger.updateWithNewCalendar(calendar, misfireThreshold); if (removed == 1) { setTriggerState(RedisTriggerState.WAITING, (double) trigger.getNextFireTime().getTime(), triggerHashKey, jedis); } } } } }
public class class_name { @Override public void storeCalendar(String name, Calendar calendar, boolean replaceExisting, boolean updateTriggers, JedisCluster jedis) throws JobPersistenceException { final String calendarHashKey = redisSchema.calendarHashKey(name); if (!replaceExisting && jedis.exists(calendarHashKey)) { throw new ObjectAlreadyExistsException(String.format("Calendar with key %s already exists.", calendarHashKey)); } Map<String, String> calendarMap = new HashMap<>(); calendarMap.put(CALENDAR_CLASS, calendar.getClass().getName()); try { calendarMap.put(CALENDAR_JSON, mapper.writeValueAsString(calendar)); } catch (JsonProcessingException e) { throw new JobPersistenceException("Unable to serialize calendar.", e); } jedis.hmset(calendarHashKey, calendarMap); jedis.sadd(redisSchema.calendarsSet(), calendarHashKey); if (updateTriggers) { final String calendarTriggersSetKey = redisSchema.calendarTriggersSetKey(name); Set<String> triggerHashKeys = jedis.smembers(calendarTriggersSetKey); for (String triggerHashKey : triggerHashKeys) { OperableTrigger trigger = retrieveTrigger(redisSchema.triggerKey(triggerHashKey), jedis); long removed = jedis.zrem(redisSchema.triggerStateKey(RedisTriggerState.WAITING), triggerHashKey); trigger.updateWithNewCalendar(calendar, misfireThreshold); if (removed == 1) { setTriggerState(RedisTriggerState.WAITING, (double) trigger.getNextFireTime().getTime(), triggerHashKey, jedis); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public static void checkPackageAccess(String name) { SecurityManager s = System.getSecurityManager(); if (s != null) { String cname = name.replace('/', '.'); if (cname.startsWith("[")) { int b = cname.lastIndexOf('[') + 2; if (b > 1 && b < cname.length()) { cname = cname.substring(b); } } int i = cname.lastIndexOf('.'); if (i != -1) { s.checkPackageAccess(cname.substring(0, i)); } } } }
public class class_name { public static void checkPackageAccess(String name) { SecurityManager s = System.getSecurityManager(); if (s != null) { String cname = name.replace('/', '.'); if (cname.startsWith("[")) { int b = cname.lastIndexOf('[') + 2; if (b > 1 && b < cname.length()) { cname = cname.substring(b); // depends on control dependency: [if], data = [(b] } } int i = cname.lastIndexOf('.'); if (i != -1) { s.checkPackageAccess(cname.substring(0, i)); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public Observable<ServiceResponse<Page<ResourceMetricInner>>> listWorkerPoolInstanceMetricsNextWithServiceResponseAsync(final String nextPageLink) { return listWorkerPoolInstanceMetricsNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Observable<ServiceResponse<Page<ResourceMetricInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricInner>>> call(ServiceResponse<Page<ResourceMetricInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listWorkerPoolInstanceMetricsNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public Observable<ServiceResponse<Page<ResourceMetricInner>>> listWorkerPoolInstanceMetricsNextWithServiceResponseAsync(final String nextPageLink) { return listWorkerPoolInstanceMetricsNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Observable<ServiceResponse<Page<ResourceMetricInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricInner>>> call(ServiceResponse<Page<ResourceMetricInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); // depends on control dependency: [if], data = [none] } return Observable.just(page).concatWith(listWorkerPoolInstanceMetricsNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { protected void pad() throws IOException { if (bytesWritten > 0) { int extra = (int) ( bytesWritten % TarConstants.DATA_BLOCK ); if (extra > 0) { write( new byte[TarConstants.DATA_BLOCK - extra] ); } } } }
public class class_name { protected void pad() throws IOException { if (bytesWritten > 0) { int extra = (int) ( bytesWritten % TarConstants.DATA_BLOCK ); if (extra > 0) { write( new byte[TarConstants.DATA_BLOCK - extra] ); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public Prediction<DynamicAssignment, DynamicAssignment> getBestPredictions(DynamicAssignment dynamicInput, DynamicAssignment dynamicOutput, int numPredictions) { if (!factorGraph.getVariables().isValidAssignment(dynamicInput)) { // Cannot make predictions return Prediction.create(dynamicInput, dynamicOutput, Double.NEGATIVE_INFINITY, new double[0], Collections.<DynamicAssignment> emptyList()); } // Compute max-marginals conditioned on the input Assignment input = factorGraph.getVariables().toAssignment(dynamicInput); FactorGraph conditionalFactorGraph = factorGraph.getFactorGraph(dynamicInput).conditional(input); MaxMarginalSet maxMarginals = marginalCalculator.computeMaxMarginals(conditionalFactorGraph); List<Assignment> bestAssignments = Lists.newArrayList(); try { for (int i = 0; i < numPredictions; i++) { bestAssignments.add(maxMarginals.getNthBestAssignment(i)); } } catch (ZeroProbabilityError e) { // Occurs if all outputs have zero probability under the given assignment. // Safely ignored (setting bestAssignments to the empty list). } // Need marginals in order to compute the true partition function. double logPartitionFunction = Double.NEGATIVE_INFINITY; try { MarginalSet marginals = marginalCalculator.computeMarginals(conditionalFactorGraph); logPartitionFunction = marginals.getLogPartitionFunction(); } catch (ZeroProbabilityError e) { // If this occurs, the factor graph assigns zero probability // to everything given dynamicInput. return Prediction.create(dynamicInput, dynamicOutput, Double.NEGATIVE_INFINITY, new double[0], Collections.<DynamicAssignment>emptyList()); } List<DynamicAssignment> predictedOutputs = Lists.newArrayList(); double[] scores = new double[bestAssignments.size()]; for (int i = 0; i < bestAssignments.size(); i++) { Assignment bestAssignment = bestAssignments.get(i); scores[i] = conditionalFactorGraph.getUnnormalizedLogProbability(bestAssignment) - logPartitionFunction; Assignment outputAssignment = bestAssignment.intersection( getOutputVariables(conditionalFactorGraph, outputVariablePattern)); predictedOutputs.add(factorGraph.getVariables().toDynamicAssignment(outputAssignment, conditionalFactorGraph.getAllVariables())); } double outputScore = Double.NEGATIVE_INFINITY; if (dynamicOutput != null) { DynamicAssignment dynamicInputAndOutput = dynamicInput.union(dynamicOutput); if (factorGraph.getVariables().isValidAssignment(dynamicInputAndOutput)) { Assignment inputAndOutput = factorGraph.getVariables().toAssignment(dynamicInputAndOutput); FactorGraph jointConditioned = factorGraph.getFactorGraph(dynamicInputAndOutput) .conditional(inputAndOutput); try { MarginalSet conditionedMarginals = marginalCalculator.computeMarginals(jointConditioned); outputScore = conditionedMarginals.getLogPartitionFunction() - logPartitionFunction; } catch (ZeroProbabilityError e) { // outputScore is already set as if output had zero probability. } } } return Prediction.create(dynamicInput, dynamicOutput, outputScore, scores, predictedOutputs); } }
public class class_name { @Override public Prediction<DynamicAssignment, DynamicAssignment> getBestPredictions(DynamicAssignment dynamicInput, DynamicAssignment dynamicOutput, int numPredictions) { if (!factorGraph.getVariables().isValidAssignment(dynamicInput)) { // Cannot make predictions return Prediction.create(dynamicInput, dynamicOutput, Double.NEGATIVE_INFINITY, new double[0], Collections.<DynamicAssignment> emptyList()); // depends on control dependency: [if], data = [none] } // Compute max-marginals conditioned on the input Assignment input = factorGraph.getVariables().toAssignment(dynamicInput); FactorGraph conditionalFactorGraph = factorGraph.getFactorGraph(dynamicInput).conditional(input); MaxMarginalSet maxMarginals = marginalCalculator.computeMaxMarginals(conditionalFactorGraph); List<Assignment> bestAssignments = Lists.newArrayList(); try { for (int i = 0; i < numPredictions; i++) { bestAssignments.add(maxMarginals.getNthBestAssignment(i)); // depends on control dependency: [for], data = [i] } } catch (ZeroProbabilityError e) { // Occurs if all outputs have zero probability under the given assignment. // Safely ignored (setting bestAssignments to the empty list). } // depends on control dependency: [catch], data = [none] // Need marginals in order to compute the true partition function. double logPartitionFunction = Double.NEGATIVE_INFINITY; try { MarginalSet marginals = marginalCalculator.computeMarginals(conditionalFactorGraph); logPartitionFunction = marginals.getLogPartitionFunction(); // depends on control dependency: [try], data = [none] } catch (ZeroProbabilityError e) { // If this occurs, the factor graph assigns zero probability // to everything given dynamicInput. return Prediction.create(dynamicInput, dynamicOutput, Double.NEGATIVE_INFINITY, new double[0], Collections.<DynamicAssignment>emptyList()); } // depends on control dependency: [catch], data = [none] List<DynamicAssignment> predictedOutputs = Lists.newArrayList(); double[] scores = new double[bestAssignments.size()]; for (int i = 0; i < bestAssignments.size(); i++) { Assignment bestAssignment = bestAssignments.get(i); scores[i] = conditionalFactorGraph.getUnnormalizedLogProbability(bestAssignment) - logPartitionFunction; // depends on control dependency: [for], data = [i] Assignment outputAssignment = bestAssignment.intersection( getOutputVariables(conditionalFactorGraph, outputVariablePattern)); predictedOutputs.add(factorGraph.getVariables().toDynamicAssignment(outputAssignment, conditionalFactorGraph.getAllVariables())); // depends on control dependency: [for], data = [none] } double outputScore = Double.NEGATIVE_INFINITY; if (dynamicOutput != null) { DynamicAssignment dynamicInputAndOutput = dynamicInput.union(dynamicOutput); if (factorGraph.getVariables().isValidAssignment(dynamicInputAndOutput)) { Assignment inputAndOutput = factorGraph.getVariables().toAssignment(dynamicInputAndOutput); FactorGraph jointConditioned = factorGraph.getFactorGraph(dynamicInputAndOutput) .conditional(inputAndOutput); try { MarginalSet conditionedMarginals = marginalCalculator.computeMarginals(jointConditioned); outputScore = conditionedMarginals.getLogPartitionFunction() - logPartitionFunction; // depends on control dependency: [try], data = [none] } catch (ZeroProbabilityError e) { // outputScore is already set as if output had zero probability. } // depends on control dependency: [catch], data = [none] } } return Prediction.create(dynamicInput, dynamicOutput, outputScore, scores, predictedOutputs); } }
public class class_name { public PMSession registerSession(String sessionId) { synchronized (sessions) { if (sessionId != null) { if (!sessions.containsKey(sessionId)) { sessions.put(sessionId, new PMSession(sessionId)); } return getSession(sessionId); } else { return registerSession(newSessionId()); } } } }
public class class_name { public PMSession registerSession(String sessionId) { synchronized (sessions) { if (sessionId != null) { if (!sessions.containsKey(sessionId)) { sessions.put(sessionId, new PMSession(sessionId)); // depends on control dependency: [if], data = [none] } return getSession(sessionId); // depends on control dependency: [if], data = [(sessionId] } else { return registerSession(newSessionId()); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void keyPressed(KeyEvent evt) { if (evt.getKeyCode() == KeyEvent.VK_ENTER) { boolean bDoTab = true; int iTextLength = m_control.getDocument().getLength(); if (((m_control.getSelectionStart() == 0) || (m_control.getSelectionStart() == iTextLength)) && ((m_control.getSelectionEnd() == 0) || (m_control.getSelectionEnd() == iTextLength))) bDoTab = true; else bDoTab = false; // Not fully selected, definitely process this key if (bDoTab) { if (m_bDirty) bDoTab = false; // Data changed, definetly process this key } if (evt.getKeyCode() == KeyEvent.VK_ENTER) if (!bDoTab) return; // Do not consume... process the return in the control evt.consume(); // Don't process the tab as an input character... tab to the next/prev field. this.transferFocus(); // Move focus to next component return; } m_bDirty = true; } }
public class class_name { public void keyPressed(KeyEvent evt) { if (evt.getKeyCode() == KeyEvent.VK_ENTER) { boolean bDoTab = true; int iTextLength = m_control.getDocument().getLength(); if (((m_control.getSelectionStart() == 0) || (m_control.getSelectionStart() == iTextLength)) && ((m_control.getSelectionEnd() == 0) || (m_control.getSelectionEnd() == iTextLength))) bDoTab = true; else bDoTab = false; // Not fully selected, definitely process this key if (bDoTab) { if (m_bDirty) bDoTab = false; // Data changed, definetly process this key } if (evt.getKeyCode() == KeyEvent.VK_ENTER) if (!bDoTab) return; // Do not consume... process the return in the control evt.consume(); // Don't process the tab as an input character... tab to the next/prev field. // depends on control dependency: [if], data = [none] this.transferFocus(); // Move focus to next component // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } m_bDirty = true; } }
public class class_name { protected void openPopup() { if (m_cmsPopup == null) { m_cmsPopup = new CmsPopup(Messages.get().key(Messages.GUI_DIALOG_CATEGORIES_TITLE_0), CmsPopup.WIDE_WIDTH); m_cmsCategoryTree = new CmsCategoryTree(m_selected, 300, m_isSingleValue, m_resultList, m_collapsed); m_cmsPopup.add(m_cmsCategoryTree); m_cmsPopup.setModal(false); m_cmsPopup.setAutoHideEnabled(true); m_cmsPopup.addCloseHandler(new CloseHandler<PopupPanel>() { public void onClose(CloseEvent<PopupPanel> event) { closePopup(); } }); m_cmsPopup.addDialogClose(new Command() { public void execute() { // do nothing all will done in onClose(); } }); } if (m_previewHandlerRegistration != null) { m_previewHandlerRegistration.removeHandler(); } m_previewHandlerRegistration = Event.addNativePreviewHandler(new CloseEventPreviewHandler()); m_cmsCategoryTree.truncate("CATEGORIES", CmsPopup.WIDE_WIDTH - 20); m_cmsPopup.showRelativeTo(m_categoryField); m_xcoordspopup = m_cmsPopup.getPopupLeft(); m_ycoordspopup = m_cmsPopup.getPopupTop(); } }
public class class_name { protected void openPopup() { if (m_cmsPopup == null) { m_cmsPopup = new CmsPopup(Messages.get().key(Messages.GUI_DIALOG_CATEGORIES_TITLE_0), CmsPopup.WIDE_WIDTH); // depends on control dependency: [if], data = [none] m_cmsCategoryTree = new CmsCategoryTree(m_selected, 300, m_isSingleValue, m_resultList, m_collapsed); // depends on control dependency: [if], data = [none] m_cmsPopup.add(m_cmsCategoryTree); // depends on control dependency: [if], data = [none] m_cmsPopup.setModal(false); // depends on control dependency: [if], data = [none] m_cmsPopup.setAutoHideEnabled(true); // depends on control dependency: [if], data = [none] m_cmsPopup.addCloseHandler(new CloseHandler<PopupPanel>() { public void onClose(CloseEvent<PopupPanel> event) { closePopup(); } }); // depends on control dependency: [if], data = [none] m_cmsPopup.addDialogClose(new Command() { public void execute() { // do nothing all will done in onClose(); } }); // depends on control dependency: [if], data = [none] } if (m_previewHandlerRegistration != null) { m_previewHandlerRegistration.removeHandler(); // depends on control dependency: [if], data = [none] } m_previewHandlerRegistration = Event.addNativePreviewHandler(new CloseEventPreviewHandler()); m_cmsCategoryTree.truncate("CATEGORIES", CmsPopup.WIDE_WIDTH - 20); m_cmsPopup.showRelativeTo(m_categoryField); m_xcoordspopup = m_cmsPopup.getPopupLeft(); m_ycoordspopup = m_cmsPopup.getPopupTop(); } }
public class class_name { public void setTree(final TreeNode<ChartData> TREE) { if (null != tree) { getTreeNode().flattened().forEach(node -> node.removeAllTreeNodeEventListeners()); } tree.set(TREE); getTreeNode().flattened().forEach(node -> node.setOnTreeNodeEvent(e -> redraw())); prepareData(); if (isAutoTextColor()) { adjustTextColors(); } drawChart(); } }
public class class_name { public void setTree(final TreeNode<ChartData> TREE) { if (null != tree) { getTreeNode().flattened().forEach(node -> node.removeAllTreeNodeEventListeners()); } // depends on control dependency: [if], data = [none] tree.set(TREE); getTreeNode().flattened().forEach(node -> node.setOnTreeNodeEvent(e -> redraw())); prepareData(); if (isAutoTextColor()) { adjustTextColors(); } // depends on control dependency: [if], data = [none] drawChart(); } }
public class class_name { public static GooglePaymentConfiguration fromJson(JSONObject json) { if (json == null) { json = new JSONObject(); } GooglePaymentConfiguration googlePaymentConfiguration = new GooglePaymentConfiguration(); googlePaymentConfiguration.mEnabled = json.optBoolean(ENABLED_KEY, false); googlePaymentConfiguration.mGoogleAuthorizationFingerprint = Json.optString(json, GOOGLE_AUTHORIZATION_FINGERPRINT_KEY, null); googlePaymentConfiguration.mEnvironment = Json.optString(json, ENVIRONMENT_KEY, null); googlePaymentConfiguration.mDisplayName = Json.optString(json, DISPLAY_NAME_KEY, ""); JSONArray supportedNetworks = json.optJSONArray(SUPPORTED_NETWORKS_KEY); if (supportedNetworks != null) { googlePaymentConfiguration.mSupportedNetworks = new String[supportedNetworks.length()]; for (int i = 0; i < supportedNetworks.length(); i++) { try { googlePaymentConfiguration.mSupportedNetworks[i] = supportedNetworks.getString(i); } catch (JSONException ignored) {} } } else { googlePaymentConfiguration.mSupportedNetworks = new String[0]; } return googlePaymentConfiguration; } }
public class class_name { public static GooglePaymentConfiguration fromJson(JSONObject json) { if (json == null) { json = new JSONObject(); // depends on control dependency: [if], data = [none] } GooglePaymentConfiguration googlePaymentConfiguration = new GooglePaymentConfiguration(); googlePaymentConfiguration.mEnabled = json.optBoolean(ENABLED_KEY, false); googlePaymentConfiguration.mGoogleAuthorizationFingerprint = Json.optString(json, GOOGLE_AUTHORIZATION_FINGERPRINT_KEY, null); googlePaymentConfiguration.mEnvironment = Json.optString(json, ENVIRONMENT_KEY, null); googlePaymentConfiguration.mDisplayName = Json.optString(json, DISPLAY_NAME_KEY, ""); JSONArray supportedNetworks = json.optJSONArray(SUPPORTED_NETWORKS_KEY); if (supportedNetworks != null) { googlePaymentConfiguration.mSupportedNetworks = new String[supportedNetworks.length()]; // depends on control dependency: [if], data = [none] for (int i = 0; i < supportedNetworks.length(); i++) { try { googlePaymentConfiguration.mSupportedNetworks[i] = supportedNetworks.getString(i); // depends on control dependency: [try], data = [none] } catch (JSONException ignored) {} // depends on control dependency: [catch], data = [none] } } else { googlePaymentConfiguration.mSupportedNetworks = new String[0]; // depends on control dependency: [if], data = [none] } return googlePaymentConfiguration; } }
public class class_name { public List<IGosuAnnotation> getAnnotations() { ArrayList<IGosuAnnotation> annotations = new ArrayList<IGosuAnnotation>(); if( _dfsGetter != null ) { annotations.addAll( _dfsGetter.getAnnotations() ); } if( _dfsSetter != null && !pureVarBasedProperty() ) { annotations.addAll( _dfsSetter.getAnnotations() ); } return annotations; } }
public class class_name { public List<IGosuAnnotation> getAnnotations() { ArrayList<IGosuAnnotation> annotations = new ArrayList<IGosuAnnotation>(); if( _dfsGetter != null ) { annotations.addAll( _dfsGetter.getAnnotations() ); // depends on control dependency: [if], data = [( _dfsGetter] } if( _dfsSetter != null && !pureVarBasedProperty() ) { annotations.addAll( _dfsSetter.getAnnotations() ); // depends on control dependency: [if], data = [( _dfsSetter] } return annotations; } }
public class class_name { @Override public void paint(final RenderContext renderContext) { if (!DebugUtil.isDebugFeaturesEnabled() || !(renderContext instanceof WebXmlRenderContext)) { getBackingComponent().paint(renderContext); return; } AjaxOperation operation = AjaxHelper.getCurrentOperation(); if (operation == null) { getBackingComponent().paint(renderContext); return; } getBackingComponent().paint(renderContext); XmlStringBuilder xml = ((WebXmlRenderContext) renderContext).getWriter(); xml.appendTag("ui:debug"); for (String targetId : operation.getTargets()) { ComponentWithContext target = WebUtilities.getComponentById(targetId, true); if (target != null) { writeDebugInfo(target.getComponent(), xml); } } xml.appendEndTag("ui:debug"); } }
public class class_name { @Override public void paint(final RenderContext renderContext) { if (!DebugUtil.isDebugFeaturesEnabled() || !(renderContext instanceof WebXmlRenderContext)) { getBackingComponent().paint(renderContext); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } AjaxOperation operation = AjaxHelper.getCurrentOperation(); if (operation == null) { getBackingComponent().paint(renderContext); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } getBackingComponent().paint(renderContext); XmlStringBuilder xml = ((WebXmlRenderContext) renderContext).getWriter(); xml.appendTag("ui:debug"); for (String targetId : operation.getTargets()) { ComponentWithContext target = WebUtilities.getComponentById(targetId, true); if (target != null) { writeDebugInfo(target.getComponent(), xml); // depends on control dependency: [if], data = [(target] } } xml.appendEndTag("ui:debug"); } }
public class class_name { private void addRecords(HBaseDataWrapper columnWrapper, List<HBaseDataWrapper> embeddableData, List<HBaseDataWrapper> dataSet) { dataSet.add(columnWrapper); if (!embeddableData.isEmpty()) { dataSet.addAll(embeddableData); } } }
public class class_name { private void addRecords(HBaseDataWrapper columnWrapper, List<HBaseDataWrapper> embeddableData, List<HBaseDataWrapper> dataSet) { dataSet.add(columnWrapper); if (!embeddableData.isEmpty()) { dataSet.addAll(embeddableData); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public boolean controlEvents(EventModel eventModel) { if (level.compareTo(PresenceIndicatorLevel.WEAK) >= 0) { return present; } else //noinspection SimplifiableIfStatement if (level.compareTo(PresenceIndicatorLevel.WEAK) < 0 && mostVague.get()) { return present; } else { return true; } } }
public class class_name { @Override public boolean controlEvents(EventModel eventModel) { if (level.compareTo(PresenceIndicatorLevel.WEAK) >= 0) { return present; // depends on control dependency: [if], data = [none] } else //noinspection SimplifiableIfStatement if (level.compareTo(PresenceIndicatorLevel.WEAK) < 0 && mostVague.get()) { return present; // depends on control dependency: [if], data = [none] } else { return true; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void addObject(DigitalObject obj) { // CURRENT TIME: // Get the current time to use for created dates on object // and object components (if they are not already there). Date nowUTC = new Date(); // DOReplicator replicator=(DOReplicator) // m_server.getModule("org.fcrepo.server.storage.replication.DOReplicator"); DOManager manager = (DOManager) m_server .getModule("org.fcrepo.server.storage.DOManager"); FieldSearch fieldSearch = (FieldSearch) m_server .getModule("org.fcrepo.server.search.FieldSearch"); PIDGenerator pidGenerator = (PIDGenerator) m_server .getModule("org.fcrepo.server.management.PIDGenerator"); // SET OBJECT PROPERTIES: logger.debug("Rebuild: Setting object/component states and create dates if unset..."); // set object state to "A" (Active) if not already set if (obj.getState() == null || obj.getState().isEmpty()) { obj.setState("A"); } // set object create date to UTC if not already set if (obj.getCreateDate() == null) { obj.setCreateDate(nowUTC); } // set object last modified date to UTC obj.setLastModDate(nowUTC); // SET OBJECT PROPERTIES: logger.debug("Rebuild: Setting object/component states and create dates if unset..."); // set object state to "A" (Active) if not already set if (obj.getState() == null || obj.getState().isEmpty()) { obj.setState("A"); } // set object create date to UTC if not already set if (obj.getCreateDate() == null) { obj.setCreateDate(nowUTC); } // set object last modified date to UTC obj.setLastModDate(nowUTC); // SET DATASTREAM PROPERTIES... Iterator<String> dsIter = obj.datastreamIdIterator(); while (dsIter.hasNext()) { for (Datastream ds : obj.datastreams(dsIter.next())) { // Set create date to UTC if not already set if (ds.DSCreateDT == null) { ds.DSCreateDT = nowUTC; } // Set state to "A" (Active) if not already set if (ds.DSState == null || ds.DSState.isEmpty()) { ds.DSState = "A"; } } } // PID GENERATION: // have the system generate a PID if one was not provided logger.debug("INGEST: Stream contained PID with retainable namespace-id... will use PID from stream."); try { pidGenerator.neverGeneratePID(obj.getPid()); } catch (IOException e) { throw new RuntimeException("Error calling pidGenerator.neverGeneratePID(): " + e.getMessage(), e); } // REGISTRY: // at this point the object is valid, so make a record // of it in the digital object registry try { registerObject(obj); } catch (StorageDeviceException e) { // continue past individual errors logger.error(e.getMessage()); } try { logger.info("COMMIT: Attempting replication: {}", obj.getPid()); DOReader reader = manager.getReader(Server.USE_DEFINITIVE_STORE, m_context, obj.getPid()); logger.info("COMMIT: Updating FieldSearch indexes..."); fieldSearch.update(reader); } catch (ServerException se) { System.out.println("Error while replicating: " + se.getClass().getName() + ": " + se.getMessage()); se.printStackTrace(); } catch (Throwable th) { System.out.println("Error while replicating: " + th.getClass().getName() + ": " + th.getMessage()); th.printStackTrace(); } } }
public class class_name { @Override public void addObject(DigitalObject obj) { // CURRENT TIME: // Get the current time to use for created dates on object // and object components (if they are not already there). Date nowUTC = new Date(); // DOReplicator replicator=(DOReplicator) // m_server.getModule("org.fcrepo.server.storage.replication.DOReplicator"); DOManager manager = (DOManager) m_server .getModule("org.fcrepo.server.storage.DOManager"); FieldSearch fieldSearch = (FieldSearch) m_server .getModule("org.fcrepo.server.search.FieldSearch"); PIDGenerator pidGenerator = (PIDGenerator) m_server .getModule("org.fcrepo.server.management.PIDGenerator"); // SET OBJECT PROPERTIES: logger.debug("Rebuild: Setting object/component states and create dates if unset..."); // set object state to "A" (Active) if not already set if (obj.getState() == null || obj.getState().isEmpty()) { obj.setState("A"); // depends on control dependency: [if], data = [none] } // set object create date to UTC if not already set if (obj.getCreateDate() == null) { obj.setCreateDate(nowUTC); // depends on control dependency: [if], data = [none] } // set object last modified date to UTC obj.setLastModDate(nowUTC); // SET OBJECT PROPERTIES: logger.debug("Rebuild: Setting object/component states and create dates if unset..."); // set object state to "A" (Active) if not already set if (obj.getState() == null || obj.getState().isEmpty()) { obj.setState("A"); // depends on control dependency: [if], data = [none] } // set object create date to UTC if not already set if (obj.getCreateDate() == null) { obj.setCreateDate(nowUTC); // depends on control dependency: [if], data = [none] } // set object last modified date to UTC obj.setLastModDate(nowUTC); // SET DATASTREAM PROPERTIES... Iterator<String> dsIter = obj.datastreamIdIterator(); while (dsIter.hasNext()) { for (Datastream ds : obj.datastreams(dsIter.next())) { // Set create date to UTC if not already set if (ds.DSCreateDT == null) { ds.DSCreateDT = nowUTC; // depends on control dependency: [if], data = [none] } // Set state to "A" (Active) if not already set if (ds.DSState == null || ds.DSState.isEmpty()) { ds.DSState = "A"; // depends on control dependency: [if], data = [none] } } } // PID GENERATION: // have the system generate a PID if one was not provided logger.debug("INGEST: Stream contained PID with retainable namespace-id... will use PID from stream."); try { pidGenerator.neverGeneratePID(obj.getPid()); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new RuntimeException("Error calling pidGenerator.neverGeneratePID(): " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] // REGISTRY: // at this point the object is valid, so make a record // of it in the digital object registry try { registerObject(obj); // depends on control dependency: [try], data = [none] } catch (StorageDeviceException e) { // continue past individual errors logger.error(e.getMessage()); } // depends on control dependency: [catch], data = [none] try { logger.info("COMMIT: Attempting replication: {}", obj.getPid()); DOReader reader = manager.getReader(Server.USE_DEFINITIVE_STORE, m_context, obj.getPid()); logger.info("COMMIT: Updating FieldSearch indexes..."); fieldSearch.update(reader); } catch (ServerException se) { System.out.println("Error while replicating: " + se.getClass().getName() + ": " + se.getMessage()); se.printStackTrace(); } catch (Throwable th) { System.out.println("Error while replicating: " + th.getClass().getName() + ": " + th.getMessage()); th.printStackTrace(); } } }
public class class_name { public final <I extends AI18nName<?, ?>, T extends AItemSpecifics<?, ?>> void updateForItemSpecificsList( final Map<String, Object> pReqVars, final List<T> pOutdGdSpList, final SettingsAdd pSettingsAdd, final GoodsInListLuv pGoodsInListLuv, final TradingSettings pTradingSettings, final Class<I> pI18nItemClass, final EShopItemType pItemType) throws Exception { if (pOutdGdSpList.size() == 0) { //Beige ORM may return empty list return; } @SuppressWarnings("unchecked") List<IHasIdLongVersionName> itemsForSpecifics = (List<IHasIdLongVersionName>) pReqVars.get("itemsForSpecifics"); pReqVars.remove("itemsForSpecifics"); @SuppressWarnings("unchecked") Set<Long> htmlTemplatesIds = (Set<Long>) pReqVars.get("htmlTemplatesIds"); pReqVars.remove("htmlTemplatesIds"); List<HtmlTemplate> htmlTemplates = null; List<ItemInList> itemsInList = null; List<I18nChooseableSpecifics> i18nChooseableSpecificsLst = null; List<I18nSpecificsOfItemGroup> i18nSpecificsOfItemGroupLst = null; List<I18nSpecificsOfItem> i18nSpecificsOfItemLst = null; List<I> i18nItemLst = null; List<I18nSpecificInList> i18nSpecificInListLst = null; List<I18nUnitOfMeasure> i18nUomLst = null; try { this.srvDatabase.setIsAutocommit(false); this.srvDatabase. setTransactionIsolation(ISrvDatabase.TRANSACTION_READ_UNCOMMITTED); this.srvDatabase.beginTransaction(); StringBuffer itemsIdsIn = new StringBuffer("("); boolean isFirst = true; for (IHasIdLongVersionName it : itemsForSpecifics) { if (isFirst) { isFirst = false; } else { itemsIdsIn.append(", "); } itemsIdsIn.append(it.getItsId().toString()); } itemsIdsIn.append(")"); itemsInList = getSrvOrm().retrieveListWithConditions(pReqVars, ItemInList.class, "where ITSTYPE=" + pItemType.ordinal() + " and ITEMID in " + itemsIdsIn.toString()); if (htmlTemplatesIds.size() > 0) { StringBuffer whereStr = new StringBuffer("where ITSID in ("); isFirst = true; for (Long id : htmlTemplatesIds) { if (isFirst) { isFirst = false; } else { whereStr.append(", "); } whereStr.append(id.toString()); } whereStr.append(")"); htmlTemplates = getSrvOrm().retrieveListWithConditions(pReqVars, HtmlTemplate.class, whereStr.toString()); } if (pTradingSettings.getUseAdvancedI18n()) { i18nItemLst = retrieveI18nItem(pReqVars, pI18nItemClass, itemsIdsIn.toString()); if (i18nItemLst.size() > 0) { i18nSpecificInListLst = getSrvOrm().retrieveListWithConditions(pReqVars, I18nSpecificInList.class, "where ITSTYPE=" + pItemType.ordinal() + " and ITEMID in " + itemsIdsIn.toString()); StringBuffer specGrIdIn = null; StringBuffer specChIdIn = null; StringBuffer specIdIn = new StringBuffer("("); isFirst = true; boolean isFirstGr = true; boolean isFirstCh = true; for (AItemSpecifics<?, ?> gs : pOutdGdSpList) { if (isFirst) { isFirst = false; } else { specIdIn.append(", "); } specIdIn.append(gs.getSpecifics().getItsId().toString()); if (gs.getSpecifics().getItsGroop() != null) { if (isFirstGr) { specGrIdIn = new StringBuffer("("); isFirstGr = false; } else { specGrIdIn.append(", "); } specGrIdIn.append(gs.getSpecifics().getItsGroop().getItsId().toString()); } if (gs.getSpecifics().getItsType().equals(ESpecificsItemType.CHOOSEABLE_SPECIFICS)) { if (isFirstCh) { specChIdIn = new StringBuffer("("); isFirstCh = false; } else { specChIdIn.append(", "); } specChIdIn.append(gs.getLongValue1().toString()); } } specIdIn.append(")"); if (specGrIdIn != null) { specGrIdIn.append(")"); } if (specChIdIn != null) { specChIdIn.append(")"); } pReqVars.put("I18nSpecificsOfItemhasNamedeepLevel", 1); pReqVars.put("I18nSpecificsOfItemlangdeepLevel", 1); i18nSpecificsOfItemLst = getSrvOrm().retrieveListWithConditions(pReqVars, I18nSpecificsOfItem.class, "where HASNAME in " + specIdIn.toString()); pReqVars.remove("I18nSpecificsOfItemhasNamedeepLevel"); pReqVars.remove("I18nSpecificsOfItemlangdeepLevel"); pReqVars.put("I18nUnitOfMeasurehasNamedeepLevel", 1); pReqVars.put("I18nUnitOfMeasurelangdeepLevel", 1); i18nUomLst = getSrvOrm().retrieveList(pReqVars, I18nUnitOfMeasure.class); pReqVars.remove("I18nUnitOfMeasurehasNamedeepLevel"); pReqVars.remove("I18nUnitOfMeasurelangdeepLevel"); if (specGrIdIn != null) { pReqVars.put("I18nSpecificsOfItemGrouphasNamedeepLevel", 1); pReqVars.put("I18nSpecificsOfItemGrouplangdeepLevel", 1); i18nSpecificsOfItemGroupLst = getSrvOrm().retrieveListWithConditions(pReqVars, I18nSpecificsOfItemGroup.class, "where HASNAME in " + specGrIdIn.toString()); pReqVars.remove("I18nSpecificsOfItemGrouphasNamedeepLevel"); pReqVars.remove("I18nSpecificsOfItemGrouplangdeepLevel"); } if (specChIdIn != null) { pReqVars.put("I18nChooseableSpecificshasNamedeepLevel", 1); pReqVars.put("I18nChooseableSpecificslangdeepLevel", 1); i18nChooseableSpecificsLst = getSrvOrm().retrieveListWithConditions(pReqVars, I18nChooseableSpecifics.class, "where HASNAME in " + specChIdIn.toString()); pReqVars.remove("I18nChooseableSpecificshasNamedeepLevel"); pReqVars.remove("I18nChooseableSpecificslangdeepLevel"); } } } } catch (Exception ex) { if (!this.srvDatabase.getIsAutocommit()) { this.srvDatabase.rollBackTransaction(); } throw ex; } finally { this.srvDatabase.releaseResources(); } if (htmlTemplates != null && htmlTemplates.size() > 0) { for (AItemSpecifics<?, ?> gs : pOutdGdSpList) { if (gs.getSpecifics().getTempHtml() != null) { gs.getSpecifics().setTempHtml( findTemplate(htmlTemplates, gs.getSpecifics().getTempHtml().getItsId())); } if (gs.getSpecifics().getItsGroop() != null) { if (gs.getSpecifics().getItsGroop().getTemplateStart() != null) { gs.getSpecifics().getItsGroop().setTemplateStart(findTemplate(htmlTemplates, gs.getSpecifics().getItsGroop().getTemplateStart().getItsId())); } if (gs.getSpecifics().getItsGroop().getTemplateEnd() != null) { gs.getSpecifics().getItsGroop().setTemplateEnd(findTemplate(htmlTemplates, gs.getSpecifics().getItsGroop().getTemplateEnd().getItsId())); } if (gs.getSpecifics().getItsGroop().getTemplateStart() != null) { gs.getSpecifics().getItsGroop().setTemplateDetail(findTemplate(htmlTemplates, gs.getSpecifics().getItsGroop().getTemplateDetail().getItsId())); } } } } int steps = itemsForSpecifics.size() / pSettingsAdd.getRecordsPerTransaction(); int currentStep = 1; Long lastUpdatedVersion = null; do { try { this.srvDatabase.setIsAutocommit(false); this.srvDatabase.setTransactionIsolation(ISrvDatabase.TRANSACTION_READ_UNCOMMITTED); this.srvDatabase.beginTransaction(); int stepLen = Math.min(itemsForSpecifics.size(), currentStep * pSettingsAdd.getRecordsPerTransaction()); for (int i = (currentStep - 1) * pSettingsAdd.getRecordsPerTransaction(); i < stepLen; i++) { IHasIdLongVersionName item = itemsForSpecifics.get(i); ItemInList itemInList = findItemInListFor(itemsInList, item.getItsId(), pItemType); if (itemInList == null) { itemInList = createItemInList(pReqVars, item); } int j = findFirstIdxFor(pOutdGdSpList, item); SpecificsOfItemGroup specificsOfItemGroupWas = null; //reset any way: itemInList.setItsName(item.getItsName()); itemInList.setDetailsMethod(null); itemInList.setImageUrl(null); //i18n: List<I18nSpecificInList> i18nSpInLsLstFg = null; if (i18nItemLst != null) { for (I i18nItem : i18nItemLst) { if (i18nSpInLsLstFg == null) { i18nSpInLsLstFg = new ArrayList<I18nSpecificInList>(); } if (i18nItem.getHasName().getItsId().equals(item.getItsId())) { I18nSpecificInList i18nspInLs = findI18nSpecificInListFor(i18nSpecificInListLst, item, pItemType, i18nItem.getLang()); if (i18nspInLs == null) { i18nspInLs = new I18nSpecificInList(); i18nspInLs.setIsNew(true); i18nspInLs.setItsType(pItemType); i18nspInLs.setItemId(item.getItsId()); i18nspInLs.setLang(i18nItem.getLang()); } i18nspInLs.setItsName(i18nItem.getItsName()); i18nSpInLsLstFg.add(i18nspInLs); } } } if (pSettingsAdd.getSpecHtmlStart() != null) { itemInList.setSpecificInList(pSettingsAdd.getSpecHtmlStart()); if (i18nSpInLsLstFg != null) { for (I18nSpecificInList i18nspInLs : i18nSpInLsLstFg) { i18nspInLs.setSpecificInList(pSettingsAdd.getSpecHtmlStart()); } } } else { itemInList.setSpecificInList(""); if (i18nSpInLsLstFg != null) { for (I18nSpecificInList i18nspInLs : i18nSpInLsLstFg) { i18nspInLs.setSpecificInList(""); } } } boolean wasGrStart = false; do { if (pOutdGdSpList.get(j).getSpecifics().getIsShowInList()) { if (pOutdGdSpList.get(j).getSpecifics().getItsType().equals(ESpecificsItemType.IMAGE)) { itemInList.setImageUrl(pOutdGdSpList.get(j).getStringValue1()); } else { // build ItemInList.specificInList: if (pOutdGdSpList.get(j).getSpecifics().getItsGroop() == null || specificsOfItemGroupWas == null || !pOutdGdSpList.get(j).getSpecifics().getItsGroop().getItsId().equals(specificsOfItemGroupWas.getItsId())) { if (wasGrStart) { if (pSettingsAdd.getSpecGrSeparator() != null && pSettingsAdd.getSpecGrHtmlEnd() != null) { itemInList.setSpecificInList(itemInList.getSpecificInList() + pSettingsAdd.getSpecGrHtmlEnd() + pSettingsAdd.getSpecGrSeparator()); } else if (pSettingsAdd.getSpecGrHtmlEnd() != null) { itemInList.setSpecificInList(itemInList.getSpecificInList() + pSettingsAdd.getSpecGrHtmlEnd()); } else if (pSettingsAdd.getSpecGrSeparator() != null) { itemInList.setSpecificInList(itemInList.getSpecificInList() + pSettingsAdd.getSpecGrSeparator()); } } wasGrStart = true; if (pSettingsAdd.getSpecGrHtmlStart() != null) { itemInList.setSpecificInList(itemInList.getSpecificInList() + pSettingsAdd.getSpecGrHtmlStart()); if (i18nSpInLsLstFg != null) { for (I18nSpecificInList i18nspInLs : i18nSpInLsLstFg) { i18nspInLs.setSpecificInList(i18nspInLs.getSpecificInList() + pSettingsAdd.getSpecGrHtmlStart()); } } } if (pOutdGdSpList.get(j).getSpecifics().getItsGroop() != null && pOutdGdSpList.get(j).getSpecifics().getItsGroop().getTemplateStart() != null) { String grst = pOutdGdSpList.get(j).getSpecifics().getItsGroop().getTemplateStart() .getHtmlTemplate().replace(":SPECGRNM", pOutdGdSpList.get(j).getSpecifics().getItsGroop().getItsName()); itemInList.setSpecificInList(itemInList.getSpecificInList() + grst); if (i18nSpInLsLstFg != null) { for (I18nSpecificInList i18nspInLs : i18nSpInLsLstFg) { String gn = findI18nSpecGrName(i18nSpecificsOfItemGroupLst, pOutdGdSpList.get(j).getSpecifics().getItsGroop(), i18nspInLs.getLang()); grst = pOutdGdSpList.get(j).getSpecifics().getItsGroop().getTemplateStart() .getHtmlTemplate().replace(":SPECGRNM", gn); i18nspInLs.setSpecificInList(i18nspInLs.getSpecificInList() + grst); } } } } updateGoodsSpecificsInList(pReqVars, pSettingsAdd, pOutdGdSpList.get(j), itemInList, specificsOfItemGroupWas, i18nSpInLsLstFg, i18nSpecificsOfItemLst, i18nChooseableSpecificsLst, i18nUomLst); specificsOfItemGroupWas = pOutdGdSpList.get(j).getSpecifics().getItsGroop(); } } else { itemInList.setDetailsMethod(1); } j++; } while (j < pOutdGdSpList.size() && pOutdGdSpList.get(j).getItem().getItsId().equals(item.getItsId())); if (pSettingsAdd.getSpecGrHtmlEnd() != null) { itemInList.setSpecificInList(itemInList.getSpecificInList() + pSettingsAdd.getSpecGrHtmlEnd()); if (i18nSpInLsLstFg != null) { for (I18nSpecificInList i18nspInLs : i18nSpInLsLstFg) { i18nspInLs.setSpecificInList(i18nspInLs.getSpecificInList() + pSettingsAdd.getSpecGrHtmlEnd()); } } } if (pSettingsAdd.getSpecHtmlEnd() != null) { itemInList.setSpecificInList(itemInList.getSpecificInList() + pSettingsAdd.getSpecHtmlEnd()); if (i18nSpInLsLstFg != null) { for (I18nSpecificInList i18nspInLs : i18nSpInLsLstFg) { i18nspInLs.setSpecificInList(i18nspInLs.getSpecificInList() + pSettingsAdd.getSpecHtmlEnd()); } } } if (itemInList.getIsNew()) { getSrvOrm().insertEntity(pReqVars, itemInList); } else { getSrvOrm().updateEntity(pReqVars, itemInList); } if (i18nSpInLsLstFg != null) { for (I18nSpecificInList i18nspInLs : i18nSpInLsLstFg) { if (i18nspInLs.getIsNew()) { getSrvOrm().insertEntity(pReqVars, i18nspInLs); } else { getSrvOrm().updateEntity(pReqVars, i18nspInLs); } } } //item holds item-specifics version lastUpdatedVersion = item.getItsVersion(); } if (pItemType.equals(EShopItemType.GOODS)) { pGoodsInListLuv.setGoodsSpecificLuv(lastUpdatedVersion); } else if (pItemType.equals(EShopItemType.SERVICE)) { pGoodsInListLuv.setServiceSpecificLuv(lastUpdatedVersion); } else if (pItemType.equals(EShopItemType.SEGOODS)) { pGoodsInListLuv.setSeGoodSpecificLuv(lastUpdatedVersion); } else if (pItemType.equals(EShopItemType.SESERVICE)) { pGoodsInListLuv.setSeServiceSpecificLuv(lastUpdatedVersion); } else { throw new Exception("NYI for " + pItemType); } getSrvOrm().updateEntity(pReqVars, pGoodsInListLuv); this.srvDatabase.commitTransaction(); } catch (Exception ex) { if (!this.srvDatabase.getIsAutocommit()) { this.srvDatabase.rollBackTransaction(); } throw ex; } finally { this.srvDatabase.releaseResources(); } } while (currentStep++ < steps); } }
public class class_name { public final <I extends AI18nName<?, ?>, T extends AItemSpecifics<?, ?>> void updateForItemSpecificsList( final Map<String, Object> pReqVars, final List<T> pOutdGdSpList, final SettingsAdd pSettingsAdd, final GoodsInListLuv pGoodsInListLuv, final TradingSettings pTradingSettings, final Class<I> pI18nItemClass, final EShopItemType pItemType) throws Exception { if (pOutdGdSpList.size() == 0) { //Beige ORM may return empty list return; } @SuppressWarnings("unchecked") List<IHasIdLongVersionName> itemsForSpecifics = (List<IHasIdLongVersionName>) pReqVars.get("itemsForSpecifics"); pReqVars.remove("itemsForSpecifics"); @SuppressWarnings("unchecked") Set<Long> htmlTemplatesIds = (Set<Long>) pReqVars.get("htmlTemplatesIds"); pReqVars.remove("htmlTemplatesIds"); List<HtmlTemplate> htmlTemplates = null; List<ItemInList> itemsInList = null; List<I18nChooseableSpecifics> i18nChooseableSpecificsLst = null; List<I18nSpecificsOfItemGroup> i18nSpecificsOfItemGroupLst = null; List<I18nSpecificsOfItem> i18nSpecificsOfItemLst = null; List<I> i18nItemLst = null; List<I18nSpecificInList> i18nSpecificInListLst = null; List<I18nUnitOfMeasure> i18nUomLst = null; try { this.srvDatabase.setIsAutocommit(false); this.srvDatabase. setTransactionIsolation(ISrvDatabase.TRANSACTION_READ_UNCOMMITTED); this.srvDatabase.beginTransaction(); StringBuffer itemsIdsIn = new StringBuffer("("); boolean isFirst = true; for (IHasIdLongVersionName it : itemsForSpecifics) { if (isFirst) { isFirst = false; // depends on control dependency: [if], data = [none] } else { itemsIdsIn.append(", "); // depends on control dependency: [if], data = [none] } itemsIdsIn.append(it.getItsId().toString()); } itemsIdsIn.append(")"); itemsInList = getSrvOrm().retrieveListWithConditions(pReqVars, ItemInList.class, "where ITSTYPE=" + pItemType.ordinal() + " and ITEMID in " + itemsIdsIn.toString()); if (htmlTemplatesIds.size() > 0) { StringBuffer whereStr = new StringBuffer("where ITSID in ("); isFirst = true; for (Long id : htmlTemplatesIds) { if (isFirst) { isFirst = false; // depends on control dependency: [if], data = [none] } else { whereStr.append(", "); // depends on control dependency: [if], data = [none] } whereStr.append(id.toString()); } whereStr.append(")"); htmlTemplates = getSrvOrm().retrieveListWithConditions(pReqVars, HtmlTemplate.class, whereStr.toString()); } if (pTradingSettings.getUseAdvancedI18n()) { i18nItemLst = retrieveI18nItem(pReqVars, pI18nItemClass, itemsIdsIn.toString()); if (i18nItemLst.size() > 0) { i18nSpecificInListLst = getSrvOrm().retrieveListWithConditions(pReqVars, I18nSpecificInList.class, "where ITSTYPE=" + pItemType.ordinal() + " and ITEMID in " + itemsIdsIn.toString()); StringBuffer specGrIdIn = null; StringBuffer specChIdIn = null; StringBuffer specIdIn = new StringBuffer("("); isFirst = true; boolean isFirstGr = true; boolean isFirstCh = true; for (AItemSpecifics<?, ?> gs : pOutdGdSpList) { if (isFirst) { isFirst = false; } else { specIdIn.append(", "); } specIdIn.append(gs.getSpecifics().getItsId().toString()); if (gs.getSpecifics().getItsGroop() != null) { if (isFirstGr) { specGrIdIn = new StringBuffer("("); isFirstGr = false; } else { specGrIdIn.append(", "); } specGrIdIn.append(gs.getSpecifics().getItsGroop().getItsId().toString()); } if (gs.getSpecifics().getItsType().equals(ESpecificsItemType.CHOOSEABLE_SPECIFICS)) { if (isFirstCh) { specChIdIn = new StringBuffer("("); isFirstCh = false; } else { specChIdIn.append(", "); } specChIdIn.append(gs.getLongValue1().toString()); } } specIdIn.append(")"); if (specGrIdIn != null) { specGrIdIn.append(")"); } if (specChIdIn != null) { specChIdIn.append(")"); } pReqVars.put("I18nSpecificsOfItemhasNamedeepLevel", 1); pReqVars.put("I18nSpecificsOfItemlangdeepLevel", 1); i18nSpecificsOfItemLst = getSrvOrm().retrieveListWithConditions(pReqVars, I18nSpecificsOfItem.class, "where HASNAME in " + specIdIn.toString()); pReqVars.remove("I18nSpecificsOfItemhasNamedeepLevel"); pReqVars.remove("I18nSpecificsOfItemlangdeepLevel"); pReqVars.put("I18nUnitOfMeasurehasNamedeepLevel", 1); pReqVars.put("I18nUnitOfMeasurelangdeepLevel", 1); i18nUomLst = getSrvOrm().retrieveList(pReqVars, I18nUnitOfMeasure.class); pReqVars.remove("I18nUnitOfMeasurehasNamedeepLevel"); pReqVars.remove("I18nUnitOfMeasurelangdeepLevel"); if (specGrIdIn != null) { pReqVars.put("I18nSpecificsOfItemGrouphasNamedeepLevel", 1); pReqVars.put("I18nSpecificsOfItemGrouplangdeepLevel", 1); i18nSpecificsOfItemGroupLst = getSrvOrm().retrieveListWithConditions(pReqVars, I18nSpecificsOfItemGroup.class, "where HASNAME in " + specGrIdIn.toString()); pReqVars.remove("I18nSpecificsOfItemGrouphasNamedeepLevel"); pReqVars.remove("I18nSpecificsOfItemGrouplangdeepLevel"); } if (specChIdIn != null) { pReqVars.put("I18nChooseableSpecificshasNamedeepLevel", 1); pReqVars.put("I18nChooseableSpecificslangdeepLevel", 1); i18nChooseableSpecificsLst = getSrvOrm().retrieveListWithConditions(pReqVars, I18nChooseableSpecifics.class, "where HASNAME in " + specChIdIn.toString()); pReqVars.remove("I18nChooseableSpecificshasNamedeepLevel"); pReqVars.remove("I18nChooseableSpecificslangdeepLevel"); } } } } catch (Exception ex) { if (!this.srvDatabase.getIsAutocommit()) { this.srvDatabase.rollBackTransaction(); } throw ex; } finally { this.srvDatabase.releaseResources(); } if (htmlTemplates != null && htmlTemplates.size() > 0) { for (AItemSpecifics<?, ?> gs : pOutdGdSpList) { if (gs.getSpecifics().getTempHtml() != null) { gs.getSpecifics().setTempHtml( findTemplate(htmlTemplates, gs.getSpecifics().getTempHtml().getItsId())); } if (gs.getSpecifics().getItsGroop() != null) { if (gs.getSpecifics().getItsGroop().getTemplateStart() != null) { gs.getSpecifics().getItsGroop().setTemplateStart(findTemplate(htmlTemplates, gs.getSpecifics().getItsGroop().getTemplateStart().getItsId())); } if (gs.getSpecifics().getItsGroop().getTemplateEnd() != null) { gs.getSpecifics().getItsGroop().setTemplateEnd(findTemplate(htmlTemplates, gs.getSpecifics().getItsGroop().getTemplateEnd().getItsId())); } if (gs.getSpecifics().getItsGroop().getTemplateStart() != null) { gs.getSpecifics().getItsGroop().setTemplateDetail(findTemplate(htmlTemplates, gs.getSpecifics().getItsGroop().getTemplateDetail().getItsId())); } } } } int steps = itemsForSpecifics.size() / pSettingsAdd.getRecordsPerTransaction(); int currentStep = 1; Long lastUpdatedVersion = null; do { try { this.srvDatabase.setIsAutocommit(false); this.srvDatabase.setTransactionIsolation(ISrvDatabase.TRANSACTION_READ_UNCOMMITTED); this.srvDatabase.beginTransaction(); int stepLen = Math.min(itemsForSpecifics.size(), currentStep * pSettingsAdd.getRecordsPerTransaction()); for (int i = (currentStep - 1) * pSettingsAdd.getRecordsPerTransaction(); i < stepLen; i++) { IHasIdLongVersionName item = itemsForSpecifics.get(i); ItemInList itemInList = findItemInListFor(itemsInList, item.getItsId(), pItemType); if (itemInList == null) { itemInList = createItemInList(pReqVars, item); } int j = findFirstIdxFor(pOutdGdSpList, item); SpecificsOfItemGroup specificsOfItemGroupWas = null; //reset any way: itemInList.setItsName(item.getItsName()); itemInList.setDetailsMethod(null); itemInList.setImageUrl(null); //i18n: List<I18nSpecificInList> i18nSpInLsLstFg = null; if (i18nItemLst != null) { for (I i18nItem : i18nItemLst) { if (i18nSpInLsLstFg == null) { i18nSpInLsLstFg = new ArrayList<I18nSpecificInList>(); } if (i18nItem.getHasName().getItsId().equals(item.getItsId())) { I18nSpecificInList i18nspInLs = findI18nSpecificInListFor(i18nSpecificInListLst, item, pItemType, i18nItem.getLang()); if (i18nspInLs == null) { i18nspInLs = new I18nSpecificInList(); i18nspInLs.setIsNew(true); i18nspInLs.setItsType(pItemType); i18nspInLs.setItemId(item.getItsId()); i18nspInLs.setLang(i18nItem.getLang()); } i18nspInLs.setItsName(i18nItem.getItsName()); i18nSpInLsLstFg.add(i18nspInLs); } } } if (pSettingsAdd.getSpecHtmlStart() != null) { itemInList.setSpecificInList(pSettingsAdd.getSpecHtmlStart()); if (i18nSpInLsLstFg != null) { for (I18nSpecificInList i18nspInLs : i18nSpInLsLstFg) { i18nspInLs.setSpecificInList(pSettingsAdd.getSpecHtmlStart()); } } } else { itemInList.setSpecificInList(""); if (i18nSpInLsLstFg != null) { for (I18nSpecificInList i18nspInLs : i18nSpInLsLstFg) { i18nspInLs.setSpecificInList(""); } } } boolean wasGrStart = false; do { if (pOutdGdSpList.get(j).getSpecifics().getIsShowInList()) { if (pOutdGdSpList.get(j).getSpecifics().getItsType().equals(ESpecificsItemType.IMAGE)) { itemInList.setImageUrl(pOutdGdSpList.get(j).getStringValue1()); } else { // build ItemInList.specificInList: if (pOutdGdSpList.get(j).getSpecifics().getItsGroop() == null || specificsOfItemGroupWas == null || !pOutdGdSpList.get(j).getSpecifics().getItsGroop().getItsId().equals(specificsOfItemGroupWas.getItsId())) { if (wasGrStart) { if (pSettingsAdd.getSpecGrSeparator() != null && pSettingsAdd.getSpecGrHtmlEnd() != null) { itemInList.setSpecificInList(itemInList.getSpecificInList() + pSettingsAdd.getSpecGrHtmlEnd() + pSettingsAdd.getSpecGrSeparator()); } else if (pSettingsAdd.getSpecGrHtmlEnd() != null) { itemInList.setSpecificInList(itemInList.getSpecificInList() + pSettingsAdd.getSpecGrHtmlEnd()); } else if (pSettingsAdd.getSpecGrSeparator() != null) { itemInList.setSpecificInList(itemInList.getSpecificInList() + pSettingsAdd.getSpecGrSeparator()); } } wasGrStart = true; if (pSettingsAdd.getSpecGrHtmlStart() != null) { itemInList.setSpecificInList(itemInList.getSpecificInList() + pSettingsAdd.getSpecGrHtmlStart()); if (i18nSpInLsLstFg != null) { for (I18nSpecificInList i18nspInLs : i18nSpInLsLstFg) { i18nspInLs.setSpecificInList(i18nspInLs.getSpecificInList() + pSettingsAdd.getSpecGrHtmlStart()); } } } if (pOutdGdSpList.get(j).getSpecifics().getItsGroop() != null && pOutdGdSpList.get(j).getSpecifics().getItsGroop().getTemplateStart() != null) { String grst = pOutdGdSpList.get(j).getSpecifics().getItsGroop().getTemplateStart() .getHtmlTemplate().replace(":SPECGRNM", pOutdGdSpList.get(j).getSpecifics().getItsGroop().getItsName()); itemInList.setSpecificInList(itemInList.getSpecificInList() + grst); if (i18nSpInLsLstFg != null) { for (I18nSpecificInList i18nspInLs : i18nSpInLsLstFg) { String gn = findI18nSpecGrName(i18nSpecificsOfItemGroupLst, pOutdGdSpList.get(j).getSpecifics().getItsGroop(), i18nspInLs.getLang()); grst = pOutdGdSpList.get(j).getSpecifics().getItsGroop().getTemplateStart() .getHtmlTemplate().replace(":SPECGRNM", gn); i18nspInLs.setSpecificInList(i18nspInLs.getSpecificInList() + grst); } } } } updateGoodsSpecificsInList(pReqVars, pSettingsAdd, pOutdGdSpList.get(j), itemInList, specificsOfItemGroupWas, i18nSpInLsLstFg, i18nSpecificsOfItemLst, i18nChooseableSpecificsLst, i18nUomLst); specificsOfItemGroupWas = pOutdGdSpList.get(j).getSpecifics().getItsGroop(); } } else { itemInList.setDetailsMethod(1); } j++; } while (j < pOutdGdSpList.size() && pOutdGdSpList.get(j).getItem().getItsId().equals(item.getItsId())); if (pSettingsAdd.getSpecGrHtmlEnd() != null) { itemInList.setSpecificInList(itemInList.getSpecificInList() + pSettingsAdd.getSpecGrHtmlEnd()); if (i18nSpInLsLstFg != null) { for (I18nSpecificInList i18nspInLs : i18nSpInLsLstFg) { i18nspInLs.setSpecificInList(i18nspInLs.getSpecificInList() + pSettingsAdd.getSpecGrHtmlEnd()); } } } if (pSettingsAdd.getSpecHtmlEnd() != null) { itemInList.setSpecificInList(itemInList.getSpecificInList() + pSettingsAdd.getSpecHtmlEnd()); if (i18nSpInLsLstFg != null) { for (I18nSpecificInList i18nspInLs : i18nSpInLsLstFg) { i18nspInLs.setSpecificInList(i18nspInLs.getSpecificInList() + pSettingsAdd.getSpecHtmlEnd()); } } } if (itemInList.getIsNew()) { getSrvOrm().insertEntity(pReqVars, itemInList); } else { getSrvOrm().updateEntity(pReqVars, itemInList); } if (i18nSpInLsLstFg != null) { for (I18nSpecificInList i18nspInLs : i18nSpInLsLstFg) { if (i18nspInLs.getIsNew()) { getSrvOrm().insertEntity(pReqVars, i18nspInLs); } else { getSrvOrm().updateEntity(pReqVars, i18nspInLs); } } } //item holds item-specifics version lastUpdatedVersion = item.getItsVersion(); } if (pItemType.equals(EShopItemType.GOODS)) { pGoodsInListLuv.setGoodsSpecificLuv(lastUpdatedVersion); } else if (pItemType.equals(EShopItemType.SERVICE)) { pGoodsInListLuv.setServiceSpecificLuv(lastUpdatedVersion); } else if (pItemType.equals(EShopItemType.SEGOODS)) { pGoodsInListLuv.setSeGoodSpecificLuv(lastUpdatedVersion); } else if (pItemType.equals(EShopItemType.SESERVICE)) { pGoodsInListLuv.setSeServiceSpecificLuv(lastUpdatedVersion); } else { throw new Exception("NYI for " + pItemType); } getSrvOrm().updateEntity(pReqVars, pGoodsInListLuv); this.srvDatabase.commitTransaction(); } catch (Exception ex) { if (!this.srvDatabase.getIsAutocommit()) { this.srvDatabase.rollBackTransaction(); } throw ex; } finally { this.srvDatabase.releaseResources(); } } while (currentStep++ < steps); } }
public class class_name { public void addRequestHandler(String host, String firstPath, RequestHandler requestHandler) { String key = hostPathToKey(host, firstPath); if (pathMap.containsKey(key)) { LOGGER.warning("Duplicate port:path map for " + port + ":" + key); } else { pathMap.put(key, requestHandler); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Registered requestHandler(port/host/path) (" + port + "/" + host + "/" + firstPath + "): " + key); } } } }
public class class_name { public void addRequestHandler(String host, String firstPath, RequestHandler requestHandler) { String key = hostPathToKey(host, firstPath); if (pathMap.containsKey(key)) { LOGGER.warning("Duplicate port:path map for " + port + ":" + key); // depends on control dependency: [if], data = [none] } else { pathMap.put(key, requestHandler); // depends on control dependency: [if], data = [none] if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Registered requestHandler(port/host/path) (" + port + "/" + host + "/" + firstPath + "): " + key); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public AbsAxis getPipeline() { assert getPipeStack().size() <= 1; if (getPipeStack().size() == 1 && mExprStack.size() == 1) { return getPipeStack().pop().getExpr(); } else { throw new IllegalStateException("Query was not build correctly."); } } }
public class class_name { public AbsAxis getPipeline() { assert getPipeStack().size() <= 1; if (getPipeStack().size() == 1 && mExprStack.size() == 1) { return getPipeStack().pop().getExpr(); // depends on control dependency: [if], data = [none] } else { throw new IllegalStateException("Query was not build correctly."); } } }
public class class_name { private static Map<Long, Double> fillCalculateMetricTransform(Metric metric, String calculationType) { // Calculate min, max, avg, dev, or a percentile value Double result = calculateResult(metric, calculationType); // return a new time series with the constant values for each time stamp Map<Long, Double> resultMap = new TreeMap<>(); for (Map.Entry<Long, Double> entry : metric.getDatapoints().entrySet()) { Long timestamp = entry.getKey(); resultMap.put(timestamp, result); } return resultMap; } }
public class class_name { private static Map<Long, Double> fillCalculateMetricTransform(Metric metric, String calculationType) { // Calculate min, max, avg, dev, or a percentile value Double result = calculateResult(metric, calculationType); // return a new time series with the constant values for each time stamp Map<Long, Double> resultMap = new TreeMap<>(); for (Map.Entry<Long, Double> entry : metric.getDatapoints().entrySet()) { Long timestamp = entry.getKey(); resultMap.put(timestamp, result); // depends on control dependency: [for], data = [none] } return resultMap; } }
public class class_name { public static long[] allLongs(Cursor cursor, boolean close) { long[] l = EMPTY_LONG_ARRAY; if (cursor.moveToFirst()) { l = new long[cursor.getCount()]; do { l[cursor.getPosition()] = cursor.getLong(0); } while (cursor.moveToNext()); } close(cursor, close); return l; } }
public class class_name { public static long[] allLongs(Cursor cursor, boolean close) { long[] l = EMPTY_LONG_ARRAY; if (cursor.moveToFirst()) { l = new long[cursor.getCount()]; // depends on control dependency: [if], data = [none] do { l[cursor.getPosition()] = cursor.getLong(0); } while (cursor.moveToNext()); } close(cursor, close); return l; } }
public class class_name { public PartnerLogData findEntry(RecoveryWrapper rw) { if (tc.isEntryEnabled()) Tr.entry(tc, "findEntry", rw); PartnerLogData entry; _pltWriteLock.lock(); try { // Search the partner log table... for (PartnerLogData pld : _partnerLogTable) { final RecoveryWrapper nextWrapper = pld.getLogData(); if (rw.isSameAs(nextWrapper)) { if (tc.isDebugEnabled()) Tr.debug(tc, "Found entry in table"); if (tc.isEntryEnabled()) Tr.exit(tc, "findEntry", pld.getIndex()); return pld; } } // // We have never seen this wrapper before, // so we need to add it to the recoveryTable // entry = rw.container(_failureScopeController); addPartnerEntry(entry); } finally { _pltWriteLock.unlock(); } if (tc.isEntryEnabled()) Tr.exit(tc, "findEntry", entry); return entry; } }
public class class_name { public PartnerLogData findEntry(RecoveryWrapper rw) { if (tc.isEntryEnabled()) Tr.entry(tc, "findEntry", rw); PartnerLogData entry; _pltWriteLock.lock(); try { // Search the partner log table... for (PartnerLogData pld : _partnerLogTable) { final RecoveryWrapper nextWrapper = pld.getLogData(); if (rw.isSameAs(nextWrapper)) { if (tc.isDebugEnabled()) Tr.debug(tc, "Found entry in table"); if (tc.isEntryEnabled()) Tr.exit(tc, "findEntry", pld.getIndex()); return pld; // depends on control dependency: [if], data = [none] } } // // We have never seen this wrapper before, // so we need to add it to the recoveryTable // entry = rw.container(_failureScopeController); // depends on control dependency: [try], data = [none] addPartnerEntry(entry); // depends on control dependency: [try], data = [none] } finally { _pltWriteLock.unlock(); } if (tc.isEntryEnabled()) Tr.exit(tc, "findEntry", entry); return entry; } }
public class class_name { private String stripSuffixes(String word) { //integer variables 1 is positive, 0 undecided, -1 negative equiverlent of pun vars positive undecided negative int ruleok = 0; int Continue = 0; //integer varables int pll = 0; //position of last letter int xl; //counter for nuber of chars to be replaced and length of stemmed word if rule was aplied int pfv; //poition of first vowel int prt; //pointer into rule table int ir; //index of rule int iw; //index of word //char variables char ll; // last letter //String variables eqiverlent of tenchar variables String rule = ""; //varlable holding the current rule String stem = ""; // string holding the word as it is being stemmed this is returned as a stemmed word. //boolean varable boolean intact = true; //intact if the word has not yet been stemmed to determin a requirement of some stemming rules //set stem = to word stem = cleanup(word.toLowerCase()); // set the position of pll to the last letter in the string pll = 0; //move through the word to find the position of the last letter before a non letter char while ((pll + 1 < stem.length()) && ((stem.charAt(pll + 1) >= 'a') && (stem.charAt(pll + 1) <= 'z'))) { pll++; } if (pll < 1) { Continue = -1; } //find the position of the first vowel pfv = firstVowel(stem, pll); iw = stem.length() - 1; //repeat until continue == negative ie. -1 while (Continue != -1) { Continue = 0; //SEEK RULE FOR A NEW FINAL LETTER ll = stem.charAt(pll); //last letter //Check to see if there are any possible rules for stemming if ((ll >= 'a') && (ll <= 'z')) { prt = index[charCode(ll)]; //pointer into rule-table } else { prt = -1; //0 is a vaild rule } if (prt == -1) { Continue = -1; //no rule available } if (Continue == 0) { // THERE IS A POSSIBLE RULE (OR RULES) : SEE IF ONE WORKS rule = rules.get(prt); // Take first rule while (Continue == 0) { ruleok = 0; if (rule.charAt(0) != ll) { //rule-letter changes Continue = -1; ruleok = -1; } ir = 1; //index of rule: 2nd character iw = pll - 1; //index of word: next-last letter //repeat untill the rule is not undecided find a rule that is acceptable while (ruleok == 0) { if ((rule.charAt(ir) >= '0') && (rule.charAt(ir) <= '9')) //rule fully matched { ruleok = 1; } else if (rule.charAt(ir) == '*') { //match only if word intact if (intact) { ir = ir + 1; // move forwards along rule ruleok = 1; } else { ruleok = -1; } } else if (rule.charAt(ir) != stem.charAt(iw)) { // mismatch of letters ruleok = -1; } else if (iw <= pfv) { //insufficient stem remains ruleok = -1; } else { // move on to compare next pair of letters ir = ir + 1; // move forwards along rule iw = iw - 1; // move backwards along word } } //if the rule that has just been checked is valid if (ruleok == 1) { // CHECK ACCEPTABILITY CONDITION FOR PROPOSED RULE xl = 0; //count any replacement letters while (!((rule.charAt(ir + xl + 1) >= '.') && (rule.charAt(ir + xl + 1) <= '>'))) { xl++; } xl = pll + xl + 48 - ((int) (rule.charAt(ir))); // position of last letter if rule used if (pfv == 0) { //if word starts with vowel... if (xl < 1) { // ...minimal stem is 2 letters ruleok = -1; } else { //ruleok=1; as ruleok must alread be positive to reach this stage } } //if word start swith consonant... else if ((xl < 2) | (xl < pfv)) { ruleok = -1; // ...minimal stem is 3 letters... // ...including one or more vowel } else { //ruleok=1; as ruleok must alread be positive to reach this stage } } // if using the rule passes the assertion tests if (ruleok == 1) { // APPLY THE MATCHING RULE intact = false; // move end of word marker to position... // ... given by the numeral. pll = pll + 48 - ((int) (rule.charAt(ir))); ir++; stem = stem.substring(0, (pll + 1)); // append any letters following numeral to the word while ((ir < rule.length()) && (('a' <= rule.charAt(ir)) && (rule.charAt(ir) <= 'z'))) { stem += rule.charAt(ir); ir++; pll++; } //if rule ends with '.' then terminate if ((rule.charAt(ir)) == '.') { Continue = -1; } else { //if rule ends with '>' then Continue Continue = 1; } } else { //if rule did not match then look for another prt = prt + 1; // move to next rule in RULETABLE if (prt >= rules.size()) { Continue = -1; } else { rule = rules.get(prt); if (rule.charAt(0) != ll) { //rule-letter changes Continue = -1; } } } } } } return stem; } }
public class class_name { private String stripSuffixes(String word) { //integer variables 1 is positive, 0 undecided, -1 negative equiverlent of pun vars positive undecided negative int ruleok = 0; int Continue = 0; //integer varables int pll = 0; //position of last letter int xl; //counter for nuber of chars to be replaced and length of stemmed word if rule was aplied int pfv; //poition of first vowel int prt; //pointer into rule table int ir; //index of rule int iw; //index of word //char variables char ll; // last letter //String variables eqiverlent of tenchar variables String rule = ""; //varlable holding the current rule String stem = ""; // string holding the word as it is being stemmed this is returned as a stemmed word. //boolean varable boolean intact = true; //intact if the word has not yet been stemmed to determin a requirement of some stemming rules //set stem = to word stem = cleanup(word.toLowerCase()); // set the position of pll to the last letter in the string pll = 0; //move through the word to find the position of the last letter before a non letter char while ((pll + 1 < stem.length()) && ((stem.charAt(pll + 1) >= 'a') && (stem.charAt(pll + 1) <= 'z'))) { pll++; // depends on control dependency: [while], data = [none] } if (pll < 1) { Continue = -1; // depends on control dependency: [if], data = [none] } //find the position of the first vowel pfv = firstVowel(stem, pll); iw = stem.length() - 1; //repeat until continue == negative ie. -1 while (Continue != -1) { Continue = 0; //SEEK RULE FOR A NEW FINAL LETTER ll = stem.charAt(pll); // depends on control dependency: [while], data = [none] //last letter //Check to see if there are any possible rules for stemming if ((ll >= 'a') && (ll <= 'z')) { prt = index[charCode(ll)]; // depends on control dependency: [if], data = [none] //pointer into rule-table } else { prt = -1; // depends on control dependency: [if], data = [none] //0 is a vaild rule } if (prt == -1) { Continue = -1; // depends on control dependency: [if], data = [none] //no rule available } if (Continue == 0) { // THERE IS A POSSIBLE RULE (OR RULES) : SEE IF ONE WORKS rule = rules.get(prt); // depends on control dependency: [if], data = [none] // Take first rule while (Continue == 0) { ruleok = 0; // depends on control dependency: [while], data = [none] if (rule.charAt(0) != ll) { //rule-letter changes Continue = -1; // depends on control dependency: [if], data = [none] ruleok = -1; // depends on control dependency: [if], data = [none] } ir = 1; // depends on control dependency: [while], data = [none] //index of rule: 2nd character iw = pll - 1; // depends on control dependency: [while], data = [none] //index of word: next-last letter //repeat untill the rule is not undecided find a rule that is acceptable while (ruleok == 0) { if ((rule.charAt(ir) >= '0') && (rule.charAt(ir) <= '9')) //rule fully matched { ruleok = 1; // depends on control dependency: [if], data = [none] } else if (rule.charAt(ir) == '*') { //match only if word intact if (intact) { ir = ir + 1; // depends on control dependency: [if], data = [none] // move forwards along rule ruleok = 1; // depends on control dependency: [if], data = [none] } else { ruleok = -1; // depends on control dependency: [if], data = [none] } } else if (rule.charAt(ir) != stem.charAt(iw)) { // mismatch of letters ruleok = -1; // depends on control dependency: [if], data = [none] } else if (iw <= pfv) { //insufficient stem remains ruleok = -1; // depends on control dependency: [if], data = [none] } else { // move on to compare next pair of letters ir = ir + 1; // depends on control dependency: [if], data = [none] // move forwards along rule iw = iw - 1; // depends on control dependency: [if], data = [none] // move backwards along word } } //if the rule that has just been checked is valid if (ruleok == 1) { // CHECK ACCEPTABILITY CONDITION FOR PROPOSED RULE xl = 0; // depends on control dependency: [if], data = [none] //count any replacement letters while (!((rule.charAt(ir + xl + 1) >= '.') && (rule.charAt(ir + xl + 1) <= '>'))) { xl++; // depends on control dependency: [while], data = [none] } xl = pll + xl + 48 - ((int) (rule.charAt(ir))); // depends on control dependency: [if], data = [none] // position of last letter if rule used if (pfv == 0) { //if word starts with vowel... if (xl < 1) { // ...minimal stem is 2 letters ruleok = -1; // depends on control dependency: [if], data = [none] } else { //ruleok=1; as ruleok must alread be positive to reach this stage } } //if word start swith consonant... else if ((xl < 2) | (xl < pfv)) { ruleok = -1; // depends on control dependency: [if], data = [none] // ...minimal stem is 3 letters... // ...including one or more vowel } else { //ruleok=1; as ruleok must alread be positive to reach this stage } } // if using the rule passes the assertion tests if (ruleok == 1) { // APPLY THE MATCHING RULE intact = false; // depends on control dependency: [if], data = [none] // move end of word marker to position... // ... given by the numeral. pll = pll + 48 - ((int) (rule.charAt(ir))); // depends on control dependency: [if], data = [none] ir++; // depends on control dependency: [if], data = [none] stem = stem.substring(0, (pll + 1)); // depends on control dependency: [if], data = [1)] // append any letters following numeral to the word while ((ir < rule.length()) && (('a' <= rule.charAt(ir)) && (rule.charAt(ir) <= 'z'))) { stem += rule.charAt(ir); // depends on control dependency: [while], data = [none] ir++; // depends on control dependency: [while], data = [none] pll++; // depends on control dependency: [while], data = [none] } //if rule ends with '.' then terminate if ((rule.charAt(ir)) == '.') { Continue = -1; // depends on control dependency: [if], data = [none] } else { //if rule ends with '>' then Continue Continue = 1; } } else { //if rule did not match then look for another prt = prt + 1; // depends on control dependency: [if], data = [none] // move to next rule in RULETABLE if (prt >= rules.size()) { Continue = -1; // depends on control dependency: [if], data = [none] } else { rule = rules.get(prt); // depends on control dependency: [if], data = [(prt] if (rule.charAt(0) != ll) { //rule-letter changes Continue = -1; // depends on control dependency: [if], data = [none] } } } } } } return stem; } }
public class class_name { public static BufferedReader createBufferedReader(InputStream stream) { try { return new BufferedReader(new InputStreamReader(stream, "UTF-8")); } catch(UnsupportedEncodingException unused) { throw new BugError("Unsupported UTF-8 ecoding."); } } }
public class class_name { public static BufferedReader createBufferedReader(InputStream stream) { try { return new BufferedReader(new InputStreamReader(stream, "UTF-8")); // depends on control dependency: [try], data = [none] } catch(UnsupportedEncodingException unused) { throw new BugError("Unsupported UTF-8 ecoding."); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public ClassLoader execute(ClassLoader cl) { //PK83186 start newClassLoader = cl; if (threadContextAccessor.isPrivileged()) { cl = (ClassLoader) run(); } else { cl = (ClassLoader) AccessController.doPrivileged(this); } newClassLoader = null; oldClassLoader = null; return cl; //PK83186 end } }
public class class_name { public ClassLoader execute(ClassLoader cl) { //PK83186 start newClassLoader = cl; if (threadContextAccessor.isPrivileged()) { cl = (ClassLoader) run(); // depends on control dependency: [if], data = [none] } else { cl = (ClassLoader) AccessController.doPrivileged(this); // depends on control dependency: [if], data = [none] } newClassLoader = null; oldClassLoader = null; return cl; //PK83186 end } }
public class class_name { public void setNextDate(final Date pValue, final String pPattern, final boolean pUseBcd) { // create date formatter SimpleDateFormat sdf = new SimpleDateFormat(pPattern); String value = sdf.format(pValue); if (pUseBcd) { setNextHexaString(value, value.length() * 4); } else { setNextString(value, value.length() * 8); } } }
public class class_name { public void setNextDate(final Date pValue, final String pPattern, final boolean pUseBcd) { // create date formatter SimpleDateFormat sdf = new SimpleDateFormat(pPattern); String value = sdf.format(pValue); if (pUseBcd) { setNextHexaString(value, value.length() * 4); // depends on control dependency: [if], data = [none] } else { setNextString(value, value.length() * 8); // depends on control dependency: [if], data = [none] } } }