code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public byte findRecoveryId(Sha256Hash hash, ECDSASignature sig) { byte recId = -1; for (byte i = 0; i < 4; i++) { ECKey k = ECKey.recoverFromSignature(i, sig, hash, isCompressed()); if (k != null && k.pub.equals(pub)) { recId = i; break; } } if (recId == -1) throw new RuntimeException("Could not construct a recoverable key. This should never happen."); return recId; } }
public class class_name { public byte findRecoveryId(Sha256Hash hash, ECDSASignature sig) { byte recId = -1; for (byte i = 0; i < 4; i++) { ECKey k = ECKey.recoverFromSignature(i, sig, hash, isCompressed()); if (k != null && k.pub.equals(pub)) { recId = i; // depends on control dependency: [if], data = [none] break; } } if (recId == -1) throw new RuntimeException("Could not construct a recoverable key. This should never happen."); return recId; } }
public class class_name { public T reserve(final Txn<T> txn, final T key, final int size, final PutFlags... op) { if (SHOULD_CHECK) { requireNonNull(txn); requireNonNull(key); txn.checkReady(); txn.checkWritesAllowed(); } txn.kv().keyIn(key); txn.kv().valIn(size); final int flags = mask(op) | MDB_RESERVE.getMask(); checkRc(LIB.mdb_put(txn.pointer(), ptr, txn.kv().pointerKey(), txn.kv() .pointerVal(), flags)); txn.kv().valOut(); // marked as in,out in LMDB C docs return txn.val(); } }
public class class_name { public T reserve(final Txn<T> txn, final T key, final int size, final PutFlags... op) { if (SHOULD_CHECK) { requireNonNull(txn); // depends on control dependency: [if], data = [none] requireNonNull(key); // depends on control dependency: [if], data = [none] txn.checkReady(); // depends on control dependency: [if], data = [none] txn.checkWritesAllowed(); // depends on control dependency: [if], data = [none] } txn.kv().keyIn(key); txn.kv().valIn(size); final int flags = mask(op) | MDB_RESERVE.getMask(); checkRc(LIB.mdb_put(txn.pointer(), ptr, txn.kv().pointerKey(), txn.kv() .pointerVal(), flags)); txn.kv().valOut(); // marked as in,out in LMDB C docs return txn.val(); } }
public class class_name { public int receive(final MessageHandler handler) { int messagesReceived = 0; final BroadcastReceiver receiver = this.receiver; final long lastSeenLappedCount = receiver.lappedCount(); if (receiver.receiveNext()) { if (lastSeenLappedCount != receiver.lappedCount()) { throw new IllegalStateException("unable to keep up with broadcast"); } final int length = receiver.length(); final int capacity = scratchBuffer.capacity(); if (length > capacity && !scratchBuffer.isExpandable()) { throw new IllegalStateException( "buffer required length of " + length + " but only has " + capacity); } final int msgTypeId = receiver.typeId(); scratchBuffer.putBytes(0, receiver.buffer(), receiver.offset(), length); if (!receiver.validate()) { throw new IllegalStateException("unable to keep up with broadcast"); } handler.onMessage(msgTypeId, scratchBuffer, 0, length); messagesReceived = 1; } return messagesReceived; } }
public class class_name { public int receive(final MessageHandler handler) { int messagesReceived = 0; final BroadcastReceiver receiver = this.receiver; final long lastSeenLappedCount = receiver.lappedCount(); if (receiver.receiveNext()) { if (lastSeenLappedCount != receiver.lappedCount()) { throw new IllegalStateException("unable to keep up with broadcast"); } final int length = receiver.length(); final int capacity = scratchBuffer.capacity(); if (length > capacity && !scratchBuffer.isExpandable()) { throw new IllegalStateException( "buffer required length of " + length + " but only has " + capacity); } final int msgTypeId = receiver.typeId(); scratchBuffer.putBytes(0, receiver.buffer(), receiver.offset(), length); // depends on control dependency: [if], data = [none] if (!receiver.validate()) { throw new IllegalStateException("unable to keep up with broadcast"); } handler.onMessage(msgTypeId, scratchBuffer, 0, length); // depends on control dependency: [if], data = [none] messagesReceived = 1; // depends on control dependency: [if], data = [none] } return messagesReceived; } }
public class class_name { @Override public void clear() { lock.writeLock().lock(); try { properties.clear(); } finally { lock.writeLock().unlock(); } } }
public class class_name { @Override public void clear() { lock.writeLock().lock(); try { properties.clear(); // depends on control dependency: [try], data = [none] } finally { lock.writeLock().unlock(); } } }
public class class_name { @Override public boolean queue(IQueueMessage<ID, DATA> _msg) { IQueueMessage<ID, DATA> msg = _msg.clone(); Date now = new Date(); msg.setNumRequeues(0).setQueueTimestamp(now).setTimestamp(now); try { return putToQueue(msg, false); } catch (RocksDBException e) { throw new QueueException(e); } } }
public class class_name { @Override public boolean queue(IQueueMessage<ID, DATA> _msg) { IQueueMessage<ID, DATA> msg = _msg.clone(); Date now = new Date(); msg.setNumRequeues(0).setQueueTimestamp(now).setTimestamp(now); try { return putToQueue(msg, false); // depends on control dependency: [try], data = [none] } catch (RocksDBException e) { throw new QueueException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void listenTextMessagesWithDestination(final String destinationName, final Consumer<String> messageListener) { final MessageConsumer consumer = getConsumer(destinationName); try { consumer.setMessageListener(message -> { try { messageListener.accept( ((TextMessage) message).getText() ); if (acknowledgeMode == Session.CLIENT_ACKNOWLEDGE) { message.acknowledge(); } } catch (JMSException e) { throw new JmsException("Unable to register get text from message in listener " + destinationName, e); } catch (Exception ex) { throw new IllegalStateException("Unable handle JMS Consumer " + destinationName, ex); } }); } catch (JMSException e) { throw new JmsException("Unable to register message listener " + destinationName, e); } } }
public class class_name { public void listenTextMessagesWithDestination(final String destinationName, final Consumer<String> messageListener) { final MessageConsumer consumer = getConsumer(destinationName); try { consumer.setMessageListener(message -> { try { messageListener.accept( ((TextMessage) message).getText() ); // depends on control dependency: [try], data = [none] if (acknowledgeMode == Session.CLIENT_ACKNOWLEDGE) { message.acknowledge(); // depends on control dependency: [if], data = [none] } } catch (JMSException e) { throw new JmsException("Unable to register get text from message in listener " + destinationName, e); } catch (Exception ex) { // depends on control dependency: [catch], data = [none] throw new IllegalStateException("Unable handle JMS Consumer " + destinationName, ex); } // depends on control dependency: [catch], data = [none] }); } catch (JMSException e) { throw new JmsException("Unable to register message listener " + destinationName, e); } } }
public class class_name { public synchronized TableCellRenderer getRenderer(Class<?> type) { TableCellRenderer renderer = null; Object value = typeToRenderer.get(type); if (value instanceof TableCellRenderer) { renderer = (TableCellRenderer) value; } else if (value instanceof Class<?>) { try { renderer = (TableCellRenderer) ((Class<? extends TableCellRenderer>) value).newInstance(); } catch (InstantiationException ex) { Logger.getLogger(PropertyRendererRegistry.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(PropertyRendererRegistry.class.getName()).log(Level.SEVERE, null, ex); } } return renderer; } }
public class class_name { public synchronized TableCellRenderer getRenderer(Class<?> type) { TableCellRenderer renderer = null; Object value = typeToRenderer.get(type); if (value instanceof TableCellRenderer) { renderer = (TableCellRenderer) value; // depends on control dependency: [if], data = [none] } else if (value instanceof Class<?>) { try { renderer = (TableCellRenderer) ((Class<? extends TableCellRenderer>) value).newInstance(); // depends on control dependency: [try], data = [none] } catch (InstantiationException ex) { Logger.getLogger(PropertyRendererRegistry.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { // depends on control dependency: [catch], data = [none] Logger.getLogger(PropertyRendererRegistry.class.getName()).log(Level.SEVERE, null, ex); } // depends on control dependency: [catch], data = [none] } return renderer; } }
public class class_name { private int readUShort(int pos) { int ret = output[pos]; if (ret < 0) { ret += 256; } ret = ret << 8; if (output[pos + 1] < 0) { ret |= output[pos + 1] + 256; } else { ret |= output[pos + 1]; } return ret; } }
public class class_name { private int readUShort(int pos) { int ret = output[pos]; if (ret < 0) { ret += 256; // depends on control dependency: [if], data = [none] } ret = ret << 8; if (output[pos + 1] < 0) { ret |= output[pos + 1] + 256; // depends on control dependency: [if], data = [none] } else { ret |= output[pos + 1]; // depends on control dependency: [if], data = [none] } return ret; } }
public class class_name { private ContainerCreateConfig add(String name, String value) { if (value != null) { createConfig.addProperty(name, value); } return this; } }
public class class_name { private ContainerCreateConfig add(String name, String value) { if (value != null) { createConfig.addProperty(name, value); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { public static void setAuthenticationFailedListener(AuthenticationFailedListener listener) { try { if (!ApptentiveInternal.checkRegistered()) { return; } ApptentiveInternal.getInstance().setAuthenticationFailedListener(listener); } catch (Exception e) { ApptentiveLog.e(CONVERSATION, e, "Error in Apptentive.setUnreadMessagesListener()"); logException(e); } } }
public class class_name { public static void setAuthenticationFailedListener(AuthenticationFailedListener listener) { try { if (!ApptentiveInternal.checkRegistered()) { return; // depends on control dependency: [if], data = [none] } ApptentiveInternal.getInstance().setAuthenticationFailedListener(listener); // depends on control dependency: [try], data = [none] } catch (Exception e) { ApptentiveLog.e(CONVERSATION, e, "Error in Apptentive.setUnreadMessagesListener()"); logException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static ManagerResponse sendAction(final ManagerAction action, final int timeout) throws IllegalArgumentException, IllegalStateException, IOException, TimeoutException { if (logger.isDebugEnabled()) CoherentManagerConnection.logger.debug("Sending Action: " + action.toString()); //$NON-NLS-1$ CoherentManagerConnection.getInstance(); if ((CoherentManagerConnection.managerConnection != null) && (CoherentManagerConnection.managerConnection.getState() == ManagerConnectionState.CONNECTED)) { final org.asteriskjava.manager.action.ManagerAction ajAction = action.getAJAction(); org.asteriskjava.manager.response.ManagerResponse response = CoherentManagerConnection.managerConnection .sendAction(ajAction, timeout); ManagerResponse convertedResponse = null; // UserEventActions always return a null if (response != null) convertedResponse = CoherentEventFactory.build(response); if ((convertedResponse != null) && (convertedResponse.getResponse().compareToIgnoreCase("Error") == 0))//$NON-NLS-1$ { CoherentManagerConnection.logger.warn("Action '" + ajAction + "' failed, Response: " //$NON-NLS-1$ //$NON-NLS-2$ + convertedResponse.getResponse() + " Message: " + convertedResponse.getMessage()); //$NON-NLS-1$ } return convertedResponse; } throw new IllegalStateException("not connected."); //$NON-NLS-1$ } }
public class class_name { public static ManagerResponse sendAction(final ManagerAction action, final int timeout) throws IllegalArgumentException, IllegalStateException, IOException, TimeoutException { if (logger.isDebugEnabled()) CoherentManagerConnection.logger.debug("Sending Action: " + action.toString()); //$NON-NLS-1$ CoherentManagerConnection.getInstance(); if ((CoherentManagerConnection.managerConnection != null) && (CoherentManagerConnection.managerConnection.getState() == ManagerConnectionState.CONNECTED)) { final org.asteriskjava.manager.action.ManagerAction ajAction = action.getAJAction(); org.asteriskjava.manager.response.ManagerResponse response = CoherentManagerConnection.managerConnection .sendAction(ajAction, timeout); ManagerResponse convertedResponse = null; // UserEventActions always return a null if (response != null) convertedResponse = CoherentEventFactory.build(response); if ((convertedResponse != null) && (convertedResponse.getResponse().compareToIgnoreCase("Error") == 0))//$NON-NLS-1$ { CoherentManagerConnection.logger.warn("Action '" + ajAction + "' failed, Response: " //$NON-NLS-1$ //$NON-NLS-2$ + convertedResponse.getResponse() + " Message: " + convertedResponse.getMessage()); //$NON-NLS-1$ // depends on control dependency: [if], data = [none] } return convertedResponse; } throw new IllegalStateException("not connected."); //$NON-NLS-1$ } }
public class class_name { public void removeCommandRegistryListener(CommandRegistryListener listener) { if (logger.isDebugEnabled()) { logger.debug("Removing command registry listener " + listener); } commandRegistryListeners.remove(listener); } }
public class class_name { public void removeCommandRegistryListener(CommandRegistryListener listener) { if (logger.isDebugEnabled()) { logger.debug("Removing command registry listener " + listener); // depends on control dependency: [if], data = [none] } commandRegistryListeners.remove(listener); } }
public class class_name { public static long start(Context context, String tag) { final int uid = getUid(context); if (uid > 0) { long appRxValue = TrafficStats.getUidRxBytes(uid); long appTxValue = TrafficStats.getUidTxBytes(uid); sReceivedBytes.put(tag, appRxValue); sSendBytes.put(tag, appTxValue); if (DEBUG) { LogUtils.v(TAG, "start() rxValue=" + appRxValue / 1000 + " txValue=" + appTxValue / 1000 + " uid=" + uid); } return appRxValue; } return 0; } }
public class class_name { public static long start(Context context, String tag) { final int uid = getUid(context); if (uid > 0) { long appRxValue = TrafficStats.getUidRxBytes(uid); long appTxValue = TrafficStats.getUidTxBytes(uid); sReceivedBytes.put(tag, appRxValue); // depends on control dependency: [if], data = [none] sSendBytes.put(tag, appTxValue); // depends on control dependency: [if], data = [none] if (DEBUG) { LogUtils.v(TAG, "start() rxValue=" + appRxValue / 1000 + " txValue=" + appTxValue / 1000 + " uid=" + uid); // depends on control dependency: [if], data = [none] } return appRxValue; // depends on control dependency: [if], data = [none] } return 0; } }
public class class_name { private void startConnection() { while (doStart()) { boolean isValid = false; try { long now = currentTimeActual(); updateIdleExpireTime(now); int id = _gId.incrementAndGet(); updateThrottle(); /* if (id == 200) { ThreadDump.create().dumpThreads(); } else */ /* if (id == 1000) { ThreadDump.create().dumpThreads(); } */ launchChildThread(id); isValid = true; } finally { if (! isValid) { onStartFail(); } } } } }
public class class_name { private void startConnection() { while (doStart()) { boolean isValid = false; try { long now = currentTimeActual(); updateIdleExpireTime(now); // depends on control dependency: [try], data = [none] int id = _gId.incrementAndGet(); updateThrottle(); // depends on control dependency: [try], data = [none] /* if (id == 200) { ThreadDump.create().dumpThreads(); } else */ /* if (id == 1000) { ThreadDump.create().dumpThreads(); } */ launchChildThread(id); // depends on control dependency: [try], data = [none] isValid = true; // depends on control dependency: [try], data = [none] } finally { if (! isValid) { onStartFail(); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public double evaluate() { if (model.data.tstData.size() <= 0) { return 0.0; } for (int i = 0; i < humanLabelCounts.length; i++) { humanLabelCounts[i] = 0; modelLabelCounts[i] = 0; humanModelCounts[i] = 0; } int matchingCount = 0; for (int i = 0; i < model.data.tstData.size(); i++) { Observation obsr = (Observation)model.data.tstData.get(i); if (obsr.humanLabel == obsr.modelLabel) { matchingCount++; } } return (double)(matchingCount * 100) / model.data.tstData.size(); } }
public class class_name { public double evaluate() { if (model.data.tstData.size() <= 0) { return 0.0; // depends on control dependency: [if], data = [none] } for (int i = 0; i < humanLabelCounts.length; i++) { humanLabelCounts[i] = 0; // depends on control dependency: [for], data = [i] modelLabelCounts[i] = 0; // depends on control dependency: [for], data = [i] humanModelCounts[i] = 0; // depends on control dependency: [for], data = [i] } int matchingCount = 0; for (int i = 0; i < model.data.tstData.size(); i++) { Observation obsr = (Observation)model.data.tstData.get(i); if (obsr.humanLabel == obsr.modelLabel) { matchingCount++; // depends on control dependency: [if], data = [none] } } return (double)(matchingCount * 100) / model.data.tstData.size(); } }
public class class_name { public static String[] getExtends(Configuration config, String module, String[] defaultExtensions) { String extension = getStringExtends(config, module); if (StringUtils.isBlank(extension)) { return defaultExtensions; } else { extension = extension.toLowerCase(); } String[] extensions = extension.split(","); for (String ext : defaultExtensions) { if (!ArrayUtils.contains(extensions, ext.substring(1)) && !ArrayUtils.contains(extensions, ext)) { extensions = ArrayUtils.add(extensions, ext); } } return extensions; } }
public class class_name { public static String[] getExtends(Configuration config, String module, String[] defaultExtensions) { String extension = getStringExtends(config, module); if (StringUtils.isBlank(extension)) { return defaultExtensions; // depends on control dependency: [if], data = [none] } else { extension = extension.toLowerCase(); // depends on control dependency: [if], data = [none] } String[] extensions = extension.split(","); for (String ext : defaultExtensions) { if (!ArrayUtils.contains(extensions, ext.substring(1)) && !ArrayUtils.contains(extensions, ext)) { extensions = ArrayUtils.add(extensions, ext); // depends on control dependency: [if], data = [none] } } return extensions; } }
public class class_name { public static Trades adaptTrades(LakeBTCTradeResponse[] transactions, CurrencyPair currencyPair) { List<Trade> trades = new ArrayList<>(); long lastTradeId = 0; for (LakeBTCTradeResponse trade : transactions) { final OrderType orderType = trade.getType().startsWith("buy") ? OrderType.BID : OrderType.ASK; trades.add( new Trade( orderType, trade.getAmount(), currencyPair, trade.getTotal(), DateUtils.fromMillisUtc(trade.getAt() * 1000L), trade.getId())); } return new Trades(trades, lastTradeId, Trades.TradeSortType.SortByTimestamp); } }
public class class_name { public static Trades adaptTrades(LakeBTCTradeResponse[] transactions, CurrencyPair currencyPair) { List<Trade> trades = new ArrayList<>(); long lastTradeId = 0; for (LakeBTCTradeResponse trade : transactions) { final OrderType orderType = trade.getType().startsWith("buy") ? OrderType.BID : OrderType.ASK; trades.add( new Trade( orderType, trade.getAmount(), currencyPair, trade.getTotal(), DateUtils.fromMillisUtc(trade.getAt() * 1000L), trade.getId())); // depends on control dependency: [for], data = [trade] } return new Trades(trades, lastTradeId, Trades.TradeSortType.SortByTimestamp); } }
public class class_name { public String timestamp() { float totalSeconds = this.length(); float second = totalSeconds % 60; int minute = (int) totalSeconds / 60 % 60; int hour = (int) (totalSeconds / 3600); StringBuilder sb = new StringBuilder(); if (hour > 0) { sb.append(hour + ":"); } if (minute > 0) { sb.append(minute + ":"); } sb.append(second); return sb.toString(); } }
public class class_name { public String timestamp() { float totalSeconds = this.length(); float second = totalSeconds % 60; int minute = (int) totalSeconds / 60 % 60; int hour = (int) (totalSeconds / 3600); StringBuilder sb = new StringBuilder(); if (hour > 0) { sb.append(hour + ":"); // depends on control dependency: [if], data = [(hour] } if (minute > 0) { sb.append(minute + ":"); // depends on control dependency: [if], data = [(minute] } sb.append(second); return sb.toString(); } }
public class class_name { private void cleanup() { final String methodName = "cleanup(): "; try { final Bundle b = bundle.getAndSet(null); if (b != null) { if (tc.isDebugEnabled()) { Tr.debug(tc, methodName + "Uninstalling bundle location: " + b.getLocation() + ", bundle id: " + b.getBundleId()); } SecurityManager sm = System.getSecurityManager(); if (sm != null) { AccessController.doPrivileged(new PrivilegedAction<Void>() { @Override public Void run() { try { b.uninstall(); return null; } catch (BundleException ignored) { return null; } } }); } else { b.uninstall(); } } } catch (BundleException ignored) { } catch (IllegalStateException ignored) { } } }
public class class_name { private void cleanup() { final String methodName = "cleanup(): "; try { final Bundle b = bundle.getAndSet(null); if (b != null) { if (tc.isDebugEnabled()) { Tr.debug(tc, methodName + "Uninstalling bundle location: " + b.getLocation() + ", bundle id: " + b.getBundleId()); // depends on control dependency: [if], data = [none] } SecurityManager sm = System.getSecurityManager(); if (sm != null) { AccessController.doPrivileged(new PrivilegedAction<Void>() { @Override public Void run() { try { b.uninstall(); // depends on control dependency: [try], data = [none] return null; // depends on control dependency: [try], data = [none] } catch (BundleException ignored) { return null; } // depends on control dependency: [catch], data = [none] } }); // depends on control dependency: [if], data = [none] } else { b.uninstall(); // depends on control dependency: [if], data = [none] } } } catch (BundleException ignored) { } catch (IllegalStateException ignored) { // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] } }
public class class_name { public PersistenceBrokerInternal getBrokerInternal() { if (broker == null || broker.isClosed()) { checkOpen(); try { checkForDB(); broker = PersistenceBrokerFactoryFactory.instance().createPersistenceBroker(curDB.getPBKey()); } catch (PBFactoryException e) { log.error("Cannot obtain PersistenceBroker from PersistenceBrokerFactory, " + "found PBKey was " + curDB.getPBKey(), e); throw new PersistenceBrokerException(e); } } return broker; } }
public class class_name { public PersistenceBrokerInternal getBrokerInternal() { if (broker == null || broker.isClosed()) { checkOpen(); // depends on control dependency: [if], data = [none] try { checkForDB(); // depends on control dependency: [try], data = [none] broker = PersistenceBrokerFactoryFactory.instance().createPersistenceBroker(curDB.getPBKey()); // depends on control dependency: [try], data = [none] } catch (PBFactoryException e) { log.error("Cannot obtain PersistenceBroker from PersistenceBrokerFactory, " + "found PBKey was " + curDB.getPBKey(), e); throw new PersistenceBrokerException(e); } // depends on control dependency: [catch], data = [none] } return broker; } }
public class class_name { public Optional<Object> getDefaultValue() { Validate.notNull(parameter, "parameter must not be null!"); if (parameter instanceof AbstractSerializableParameter) { AbstractSerializableParameter serializableParameter = (AbstractSerializableParameter) parameter; return Optional.ofNullable(serializableParameter.getDefaultValue()); } return Optional.empty(); } }
public class class_name { public Optional<Object> getDefaultValue() { Validate.notNull(parameter, "parameter must not be null!"); if (parameter instanceof AbstractSerializableParameter) { AbstractSerializableParameter serializableParameter = (AbstractSerializableParameter) parameter; return Optional.ofNullable(serializableParameter.getDefaultValue()); // depends on control dependency: [if], data = [none] } return Optional.empty(); } }
public class class_name { void sortLostFiles(List<String> files) { // TODO: We should first fix the files that lose more blocks Comparator<String> comp = new Comparator<String>() { public int compare(String p1, String p2) { Codec c1 = null; Codec c2 = null; for (Codec codec : Codec.getCodecs()) { if (isParityFile(p1, codec)) { c1 = codec; } else if (isParityFile(p2, codec)) { c2 = codec; } } if (c1 == null && c2 == null) { return 0; // both are source files } if (c1 == null && c2 != null) { return -1; // only p1 is a source file } if (c2 == null && c1 != null) { return 1; // only p2 is a source file } return c2.priority - c1.priority; // descending order } }; Collections.sort(files, comp); } }
public class class_name { void sortLostFiles(List<String> files) { // TODO: We should first fix the files that lose more blocks Comparator<String> comp = new Comparator<String>() { public int compare(String p1, String p2) { Codec c1 = null; Codec c2 = null; for (Codec codec : Codec.getCodecs()) { if (isParityFile(p1, codec)) { c1 = codec; // depends on control dependency: [if], data = [none] } else if (isParityFile(p2, codec)) { c2 = codec; // depends on control dependency: [if], data = [none] } } if (c1 == null && c2 == null) { return 0; // both are source files // depends on control dependency: [if], data = [none] } if (c1 == null && c2 != null) { return -1; // only p1 is a source file // depends on control dependency: [if], data = [none] } if (c2 == null && c1 != null) { return 1; // only p2 is a source file // depends on control dependency: [if], data = [none] } return c2.priority - c1.priority; // descending order } }; Collections.sort(files, comp); } }
public class class_name { public String render(Message5WH msg) { if(msg!=null){ ST ret = this.stg.getInstanceOf("message5wh"); if(msg.getWhereLocation()!=null){ ST where = this.stg.getInstanceOf("where"); where.add("location", msg.getWhereLocation()); if(msg.getWhereLine()>0){ where.add("line", msg.getWhereLine()); } if(msg.getWhereColumn()>0){ where.add("column", msg.getWhereColumn()); } ret.add("where", where); } ret.add("reporter", msg.getReporter()); if(msg.getType()!=null){ Map<String, Boolean> typeMap = new HashMap<>(); typeMap.put(msg.getType().toString(), true); ret.add("type", typeMap); } if(msg.getWhat()!=null && !StringUtils.isBlank(msg.getWhat().toString())){ ret.add("what", msg.getWhat()); } ret.add("who", msg.getWho()); ret.add("when", msg.getWhen()); ret.add("why", msg.getWhy()); ret.add("how", msg.getHow()); return ret.render(); } return ""; } }
public class class_name { public String render(Message5WH msg) { if(msg!=null){ ST ret = this.stg.getInstanceOf("message5wh"); if(msg.getWhereLocation()!=null){ ST where = this.stg.getInstanceOf("where"); where.add("location", msg.getWhereLocation()); // depends on control dependency: [if], data = [none] if(msg.getWhereLine()>0){ where.add("line", msg.getWhereLine()); // depends on control dependency: [if], data = [none] } if(msg.getWhereColumn()>0){ where.add("column", msg.getWhereColumn()); // depends on control dependency: [if], data = [none] } ret.add("where", where); // depends on control dependency: [if], data = [none] } ret.add("reporter", msg.getReporter()); // depends on control dependency: [if], data = [none] if(msg.getType()!=null){ Map<String, Boolean> typeMap = new HashMap<>(); typeMap.put(msg.getType().toString(), true); // depends on control dependency: [if], data = [(msg.getType()] ret.add("type", typeMap); // depends on control dependency: [if], data = [none] } if(msg.getWhat()!=null && !StringUtils.isBlank(msg.getWhat().toString())){ ret.add("what", msg.getWhat()); // depends on control dependency: [if], data = [none] } ret.add("who", msg.getWho()); // depends on control dependency: [if], data = [none] ret.add("when", msg.getWhen()); // depends on control dependency: [if], data = [none] ret.add("why", msg.getWhy()); // depends on control dependency: [if], data = [none] ret.add("how", msg.getHow()); // depends on control dependency: [if], data = [none] return ret.render(); // depends on control dependency: [if], data = [none] } return ""; } }
public class class_name { public static List<String> parse(String address, String addresses) { List<String> result; // backwards compatibility - older clients only send a single address in the single address header and don't supply the multi-address header if (addresses == null || addresses.isEmpty()) { addresses = address; } if (addresses == null) { result = Collections.emptyList(); } else { String[] parts = addresses.split(","); result = new ArrayList<String>(parts.length); for (String part : parts) { part = part.trim(); if (NetworkAddress.isValidIPAddress(part)) { result.add(part); } } } return result; } }
public class class_name { public static List<String> parse(String address, String addresses) { List<String> result; // backwards compatibility - older clients only send a single address in the single address header and don't supply the multi-address header if (addresses == null || addresses.isEmpty()) { addresses = address; // depends on control dependency: [if], data = [none] } if (addresses == null) { result = Collections.emptyList(); // depends on control dependency: [if], data = [none] } else { String[] parts = addresses.split(","); result = new ArrayList<String>(parts.length); // depends on control dependency: [if], data = [none] for (String part : parts) { part = part.trim(); // depends on control dependency: [for], data = [part] if (NetworkAddress.isValidIPAddress(part)) { result.add(part); // depends on control dependency: [if], data = [none] } } } return result; } }
public class class_name { public void updateByQuery(ESSyncConfig config, Map<String, Object> paramsTmp, Map<String, Object> esFieldData) { if (paramsTmp.isEmpty()) { return; } ESMapping mapping = config.getEsMapping(); BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery(); paramsTmp.forEach((fieldName, value) -> queryBuilder.must(QueryBuilders.termsQuery(fieldName, value))); // 查询sql批量更新 DataSource ds = DatasourceConfig.DATA_SOURCES.get(config.getDataSourceKey()); StringBuilder sql = new StringBuilder("SELECT * FROM (" + mapping.getSql() + ") _v WHERE "); List<Object> values = new ArrayList<>(); paramsTmp.forEach((fieldName, value) -> { sql.append("_v.").append(fieldName).append("=? AND "); values.add(value); }); //TODO 直接外部包裹sql会导致全表扫描性能低, 待优化拼接内部where条件 int len = sql.length(); sql.delete(len - 4, len); Integer syncCount = (Integer) Util.sqlRS(ds, sql.toString(), values, rs -> { int count = 0; try { while (rs.next()) { Object idVal = getIdValFromRS(mapping, rs); append4Update(mapping, idVal, esFieldData); commitBulk(); count++; } } catch (Exception e) { throw new RuntimeException(e); } return count; }); if (logger.isTraceEnabled()) { logger.trace("Update ES by query affected {} records", syncCount); } } }
public class class_name { public void updateByQuery(ESSyncConfig config, Map<String, Object> paramsTmp, Map<String, Object> esFieldData) { if (paramsTmp.isEmpty()) { return; // depends on control dependency: [if], data = [none] } ESMapping mapping = config.getEsMapping(); BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery(); paramsTmp.forEach((fieldName, value) -> queryBuilder.must(QueryBuilders.termsQuery(fieldName, value))); // 查询sql批量更新 DataSource ds = DatasourceConfig.DATA_SOURCES.get(config.getDataSourceKey()); StringBuilder sql = new StringBuilder("SELECT * FROM (" + mapping.getSql() + ") _v WHERE "); List<Object> values = new ArrayList<>(); paramsTmp.forEach((fieldName, value) -> { sql.append("_v.").append(fieldName).append("=? AND "); values.add(value); }); //TODO 直接外部包裹sql会导致全表扫描性能低, 待优化拼接内部where条件 int len = sql.length(); sql.delete(len - 4, len); Integer syncCount = (Integer) Util.sqlRS(ds, sql.toString(), values, rs -> { int count = 0; try { while (rs.next()) { Object idVal = getIdValFromRS(mapping, rs); append4Update(mapping, idVal, esFieldData); // depends on control dependency: [while], data = [none] commitBulk(); // depends on control dependency: [while], data = [none] count++; // depends on control dependency: [while], data = [none] } } catch (Exception e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] return count; }); if (logger.isTraceEnabled()) { logger.trace("Update ES by query affected {} records", syncCount); } } }
public class class_name { public static double[] getBorders(int numberOfBins, List<Double> counts) { Collections.sort(counts); if (!counts.isEmpty()) { List<Integer> borderInds = findBordersNaive(numberOfBins, counts); if (borderInds == null) { borderInds = findBorderIndsByRepeatedDividing(numberOfBins, counts); } double[] result = new double[borderInds.size()]; for (int i = 0; i < result.length; i++) { result[i] = counts.get(borderInds.get(i)); } return result; } else return new double[]{0.0}; } }
public class class_name { public static double[] getBorders(int numberOfBins, List<Double> counts) { Collections.sort(counts); if (!counts.isEmpty()) { List<Integer> borderInds = findBordersNaive(numberOfBins, counts); if (borderInds == null) { borderInds = findBorderIndsByRepeatedDividing(numberOfBins, counts); // depends on control dependency: [if], data = [none] } double[] result = new double[borderInds.size()]; for (int i = 0; i < result.length; i++) { result[i] = counts.get(borderInds.get(i)); // depends on control dependency: [for], data = [i] } return result; // depends on control dependency: [if], data = [none] } else return new double[]{0.0}; } }
public class class_name { public void execute() { if (round.needsExecution()) { Round old = round; round = old.next(); old.execute(); } } }
public class class_name { public void execute() { if (round.needsExecution()) { Round old = round; round = old.next(); // depends on control dependency: [if], data = [none] old.execute(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean delete(DeleteAction deleteAction) { HTableInterface table = pool.getTable(tableName); try { for (DeleteActionModifier deleteActionModifier : deleteActionModifiers) { deleteAction = deleteActionModifier.modifyDeleteAction(deleteAction); } Delete delete = deleteAction.getDelete(); if (deleteAction.getVersionCheckAction() != null) { byte[] versionBytes = Bytes.toBytes(deleteAction .getVersionCheckAction().getVersion()); try { return table.checkAndDelete(delete.getRow(), Constants.SYS_COL_FAMILY, Constants.VERSION_CHECK_COL_QUALIFIER, versionBytes, delete); } catch (IOException e) { throw new DatasetIOException( "Error deleteing row from table with checkAndDelete", e); } } else { try { table.delete(delete); return true; } catch (IOException e) { throw new DatasetIOException("Error deleteing row from table", e); } } } finally { if (table != null) { try { table.close(); } catch (IOException e) { throw new DatasetIOException("Error putting table back into pool", e); } } } } }
public class class_name { public boolean delete(DeleteAction deleteAction) { HTableInterface table = pool.getTable(tableName); try { for (DeleteActionModifier deleteActionModifier : deleteActionModifiers) { deleteAction = deleteActionModifier.modifyDeleteAction(deleteAction); // depends on control dependency: [for], data = [deleteActionModifier] } Delete delete = deleteAction.getDelete(); if (deleteAction.getVersionCheckAction() != null) { byte[] versionBytes = Bytes.toBytes(deleteAction .getVersionCheckAction().getVersion()); try { return table.checkAndDelete(delete.getRow(), Constants.SYS_COL_FAMILY, Constants.VERSION_CHECK_COL_QUALIFIER, versionBytes, delete); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new DatasetIOException( "Error deleteing row from table with checkAndDelete", e); } // depends on control dependency: [catch], data = [none] } else { try { table.delete(delete); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new DatasetIOException("Error deleteing row from table", e); } // depends on control dependency: [catch], data = [none] } } finally { if (table != null) { try { table.close(); } catch (IOException e) { throw new DatasetIOException("Error putting table back into pool", e); } } } } }
public class class_name { @Nullable Object convertRootField(OrcStruct struct, String fieldName) { // this cache is only valid for the root level, to skip the indexOf on fieldNames to get the fieldIndex. TypeDescription schema = struct.getSchema(); final List<String> fields = schema.getFieldNames(); if (fieldIndexCache == null) { fieldIndexCache = new Object2IntOpenHashMap<>(fields.size()); for (int i = 0; i < fields.size(); i++) { fieldIndexCache.put(fields.get(i), i); } } WritableComparable wc = struct.getFieldValue(fieldName); int fieldIndex = fieldIndexCache.getOrDefault(fieldName, -1); return convertField(struct, fieldIndex); } }
public class class_name { @Nullable Object convertRootField(OrcStruct struct, String fieldName) { // this cache is only valid for the root level, to skip the indexOf on fieldNames to get the fieldIndex. TypeDescription schema = struct.getSchema(); final List<String> fields = schema.getFieldNames(); if (fieldIndexCache == null) { fieldIndexCache = new Object2IntOpenHashMap<>(fields.size()); // depends on control dependency: [if], data = [none] for (int i = 0; i < fields.size(); i++) { fieldIndexCache.put(fields.get(i), i); // depends on control dependency: [for], data = [i] } } WritableComparable wc = struct.getFieldValue(fieldName); int fieldIndex = fieldIndexCache.getOrDefault(fieldName, -1); return convertField(struct, fieldIndex); } }
public class class_name { public static void closeFileStream(InputStream inputStream, String filePath){ try { if (inputStream != null) { inputStream.close(); } } catch (IOException e) { LOG.error("close file {} occur an IOExcpetion {}", filePath, e); } } }
public class class_name { public static void closeFileStream(InputStream inputStream, String filePath){ try { if (inputStream != null) { inputStream.close(); // depends on control dependency: [if], data = [none] } } catch (IOException e) { LOG.error("close file {} occur an IOExcpetion {}", filePath, e); } } }
public class class_name { public BaseField setupField(int iFieldSeq) { BaseField field = null; //if (iFieldSeq == 0) //{ // field = new CounterField(this, ID, Constants.DEFAULT_FIELD_LENGTH, null, null); // field.setHidden(true); //} //if (iFieldSeq == 1) //{ // field = new RecordChangedField(this, LAST_CHANGED, Constants.DEFAULT_FIELD_LENGTH, null, null); // field.setHidden(true); //} //if (iFieldSeq == 2) //{ // field = new BooleanField(this, DELETED, Constants.DEFAULT_FIELD_LENGTH, null, new Boolean(false)); // field.setHidden(true); //} if (iFieldSeq == 3) field = new StringField(this, NAME, 120, null, null); if (iFieldSeq == 4) field = new ProjectTaskField(this, PARENT_PROJECT_TASK_ID, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 5) { field = new ShortField(this, SEQUENCE, Constants.DEFAULT_FIELD_LENGTH, null, new Short((short)0)); field.setNullable(false); } //if (iFieldSeq == 6) // field = new MemoField(this, COMMENT, Constants.DEFAULT_FIELD_LENGTH, null, null); //if (iFieldSeq == 7) // field = new StringField(this, CODE, 30, null, null); if (iFieldSeq == 8) field = new DateTimeField(this, START_DATE_TIME, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 9) { field = new RealField(this, DURATION, Constants.DEFAULT_FIELD_LENGTH, null, new Double(1)); field.addListener(new InitOnceFieldHandler(null)); } if (iFieldSeq == 10) { field = new DateTimeField(this, END_DATE_TIME, Constants.DEFAULT_FIELD_LENGTH, null, null); field.setVirtual(true); } if (iFieldSeq == 11) field = new PercentField(this, PROGRESS, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 12) field = new ProjectFilter(this, PROJECT_ID, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 13) field = new ProjectVersionField(this, PROJECT_VERSION_ID, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 14) field = new IssueStatusField(this, PROJECT_TYPE_ID, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 15) field = new IssueStatusField(this, PROJECT_STATUS_ID, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 16) field = new UserField(this, ASSIGNED_USER_ID, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 17) field = new IssuePriorityField(this, PROJECT_PRIORITY_ID, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 18) field = new ProjectTask_EnteredDate(this, ENTERED_DATE, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 19) field = new UserField(this, ENTERED_BY_USER_ID, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 20) field = new DateTimeField(this, CHANGED_DATE, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 21) field = new UserField(this, CHANGED_BY_USER_ID, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 22) field = new BooleanField(this, HAS_CHILDREN, Constants.DEFAULT_FIELD_LENGTH, null, new Boolean(false)); if (field == null) field = super.setupField(iFieldSeq); return field; } }
public class class_name { public BaseField setupField(int iFieldSeq) { BaseField field = null; //if (iFieldSeq == 0) //{ // field = new CounterField(this, ID, Constants.DEFAULT_FIELD_LENGTH, null, null); // field.setHidden(true); //} //if (iFieldSeq == 1) //{ // field = new RecordChangedField(this, LAST_CHANGED, Constants.DEFAULT_FIELD_LENGTH, null, null); // field.setHidden(true); //} //if (iFieldSeq == 2) //{ // field = new BooleanField(this, DELETED, Constants.DEFAULT_FIELD_LENGTH, null, new Boolean(false)); // field.setHidden(true); //} if (iFieldSeq == 3) field = new StringField(this, NAME, 120, null, null); if (iFieldSeq == 4) field = new ProjectTaskField(this, PARENT_PROJECT_TASK_ID, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 5) { field = new ShortField(this, SEQUENCE, Constants.DEFAULT_FIELD_LENGTH, null, new Short((short)0)); // depends on control dependency: [if], data = [none] field.setNullable(false); // depends on control dependency: [if], data = [none] } //if (iFieldSeq == 6) // field = new MemoField(this, COMMENT, Constants.DEFAULT_FIELD_LENGTH, null, null); //if (iFieldSeq == 7) // field = new StringField(this, CODE, 30, null, null); if (iFieldSeq == 8) field = new DateTimeField(this, START_DATE_TIME, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 9) { field = new RealField(this, DURATION, Constants.DEFAULT_FIELD_LENGTH, null, new Double(1)); // depends on control dependency: [if], data = [none] field.addListener(new InitOnceFieldHandler(null)); // depends on control dependency: [if], data = [none] } if (iFieldSeq == 10) { field = new DateTimeField(this, END_DATE_TIME, Constants.DEFAULT_FIELD_LENGTH, null, null); // depends on control dependency: [if], data = [none] field.setVirtual(true); // depends on control dependency: [if], data = [none] } if (iFieldSeq == 11) field = new PercentField(this, PROGRESS, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 12) field = new ProjectFilter(this, PROJECT_ID, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 13) field = new ProjectVersionField(this, PROJECT_VERSION_ID, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 14) field = new IssueStatusField(this, PROJECT_TYPE_ID, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 15) field = new IssueStatusField(this, PROJECT_STATUS_ID, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 16) field = new UserField(this, ASSIGNED_USER_ID, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 17) field = new IssuePriorityField(this, PROJECT_PRIORITY_ID, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 18) field = new ProjectTask_EnteredDate(this, ENTERED_DATE, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 19) field = new UserField(this, ENTERED_BY_USER_ID, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 20) field = new DateTimeField(this, CHANGED_DATE, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 21) field = new UserField(this, CHANGED_BY_USER_ID, Constants.DEFAULT_FIELD_LENGTH, null, null); if (iFieldSeq == 22) field = new BooleanField(this, HAS_CHILDREN, Constants.DEFAULT_FIELD_LENGTH, null, new Boolean(false)); if (field == null) field = super.setupField(iFieldSeq); return field; } }
public class class_name { private ResourceAccessor createResourceAccessor(ClassLoader classLoader) { List<ResourceAccessor> resourceAccessors = new ArrayList<ResourceAccessor>(); resourceAccessors.add(new FileSystemResourceAccessor(Paths.get(".").toAbsolutePath().getRoot().toFile())); resourceAccessors.add(new ClassLoaderResourceAccessor(classLoader)); String changeLogDirectory = getChangeLogDirectory(); if (changeLogDirectory != null) { changeLogDirectory = changeLogDirectory.trim().replace('\\', '/'); //convert to standard / if using absolute path on windows resourceAccessors.add(new FileSystemResourceAccessor(new File(changeLogDirectory))); } return new CompositeResourceAccessor(resourceAccessors.toArray(new ResourceAccessor[0])); } }
public class class_name { private ResourceAccessor createResourceAccessor(ClassLoader classLoader) { List<ResourceAccessor> resourceAccessors = new ArrayList<ResourceAccessor>(); resourceAccessors.add(new FileSystemResourceAccessor(Paths.get(".").toAbsolutePath().getRoot().toFile())); resourceAccessors.add(new ClassLoaderResourceAccessor(classLoader)); String changeLogDirectory = getChangeLogDirectory(); if (changeLogDirectory != null) { changeLogDirectory = changeLogDirectory.trim().replace('\\', '/'); //convert to standard / if using absolute path on windows // depends on control dependency: [if], data = [none] resourceAccessors.add(new FileSystemResourceAccessor(new File(changeLogDirectory))); // depends on control dependency: [if], data = [(changeLogDirectory] } return new CompositeResourceAccessor(resourceAccessors.toArray(new ResourceAccessor[0])); } }
public class class_name { @Override public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws IOException { String action; if ((action = req.getParams().get(PARAM_ACTION)) != null) { // generate list of files if (action.equals(ACTION_CONFIG_FILES)) { String configDir = req.getCore().getResourceLoader().getConfigDir(); rsp.add(ACTION_CONFIG_FILES, getFiles(configDir, null)); // get file } else if (action.equals(ACTION_CONFIG_FILE)) { String file = req.getParams().get(PARAM_CONFIG_FILE, null); if (file != null && !file.contains("..") && !file.startsWith("/")) { InputStream is; try { is = req.getCore().getResourceLoader().openResource(file); rsp.add(ACTION_CONFIG_FILE, IOUtils.toString(is, StandardCharsets.UTF_8)); } catch (IOException e) { log.debug(e); rsp.add(MESSAGE_ERROR, e.getMessage()); } } // test mapping } else if (action.equals(ACTION_MAPPING)) { String configuration = null; String document = null; String documentUrl = null; if (req.getContentStreams() != null) { Iterator<ContentStream> it = req.getContentStreams().iterator(); if (it.hasNext()) { ContentStream cs = it.next(); Map<String, String> params = new HashMap<>(); getParamsFromJSON(params, IOUtils.toString(cs.getReader())); configuration = params.get(PARAM_MAPPING_CONFIGURATION); document = params.get(PARAM_MAPPING_DOCUMENT); documentUrl = params.get(PARAM_MAPPING_DOCUMENT_URL); } } else { configuration = req.getParams().get(PARAM_MAPPING_CONFIGURATION); document = req.getParams().get(PARAM_MAPPING_DOCUMENT); documentUrl = req.getParams().get(PARAM_MAPPING_DOCUMENT_URL); } if (configuration != null && documentUrl != null) { InputStream stream = IOUtils.toInputStream(configuration, StandardCharsets.UTF_8); try (MtasTokenizer tokenizer = new MtasTokenizer(stream);) { MtasFetchData fetchData = new MtasFetchData(new StringReader(documentUrl)); rsp.add(ACTION_MAPPING, tokenizer.getList(fetchData.getUrl(null, null))); tokenizer.close(); } catch (IOException | MtasParserException e) { log.debug(e); rsp.add(MESSAGE_ERROR, e.getMessage()); } finally { stream.close(); } } else if (configuration != null && document != null) { InputStream stream = IOUtils.toInputStream(configuration, StandardCharsets.UTF_8); try (MtasTokenizer tokenizer = new MtasTokenizer(stream);) { rsp.add(ACTION_MAPPING, tokenizer.getList(new StringReader(document))); tokenizer.close(); } catch (IOException e) { log.debug(e); rsp.add(MESSAGE_ERROR, e.getMessage()); } finally { stream.close(); } } } else if (action.equals(ACTION_RUNNING) || action.equals(ACTION_HISTORY) || action.equals(ACTION_ERROR)) { boolean shardRequests = req.getParams().getBool(PARAM_SHARDREQUESTS, false); int number; try { number = Integer.parseInt(req.getParams().get(PARAM_NUMBER)); } catch (NumberFormatException e) { number = defaultNumber; } if (action.equals(ACTION_RUNNING)) { rsp.add(ACTION_RUNNING, running.createListOutput(shardRequests, number)); } else if (action.equals(ACTION_HISTORY)) { rsp.add(ACTION_HISTORY, history.createListOutput(shardRequests, number)); } else if (action.equals(ACTION_ERROR)) { rsp.add(ACTION_ERROR, error.createListOutput(shardRequests, number)); } } else if (action.equals(ACTION_STATUS)) { String key = req.getParams().get(PARAM_KEY, null); String abort = req.getParams().get(PARAM_ABORT, null); MtasSolrStatus solrStatus = null; if ((solrStatus = history.get(key)) != null || (solrStatus = running.get(key)) != null || (solrStatus = error.get(key)) != null) { if (abort != null && !solrStatus.finished()) { solrStatus.setError(abort); } rsp.add(ACTION_STATUS, solrStatus.createItemOutput()); } else { rsp.add(ACTION_STATUS, null); } } } } }
public class class_name { @Override public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws IOException { String action; if ((action = req.getParams().get(PARAM_ACTION)) != null) { // generate list of files if (action.equals(ACTION_CONFIG_FILES)) { String configDir = req.getCore().getResourceLoader().getConfigDir(); rsp.add(ACTION_CONFIG_FILES, getFiles(configDir, null)); // depends on control dependency: [if], data = [none] // get file } else if (action.equals(ACTION_CONFIG_FILE)) { String file = req.getParams().get(PARAM_CONFIG_FILE, null); if (file != null && !file.contains("..") && !file.startsWith("/")) { InputStream is; try { is = req.getCore().getResourceLoader().openResource(file); // depends on control dependency: [try], data = [none] rsp.add(ACTION_CONFIG_FILE, IOUtils.toString(is, StandardCharsets.UTF_8)); // depends on control dependency: [try], data = [none] } catch (IOException e) { log.debug(e); rsp.add(MESSAGE_ERROR, e.getMessage()); } // depends on control dependency: [catch], data = [none] } // test mapping } else if (action.equals(ACTION_MAPPING)) { String configuration = null; String document = null; String documentUrl = null; if (req.getContentStreams() != null) { Iterator<ContentStream> it = req.getContentStreams().iterator(); if (it.hasNext()) { ContentStream cs = it.next(); Map<String, String> params = new HashMap<>(); getParamsFromJSON(params, IOUtils.toString(cs.getReader())); // depends on control dependency: [if], data = [none] configuration = params.get(PARAM_MAPPING_CONFIGURATION); // depends on control dependency: [if], data = [none] document = params.get(PARAM_MAPPING_DOCUMENT); // depends on control dependency: [if], data = [none] documentUrl = params.get(PARAM_MAPPING_DOCUMENT_URL); // depends on control dependency: [if], data = [none] } } else { configuration = req.getParams().get(PARAM_MAPPING_CONFIGURATION); // depends on control dependency: [if], data = [none] document = req.getParams().get(PARAM_MAPPING_DOCUMENT); // depends on control dependency: [if], data = [none] documentUrl = req.getParams().get(PARAM_MAPPING_DOCUMENT_URL); // depends on control dependency: [if], data = [none] } if (configuration != null && documentUrl != null) { InputStream stream = IOUtils.toInputStream(configuration, StandardCharsets.UTF_8); try (MtasTokenizer tokenizer = new MtasTokenizer(stream);) { MtasFetchData fetchData = new MtasFetchData(new StringReader(documentUrl)); rsp.add(ACTION_MAPPING, tokenizer.getList(fetchData.getUrl(null, null))); tokenizer.close(); } catch (IOException | MtasParserException e) { // depends on control dependency: [if], data = [none] log.debug(e); rsp.add(MESSAGE_ERROR, e.getMessage()); } finally { // depends on control dependency: [if], data = [none] stream.close(); } } else if (configuration != null && document != null) { InputStream stream = IOUtils.toInputStream(configuration, StandardCharsets.UTF_8); try (MtasTokenizer tokenizer = new MtasTokenizer(stream);) { rsp.add(ACTION_MAPPING, tokenizer.getList(new StringReader(document))); tokenizer.close(); } catch (IOException e) { // depends on control dependency: [if], data = [none] log.debug(e); rsp.add(MESSAGE_ERROR, e.getMessage()); } finally { // depends on control dependency: [if], data = [none] stream.close(); } } } else if (action.equals(ACTION_RUNNING) || action.equals(ACTION_HISTORY) || action.equals(ACTION_ERROR)) { boolean shardRequests = req.getParams().getBool(PARAM_SHARDREQUESTS, false); int number; try { number = Integer.parseInt(req.getParams().get(PARAM_NUMBER)); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { number = defaultNumber; } // depends on control dependency: [catch], data = [none] if (action.equals(ACTION_RUNNING)) { rsp.add(ACTION_RUNNING, running.createListOutput(shardRequests, number)); // depends on control dependency: [if], data = [none] } else if (action.equals(ACTION_HISTORY)) { rsp.add(ACTION_HISTORY, history.createListOutput(shardRequests, number)); // depends on control dependency: [if], data = [none] } else if (action.equals(ACTION_ERROR)) { rsp.add(ACTION_ERROR, error.createListOutput(shardRequests, number)); // depends on control dependency: [if], data = [none] } } else if (action.equals(ACTION_STATUS)) { String key = req.getParams().get(PARAM_KEY, null); String abort = req.getParams().get(PARAM_ABORT, null); MtasSolrStatus solrStatus = null; if ((solrStatus = history.get(key)) != null || (solrStatus = running.get(key)) != null || (solrStatus = error.get(key)) != null) { if (abort != null && !solrStatus.finished()) { solrStatus.setError(abort); // depends on control dependency: [if], data = [(abort] } rsp.add(ACTION_STATUS, solrStatus.createItemOutput()); // depends on control dependency: [if], data = [none] } else { rsp.add(ACTION_STATUS, null); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { private static void addDescriptions(Entry entry, String... descriptions) { try { entry.add(SchemaConstants.OBJECT_CLASS_ATTRIBUTE, SchemaConstants.DESCRIPTIVE_OBJECT_OC); if (descriptions == null) { // case 1 entry.add(SchemaConstants.EMPTY_FLAG_ATTRIBUTE, String.valueOf(false)); } else if (descriptions.length == 1 && descriptions[0].isEmpty()) { // case 2 entry.add(SchemaConstants.EMPTY_FLAG_ATTRIBUTE, String.valueOf(true)); } else { // case 3 entry.add(SchemaConstants.STRING_ATTRIBUTE, StringUtils.join(descriptions, ServerConfig.multipleValueSeparator)); } } catch (LdapException e) { throw new LdapRuntimeException(e); } } }
public class class_name { private static void addDescriptions(Entry entry, String... descriptions) { try { entry.add(SchemaConstants.OBJECT_CLASS_ATTRIBUTE, SchemaConstants.DESCRIPTIVE_OBJECT_OC); // depends on control dependency: [try], data = [none] if (descriptions == null) { // case 1 entry.add(SchemaConstants.EMPTY_FLAG_ATTRIBUTE, String.valueOf(false)); // depends on control dependency: [if], data = [none] } else if (descriptions.length == 1 && descriptions[0].isEmpty()) { // case 2 entry.add(SchemaConstants.EMPTY_FLAG_ATTRIBUTE, String.valueOf(true)); // depends on control dependency: [if], data = [none] } else { // case 3 entry.add(SchemaConstants.STRING_ATTRIBUTE, StringUtils.join(descriptions, ServerConfig.multipleValueSeparator)); // depends on control dependency: [if], data = [none] } } catch (LdapException e) { throw new LdapRuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void setChainStartRetryInterval(Object value) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Setting chain start retry interval [" + value + "]"); } try { long num = MetatypeUtils.parseLong(PROPERTY_CONFIG_ALIAS, PROPERTY_CHAIN_START_RETRY_INTERVAL, value, chainStartRetryInterval); if (0L <= num) { this.chainStartRetryInterval = num; } else { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Value is too low"); } } } catch (NumberFormatException nfe) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Value is not a number"); } } } }
public class class_name { public void setChainStartRetryInterval(Object value) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Setting chain start retry interval [" + value + "]"); // depends on control dependency: [if], data = [none] } try { long num = MetatypeUtils.parseLong(PROPERTY_CONFIG_ALIAS, PROPERTY_CHAIN_START_RETRY_INTERVAL, value, chainStartRetryInterval); if (0L <= num) { this.chainStartRetryInterval = num; // depends on control dependency: [if], data = [none] } else { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Value is too low"); // depends on control dependency: [if], data = [none] } } } catch (NumberFormatException nfe) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Value is not a number"); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Observable<ServiceResponse<OperationStatus>> updateWithServiceResponseAsync(UUID appId, String versionId, String version) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } TaskUpdateObject versionUpdateObject = new TaskUpdateObject(); versionUpdateObject.withVersion(version); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); return service.update(appId, versionId, this.client.acceptLanguage(), versionUpdateObject, parameterizedHost, this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<OperationStatus>>>() { @Override public Observable<ServiceResponse<OperationStatus>> call(Response<ResponseBody> response) { try { ServiceResponse<OperationStatus> clientResponse = updateDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<OperationStatus>> updateWithServiceResponseAsync(UUID appId, String versionId, String version) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } TaskUpdateObject versionUpdateObject = new TaskUpdateObject(); versionUpdateObject.withVersion(version); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); return service.update(appId, versionId, this.client.acceptLanguage(), versionUpdateObject, parameterizedHost, this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<OperationStatus>>>() { @Override public Observable<ServiceResponse<OperationStatus>> call(Response<ResponseBody> response) { try { ServiceResponse<OperationStatus> clientResponse = updateDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { @Pure public static double getTriangleSegmentIntersectionFactorWithJimenezAlgorithm( double tx1, double ty1, double tz1, double tx2, double ty2, double tz2, double tx3, double ty3, double tz3, double sx1, double sy1, double sz1, double sx2, double sy2, double sz2) { // Input: Triangle (V1, V2, V3); Segment(Q1, Q2) // A = Q1 - V3 double Ax = sx1 - tx3; double Ay = sy1 - ty3; double Az = sz1 - tz3; // B = V1 - V3 double Bx = tx1 - tx3; double By = ty1 - ty3; double Bz = tz1 - tz3; // C = V2 - V3 double Cx = tx2 - tx3; double Cy = ty2 - ty3; double Cz = tz2 - tz3; // W1 = B x C Vector3f W1 = new Vector3f(); FunctionalVector3D.crossProduct(Bx, By, Bz, Cx, Cy, Cz, W1); // w = A . W1 double w = FunctionalVector3D.dotProduct(Ax, Ay, Az, W1.getX(), W1.getY(), W1.getZ()); // D = Q2 - Q1 double Dx = sx2 - sx1; double Dy = sy2 - sy1; double Dz = sz2 - sz1; // s = D . W1 double t, u; double s = FunctionalVector3D.dotProduct(Dx, Dy, Dz, W1.getX(), W1.getY(), W1.getZ()); int cmp = MathUtil.compareEpsilon(w, 0.); if (cmp > 0) { // Case: if (w > epsilon) // // if (s > epsilon) rejection 2 if (!MathUtil.isEpsilonZero(s)) { return Double.NaN; } // W2 = A x D Vector3f W2 = new Vector3f(); FunctionalVector3D.crossProduct(Ax, Ay, Az, Dx, Dy, Dz, W2); // t = W2 . C t = FunctionalVector3D.dotProduct(W2.getX(), W2.getY(), W2.getZ(), Cx, Cy, Cz); // if (t < -epsilon) rejection 3 if ( t < -MathConstants.EPSILON) { return Double.NaN; } // u = - W2 . B u = - FunctionalVector3D.dotProduct(W2.getX(), W2.getY(), W2.getZ(), Bx, By, Bz); // if ( u < -epsilon) rejection 4 if (u < -MathConstants.EPSILON) { return Double.NaN; } // if (w < s + t + u) rejection 5 if (w < (s + t + u)) { return Double.NaN; } } else if (cmp < 0) { // Case: if (w < -epsilon) // // if (s < -epsilon) rejection 2 if (s < -MathConstants.EPSILON) { return Double.NaN; } // W2 = A x D Vector3f W2 = new Vector3f(); FunctionalVector3D.crossProduct(Ax, Ay, Az, Dx, Dy, Dz, W2); // t = W2 . C t = FunctionalVector3D.dotProduct(W2.getX(), W2.getY(), W2.getZ(), Cx, Cy, Cz); // if (t > epsilon) rejection 3 if ( t > MathConstants.EPSILON) { return Double.NaN; } // u = - W2 . B u = - FunctionalVector3D.dotProduct(W2.getX(), W2.getY(), W2.getZ(), Bx, By, Bz); // if ( u > epsilon) rejection 4 if (u > MathConstants.EPSILON) { return Double.NaN; } // if (w > s + t + u) rejection 5 if (w > (s + t + u)) { return Double.NaN; } } else { // Case: if (-epsilon <= w <= epsilon) // Swap Q1, Q2 if (s > MathConstants.EPSILON) { // if (s > epsilon) // // W2 = D x A Vector3f W2 = new Vector3f(); FunctionalVector3D.crossProduct(Dx, Dy, Dz, Ax, Ay, Az, W2); // t = W2 . C t = FunctionalVector3D.dotProduct(W2.getX(), W2.getY(), W2.getZ(), Cx, Cy, Cz); // if (t < -epsilon) rejection 3 if (t < -MathConstants.EPSILON) { return Double.NaN; } // u = - W2 . B u = - FunctionalVector3D.dotProduct(W2.getX(), W2.getY(), W2.getZ(), Bx, By, Bz); // if ( u < -epsilon) rejection 4 if (u < -MathConstants.EPSILON) { return Double.NaN; } // if (-s < t + u) rejection 5 if (-s < (t + u)) { return Double.NaN; } } else if (s < -MathConstants.EPSILON) { // if (s < -epsilon) // // W2 = D x A Vector3f W2 = new Vector3f(); FunctionalVector3D.crossProduct(Dx, Dy, Dz, Ax, Ay, Az, W2); // t = W2 . C t = FunctionalVector3D.dotProduct(W2.getX(), W2.getY(), W2.getZ(), Cx, Cy, Cz); // if (t > epsilon) rejection 3 if (t > MathConstants.EPSILON) { return Double.NaN; } // u = - W2 . B u = - FunctionalVector3D.dotProduct(W2.getX(), W2.getY(), W2.getZ(), Bx, By, Bz); // if ( u > epsilon) rejection 4 if (u > MathConstants.EPSILON) { return Double.NaN; } // if (-s > t + u) rejection 5 if (-s > (t + u)) { return Double.NaN; } } else { // rejection 1 return Double.NaN; } } // double tt = 1. / (s-w); double t_param = w / (s-w); // double alpha = tt * t; // double beta = tt * u; return t_param; } }
public class class_name { @Pure public static double getTriangleSegmentIntersectionFactorWithJimenezAlgorithm( double tx1, double ty1, double tz1, double tx2, double ty2, double tz2, double tx3, double ty3, double tz3, double sx1, double sy1, double sz1, double sx2, double sy2, double sz2) { // Input: Triangle (V1, V2, V3); Segment(Q1, Q2) // A = Q1 - V3 double Ax = sx1 - tx3; double Ay = sy1 - ty3; double Az = sz1 - tz3; // B = V1 - V3 double Bx = tx1 - tx3; double By = ty1 - ty3; double Bz = tz1 - tz3; // C = V2 - V3 double Cx = tx2 - tx3; double Cy = ty2 - ty3; double Cz = tz2 - tz3; // W1 = B x C Vector3f W1 = new Vector3f(); FunctionalVector3D.crossProduct(Bx, By, Bz, Cx, Cy, Cz, W1); // w = A . W1 double w = FunctionalVector3D.dotProduct(Ax, Ay, Az, W1.getX(), W1.getY(), W1.getZ()); // D = Q2 - Q1 double Dx = sx2 - sx1; double Dy = sy2 - sy1; double Dz = sz2 - sz1; // s = D . W1 double t, u; double s = FunctionalVector3D.dotProduct(Dx, Dy, Dz, W1.getX(), W1.getY(), W1.getZ()); int cmp = MathUtil.compareEpsilon(w, 0.); if (cmp > 0) { // Case: if (w > epsilon) // // if (s > epsilon) rejection 2 if (!MathUtil.isEpsilonZero(s)) { return Double.NaN; // depends on control dependency: [if], data = [none] } // W2 = A x D Vector3f W2 = new Vector3f(); FunctionalVector3D.crossProduct(Ax, Ay, Az, Dx, Dy, Dz, W2); // depends on control dependency: [if], data = [none] // t = W2 . C t = FunctionalVector3D.dotProduct(W2.getX(), W2.getY(), W2.getZ(), Cx, Cy, Cz); // depends on control dependency: [if], data = [none] // if (t < -epsilon) rejection 3 if ( t < -MathConstants.EPSILON) { return Double.NaN; // depends on control dependency: [if], data = [none] } // u = - W2 . B u = - FunctionalVector3D.dotProduct(W2.getX(), W2.getY(), W2.getZ(), Bx, By, Bz); // depends on control dependency: [if], data = [none] // if ( u < -epsilon) rejection 4 if (u < -MathConstants.EPSILON) { return Double.NaN; // depends on control dependency: [if], data = [none] } // if (w < s + t + u) rejection 5 if (w < (s + t + u)) { return Double.NaN; // depends on control dependency: [if], data = [none] } } else if (cmp < 0) { // Case: if (w < -epsilon) // // if (s < -epsilon) rejection 2 if (s < -MathConstants.EPSILON) { return Double.NaN; // depends on control dependency: [if], data = [none] } // W2 = A x D Vector3f W2 = new Vector3f(); FunctionalVector3D.crossProduct(Ax, Ay, Az, Dx, Dy, Dz, W2); // depends on control dependency: [if], data = [none] // t = W2 . C t = FunctionalVector3D.dotProduct(W2.getX(), W2.getY(), W2.getZ(), Cx, Cy, Cz); // depends on control dependency: [if], data = [none] // if (t > epsilon) rejection 3 if ( t > MathConstants.EPSILON) { return Double.NaN; // depends on control dependency: [if], data = [none] } // u = - W2 . B u = - FunctionalVector3D.dotProduct(W2.getX(), W2.getY(), W2.getZ(), Bx, By, Bz); // depends on control dependency: [if], data = [none] // if ( u > epsilon) rejection 4 if (u > MathConstants.EPSILON) { return Double.NaN; // depends on control dependency: [if], data = [none] } // if (w > s + t + u) rejection 5 if (w > (s + t + u)) { return Double.NaN; // depends on control dependency: [if], data = [none] } } else { // Case: if (-epsilon <= w <= epsilon) // Swap Q1, Q2 if (s > MathConstants.EPSILON) { // if (s > epsilon) // // W2 = D x A Vector3f W2 = new Vector3f(); FunctionalVector3D.crossProduct(Dx, Dy, Dz, Ax, Ay, Az, W2); // depends on control dependency: [if], data = [none] // t = W2 . C t = FunctionalVector3D.dotProduct(W2.getX(), W2.getY(), W2.getZ(), Cx, Cy, Cz); // depends on control dependency: [if], data = [none] // if (t < -epsilon) rejection 3 if (t < -MathConstants.EPSILON) { return Double.NaN; // depends on control dependency: [if], data = [none] } // u = - W2 . B u = - FunctionalVector3D.dotProduct(W2.getX(), W2.getY(), W2.getZ(), Bx, By, Bz); // depends on control dependency: [if], data = [none] // if ( u < -epsilon) rejection 4 if (u < -MathConstants.EPSILON) { return Double.NaN; // depends on control dependency: [if], data = [none] } // if (-s < t + u) rejection 5 if (-s < (t + u)) { return Double.NaN; // depends on control dependency: [if], data = [none] } } else if (s < -MathConstants.EPSILON) { // if (s < -epsilon) // // W2 = D x A Vector3f W2 = new Vector3f(); FunctionalVector3D.crossProduct(Dx, Dy, Dz, Ax, Ay, Az, W2); // depends on control dependency: [if], data = [none] // t = W2 . C t = FunctionalVector3D.dotProduct(W2.getX(), W2.getY(), W2.getZ(), Cx, Cy, Cz); // depends on control dependency: [if], data = [none] // if (t > epsilon) rejection 3 if (t > MathConstants.EPSILON) { return Double.NaN; // depends on control dependency: [if], data = [none] } // u = - W2 . B u = - FunctionalVector3D.dotProduct(W2.getX(), W2.getY(), W2.getZ(), Bx, By, Bz); // depends on control dependency: [if], data = [none] // if ( u > epsilon) rejection 4 if (u > MathConstants.EPSILON) { return Double.NaN; // depends on control dependency: [if], data = [none] } // if (-s > t + u) rejection 5 if (-s > (t + u)) { return Double.NaN; // depends on control dependency: [if], data = [none] } } else { // rejection 1 return Double.NaN; // depends on control dependency: [if], data = [none] } } // double tt = 1. / (s-w); double t_param = w / (s-w); // double alpha = tt * t; // double beta = tt * u; return t_param; } }
public class class_name { public DescribeDhcpOptionsRequest withDhcpOptionsIds(String... dhcpOptionsIds) { if (this.dhcpOptionsIds == null) { setDhcpOptionsIds(new com.amazonaws.internal.SdkInternalList<String>(dhcpOptionsIds.length)); } for (String ele : dhcpOptionsIds) { this.dhcpOptionsIds.add(ele); } return this; } }
public class class_name { public DescribeDhcpOptionsRequest withDhcpOptionsIds(String... dhcpOptionsIds) { if (this.dhcpOptionsIds == null) { setDhcpOptionsIds(new com.amazonaws.internal.SdkInternalList<String>(dhcpOptionsIds.length)); // depends on control dependency: [if], data = [none] } for (String ele : dhcpOptionsIds) { this.dhcpOptionsIds.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { @SuppressWarnings("rawtypes") private boolean hasGroups(final Annotation anno, final Class<?>... groups) { final Optional<Class[]> targetGroups = Utils.getAnnotationAttribute(anno, "groups", Class[].class); if(!targetGroups.isPresent()) { // groups属性を持たない場合 return false; } if(groups.length == 0) { if(targetGroups.get().length == 0) { // グループの指定がない場合は、デフォルトグループとして処理。 return true; } else { for(Class<?> targetGroup : targetGroups.get()) { if(targetGroup.equals(DefaultGroup.class)) { // デフォルトを直接指定している場合に、グループと一致。 return true; } } } } else { // グループの指定がある場合 for(Class<?> group : groups) { if(group.equals(DefaultGroup.class) && targetGroups.get().length == 0) { // フィールド側にグループの指定がない場合は、デフォルトグループとして処理する。 return true; } for(Class<?> targetGroup : targetGroups.get()) { // 一致するグループを持つか判定する。 if(targetGroup.equals(group)) { return true; } } } } return false; } }
public class class_name { @SuppressWarnings("rawtypes") private boolean hasGroups(final Annotation anno, final Class<?>... groups) { final Optional<Class[]> targetGroups = Utils.getAnnotationAttribute(anno, "groups", Class[].class); if(!targetGroups.isPresent()) { // groups属性を持たない場合 return false; // depends on control dependency: [if], data = [none] } if(groups.length == 0) { if(targetGroups.get().length == 0) { // グループの指定がない場合は、デフォルトグループとして処理。 return true; // depends on control dependency: [if], data = [none] } else { for(Class<?> targetGroup : targetGroups.get()) { if(targetGroup.equals(DefaultGroup.class)) { // デフォルトを直接指定している場合に、グループと一致。 return true; // depends on control dependency: [if], data = [none] } } } } else { // グループの指定がある場合 for(Class<?> group : groups) { if(group.equals(DefaultGroup.class) && targetGroups.get().length == 0) { // フィールド側にグループの指定がない場合は、デフォルトグループとして処理する。 return true; // depends on control dependency: [if], data = [none] } for(Class<?> targetGroup : targetGroups.get()) { // 一致するグループを持つか判定する。 if(targetGroup.equals(group)) { return true; // depends on control dependency: [if], data = [none] } } } } return false; } }
public class class_name { @NotNull public Optional<IntPair<T>> findIndexed( int from, int step, @NotNull IndexedPredicate<? super T> predicate) { int index = from; while (iterator.hasNext()) { final T value = iterator.next(); if (predicate.test(index, value)) { return Optional.of(new IntPair<T>(index, value)); } index += step; } return Optional.empty(); } }
public class class_name { @NotNull public Optional<IntPair<T>> findIndexed( int from, int step, @NotNull IndexedPredicate<? super T> predicate) { int index = from; while (iterator.hasNext()) { final T value = iterator.next(); if (predicate.test(index, value)) { return Optional.of(new IntPair<T>(index, value)); // depends on control dependency: [if], data = [none] } index += step; // depends on control dependency: [while], data = [none] } return Optional.empty(); } }
public class class_name { public static <K, V> Map<K, V> toSorted(Map<K, V> self, Comparator<Map.Entry<K, V>> comparator) { List<Map.Entry<K, V>> sortedEntries = toSorted(self.entrySet(), comparator); Map<K, V> result = new LinkedHashMap<K, V>(); for (Map.Entry<K, V> entry : sortedEntries) { result.put(entry.getKey(), entry.getValue()); } return result; } }
public class class_name { public static <K, V> Map<K, V> toSorted(Map<K, V> self, Comparator<Map.Entry<K, V>> comparator) { List<Map.Entry<K, V>> sortedEntries = toSorted(self.entrySet(), comparator); Map<K, V> result = new LinkedHashMap<K, V>(); for (Map.Entry<K, V> entry : sortedEntries) { result.put(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry] } return result; } }
public class class_name { public void setActions(java.util.Collection<DatasetAction> actions) { if (actions == null) { this.actions = null; return; } this.actions = new java.util.ArrayList<DatasetAction>(actions); } }
public class class_name { public void setActions(java.util.Collection<DatasetAction> actions) { if (actions == null) { this.actions = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.actions = new java.util.ArrayList<DatasetAction>(actions); } }
public class class_name { void processNames(Collection<String> namesToResolve) { for (String name : namesToResolve) { SampleResource sample = sampleIndex.get(name.toLowerCase()); if (sample != null) { // Found a sample, add it and any required features samplesToInstall.add(sample); if (sample.getRequireFeature() != null) { featureNamesToResolve.addAll(sample.getRequireFeature()); } } else { // Name didn't match any samples, assume it's a feature name NameAndVersion nameAndVersion = splitRequestedNameAndVersion(name); if (nameAndVersion.version != null) { resolverRepository.setPreferredVersion(nameAndVersion.name, nameAndVersion.version); } featureNamesToResolve.add(nameAndVersion.name); requestedFeatureNames.add(nameAndVersion.name); } } } }
public class class_name { void processNames(Collection<String> namesToResolve) { for (String name : namesToResolve) { SampleResource sample = sampleIndex.get(name.toLowerCase()); if (sample != null) { // Found a sample, add it and any required features samplesToInstall.add(sample); // depends on control dependency: [if], data = [(sample] if (sample.getRequireFeature() != null) { featureNamesToResolve.addAll(sample.getRequireFeature()); // depends on control dependency: [if], data = [(sample.getRequireFeature()] } } else { // Name didn't match any samples, assume it's a feature name NameAndVersion nameAndVersion = splitRequestedNameAndVersion(name); if (nameAndVersion.version != null) { resolverRepository.setPreferredVersion(nameAndVersion.name, nameAndVersion.version); // depends on control dependency: [if], data = [none] } featureNamesToResolve.add(nameAndVersion.name); // depends on control dependency: [if], data = [none] requestedFeatureNames.add(nameAndVersion.name); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static Field[] getDeclaredFieldsInHierarchy(Class<?> clazz) { List<Field> fields = new ArrayList<Field>(); for (Class<?> acls = clazz; acls != null; acls = acls.getSuperclass()) { for (Field field : acls.getDeclaredFields()) { fields.add(field); } } return fields.toArray(new Field[fields.size()]); } }
public class class_name { public static Field[] getDeclaredFieldsInHierarchy(Class<?> clazz) { List<Field> fields = new ArrayList<Field>(); for (Class<?> acls = clazz; acls != null; acls = acls.getSuperclass()) { for (Field field : acls.getDeclaredFields()) { fields.add(field); // depends on control dependency: [for], data = [field] } } return fields.toArray(new Field[fields.size()]); } }
public class class_name { public String getViewableName() { String name = getName(); if (DBProperties.hasProperty("Command." + getName())) { name = DBProperties.getProperty("Command." + getName()); } return name; } }
public class class_name { public String getViewableName() { String name = getName(); if (DBProperties.hasProperty("Command." + getName())) { name = DBProperties.getProperty("Command." + getName()); // depends on control dependency: [if], data = [none] } return name; } }
public class class_name { private static String detectSystemType(String systemType, String osName, boolean currentSystem) { if (!isEmpty(systemType)) { return systemType; } if (isEmpty(osName)) { return UNKNOWN; } String os = osName.toLowerCase(Locale.US).trim(); if (os.startsWith("windows")) { return SYSTEM_TYPE_WINDOWS; } else if (os.startsWith("mac")) { return SYSTEM_TYPE_MAC_OS; } else if (os.startsWith("ios")) { return SYSTEM_TYPE_IOS; } else if (os.contains("linux")) { return SYSTEM_TYPE_LINUX; } else if (os.contains("bsd")) { return SYSTEM_TYPE_BSD; } else if (os.contains("solaris") || os.contains("hp-ux") || os.contains("nix") || os.contains("aix") || os.contains("nextstep") || os.contains("sorix") || os.contains("irix")) { return SYSTEM_TYPE_UNIX; } else if (os.startsWith("z/") || os.startsWith("os/360") || os.startsWith("os/390") || os.startsWith("os/400") || os.startsWith("bs2000") || os.startsWith("mvs") || os.startsWith("aix") || os.startsWith("tpf") || os.equals("cms")) { return SYSTEM_TYPE_MAINFRAIME; } else { return UNKNOWN; } } }
public class class_name { private static String detectSystemType(String systemType, String osName, boolean currentSystem) { if (!isEmpty(systemType)) { return systemType; // depends on control dependency: [if], data = [none] } if (isEmpty(osName)) { return UNKNOWN; // depends on control dependency: [if], data = [none] } String os = osName.toLowerCase(Locale.US).trim(); if (os.startsWith("windows")) { return SYSTEM_TYPE_WINDOWS; // depends on control dependency: [if], data = [none] } else if (os.startsWith("mac")) { return SYSTEM_TYPE_MAC_OS; // depends on control dependency: [if], data = [none] } else if (os.startsWith("ios")) { return SYSTEM_TYPE_IOS; // depends on control dependency: [if], data = [none] } else if (os.contains("linux")) { return SYSTEM_TYPE_LINUX; // depends on control dependency: [if], data = [none] } else if (os.contains("bsd")) { return SYSTEM_TYPE_BSD; // depends on control dependency: [if], data = [none] } else if (os.contains("solaris") || os.contains("hp-ux") || os.contains("nix") || os.contains("aix") || os.contains("nextstep") || os.contains("sorix") || os.contains("irix")) { return SYSTEM_TYPE_UNIX; // depends on control dependency: [if], data = [none] } else if (os.startsWith("z/") || os.startsWith("os/360") || os.startsWith("os/390") || os.startsWith("os/400") || os.startsWith("bs2000") || os.startsWith("mvs") || os.startsWith("aix") || os.startsWith("tpf") || os.equals("cms")) { return SYSTEM_TYPE_MAINFRAIME; // depends on control dependency: [if], data = [none] } else { return UNKNOWN; // depends on control dependency: [if], data = [none] } } }
public class class_name { public ArgumentBuilder withPreCompiledArguments(final List<String> preCompiledArguments) { // Check sanity Validate.notNull(preCompiledArguments, "preCompiledArguments"); // Add the preCompiledArguments in the exact order they were given. synchronized (lock) { for (String current : preCompiledArguments) { arguments.add(current); } } // All done. return this; } }
public class class_name { public ArgumentBuilder withPreCompiledArguments(final List<String> preCompiledArguments) { // Check sanity Validate.notNull(preCompiledArguments, "preCompiledArguments"); // Add the preCompiledArguments in the exact order they were given. synchronized (lock) { for (String current : preCompiledArguments) { arguments.add(current); // depends on control dependency: [for], data = [current] } } // All done. return this; } }
public class class_name { private void checkDoc() { if (foundDoc) { if (!checkDocWarningEmitted) { env.warning(null, "javadoc.Multiple_package_comments", name()); checkDocWarningEmitted = true; } } else { foundDoc = true; } } }
public class class_name { private void checkDoc() { if (foundDoc) { if (!checkDocWarningEmitted) { env.warning(null, "javadoc.Multiple_package_comments", name()); // depends on control dependency: [if], data = [none] checkDocWarningEmitted = true; // depends on control dependency: [if], data = [none] } } else { foundDoc = true; // depends on control dependency: [if], data = [none] } } }
public class class_name { @SuppressWarnings("unused") private void initializeClientPolling(Component component) { if (component instanceof AbstractComponent) { AbstractComponent acomp = (AbstractComponent)component; for (Extension extension : acomp.getExtensions()) { if (extension instanceof CmsPollServerExtension) { return; } } new CmsPollServerExtension((AbstractComponent)component); } } }
public class class_name { @SuppressWarnings("unused") private void initializeClientPolling(Component component) { if (component instanceof AbstractComponent) { AbstractComponent acomp = (AbstractComponent)component; for (Extension extension : acomp.getExtensions()) { if (extension instanceof CmsPollServerExtension) { return; // depends on control dependency: [if], data = [none] } } new CmsPollServerExtension((AbstractComponent)component); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static ByteBuf append(ByteBufAllocator allocator, boolean useDirect, PemEncoded encoded, int count, ByteBuf pem) { ByteBuf content = encoded.content(); if (pem == null) { // see the other append() method pem = newBuffer(allocator, useDirect, content.readableBytes() * count); } pem.writeBytes(content.slice()); return pem; } }
public class class_name { private static ByteBuf append(ByteBufAllocator allocator, boolean useDirect, PemEncoded encoded, int count, ByteBuf pem) { ByteBuf content = encoded.content(); if (pem == null) { // see the other append() method pem = newBuffer(allocator, useDirect, content.readableBytes() * count); // depends on control dependency: [if], data = [none] } pem.writeBytes(content.slice()); return pem; } }
public class class_name { public static byte [][] toByteArrays(final String [] t) { byte [][] result = new byte[t.length][]; for (int i = 0; i < t.length; i++) { result[i] = Bytes.toBytes(t[i]); } return result; } }
public class class_name { public static byte [][] toByteArrays(final String [] t) { byte [][] result = new byte[t.length][]; for (int i = 0; i < t.length; i++) { result[i] = Bytes.toBytes(t[i]); // depends on control dependency: [for], data = [i] } return result; } }
public class class_name { public JvmOperation toGetter(/* @Nullable */ final EObject sourceElement, /* @Nullable */ final String propertyName, /* @Nullable */ final String fieldName, /* @Nullable */ JvmTypeReference typeRef) { if(sourceElement == null || propertyName == null || fieldName == null) return null; JvmOperation result = typesFactory.createJvmOperation(); result.setVisibility(JvmVisibility.PUBLIC); String prefix = (isPrimitiveBoolean(typeRef) ? "is" : "get"); result.setSimpleName(prefix + Strings.toFirstUpper(propertyName)); result.setReturnType(cloneWithProxies(typeRef)); setBody(result, new Procedures.Procedure1<ITreeAppendable>() { @Override public void apply(/* @Nullable */ ITreeAppendable p) { if(p != null) { p = p.trace(sourceElement); p.append("return this."); p.append(javaKeywords.isJavaKeyword(fieldName) ? fieldName+"_" : fieldName); p.append(";"); } } }); return associate(sourceElement, result); } }
public class class_name { public JvmOperation toGetter(/* @Nullable */ final EObject sourceElement, /* @Nullable */ final String propertyName, /* @Nullable */ final String fieldName, /* @Nullable */ JvmTypeReference typeRef) { if(sourceElement == null || propertyName == null || fieldName == null) return null; JvmOperation result = typesFactory.createJvmOperation(); result.setVisibility(JvmVisibility.PUBLIC); String prefix = (isPrimitiveBoolean(typeRef) ? "is" : "get"); result.setSimpleName(prefix + Strings.toFirstUpper(propertyName)); result.setReturnType(cloneWithProxies(typeRef)); setBody(result, new Procedures.Procedure1<ITreeAppendable>() { @Override public void apply(/* @Nullable */ ITreeAppendable p) { if(p != null) { p = p.trace(sourceElement); // depends on control dependency: [if], data = [none] p.append("return this."); // depends on control dependency: [if], data = [none] p.append(javaKeywords.isJavaKeyword(fieldName) ? fieldName+"_" : fieldName); // depends on control dependency: [if], data = [none] p.append(";"); // depends on control dependency: [if], data = [none] } } }); return associate(sourceElement, result); } }
public class class_name { public SimpleOrderedMap<Object> check(String id) throws IOException { if (idToVersion.containsKey(id)) { String version = idToVersion.get(id); MtasSolrCollectionCacheItem item = versionToItem.get(version); Date date = new Date(); long now = date.getTime(); if (verify(version, now)) { SimpleOrderedMap<Object> data = new SimpleOrderedMap<>(); data.add("now", now); data.add("id", item.id); data.add("size", item.size); data.add("version", version); data.add("expiration", expirationVersion.get(version)); return data; } else { idToVersion.remove(id); versionToItem.remove(version); expirationVersion.remove(version); return null; } } else { return null; } } }
public class class_name { public SimpleOrderedMap<Object> check(String id) throws IOException { if (idToVersion.containsKey(id)) { String version = idToVersion.get(id); MtasSolrCollectionCacheItem item = versionToItem.get(version); Date date = new Date(); long now = date.getTime(); if (verify(version, now)) { SimpleOrderedMap<Object> data = new SimpleOrderedMap<>(); data.add("now", now); // depends on control dependency: [if], data = [none] data.add("id", item.id); // depends on control dependency: [if], data = [none] data.add("size", item.size); // depends on control dependency: [if], data = [none] data.add("version", version); // depends on control dependency: [if], data = [none] data.add("expiration", expirationVersion.get(version)); // depends on control dependency: [if], data = [none] return data; // depends on control dependency: [if], data = [none] } else { idToVersion.remove(id); // depends on control dependency: [if], data = [none] versionToItem.remove(version); // depends on control dependency: [if], data = [none] expirationVersion.remove(version); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } } else { return null; } } }
public class class_name { public void run() { LOGGER.debug("begin scan for config file changes ..."); try { Date lastModified = new Date(_xmlConfigFile.lastModified()); if (_lastTimeRead == null || lastModified.after(_lastTimeRead)) { LOGGER.info("loading config file changes ..."); this.loadServiceConfigFile(); _lastTimeRead = new Date(); } } catch (ConfigurationException e) { e.printStackTrace(); LOGGER.error( "Error loading configuation file: ", e ); } LOGGER.debug("finish scan for config file changes"); } }
public class class_name { public void run() { LOGGER.debug("begin scan for config file changes ..."); try { Date lastModified = new Date(_xmlConfigFile.lastModified()); if (_lastTimeRead == null || lastModified.after(_lastTimeRead)) { LOGGER.info("loading config file changes ..."); // depends on control dependency: [if], data = [none] this.loadServiceConfigFile(); // depends on control dependency: [if], data = [none] _lastTimeRead = new Date(); // depends on control dependency: [if], data = [none] } } catch (ConfigurationException e) { e.printStackTrace(); LOGGER.error( "Error loading configuation file: ", e ); } // depends on control dependency: [catch], data = [none] LOGGER.debug("finish scan for config file changes"); } }
public class class_name { static GJLocaleSymbols forLocale(Locale locale) { if (locale == null) { locale = Locale.getDefault(); } GJLocaleSymbols symbols = cCache.get(locale); if (symbols == null) { symbols = new GJLocaleSymbols(locale); GJLocaleSymbols oldSymbols = cCache.putIfAbsent(locale, symbols); if (oldSymbols != null) { symbols = oldSymbols; } } return symbols; } }
public class class_name { static GJLocaleSymbols forLocale(Locale locale) { if (locale == null) { locale = Locale.getDefault(); // depends on control dependency: [if], data = [none] } GJLocaleSymbols symbols = cCache.get(locale); if (symbols == null) { symbols = new GJLocaleSymbols(locale); // depends on control dependency: [if], data = [none] GJLocaleSymbols oldSymbols = cCache.putIfAbsent(locale, symbols); if (oldSymbols != null) { symbols = oldSymbols; // depends on control dependency: [if], data = [none] } } return symbols; } }
public class class_name { public UserDefinedFunction withResourceUris(ResourceUri... resourceUris) { if (this.resourceUris == null) { setResourceUris(new java.util.ArrayList<ResourceUri>(resourceUris.length)); } for (ResourceUri ele : resourceUris) { this.resourceUris.add(ele); } return this; } }
public class class_name { public UserDefinedFunction withResourceUris(ResourceUri... resourceUris) { if (this.resourceUris == null) { setResourceUris(new java.util.ArrayList<ResourceUri>(resourceUris.length)); // depends on control dependency: [if], data = [none] } for (ResourceUri ele : resourceUris) { this.resourceUris.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public String getIconForEntry(CmsClientSitemapEntry entry) { String result; if (isNavigationMode()) { if (m_controller.isDetailPage(entry.getId())) { result = m_controller.getDetailPageInfo(entry.getId()).getIconClasses(); } else { result = entry.getNavModeIcon(); } } else { result = entry.getVfsModeIcon(); } return result; } }
public class class_name { public String getIconForEntry(CmsClientSitemapEntry entry) { String result; if (isNavigationMode()) { if (m_controller.isDetailPage(entry.getId())) { result = m_controller.getDetailPageInfo(entry.getId()).getIconClasses(); // depends on control dependency: [if], data = [none] } else { result = entry.getNavModeIcon(); // depends on control dependency: [if], data = [none] } } else { result = entry.getVfsModeIcon(); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public String getListCacheKey() { Object table = getLookupTable(); if (table != null && ConfigurationProperties.getDatalistCaching()) { String key = APPLICATION_LOOKUP_TABLE.getCacheKeyForTable(table); return key; } return null; } }
public class class_name { public String getListCacheKey() { Object table = getLookupTable(); if (table != null && ConfigurationProperties.getDatalistCaching()) { String key = APPLICATION_LOOKUP_TABLE.getCacheKeyForTable(table); return key; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public static List<Float> parseFloatList(String option) throws ParseException { String[] f = option.split(","); List<Float> rv = new ArrayList<>(); try { for (int i = 0; i < f.length; i++) { rv.add(Float.parseFloat(f[i])); } return rv; } catch (NumberFormatException e) { throw new ParseException("Wrong number syntax"); } } }
public class class_name { public static List<Float> parseFloatList(String option) throws ParseException { String[] f = option.split(","); List<Float> rv = new ArrayList<>(); try { for (int i = 0; i < f.length; i++) { rv.add(Float.parseFloat(f[i])); // depends on control dependency: [for], data = [i] } return rv; } catch (NumberFormatException e) { throw new ParseException("Wrong number syntax"); } } }
public class class_name { public List<com.ibm.wsspi.security.wim.model.CheckPointType> getCheckPoint() { if (checkPoint == null) { checkPoint = new ArrayList<com.ibm.wsspi.security.wim.model.CheckPointType>(); } return this.checkPoint; } }
public class class_name { public List<com.ibm.wsspi.security.wim.model.CheckPointType> getCheckPoint() { if (checkPoint == null) { checkPoint = new ArrayList<com.ibm.wsspi.security.wim.model.CheckPointType>(); // depends on control dependency: [if], data = [none] } return this.checkPoint; } }
public class class_name { private static boolean isTicketGrantingServerPrincipal(KerberosPrincipal principal) { if (principal == null) { return false; } if (principal.getName().equals("krbtgt/" + principal.getRealm() + "@" + principal.getRealm())) { return true; } return false; } }
public class class_name { private static boolean isTicketGrantingServerPrincipal(KerberosPrincipal principal) { if (principal == null) { return false; // depends on control dependency: [if], data = [none] } if (principal.getName().equals("krbtgt/" + principal.getRealm() + "@" + principal.getRealm())) { return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public void addFieldDescriptor(FieldDescriptor fld) { fld.setClassDescriptor(this); // BRJ if (m_FieldDescriptions == null) { m_FieldDescriptions = new FieldDescriptor[1]; m_FieldDescriptions[0] = fld; } else { int size = m_FieldDescriptions.length; FieldDescriptor[] tmpArray = new FieldDescriptor[size + 1]; System.arraycopy(m_FieldDescriptions, 0, tmpArray, 0, size); tmpArray[size] = fld; m_FieldDescriptions = tmpArray; // 2. Sort fields according to their getOrder() Property Arrays.sort(m_FieldDescriptions, FieldDescriptor.getComparator()); } m_fieldDescriptorNameMap = null; m_PkFieldDescriptors = null; m_nonPkFieldDescriptors = null; m_lockingFieldDescriptors = null; m_RwFieldDescriptors = null; m_RwNonPkFieldDescriptors = null; } }
public class class_name { public void addFieldDescriptor(FieldDescriptor fld) { fld.setClassDescriptor(this); // BRJ if (m_FieldDescriptions == null) { m_FieldDescriptions = new FieldDescriptor[1]; // depends on control dependency: [if], data = [none] m_FieldDescriptions[0] = fld; // depends on control dependency: [if], data = [none] } else { int size = m_FieldDescriptions.length; FieldDescriptor[] tmpArray = new FieldDescriptor[size + 1]; System.arraycopy(m_FieldDescriptions, 0, tmpArray, 0, size); // depends on control dependency: [if], data = [(m_FieldDescriptions] tmpArray[size] = fld; // depends on control dependency: [if], data = [none] m_FieldDescriptions = tmpArray; // depends on control dependency: [if], data = [none] // 2. Sort fields according to their getOrder() Property Arrays.sort(m_FieldDescriptions, FieldDescriptor.getComparator()); // depends on control dependency: [if], data = [(m_FieldDescriptions] } m_fieldDescriptorNameMap = null; m_PkFieldDescriptors = null; m_nonPkFieldDescriptors = null; m_lockingFieldDescriptors = null; m_RwFieldDescriptors = null; m_RwNonPkFieldDescriptors = null; } }
public class class_name { private double[] getVotesForInstance(Instance instance) { ErrorWeightedVote errorWeightedVote=newErrorWeightedVote(); int numberOfRulesCovering = 0; for (ActiveRule rule: ruleSet) { if (rule.isCovering(instance) == true){ numberOfRulesCovering++; double [] vote=rule.getPrediction(instance); double error= rule.getCurrentError(); errorWeightedVote.addVote(vote,error); if (!this.unorderedRules) { // Ordered Rules Option. break; // Only one rule cover the instance. } } } if (numberOfRulesCovering == 0) { double [] vote=defaultRule.getPrediction(instance); double error= defaultRule.getCurrentError(); errorWeightedVote.addVote(vote,error); } double[] weightedVote=errorWeightedVote.computeWeightedVote(); return weightedVote; } }
public class class_name { private double[] getVotesForInstance(Instance instance) { ErrorWeightedVote errorWeightedVote=newErrorWeightedVote(); int numberOfRulesCovering = 0; for (ActiveRule rule: ruleSet) { if (rule.isCovering(instance) == true){ numberOfRulesCovering++; // depends on control dependency: [if], data = [none] double [] vote=rule.getPrediction(instance); double error= rule.getCurrentError(); errorWeightedVote.addVote(vote,error); // depends on control dependency: [if], data = [none] if (!this.unorderedRules) { // Ordered Rules Option. break; // Only one rule cover the instance. } } } if (numberOfRulesCovering == 0) { double [] vote=defaultRule.getPrediction(instance); double error= defaultRule.getCurrentError(); errorWeightedVote.addVote(vote,error); // depends on control dependency: [if], data = [none] } double[] weightedVote=errorWeightedVote.computeWeightedVote(); return weightedVote; } }
public class class_name { public Category getCategory(int pageId) { long hibernateId = __getCategoryHibernateId(pageId); if (hibernateId == -1) { return null; } try { Category cat = new Category(this, hibernateId); return cat; } catch (WikiPageNotFoundException e) { return null; } } }
public class class_name { public Category getCategory(int pageId) { long hibernateId = __getCategoryHibernateId(pageId); if (hibernateId == -1) { return null; // depends on control dependency: [if], data = [none] } try { Category cat = new Category(this, hibernateId); return cat; // depends on control dependency: [try], data = [none] } catch (WikiPageNotFoundException e) { return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static ColumnIO lookupColumnByName(GroupColumnIO groupColumnIO, String columnName) { ColumnIO columnIO = groupColumnIO.getChild(columnName); if (columnIO != null) { return columnIO; } for (int i = 0; i < groupColumnIO.getChildrenCount(); i++) { if (groupColumnIO.getChild(i).getName().equalsIgnoreCase(columnName)) { return groupColumnIO.getChild(i); } } return null; } }
public class class_name { public static ColumnIO lookupColumnByName(GroupColumnIO groupColumnIO, String columnName) { ColumnIO columnIO = groupColumnIO.getChild(columnName); if (columnIO != null) { return columnIO; // depends on control dependency: [if], data = [none] } for (int i = 0; i < groupColumnIO.getChildrenCount(); i++) { if (groupColumnIO.getChild(i).getName().equalsIgnoreCase(columnName)) { return groupColumnIO.getChild(i); // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public void compileExpression(OgnlContext context, Node expression, Object root) throws Exception { // System.out.println("Compiling expr class " + expression.getClass().getName() + " and root " + root); if (expression.getAccessor() != null) return; String getBody, setBody; EnhancedClassLoader loader = getClassLoader(context); ClassPool pool = getClassPool(context, loader); CtClass newClass = pool.makeClass(expression.getClass().getName() + expression.hashCode() + _classCounter++ + "Accessor"); newClass.addInterface(getCtClass(ExpressionAccessor.class)); CtClass ognlClass = getCtClass(OgnlContext.class); CtClass objClass = getCtClass(Object.class); CtMethod valueGetter = new CtMethod(objClass, "get", new CtClass[]{ognlClass, objClass}, newClass); CtMethod valueSetter = new CtMethod(CtClass.voidType, "set", new CtClass[]{ognlClass, objClass, objClass}, newClass); CtField nodeMember = null; // will only be set if uncompilable exception is thrown CtClass nodeClass = getCtClass(Node.class); CtMethod setExpression = null; try { getBody = generateGetter(context, newClass, objClass, pool, valueGetter, expression, root); } catch (UnsupportedCompilationException uc) { //uc.printStackTrace(); nodeMember = new CtField(nodeClass, "_node", newClass); newClass.addField(nodeMember); getBody = generateOgnlGetter(newClass, valueGetter, nodeMember); if (setExpression == null) { setExpression = CtNewMethod.setter("setExpression", nodeMember); newClass.addMethod(setExpression); } } try { setBody = generateSetter(context, newClass, objClass, pool, valueSetter, expression, root); } catch (UnsupportedCompilationException uc) { //uc.printStackTrace(); if (nodeMember == null) { nodeMember = new CtField(nodeClass, "_node", newClass); newClass.addField(nodeMember); } setBody = generateOgnlSetter(newClass, valueSetter, nodeMember); if (setExpression == null) { setExpression = CtNewMethod.setter("setExpression", nodeMember); newClass.addMethod(setExpression); } } try { newClass.addConstructor(CtNewConstructor.defaultConstructor(newClass)); Class clazz = pool.toClass(newClass); newClass.detach(); expression.setAccessor((ExpressionAccessor) clazz.newInstance()); // need to set expression on node if the field was just defined. if (nodeMember != null) { expression.getAccessor().setExpression(expression); } } catch (Throwable t) { //t.printStackTrace(); throw new RuntimeException("Error compiling expression on object " + root + " with expression node " + expression + " getter body: " + getBody + " setter body: " + setBody, t); } } }
public class class_name { public void compileExpression(OgnlContext context, Node expression, Object root) throws Exception { // System.out.println("Compiling expr class " + expression.getClass().getName() + " and root " + root); if (expression.getAccessor() != null) return; String getBody, setBody; EnhancedClassLoader loader = getClassLoader(context); ClassPool pool = getClassPool(context, loader); CtClass newClass = pool.makeClass(expression.getClass().getName() + expression.hashCode() + _classCounter++ + "Accessor"); newClass.addInterface(getCtClass(ExpressionAccessor.class)); CtClass ognlClass = getCtClass(OgnlContext.class); CtClass objClass = getCtClass(Object.class); CtMethod valueGetter = new CtMethod(objClass, "get", new CtClass[]{ognlClass, objClass}, newClass); CtMethod valueSetter = new CtMethod(CtClass.voidType, "set", new CtClass[]{ognlClass, objClass, objClass}, newClass); CtField nodeMember = null; // will only be set if uncompilable exception is thrown CtClass nodeClass = getCtClass(Node.class); CtMethod setExpression = null; try { getBody = generateGetter(context, newClass, objClass, pool, valueGetter, expression, root); } catch (UnsupportedCompilationException uc) { //uc.printStackTrace(); nodeMember = new CtField(nodeClass, "_node", newClass); newClass.addField(nodeMember); getBody = generateOgnlGetter(newClass, valueGetter, nodeMember); if (setExpression == null) { setExpression = CtNewMethod.setter("setExpression", nodeMember); // depends on control dependency: [if], data = [none] newClass.addMethod(setExpression); // depends on control dependency: [if], data = [(setExpression] } } try { setBody = generateSetter(context, newClass, objClass, pool, valueSetter, expression, root); } catch (UnsupportedCompilationException uc) { //uc.printStackTrace(); if (nodeMember == null) { nodeMember = new CtField(nodeClass, "_node", newClass); // depends on control dependency: [if], data = [none] newClass.addField(nodeMember); // depends on control dependency: [if], data = [(nodeMember] } setBody = generateOgnlSetter(newClass, valueSetter, nodeMember); if (setExpression == null) { setExpression = CtNewMethod.setter("setExpression", nodeMember); // depends on control dependency: [if], data = [none] newClass.addMethod(setExpression); // depends on control dependency: [if], data = [(setExpression] } } try { newClass.addConstructor(CtNewConstructor.defaultConstructor(newClass)); Class clazz = pool.toClass(newClass); newClass.detach(); expression.setAccessor((ExpressionAccessor) clazz.newInstance()); // need to set expression on node if the field was just defined. if (nodeMember != null) { expression.getAccessor().setExpression(expression); // depends on control dependency: [if], data = [none] } } catch (Throwable t) { //t.printStackTrace(); throw new RuntimeException("Error compiling expression on object " + root + " with expression node " + expression + " getter body: " + getBody + " setter body: " + setBody, t); } } }
public class class_name { private void handleGroupMembersChanged(final ArtifactStore store, final Map<ArtifactStore, ArtifactStore> changeMap) { final StoreKey key = store.getKey(); if ( StoreType.group == key.getType() ) { final List<StoreKey> newMembers = ( (Group) store ).getConstituents(); logger.trace( "New members of: {} are: {}", store.getKey(), newMembers ); final Group group = (Group) changeMap.get( store ); final List<StoreKey> oldMembers = group.getConstituents(); logger.trace( "Old members of: {} are: {}", group.getName(), oldMembers ); boolean membersChanged = false; if ( newMembers.size() != oldMembers.size() ) { membersChanged = true; } else { for ( StoreKey storeKey : newMembers ) { if ( !oldMembers.contains( storeKey ) ) { membersChanged = true; } } } if ( membersChanged ) { logger.trace( "Membership change confirmed. Clearing caches for group: {} and groups affected by it.", group.getKey() ); clearGroupMetaCache( group, group ); try { storeManager.query().getGroupsAffectedBy( group.getKey() ).forEach( g -> clearGroupMetaCache( g, group ) ); } catch ( IndyDataException e ) { logger.error( String.format( "Can not get affected groups of %s", group.getKey() ), e ); } } else { logger.trace( "No members changed, no need to expunge merged metadata" ); } } } }
public class class_name { private void handleGroupMembersChanged(final ArtifactStore store, final Map<ArtifactStore, ArtifactStore> changeMap) { final StoreKey key = store.getKey(); if ( StoreType.group == key.getType() ) { final List<StoreKey> newMembers = ( (Group) store ).getConstituents(); logger.trace( "New members of: {} are: {}", store.getKey(), newMembers ); // depends on control dependency: [if], data = [none] final Group group = (Group) changeMap.get( store ); final List<StoreKey> oldMembers = group.getConstituents(); logger.trace( "Old members of: {} are: {}", group.getName(), oldMembers ); // depends on control dependency: [if], data = [none] boolean membersChanged = false; if ( newMembers.size() != oldMembers.size() ) { membersChanged = true; // depends on control dependency: [if], data = [none] } else { for ( StoreKey storeKey : newMembers ) { if ( !oldMembers.contains( storeKey ) ) { membersChanged = true; // depends on control dependency: [if], data = [none] } } } if ( membersChanged ) { logger.trace( "Membership change confirmed. Clearing caches for group: {} and groups affected by it.", group.getKey() ); // depends on control dependency: [if], data = [none] clearGroupMetaCache( group, group ); // depends on control dependency: [if], data = [none] try { storeManager.query().getGroupsAffectedBy( group.getKey() ).forEach( g -> clearGroupMetaCache( g, group ) ); // depends on control dependency: [try], data = [none] } catch ( IndyDataException e ) { logger.error( String.format( "Can not get affected groups of %s", group.getKey() ), e ); } // depends on control dependency: [catch], data = [none] } else { logger.trace( "No members changed, no need to expunge merged metadata" ); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void rebuildSimpleTab() { m_form.removeGroup(CmsPropertyPanel.TAB_SIMPLE); CmsPropertyPanel panel = ((CmsPropertyPanel)m_form.getWidget()); panel.clearTab(CmsPropertyPanel.TAB_SIMPLE); if (m_handler.hasEditableName()) { m_form.addField(CmsPropertyPanel.TAB_SIMPLE, createUrlNameField()); } internalBuildConfiguredFields(); m_form.renderGroup(CmsPropertyPanel.TAB_SIMPLE); } }
public class class_name { private void rebuildSimpleTab() { m_form.removeGroup(CmsPropertyPanel.TAB_SIMPLE); CmsPropertyPanel panel = ((CmsPropertyPanel)m_form.getWidget()); panel.clearTab(CmsPropertyPanel.TAB_SIMPLE); if (m_handler.hasEditableName()) { m_form.addField(CmsPropertyPanel.TAB_SIMPLE, createUrlNameField()); // depends on control dependency: [if], data = [none] } internalBuildConfiguredFields(); m_form.renderGroup(CmsPropertyPanel.TAB_SIMPLE); } }
public class class_name { public static ReadStreamOld open(String string) { VfsStringReader ss = new VfsStringReader(string); ReadStreamOld rs = new ReadStreamOld(ss); try { rs.setEncoding("UTF-8"); } catch (Exception e) { } //rs.setPath(new NullPath("string")); return rs; } }
public class class_name { public static ReadStreamOld open(String string) { VfsStringReader ss = new VfsStringReader(string); ReadStreamOld rs = new ReadStreamOld(ss); try { rs.setEncoding("UTF-8"); // depends on control dependency: [try], data = [none] } catch (Exception e) { } // depends on control dependency: [catch], data = [none] //rs.setPath(new NullPath("string")); return rs; } }
public class class_name { private void outOfCacheCapacity() { synchronized (knownPatterns) { if (knownPatterns.size() > MAX_PATTERNS_PER_LOG) { logger.warn("out of capacity in RateLimitedLog registry; accidentally " + "using interpolated strings as patterns?"); registry.flush(); knownPatterns.clear(); } } } }
public class class_name { private void outOfCacheCapacity() { synchronized (knownPatterns) { if (knownPatterns.size() > MAX_PATTERNS_PER_LOG) { logger.warn("out of capacity in RateLimitedLog registry; accidentally " + "using interpolated strings as patterns?"); // depends on control dependency: [if], data = [none] registry.flush(); // depends on control dependency: [if], data = [none] knownPatterns.clear(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static Expression trimParentheses(Expression node) { while (node instanceof ParenthesizedExpression) { node = ((ParenthesizedExpression) node).getExpression(); } return node; } }
public class class_name { public static Expression trimParentheses(Expression node) { while (node instanceof ParenthesizedExpression) { node = ((ParenthesizedExpression) node).getExpression(); // depends on control dependency: [while], data = [none] } return node; } }
public class class_name { public boolean matches(Request req) { if (!method.equals(req.getMethod())) return false; if (useRegexForPath) { if (!req.getPath().getPath().matches(basePath)) return false; } else { if (!basePath.equals(req.getPath().getPath())) return false; } if (!queries.keySet().containsAll(req.getQuery().keySet())) return false; if (!req.getNames().containsAll(headers.keySet())) return false; try { if (!isEmpty(bodyMustContain) && !req.getContent().contains(bodyMustContain)) return false; } catch (IOException e) { return false; } for (Map.Entry<String, String> reqQuery : req.getQuery().entrySet()) { String respRegex = queries.get(reqQuery.getKey()); if (!reqQuery.getValue().matches(respRegex)) return false; } for(Map.Entry<String, String> header : headers.entrySet()) { String headerValueRegex = header.getValue(); if(!req.getValue(header.getKey()).matches(headerValueRegex)) return false; } return true; } }
public class class_name { public boolean matches(Request req) { if (!method.equals(req.getMethod())) return false; if (useRegexForPath) { if (!req.getPath().getPath().matches(basePath)) return false; } else { if (!basePath.equals(req.getPath().getPath())) return false; } if (!queries.keySet().containsAll(req.getQuery().keySet())) return false; if (!req.getNames().containsAll(headers.keySet())) return false; try { if (!isEmpty(bodyMustContain) && !req.getContent().contains(bodyMustContain)) return false; } catch (IOException e) { return false; } // depends on control dependency: [catch], data = [none] for (Map.Entry<String, String> reqQuery : req.getQuery().entrySet()) { String respRegex = queries.get(reqQuery.getKey()); if (!reqQuery.getValue().matches(respRegex)) return false; } for(Map.Entry<String, String> header : headers.entrySet()) { String headerValueRegex = header.getValue(); if(!req.getValue(header.getKey()).matches(headerValueRegex)) return false; } return true; } }
public class class_name { @Override public void process(GrayF32 input , GrayU8 output ) { inputPow2.reshape(input.width,input.height); inputMean.reshape(input.width,input.height); inputMeanPow2.reshape(input.width,input.height); inputPow2Mean.reshape(input.width,input.height); stdev.reshape(input.width,input.height); tmp.reshape(input.width,input.height); inputPow2.reshape(input.width,input.height); int radius = width.computeI(Math.min(input.width,input.height))/2; // mean of input image = E[X] BlurImageOps.mean(input, inputMean, radius, tmp, work); // standard deviation = sqrt( E[X^2] + E[X]^2) PixelMath.pow2(input, inputPow2); BlurImageOps.mean(inputPow2,inputPow2Mean,radius,tmp, work); PixelMath.pow2(inputMean,inputMeanPow2); PixelMath.subtract(inputPow2Mean, inputMeanPow2, stdev); PixelMath.sqrt(stdev, stdev); float R = ImageStatistics.max(stdev); if( down ) { BoofConcurrency.loopFor(0, input.height, y -> { int i = y * stdev.width; int indexIn = input.startIndex + y * input.stride; int indexOut = output.startIndex + y * output.stride; for (int x = 0; x < input.width; x++, i++) { // threshold = mean.*(1 + k * ((deviation/R)-1)); float threshold = inputMean.data[i] * (1.0f + k * (stdev.data[i] / R - 1.0f)); output.data[indexOut++] = (byte) (input.data[indexIn++] <= threshold ? 1 : 0); } }); } else { BoofConcurrency.loopFor(0, input.height, y -> { int i = y * stdev.width; int indexIn = input.startIndex + y * input.stride; int indexOut = output.startIndex + y * output.stride; for (int x = 0; x < input.width; x++, i++) { // threshold = mean.*(1 + k * ((deviation/R)-1)); float threshold = inputMean.data[i] * (1.0f + k * (stdev.data[i] / R - 1.0f)); output.data[indexOut++] = (byte) (input.data[indexIn++] >= threshold ? 1 : 0); } }); } } }
public class class_name { @Override public void process(GrayF32 input , GrayU8 output ) { inputPow2.reshape(input.width,input.height); inputMean.reshape(input.width,input.height); inputMeanPow2.reshape(input.width,input.height); inputPow2Mean.reshape(input.width,input.height); stdev.reshape(input.width,input.height); tmp.reshape(input.width,input.height); inputPow2.reshape(input.width,input.height); int radius = width.computeI(Math.min(input.width,input.height))/2; // mean of input image = E[X] BlurImageOps.mean(input, inputMean, radius, tmp, work); // standard deviation = sqrt( E[X^2] + E[X]^2) PixelMath.pow2(input, inputPow2); BlurImageOps.mean(inputPow2,inputPow2Mean,radius,tmp, work); PixelMath.pow2(inputMean,inputMeanPow2); PixelMath.subtract(inputPow2Mean, inputMeanPow2, stdev); PixelMath.sqrt(stdev, stdev); float R = ImageStatistics.max(stdev); if( down ) { BoofConcurrency.loopFor(0, input.height, y -> { int i = y * stdev.width; int indexIn = input.startIndex + y * input.stride; int indexOut = output.startIndex + y * output.stride; for (int x = 0; x < input.width; x++, i++) { // threshold = mean.*(1 + k * ((deviation/R)-1)); float threshold = inputMean.data[i] * (1.0f + k * (stdev.data[i] / R - 1.0f)); output.data[indexOut++] = (byte) (input.data[indexIn++] <= threshold ? 1 : 0); } }); // depends on control dependency: [if], data = [none] } else { BoofConcurrency.loopFor(0, input.height, y -> { int i = y * stdev.width; int indexIn = input.startIndex + y * input.stride; int indexOut = output.startIndex + y * output.stride; for (int x = 0; x < input.width; x++, i++) { // threshold = mean.*(1 + k * ((deviation/R)-1)); float threshold = inputMean.data[i] * (1.0f + k * (stdev.data[i] / R - 1.0f)); output.data[indexOut++] = (byte) (input.data[indexIn++] >= threshold ? 1 : 0); } }); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void addMention(Stanza stanza, int begin, int end, BareJid jid) { URI uri; try { uri = new URI("xmpp:" + jid.toString()); } catch (URISyntaxException e) { throw new AssertionError("Cannot create URI from bareJid."); } ReferenceElement reference = new ReferenceElement(begin, end, ReferenceElement.Type.mention, null, uri); stanza.addExtension(reference); } }
public class class_name { public static void addMention(Stanza stanza, int begin, int end, BareJid jid) { URI uri; try { uri = new URI("xmpp:" + jid.toString()); // depends on control dependency: [try], data = [none] } catch (URISyntaxException e) { throw new AssertionError("Cannot create URI from bareJid."); } // depends on control dependency: [catch], data = [none] ReferenceElement reference = new ReferenceElement(begin, end, ReferenceElement.Type.mention, null, uri); stanza.addExtension(reference); } }
public class class_name { public static Scs cs_load(String fileName) { int i, j; float x; Scs T; BufferedReader in; try { in = new BufferedReader(new FileReader(fileName)); } catch (FileNotFoundException e1) { return (null); } T = Scs_util.cs_spalloc(0, 0, 1, true, true); /* allocate result */ String line; try { while ((line = in.readLine()) != null) { String[] tokens = line.trim().split("\\s+"); if (tokens.length != 3) { return null; } i = Integer.parseInt(tokens[0]); j = Integer.parseInt(tokens[1]); x = Float.parseFloat(tokens[2]); if (!Scs_entry.cs_entry(T, i, j, x)) return (null); } } catch (IOException e) { return (null); } return (T); } }
public class class_name { public static Scs cs_load(String fileName) { int i, j; float x; Scs T; BufferedReader in; try { in = new BufferedReader(new FileReader(fileName)); // depends on control dependency: [try], data = [none] } catch (FileNotFoundException e1) { return (null); } // depends on control dependency: [catch], data = [none] T = Scs_util.cs_spalloc(0, 0, 1, true, true); /* allocate result */ String line; try { while ((line = in.readLine()) != null) { String[] tokens = line.trim().split("\\s+"); if (tokens.length != 3) { return null; // depends on control dependency: [if], data = [none] } i = Integer.parseInt(tokens[0]); // depends on control dependency: [while], data = [none] j = Integer.parseInt(tokens[1]); // depends on control dependency: [while], data = [none] x = Float.parseFloat(tokens[2]); // depends on control dependency: [while], data = [none] if (!Scs_entry.cs_entry(T, i, j, x)) return (null); } } catch (IOException e) { return (null); } // depends on control dependency: [catch], data = [none] return (T); } }
public class class_name { public static <K, V> void putIntoSetMap(K key, V value, Map<? super K, Set<V>> map) { Set<V> list = map.get(key); if (list == null) { list = Sets.newHashSetWithExpectedSize(2); map.put(key, list); } list.add(value); } }
public class class_name { public static <K, V> void putIntoSetMap(K key, V value, Map<? super K, Set<V>> map) { Set<V> list = map.get(key); if (list == null) { list = Sets.newHashSetWithExpectedSize(2); // depends on control dependency: [if], data = [none] map.put(key, list); // depends on control dependency: [if], data = [none] } list.add(value); } }
public class class_name { @SuppressWarnings("unchecked") public static void setProperty(Object object, String name, String text) throws NoSuchFieldException { try { // need to get to the field for any typeinfo annotation, so here we go ... int length = name.lastIndexOf('.'); if (length > 0) { object = getProperty(object, name.substring(0, length)); name = name.substring(length + 1); } length = name.length(); Matcher matcher = ARRAY_INDEX.matcher(name); for (Matcher m = matcher; m.matches(); m = ARRAY_INDEX.matcher(name)) { name = m.group(1); } Field field = Beans.getKnownField(object.getClass(), name); if (name.length() != length) { int index = Integer.parseInt(matcher.group(2)); object = getProperty(object, matcher.group(1)); if (object.getClass().isArray()) { Array.set(object, index, new ValueOf(object.getClass().getComponentType(), field.getAnnotation(typeinfo.class)).invoke(text)); } else { ((List)object).set(index, new ValueOf(field.getAnnotation(typeinfo.class).value()[0]).invoke(text)); } } else { field.set(object, new ValueOf(field.getType(), field.getAnnotation(typeinfo.class)).invoke(text)); } } catch (NoSuchFieldException x) { throw x; } catch (Exception x) { throw new IllegalArgumentException(x.getMessage() + ": " + name, x); } } }
public class class_name { @SuppressWarnings("unchecked") public static void setProperty(Object object, String name, String text) throws NoSuchFieldException { try { // need to get to the field for any typeinfo annotation, so here we go ... int length = name.lastIndexOf('.'); if (length > 0) { object = getProperty(object, name.substring(0, length)); name = name.substring(length + 1); } length = name.length(); Matcher matcher = ARRAY_INDEX.matcher(name); for (Matcher m = matcher; m.matches(); m = ARRAY_INDEX.matcher(name)) { name = m.group(1); } Field field = Beans.getKnownField(object.getClass(), name); if (name.length() != length) { int index = Integer.parseInt(matcher.group(2)); object = getProperty(object, matcher.group(1)); if (object.getClass().isArray()) { Array.set(object, index, new ValueOf(object.getClass().getComponentType(), field.getAnnotation(typeinfo.class)).invoke(text)); // depends on control dependency: [if], data = [none] } else { ((List)object).set(index, new ValueOf(field.getAnnotation(typeinfo.class).value()[0]).invoke(text)); // depends on control dependency: [if], data = [none] } } else { field.set(object, new ValueOf(field.getType(), field.getAnnotation(typeinfo.class)).invoke(text)); } } catch (NoSuchFieldException x) { throw x; } catch (Exception x) { throw new IllegalArgumentException(x.getMessage() + ": " + name, x); } } }
public class class_name { public static <E extends Comparable<E>> void sort(List<E> list) { boolean swapped = true; while(swapped) { swapped = false; for(int i = 0; i < (list.size() - 1); i++) { if(list.get(i).compareTo(list.get(i + 1)) > 0) { TrivialSwap.swap(list, i, i + 1); swapped = true; } } } } }
public class class_name { public static <E extends Comparable<E>> void sort(List<E> list) { boolean swapped = true; while(swapped) { swapped = false; // depends on control dependency: [while], data = [none] for(int i = 0; i < (list.size() - 1); i++) { if(list.get(i).compareTo(list.get(i + 1)) > 0) { TrivialSwap.swap(list, i, i + 1); // depends on control dependency: [if], data = [none] swapped = true; // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public Observable<ServiceResponse<Page<AppServiceCertificateResourceInner>>> listCertificatesWithServiceResponseAsync(final String resourceGroupName, final String certificateOrderName) { return listCertificatesSinglePageAsync(resourceGroupName, certificateOrderName) .concatMap(new Func1<ServiceResponse<Page<AppServiceCertificateResourceInner>>, Observable<ServiceResponse<Page<AppServiceCertificateResourceInner>>>>() { @Override public Observable<ServiceResponse<Page<AppServiceCertificateResourceInner>>> call(ServiceResponse<Page<AppServiceCertificateResourceInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listCertificatesNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public Observable<ServiceResponse<Page<AppServiceCertificateResourceInner>>> listCertificatesWithServiceResponseAsync(final String resourceGroupName, final String certificateOrderName) { return listCertificatesSinglePageAsync(resourceGroupName, certificateOrderName) .concatMap(new Func1<ServiceResponse<Page<AppServiceCertificateResourceInner>>, Observable<ServiceResponse<Page<AppServiceCertificateResourceInner>>>>() { @Override public Observable<ServiceResponse<Page<AppServiceCertificateResourceInner>>> call(ServiceResponse<Page<AppServiceCertificateResourceInner>> 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(listCertificatesNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { private void checkSubscription(Subscriber<? super T> subscriber) { if (subscriber.isUnsubscribed()) { keepGoing = false; log.debug("unsubscribing"); } } }
public class class_name { private void checkSubscription(Subscriber<? super T> subscriber) { if (subscriber.isUnsubscribed()) { keepGoing = false; // depends on control dependency: [if], data = [none] log.debug("unsubscribing"); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void commonInitializationFinally(List extensionFactories) { // PM62909 , Specification Topic :: Web Application Deployment, Initialize Filters before Startup Servlets if (com.ibm.ws.webcontainer.osgi.WebContainer.isServerStopping()) return; if(initFilterBeforeServletInit){ try { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) logger.logp(Level.FINE,CLASS_NAME, "commonInitializationFinally", "initFilterBeforeServletInit set"); initializeFilterManager(); } catch (Throwable th) { logger.logp(Level.SEVERE, CLASS_NAME, "commonInitializationFinally", "error.initializing.filters", th); } } //PM62909 End try { doLoadOnStartupActions(); } catch (Throwable th) { // pk435011 logger.logp(Level.SEVERE, CLASS_NAME, "commonInitializationFinally", "error.while.initializing.servlets", new Object[] { th }); } try { initializeTargetMappings(); } catch (Throwable th) { // pk435011 logger.logp(Level.SEVERE, CLASS_NAME, "commonInitializationFinally", "error.while.initializing.target.mappings", th); } if(!initFilterBeforeServletInit){ //PM62909 try { // initialize filter manager // keeping old implementation for now initializeFilterManager(); } catch (Throwable th) { // pk435011 logger.logp(Level.SEVERE, CLASS_NAME, "commonInitializationFinally", "error.initializing.filters", th); } } } }
public class class_name { protected void commonInitializationFinally(List extensionFactories) { // PM62909 , Specification Topic :: Web Application Deployment, Initialize Filters before Startup Servlets if (com.ibm.ws.webcontainer.osgi.WebContainer.isServerStopping()) return; if(initFilterBeforeServletInit){ try { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) logger.logp(Level.FINE,CLASS_NAME, "commonInitializationFinally", "initFilterBeforeServletInit set"); initializeFilterManager(); // depends on control dependency: [try], data = [none] } catch (Throwable th) { logger.logp(Level.SEVERE, CLASS_NAME, "commonInitializationFinally", "error.initializing.filters", th); } // depends on control dependency: [catch], data = [none] } //PM62909 End try { doLoadOnStartupActions(); // depends on control dependency: [try], data = [none] } catch (Throwable th) { // pk435011 logger.logp(Level.SEVERE, CLASS_NAME, "commonInitializationFinally", "error.while.initializing.servlets", new Object[] { th }); } // depends on control dependency: [catch], data = [none] try { initializeTargetMappings(); // depends on control dependency: [try], data = [none] } catch (Throwable th) { // pk435011 logger.logp(Level.SEVERE, CLASS_NAME, "commonInitializationFinally", "error.while.initializing.target.mappings", th); } // depends on control dependency: [catch], data = [none] if(!initFilterBeforeServletInit){ //PM62909 try { // initialize filter manager // keeping old implementation for now initializeFilterManager(); // depends on control dependency: [try], data = [none] } catch (Throwable th) { // pk435011 logger.logp(Level.SEVERE, CLASS_NAME, "commonInitializationFinally", "error.initializing.filters", th); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { protected String getBaseURL(HttpServletRequest request) { // if (forcedBaseAddress != null) { // return forcedBaseAddress; // } String reqPrefix = request.getRequestURL().toString(); String pathInfo = request.getPathInfo() == null ? "" : request.getPathInfo(); //fix for CXF-898 if (!"/".equals(pathInfo) || reqPrefix.endsWith("/")) { StringBuilder sb = new StringBuilder(); // request.getScheme(), request.getLocalName() and request.getLocalPort() // should be marginally cheaper - provided request.getLocalName() does // return the actual name used in request URI as opposed to localhost // consistently across the Servlet stacks URI uri = URI.create(reqPrefix); sb.append(uri.getScheme()).append("://").append(uri.getRawAuthority()); //No servletPath will be appended, as in Liberty, each endpoint will be served by one servlet instance sb.append(request.getContextPath()); reqPrefix = sb.toString(); } return reqPrefix; } }
public class class_name { protected String getBaseURL(HttpServletRequest request) { // if (forcedBaseAddress != null) { // return forcedBaseAddress; // } String reqPrefix = request.getRequestURL().toString(); String pathInfo = request.getPathInfo() == null ? "" : request.getPathInfo(); //fix for CXF-898 if (!"/".equals(pathInfo) || reqPrefix.endsWith("/")) { StringBuilder sb = new StringBuilder(); // request.getScheme(), request.getLocalName() and request.getLocalPort() // should be marginally cheaper - provided request.getLocalName() does // return the actual name used in request URI as opposed to localhost // consistently across the Servlet stacks URI uri = URI.create(reqPrefix); sb.append(uri.getScheme()).append("://").append(uri.getRawAuthority()); //No servletPath will be appended, as in Liberty, each endpoint will be served by one servlet instance sb.append(request.getContextPath()); // depends on control dependency: [if], data = [none] reqPrefix = sb.toString(); // depends on control dependency: [if], data = [none] } return reqPrefix; } }
public class class_name { public static Quaternionf fromRotationMatrix(Matrix3f matrix) { final float trace = matrix.trace(); if (trace < 0) { if (matrix.get(1, 1) > matrix.get(0, 0)) { if (matrix.get(2, 2) > matrix.get(1, 1)) { final float r = (float) Math.sqrt(matrix.get(2, 2) - matrix.get(0, 0) - matrix.get(1, 1) + 1); final float s = 0.5f / r; return new Quaternionf( (matrix.get(2, 0) + matrix.get(0, 2)) * s, (matrix.get(1, 2) + matrix.get(2, 1)) * s, 0.5f * r, (matrix.get(1, 0) - matrix.get(0, 1)) * s); } else { final float r = (float) Math.sqrt(matrix.get(1, 1) - matrix.get(2, 2) - matrix.get(0, 0) + 1); final float s = 0.5f / r; return new Quaternionf( (matrix.get(0, 1) + matrix.get(1, 0)) * s, 0.5f * r, (matrix.get(1, 2) + matrix.get(2, 1)) * s, (matrix.get(0, 2) - matrix.get(2, 0)) * s); } } else if (matrix.get(2, 2) > matrix.get(0, 0)) { final float r = (float) Math.sqrt(matrix.get(2, 2) - matrix.get(0, 0) - matrix.get(1, 1) + 1); final float s = 0.5f / r; return new Quaternionf( (matrix.get(2, 0) + matrix.get(0, 2)) * s, (matrix.get(1, 2) + matrix.get(2, 1)) * s, 0.5f * r, (matrix.get(1, 0) - matrix.get(0, 1)) * s); } else { final float r = (float) Math.sqrt(matrix.get(0, 0) - matrix.get(1, 1) - matrix.get(2, 2) + 1); final float s = 0.5f / r; return new Quaternionf( 0.5f * r, (matrix.get(0, 1) + matrix.get(1, 0)) * s, (matrix.get(2, 0) - matrix.get(0, 2)) * s, (matrix.get(2, 1) - matrix.get(1, 2)) * s); } } else { final float r = (float) Math.sqrt(trace + 1); final float s = 0.5f / r; return new Quaternionf( (matrix.get(2, 1) - matrix.get(1, 2)) * s, (matrix.get(0, 2) - matrix.get(2, 0)) * s, (matrix.get(1, 0) - matrix.get(0, 1)) * s, 0.5f * r); } } }
public class class_name { public static Quaternionf fromRotationMatrix(Matrix3f matrix) { final float trace = matrix.trace(); if (trace < 0) { if (matrix.get(1, 1) > matrix.get(0, 0)) { if (matrix.get(2, 2) > matrix.get(1, 1)) { final float r = (float) Math.sqrt(matrix.get(2, 2) - matrix.get(0, 0) - matrix.get(1, 1) + 1); final float s = 0.5f / r; return new Quaternionf( (matrix.get(2, 0) + matrix.get(0, 2)) * s, (matrix.get(1, 2) + matrix.get(2, 1)) * s, 0.5f * r, (matrix.get(1, 0) - matrix.get(0, 1)) * s); // depends on control dependency: [if], data = [none] } else { final float r = (float) Math.sqrt(matrix.get(1, 1) - matrix.get(2, 2) - matrix.get(0, 0) + 1); final float s = 0.5f / r; return new Quaternionf( (matrix.get(0, 1) + matrix.get(1, 0)) * s, 0.5f * r, (matrix.get(1, 2) + matrix.get(2, 1)) * s, (matrix.get(0, 2) - matrix.get(2, 0)) * s); // depends on control dependency: [if], data = [none] } } else if (matrix.get(2, 2) > matrix.get(0, 0)) { final float r = (float) Math.sqrt(matrix.get(2, 2) - matrix.get(0, 0) - matrix.get(1, 1) + 1); final float s = 0.5f / r; return new Quaternionf( (matrix.get(2, 0) + matrix.get(0, 2)) * s, (matrix.get(1, 2) + matrix.get(2, 1)) * s, 0.5f * r, (matrix.get(1, 0) - matrix.get(0, 1)) * s); // depends on control dependency: [if], data = [none] } else { final float r = (float) Math.sqrt(matrix.get(0, 0) - matrix.get(1, 1) - matrix.get(2, 2) + 1); final float s = 0.5f / r; return new Quaternionf( 0.5f * r, (matrix.get(0, 1) + matrix.get(1, 0)) * s, (matrix.get(2, 0) - matrix.get(0, 2)) * s, (matrix.get(2, 1) - matrix.get(1, 2)) * s); // depends on control dependency: [if], data = [none] } } else { final float r = (float) Math.sqrt(trace + 1); final float s = 0.5f / r; return new Quaternionf( (matrix.get(2, 1) - matrix.get(1, 2)) * s, (matrix.get(0, 2) - matrix.get(2, 0)) * s, (matrix.get(1, 0) - matrix.get(0, 1)) * s, 0.5f * r); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void undeployModule(final InstanceContext instance, final CountingCompletionHandler<Void> counter) { deploymentIDs.remove(instance.address(), new Handler<AsyncResult<String>>() { @Override public void handle(AsyncResult<String> result) { if (result.failed()) { counter.fail(result.cause()); } else if (result.result() != null) { cluster.undeployModule(result.result(), new Handler<AsyncResult<Void>>() { @Override public void handle(AsyncResult<Void> result) { unwatchInstance(instance, counter); } }); } else { unwatchInstance(instance, counter); } } }); } }
public class class_name { private void undeployModule(final InstanceContext instance, final CountingCompletionHandler<Void> counter) { deploymentIDs.remove(instance.address(), new Handler<AsyncResult<String>>() { @Override public void handle(AsyncResult<String> result) { if (result.failed()) { counter.fail(result.cause()); // depends on control dependency: [if], data = [none] } else if (result.result() != null) { cluster.undeployModule(result.result(), new Handler<AsyncResult<Void>>() { @Override public void handle(AsyncResult<Void> result) { unwatchInstance(instance, counter); } }); // depends on control dependency: [if], data = [none] } else { unwatchInstance(instance, counter); // depends on control dependency: [if], data = [none] } } }); } }
public class class_name { public ValidStorageOptions withStorageSize(Range... storageSize) { if (this.storageSize == null) { setStorageSize(new com.amazonaws.internal.SdkInternalList<Range>(storageSize.length)); } for (Range ele : storageSize) { this.storageSize.add(ele); } return this; } }
public class class_name { public ValidStorageOptions withStorageSize(Range... storageSize) { if (this.storageSize == null) { setStorageSize(new com.amazonaws.internal.SdkInternalList<Range>(storageSize.length)); // depends on control dependency: [if], data = [none] } for (Range ele : storageSize) { this.storageSize.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public void add(NodeData data) throws RepositoryException, UnsupportedOperationException, InvalidItemStateException, IllegalStateException { checkIfOpened(); try { addNodeRecord(data); if (LOG.isDebugEnabled()) { LOG.debug("Node added " + data.getQPath().getAsString() + ", " + data.getIdentifier() + ", " + data.getPrimaryTypeName().getAsString()); } } catch (SQLException e) { if (LOG.isDebugEnabled()) { LOG.error("Node add. Database error: " + e); } exceptionHandler.handleAddException(e, data); } } }
public class class_name { public void add(NodeData data) throws RepositoryException, UnsupportedOperationException, InvalidItemStateException, IllegalStateException { checkIfOpened(); try { addNodeRecord(data); if (LOG.isDebugEnabled()) { LOG.debug("Node added " + data.getQPath().getAsString() + ", " + data.getIdentifier() + ", " + data.getPrimaryTypeName().getAsString()); // depends on control dependency: [if], data = [none] } } catch (SQLException e) { if (LOG.isDebugEnabled()) { LOG.error("Node add. Database error: " + e); // depends on control dependency: [if], data = [none] } exceptionHandler.handleAddException(e, data); } } }
public class class_name { static void setResponseLocale(PageContext pc, Locale locale) { // set response locale ServletResponse response = pc.getResponse(); response.setLocale(locale); // get response character encoding and store it in session attribute if (pc.getSession() != null) { try { pc.setAttribute(REQUEST_CHAR_SET, response.getCharacterEncoding(), PageContext.SESSION_SCOPE); } catch (IllegalStateException ex) { } // invalidated session ignored } } }
public class class_name { static void setResponseLocale(PageContext pc, Locale locale) { // set response locale ServletResponse response = pc.getResponse(); response.setLocale(locale); // get response character encoding and store it in session attribute if (pc.getSession() != null) { try { pc.setAttribute(REQUEST_CHAR_SET, response.getCharacterEncoding(), PageContext.SESSION_SCOPE); // depends on control dependency: [try], data = [none] } catch (IllegalStateException ex) { } // invalidated session ignored // depends on control dependency: [catch], data = [none] } } }
public class class_name { protected String traceChoiceFrame() { if (bp == 0) { return ""; } int n = data.get(bp); return "choice: [ n = " + data.get(bp) + ", ep = " + data.get(bp + n + 1) + ", cp = " + data.get(bp + n + 2) + ", bp = " + data.get(bp + n + 3) + ", l = " + data.get(bp + n + 4) + ", trp = " + data.get(bp + n + 5) + ", hp = " + data.get(bp + n + 6) + ", b0 = " + data.get(bp + n + 7); } }
public class class_name { protected String traceChoiceFrame() { if (bp == 0) { return ""; // depends on control dependency: [if], data = [none] } int n = data.get(bp); return "choice: [ n = " + data.get(bp) + ", ep = " + data.get(bp + n + 1) + ", cp = " + data.get(bp + n + 2) + ", bp = " + data.get(bp + n + 3) + ", l = " + data.get(bp + n + 4) + ", trp = " + data.get(bp + n + 5) + ", hp = " + data.get(bp + n + 6) + ", b0 = " + data.get(bp + n + 7); } }
public class class_name { public final void addRepeatRow(final int rowIndex) { try { SheetConfiguration sheetConfig = parent.getSheetConfigMap().get(parent.getCurrent().getCurrentTabName()); Sheet sheet = parent.getWb().getSheet(sheetConfig.getSheetName()); ConfigBuildRef configBuildRef = new ConfigBuildRef(parent.getWbWrapper(), sheet, parent.getExpEngine(), parent.getCellHelper(), sheetConfig.getCachedCells(), parent.getCellAttributesMap(), sheetConfig.getFinalCommentMap()); // set add mode configBuildRef.setAddMode(true); configBuildRef.setCollectionObjNameMap(sheetConfig.getCollectionObjNameMap()); configBuildRef.setCommandIndexMap(sheetConfig.getCommandIndexMap()); configBuildRef.setShiftMap(sheetConfig.getShiftMap()); configBuildRef.setWatchList(sheetConfig.getWatchList()); int length = CommandUtility.addRow(configBuildRef, rowIndex, parent.getSerialDataContext().getDataContext()); refreshBodyRowsInRange(configBuildRef.getInsertPosition(), length, sheet, sheetConfig); parent.getCellHelper().reCalc(); } catch (AddRowException e) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Add Row Error", e.getMessage())); LOG.log(Level.SEVERE, "Add row error = " + e.getLocalizedMessage(), e); } catch (Exception ex) { LOG.log(Level.SEVERE, "Add row error = " + ex.getLocalizedMessage(), ex); } } }
public class class_name { public final void addRepeatRow(final int rowIndex) { try { SheetConfiguration sheetConfig = parent.getSheetConfigMap().get(parent.getCurrent().getCurrentTabName()); Sheet sheet = parent.getWb().getSheet(sheetConfig.getSheetName()); ConfigBuildRef configBuildRef = new ConfigBuildRef(parent.getWbWrapper(), sheet, parent.getExpEngine(), parent.getCellHelper(), sheetConfig.getCachedCells(), parent.getCellAttributesMap(), sheetConfig.getFinalCommentMap()); // set add mode configBuildRef.setAddMode(true); // depends on control dependency: [try], data = [none] configBuildRef.setCollectionObjNameMap(sheetConfig.getCollectionObjNameMap()); // depends on control dependency: [try], data = [none] configBuildRef.setCommandIndexMap(sheetConfig.getCommandIndexMap()); // depends on control dependency: [try], data = [none] configBuildRef.setShiftMap(sheetConfig.getShiftMap()); // depends on control dependency: [try], data = [none] configBuildRef.setWatchList(sheetConfig.getWatchList()); // depends on control dependency: [try], data = [none] int length = CommandUtility.addRow(configBuildRef, rowIndex, parent.getSerialDataContext().getDataContext()); refreshBodyRowsInRange(configBuildRef.getInsertPosition(), length, sheet, sheetConfig); // depends on control dependency: [try], data = [none] parent.getCellHelper().reCalc(); // depends on control dependency: [try], data = [none] } catch (AddRowException e) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Add Row Error", e.getMessage())); LOG.log(Level.SEVERE, "Add row error = " + e.getLocalizedMessage(), e); } catch (Exception ex) { // depends on control dependency: [catch], data = [none] LOG.log(Level.SEVERE, "Add row error = " + ex.getLocalizedMessage(), ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public SimpleClassifierAdapter create() { SimpleClassifierAdapter l = new SimpleClassifierAdapter(learner, dataset); if (dataset == null) { System.out.println("dataset null while creating"); } return l; } }
public class class_name { @Override public SimpleClassifierAdapter create() { SimpleClassifierAdapter l = new SimpleClassifierAdapter(learner, dataset); if (dataset == null) { System.out.println("dataset null while creating"); // depends on control dependency: [if], data = [none] } return l; } }
public class class_name { @Override public EEnum getIfcPermitTypeEnum() { if (ifcPermitTypeEnumEEnum == null) { ifcPermitTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(1028); } return ifcPermitTypeEnumEEnum; } }
public class class_name { @Override public EEnum getIfcPermitTypeEnum() { if (ifcPermitTypeEnumEEnum == null) { ifcPermitTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(1028); // depends on control dependency: [if], data = [none] } return ifcPermitTypeEnumEEnum; } }
public class class_name { @Override public Object find(Class entityClass, Object rowId) { EntityMetadata m = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entityClass); Object enhancedEntity = null; if (rowId == null) { return null; } MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel( m.getPersistenceUnit()); if (metaModel.isEmbeddable(m.getIdAttribute().getBindableJavaType())) { rowId = KunderaCoreUtils.prepareCompositeKey(m, rowId); } try { List results = findData(m, rowId, null, null, null, null); if (results != null && !results.isEmpty()) { enhancedEntity = results.get(0); } } catch (Exception e) { log.error("Error during find by id, Caused by: .", e); throw new KunderaException("Error during find by id, Caused by: .", e); } return enhancedEntity; } }
public class class_name { @Override public Object find(Class entityClass, Object rowId) { EntityMetadata m = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entityClass); Object enhancedEntity = null; if (rowId == null) { return null; // depends on control dependency: [if], data = [none] } MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel( m.getPersistenceUnit()); if (metaModel.isEmbeddable(m.getIdAttribute().getBindableJavaType())) { rowId = KunderaCoreUtils.prepareCompositeKey(m, rowId); // depends on control dependency: [if], data = [none] } try { List results = findData(m, rowId, null, null, null, null); if (results != null && !results.isEmpty()) { enhancedEntity = results.get(0); // depends on control dependency: [if], data = [none] } } catch (Exception e) { log.error("Error during find by id, Caused by: .", e); throw new KunderaException("Error during find by id, Caused by: .", e); } // depends on control dependency: [catch], data = [none] return enhancedEntity; } }
public class class_name { static byte[] getBytesHttpOld(String pURL) throws IOException { // Get the input stream from the url InputStream in = new BufferedInputStream(getInputStreamHttp(pURL), BUF_SIZE * 2); // Get all the bytes in loop byte[] bytes = new byte[0]; int count; byte[] buffer = new byte[BUF_SIZE]; try { while ((count = in.read(buffer)) != -1) { // NOTE: According to the J2SE API doc, read(byte[]) will read // at least 1 byte, or return -1, if end-of-file is reached. bytes = (byte[]) CollectionUtil.mergeArrays(bytes, 0, bytes.length, buffer, 0, count); } } finally { // Close the buffer in.close(); } return bytes; } }
public class class_name { static byte[] getBytesHttpOld(String pURL) throws IOException { // Get the input stream from the url InputStream in = new BufferedInputStream(getInputStreamHttp(pURL), BUF_SIZE * 2); // Get all the bytes in loop byte[] bytes = new byte[0]; int count; byte[] buffer = new byte[BUF_SIZE]; try { while ((count = in.read(buffer)) != -1) { // NOTE: According to the J2SE API doc, read(byte[]) will read // at least 1 byte, or return -1, if end-of-file is reached. bytes = (byte[]) CollectionUtil.mergeArrays(bytes, 0, bytes.length, buffer, 0, count); // depends on control dependency: [while], data = [none] } } finally { // Close the buffer in.close(); } return bytes; } }
public class class_name { private int calculateWaitCyclesFromWaitTime() { String serverWaitTime = System.getProperty(BootstrapConstants.SERVER_START_WAIT_TIME); if ((serverWaitTime == null) || serverWaitTime.trim().equals("")) { return BootstrapConstants.MAX_POLL_ATTEMPTS; } int waitTime = 0; try { waitTime = Integer.parseInt(System.getProperty(BootstrapConstants.SERVER_START_WAIT_TIME)); if (waitTime < 1) { return 1; } } catch (Throwable t) { return BootstrapConstants.MAX_POLL_ATTEMPTS; } int waitCycles = (int) (TimeUnit.MILLISECONDS.convert(waitTime, TimeUnit.SECONDS) / BootstrapConstants.POLL_INTERVAL_MS); return waitCycles; } }
public class class_name { private int calculateWaitCyclesFromWaitTime() { String serverWaitTime = System.getProperty(BootstrapConstants.SERVER_START_WAIT_TIME); if ((serverWaitTime == null) || serverWaitTime.trim().equals("")) { return BootstrapConstants.MAX_POLL_ATTEMPTS; // depends on control dependency: [if], data = [none] } int waitTime = 0; try { waitTime = Integer.parseInt(System.getProperty(BootstrapConstants.SERVER_START_WAIT_TIME)); // depends on control dependency: [try], data = [none] if (waitTime < 1) { return 1; // depends on control dependency: [if], data = [none] } } catch (Throwable t) { return BootstrapConstants.MAX_POLL_ATTEMPTS; } // depends on control dependency: [catch], data = [none] int waitCycles = (int) (TimeUnit.MILLISECONDS.convert(waitTime, TimeUnit.SECONDS) / BootstrapConstants.POLL_INTERVAL_MS); return waitCycles; } }
public class class_name { @SafeVarargs public static <T> T[] join(final T[] array1, final T... array2) { if (isEmpty(array1) && isEmpty(array2)) { return null; } if (isEmpty(array1)) { return array2; } if (isEmpty(array2)) { return array1; } final Class<?> type1 = array1.getClass().getComponentType(); @SuppressWarnings("unchecked") // OK, because array is of type T final T[] joinedArray = (T[]) Array.newInstance(type1, array1.length + array2.length); int index = 0; for (T item : array1) { joinedArray[index++] = item; } for (T item : array2) { joinedArray[index++] = item; } return joinedArray; } }
public class class_name { @SafeVarargs public static <T> T[] join(final T[] array1, final T... array2) { if (isEmpty(array1) && isEmpty(array2)) { return null; // depends on control dependency: [if], data = [none] } if (isEmpty(array1)) { return array2; // depends on control dependency: [if], data = [none] } if (isEmpty(array2)) { return array1; // depends on control dependency: [if], data = [none] } final Class<?> type1 = array1.getClass().getComponentType(); @SuppressWarnings("unchecked") // OK, because array is of type T final T[] joinedArray = (T[]) Array.newInstance(type1, array1.length + array2.length); int index = 0; for (T item : array1) { joinedArray[index++] = item; // depends on control dependency: [for], data = [item] } for (T item : array2) { joinedArray[index++] = item; // depends on control dependency: [for], data = [item] } return joinedArray; } }
public class class_name { public synchronized void pause() { // use compareAndSet to make sure it stops only once and when running if (running.compareAndSet(true, false)) { logger.debug("Stopping the HystrixMetricsPoller"); scheduledTask.cancel(true); } else { logger.debug("Attempted to pause a stopped poller"); } } }
public class class_name { public synchronized void pause() { // use compareAndSet to make sure it stops only once and when running if (running.compareAndSet(true, false)) { logger.debug("Stopping the HystrixMetricsPoller"); // depends on control dependency: [if], data = [none] scheduledTask.cancel(true); // depends on control dependency: [if], data = [none] } else { logger.debug("Attempted to pause a stopped poller"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static <T> BornContext<T> evalByArgTypes(Class<T> type, Class<?>... argTypes) { BornContext<T> re; if (argTypes.length == 0) { re = evalWithoutArgs(type); } else { re = evalWithArgTypes(true, type, argTypes, null); } return re; } }
public class class_name { public static <T> BornContext<T> evalByArgTypes(Class<T> type, Class<?>... argTypes) { BornContext<T> re; if (argTypes.length == 0) { re = evalWithoutArgs(type); // depends on control dependency: [if], data = [none] } else { re = evalWithArgTypes(true, type, argTypes, null); // depends on control dependency: [if], data = [none] } return re; } }
public class class_name { private void updateTransition(Collection<Tile> resolved, Collection<Tile> toResolve, Tile tile, Tile neighbor, String neighborGroup, Transition newTransition) { if (!neighborGroup.equals(newTransition.getIn())) { updateTile(resolved, toResolve, tile, neighbor, newTransition); } } }
public class class_name { private void updateTransition(Collection<Tile> resolved, Collection<Tile> toResolve, Tile tile, Tile neighbor, String neighborGroup, Transition newTransition) { if (!neighborGroup.equals(newTransition.getIn())) { updateTile(resolved, toResolve, tile, neighbor, newTransition); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static FuturesContract futuresContractOfConfig( ExchangeSpecification exchangeSpecification) { FuturesContract contract; if (exchangeSpecification.getExchangeSpecificParameters().containsKey("Futures_Contract")) { contract = (FuturesContract) exchangeSpecification.getExchangeSpecificParameters().get("Futures_Contract"); } else if (exchangeSpecification .getExchangeSpecificParameters() .containsKey("Futures_Contract_String")) { contract = FuturesContract.valueOfIgnoreCase( FuturesContract.class, (String) exchangeSpecification .getExchangeSpecificParameters() .get("Futures_Contract_String")); } else { throw new RuntimeException( "`Futures_Contract` or `Futures_Contract_String` not defined in exchange specific parameters."); } return contract; } }
public class class_name { public static FuturesContract futuresContractOfConfig( ExchangeSpecification exchangeSpecification) { FuturesContract contract; if (exchangeSpecification.getExchangeSpecificParameters().containsKey("Futures_Contract")) { contract = (FuturesContract) exchangeSpecification.getExchangeSpecificParameters().get("Futures_Contract"); // depends on control dependency: [if], data = [none] } else if (exchangeSpecification .getExchangeSpecificParameters() .containsKey("Futures_Contract_String")) { contract = FuturesContract.valueOfIgnoreCase( FuturesContract.class, (String) exchangeSpecification .getExchangeSpecificParameters() .get("Futures_Contract_String")); // depends on control dependency: [if], data = [none] } else { throw new RuntimeException( "`Futures_Contract` or `Futures_Contract_String` not defined in exchange specific parameters."); } return contract; } }
public class class_name { public boolean isFullyLoaded(Protocol protocol) { if (fetchSize == 0 || resultSet == null) { return true; } return resultSet.isFullyLoaded() && executionResults.isEmpty() && !protocol.hasMoreResults(); } }
public class class_name { public boolean isFullyLoaded(Protocol protocol) { if (fetchSize == 0 || resultSet == null) { return true; // depends on control dependency: [if], data = [none] } return resultSet.isFullyLoaded() && executionResults.isEmpty() && !protocol.hasMoreResults(); } }