code
stringlengths
3
1.01M
repo_name
stringlengths
5
116
path
stringlengths
3
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
3
1.01M
/* * Copyright (C) 2012 Ondrej Perutka * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation, either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * <http://www.gnu.org/licenses/>. */ package org.libav.audio; import java.util.Collections; import java.util.HashSet; import java.util.Set; import org.bridj.Pointer; import org.libav.IDecoder; import org.libav.LibavException; import org.libav.avcodec.*; import org.libav.avcodec.bridge.AVCodecLibrary; import org.libav.avformat.IStreamWrapper; import org.libav.avutil.MediaType; import org.libav.avutil.bridge.AVUtilLibrary; import org.libav.bridge.LibraryManager; import org.libav.data.IFrameConsumer; import org.libav.util.Rational; /** * Audio frame decoder. * * @author Ondrej Perutka */ public class AudioFrameDecoder implements IDecoder { private static final AVUtilLibrary utilLib = LibraryManager.getInstance().getAVUtilLibrary(); private final IStreamWrapper stream; private final ICodecContextWrapper cc; private Rational sTimeBase; private long pts; private IFrameWrapper audioFrame; private Pointer<Byte> sampleBuffer; private int sampleBufferSize; private final Set<IFrameConsumer> consumers; /** * Create a new audio frame decoder for the given audio stream. * * @param stream an audio stream * @throws LibavException if the decoder cannot be created for some reason * (caused by the Libav) */ public AudioFrameDecoder(IStreamWrapper stream) throws LibavException { this.stream = stream; cc = stream.getCodecContext(); cc.clearWrapperCache(); if (cc.getCodecType() != MediaType.AUDIO) throw new IllegalArgumentException("not an audio stream"); cc.open(CodecWrapperFactory.getInstance().findDecoder(cc.getCodecId())); sTimeBase = stream.getTimeBase().mul(1000); pts = 0; audioFrame = FrameWrapperFactory.getInstance().allocFrame(); sampleBufferSize = AVCodecLibrary.AVCODEC_MAX_AUDIO_FRAME_SIZE; sampleBuffer = utilLib.av_malloc(AVCodecLibrary.AVCODEC_MAX_AUDIO_FRAME_SIZE + AVCodecLibrary.FF_INPUT_BUFFER_PADDING_SIZE).as(Byte.class); if (sampleBuffer == null) throw new OutOfMemoryError("unable to allocate memory to decode the audio stream"); audioFrame.getData().set(0, sampleBuffer); audioFrame.getLineSize().set(0, sampleBufferSize); consumers = Collections.synchronizedSet(new HashSet<IFrameConsumer>()); } @Override public ICodecContextWrapper getCodecContext() { return cc; } @Override public IStreamWrapper getStream() { return stream; } @Override public synchronized void close() { if (audioFrame != null) audioFrame.free(); if (sampleBuffer != null) utilLib.av_free(sampleBuffer); cc.close(); audioFrame = null; sampleBuffer = null; } @Override public boolean isClosed() { return cc.isClosed(); } @Override public synchronized void processPacket(Object producer, IPacketWrapper packet) throws LibavException { if (isClosed() || packet.getStreamIndex() != stream.getIndex()) return; //System.out.printf("AP: dts = %d\n", sTimeBase.mul(packet.getDts()).longValue()); Pointer<Byte> tmp = packet.getData(); while (packet.getSize() > 0) { audioFrame.getLineSize().set(0, sampleBufferSize); if (cc.decodeAudioFrame(packet, audioFrame)) sendFrame(transformPts(audioFrame)); } packet.setData(tmp); } @Override public synchronized void flush() throws LibavException { IFrameWrapper fr; while ((fr = flushContext()) != null) sendFrame(transformPts(fr)); } private synchronized IFrameWrapper flushContext() throws LibavException { if (isClosed()) return null; IPacketWrapper packet = PacketWrapperFactory.getInstance().alloc(); IFrameWrapper result = null; packet.setSize(0); packet.setData(null); audioFrame.getLineSize().set(0, sampleBufferSize); if (cc.decodeAudioFrame(packet, audioFrame)) result = audioFrame; packet.free(); return result; } protected void sendFrame(IFrameWrapper frame) throws LibavException { synchronized (consumers) { for (IFrameConsumer c : consumers) c.processFrame(this, frame); } } private IFrameWrapper transformPts(IFrameWrapper frame) { if (frame.getPacketDts() != AVUtilLibrary.AV_NOPTS_VALUE) frame.setPts(sTimeBase.mul(frame.getPacketDts()).longValue()); else { frame.setPts(pts); pts += frame.getLineSize().get(0) * 1000 / (cc.getChannels() * cc.getSampleRate() * cc.getSampleFormat().getBytesPerSample()); } return frame; } @Override public void addFrameConsumer(IFrameConsumer c) { consumers.add(c); } @Override public void removeFrameConsumer(IFrameConsumer c) { consumers.remove(c); } }
operutka/jlibav
jlibav/src/main/java/org/libav/audio/AudioFrameDecoder.java
Java
lgpl-3.0
5,860
<p>It makes sense to handle all related actions in the same place. Thus, the same <code>&lt;action&gt;</code> might logically handle all facets of CRUD on an entity, with no confusion in the naming about which <code>&lt;forward/&gt;</code> handles which facet. But go very far beyond that, and it becomes difficult to maintain a transparent naming convention. </p> <p>So to ease maintenance, this rule raises an issue when an <code>&lt;action&gt;</code> has more than the allowed number of <code>&lt;forward/&gt;</code> tags.</p> <h2>Noncompliant Code Example</h2> <p>With the default threshold of 4:</p> <pre> &lt;action path='/book' type='myapp.BookDispatchAction' name='form' parameter='method'&gt; &lt;forward name='create' path='/WEB-INF/jsp/BookCreate.jspx' redirect='false'/&gt; &lt;forward name='read' path='/WEB-INF/jsp/BookDetails' redirect='false'/&gt; &lt;forward name='update' path='/WEB-INF/jsp/BookUpdate.jspx' redirect='false'/&gt; &lt;forward name='delete' path='/WEB-INF/jsp/BookDelete.jspx' redirect='false'/&gt; &lt;forward name='authorRead' path='WEB-INF/jsp/AuthorDetails' redirect='false'/&gt; &lt;!-- Noncompliant --&gt; &lt;/action&gt; </pre> <h2>Compliant Solution</h2> <pre> &lt;action path='/book' type='myapp.BookDispatchAction' name='bookForm' parameter='method'&gt; &lt;forward name='create' path='/WEB-INF/jsp/BookCreate.jspx' redirect='false'/&gt; &lt;forward name='read' path='/WEB-INF/jsp/BookDetails' redirect='false'/&gt; &lt;forward name='update' path='/WEB-INF/jsp/BookUpdate.jspx' redirect='false'/&gt; &lt;forward name='delete' path='/WEB-INF/jsp/BookDelete.jspx' redirect='false'/&gt; &lt;/action&gt; &lt;action path='/author' type='myapp.AuthorDispatchAction' name='authorForm' parameter='method'&gt; &lt;forward name='authorRead' path='WEB-INF/jsp/AuthorDetails' redirect='false'/&gt; &lt;/action&gt; </pre>
mbring/sonar-java
java-checks/src/main/resources/org/sonar/l10n/java/rules/squid/S3373_java.html
HTML
lgpl-3.0
1,875
/* * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. * */ //#ifdef __PARSER_XHTML apf.XhtmlBodyElement = function(struct, tagName){ this.$init(tagName || "body", apf.NODE_VISIBLE, struct); }; (function(){ this.addEventListener("DOMNodeInsertedIntoDocument", function(e){ if (!this.ownerDocument.body) this.ownerDocument.body = this; this.$ext = this.$int = document.body; }, true); }).call(apf.XhtmlBodyElement.prototype = new apf.AmlElement()); apf.xhtml.setElement("body", apf.XhtmlBodyElement); //#endif
janjongboom/apf-demo
source/core/markup/xhtml/body.js
JavaScript
lgpl-3.0
1,443
<?php /** * @copyright Copyright (c) Metaways Infosystems GmbH, 2014 * @license LGPLv3, http://www.arcavias.com/en/license * @package Controller * @subpackage Frontend */ /** * Interface for order frontend controllers. * * @package Controller * @subpackage Frontend */ interface Controller_Frontend_Order_Interface extends Controller_Frontend_Common_Interface { /** * Creates a new order from the given basket. * * Saves the given basket to the storage including the addresses, coupons, * products, services, etc. and creates/stores a new order item for that * order. * * @param MShop_Order_Item_Base_Interface $basket Basket object to be stored * @return MShop_Order_Item_Interface Order item that belongs to the stored basket */ public function store( MShop_Order_Item_Base_Interface $basket ); /** * Blocks the resources listed in the order. * * Every order contains resources like products or redeemed coupon codes * that must be blocked so they can't be used by another customer in a * later order. This method reduces the the stock level of products, the * counts of coupon codes and others. * * It's save to call this method multiple times for one order. In this case, * the actions will be executed only once. All subsequent calls will do * nothing as long as the resources haven't been unblocked in the meantime. * * You can also block and unblock resources several times. Please keep in * mind that unblocked resources may be reused by other orders in the * meantime. This can lead to an oversell of products! * * @param MShop_Order_Item_Interface $orderItem Order item object * @return void */ public function block( MShop_Order_Item_Interface $orderItem ); /** * Frees the resources listed in the order. * * If customers created orders but didn't pay for them, the blocked resources * like products and redeemed coupon codes must be unblocked so they can be * ordered again or used by other customers. This method increased the stock * level of products, the counts of coupon codes and others. * * It's save to call this method multiple times for one order. In this case, * the actions will be executed only once. All subsequent calls will do * nothing as long as the resources haven't been blocked in the meantime. * * You can also unblock and block resources several times. Please keep in * mind that unblocked resources may be reused by other orders in the * meantime. This can lead to an oversell of products! * * @param MShop_Order_Item_Interface $orderItem Order item object * @return void */ public function unblock( MShop_Order_Item_Interface $orderItem ); /** * Blocks or frees the resources listed in the order if necessary. * * After payment status updates, the resources like products or coupon * codes listed in the order must be blocked or unblocked. This method * cares about executing the appropriate action depending on the payment * status. * * It's save to call this method multiple times for one order. In this case, * the actions will be executed only once. All subsequent calls will do * nothing as long as the payment status hasn't changed in the meantime. * * @param MShop_Order_Item_Interface $orderItem Order item object * @return void */ public function update( MShop_Order_Item_Interface $orderItem ); }
Arcavias/arcavias-core
controller/frontend/src/Controller/Frontend/Order/Interface.php
PHP
lgpl-3.0
3,390
/* ************************************************************************ qooxdoo - the new era of web development http://qooxdoo.org Copyright: 2004-2012 1&1 Internet AG, Germany, http://www.1und1.de License: LGPL: http://www.gnu.org/licenses/lgpl.html EPL: http://www.eclipse.org/org/documents/epl-v10.php See the LICENSE file in the project's top-level directory for details. Authors: * Mustafa Sak (msak) ************************************************************************ */ /** * @ignore(ColorSwitch) */ qx.Class.define("demobrowser.demo.ui.CommandGroupManager", { extend : qx.application.Standalone, /* ***************************************************************************** MEMBERS ***************************************************************************** */ members : { main : function() { this.base(arguments); this._manager = new qx.ui.command.GroupManager(); this._createWidgets(); }, _createWidgets : function() { var tabview = new qx.ui.tabview.TabView(); var page1 = new qx.ui.tabview.Page("Page1 - press 5 to change color"); page1.setLayout(new qx.ui.layout.Canvas()); var page2 = new qx.ui.tabview.Page("Page2 - press 5 to change color"); page2.setLayout(new qx.ui.layout.Canvas()); var page3 = new qx.ui.tabview.Page("Page3 - press 5 to change color"); page3.setLayout(new qx.ui.layout.Canvas()); page1.add(new ColorSwitch(this), {edge:0}); page2.add(new ColorSwitch(this), {edge:0}); page3.add(new ColorSwitch(this), {edge:0}); tabview.add(page1); tabview.add(page2); tabview.add(page3); this.getRoot().add(tabview, {edge: 10}); }, getGroupManager : function() { return this._manager; } } }); /** * View */ qx.Class.define("ColorSwitch", { extend : qx.ui.container.Composite, construct : function(controller) { this.base(arguments); this.setLayout(new qx.ui.layout.VBox(15)); this.setPadding(25); this._controller = controller; // create command var cmd = new qx.ui.command.Command("5"); cmd.addListener("execute", this.toggleColor, this); // create command group var group = new qx.ui.command.Group(); this._group = group; // add command into group group.add("toggleColor", cmd); // Register command group at command group manager controller.getGroupManager().add(group); this.addListener("appear", this._onAppear, this); this._createWidgets(); }, members : { _group : null, _createWidgets : function() { var btn = new qx.ui.form.TextField(); btn.setPlaceholder("If focused here, all commands will be disabled! Please press key \"5\"!"); btn.addListener("focusin", this._blockCommands, this); btn.addListener("focusout", this._unblockCommands, this); this.add(btn); var label = new qx.ui.basic.Label("All tabview pages are holding a view class with same command shortcut! Press key \"5\" on any page to change the color of the view. You will see that only the appeared page will change his color."); label.set({ rich : true, wrap : true }); this.add(label); }, toggleColor : function(target, command) { this.setBackgroundColor(this.getBackgroundColor() == "#ABEFEF" ? "#ABEFAB" : "#ABEFEF"); }, _onAppear : function(e) { this._controller.getGroupManager().setActive(this._group); }, _blockCommands : function(e) { this._controller.getGroupManager().block(); }, _unblockCommands : function(e) { this._controller.getGroupManager().unblock(); } } });
sebastienhupin/qxrad
qooxdoo/application/demobrowser/source/class/demobrowser/demo/ui/CommandGroupManager.js
JavaScript
lgpl-3.0
3,778
package org.datacleaner.extension.emailing; import java.util.Collection; import java.util.Collections; import org.datacleaner.api.Analyzer; import org.datacleaner.api.AnalyzerResult; import org.datacleaner.api.Metric; /** * Result class for {@link Analyzer}s that sends emails */ public class SendEmailAnalyzerResult implements AnalyzerResult { private static final long serialVersionUID = 1L; private final int _successCount; private final int _skipCount; private final Collection<EmailResult> _failures; public SendEmailAnalyzerResult(int successCount, int skipCount, Collection<EmailResult> failures) { _successCount = successCount; _skipCount = skipCount; _failures = failures; } public Collection<EmailResult> getFailures() { return Collections.unmodifiableCollection(_failures); } @Metric(value = "Emails skipped") public int getSkipCount() { return _skipCount; } @Metric(value = "Emails sent") public int getSuccessCount() { return _successCount; } @Metric(value = "Emails failed to send") public int getFailureCount() { if (_failures == null) { return 0; } return _failures.size(); } }
datacleaner/extension_emailing
src/main/java/org/datacleaner/extension/emailing/SendEmailAnalyzerResult.java
Java
lgpl-3.0
1,258
/* -*- mode: c; c-basic-offset: 2; tab-width: 80; -*- */ /* libhar - Library of HTTP Archive (HAR) classes * Copyright (C) 2014-2015 Andrew Robbins * * This library ("it") is free software; it is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; you can redistribute it and/or modify it under the terms of the * GNU Lesser General Public License ("LGPLv3") <https://www.gnu.org/licenses/lgpl.html>. */ #include "har-request-curl.h" #include "har-message-utils.h" #include <string.h> void har_request_transform_from_curl_easy ( HarRequest * self, const CURL * hnd) { } void har_request_transform_to_curl_easy ( const HarRequest * self_q, CURL * hnd) { HarRequest * self = HAR_REQUEST (self_q); //curl_easy_setopt(curl_easy->handle, CURLOPT_VERBOSE, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(curl_easy->handle, CURLOPT_HEADER, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(curl_easy->handle, CURLOPT_NOPROGRESS, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(curl_easy->handle, CURLOPT_NOSIGNAL, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(curl_easy->handle, CURLOPT_WILDCARDMATCH, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(curl_easy->handle, CURLOPT_WRITEFUNCTION, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(curl_easy->handle, CURLOPT_WRITEDATA, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(curl_easy->handle, CURLOPT_READFUNCTION, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(curl_easy->handle, CURLOPT_READDATA, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(curl_easy->handle, CURLOPT_IOCTLFUNCTION, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(curl_easy->handle, CURLOPT_IOCTLDATA, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(curl_easy->handle, CURLOPT_SEEKFUNCTION, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(curl_easy->handle, CURLOPT_SEEKDATA, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(curl_easy->handle, CURLOPT_SOCKOPTFUNCTION, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(curl_easy->handle, CURLOPT_SOCKOPTDATA, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(curl_easy->handle, CURLOPT_OPENSOCKETFUNCTION, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(curl_easy->handle, CURLOPT_OPENSOCKETDATA, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(curl_easy->handle, CURLOPT_CLOSESOCKETFUNCTION, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(curl_easy->handle, CURLOPT_CLOSESOCKETDATA, // har_client_options_get_verbose(har_clnt_opts)); // //curl_easy_setopt(hnd, CURLOPT_PROGRESSFUNCTION, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_PROGRESSDATA, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_XFERINFOFUNCTION, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_XFERINFODATA, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_HEADERFUNCTION, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_HEADERDATA, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_DEBUGFUNCTION, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_DEBUGDATA, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_SSL_CTX_FUNCTION, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_SSL_CTX_DATA, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_CONV_TO_NETWORK_FUNCTION, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_CONV_FROM_NETWORK_FUNCTION, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_CONV_FROM_UTF8_FUNCTION, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_INTERLEAVEFUNCTION, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_INTERLEAVEDATA, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_CHUNK_BGN_FUNCTION, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_CHUNK_END_FUNCTION, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_CHUNK_DATA, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_FNMATCH_FUNCTION, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_FNMATCH_DATA, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_ERRORBUFFER, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_STDERR, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_FAILONERROR, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_PROTOCOLS, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_REDIR_PROTOCOLS, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_PROXY, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_PROXYPORT, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_PROXYTYPE, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_NOPROXY, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_HTTPPROXYTUNNEL, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_SOCKS5_GSSAPI_SERVICE, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_SOCKS5_GSSAPI_NEC, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_INTERFACE, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_LOCALPORT, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_LOCALPORTRANGE, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_DNS_CACHE_TIMEOUT, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_DNS_USE_GLOBAL_CACHE, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_PORT, // har_request_get_port(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_TCP_NODELAY, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_ADDRESS_SCOPE, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_TCP_KEEPIDLE, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_TCP_KEEPINTVL, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_NETRC, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_NETRC_FILE, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_USERPWD, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_PROXYUSERPWD, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_USERNAME, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_PASSWORD, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_LOGIN_OPTIONS, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_PROXYUSERNAME, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_PROXYPASSWORD, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_HTTPAUTH, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_TLSAUTH_USERNAME, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_TLSAUTH_PASSWORD, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_PROXYAUTH, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_SASL_IR, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_XOAUTH2_BEARER, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_AUTOREFERER, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_ACCEPT_ENCODING, // har_headers_get_accept_encoding (har_request_get_headers (har_clnt_opts))); // //curl_easy_setopt(hnd, CURLOPT_TRANSFER_ENCODING, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_FOLLOWLOCATION, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_UNRESTRICTED_AUTH, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_POSTREDIR, // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, CURLOPT_PUT, // har_client_options_get_verbose(har_clnt_opts)); // //// ... //curl_easy_setopt(hnd, , // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, , // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, , // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, , // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, , // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, , // har_client_options_get_verbose(har_clnt_opts)); // ... // //curl_easy_setopt(hnd, , // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, , // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, , // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, , // har_client_options_get_verbose(har_clnt_opts)); //curl_easy_setopt(hnd, , // har_client_options_get_verbose(har_clnt_opts)); /* httpVersion */ { gint version = har_request_get_version(self); gchar * version_str = har_render_http_version_string(version); curl_easy_setopt(hnd, CURLOPT_HTTP_VERSION, version_str); g_free(version_str); } /* method */ { const gchar * method = har_request_get_method(self); gboolean auto_method = self->priv->_auto_method; /* libcurl has a very complicated way to set 'method' */ if (!g_ascii_strcasecmp(method, "GET")) { gint curl_method = auto_method ? 0 : CURLOPT_HTTPGET; curl_easy_setopt(hnd, curl_method, TRUE); } else if (!g_ascii_strcasecmp(method, "POST")) { gint curl_method = auto_method ? CURLOPT_POST : CURLOPT_HTTPPOST; curl_easy_setopt(hnd, curl_method, TRUE); } else if (!g_ascii_strcasecmp(method, "PUT")) { gint curl_method = CURLOPT_PUT; curl_easy_setopt(hnd, curl_method, TRUE); } else if (!g_ascii_strcasecmp(method, "HEAD")) { gint curl_method = CURLOPT_NOBODY; curl_easy_setopt(hnd, curl_method, TRUE); } else { /* Make sure that we pass the method in uppercase. */ gchar * curl_method = g_ascii_strup(method, strnlen(method, 16)); curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, curl_method); /* "Before [libcurl] version 7.17.0, strings were not copied" * but they are now. This provides a minimum version number * for which libcurl we are compatible with. */ g_free(curl_method); } /* Other methods to consider adding: * CURLOPT_COPYPOSTFIELDS * CURLOPT_POSTFIELDS */ } /* url */ { const gchar * url = har_request_get_url(self); curl_easy_setopt(hnd, CURLOPT_URL, url); } }
andydude/libhar
har/har-request-curl.c
C
lgpl-3.0
14,584
/************************************************************************** Lightspark, a free flash player implementation Copyright (C) 2010-2013 Alessandro Pignotti (a.pignotti@sssup.it) Copyright (C) 2010-2011 Timon Van Overveldt (timonvo@gmail.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. **************************************************************************/ #ifndef BACKENDS_SECURITY_H #define BACKENDS_SECURITY_H 1 #include "compat.h" #include <string> #include <list> #include <map> #include <cinttypes> #include "swftypes.h" #include "threading.h" #include "urlutils.h" #include "parsing/crossdomainpolicy.h" namespace lightspark { class PolicyFile; class URLPolicyFile; class SocketPolicyFile; typedef std::list<URLPolicyFile*> URLPFileList; typedef std::list<URLPolicyFile*>::iterator URLPFileListIt; typedef std::list<URLPolicyFile*>::const_iterator URLPFileListConstIt; typedef std::pair<tiny_string, URLPolicyFile*> URLPFilePair; typedef std::multimap<tiny_string, URLPolicyFile*> URLPFileMap; typedef std::multimap<tiny_string, URLPolicyFile*>::iterator URLPFileMapIt; typedef std::multimap<tiny_string, URLPolicyFile*>::const_iterator URLPFileMapConstIt; typedef std::pair<URLPFileMapIt, URLPFileMapIt> URLPFileMapItPair; typedef std::pair<URLPFileMapConstIt, URLPFileMapConstIt> URLPFileMapConstItPair; typedef std::list<SocketPolicyFile*> SocketPFileList; typedef std::list<SocketPolicyFile*>::const_iterator SocketPFileListConstIt; typedef std::pair<tiny_string, SocketPolicyFile*> SocketPFilePair; typedef std::multimap<tiny_string, SocketPolicyFile*> SocketPFileMap; class SecurityManager { public: enum SANDBOXTYPE { REMOTE=1, LOCAL_WITH_FILE=2, LOCAL_WITH_NETWORK=4, LOCAL_TRUSTED=8 }; private: Mutex mutex; const char* sandboxNames[4]; const char* sandboxTitles[4]; //Multimap (by domain) of pending policy files URLPFileMap pendingURLPFiles; //Multimap (by domain) of loaded policy files URLPFileMap loadedURLPFiles; //Multimap (by domain) of pending socket policy files SocketPFileMap pendingSocketPFiles; //Multimap (by domain) of loaded socket policy files SocketPFileMap loadedSocketPFiles; //Security sandbox type SANDBOXTYPE sandboxType; //Use exact domains for player settings bool exactSettings; //True if exactSettings was already set once bool exactSettingsLocked; template <class T> void loadPolicyFile(std::multimap<tiny_string, T*>& pendingFiles, std::multimap<tiny_string, T*>& loadedFiles, PolicyFile *file); template <class T> T* getPolicyFileByURL(std::multimap<tiny_string, T*>& pendingFiles, std::multimap<tiny_string, T*>& loadedFiles, const URLInfo& url); template<class T> std::list<T*> *searchPolicyFiles(const URLInfo& url, T *master, bool loadPendingPolicies, std::multimap<tiny_string, T*>& pendingFiles, std::multimap<tiny_string, T*>& loadedFiles); //Search for and loads (if allowed) policy files which should be checked //(used by evaluatePoliciesURL & evaluateHeader) //Master policy file is first-in-line and should be checked first URLPFileList* searchURLPolicyFiles(const URLInfo& url, bool loadPendingPolicies); SocketPFileList* searchSocketPolicyFiles(const URLInfo& url, bool loadPendingPolicies); public: SecurityManager(); ~SecurityManager(); //Add a policy file located at url, will decide what type of policy file it is. PolicyFile* addPolicyFile(const tiny_string& url) { return addPolicyFile(URLInfo(url)); } PolicyFile* addPolicyFile(const URLInfo& url); //Add an URL policy file located at url URLPolicyFile* addURLPolicyFile(const URLInfo& url); //Add a Socket policy file located at url SocketPolicyFile* addSocketPolicyFile(const URLInfo& url); //Get the URL policy file object (if any) for the URL policy file at url URLPolicyFile* getURLPolicyFileByURL(const URLInfo& url); SocketPolicyFile* getSocketPolicyFileByURL(const URLInfo& url); void loadURLPolicyFile(URLPolicyFile* file); void loadSocketPolicyFile(SocketPolicyFile* file); //Set the sandbox type void setSandboxType(SANDBOXTYPE type) { sandboxType = type; } SANDBOXTYPE getSandboxType() const { return sandboxType; } const char* getSandboxName() const { return getSandboxName(sandboxType); } const char* getSandboxName(SANDBOXTYPE type) const { if(type == REMOTE) return sandboxNames[0]; else if(type == LOCAL_WITH_FILE) return sandboxNames[1]; else if(type == LOCAL_WITH_NETWORK) return sandboxNames[2]; else if(type == LOCAL_TRUSTED) return sandboxNames[3]; return NULL; } const char* getSandboxTitle() const { return getSandboxTitle(sandboxType); } const char* getSandboxTitle(SANDBOXTYPE type) const { if(type == REMOTE) return sandboxTitles[0]; else if(type == LOCAL_WITH_FILE) return sandboxTitles[1]; else if(type == LOCAL_WITH_NETWORK) return sandboxTitles[2]; else if(type == LOCAL_TRUSTED) return sandboxTitles[3]; return NULL; } //Set exactSettings void setExactSettings(bool settings, bool locked=true) { if(!exactSettingsLocked) { exactSettings = settings; exactSettingsLocked = locked; } } bool getExactSettings() const { return exactSettings; } bool getExactSettingsLocked() const { return exactSettingsLocked; } //Evaluates whether the current sandbox is in the allowed sandboxes bool evaluateSandbox(int allowedSandboxes) { return evaluateSandbox(sandboxType, allowedSandboxes); } bool evaluateSandbox(SANDBOXTYPE sandbox, int allowedSandboxes); //The possible results for the URL evaluation methods below enum EVALUATIONRESULT { ALLOWED, NA_RESTRICT_LOCAL_DIRECTORY, NA_REMOTE_SANDBOX, NA_LOCAL_SANDBOX, NA_CROSSDOMAIN_POLICY, NA_PORT, NA_HEADER }; //Evaluates an URL by checking allowed sandboxes (URL policy files are not checked) EVALUATIONRESULT evaluateURLStatic(const tiny_string& url, int allowedSandboxesRemote, int allowedSandboxesLocal, bool restrictLocalDirectory) { return evaluateURLStatic(URLInfo(url), allowedSandboxesRemote, allowedSandboxesLocal); } EVALUATIONRESULT evaluateURLStatic(const URLInfo& url, int allowedSandboxesRemote, int allowedSandboxesLocal, bool restrictLocalDirectory=true); static void checkURLStaticAndThrow(const URLInfo& url, int allowedSandboxesRemote, int allowedSandboxesLocal, bool restrictLocalDirectory=true); //Evaluates an URL by checking if the type of URL (local/remote) matches the allowed sandboxes EVALUATIONRESULT evaluateSandboxURL(const URLInfo& url, int allowedSandboxesRemote, int allowedSandboxesLocal); //Checks for restricted ports EVALUATIONRESULT evaluatePortURL(const URLInfo& url); //Evaluates a (local) URL by checking if it points to a subdirectory of the origin EVALUATIONRESULT evaluateLocalDirectoryURL(const URLInfo& url); //Checks URL policy files EVALUATIONRESULT evaluatePoliciesURL(const URLInfo& url, bool loadPendingPolicies); //Check socket policy files EVALUATIONRESULT evaluateSocketConnection(const URLInfo& url, bool loadPendingPolicies); //Check for restricted headers and policy files explicitly allowing certain headers EVALUATIONRESULT evaluateHeader(const tiny_string& url, const tiny_string& header, bool loadPendingPolicies) { return evaluateHeader(URLInfo(url), header, loadPendingPolicies); } EVALUATIONRESULT evaluateHeader(const URLInfo& url, const tiny_string& header, bool loadPendingPolicies); }; class PolicySiteControl; class PolicyAllowAccessFrom; class PolicyAllowHTTPRequestHeadersFrom; class PolicyFile { friend class SecurityManager; public: enum TYPE { URL, SOCKET }; enum METAPOLICY { ALL, //All types of policy files are allowed (default for SOCKET) BY_CONTENT_TYPE, //Only policy files served with 'Content-Type: text/x-cross-domain-policy' are allowed (only for HTTP) BY_FTP_FILENAME, //Only policy files with 'crossdomain.xml' as filename are allowed (only for FTP) MASTER_ONLY, //Only this master policy file is allowed (default for HTTP/HTTPS/FTP) NONE, //No policy files are allowed, including this master policy file NONE_THIS_RESPONSE //Don't use this policy file, provided as a HTTP header only (TODO: support this type) }; private: URLInfo originalURL; protected: PolicyFile(URLInfo _url, TYPE _type); virtual ~PolicyFile(); Mutex mutex; URLInfo url; TYPE type; //Is this PolicyFile object valid? //Reason for invalidness can be: incorrect URL, download failed (in case of URLPolicyFiles) bool valid; //Ignore this object? //Reason for ignoring can be: master policy file doesn't allow other/any policy files bool ignore; //Is this file loaded and parsed yet? bool loaded; //Load and parse the policy file void load(); //Return true, if master policy file tells to ignore this file virtual bool isIgnoredByMaster()=0; //Download polic file content from url into policy. //Return true, if file was downloaded successfully and is valid. virtual bool retrievePolicyFile(std::vector<unsigned char>& policy)=0; //Return parser parameters required to handle this policy file virtual void getParserType(CrossDomainPolicy::POLICYFILETYPE&, CrossDomainPolicy::POLICYFILESUBTYPE&)=0; //Return false if siteControl is invalid virtual bool checkSiteControlValidity(); //Process one element from the policy file virtual void handlePolicyElement(CrossDomainPolicy::ELEMENT& elementType, const CrossDomainPolicy& parser); PolicySiteControl* siteControl; std::list<PolicyAllowAccessFrom*> allowAccessFrom; public: const URLInfo& getURL() const { return url; } const URLInfo& getOriginalURL() const { return originalURL; } TYPE getType() const { return type; } bool isValid() const { return valid; } bool isIgnored() const { return ignore; } virtual bool isMaster() const = 0; bool isLoaded() const { return loaded; } //Get the master policy file controlling this one //virtual PolicyFile* getMasterPolicyFile()=0; METAPOLICY getMetaPolicy(); //Is access to the policy file URL allowed by this policy file? virtual bool allowsAccessFrom(const URLInfo& url, const URLInfo& to) = 0; }; class URLPolicyFile : public PolicyFile { friend class SecurityManager; public: enum SUBTYPE { HTTP, HTTPS, FTP }; private: SUBTYPE subtype; std::list<PolicyAllowHTTPRequestHeadersFrom*> allowHTTPRequestHeadersFrom; protected: URLPolicyFile(const URLInfo& _url); ~URLPolicyFile(); //Load and parse the policy file bool isIgnoredByMaster(); bool retrievePolicyFile(std::vector<unsigned char>& policy); void getParserType(CrossDomainPolicy::POLICYFILETYPE&, CrossDomainPolicy::POLICYFILESUBTYPE&); bool checkSiteControlValidity(); void handlePolicyElement(CrossDomainPolicy::ELEMENT& elementType, const CrossDomainPolicy& parser); public: SUBTYPE getSubtype() const { return subtype; } //If strict is true, the policy will be loaded first to see if it isn't redirected bool isMaster() const; //Get the master policy file controlling this one URLPolicyFile* getMasterPolicyFile(); //Is access to the policy file URL allowed by this policy file? bool allowsAccessFrom(const URLInfo& url, const URLInfo& to); //Is this request header allowed by this policy file for the given URL? bool allowsHTTPRequestHeaderFrom(const URLInfo& u, const URLInfo& to, const std::string& header); }; class SocketPolicyFile : public PolicyFile { friend class SecurityManager; protected: SocketPolicyFile(const URLInfo& _url); bool isIgnoredByMaster(); bool retrievePolicyFile(std::vector<unsigned char>& outData); void getParserType(CrossDomainPolicy::POLICYFILETYPE&, CrossDomainPolicy::POLICYFILESUBTYPE&); public: static const unsigned int MASTER_PORT; static const char *MASTER_PORT_URL; //If strict is true, the policy will be loaded first to see if it isn't redirected bool isMaster() const; //Get the master policy file controlling this one SocketPolicyFile* getMasterPolicyFile(); //Is access to the policy file URL allowed by this policy file? bool allowsAccessFrom(const URLInfo& url, const URLInfo& to); }; //Site-wide declarations for master policy file //Only valid inside master policy files class PolicySiteControl { private: PolicyFile::METAPOLICY permittedPolicies; //Required public: PolicySiteControl(const std::string _permittedPolicies); PolicyFile::METAPOLICY getPermittedPolicies() const { return permittedPolicies; } static PolicyFile::METAPOLICY defaultSitePolicy(PolicyFile::TYPE policyFileType); }; class PortRange { private: uint16_t startPort; uint16_t endPort; bool isRange; bool matchAll; public: PortRange(uint16_t _startPort, uint16_t _endPort=0, bool _isRange=false, bool _matchAll=false): startPort(_startPort),endPort(_endPort),isRange(_isRange),matchAll(_matchAll){}; bool matches(uint16_t port) { if(matchAll) return true; if(isRange) { return startPort >= port && endPort <= port; } else return startPort == port; } }; //Permit access by documents from specified domains class PolicyAllowAccessFrom { friend class PolicyFile; friend class URLPolicyFile; friend class SocketPolicyFile; private: PolicyFile* file; std::string domain; //Required std::list<PortRange*> toPorts; //Only used for SOCKET policy files, required bool secure; //Only used for SOCKET & HTTPS, optional, default: SOCKET=false, HTTPS=true protected: PolicyAllowAccessFrom(PolicyFile* _file, const std::string _domain, const std::string _toPorts, bool _secure, bool secureSpecified); ~PolicyAllowAccessFrom(); public: const std::string& getDomain() const { return domain; } size_t getToPortsLength() const { return toPorts.size(); } std::list<PortRange*>::const_iterator getToPortsBegin() const { return toPorts.begin(); } std::list<PortRange*>::const_iterator getToPortsEnd() const { return toPorts.end(); } bool getSecure() const { return secure; } //Does this entry allow a given URL? bool allowsAccessFrom(const URLInfo& url, uint16_t toPort=0, bool bCheckHttps=true) const; }; //Permit HTTP request header sending (only for HTTP) class PolicyAllowHTTPRequestHeadersFrom { friend class PolicyFile; friend class URLPolicyFile; private: URLPolicyFile* file; std::string domain; //Required std::list<std::string*> headers; //Required bool secure; //Only used for HTTPS, optional, default=true protected: PolicyAllowHTTPRequestHeadersFrom(URLPolicyFile* _file, const std::string _domain, const std::string _headers, bool _secure, bool secureSpecified); ~PolicyAllowHTTPRequestHeadersFrom(); public: const std::string getDomain() const { return domain; } size_t getHeadersLength() const { return headers.size(); } std::list<std::string*>::const_iterator getHeadersBegin() const { return headers.begin(); } std::list<std::string*>::const_iterator getHeadersEnd() const { return headers.end(); } bool getSecure() const { return secure; } //Does this entry allow a given request header for a given URL? bool allowsHTTPRequestHeaderFrom(const URLInfo& url, const std::string& header) const; }; } #endif /* BACKENDS_SECURITY_H */
lightspark/lightspark
src/backends/security.h
C
lgpl-3.0
15,624
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns='http://www.w3.org/1999/xhtml' lang='he' dir='rtl'> <head> <meta http-equiv='Content-Type' content='text/html; charset=windows-1255' /> <meta http-equiv='Content-Script-Type' content='text/javascript' /> <meta http-equiv='revisit-after' content='15 days' /> <link rel='stylesheet' href='../../_script/klli.css' /> <link rel='stylesheet' href='../_themes/klli.css' /> <title>òì ðéñéí åàîåðä</title> <meta name='author' content='àäøï àîåæâ' /> <meta name='receiver' content='./tnk1/sofrim/amozeg/mqorot/d.nisim' /> <meta name='jmQovc' content='tnk1/messages/sofrim_amozeg_mqorot_index_0.html' /> <meta name='tvnit' content='' /> </head> <body lang='he' class='newarticle'><div class='pnim'> <!--NiwutElyon0--> <div class='NiwutElyon'> <div class='NiwutElyon'><a class='link_to_homepage' href='../index.html'>øàùé</a>&gt;<a href='../sofrim/amozeg/mqorot/index.html'>ñåâéåú çééðå òì áñéñ î÷åøåú äéäãåú</a>&gt;</div> </div> <!--NiwutElyon1--> <h1 id='h1'>òì ðéñéí åàîåðä</h1> <div id='idfields'> <p>îàú: àäøï àîåæâ</p> <p>àì: ./tnk1/sofrim/amozeg/mqorot/d.nisim</p> </div> <script type='text/javascript' src='../../_script/vars.js'></script> <script type='text/javascript'>kotrt()</script> <div id='tokn'> ìîçé÷ä </div><!--tokn--> <h2 id='tguvot'>úâåáåú</h2> <ul id='ultguvot'> <li></li> </ul><!--end--> <script type='text/javascript'>tguva();txtit()</script> </div><!--pnim--> </body> </html>
erelsgl/erel-sites
tnk1/messages/sofrim_amozeg_mqorot_index_0.html
HTML
lgpl-3.0
1,534
// Created file "Lib\src\ADSIid\guid" typedef struct _GUID { unsigned long Data1; unsigned short Data2; unsigned short Data3; unsigned char Data4[8]; } GUID; #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } DEFINE_GUID(DBROWCOL_PARENTNAME, 0x0c733ab6, 0x2a1c, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d);
Frankie-PellesC/fSDK
Lib/src/ADSIid/guid00000115.c
C
lgpl-3.0
450
// Created file "Lib\src\dxguid\d3d10guid" typedef struct _GUID { unsigned long Data1; unsigned short Data2; unsigned short Data3; unsigned char Data4[8]; } GUID; #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } DEFINE_GUID(IID_ID3D10BlendState1, 0xedad8d99, 0x8a35, 0x4d6d, 0x85, 0x66, 0x2e, 0xa2, 0x76, 0xcd, 0xe1, 0x61);
Frankie-PellesC/fSDK
Lib/src/dxguid/d3d10guid000000C7.c
C
lgpl-3.0
457
#!/bin/bash declare -a colors # ½Å±¾ÖÐËùÓеĺóÐøÃüÁî¶¼»á°Ñ #+ ±äÁ¿"colors"¿´×÷Êý×é. echo "Enter your favorite colors (separated from each other by a space)." read -a colors # ÖÁÉÙÐèÒª¼üÈë3ÖÖÑÕÉ«, ÒÔ±ãÓÚºó±ßµÄÑÝʾ. # 'read'ÃüÁîµÄÌØÊâÑ¡Ïî, #+ ÔÊÐí¸øÊý×éÔªËØ¸³Öµ. echo element_count=${#colors[@]} # ÌáÈ¡Êý×éÔªËØ¸öÊýµÄÌØÊâÓï·¨. # ÓÃelement_count=${#colors[*]}Ò²Ò»Ñù. # # "@"±äÁ¿ÔÊÐíÔÚÒýÓÃÖдæÔÚµ¥´Ê·Ö¸î(word splitting) #+ (ÒÀ¿¿¿Õ°××Ö·ûÀ´·Ö¸ô±äÁ¿). # # Õâ¾ÍºÃÏñ"$@"ºÍ"$*" #+ ÔÚλÖòÎÊýÖеÄËù±íÏÖ³öÀ´µÄÐÐΪһÑù. index=0 while [ "$index" -lt "$element_count" ] do # ÁгöÊý×éÖеÄËùÓÐÔªËØ. echo ${colors[$index]} let "index = $index + 1" # »ò: # index+=1 # Èç¹ûÄãÔËÐеÄBash°æ±¾ÊÇ3.1ÒÔºóµÄ»°, ²ÅÖ§³ÖÕâÖÖÓï·¨. done # ÿ¸öÊý×éÔªËØ±»ÁÐΪµ¥¶ÀµÄÒ»ÐÐ. # Èç¹ûûÓÐÕâÖÖÒªÇóµÄ»°, ¿ÉÒÔʹÓÃecho -n "${colors[$index]} " # # Ò²¿ÉÒÔʹÓÃ"for"Ñ­»·À´×ö: # for i in "${colors[@]}" # do # echo "$i" # done # (¸Ðл, S.C.) echo # ÔÙ´ÎÁгöÊý×éÖеÄËùÓÐÔªËØ, ²»¹ýÕâ´ÎµÄ×ö·¨¸üÓÅÑÅ. echo ${colors[@]} # ÓÃecho ${colors[*]}Ò²ÐÐ. echo # "unset"ÃüÁî¼´¿ÉÒÔɾ³ýÊý×éÊý¾Ý, Ò²¿ÉÒÔɾ³ýÕû¸öÊý×é. unset colors[1] # ɾ³ýÊý×éµÄµÚ2¸öÔªËØ. # ×÷ÓõÈЧÓÚ colors[1]= echo ${colors[@]} # ÔÙ´ÎÁгöÊý×éÄÚÈÝ, µÚ2¸öÔªËØÃ»ÁË. unset colors # ɾ³ýÕû¸öÊý×é. # unset colors[*] »ò #+ unset colors[@] ¶¼¿ÉÒÔ. echo; echo -n "Colors gone." echo ${colors[@]} # ÔÙ´ÎÁгöÊý×éÄÚÈÝ, ÄÚÈÝΪ¿Õ. exit 0
liruiqiu/tlpi
sh/sh/ex67.sh
Shell
lgpl-3.0
1,554
// This file is part of TorrentCore. // https://torrentcore.org // Copyright (c) Samuel Fisher. // // Licensed under the GNU Lesser General Public License, version 3. See the // LICENSE file in the project root for full license information. using System; using System.Collections.Generic; using System.Text; using TorrentCore.Transport; namespace TorrentCore.Application.BitTorrent { public sealed class BitTorrentPeerDetails { public BitTorrentPeerDetails(string address, PeerId peerId) { Address = address; PeerId = peerId; } public string Address { get; } public PeerId PeerId { get; } } }
SamuelFisher/torrentcore
TorrentCore/Application/BitTorrent/BitTorrentPeerDetails.cs
C#
lgpl-3.0
678
var searchData= [ ['uint16',['UInt16',['../d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#ae3ea6483d22355c7d6b8aaa268359d57a266985b8569588028028a205c37798a4',1,'HydroCouple::Spatial::IRaster']]], ['uint32',['UInt32',['../d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#ae3ea6483d22355c7d6b8aaa268359d57a525c93df497c1cc30532a19e0ed566d2',1,'HydroCouple::Spatial::IRaster']]], ['unknown',['Unknown',['../d8/d5b/class_hydro_couple_1_1_spatial_1_1_i_raster.html#ae3ea6483d22355c7d6b8aaa268359d57a6b6a05fc6ca4f23a7946b2a71e6745a2',1,'HydroCouple::Spatial::IRaster']]], ['updated',['Updated',['../d3/dae/class_hydro_couple_1_1_i_model_component.html#ac03f31f2698581f53a46338242b8bd0fae96068c5849c31292bbff257590fc386',1,'HydroCouple::IModelComponent::Updated()'],['../df/d74/class_hydro_couple_1_1_i_workflow_component.html#ac51e321b9a3eb96529d698464747b632a1fe962ad166b5eedccc370d12c8950f1',1,'HydroCouple::IWorkflowComponent::Updated()']]], ['updating',['Updating',['../d3/dae/class_hydro_couple_1_1_i_model_component.html#ac03f31f2698581f53a46338242b8bd0fa740129adacab91e3d34b4235a8aa9260',1,'HydroCouple::IModelComponent::Updating()'],['../df/d74/class_hydro_couple_1_1_i_workflow_component.html#ac51e321b9a3eb96529d698464747b632ae7390df27945c079b7141ee7234a1361',1,'HydroCouple::IWorkflowComponent::Updating()']]] ];
HydroCouple/hydrocouple.github.io
hydrocoupledocs/html/search/enumvalues_f.js
JavaScript
lgpl-3.0
1,343
/** * Copyright (C) 2015 Michael Schnell. All rights reserved. * http://www.fuin.org/ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 3 of the License, or (at your option) any * later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library. If not, see http://www.gnu.org/licenses/. */ package org.fuin.units4j.dependency; import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.List; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlRootElement; /** * Package dependency rules. Caution: A package cannot be in both lists! */ @XmlRootElement(name = "dependencies") public final class Dependencies implements Serializable { private static final long serialVersionUID = 1L; @XmlElementWrapper(name="alwaysAllowed") @XmlElement(name = "dependsOn") private final List<DependsOn> alwaysAllowed; @XmlElementWrapper(name="alwaysForbidden") @XmlElement(name = "notDependsOn") private final List<NotDependsOn> alwaysForbidden; @XmlElementWrapper(name="allowed") @XmlElement(name = "package") private final List<Package<DependsOn>> allowed; @XmlElementWrapper(name="forbidden") @XmlElement(name = "package") private final List<Package<NotDependsOn>> forbidden; /** * Default constructor. */ public Dependencies() { super(); this.alwaysAllowed = new ArrayList<>(); this.alwaysForbidden = new ArrayList<>(); this.allowed = new ArrayList<>(); this.forbidden = new ArrayList<>(); } /** * Returns a list of packages like "java.lang" that are always Ok to depend on. * * @return List of packages. */ public final List<DependsOn> getAlwaysAllowed() { if (alwaysAllowed == null) { // This can only happen with serialization return Collections.emptyList(); } return alwaysAllowed; } /** * Returns a list of packages that are always forbidden to depend on. * * @return List of packages. */ public final List<NotDependsOn> getAlwaysForbidden() { if (alwaysForbidden == null) { // This can only happen with serialization return Collections.emptyList(); } return alwaysForbidden; } /** * Checks if the package is always OK. * * @param packageName * Name of the package to check. * * @return If the package is always allowed <code>true</code> else <code>false</code>. */ public final boolean isAlwaysAllowed(final String packageName) { if (packageName.equals("java.lang")) { return true; } return Utils.findAllowedByName(getAlwaysAllowed(), packageName) != null; } /** * Checks if the package is always forbidden. * * @param packageName * Name of the package to check. * * @return If the package is always forbidden <code>true</code> else <code>false</code>. */ public final boolean isAlwaysForbidden(final String packageName) { return Utils.findForbiddenByName(getAlwaysForbidden(), packageName) != null; } /** * Returns the list of allowed package dependencies. * * @return List of explicit allowed dependencies - All other dependencies are considered to be an error. */ public final List<Package<DependsOn>> getAllowed() { if (allowed == null) { // This can only happen with serialization return Collections.emptyList(); } return allowed; } /** * Returns the list of forbidden package dependencies. * * @return List of explicit forbidden dependencies - All other dependencies are considered to be valid. */ public final List<Package<NotDependsOn>> getForbidden() { if (forbidden == null) { // This can only happen with serialization return Collections.emptyList(); } return forbidden; } /** * Checks if the definition is valid - Especially if no package is in both lists. * * @throws InvalidDependenciesDefinitionException * This instance is invalid. */ public final void validate() throws InvalidDependenciesDefinitionException { int errorCount = 0; final StringBuilder sb = new StringBuilder("Duplicate package entries in 'allowed' and 'forbidden': "); final List<Package<NotDependsOn>> list = getForbidden(); for (int i = 0; i < list.size(); i++) { final String name = list.get(i).getName(); final Package<DependsOn> dep = new Package<>(name); if (getAllowed().indexOf(dep) > -1) { if (errorCount > 0) { sb.append(", "); } sb.append(name); errorCount++; } } if (errorCount > 0) { throw new InvalidDependenciesDefinitionException(this, sb.toString()); } } /** * Find an entry in the allowed list by package name. * * @param packageName * Name to find. * * @return Package or <code>null</code> if no entry with the given name was found. */ public final Package<DependsOn> findAllowedByName(final String packageName) { final List<Package<DependsOn>> list = getAllowed(); for (final Package<DependsOn> pkg : list) { if (pkg.getName().equals(packageName)) { return pkg; } } return null; } /** * Find an entry in the forbidden list by package name. * * @param packageName * Name to find. * * @return Package or <code>null</code> if no entry with the given name was found. */ public final Package<NotDependsOn> findForbiddenByName(final String packageName) { final List<Package<NotDependsOn>> list = getForbidden(); for (final Package<NotDependsOn> pkg : list) { if (pkg.getName().equals(packageName)) { return pkg; } } return null; } }
fuinorg/units4j
src/main/java/org/fuin/units4j/dependency/Dependencies.java
Java
lgpl-3.0
6,967
#!/usr/bin/ksh ############################################################ ## 功能:从存储服务器获取确认文件 ############################################################ #------------------------参数说明---------------------------- #--接收 # localPath -本地文件路径 # remotePath -远程文件路径 # serverIP -远程服务器IP # sftpUser -sftp用户名 # sftpPass -sftp密码 #--变量 # SYSDATE -系统日期 # STATION_ARR[] -小站文件夹数组,新增小站增加此数组即可 #----------------------------------------------------------- # 接收参数 localPath=$1 remotePath=$2 serverIP=$3 sftpUser=$4 sftpPass=$5 # 定义变量 SYSDATE=`date +%Y%m%d` STATION_ARR[0]="k0001" STATION_ARR[1]="k0253" STATION_ARR[2]="zdfile" #----------------------------------------------------------- #--返回值RETURNCODE # 0 -成功 # 1 -参数传递异常 # 2 -处理文件夹异常 # 3 -获取文件异常 #----------------------------------------------------------- # [函数]脚本执行返回值 retrunCode() { if [ ${result} -eq "1" ]; then RETURNCODE=$1 echo ${RETURNCODE} fi } # [函数]处理日期文件夹 createForlder() { cd $1 if [[ ! -d ${SYSDATE} ]]; then mkdir ${SYSDATE} chmod 755 ${SYSDATE} fi cd ${SYSDATE} } # [函数]SFTP非交互式操作 sftp_download() { expect <<- EOF set timeout 5 spawn sftp $1@$2 expect { "(yes/no)?" {send "yes\r"; expect_continue} "password:" {send "$3\r"} } expect "sftp>" send "cd $4\r" set timeout -1 expect "sftp>" send "mget *$sysdate*04.*\r" expect "sftp>" send "mget *$sysdate*06.*\r" expect "sftp>" send "bye\r" EOF } # 校验参数个数 if [[ $# != 5 ]]; then exit fi result=$? retrunCode "1" # 处理文件夹 createForlder ${localPath} result=$? retrunCode "2" # 循环获取文件 for station in ${STATION_ARR[@]}; do remoteDir=${remotePath}${station} sftp_download ${sftpUser} ${serverIP} ${sftpPass} ${remoteDir} done result=$? retrunCode "3"
WZQ1397/automatic-repo
shell/filesystem/ftpautodownload.sh
Shell
lgpl-3.0
2,196
#include "LdpcEncoder.h" #include "LdpcDecoder.h" using namespace std; namespace encode { LdpcEncoder::LdpcEncoder(const BitMatrixFactory& matrixFactory, const EquationSolverFactory& solverFactory, const uint32_t symbolSize, const DataSource& source) : Encoder(matrixFactory, solverFactory, symbolSize), mSource(source) { mSource.assertNoWordPadding(); } vector<word_t> LdpcEncoder::createSymbol(SymbolID id) const { const uint32_t numSymbols = mSource.wordSize() / getSourceSymbolSize(); vector<word_t> encodedSymbol(getEncodedSymbolSize()); if(static_cast<uint32_t>(id) < numSymbols) { uint32_t pos = static_cast<uint32_t>(id) * getSourceSymbolSize(); for(uint32_t j = 0; j < getSourceSymbolSize(); ++j) encodedSymbol[j] = mSource.wordData()[pos + j]; } else { //TODO move to baseclass auto rels = LdpcDecoder::generateRelationships(id - numSymbols, numSymbols); for(uint32_t j = 0; j < getEncodedSymbolSize(); ++j) { word_t data = 0; for(auto it: rels) { data ^= mSource.wordData()[it*getSourceSymbolSize() + j]; } encodedSymbol[j] = data; } } return encodedSymbol; } }
kaimast/fountain-tools
libencode/src/LdpcEncoder.cpp
C++
lgpl-3.0
1,297
<?php namespace App\Model\Table; use Cake\ORM\Table; use Cake\Validation\Validator; class TasksTable extends Table { public function initialize(array $config) { parent::initialize($config); $this->addBehavior('Timestamp'); $this->table($this->connection()->config()['database'] . "." . $this->table()); // this is very important for joining and associations. $this->hasMany('Taskworkers', [ 'foreignKey' => 'task_id' ])->setDependent(true); $this->belongsTo('Projects', [ 'foreignKey' => 'project_id' ])->setDependent(true); } public static function defaultConnectionName() { return 'projects'; } public function validationDefault(Validator $validator) { return $validator ->notEmpty('name', 'Nome do projeto não pode estar vazio'); } } ?>
danit595/Efsc_cakev2
src/Model/Table/TasksTable.php
PHP
lgpl-3.0
814
package de.invesdwin.nowicket.component.pnotify.header; import javax.annotation.concurrent.Immutable; import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.markup.html.IHeaderContributor; @Immutable public final class PNotifyHeaderContributor implements IHeaderContributor { public static final PNotifyHeaderContributor INSTANCE = new PNotifyHeaderContributor(); private PNotifyHeaderContributor() {} @Override public void renderHead(final IHeaderResponse response) { PNotifyJsReference.INSTANCE.renderHead(response); PNotifySettingsJsReference.INSTANCE.renderHead(response); PNotifyCssReference.INSTANCE.renderHead(response); } }
subes/invesdwin-nowicket
invesdwin-nowicket-parent/invesdwin-nowicket/src/main/java/de/invesdwin/nowicket/component/pnotify/header/PNotifyHeaderContributor.java
Java
lgpl-3.0
729
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2010.06.10 at 04:19:23 PM CEST // package nl.b3p.csw.jaxb.gml; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlType; /** * Definition of a unit of measure (or uom). The definition includes a quantityType property, which indicates the phenomenon to which the units apply, and a catalogSymbol, which gives the short symbol used for this unit. This element is used when the relationship of this unit to other units or units systems is unknown. * * <p>Java class for UnitDefinitionType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="UnitDefinitionType"> * &lt;complexContent> * &lt;extension base="{http://www.opengis.net/gml}DefinitionType"> * &lt;sequence> * &lt;element ref="{http://www.opengis.net/gml}quantityType"/> * &lt;element ref="{http://www.opengis.net/gml}catalogSymbol" minOccurs="0"/> * &lt;/sequence> * &lt;/extension> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "UnitDefinitionType", propOrder = { "quantityType", "catalogSymbol" }) @XmlSeeAlso({ DerivedUnitType.class, BaseUnitType.class, ConventionalUnitType.class }) public class UnitDefinitionType extends DefinitionType { @XmlElementRef(name = "quantityType", namespace = "http://www.opengis.net/gml", type = QuantityType.class) protected QuantityType quantityType; @XmlElementRef(name = "catalogSymbol", namespace = "http://www.opengis.net/gml", type = CatalogSymbol.class) protected CatalogSymbol catalogSymbol; /** * Default no-arg constructor * */ public UnitDefinitionType() { super(); } /** * Fully-initialising value constructor * */ public UnitDefinitionType(final List<MetaDataProperty> metaDataProperty, final Description description, final List<Name> name, final String id, final QuantityType quantityType, final CatalogSymbol catalogSymbol) { super(metaDataProperty, description, name, id); this.quantityType = quantityType; this.catalogSymbol = catalogSymbol; } /** * Gets the value of the quantityType property. * * @return * possible object is * {@link QuantityType } * */ public QuantityType getQuantityType() { return quantityType; } /** * Sets the value of the quantityType property. * * @param value * allowed object is * {@link QuantityType } * */ public void setQuantityType(QuantityType value) { this.quantityType = value; } /** * Gets the value of the catalogSymbol property. * * @return * possible object is * {@link CatalogSymbol } * */ public CatalogSymbol getCatalogSymbol() { return catalogSymbol; } /** * Sets the value of the catalogSymbol property. * * @param value * allowed object is * {@link CatalogSymbol } * */ public void setCatalogSymbol(CatalogSymbol value) { this.catalogSymbol = value; } }
B3Partners/b3p-commons-csw
src/main/java/nl/b3p/csw/jaxb/gml/UnitDefinitionType.java
Java
lgpl-3.0
3,768
'use strict'; var gulp = require('gulp'), sass = require('gulp-sass'), concatCss = require('gulp-concat-css'), csso = require('gulp-csso'), concat = require('gulp-concat'), minifyjs = require('gulp-minify'), processhtml = require('gulp-processhtml'); gulp.task('sass', function () { return gulp.src('./sass/**/*.scss') .pipe(sass().on('error', sass.logError)) .pipe(gulp.dest('./css')); }); gulp.task('css_min_concat', function () { return gulp.src([ './css/**/*.css' ]) .pipe(csso()) .pipe(concatCss('style.css')) .pipe(gulp.dest('../public/css')); }); gulp.task('js_min_concat', function () { return gulp.src([ './js/**/*.js' ]) .pipe(minifyjs({ ext:{min: '.min.js'}, noSource: true })) .pipe(concat('script.js')) .pipe(gulp.dest('../public/js')); }); gulp.task('posthtml', function () { return gulp.src('./*.html') .pipe(processhtml()) .pipe(gulp.dest('../views')); }); gulp.task('prod', ['sass', 'css_min_concat', 'js_min_concat', 'posthtml'], function() {});
nirdizati/nirdizati-runtime
src/gulpfile.js
JavaScript
lgpl-3.0
1,192
// Created file "Lib\src\Uuid\X64\scripteddiag_i" typedef struct _GUID { unsigned long Data1; unsigned short Data2; unsigned short Data3; unsigned char Data4[8]; } GUID; #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } DEFINE_GUID(IID_IScriptedDiagnosticInformation, 0x2db48474, 0xd18b, 0x4315, 0xb5, 0x52, 0xdc, 0x6c, 0xf5, 0xf6, 0x51, 0xd5);
Frankie-PellesC/fSDK
Lib/src/Uuid/X64/scripteddiag_i00000005.c
C
lgpl-3.0
477
// Created file "Lib\src\Uuid\i_mshtml" typedef struct _GUID { unsigned long Data1; unsigned short Data2; unsigned short Data3; unsigned char Data4[8]; } GUID; #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } DEFINE_GUID(IID_IHTMLDOMTextNode2, 0x3050f809, 0x98b5, 0x11cf, 0xbb, 0x82, 0x00, 0xaa, 0x00, 0xbd, 0xce, 0x0b);
Frankie-PellesC/fSDK
Lib/src/Uuid/i_mshtml00000035.c
C
lgpl-3.0
454
/******************************************************************************* * Copyright (c) 2009, 2017 GreenVulcano ESB Open Source Project. * All rights reserved. * * This file is part of GreenVulcano ESB. * * GreenVulcano ESB is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * GreenVulcano ESB is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with GreenVulcano ESB. If not, see <http://www.gnu.org/licenses/>. *******************************************************************************/ package it.greenvulcano.gvesb.rsh; import java.rmi.RemoteException; import org.w3c.dom.Node; import it.greenvulcano.gvesb.rsh.server.rmi.RSHService; /** * * @version 4.0.0 - Mar 2017 * @author GreenVulcano Developer Team */ public interface RSHServiceClient extends RSHService { /** * * @param node * @throws RSHException */ public void init(Node node) throws RSHException; /** * * @param fileName * @return byte[] * @throws RemoteException * @throws RSHException */ public byte[] getFileB(String fileName) throws RemoteException, RSHException; /** * * @param fileName * @param content * @throws RemoteException * @throws RSHException */ public void sendFileB(String fileName, byte[] content) throws RemoteException, RSHException; /** * * @return String */ public String getName(); public void invalidate(); /** * * @return boolean */ public boolean isValid(); public void cleanup(); }
green-vulcano/gv-legacy
gvlegacy/gvvcl-rsh/src/main/java/it/greenvulcano/gvesb/rsh/RSHServiceClient.java
Java
lgpl-3.0
2,029
using BigBirds.Domain.Entities; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Linq.Expressions; using System.Data.Entity; using BigBirds.Domain.Entities.Seed; using System.Data.Common; using BigBirds.Domain.Contexts; namespace BigBirds.Domain.Repository { public class EFBaseRepository<TEntity> : IUnitOfWork, IRepository<TEntity> where TEntity : EntidadeBase { #region fields and properties bool _disposed; private readonly DbContext _dbContext; protected DbContext DbContext { get { return _dbContext; } } #endregion #region constructors private EFBaseRepository(string connectionName) { if (string.IsNullOrWhiteSpace(connectionName)) throw new ArgumentNullException("connectionName"); _dbContext = new DbContext(connectionName); // setting the db initializer // Database.SetInitializer<BigBirdsContext>(new EFBootstrap()); } public EFBaseRepository(DbContext dbContext) { if (dbContext == null) throw new ArgumentNullException("dbContext"); _dbContext = dbContext; // Database.SetInitializer<BigBirdsContext>(new EFBootstrap()); } ~EFBaseRepository() { Dispose(false); } #endregion #region interface IRepository<TEntity> public void Add(TEntity obj) { if (obj == null) throw new ArgumentNullException("obj"); DbContext.Set<TEntity>().Add(obj); } public void Update(TEntity obj) { if (obj == null) throw new ArgumentNullException("obj"); DbContext.Set<TEntity>().Attach(obj); DbContext.Entry(obj).State = EntityState.Modified; } public ICollection<TEntity> GetAll() { return DbContext.Set<TEntity>().ToList(); } public ICollection<TEntity> GetAll(Expression<Func<TEntity, bool>> criteria) { return DbContext.Set<TEntity>().Where(criteria).ToList(); } public TEntity GetById(int id) { return _dbContext.Set<TEntity>().Find(id); } public void Remove(TEntity obj) { if (obj == null) throw new ArgumentNullException("obj"); DbContext.Set<TEntity>().Attach(obj); DbContext.Set<TEntity>().Remove(obj); } public void Remove(int id) { var entidade = GetById(id); DbContext.Set<TEntity>().Attach(entidade); DbContext.Set<TEntity>().Remove(entidade); } #endregion #region interface IUnitOfWork public void SaveChanges() { _dbContext.SaveChanges(); } #endregion #region IDisposable public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { if (_disposed) return; if (disposing) { // free other managed objects that implement // IDisposable only } // release any unmanaged objects // set the object references to null _disposed = true; } #endregion } }
mnatanbrito/HackathonSerpro
BigBirds/BigBirds.Domain/Repository/EFBaseRepository.cs
C#
lgpl-3.0
3,508
/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check bigger struct which overlaps the gp and fp register count on Darwin/AIX/ppc64. Limitations: none. PR: none. Originator: <andreast@gcc.gnu.org> 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_64byte { double a; double b; double c; double d; double e; double f; double g; double h; } cls_struct_64byte; cls_struct_64byte cls_struct_64byte_fn(struct cls_struct_64byte b0, struct cls_struct_64byte b1, struct cls_struct_64byte b2, struct cls_struct_64byte b3) { struct cls_struct_64byte result; result.a = b0.a + b1.a + b2.a + b3.a; result.b = b0.b + b1.b + b2.b + b3.b; result.c = b0.c + b1.c + b2.c + b3.c; result.d = b0.d + b1.d + b2.d + b3.d; result.e = b0.e + b1.e + b2.e + b3.e; result.f = b0.f + b1.f + b2.f + b3.f; result.g = b0.g + b1.g + b2.g + b3.g; result.h = b0.h + b1.h + b2.h + b3.h; printf("%g %g %g %g %g %g %g %g\n", result.a, result.b, result.c, result.d, result.e, result.f, result.g, result.h); return result; } static void cls_struct_64byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_64byte b0, b1, b2, b3; b0 = *(struct cls_struct_64byte*)(args[0]); b1 = *(struct cls_struct_64byte*)(args[1]); b2 = *(struct cls_struct_64byte*)(args[2]); b3 = *(struct cls_struct_64byte*)(args[3]); *(cls_struct_64byte*)resp = cls_struct_64byte_fn(b0, b1, b2, b3); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[9]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_64byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0 }; struct cls_struct_64byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0 }; struct cls_struct_64byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0 }; struct cls_struct_64byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0 }; struct cls_struct_64byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; cls_struct_fields[3] = &ffi_type_double; cls_struct_fields[4] = &ffi_type_double; cls_struct_fields[5] = &ffi_type_double; cls_struct_fields[6] = &ffi_type_double; cls_struct_fields[7] = &ffi_type_double; cls_struct_fields[8] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = &cls_struct_type; dbl_arg_types[3] = &cls_struct_type; dbl_arg_types[4] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = &h_dbl; args_dbl[4] = NULL; ffi_call(&cif, FFI_FN(cls_struct_64byte_fn), &res_dbl, args_dbl); /* { dg-output "22 15 17 25 6 13 19 18" } */ printf("res: %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h); /* { dg-output "\nres: 22 15 17 25 6 13 19 18" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_64byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_64byte(*)(cls_struct_64byte, cls_struct_64byte, cls_struct_64byte, cls_struct_64byte)) (code))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n22 15 17 25 6 13 19 18" } */ printf("res: %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h); /* { dg-output "\nres: 22 15 17 25 6 13 19 18" } */ exit(0); }
kveratis/GameCode4
Source/GCC4/3rdParty/luaplus51-all/Src/Modules/alien/libffi/testsuite/libffi.call/cls_64byte.c
C
lgpl-3.0
4,044
<html> <head> <meta http-equiv="content-type" content="text/html; charset=windows-1252"/> <title>Insérer un programme dans une Tâche</title> <style type="text/css"> @page { size: 21.59cm 27.94cm; margin-right: 2cm; margin-top: 2.5cm; margin-bottom: 1.5cm } p { margin-bottom: 0.21cm; direction: ltr; color: #000000; orphans: 0; widows: 0 } p.western { font-family: "Arial", "Times New Roman", serif; font-size: 10pt; so-language: it-IT } h3.western { font-family: "Liberation Sans", "Arial", sans-serif; so-language: it-IT } a:link { color: #0000ff } a.cjk:visited { so-language: zh-CN } </style> </head> <body> <h3 class="western">Insérer un programme dans une Tâche</h3> <p class="western">Après avoir créé le programme, nous pouvons l'insérer dans la tâche que nous voulons. Pour ce faire, sélectionnez le programme dans l'onglet &ldquo;Class&rdquo;, et faites-le glisser (avec le bouton gauche de la souris) dans la tâche souhaitée.</p> <p class="western"><strong>REMARQUE:</strong> Le même programme peut être utilisé puis instancié dans plusieurs tâches.</p> <p class="western"><img src="Inserimento_programma_Task_1.png" name="Immagine164" align="bottom" width="243" height="314" border="0"/></p> <p class="western">Dans le programme, il est possible d'insérer et d'utiliser une fonction et/ou un bloc fonction ; voir l'aide ATCMcontrol pour plus de détails.</p> <br/> </body> </html>
MECTsrl/mect_plugins
qt_help/tutorial/Inserimento_programma_Task_fr.html
HTML
lgpl-3.0
1,463
/* * #%L * The AIBench Shell Plugin * %% * Copyright (C) 2006 - 2017 Daniel Glez-Peña and Florentino Fdez-Riverola * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. * #L% */ /***************************************************************************** * * * This file is part of the BeanShell Java Scripting distribution. * * Documentation and updates may be found at http://www.beanshell.org/ * * * * Sun Public License Notice: * * * * The contents of this file are subject to the Sun Public License Version * * 1.0 (the "License"); you may not use this file except in compliance with * * the License. A copy of the License is available at http://www.sun.com * * * * The Original Code is BeanShell. The Initial Developer of the Original * * Code is Pat Niemeyer. Portions created by Pat Niemeyer are Copyright * * (C) 2000. All Rights Reserved. * * * * GNU Public License Notice: * * * * Alternatively, the contents of this file may be used under the terms of * * the GNU Lesser General Public License (the "LGPL"), in which case the * * provisions of LGPL are applicable instead of those above. If you wish to * * allow use of your version of this file only under the terms of the LGPL * * and not to allow others to use your version of this file under the SPL, * * indicate your decision by deleting the provisions above and replace * * them with the notice and other provisions required by the LGPL. If you * * do not delete the provisions above, a recipient may use your version of * * this file under either the SPL or the LGPL. * * * * Patrick Niemeyer (pat@pat.net) * * Author of Learning Java, O'Reilly & Associates * * http://www.pat.net/~pat/ * * * *****************************************************************************/ package bsh; /* * Note: great care (and lots of typing) were taken to insure that the namespace * and interpreter references are passed on the stack and not (as they were * erroneously before) installed in instance variables... Each of these node * objects must be re-entrable to allow for recursive situations. * * The only data which should really be stored in instance vars here should be * parse tree data... features of the node which should never change (e.g. the * number of arguments, etc.) * * Exceptions would be public fields of simple classes that just publish data * produced by the last eval()... data that is used immediately. We'll try to * remember to mark these as transient to highlight them. * */ class SimpleNode implements Node { private static final long serialVersionUID = 1L; public static SimpleNode JAVACODE = new SimpleNode(-1) { private static final long serialVersionUID = 1L; public String getSourceFile() { return "<Called from Java Code>"; } public int getLineNumber() { return -1; } public String getText() { return "<Compiled Java Code>"; } }; protected Node parent; protected Node[] children; protected int id; Token firstToken, lastToken; /** the source of the text from which this was parsed */ String sourceFile; public SimpleNode(int i) { id = i; } public void jjtOpen() {} public void jjtClose() {} public void jjtSetParent(Node n) { parent = n; } public Node jjtGetParent() { return parent; } // public SimpleNode getParent() { return (SimpleNode)parent; } public void jjtAddChild(Node n, int i) { if (children == null) children = new Node[i + 1]; else if (i >= children.length) { Node c[] = new Node[i + 1]; System.arraycopy(children, 0, c, 0, children.length); children = c; } children[i] = n; } public Node jjtGetChild(int i) { return children[i]; } public SimpleNode getChild(int i) { return (SimpleNode) jjtGetChild(i); } public int jjtGetNumChildren() { return (children == null) ? 0 : children.length; } /* * You can override these two methods in subclasses of SimpleNode to * customize the way the node appears when the tree is dumped. If your * output uses more than one line you should override toString(String), * otherwise overriding toString() is probably all you need to do. */ public String toString() { return ParserTreeConstants.jjtNodeName[id]; } public String toString(String prefix) { return prefix + toString(); } /* * Override this method if you want to customize how the node dumps out its * children. */ public void dump(String prefix) { System.out.println(toString(prefix)); if (children != null) { for (int i = 0; i < children.length; ++i) { SimpleNode n = (SimpleNode) children[i]; if (n != null) { n.dump(prefix + " "); } } } } // ---- BeanShell specific stuff hereafter ---- // /** * Detach this node from its parent. This is primarily useful in node * serialization. (see BSHMethodDeclaration) */ public void prune() { jjtSetParent(null); } /** * This is the general signature for evaluation of a node. * * @param callstack the call stack of the evaluation. * @param interpreter the interpreter. * @return the result of the evaluation. * @throws EvalError if an error occurs while evaluating. */ public Object eval(CallStack callstack, Interpreter interpreter) throws EvalError { throw new InterpreterError("Unimplemented or inappropriate for " + getClass().getName()); } /** * Set the name of the source file (or more generally source) of the text * from which this node was parsed. * * @param sourceFile the name of the source file (or more generally source) of the text * from which this node was parsed. */ public void setSourceFile(String sourceFile) { this.sourceFile = sourceFile; } /** * Get the name of the source file (or more generally source) of the text * from which this node was parsed. This will recursively search up the * chain of parent nodes until a source is found or return a string * indicating that the source is unknown. * * @return the name of the source file of the text from which this node was parsed. */ public String getSourceFile() { if (sourceFile == null) if (parent != null) return ((SimpleNode) parent).getSourceFile(); else return "<unknown file>"; else return sourceFile; } /** * Returns the line number of the starting token. * * @return the line number of the starting token. */ public int getLineNumber() { return firstToken.beginLine; } /* * Get the ending line number of the starting token public int * getEndLineNumber() { return lastToken.endLine; } */ /** * Returns the text of the tokens comprising this node. * * @return the text of the tokens comprising this node. */ public String getText() { StringBuffer text = new StringBuffer(); Token t = firstToken; while (t != null) { text.append(t.image); if (!t.image.equals(".")) text.append(" "); if (t == lastToken || t.image.equals("{") || t.image.equals(";")) break; t = t.next; } return text.toString(); } }
sing-group/aibench-project
aibench-shell/src/main/java/bsh/SimpleNode.java
Java
lgpl-3.0
8,571
/** * */ package com.iam_vip.v2.type; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import org.dom4j.Element; import com.iam_vip.v2.__IXml; /** * @author Colin */ public class XmlList extends XmlObject implements __IXml { /** * */ private static final long serialVersionUID = 6301560450684035658L; public static final String TAG[] = { "array", "list", "set", "collection" }; public static final List<String> TAGS = Arrays.asList(TAG); /** * */ public XmlList() { } private List<Element> elements; private int size = LENGTH; /* * (non-Javadoc) * @see com.iam_vip.v2.XmlObject#parse(org.dom4j.Element) */ @Override public XmlList parse(Element element) { this.elements = element.elements(); String size_attr = element.attributeValue("size"); if (!(size_attr == null || "".equals(size_attr))) { this.size = Integer.parseInt(size_attr); } return this; } /* * (non-Javadoc) * @see com.iam_vip.v2.XmlObject#value() */ @Override public Object value() throws Exception { List<Object> list = new ArrayList<Object>(this.size + 1); if (this.elements.size() == 1) { // List with value Element element = this.elements.get(0); String elementName = element.getName(); for (int i = 0; i < this.size; ++i) { XmlObject data = null; for (List<String> key : DATA.keySet()) { if (key.contains(elementName)) { data = (XmlObject) DATA.get(key).newInstance(); data.parse(element); break; } } if (data != null) { list.add(data.value()); } } // List with value } else { for (int i = 0; i < this.size; ++i) { // 数据项 Map<String, Object> item = new HashMap<String, Object>(this.elements.size() + 1); for (Element element : this.elements) { String elementName = element.getName(); String elementKey = element.attributeValue("key"); XmlObject data = null; for (List<String> key : DATA.keySet()) { if (key.contains(elementName)) { data = (XmlObject) DATA.get(key).newInstance(); data.parse(element); break; } } if (data != null) { item.put(elementKey, data.value()); } } // for (Element element : elements) {} list.add(item); } // Root Element List Size } // List with object return list; } }
nilocsivad/generate-json-java
src/main/java/com/iam_vip/v2/type/XmlList.java
Java
lgpl-3.0
2,416
#!/bin/bash php -f postgresqldumper.php admin postgre_admin.sql 32 "../../modules/admin/install/mysqli.php" "../../modules/admin/install/postgresql.php" php -f postgresqldumper.php appointment appointment.sql 2 "../../modules/appointment/install/mysqli.php" "../../modules/appointment/install/postgresql.php" php -f postgresqldumper.php contacts postgre_contacts.sql 2 "../../modules/contacts/install/mysqli.php" "../../modules/contacts/install/postgresql.php" php -f postgresqldumper.php counter postgre_counter.sql 3 "../../modules/counter/install/mysqli.php" "../../modules/counter/install/postgresql.php" php -f postgresqldumper.php image postgre_image.sql 2 "../../modules/image/install/mysqli.php" "../../modules/image/install/postgresql.php" php -f postgresqldumper.php menu postgre_menu.sql 2 "../../modules/menu/install/mysqli.php" "../../modules/menu/install/postgresql.php" php -f postgresqldumper.php page postgre_page.sql 1 "../../modules/page/install/mysqli.php" "../../modules/page/install/postgresql.php" php -f postgresqldumper.php search postgre_search.sql 4 "../../modules/search/install/mysqli.php" "../../modules/search/install/postgresql.php" php -f postgresqldumper.php skype postgre_skype.sql 2 "../../modules/skype/install/mysqli.php" "../../modules/skype/install/postgresql.php" php -f postgresqldumper.php standard postgre_standard.sql 1 "../../modules/standard/install/mysqli.php" "../../modules/standard/install/postgresql.php" php -f postgresqldumper.php table postgre_table.sql 2 "../../modules/table/install/mysqli.php" "../../modules/table/install/postgresql.php"
Devoter/rtQuery
translator/dumper/makeObjectsFromPostgreSQL.sh
Shell
lgpl-3.0
1,597
\hypertarget{dir_68267d1309a1af8e8297ef4c3efbcdba}{\section{/home/stephan/code/unversioned/mdcore-\/0.1.7/src Directory Reference} \label{dir_68267d1309a1af8e8297ef4c3efbcdba}\index{/home/stephan/code/unversioned/mdcore-\/0.\-1.\-7/src Directory Reference@{/home/stephan/code/unversioned/mdcore-\/0.\-1.\-7/src Directory Reference}} } \subsection*{Files} \begin{DoxyCompactItemize} \item file \hyperlink{angle_8c}{angle.\-c} \item file \hyperlink{angle_8h}{angle.\-h} \item file \hyperlink{bond_8c}{bond.\-c} \item file \hyperlink{bond_8h}{bond.\-h} \item file \hyperlink{btree_8c}{btree.\-c} \item file \hyperlink{btree_8h}{btree.\-h} \item file \hyperlink{cell_8c}{cell.\-c} \item file \hyperlink{cell_8h}{cell.\-h} \item file \hyperlink{cutil__math_8h}{cutil\-\_\-math.\-h} \item file \hyperlink{cycle_8h}{cycle.\-h} \item file \hyperlink{dihedral_8c}{dihedral.\-c} \item file \hyperlink{dihedral_8h}{dihedral.\-h} \item file \hyperlink{engine_8c}{engine.\-c} \item file \hyperlink{engine_8h}{engine.\-h} \item file \hyperlink{engine__bonded_8c}{engine\-\_\-bonded.\-c} \item file \hyperlink{engine__cuda_8cu}{engine\-\_\-cuda.\-cu} \item file \hyperlink{engine__exchange_8c}{engine\-\_\-exchange.\-c} \item file \hyperlink{engine__io_8c}{engine\-\_\-io.\-c} \item file \hyperlink{engine__rigid_8c}{engine\-\_\-rigid.\-c} \item file \hyperlink{errs_8c}{errs.\-c} \item file \hyperlink{errs_8h}{errs.\-h} \item file \hyperlink{exclusion_8c}{exclusion.\-c} \item file \hyperlink{exclusion_8h}{exclusion.\-h} \item file \hyperlink{fptype_8h}{fptype.\-h} \item file \hyperlink{lock_8h}{lock.\-h} \item file \hyperlink{mainpage_8h}{mainpage.\-h} \item file \hyperlink{mdcore_8h}{mdcore.\-h} \item file \hyperlink{part_8c}{part.\-c} \item file \hyperlink{part_8h}{part.\-h} \item file \hyperlink{potential_8c}{potential.\-c} \item file \hyperlink{potential_8h}{potential.\-h} \item file \hyperlink{potential__eval_8h}{potential\-\_\-eval.\-h} \item file \hyperlink{queue_8c}{queue.\-c} \item file \hyperlink{queue_8h}{queue.\-h} \item file \hyperlink{reader_8c}{reader.\-c} \item file \hyperlink{reader_8h}{reader.\-h} \item file \hyperlink{rigid_8c}{rigid.\-c} \item file \hyperlink{rigid_8h}{rigid.\-h} \item file \hyperlink{runner_8c}{runner.\-c} \item file \hyperlink{runner_8h}{runner.\-h} \item file \hyperlink{runner__cuda_8cu}{runner\-\_\-cuda.\-cu} \item file \hyperlink{runner__cuda_8h}{runner\-\_\-cuda.\-h} \item file \hyperlink{runner__cuda__main_8h}{runner\-\_\-cuda\-\_\-main.\-h} \item file \hyperlink{runner__dopair_8c}{runner\-\_\-dopair.\-c} \item file \hyperlink{runner__dosort_8c}{runner\-\_\-dosort.\-c} \item file \hyperlink{space_8c}{space.\-c} \item file \hyperlink{space_8h}{space.\-h} \item file \hyperlink{spme_8c}{spme.\-c} \item file \hyperlink{spme_8h}{spme.\-h} \item file \hyperlink{task_8c}{task.\-c} \item file \hyperlink{task_8h}{task.\-h} \end{DoxyCompactItemize}
stephanmg/mdcore
doc/latex/dir_68267d1309a1af8e8297ef4c3efbcdba.tex
TeX
lgpl-3.0
2,949
package com.intermancer.predictor.experiment; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.intermancer.predictor.feeder.Feeder; import com.intermancer.predictor.organism.Organism; import com.intermancer.predictor.organism.breed.BreedStrategy; import com.intermancer.predictor.organism.store.OrganismStore; import com.intermancer.predictor.organism.store.OrganismStoreRecord; import com.intermancer.predictor.organism.store.StoreFullException; public class ExperimentPrimeStrategy implements OrganismLifecycleStrategy { private static final Logger logger = LogManager.getLogger(ExperimentPrimeStrategy.class); private final ObjectMapper mapper; private BreedStrategy breedStrategy; private Feeder feeder; public ExperimentPrimeStrategy() { mapper = new ObjectMapper(); } public ExperimentPrimeStrategy(BreedStrategy breedStrategy, Feeder feeder) { this(); this.breedStrategy = breedStrategy; this.feeder = feeder; } @Override public List<OrganismStoreRecord> getAncestors(OrganismStore store) { List<OrganismStoreRecord> parents = new ArrayList<OrganismStoreRecord>(); // We will pull alpha from the top quarter. OrganismStoreRecord alpha = store.getRandomOrganismStoreRecordFromLowScorePool(0.25); parents.add(alpha); // We will pull beta from the entire pool. OrganismStoreRecord beta = alpha; do { beta = store.getRandomOrganismStoreRecord(); } while (beta.equals(alpha)); parents.add(beta); return parents; } @Override public List<OrganismStoreRecord> generateNextGeneration(List<OrganismStoreRecord> ancestors) { List<Organism> ancestorOrganisms = new ArrayList<Organism>(); for (OrganismStoreRecord record : ancestors) { ancestorOrganisms.add(record.getOrganism()); } List<Organism> children = breedStrategy.breed(ancestorOrganisms); List<OrganismStoreRecord> scoredChildren = new ArrayList<OrganismStoreRecord>(); for (Organism child : children) { OrganismStoreRecord storeRecord = feedOrganism(child); scoredChildren.add(storeRecord); } return scoredChildren; } @Override public OrganismStoreRecord feedOrganism(Organism organism) { feeder.setOrganism(organism); feeder.init(); feeder.feedOrganism(); OrganismStoreRecord storeRecord = new OrganismStoreRecord(feeder.getEvaluator().getScore(), organism); return storeRecord; } @Override public List<OrganismStoreRecord> mergeIntoPopulation(List<OrganismStoreRecord> ancestors, List<OrganismStoreRecord> children, OrganismStore store) throws StoreFullException { List<OrganismStoreRecord> allOrganisms = new ArrayList<OrganismStoreRecord>(); allOrganisms.addAll(children); allOrganisms.addAll(ancestors); Collections.sort(allOrganisms, OrganismStoreRecord.COMPARATOR); List<OrganismStoreRecord> recordsToRemove = new ArrayList<OrganismStoreRecord>(); List<OrganismStoreRecord> recordsToAdd = new ArrayList<OrganismStoreRecord>(); List<OrganismStoreRecord> finals = new ArrayList<OrganismStoreRecord>(); for (int i = 0; i < allOrganisms.size(); i++) { OrganismStoreRecord record = allOrganisms.get(i); if (i < 2) { if (record.getId() == null) { recordsToAdd.add(record); } finals.add(record); } else { if (record.getId() != null) { recordsToRemove.add(record); } } } for (OrganismStoreRecord record : recordsToRemove) { store.removeRecord(record); } for (OrganismStoreRecord record : recordsToAdd) { try { store.addRecord(record); } catch (StoreFullException ex) { try { // This happened when the two ancestors were the same // record. ArrayList<Object> items = new ArrayList<Object>(); items.add("==========ancestors=========="); items.add(ancestors); items.add("==========children=========="); items.add(children); items.add("==========allOrganisms=========="); items.add(allOrganisms); items.add("==========recordsToRemove=========="); items.add(recordsToRemove); items.add("==========recordsToAdd=========="); items.add(recordsToAdd); logger.error("Combined record:{}", mapper.writeValueAsString(items)); } catch (JsonProcessingException e) { e.printStackTrace(); } throw ex; } } store.analyze(); return finals; } public BreedStrategy getBreedStrategy() { return breedStrategy; } public void setBreedStrategy(BreedStrategy breedStrategy) { this.breedStrategy = breedStrategy; } public Feeder getFeeder() { return feeder; } public void setFeeder(Feeder feeder) { this.feeder = feeder; } }
intermancer/predictor2-core
src/main/java/com/intermancer/predictor/experiment/ExperimentPrimeStrategy.java
Java
lgpl-3.0
4,797
/* Copyright 2011 PODO. This file is part of PODO. PODO is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. PODO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with PODO. If not, see <http://www.gnu.org/licenses/>. */ #include <gui/PDApp.h> #include <gui/PDWidget.h> #include <gui/PDLabel.h> #include <gui/PDPainter.h> class MainFrm : public PD::Widget { private: PD::Label* m_label1; PD::Label* m_label2; PD::Label* m_label3; public: MainFrm(Widget* parent) : Widget(parent) { //palette().setColor(PD::Palette::Background, PD::green); m_label1 = new PD::Label(this, "Label1", "Label1-FillBg"); m_label1->palette().setColor(PD::Palette::Text, PD::white); m_label1->palette().setColor(PD::Palette::Background, PD::blue); m_label1->setAlignment(PD::AlignRight); m_label1->setGeometry(10,10,280,30); m_label1->show(); m_label2 = new PD::Label(this, "Label2", "Label2-NoBg"); m_label2->palette().setColor(PD::Palette::Text, PD::white); m_label2->palette().setColor(PD::Palette::Background, PD::blue); m_label2->setAlignment( PD::AlignLeft); m_label2->setBgMode(PD::NoBg); m_label2->setGeometry(10,50,280,30); m_label2->show(); m_label3 = new PD::Label(this, "Label3", "Label-ParentBg-1"); m_label3->setAlignment(PD::AlignCenter); m_label3->setBgMode(PD::ParentBg); m_label3->setGeometry(10,90,280,30); m_label3->show(); } ~MainFrm() { delete m_label1; delete m_label2; delete m_label3; } }; int main(int /*argc*/, char** /*argv*/) { PD::App app(400, 300); MainFrm m(NULL); m.setGeometry(0, 0, 400, 300); m.show(); return app.exec(); }
ktd2004/podo
examples/gui/label/main.cpp
C++
lgpl-3.0
2,108
/* * MPEG Audio parser * Copyright (c) 2003 Fabrice Bellard * Copyright (c) 2003 Michael Niedermayer * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "parser.h" #include "mpegaudiodecheader.h" #include "libavutil/common.h" #include "libavformat/id3v1.h" // for ID3v1_TAG_SIZE typedef struct MpegAudioParseContext { ParseContext pc; int frame_size; uint32_t header; int header_count; int no_bitrate; } MpegAudioParseContext; #define MPA_HEADER_SIZE 4 /* header + layer + freq + lsf/mpeg25 */ #define SAME_HEADER_MASK \ (0xffe00000 | (3 << 17) | (3 << 10) | (3 << 19)) static int mpegaudio_parse(AVCodecParserContext *s1, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size) { MpegAudioParseContext *s = s1->priv_data; ParseContext *pc = &s->pc; uint32_t state= pc->state; int i; int next= END_NOT_FOUND; int flush = !buf_size; for(i=0; i<buf_size; ){ if(s->frame_size){ int inc= FFMIN(buf_size - i, s->frame_size); i += inc; s->frame_size -= inc; state = 0; if(!s->frame_size){ next= i; break; } }else{ while(i<buf_size){ int ret, sr, channels, bit_rate, frame_size; enum AVCodecID codec_id = avctx->codec_id; state= (state<<8) + buf[i++]; ret = ff_mpa_decode_header(state, &sr, &channels, &frame_size, &bit_rate, &codec_id); if (ret < 4) { if (i > 4) s->header_count = -2; } else { int header_threshold = avctx->codec_id != AV_CODEC_ID_NONE && avctx->codec_id != codec_id; if((state&SAME_HEADER_MASK) != (s->header&SAME_HEADER_MASK) && s->header) s->header_count= -3; s->header= state; s->header_count++; s->frame_size = ret-4; if (s->header_count > header_threshold) { avctx->sample_rate= sr; avctx->channels = channels; s1->duration = frame_size; avctx->codec_id = codec_id; if (s->no_bitrate || !avctx->bit_rate) { s->no_bitrate = 1; avctx->bit_rate += (bit_rate - avctx->bit_rate) / (s->header_count - header_threshold); } } if (s1->flags & PARSER_FLAG_COMPLETE_FRAMES) { s->frame_size = 0; next = buf_size; } else if (codec_id == AV_CODEC_ID_MP3ADU) { avpriv_report_missing_feature(avctx, "MP3ADU full parser"); *poutbuf = NULL; *poutbuf_size = 0; return buf_size; /* parsers must not return error codes */ } break; } } } } pc->state= state; if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { *poutbuf = NULL; *poutbuf_size = 0; return buf_size; } if (flush && buf_size >= ID3v1_TAG_SIZE && memcmp(buf, "TAG", 3) == 0) { *poutbuf = NULL; *poutbuf_size = 0; return next; } *poutbuf = buf; *poutbuf_size = buf_size; return next; } AVCodecParser ff_mpegaudio_parser = { .codec_ids = { AV_CODEC_ID_MP1, AV_CODEC_ID_MP2, AV_CODEC_ID_MP3, AV_CODEC_ID_MP3ADU }, .priv_data_size = sizeof(MpegAudioParseContext), .parser_parse = mpegaudio_parse, .parser_close = ff_parse_close, };
olivierayache/xuggle-xuggler
captive/ffmpeg/csrc/libavcodec/mpegaudio_parser.c
C
lgpl-3.0
4,646
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <html> <head> <title>fr.inria.zvtm.widgets package</title> </head> <body bgcolor="white"> <p>Specialized versions of conventional Swing widgets to be overlaid on top of ZVTM views, and ZVTM Glyph-based widgets such as pie menus.</p> </body> </html>
sharwell/zgrnbviewer
org-tvl-netbeans-zgrviewer/src/fr/inria/zvtm/widgets/package.html
HTML
lgpl-3.0
307
// // Copyright (c) 2016-present, Facebook, Inc. // All rights reserved. // // This source code is licensed under the BSD-style license found in the // LICENSE file in the root directory of this source tree. An additional grant // of patent rights can be found in the PATENTS file in the same directory. // #import <SocketRocket/NSRunLoop+SRWebSocket.h> // Empty function that force links the object file for the category. extern void import_NSRunLoop_SRWebSocket();
ios-plugin/uexDemo
3rdParty/src/SocketRocket/SocketRocket/Internal/NSRunLoop+SRWebSocketPrivate.h
C
lgpl-3.0
469
--- wrapper_template: "kubernetes/docs/base_docs.html" markdown_includes: nav: "kubernetes/docs/shared/_side-navigation.md" context: title: "vSphere integrator charm" description: Kubernetes-master Charm reference keywords: kubernetes-master, charm, config tags: [reference] sidebar: k8smain-sidebar permalink: charm-vsphere-integrator.html layout: [base, ubuntu-com] toc: False --- This charm acts as a proxy to VMware vSphere and provides an [interface][] to provide a set of credentials for a somewhat limited project user to the applications that are related to this charm. ## Usage When on a vSphere cloud, this charm can be deployed, granted trust via Juju to access vSphere, and then related to an application that supports the [interface][]. For example, [Charmed Kubernetes][] has support for this, and can be deployed with the following bundle overlay: ```yaml applications: vsphere-integrator: charm: cs:~containers/vsphere-integrator num_units: 1 relations: - ['vsphere-integrator', 'kubernetes-master'] - ['vsphere-integrator', 'kubernetes-worker'] ``` Using Juju 2.4 or later: ```bash juju deploy cs:charmed-kubernetes --overlay ./k8s-vsphere-overlay.yaml juju trust vsphere-integrator ``` To deploy with earlier versions of Juju, you will need to provide the cloud credentials via the `credentials` charm config option: ```bash cat <<EOJ > /path/to/cloud.json { "vsphere_ip": "a.b.c.d", "user": "joe", "password": "passw0rd", "datacenter": "dc0" } EOJ juju config vsphere-integrator credentials="$(base64 /path/to/cloud.json)" ``` ## Configuration This charm supports multiple config options that can be used to describe they vSphere environment. The only required option is `datastore`, as it is not included in the Juju credential that this charm relies on. By default, this is set to *datastore1*. This can be changed with: ```bash juju config vsphere-integrator datastore='mydatastore' ``` You may also configure a *folder* and *resource pool path* for this charm. Details about these options can be found in the [vmware documentation][]: ```bash juju config vsphere-integrator folder='juju-kubernetes' respool_path='foo' ``` As mentioned in the **Usage** section, `credentials` may be set with a base64-encoded json file. When set, this data will take precedent over all other methods of specifying credentials for this charm. If `credentials` is empty, there are config options for each key that constitute a Juju credential. These can be set with: ```bash juju config vsphere-integrator \ vsphere_ip='a.b.c.d' \ user='joe' \ password='passw0rd' \ datacenter='dc0' ``` >Note: If any of the credential config options are set, they must all be set. When all of the credential config options are empty, this charm will fall back to the credential data it received with `juju trust vsphere-integrator`. <!-- CONFIG STARTS --> <!--AUTOGENERATED CONFIG TEXT - DO NOT EDIT --> | name | type | Default | Description | |------|--------|--------------|-------------------------------------------| | <a id="table-credentials"> </a> credentials | string | | [See notes](#credentials-description) | | <a id="table-datacenter"> </a> datacenter | string | | vSphere datacenter name. In the vCenter control panel, this can be found at Inventory Lists > Resources > Datacenters. | | <a id="table-datastore"> </a> datastore | string | datastore1 | Datastore to use for provisioning volumes using storage classes and persistent volume claims. Defaults to 'datastore1'. | | <a id="table-folder"> </a> folder | string | juju-kubernetes | Virtual center VM folder path under the datacenter. Defaults to 'juju-kubernetes'. This value must not be empty. | | <a id="table-password"> </a> password | string | | Password of a valid vSphere user. | | <a id="table-respool_path"> </a> respool_path | string | | Path to resource pool under the datacenter. | | <a id="table-user"> </a> user | string | | Username of a valid vSphere user. | | <a id="table-vsphere_ip"> </a> vsphere_ip | string | | IP address of the vSphere server. | --- ### credentials <a id="credentials-description"> </a> **Description:** The base64-encoded contents of a JSON file containing vSphere credentials. The credentials must contain the following keys: vsphere_ip, user, password, datacenter, and datastore. This can be used from bundles with 'include-base64://' (see https://docs.jujucharms.com/2.4/en/charms-bundles#setting-charm-configuration-options-in-a-bundle), or from the command-line with 'juju config vsphere credentials="$(base64 /path/to/file)"'. It is strongly recommended that you use 'juju trust' instead, if available. [Back to table](#table-credentials) <!-- CONFIG ENDS --> ## Resource Usage Note By relating to this charm, other charms can directly allocate resources, such as PersistentDisk volumes, which could lead to cloud charges and count against quotas. Because these resources are not managed by Juju, they will not be automatically deleted when the models or applications are destroyed, nor will they show up in Juju's status or GUI. It is therefore up to the operator to manually delete these resources when they are no longer needed, using the vCenter console or API. ## Examples The following are some examples using vSphere integration with Charmed Kubernetes. ### Creating a pod with a PersistentDisk-backed volume This script creates a busybox pod with a persistent volume claim backed by vSphere's PersistentDisk. ```bash #!/bin/bash # create a storage class using the `kubernetes.io/vsphere-volume` provisioner kubectl create -f - <<EOY apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: mystorage provisioner: kubernetes.io/vsphere-volume parameters: diskformat: zeroedthick EOY # create a persistent volume claim using that storage class kubectl create -f - <<EOY kind: PersistentVolumeClaim apiVersion: v1 metadata: name: testclaim spec: accessModes: - ReadWriteOnce resources: requests: storage: 100Mi storageClassName: mystorage EOY # create the busybox pod with a volume using that PVC: kubectl create -f - <<EOY apiVersion: v1 kind: Pod metadata: name: busybox namespace: default spec: containers: - image: busybox command: - sleep - "3600" imagePullPolicy: IfNotPresent name: busybox volumeMounts: - mountPath: "/pv" name: testvolume restartPolicy: Always volumes: - name: testvolume persistentVolumeClaim: claimName: testclaim EOY ``` [interface]: https://github.com/juju-solutions/interface-vsphere-integration [Charmed Kubernetes]: https://jaas.ai/charmed-kubernetes [vmware documentation]: https://vmware.github.io/vsphere-storage-for-kubernetes/documentation/existing.html
barrymcgee/www.ubuntu.com
templates/kubernetes/docs/charm-vsphere-integrator.md
Markdown
lgpl-3.0
6,862
/* * Copyright (C) 2017 Max 'Libra' Kersten * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package capricorn; /** * An enum is used to prevent typos in the code and to keep the structure clean * and clear for other programmers * * @author Max 'Libra' Kersten */ public enum Arguments { GUARD, INSTALL, REPAIR, SCAN, UNINSTALL, STATUS, HELP }
ThisIsLibra/Capricorn
src/capricorn/Arguments.java
Java
lgpl-3.0
1,016
/* * This file is part of CasADi. * * CasADi -- A symbolic framework for dynamic optimization. * Copyright (C) 2010-2014 Joel Andersson, Joris Gillis, Moritz Diehl, * K.U. Leuven. All rights reserved. * Copyright (C) 2011-2014 Greg Horn * * CasADi is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * CasADi is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with CasADi; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef CASADI_SETNONZEROS_HPP #define CASADI_SETNONZEROS_HPP #include "mx_node.hpp" #include <map> #include <stack> /// \cond INTERNAL namespace casadi { /** \brief Assign or add entries to a matrix \author Joel Andersson \date 2013 */ template<bool Add> class CASADI_EXPORT SetNonzeros : public MXNode { public: /// Constructor SetNonzeros(const MX& y, const MX& x); /// Destructor ~SetNonzeros() override = 0; /// Get all the nonzeros virtual std::vector<int> all() const = 0; /** \brief Evaluate symbolically (MX) */ void eval_mx(const std::vector<MX>& arg, std::vector<MX>& res) const override; /** \brief Calculate forward mode directional derivatives */ void eval_forward(const std::vector<std::vector<MX> >& fseed, std::vector<std::vector<MX> >& fsens) const override; /** \brief Calculate reverse mode directional derivatives */ void eval_reverse(const std::vector<std::vector<MX> >& aseed, std::vector<std::vector<MX> >& asens) const override; /** \brief Get the operation */ int op() const override { return Add ? OP_ADDNONZEROS : OP_SETNONZEROS;} /// Get an IM representation of a GetNonzeros or SetNonzeros node Matrix<int> mapping() const override; /// Can the operation be performed inplace (i.e. overwrite the result) int numInplace() const override { return 1;} }; /** \brief Add the nonzeros of a matrix to another matrix \author Joel Andersson \date 2013 */ template<bool Add> class CASADI_EXPORT SetNonzerosVector : public SetNonzeros<Add>{ public: /// Constructor SetNonzerosVector(const MX& y, const MX& x, const std::vector<int>& nz); /// Destructor ~SetNonzerosVector() override {} /// Get all the nonzeros std::vector<int> all() const override { return nz_;} /// Evaluate the function (template) template<typename T> void evalGen(const T** arg, T** res, int* iw, T* w, int mem) const; /// Evaluate the function numerically void eval(const double** arg, double** res, int* iw, double* w, int mem) const override; /// Evaluate the function symbolically (SX) void eval_sx(const SXElem** arg, SXElem** res, int* iw, SXElem* w, int mem) const override; /** \brief Propagate sparsity forward */ void sp_fwd(const bvec_t** arg, bvec_t** res, int* iw, bvec_t* w, int mem) const override; /** \brief Propagate sparsity backwards */ void sp_rev(bvec_t** arg, bvec_t** res, int* iw, bvec_t* w, int mem) const override; /** \brief Print expression */ std::string print(const std::vector<std::string>& arg) const override; /** \brief Generate code for the operation */ void generate(CodeGenerator& g, const std::string& mem, const std::vector<int>& arg, const std::vector<int>& res) const override; /** \brief Check if two nodes are equivalent up to a given depth */ bool is_equal(const MXNode* node, int depth) const override; /// Operation sequence std::vector<int> nz_; }; // Specialization of the above when nz_ is a Slice template<bool Add> class CASADI_EXPORT SetNonzerosSlice : public SetNonzeros<Add>{ public: /// Constructor SetNonzerosSlice(const MX& y, const MX& x, const Slice& s) : SetNonzeros<Add>(y, x), s_(s) {} /// Destructor ~SetNonzerosSlice() override {} /// Get all the nonzeros std::vector<int> all() const override { return s_.all(s_.stop);} /// Check if the instance is in fact a simple assignment bool isAssignment() const; /// Simplify void simplifyMe(MX& ex) override; /** \brief Propagate sparsity forward */ void sp_fwd(const bvec_t** arg, bvec_t** res, int* iw, bvec_t* w, int mem) const override; /** \brief Propagate sparsity backwards */ void sp_rev(bvec_t** arg, bvec_t** res, int* iw, bvec_t* w, int mem) const override; /// Evaluate the function (template) template<typename T> void evalGen(const T** arg, T** res, int* iw, T* w, int mem) const; /// Evaluate the function numerically void eval(const double** arg, double** res, int* iw, double* w, int mem) const override; /// Evaluate the function symbolically (SX) void eval_sx(const SXElem** arg, SXElem** res, int* iw, SXElem* w, int mem) const override; /** \brief Print expression */ std::string print(const std::vector<std::string>& arg) const override; /** \brief Generate code for the operation */ void generate(CodeGenerator& g, const std::string& mem, const std::vector<int>& arg, const std::vector<int>& res) const override; /** \brief Check if two nodes are equivalent up to a given depth */ bool is_equal(const MXNode* node, int depth) const override; // Data member Slice s_; }; // Specialization of the above when nz_ is a nested Slice template<bool Add> class CASADI_EXPORT SetNonzerosSlice2 : public SetNonzeros<Add>{ public: /// Constructor SetNonzerosSlice2(const MX& y, const MX& x, const Slice& inner, const Slice& outer) : SetNonzeros<Add>(y, x), inner_(inner), outer_(outer) {} /// Destructor ~SetNonzerosSlice2() override {} /// Get all the nonzeros std::vector<int> all() const override { return inner_.all(outer_, outer_.stop);} /** \brief Propagate sparsity forward */ void sp_fwd(const bvec_t** arg, bvec_t** res, int* iw, bvec_t* w, int mem) const override; /** \brief Propagate sparsity backwards */ void sp_rev(bvec_t** arg, bvec_t** res, int* iw, bvec_t* w, int mem) const override; /// Evaluate the function (template) template<typename T> void evalGen(const T** arg, T** res, int* iw, T* w, int mem) const; /// Evaluate the function numerically void eval(const double** arg, double** res, int* iw, double* w, int mem) const override; /// Evaluate the function symbolically (SX) void eval_sx(const SXElem** arg, SXElem** res, int* iw, SXElem* w, int mem) const override; /** \brief Print expression */ std::string print(const std::vector<std::string>& arg) const override; /** \brief Generate code for the operation */ void generate(CodeGenerator& g, const std::string& mem, const std::vector<int>& arg, const std::vector<int>& res) const override; /** \brief Check if two nodes are equivalent up to a given depth */ bool is_equal(const MXNode* node, int depth) const override; // Data members Slice inner_, outer_; }; } // namespace casadi /// \endcond #endif // CASADI_SETNONZEROS_HPP
andrescodas/casadi
casadi/core/setnonzeros.hpp
C++
lgpl-3.0
7,728
/* * Copyright © 2014, 2015 Jeremy Herbison * * This file is part of PowerShell Audio. * * PowerShell Audio is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser * General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your * option) any later version. * * PowerShell Audio is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public License along with PowerShell Audio. If not, see * <http://www.gnu.org/licenses/>. */ using PowerShellAudio.Extensions.Mp3.Properties; using System.Diagnostics.CodeAnalysis; using System.Diagnostics.Contracts; using System.IO; namespace PowerShellAudio.Extensions.Mp3 { class FrameHeader { [SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", MessageId = "Member", Justification = "Does not waste space")] static readonly int[,] _bitRates = { { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 }, { 0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 }, { 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 }, { 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256 }, { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 } }; [SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", MessageId = "Member", Justification = "Does not waste space")] static readonly int[,] _sampleRates = { { 44100, 48000, 32000 }, { 22050, 24000, 16000 }, { 11025, 12000, 8000 } }; readonly byte[] _headerBytes; internal string MpegVersion { get { Contract.Ensures(!string.IsNullOrEmpty(Contract.Result<string>())); switch ((_headerBytes[1] >> 3) & 0x3) { case 0: return "2.5"; case 2: return "2"; case 3: return "1"; default: throw new UnsupportedAudioException(Resources.FrameHeaderVersionError); } } } internal string Layer { get { Contract.Ensures(!string.IsNullOrEmpty(Contract.Result<string>())); switch ((_headerBytes[1] >> 1) & 0x3) { case 1: return "III"; case 2: return "II"; case 3: return "I"; default: throw new UnsupportedAudioException(Resources.FrameHeaderLayerError); } } } internal bool HasCrc => (_headerBytes[1] & 0x1) == 0; internal int BitRate { get { Contract.Ensures(Contract.Result<int>() >= 0); int column = (_headerBytes[2] >> 4) & 0xf; if (column == 15) throw new IOException(Resources.FrameHeaderBitRateError); int row; if (MpegVersion == "1") switch (Layer) { case "I": row = 0; break; case "II": row = 1; break; default: row = 2; break; } else if (Layer == "I") row = 3; else row = 4; return _bitRates[row, column]; } } internal int SampleRate { get { Contract.Ensures(Contract.Result<int>() > 0); int column = (_headerBytes[2] >> 2) & 0x3; int row; if (column == 3) throw new IOException(Resources.FrameHeaderSampleRateError); switch (MpegVersion) { case "1": row = 0; break; case "2": row = 1; break; default: row = 2; break; } return _sampleRates[row, column]; } } internal int Padding => (_headerBytes[2] >> 1) & 0x1; internal string ChannelMode { get { Contract.Ensures(!string.IsNullOrEmpty(Contract.Result<string>())); switch ((_headerBytes[3] >> 6) & 0x3) { case 0: return "Stereo"; case 1: return "Joint Stereo"; case 2: return "Dual Channel"; default: return "Mono"; } } } internal int SamplesPerFrame { get { if (Layer == "I") return 384; if (Layer == "II" || MpegVersion == "1") return 1152; return 576; } } internal FrameHeader(byte[] headerBytes) { Contract.Requires(headerBytes != null); Contract.Requires(headerBytes.Length == 4); Contract.Ensures(_headerBytes == headerBytes); _headerBytes = headerBytes; } [ContractInvariantMethod] void ObjectInvariant() { Contract.Invariant(_headerBytes != null); Contract.Invariant(_headerBytes.Length == 4); } } }
jherby2k/PowerShellAudio
Extensions/PowerShellAudio.Extensions.Mp3/FrameHeader.cs
C#
lgpl-3.0
6,388
import { css, Theme } from "@emotion/react"; import "@fontsource/roboto/400.css"; import "@fontsource/roboto/500.css"; import "@fontsource/roboto/700.css"; import "@fontsource/roboto/900.css"; export const global = (theme: Theme) => css` * { box-sizing: border-box; } /** Remove this when bootstrap is removed **/ html { scroll-behavior: revert !important; } body, html { margin: 0; padding: 0; font-family: "Roboto", sans-serif; color: ${theme.fontColor.normal}; font-size: 16px; } body { background: ${theme.color.background}; overflow-y: scroll; } a { text-decoration: none; color: inherit; } h1, h2, h3, h4, h5, figure, figcaption, li, ul, ol, blockquote { margin: 0; padding: 0; margin-top: 0px; list-style: none; line-height: initial; } h1 { font-size: 1.8em; } h2 { font-weight: 700; font-size: 1.5em; } h3 { font-size: 1.2em; font-weight: 600; } p { font-size: 1em; } button { padding: 0; margin: 0; border: none; background: none; color: inherit; text-align: inherit; box-sizing: inherit; cursor: pointer; font: inherit; -webkit-appearance: none; -moz-appearance: none; appearance: none; } input, label, select, button, textarea { margin: 0; border: 0; padding: 0; display: inline-block; vertical-align: middle; white-space: normal; background: none; line-height: 1; } `;
Frikanalen/frikanalen
packages/frontend/modules/styling/global.ts
TypeScript
lgpl-3.0
1,543
using System; using System.Collections.Generic; using System.Text.RegularExpressions; namespace Simplify.Web.Routing { /// <summary> /// Provides controller path parser /// </summary> public class ControllerPathParser : IControllerPathParser { /// <summary> /// Parses the specified controller path. /// </summary> /// <param name="controllerPath">The controller path.</param> /// <returns></returns> /// <exception cref="ControllerRouteException"> /// Bad controller path: + controllerPath /// or /// </exception> public IControllerPath Parse(string controllerPath) { var items = controllerPath.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); var pathItems = new List<PathItem>(); foreach (var item in items) { if (item.Contains("{") || item.Contains("}") || item.Contains(":")) { var matches = Regex.Matches(item, @"^{[a-zA-Z0-9:_\-\[\]]+}$"); if (matches.Count == 0) throw new ControllerRouteException("Bad controller path: " + controllerPath); var subitem = item.Substring(1, item.Length - 2); if (subitem.Contains(":")) { var parameterData = subitem.Split(':'); var type = ParseParameterType(parameterData[1]); if (type == null) throw new ControllerRouteException( $"Undefined controller parameter type '{parameterData[1]}', path: {controllerPath}"); pathItems.Add(new PathParameter(parameterData[0], type)); } else pathItems.Add(new PathParameter(subitem, typeof(string))); } else pathItems.Add(new PathSegment(item)); } return new ControllerPath(pathItems); } private static Type ParseParameterType(string typeData) { if (typeData == "int") return typeof(int); if (typeData == "decimal") return typeof(decimal); if (typeData == "bool") return typeof(bool); if (typeData == "[]") return typeof(string[]); if (typeData == "string[]") return typeof(string[]); if (typeData == "int[]") return typeof(int[]); if (typeData == "decimal[]") return typeof(decimal[]); if (typeData == "bool[]") return typeof(bool[]); return null; } } }
i4004/Simplify.Web
src/Simplify.Web/Routing/ControllerPathParser.cs
C#
lgpl-3.0
2,187
package leetcode151withexplain; /** * ±¾ÌâÌâÒ⣺¸ø³öÁ½¸öÕûÊý Çó³ö½á¹û ²»ÄÜÓÃÒÑÓеij˷¨ ³ö·¢ºÍÇóÓຯÊý * * */ public class DivideTwoIntegers123 { public int divide(int dividend, int divisor) { long a = (long)Math.abs((long)dividend); long b = (long)Math.abs((long)divisor); long res = 0; while(a >= b) { long c = b; //through << to accelate the caluation //cÿһÂÖ×óÒÆÒ»Î» ¾Í´ú±í³ËÒÔ2,ÄÇôÕâÀïÃæ¾Í°üº¬ÁË1<<i¸öb for(int i = 0; a >= c; i++, c <<=1) { a -= c; res += 1<<i; } } //¾ö¶¨Õý¸ººÅ boolean positiveOrNot = true; if(dividend > 0 && divisor < 0) positiveOrNot = false; if(dividend < 0 && divisor > 0) positiveOrNot = false; return positiveOrNot == true ? (int)(res) : (int)(-res); } }
hy2708/hy2708-repository
java/commons/commons-algorithm/src/main/java/com/hy/commons/algorithm/leetcode/e/DivideTwoIntegers123.java
Java
lgpl-3.0
978
/****************************************************************************** * * Project: ConverterPIX @ Core * File: /prefab/curve.h * * _____ _ _____ _______ __ * / ____| | | | __ \_ _\ \ / / * | | ___ _ ____ _____ _ __| |_ ___ _ __| |__) || | \ V / * | | / _ \| '_ \ \ / / _ \ '__| __/ _ \ '__| ___/ | | > < * | |___| (_) | | | \ V / __/ | | || __/ | | | _| |_ / . \ * \_____\___/|_| |_|\_/ \___|_| \__\___|_| |_| |_____/_/ \_\ * * * Copyright (C) 2017 Michal Wojtowicz. * All rights reserved. * * This software is ditributed WITHOUT ANY WARRANTY; without even * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the copyright file for more information. * *****************************************************************************/ #pragma once #include <math/vector.h> #include <math/quaternion.h> class Curve { private: String m_name; u32 m_flags; u32 m_leadsToNodes; Float3 m_startPosition; Quaternion m_startRotation; Float3 m_endPosition; Quaternion m_endRotation; float m_length; i32 m_nextLines[4]; i32 m_prevLines[4]; u32 m_nextLinesCount; u32 m_prevLinesCount; i32 m_semaphoreId; String m_trafficRule; friend Prefab; }; /* eof */
mwl4/ConverterPIX
src/prefab/curve.h
C
lgpl-3.0
1,346
/** * @file old_boost_test_definitions.hpp * @author Ryan Curtin * * Ancient Boost.Test versions don't act how we expect. This file includes the * things we need to fix that. * * This file is part of MLPACK 1.0.10. * * MLPACK is free software: you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) any * later version. * * MLPACK is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details (LICENSE.txt). * * You should have received a copy of the GNU General Public License along with * MLPACK. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __MLPACK_TESTS_OLD_BOOST_TEST_DEFINITIONS_HPP #define __MLPACK_TESTS_OLD_BOOST_TEST_DEFINITIONS_HPP #include <boost/version.hpp> // This is only necessary for pre-1.36 Boost.Test. #if BOOST_VERSION < 103600 #include <boost/test/floating_point_comparison.hpp> #include <boost/test/auto_unit_test.hpp> // This depends on other macros. Probably not a great idea... but it works, and // we only need it for ancient Boost versions. #define BOOST_REQUIRE_GE( L, R ) \ BOOST_REQUIRE_EQUAL( (L >= R), true ) #define BOOST_REQUIRE_NE( L, R ) \ BOOST_REQUIRE_EQUAL( (L != R), true ) #define BOOST_REQUIRE_LE( L, R ) \ BOOST_REQUIRE_EQUAL( (L <= R), true ) #define BOOST_REQUIRE_LT( L, R ) \ BOOST_REQUIRE_EQUAL( (L < R), true ) #define BOOST_REQUIRE_GT( L, R ) \ BOOST_REQUIRE_EQUAL( (L > R), true ) #endif #endif
biotrump/mlpack
src/mlpack/tests/old_boost_test_definitions.hpp
C++
lgpl-3.0
1,729
package net.kyau.darkmatter.items; import java.util.List; import org.lwjgl.input.Keyboard; import net.kyau.darkmatter.DarkMatterMod; import net.kyau.darkmatter.dimension.TeleporterVoid; import net.kyau.darkmatter.references.ModInfo; import net.kyau.darkmatter.references.Ref; import net.kyau.darkmatter.registry.ModSounds; import net.kyau.darkmatter.sound.SoundHelper; import net.kyau.darkmatter.utils.ChatUtil; import net.kyau.darkmatter.utils.ItemHelper; import net.kyau.darkmatter.utils.LogHelper; import net.kyau.darkmatter.utils.NBTHelper; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; import net.minecraft.init.SoundEvents; import net.minecraft.item.EnumAction; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class VoidPearl extends BaseItem { public static int cooldown = Ref.ItemCooldown.VOIDPEARL; public VoidPearl() { super(); //this.setUnlocalizedName(Ref.ItemID.VOIDPEARL); setCreativeTab(DarkMatterMod.DarkMatterTab); } @Override public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.NONE; } @Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { boolean firstUse = false; ItemStack stack = player.getHeldItem(hand); NBTTagCompound playerNBT = player.getEntityData(); // Set an Owner, if one doesn't exist already if (!ItemHelper.hasOwnerUUID(stack)) { ItemHelper.setOwner(stack, player); if (!world.isRemote) ChatUtil.sendNoSpam(player, new TextComponentTranslation(Ref.Translation.IMPRINT_SUCCESS)); firstUse = true; } // Set a UUID, if one doesn't exist already if (!NBTHelper.hasUUID(stack)) { NBTHelper.setUUID(stack); } // Set a LastUse, if one doesn't exist already if (!playerNBT.hasKey(Ref.NBT.LASTUSE)) { playerNBT.setLong(Ref.NBT.LASTUSE, player.world.getTotalWorldTime() - (cooldown + 10)); } // if (!NBTHelper.hasTag(stack, Ref.NBT.LASTUSE)) { // NBTHelper.setLastUse(stack, player.worldObj.getTotalWorldTime() - (cooldown + 10)); // } if (firstUse) return new ActionResult<ItemStack>(EnumActionResult.PASS, stack); final String owner = ItemHelper.getOwnerName(stack); // invalid ownership if (!owner.equals(player.getDisplayNameString())) { ChatUtil.sendNoSpam(player, Ref.Translation.IMPRINT_SCAN_FAILED); if (!world.isRemote) { SoundHelper.playSound(world, player, ModSounds.ERROR, 0.5F, 1.0F); } return new ActionResult<ItemStack>(EnumActionResult.FAIL, stack); } DimensionManager dm = new DimensionManager(); World overworld = dm.getWorld(0); //PlayerProperties props = PlayerProperties.get(player); //long currentTime = player.world.getTotalWorldTime(); //long lastUse = props.getCooldown(); //long lastUse = 0; //long ticksSinceLastUse = currentTime - lastUse; //if (ModInfo.DEBUG) //LogHelper.info("> DEBUG: ticksSinceLastUse: " + ticksSinceLastUse + "." + cooldown); //if (ticksSinceLastUse > cooldown || ticksSinceLastUse < 0) { // Get the Overworld world object BlockPos playerHome = player.getBedLocation(0); boolean spawnpoint = false; // If player has no bed, set the destination to server spawn if (playerHome == null) { spawnpoint = true; if (!world.isRemote) { playerHome = overworld.getSpawnPoint(); } else { playerHome = player.world.getSpawnPoint(); } } if (!world.isRemote) { IBlockState state = overworld.getBlockState(playerHome); Block block = (state == null) ? null : overworld.getBlockState(playerHome).getBlock(); if (block != null && !spawnpoint) { if (block.equals(Blocks.BED) || block.isBed(state, overworld, playerHome, player)) { // Reposition player according to where bed wants the player to spawn playerHome = block.getBedSpawnPosition(state, overworld, playerHome, null); } else { player.sendMessage(new TextComponentTranslation("Your bed was missing or obstructed.")); return new ActionResult<ItemStack>(EnumActionResult.FAIL, stack); } } else if (block == null) { player.sendMessage(new TextComponentTranslation(TextFormatting.RED + "ERROR: No spawn or bed location found!")); return new ActionResult<ItemStack>(EnumActionResult.FAIL, stack); } // Trigger cooldown and send client packet long time = overworld.getTotalWorldTime(); //props.setCooldown(time); // Destination exists, teleport the player EntityPlayerMP playerMP = (EntityPlayerMP) player; // Make sure destination is clean while (overworld.getBlockState(playerHome).getBlock().isOpaqueCube(state)) playerHome = playerHome.up(2); // Issue teleport if (!(playerMP.dimension == 1)) { if (playerMP.dimension != 0) { world.getMinecraftServer().getPlayerList().transferPlayerToDimension(playerMP, 0, new TeleporterVoid(playerMP.mcServer.worldServerForDimension(0))); } player.setPositionAndUpdate(playerHome.getX(), playerHome.getY(), playerHome.getZ()); player.fallDistance = 0F; //MinecraftServer.getServer().worldServerForDimension(playerMP.dimension).playSoundEffect(player.posX, player.posY, player.posZ, "mob.endermen.portal", 1.0F, 1.0F); SoundHelper.playSound(world, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.HOSTILE, 1.0F, 1.0F); } } return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack); /* } else { if (player.dimension == 1 && owner.equals(player.getDisplayNameString())) { SoundHelper.playSound(world, player, ModSounds.ERROR, 0.5F, 1.0F); } else if (ticksSinceLastUse > 0 && ticksSinceLastUse < cooldown) { SoundHelper.playSound(world, player, ModSounds.ERROR, 0.5F, 1.0F); } } return new ActionResult<ItemStack>(EnumActionResult.FAIL, stack); */ } @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) { // Item Stats if (!ItemHelper.hasOwner(stack)) { tooltip.add(I18n.format(Ref.Translation.PREIMPRINT)); } // Description if (Keyboard.isKeyDown(0x2A) || Keyboard.isKeyDown(0x36)) { tooltip.add(TextFormatting.GRAY + "This device may be used to transport"); tooltip.add(TextFormatting.GRAY + "you across dimensions to your home."); } else { tooltip.add(I18n.format(Ref.Translation.MORE_INFORMATION)); } // Owner information if (ItemHelper.hasOwner(stack)) { final String owner = ItemHelper.getOwnerName(stack); if (owner.equals(player.getDisplayNameString())) { tooltip.add(TextFormatting.GREEN + I18n.format(Ref.Translation.OWNER) + " " + owner); /* long lastUse = DarkMatterMod.proxy.getVoidPearlLastUse(); if (lastUse != -1) { long currentTime = player.world.getTotalWorldTime(); long ticksSinceLastUse = currentTime - lastUse; // LogHelper.info("Worldtime: " + currentTime + " / Last Use: " + lastUse); if (ticksSinceLastUse < cooldown) { long current = (cooldown / 20) - (ticksSinceLastUse / 20); String currentCooldown = ItemHelper.formatCooldown(current); tooltip.add(I18n.format(Ref.Translation.COOLDOWN) + " " + currentCooldown); } } */ } else { if (ModInfo.DEBUG) { tooltip.add(TextFormatting.RED + I18n.format(Ref.Translation.OWNER) + " " + owner); } else { tooltip.add(TextFormatting.RED + I18n.format(Ref.Translation.OWNER) + " " + TextFormatting.OBFUSCATED + owner); } } } super.addInformation(stack, player, tooltip, advanced); } }
kyau/darkmatter
src/main/java/net/kyau/darkmatter/items/VoidPearl.java
Java
lgpl-3.0
8,733
package nth.reflect.fw.ui.commandline.domain.command; import java.io.File; import java.net.URI; import java.net.URL; import java.text.Format; import java.util.Date; import java.util.Map; import nth.reflect.fw.layer5provider.reflection.info.property.PropertyInfo; public class Parameter { private final PropertyInfo propertyInfo; private final Class<?> type; private final Map<Class<?>, String> types; public Parameter(PropertyInfo propertyInfo) throws ReflectCommandLineException { this.propertyInfo = propertyInfo; type = propertyInfo.getTypeInfo().getType(); types = CommandService.getSupportedParameterPropertyTypes(); if (!types.containsKey(type)) { throw new ReflectCommandLineException("Property type " + type.getCanonicalName() + " is not supported for property " + propertyInfo.getSimpleName()); } } public String getName() { return propertyInfo.getSimpleName(); } public String getDescription() { StringBuffer description = new StringBuffer(); description.append("("); description.append(types.get(type)); description.append(") "); description.append(propertyInfo.getDescription()); return description.toString(); } public String getUsage() { StringBuffer usage = new StringBuffer(); if (type.isAssignableFrom(String.class) || type.isAssignableFrom(File.class) || type.isAssignableFrom(Date.class) || type.isAssignableFrom(URI.class) || type.isAssignableFrom(URL.class)) { usage.append("\"<"); usage.append(propertyInfo.getSimpleName()); usage.append(">\""); } else { usage.append("<"); usage.append(propertyInfo.getSimpleName()); usage.append(">"); } return usage.toString(); } /** * * @param parameter * value of a service object method which is about to be invoked * @param argument * command line argument that needs to be parsed to a parameter * property * @throws ReflectCommandLineException */ public void parseArgument(Object parameter, String argument) throws ReflectCommandLineException { try { if (propertyInfo.getTypeInfo().getType() == File.class) { File file = new File(argument); propertyInfo.setValue(parameter, file); } else { Format format = propertyInfo.getFormat(); Object value = format.parseObject(argument); propertyInfo.setValue(parameter, value); } } catch (Throwable e) { throw new ReflectCommandLineException("Could not parse '" + argument + "' to a '" + type.getName() + "' for property " + propertyInfo.getSimpleName()); } } }
ntenhoeve/Introspect-Framework
reflect/reflect-for-commandline/src/main/java/nth/reflect/fw/ui/commandline/domain/command/Parameter.java
Java
lgpl-3.0
2,634
/* Copyright 2013-2021 Paul Colby This file is part of QtAws. QtAws is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. QtAws is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the QtAws. If not, see <http://www.gnu.org/licenses/>. */ #ifndef QTAWS_GETAGGREGATECONFORMANCEPACKCOMPLIANCESUMMARYRESPONSE_P_H #define QTAWS_GETAGGREGATECONFORMANCEPACKCOMPLIANCESUMMARYRESPONSE_P_H #include "configserviceresponse_p.h" namespace QtAws { namespace ConfigService { class GetAggregateConformancePackComplianceSummaryResponse; class GetAggregateConformancePackComplianceSummaryResponsePrivate : public ConfigServiceResponsePrivate { public: explicit GetAggregateConformancePackComplianceSummaryResponsePrivate(GetAggregateConformancePackComplianceSummaryResponse * const q); void parseGetAggregateConformancePackComplianceSummaryResponse(QXmlStreamReader &xml); private: Q_DECLARE_PUBLIC(GetAggregateConformancePackComplianceSummaryResponse) Q_DISABLE_COPY(GetAggregateConformancePackComplianceSummaryResponsePrivate) }; } // namespace ConfigService } // namespace QtAws #endif
pcolby/libqtaws
src/configservice/getaggregateconformancepackcompliancesummaryresponse_p.h
C
lgpl-3.0
1,593
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2010.06.10 at 04:19:23 PM CEST // package nl.b3p.csw.jaxb.filter; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for ComparisonOpsType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="ComparisonOpsType"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ComparisonOpsType") @XmlSeeAlso({ BinaryComparisonOpType.class, PropertyIsLikeType.class, PropertyIsBetweenType.class, PropertyIsNullType.class }) public abstract class ComparisonOpsType { /** * Default no-arg constructor * */ public ComparisonOpsType() { super(); } }
B3Partners/b3p-commons-csw
src/main/java/nl/b3p/csw/jaxb/filter/ComparisonOpsType.java
Java
lgpl-3.0
1,359
/* * Demoiselle Framework * Copyright (C) 2016 SERPRO * ---------------------------------------------------------------------------- * This file is part of Demoiselle Framework. * * Demoiselle Framework is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License version 3 * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License version 3 * along with this program; if not, see <http://www.gnu.org/licenses/> * or write to the Free Software Foundation, Inc., 51 Franklin Street, * Fifth Floor, Boston, MA 02110-1301, USA. * ---------------------------------------------------------------------------- * Este arquivo é parte do Framework Demoiselle. * * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação * do Software Livre (FSF). * * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português * para maiores detalhes. * * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> * ou escreva para a Fundação do Software Livre (FSF) Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. */ package org.demoiselle.signer.policy.impl.cades; import java.util.List; /** * Basic specification for implementation of digital signatures in CADES format. */ public interface Checker { /** * Check a digital signature with attached content, informed by parameter signedData * * @param signedData attached signature to be checked * @return List&lt;SignatureInformations&gt; list of signature information */ List<SignatureInformations> checkAttachedSignature(byte[] signedData); /** * Check an digital detached signature, informed by parameter signedData and it's content * * @param content content to be checked * @param signedData detached signature * @return List&lt;SignatureInformations&gt; list of signature information */ List<SignatureInformations> checkDetachedSignature(byte[] content, byte[] signedData); /** * Check a digital detached signature, informed by parameter signedData, based on calculated hash from content * * @param digestAlgorithmOID OID of algorithm used to calculate a hash from content (ex: 2.16.840.1.101.3.4.2.1 ) * @param calculatedHashContent calculated hash * @param signedData detached signature * @return List&lt;SignatureInformation&gt; list of signature information */ List<SignatureInformations> checkSignatureByHash(String digestAlgorithmOID, byte[] calculatedHashContent, byte[] signedData); }
demoiselle/signer
policy-impl-cades/src/main/java/org/demoiselle/signer/policy/impl/cades/Checker.java
Java
lgpl-3.0
3,211
# RABDAM # Copyright (C) 2020 Garman Group, University of Oxford # This file is part of RABDAM. # RABDAM is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation, either version 3 of # the License, or (at your option) any later version. # RABDAM is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General # Public License along with this program. If not, see # <http://www.gnu.org/licenses/>. # An outer layer to the pipeline scripts. Depending upon the flags specified # in the command line input, this script will run either the complete / a # subsection of the pipeline. # python -m unittest tests/test_bnet_calculation.py import os import unittest from rabdam.Subroutines.CalculateBDamage import rabdam class TestClass(unittest.TestCase): def test_bnet_values(self): """ Checks that RABDAM calculates expected Bnet values for a selection of PDB entries """ import os import requests import shutil import pandas as pd exp_bnet_dict = {'2O2X': 3.300580966, '4EZF': 3.193514624, '4MWU': 3.185476349, '4MOV': 3.144130191, '3NBM': 3.141821366, '1GW1': 3.105626889, '4EWE': 3.08241654, '3F1P': 3.060628186, '3IV0': 3.054440912, '4ZWV': 3.017330004, '1T2I': 3.004830448, '3LX3': 2.962424378, '5P4N': 2.916582486, '5MAA': 2.91219352, '1E73': 2.850203561, '1YKI': 2.797739814, '4WA4': 2.720540993, '3V2J': 2.669599635, '3CUI': 2.666605946, '4XLA': 2.624366813, '4DUK': 2.854175949, '3V38': 2.500984382, '1VJF': 2.496374854, '5IO2': 2.467587911, '5CM7': 2.44869046, '2EHU': 2.448290431, '5JOW': 2.439619791, '2C54': 2.379224017, '4GZK': 2.349526276, '2NUM': 2.326904729, '5FYO': 2.319618192, '4ODK': 2.304354685, '6EV4': 2.302433369, '5P5U': 2.288966997, '3VHV': 2.285877338, '4JCK': 2.27150332, '5EKM': 2.258574341, '3H4O': 2.231817033, '5JIG': 2.247664542, '2H5S': 2.206850226, '4M5I': 2.169405117, '1Y59': 2.138787261, '4C45': 2.131256276, '5F90': 2.11287042, '4NI3': 2.088735516, '4Z6N': 2.083743584, '5M2G': 2.06566475, '5ER6': 2.05707889, '4R0X': 2.006996308, '5LLG': 1.981501196, '1FCX': 1.976990791, '5M90': 1.96542442, '3NJK': 1.955577757, '5CWG': 1.949818624, '2P7O': 1.921138477, '5SZC': 1.962633169, '2I0K': 1.901555841, '4RDK': 1.886900766, '5MA0': 1.877853781, '4C1E': 1.877575448, '5EJ3': 1.875439995, '2WUG': 1.87334953, '4MPY': 1.842338963, '4OTZ': 1.835716553, '4IOO': 1.828349113, '4Z6O': 1.800528596, '4ZOT': 1.799163077, '5PHB': 1.783879628, '3UJC': 1.747894856, '4FR8': 1.738876799, '5PH8': 1.736825591, '5UPM': 1.736663507, '3MWX': 1.733132746, '4KDX': 1.729650659, '3WH5': 1.717975404, '4P04': 1.714107945, '5Y90': 1.695283923, '4H31': 1.674014779, '5HJE': 1.662869176, '4YKK': 1.653894709, '1Q0F': 1.646880018, '5JP6': 1.629246723, '1X7Y': 1.618817315, '4ZC8': 1.60606196, '5EPE': 1.604407869, '4ZS9': 1.582398487, '5VNX': 1.543824945, '5IHV': 1.542271159, '5J90': 1.526469901, '4K6W': 1.520316883, '3PBC': 1.512738972, '5CMB': 1.504620762, '4PSC': 1.491796934, '5UPN': 1.477252783, '4XLZ': 1.473298738, '4XGY': 1.465885549, '5M4G': 1.400219288, '3A54': 1.319587779} if not os.path.isdir('tests/temp_files/'): os.mkdir('tests/temp_files/') for code, exp_bnet in exp_bnet_dict.items(): # Checks cif file cif_text = requests.get('https://files.rcsb.org/view/%s.cif' % code) with open('tests/temp_files/%s.cif' % code, 'w') as f: f.write(cif_text.text) rabdam_run = rabdam( pathToInput='%s/tests/temp_files/%s.cif' % (os.getcwd(), code), outputDir='%s/tests/temp_files/' % os.getcwd(), batchRun=True, overwrite=True, PDT=7, windowSize=0.02, protOrNA='protein', HETATM=False, removeAtoms=[], addAtoms=[], highlightAtoms=[], createOrigpdb=False, createAUpdb=False, createUCpdb=False, createAUCpdb=False, createTApdb=False ) rabdam_run.rabdam_dataframe(test=True) rabdam_run.rabdam_analysis( output_options=['csv', 'pdb', 'cif', 'kde', 'bnet', 'summary'] ) bnet_df = pd.read_pickle('tests/temp_files/Logfiles/Bnet_protein.pkl') act_bnet_cif = bnet_df['Bnet'].tolist()[-1] self.assertEqual(round(exp_bnet, 7), round(act_bnet_cif, 7)) os.remove('tests/temp_files/%s.cif' % code) os.remove('tests/temp_files/Logfiles/Bnet_protein.pkl') # Checks PDB file pdb_text = requests.get('https://files.rcsb.org/view/%s.pdb' % code) with open('tests/temp_files/%s.pdb' % code, 'w') as f: f.write(pdb_text.text) rabdam_run = rabdam( pathToInput='%s/tests/temp_files/%s.pdb' % (os.getcwd(), code), outputDir='%s/tests/temp_files/' % os.getcwd(), batchRun=True, overwrite=True, PDT=7, windowSize=0.02, protOrNA='protein', HETATM=False, removeAtoms=[], addAtoms=[], highlightAtoms=[], createOrigpdb=False, createAUpdb=False, createUCpdb=False, createAUCpdb=False, createTApdb=False ) rabdam_run.rabdam_dataframe(test=True) rabdam_run.rabdam_analysis( output_options=['csv', 'pdb', 'cif', 'kde', 'bnet', 'summary'] ) bnet_df = pd.read_pickle( '%s/tests/temp_files/Logfiles/Bnet_protein.pkl' % os.getcwd() ) act_bnet_pdb = bnet_df['Bnet'].tolist()[-1] self.assertEqual(round(exp_bnet, 7), round(act_bnet_pdb, 7)) os.remove('tests/temp_files/%s.pdb' % code) os.remove('tests/temp_files/Logfiles/Bnet_protein.pkl') shutil.rmtree('tests/temp_files/')
GarmanGroup/RABDAM
tests/test_bnet_calculation.py
Python
lgpl-3.0
8,856
<?php {include "../includes/header.php"} namespace {$moduleCode}\Controller; use {$moduleCode}\Controller\Base\{$moduleCode}ConfigController as Base{$moduleCode}ConfigController; /** * Class {$moduleCode}ConfigController * @package {$moduleCode}\Controller */ class {$moduleCode}ConfigController extends Base{$moduleCode}ConfigController { }
fluppi/dotto-project
local/modules/TheliaStudio/Resources/Controller/__CONFIG_FORM__ConfigControllerFIX.php
PHP
lgpl-3.0
348
#include <iostream> #include "../global/templates.hpp" using std::cout; using std::cin; using std::endl; using algo4j_util::Pair; auto main(int argc, const char *argv[]) -> int { auto pair = *new Pair<int, int>(233, 666); cout << pair << endl; cin >> pair; cout << pair << endl; return 0; }
ice1000/algo4j
jni/cpp-test/pair_test.cpp
C++
lgpl-3.0
299
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_24) on Thu Feb 09 13:37:56 GMT 2012 --> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE> Uses of Class gate.util.AnnotationDiffer (GATE JavaDoc) </TITLE> <META NAME="date" CONTENT="2012-02-09"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class gate.util.AnnotationDiffer (GATE JavaDoc)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?gate/util//class-useAnnotationDiffer.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="AnnotationDiffer.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>Uses of Class<br>gate.util.AnnotationDiffer</B></H2> </CENTER> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Packages that use <A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util">AnnotationDiffer</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#gate.gui"><B>gate.gui</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#gate.util"><B>gate.util</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <A NAME="gate.gui"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Uses of <A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util">AnnotationDiffer</A> in <A HREF="../../../gate/gui/package-summary.html">gate.gui</A></FONT></TH> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Fields in <A HREF="../../../gate/gui/package-summary.html">gate.gui</A> declared as <A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util">AnnotationDiffer</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected &nbsp;<A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util">AnnotationDiffer</A></CODE></FONT></TD> <TD><CODE><B>AnnotationDiffGUI.</B><B><A HREF="../../../gate/gui/AnnotationDiffGUI.html#differ">differ</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Fields in <A HREF="../../../gate/gui/package-summary.html">gate.gui</A> with type parameters of type <A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util">AnnotationDiffer</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected &nbsp;<A HREF="http://docs.oracle.com/javase/6/docs/api/java/util/ArrayList.html?is-external=true" title="class or interface in java.util">ArrayList</A>&lt;<A HREF="http://docs.oracle.com/javase/6/docs/api/java/util/HashMap.html?is-external=true" title="class or interface in java.util">HashMap</A>&lt;<A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>,<A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util">AnnotationDiffer</A>&gt;&gt;</CODE></FONT></TD> <TD><CODE><B>CorpusQualityAssurance.</B><B><A HREF="../../../gate/gui/CorpusQualityAssurance.html#differsByDocThenType">differsByDocThenType</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ordered by document as in the <code>corpus</code> then contains (annotation type * AnnotationDiffer)</TD> </TR> </TABLE> &nbsp; <P> <A NAME="gate.util"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Uses of <A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util">AnnotationDiffer</A> in <A HREF="../../../gate/util/package-summary.html">gate.util</A></FONT></TH> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Fields in <A HREF="../../../gate/util/package-summary.html">gate.util</A> with type parameters of type <A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util">AnnotationDiffer</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected &nbsp;<A HREF="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A>&lt;<A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>,<A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util">AnnotationDiffer</A>&gt;</CODE></FONT></TD> <TD><CODE><B>OntologyMeasures.</B><B><A HREF="../../../gate/util/OntologyMeasures.html#differByTypeMap">differByTypeMap</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../gate/util/package-summary.html">gate.util</A> that return <A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util">AnnotationDiffer</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected &nbsp;<A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util">AnnotationDiffer</A></CODE></FONT></TD> <TD><CODE><B>CorpusBenchmarkTool.</B><B><A HREF="../../../gate/util/CorpusBenchmarkTool.html#measureDocs(gate.Document, gate.Document, java.lang.String)">measureDocs</A></B>(<A HREF="../../../gate/Document.html" title="interface in gate">Document</A>&nbsp;keyDoc, <A HREF="../../../gate/Document.html" title="interface in gate">Document</A>&nbsp;respDoc, <A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;annotType)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../gate/util/package-summary.html">gate.util</A> that return types with arguments of type <A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util">AnnotationDiffer</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A>&lt;<A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>,<A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util">AnnotationDiffer</A>&gt;</CODE></FONT></TD> <TD><CODE><B>OntologyMeasures.</B><B><A HREF="../../../gate/util/OntologyMeasures.html#getDifferByTypeMap()">getDifferByTypeMap</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Be careful, don't modify it.</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../gate/util/package-summary.html">gate.util</A> with parameters of type <A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util">AnnotationDiffer</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected &nbsp;void</CODE></FONT></TD> <TD><CODE><B>CorpusBenchmarkTool.</B><B><A HREF="../../../gate/util/CorpusBenchmarkTool.html#printAnnotations(gate.util.AnnotationDiffer, gate.Document, gate.Document)">printAnnotations</A></B>(<A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util">AnnotationDiffer</A>&nbsp;annotDiff, <A HREF="../../../gate/Document.html" title="interface in gate">Document</A>&nbsp;keyDoc, <A HREF="../../../gate/Document.html" title="interface in gate">Document</A>&nbsp;respDoc)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected &nbsp;void</CODE></FONT></TD> <TD><CODE><B>CorpusBenchmarkTool.</B><B><A HREF="../../../gate/util/CorpusBenchmarkTool.html#storeAnnotations(java.lang.String, gate.util.AnnotationDiffer, gate.Document, gate.Document, java.io.Writer)">storeAnnotations</A></B>(<A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;type, <A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util">AnnotationDiffer</A>&nbsp;annotDiffer, <A HREF="../../../gate/Document.html" title="interface in gate">Document</A>&nbsp;keyDoc, <A HREF="../../../gate/Document.html" title="interface in gate">Document</A>&nbsp;respDoc, <A HREF="http://docs.oracle.com/javase/6/docs/api/java/io/Writer.html?is-external=true" title="class or interface in java.io">Writer</A>&nbsp;errFileWriter)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected &nbsp;void</CODE></FONT></TD> <TD><CODE><B>CorpusBenchmarkTool.</B><B><A HREF="../../../gate/util/CorpusBenchmarkTool.html#updateStatistics(gate.util.AnnotationDiffer, java.lang.String)">updateStatistics</A></B>(<A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util">AnnotationDiffer</A>&nbsp;annotDiffer, <A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;annotType)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected &nbsp;void</CODE></FONT></TD> <TD><CODE><B>CorpusBenchmarkTool.</B><B><A HREF="../../../gate/util/CorpusBenchmarkTool.html#updateStatisticsProc(gate.util.AnnotationDiffer, java.lang.String)">updateStatisticsProc</A></B>(<A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util">AnnotationDiffer</A>&nbsp;annotDiffer, <A HREF="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;annotType)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Update statistics for processed documents The same procedure as updateStatistics with different hashTables</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Method parameters in <A HREF="../../../gate/util/package-summary.html">gate.util</A> with type arguments of type <A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util">AnnotationDiffer</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B>OntologyMeasures.</B><B><A HREF="../../../gate/util/OntologyMeasures.html#calculateBdm(java.util.Collection)">calculateBdm</A></B>(<A HREF="http://docs.oracle.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A>&lt;<A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util">AnnotationDiffer</A>&gt;&nbsp;differs)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;For a document get the annotation differs that contain the type to compare and the annotation differs that may have miscategorized annotations for this type.</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Constructor parameters in <A HREF="../../../gate/util/package-summary.html">gate.util</A> with type arguments of type <A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util">AnnotationDiffer</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../gate/util/AnnotationDiffer.html#AnnotationDiffer(java.util.Collection)">AnnotationDiffer</A></B>(<A HREF="http://docs.oracle.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A>&lt;<A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util">AnnotationDiffer</A>&gt;&nbsp;differs)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructor to be used when you have a collection of AnnotationDiffer and want to consider it as only one AnnotationDiffer.</TD> </TR> </TABLE> &nbsp; <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../gate/util/AnnotationDiffer.html" title="class in gate.util"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?gate/util//class-useAnnotationDiffer.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="AnnotationDiffer.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>
liuhongchao/GATE_Developer_7.0
doc/javadoc/gate/util/class-use/AnnotationDiffer.html
HTML
lgpl-3.0
19,205
#include "Project.hpp" #include "Buffer.hpp" #include "Configuration.hpp" #include "CoordinateSystem.hpp" #include "Field.hpp" #include "Helpers.hpp" #include "Manifold.hpp" #include "Parameter.hpp" #include "ParameterValue.hpp" #include "TangentSpace.hpp" #include "TensorType.hpp" #ifdef SIMULATIONIO_HAVE_HDF5 #include "H5Helpers.hpp" #endif #include <algorithm> #include <cstddef> #include <cstdlib> #include <fstream> #include <functional> #include <iomanip> #include <map> #include <sstream> #include <string> #include <vector> namespace SimulationIO { using std::ifstream; using std::ios; using std::max; using std::min; using std::ofstream; using std::ostringstream; using std::string; using std::vector; shared_ptr<Project> createProject(const string &name) { auto project = Project::create(name); assert(project->invariant()); return project; } #ifdef SIMULATIONIO_HAVE_HDF5 shared_ptr<Project> readProject(const H5::H5Location &loc, const string &filename) { auto project = Project::create(loc, filename); assert(project->invariant()); return project; } shared_ptr<Project> readProjectHDF5(const string &filename) { auto file = H5::H5File(filename, H5F_ACC_RDONLY); return readProject(file, filename); } #endif #ifdef SIMULATIONIO_HAVE_ASDF_CXX shared_ptr<Project> readProject(const shared_ptr<ASDF::reader_state> &rs, const YAML::Node &node) { auto project = Project::create(rs, node); assert(project->invariant()); return project; } map<string, shared_ptr<Project>> readProjectsASDF(const shared_ptr<istream> &pis, const string &filename) { map<string, shared_ptr<Project>> projects; function<void(const shared_ptr<ASDF::reader_state> &rs, const string &name, const YAML::Node &node)> read_project{[&](const shared_ptr<ASDF::reader_state> &rs, const string &name, const YAML::Node &node) { projects[name] = readProject(rs, node); }}; map<string, function<void(const shared_ptr<ASDF::reader_state> &rs, const string &name, const YAML::Node &node)>> readers{{"tag:github.com/eschnett/SimulationIO/asdf-cxx/Project-1.0.0", read_project}}; auto doc = ASDF::asdf(pis, filename, readers); return projects; } map<string, shared_ptr<Project>> readProjectsASDF(const string &filename) { auto pis = make_shared<ifstream>(filename, ios::binary | ios::in); return readProjectsASDF(pis, filename); } shared_ptr<Project> readProjectASDF(const shared_ptr<istream> &pis, const string &filename) { auto projects = readProjectsASDF(pis, filename); assert(projects.size() == 1); return projects.begin()->second; } shared_ptr<Project> readProjectASDF(const string &filename) { auto pis = make_shared<ifstream>(filename, ios::binary | ios::in); return readProjectASDF(pis, filename); } #endif bool Project::invariant() const { return Common::invariant(); } #ifdef SIMULATIONIO_HAVE_HDF5 void Project::read(const H5::H5Location &loc, const string &filename) { auto group = loc.openGroup("."); createTypes(); // TODO: read from file instead to ensure integer constants are // consistent assert(H5::readAttribute<string>(group, "type", enumtype) == "Project"); H5::readAttribute(group, "name", m_name); H5::readGroup(group, "parameters", [&](const H5::Group &group, const string &name) { readParameter(group, name); }); H5::readGroup(group, "configurations", [&](const H5::Group &group, const string &name) { readConfiguration(group, name); }); H5::readGroup(group, "tensortypes", [&](const H5::Group &group, const string &name) { readTensorType(group, name); }); H5::readGroup(group, "manifolds", [&](const H5::Group &group, const string &name) { readManifold(group, name); }); H5::readGroup(group, "tangentspaces", [&](const H5::Group &group, const string &name) { readTangentSpace(group, name); }); H5::readGroup(group, "fields", [&](const H5::Group &group, const string &name) { readField(group, name); }); H5::readGroup(group, "coordinatesystems", [&](const H5::Group &group, const string &name) { readCoordinateSystem(group, name); }); } #endif #ifdef SIMULATIONIO_HAVE_ASDF_CXX void Project::read(const shared_ptr<ASDF::reader_state> &rs, const YAML::Node &node) { createTypes(); // TODO: read from file instead to ensure integer constants are // consistent assert(node.Tag() == "tag:github.com/eschnett/SimulationIO/asdf-cxx/Project-1.0.0"); m_name = node["name"].Scalar(); for (const auto &kv : node["parameters"]) readParameter(rs, kv.second); for (const auto &kv : node["configurations"]) readConfiguration(rs, kv.second); for (const auto &kv : node["tensortypes"]) readTensorType(rs, kv.second); for (const auto &kv : node["manifolds"]) readManifold(rs, kv.second); for (const auto &kv : node["tangentspaces"]) readTangentSpace(rs, kv.second); for (const auto &kv : node["fields"]) readField(rs, kv.second); for (const auto &kv : node["coordinatesystems"]) readCoordinateSystem(rs, kv.second); } #endif void Project::merge(const shared_ptr<Project> &project) { // TODO: combine types for (const auto &iter : project->parameters()) { const auto &parameter = iter.second; if (!m_parameters.count(parameter->name())) createParameter(parameter->name()); m_parameters.at(parameter->name())->merge(parameter); } for (const auto &iter : project->configurations()) { const auto &configuration = iter.second; if (!m_configurations.count(configuration->name())) createConfiguration(configuration->name()); m_configurations.at(configuration->name())->merge(configuration); } for (const auto &iter : project->tensortypes()) { const auto &tensortype = iter.second; if (!m_tensortypes.count(tensortype->name())) createTensorType(tensortype->name(), tensortype->dimension(), tensortype->rank()); m_tensortypes.at(tensortype->name())->merge(tensortype); } for (const auto &iter : project->manifolds()) { const auto &manifold = iter.second; if (!m_manifolds.count(manifold->name())) createManifold(manifold->name(), m_configurations.at(manifold->configuration()->name()), manifold->dimension()); m_manifolds.at(manifold->name())->merge(manifold); } for (const auto &iter : project->tangentspaces()) { const auto &tangentspace = iter.second; if (!m_tangentspaces.count(tangentspace->name())) createTangentSpace( tangentspace->name(), m_configurations.at(tangentspace->configuration()->name()), tangentspace->dimension()); m_tangentspaces.at(tangentspace->name())->merge(tangentspace); } for (const auto &iter : project->fields()) { const auto &field = iter.second; if (!m_fields.count(field->name())) createField(field->name(), m_configurations.at(field->configuration()->name()), m_manifolds.at(field->manifold()->name()), m_tangentspaces.at(field->tangentspace()->name()), m_tensortypes.at(field->tensortype()->name())); m_fields.at(field->name())->merge(field); } for (const auto &iter : project->coordinatesystems()) { const auto &coordinatesystem = iter.second; if (!m_coordinatesystems.count(coordinatesystem->name())) createCoordinateSystem( coordinatesystem->name(), m_configurations.at(coordinatesystem->configuration()->name()), m_manifolds.at(coordinatesystem->manifold()->name())); m_coordinatesystems.at(coordinatesystem->name())->merge(coordinatesystem); } } void Project::createStandardTensorTypes() { { auto s0d = createTensorType("Scalar0D", 0, 0); s0d->createTensorComponent("scalar", 0, vector<int>{}); } { auto v0d = createTensorType("Vector0D", 0, 1); } { auto t0d = createTensorType("Tensor0D", 0, 2); } { auto st0d = createTensorType("SymmetricTensor0D", 0, 2); } { auto s1d = createTensorType("Scalar1D", 1, 0); s1d->createTensorComponent("scalar", 0, vector<int>{}); } { auto v1d = createTensorType("Vector1D", 1, 1); v1d->createTensorComponent("0", 0, {0}); } { auto t1d = createTensorType("Tensor1D", 1, 2); t1d->createTensorComponent("00", 0, {0, 0}); } { auto st1d = createTensorType("SymmetricTensor1D", 1, 2); st1d->createTensorComponent("00", 0, {0, 0}); } { auto s2d = createTensorType("Scalar2D", 2, 0); s2d->createTensorComponent("scalar", 0, vector<int>{}); } { auto v2d = createTensorType("Vector2D", 2, 1); v2d->createTensorComponent("0", 0, {0}); v2d->createTensorComponent("1", 1, {1}); } { auto t2d = createTensorType("Tensor2D", 2, 2); t2d->createTensorComponent("00", 0, {0, 0}); t2d->createTensorComponent("01", 1, {0, 1}); t2d->createTensorComponent("10", 2, {1, 0}); t2d->createTensorComponent("11", 3, {1, 1}); } { auto st2d = createTensorType("SymmetricTensor2D", 2, 2); st2d->createTensorComponent("00", 0, {0, 0}); st2d->createTensorComponent("01", 1, {0, 1}); st2d->createTensorComponent("11", 2, {1, 1}); } { auto s3d = createTensorType("Scalar3D", 3, 0); s3d->createTensorComponent("scalar", 0, vector<int>{}); } { auto v3d = createTensorType("Vector3D", 3, 1); v3d->createTensorComponent("0", 0, {0}); v3d->createTensorComponent("1", 1, {1}); v3d->createTensorComponent("2", 2, {2}); } { auto t3d = createTensorType("Tensor3D", 3, 2); t3d->createTensorComponent("00", 0, {0, 0}); t3d->createTensorComponent("01", 1, {0, 1}); t3d->createTensorComponent("02", 2, {0, 2}); t3d->createTensorComponent("10", 3, {1, 0}); t3d->createTensorComponent("11", 4, {1, 1}); t3d->createTensorComponent("12", 5, {1, 2}); t3d->createTensorComponent("20", 6, {2, 0}); t3d->createTensorComponent("21", 7, {2, 1}); t3d->createTensorComponent("22", 8, {2, 2}); } { auto st3d = createTensorType("SymmetricTensor3D", 3, 2); st3d->createTensorComponent("00", 0, {0, 0}); st3d->createTensorComponent("01", 1, {0, 1}); st3d->createTensorComponent("02", 2, {0, 2}); st3d->createTensorComponent("11", 3, {1, 1}); st3d->createTensorComponent("12", 4, {1, 2}); st3d->createTensorComponent("22", 5, {2, 2}); } { auto s4d = createTensorType("Scalar4D", 4, 0); s4d->createTensorComponent("scalar", 0, vector<int>{}); } { auto v4d = createTensorType("Vector4D", 4, 1); v4d->createTensorComponent("0", 0, {0}); v4d->createTensorComponent("1", 1, {1}); v4d->createTensorComponent("2", 2, {2}); v4d->createTensorComponent("3", 3, {3}); } { auto t4d = createTensorType("Tensor4D", 4, 2); t4d->createTensorComponent("00", 0, {0, 0}); t4d->createTensorComponent("01", 1, {0, 1}); t4d->createTensorComponent("02", 2, {0, 2}); t4d->createTensorComponent("03", 3, {0, 3}); t4d->createTensorComponent("10", 4, {1, 0}); t4d->createTensorComponent("11", 5, {1, 1}); t4d->createTensorComponent("12", 6, {1, 2}); t4d->createTensorComponent("13", 7, {1, 3}); t4d->createTensorComponent("20", 8, {2, 0}); t4d->createTensorComponent("21", 9, {2, 1}); t4d->createTensorComponent("22", 10, {2, 2}); t4d->createTensorComponent("23", 11, {2, 3}); t4d->createTensorComponent("30", 12, {3, 0}); t4d->createTensorComponent("31", 13, {3, 1}); t4d->createTensorComponent("32", 14, {3, 2}); t4d->createTensorComponent("33", 15, {3, 3}); } { auto st4d = createTensorType("SymmetricTensor4D", 4, 2); st4d->createTensorComponent("00", 0, {0, 0}); st4d->createTensorComponent("01", 1, {0, 1}); st4d->createTensorComponent("02", 2, {0, 2}); st4d->createTensorComponent("03", 3, {0, 3}); st4d->createTensorComponent("11", 4, {1, 1}); st4d->createTensorComponent("12", 5, {1, 2}); st4d->createTensorComponent("13", 6, {1, 3}); st4d->createTensorComponent("22", 7, {2, 2}); st4d->createTensorComponent("23", 8, {2, 3}); st4d->createTensorComponent("33", 9, {3, 3}); } } ostream &Project::output(ostream &os, int level) const { os << indent(level) << "Project " << quote(name()) << "\n"; for (const auto &par : parameters()) par.second->output(os, level + 1); for (const auto &conf : configurations()) conf.second->output(os, level + 1); for (const auto &tt : tensortypes()) tt.second->output(os, level + 1); for (const auto &m : manifolds()) m.second->output(os, level + 1); for (const auto &ts : tangentspaces()) ts.second->output(os, level + 1); for (const auto &f : fields()) f.second->output(os, level + 1); for (const auto &cs : coordinatesystems()) cs.second->output(os, level + 1); return os; } #ifdef SIMULATIONIO_HAVE_HDF5 void Project::insertEnumField(const H5::EnumType &type, const string &name, int value) { type.insert(name, &value); } #endif void Project::createTypes() const { #ifdef SIMULATIONIO_HAVE_HDF5 enumtype = H5::EnumType(H5::getType(int{})); insertEnumField(enumtype, "Basis", type_Basis); insertEnumField(enumtype, "BasisVector", type_BasisVector); insertEnumField(enumtype, "Configuration", type_Configuration); insertEnumField(enumtype, "CoordinateField", type_CoordinateField); insertEnumField(enumtype, "CoordinateSystem", type_CoordinateSystem); insertEnumField(enumtype, "DiscreteField", type_DiscreteField); insertEnumField(enumtype, "DiscreteFieldBlock", type_DiscreteFieldBlock); insertEnumField(enumtype, "DiscreteFieldBlockComponent", type_DiscreteFieldBlockComponent); insertEnumField(enumtype, "Discretization", type_Discretization); insertEnumField(enumtype, "DiscretizationBlock", type_DiscretizationBlock); insertEnumField(enumtype, "Field", type_Field); insertEnumField(enumtype, "Manifold", type_Manifold); insertEnumField(enumtype, "Parameter", type_Parameter); insertEnumField(enumtype, "ParameterValue", type_ParameterValue); insertEnumField(enumtype, "Project", type_Project); insertEnumField(enumtype, "SubDiscretization", type_SubDiscretization); insertEnumField(enumtype, "TangentSpace", type_TangentSpace); insertEnumField(enumtype, "TensorComponent", type_TensorComponent); insertEnumField(enumtype, "TensorType", type_TensorType); auto double_type = H5::getType(double{}); typedef long long long_long; auto int_type = H5::getType(long_long{}); #if 0 // A range is described by its minimum (inclusive), maximum (inclusive), and // count (non-negative). Here we use double precision for all three fields, // but other precisions are also possible. We use a floating point number to // describe the count for uniformity. rangetype = H5::CompType(sizeof(range_t)); rangetype.insertMember("minimum", offsetof(range_t, minimum), double_type); rangetype.insertMember("maximum", offsetof(range_t, maximum), double_type); rangetype.insertMember("count", offsetof(range_t, count), double_type); #endif // point, box, and region are defined in RegionCalculus.hpp pointtypes.clear(); boxtypes.clear(); regiontypes.clear(); for (int d = 0; d <= 4; ++d) { // point_t auto pointtype = [&] { const hsize_t dim = max(1, d); // HDF5 requires at least 1 element const hsize_t dims[1] = {dim}; // TODO: Handle d==0 correctly return H5::ArrayType(int_type, 1, dims); }(); pointtypes.push_back(pointtype); // box_t auto boxtype = [&] { vector<size_t> offsets; size_t size = 0; if (d == 0) { offsets.push_back(size); auto inttype = H5::getType(int{}); size += inttype.getSize(); auto boxtype = H5::CompType(size); boxtype.insertMember("full", offsets.at(0), inttype); return boxtype; } else { offsets.push_back(size); size += pointtype.getSize(); offsets.push_back(size); size += pointtype.getSize(); auto boxtype = H5::CompType(size); boxtype.insertMember("lower", offsets.at(0), pointtype); boxtype.insertMember("upper", offsets.at(1), pointtype); return boxtype; } }(); boxtypes.push_back(boxtype); // region_t auto regiontype = H5::VarLenType(&boxtype); regiontypes.push_back(regiontype); // TODO: Move these to Buffer.cpp // linearization_t auto linearizationtype = [&] { vector<size_t> offsets; size_t size = 0; offsets.push_back(size); size += boxtype.getSize(); offsets.push_back(size); size += int_type.getSize(); auto type = H5::CompType(size); type.insertMember("box", offsets.at(0), boxtype); type.insertMember("pos", offsets.at(1), int_type); return type; }(); linearizationtypes.push_back(linearizationtype); // concatenation_t auto concatenationtype = [&] { auto type = H5::VarLenType(&linearizationtype); return type; }(); concatenationtypes.push_back(concatenationtype); } #endif } #ifdef SIMULATIONIO_HAVE_HDF5 void Project::write(const H5::H5Location &loc, const H5::H5Location &parent) const { assert(invariant()); // auto group = loc.createGroup(name()); auto group = loc.openGroup("."); createTypes(); auto typegroup = group.createGroup("types"); enumtype.commit(typegroup, "SimulationIO"); #if 0 rangetype.commit(typegroup, "Range"); #endif for (int d = 0; d < int(pointtypes.size()); ++d) pointtypes.at(d).commit(typegroup, "Point[" + to_string(d) + "]"); for (int d = 0; d < int(boxtypes.size()); ++d) boxtypes.at(d).commit(typegroup, "Box[" + to_string(d) + "]"); for (int d = 0; d < int(regiontypes.size()); ++d) regiontypes.at(d).commit(typegroup, "Region[" + to_string(d) + "]"); H5::createAttribute(group, "type", enumtype, "Project"); H5::createAttribute(group, "name", name()); // no link to parent H5::createGroup(group, "parameters", parameters()); H5::createGroup(group, "configurations", configurations()); H5::createGroup(group, "tensortypes", tensortypes()); H5::createGroup(group, "manifolds", manifolds()); H5::createGroup(group, "tangentspaces", tangentspaces()); H5::createGroup(group, "fields", fields()); H5::createGroup(group, "coordinatesystems", coordinatesystems()); } void Project::writeHDF5(const string &filename) const { auto fapl = H5::FileAccPropList(); // fapl.setFcloseDegree(H5F_CLOSE_STRONG); fapl.setLibverBounds(H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); auto file = H5::H5File(filename, H5F_ACC_EXCL, H5::FileCreatPropList::DEFAULT, fapl); write(file); } #endif #ifdef SIMULATIONIO_HAVE_ASDF_CXX vector<string> Project::yaml_path() const { return {name()}; } ASDF::writer &Project::write(ASDF::writer &w) const { auto aw = asdf_writer(w); aw.group("parameters", parameters()); aw.group("configurations", configurations()); aw.group("tensortypes", tensortypes()); aw.group("manifolds", manifolds()); aw.group("tangentspaces", tangentspaces()); aw.group("fields", fields()); aw.group("coordinatesystems", coordinatesystems()); return w; } void Project::writeASDF(ostream &file) const { map<string, string> tags{ {"sio", "tag:github.com/eschnett/SimulationIO/asdf-cxx/"}}; map<string, function<void(ASDF::writer & w)>> funs{ {name(), [&](ASDF::writer &w) { w << *this; }}}; const auto &doc = ASDF::asdf(move(tags), move(funs)); doc.write(file); } void Project::writeASDF(const string &filename) const { ofstream os(filename, ios::binary | ios::trunc | ios::out); writeASDF(os); } #endif #ifdef SIMULATIONIO_HAVE_TILEDB vector<string> Project::tiledb_path() const { return {m_tiledb_filename}; } void Project::write(const tiledb::Context &ctx, const string &loc) const { assert(invariant()); const tiledb_writer w(*this, ctx, loc); w.add_group("parameters", parameters()); w.add_group("configurations", configurations()); w.add_group("tensortypes", tensortypes()); w.add_group("manifolds", manifolds()); w.add_group("tangentspaces", tangentspaces()); w.add_group("fields", fields()); w.add_group("coordinatesystems", coordinatesystems()); } void Project::writeTileDB(const string &filename) const { tiledb::Config config; config.set("vfs.num_threads", "1"); // TODO: let the caller choose this tiledb::Context ctx(config); m_tiledb_filename = filename; write(ctx, filename); } #endif shared_ptr<Parameter> Project::createParameter(const string &name) { auto parameter = Parameter::create(name, shared_from_this()); checked_emplace(m_parameters, parameter->name(), parameter, "Project", "parameters"); assert(parameter->invariant()); return parameter; } shared_ptr<Parameter> Project::getParameter(const string &name) { auto loc = m_parameters.find(name); if (loc != m_parameters.end()) { const auto &parameter = loc->second; return parameter; } return createParameter(name); } shared_ptr<Parameter> Project::copyParameter(const shared_ptr<Parameter> &parameter, bool copy_children) { auto parameter2 = getParameter(parameter->name()); if (copy_children) { for (const auto &parametervalue_kv : parameter->parametervalues()) { const auto &parametervalue = parametervalue_kv.second; auto parametervalue2 = parameter2->copyParameterValue(parametervalue, copy_children); } } return parameter2; } #ifdef SIMULATIONIO_HAVE_HDF5 shared_ptr<Parameter> Project::readParameter(const H5::H5Location &loc, const string &entry) { auto parameter = Parameter::create(loc, entry, shared_from_this()); checked_emplace(m_parameters, parameter->name(), parameter, "Project", "parameters"); assert(parameter->invariant()); return parameter; } #endif #ifdef SIMULATIONIO_HAVE_ASDF_CXX shared_ptr<Parameter> Project::readParameter(const shared_ptr<ASDF::reader_state> &rs, const YAML::Node &node) { auto parameter = Parameter::create(rs, node, shared_from_this()); checked_emplace(m_parameters, parameter->name(), parameter, "Project", "parameters"); assert(parameter->invariant()); return parameter; } shared_ptr<Parameter> Project::getParameter(const shared_ptr<ASDF::reader_state> &rs, const YAML::Node &node) { auto ref = ASDF::reference(rs, node); auto doc_path = ref.get_split_target(); const auto &doc = doc_path.first; const auto &path = doc_path.second; assert(doc.empty()); assert(path.at(0) == name()); assert(path.at(1) == "parameters"); const auto &parameter_name = path.at(2); return parameters().at(parameter_name); } #endif shared_ptr<Configuration> Project::createConfiguration(const string &name) { auto configuration = Configuration::create(name, shared_from_this()); checked_emplace(m_configurations, configuration->name(), configuration, "Project", "configurations"); assert(configuration->invariant()); return configuration; } shared_ptr<Configuration> Project::getConfiguration(const string &name) { auto loc = m_configurations.find(name); if (loc != m_configurations.end()) { const auto &configuration = loc->second; return configuration; } return createConfiguration(name); } shared_ptr<Configuration> Project::copyConfiguration(const shared_ptr<Configuration> &configuration, bool copy_children) { auto configuration2 = getConfiguration(configuration->name()); for (const auto &parametervalue_kv : configuration->parametervalues()) { const auto &parametervalue = parametervalue_kv.second; auto parameter2 = copyParameter(parametervalue->parameter()); auto parametervalue2 = parameter2->copyParameterValue(parametervalue); if (!configuration2->parametervalues().count(parametervalue2->name())) configuration2->insertParameterValue(parametervalue2); } return configuration2; } #ifdef SIMULATIONIO_HAVE_HDF5 shared_ptr<Configuration> Project::readConfiguration(const H5::H5Location &loc, const string &entry) { auto configuration = Configuration::create(loc, entry, shared_from_this()); checked_emplace(m_configurations, configuration->name(), configuration, "Project", "configurations"); assert(configuration->invariant()); return configuration; } #endif #ifdef SIMULATIONIO_HAVE_ASDF_CXX shared_ptr<Configuration> Project::readConfiguration(const shared_ptr<ASDF::reader_state> &rs, const YAML::Node &node) { auto configuration = Configuration::create(rs, node, shared_from_this()); checked_emplace(m_configurations, configuration->name(), configuration, "Project", "configurations"); assert(configuration->invariant()); return configuration; } shared_ptr<Configuration> Project::getConfiguration(const shared_ptr<ASDF::reader_state> &rs, const YAML::Node &node) { auto ref = ASDF::reference(rs, node); auto doc_path = ref.get_split_target(); const auto &doc = doc_path.first; const auto &path = doc_path.second; assert(doc.empty()); assert(path.at(0) == name()); assert(path.at(1) == "configurations"); const auto &configuration_name = path.at(2); return configurations().at(configuration_name); } #endif shared_ptr<TensorType> Project::createTensorType(const string &name, int dimension, int rank) { auto tensortype = TensorType::create(name, shared_from_this(), dimension, rank); checked_emplace(m_tensortypes, tensortype->name(), tensortype, "Project", "tensortypes"); assert(tensortype->invariant()); return tensortype; } shared_ptr<TensorType> Project::getTensorType(const string &name, int dimension, int rank) { auto loc = m_tensortypes.find(name); if (loc != m_tensortypes.end()) { const auto &tensortype = loc->second; assert(tensortype->dimension() == dimension); assert(tensortype->rank() == rank); return tensortype; } return createTensorType(name, dimension, rank); } shared_ptr<TensorType> Project::copyTensorType(const shared_ptr<TensorType> &tensortype, bool copy_children) { auto tensortype2 = getTensorType(tensortype->name(), tensortype->dimension(), tensortype->rank()); if (copy_children) { for (const auto &tensorcomponent_kv : tensortype->tensorcomponents()) { const auto &tensorcomponent = tensorcomponent_kv.second; auto tensorcomponent2 = tensortype2->copyTensorComponent(tensorcomponent, copy_children); } } return tensortype2; } #ifdef SIMULATIONIO_HAVE_HDF5 shared_ptr<TensorType> Project::readTensorType(const H5::H5Location &loc, const string &entry) { auto tensortype = TensorType::create(loc, entry, shared_from_this()); checked_emplace(m_tensortypes, tensortype->name(), tensortype, "Project", "tensortypes"); assert(tensortype->invariant()); return tensortype; } #endif #ifdef SIMULATIONIO_HAVE_ASDF_CXX shared_ptr<TensorType> Project::readTensorType(const shared_ptr<ASDF::reader_state> &rs, const YAML::Node &node) { auto tensortype = TensorType::create(rs, node, shared_from_this()); checked_emplace(m_tensortypes, tensortype->name(), tensortype, "Project", "tensortypes"); assert(tensortype->invariant()); return tensortype; } shared_ptr<TensorType> Project::getTensorType(const shared_ptr<ASDF::reader_state> &rs, const YAML::Node &node) { auto ref = ASDF::reference(rs, node); auto doc_path = ref.get_split_target(); const auto &doc = doc_path.first; const auto &path = doc_path.second; assert(doc.empty()); assert(path.at(0) == name()); assert(path.at(1) == "tensortypes"); const auto &tensortype_name = path.at(2); return tensortypes().at(tensortype_name); } #endif shared_ptr<Manifold> Project::createManifold(const string &name, const shared_ptr<Configuration> &configuration, int dimension) { assert(configuration->project().get() == this); auto manifold = Manifold::create(name, shared_from_this(), configuration, dimension); checked_emplace(m_manifolds, manifold->name(), manifold, "Project", "manifolds"); assert(manifold->invariant()); return manifold; } shared_ptr<Manifold> Project::getManifold(const string &name, const shared_ptr<Configuration> &configuration, int dimension) { auto loc = m_manifolds.find(name); if (loc != m_manifolds.end()) { const auto &manifold = loc->second; assert(manifold->configuration() == configuration); assert(manifold->dimension() == dimension); return manifold; } return createManifold(name, configuration, dimension); } shared_ptr<Manifold> Project::copyManifold(const shared_ptr<Manifold> &manifold, bool copy_children) { auto configuration2 = copyConfiguration(manifold->configuration()); auto manifold2 = getManifold(manifold->name(), configuration2, manifold->dimension()); if (copy_children) { for (const auto &discretization_kv : manifold->discretizations()) { const auto &discretization = discretization_kv.second; auto discretization2 = manifold2->copyDiscretization(discretization, copy_children); } } return manifold2; } #ifdef SIMULATIONIO_HAVE_HDF5 shared_ptr<Manifold> Project::readManifold(const H5::H5Location &loc, const string &entry) { auto manifold = Manifold::create(loc, entry, shared_from_this()); checked_emplace(m_manifolds, manifold->name(), manifold, "Project", "manifolds"); assert(manifold->invariant()); return manifold; } #endif #ifdef SIMULATIONIO_HAVE_ASDF_CXX shared_ptr<Manifold> Project::readManifold(const shared_ptr<ASDF::reader_state> &rs, const YAML::Node &node) { auto manifold = Manifold::create(rs, node, shared_from_this()); checked_emplace(m_manifolds, manifold->name(), manifold, "Project", "manifolds"); assert(manifold->invariant()); return manifold; } shared_ptr<Manifold> Project::getManifold(const shared_ptr<ASDF::reader_state> &rs, const YAML::Node &node) { auto ref = ASDF::reference(rs, node); auto doc_path = ref.get_split_target(); const auto &doc = doc_path.first; const auto &path = doc_path.second; assert(doc.empty()); assert(path.at(0) == name()); assert(path.at(1) == "manifolds"); const auto &manifold_name = path.at(2); return manifolds().at(manifold_name); } #endif shared_ptr<TangentSpace> Project::createTangentSpace(const string &name, const shared_ptr<Configuration> &configuration, int dimension) { assert(configuration->project().get() == this); auto tangentspace = TangentSpace::create(name, shared_from_this(), configuration, dimension); checked_emplace(m_tangentspaces, tangentspace->name(), tangentspace, "Project", "tangentspaces"); assert(tangentspace->invariant()); return tangentspace; } shared_ptr<TangentSpace> Project::getTangentSpace(const string &name, const shared_ptr<Configuration> &configuration, int dimension) { auto loc = m_tangentspaces.find(name); if (loc != m_tangentspaces.end()) { const auto &tangentspace = loc->second; assert(tangentspace->configuration() == configuration); assert(tangentspace->dimension() == dimension); return tangentspace; } return createTangentSpace(name, configuration, dimension); } shared_ptr<TangentSpace> Project::copyTangentSpace(const shared_ptr<TangentSpace> &tangentspace, bool copy_children) { auto configuration2 = copyConfiguration(tangentspace->configuration()); auto tangentspace2 = getTangentSpace(tangentspace->name(), configuration2, tangentspace->dimension()); if (copy_children) { for (const auto &basis_kv : tangentspace->bases()) { const auto &basis = basis_kv.second; auto basis2 = tangentspace2->copyBasis(basis, copy_children); } } return tangentspace2; } #ifdef SIMULATIONIO_HAVE_HDF5 shared_ptr<TangentSpace> Project::readTangentSpace(const H5::H5Location &loc, const string &entry) { auto tangentspace = TangentSpace::create(loc, entry, shared_from_this()); checked_emplace(m_tangentspaces, tangentspace->name(), tangentspace, "Project", "tangentspaces"); assert(tangentspace->invariant()); return tangentspace; } #endif #ifdef SIMULATIONIO_HAVE_ASDF_CXX shared_ptr<TangentSpace> Project::readTangentSpace(const shared_ptr<ASDF::reader_state> &rs, const YAML::Node &node) { auto tangentspace = TangentSpace::create(rs, node, shared_from_this()); checked_emplace(m_tangentspaces, tangentspace->name(), tangentspace, "Project", "tangentspaces"); assert(tangentspace->invariant()); return tangentspace; } shared_ptr<TangentSpace> Project::getTangentSpace(const shared_ptr<ASDF::reader_state> &rs, const YAML::Node &node) { auto ref = ASDF::reference(rs, node); auto doc_path = ref.get_split_target(); const auto &doc = doc_path.first; const auto &path = doc_path.second; assert(doc.empty()); assert(path.at(0) == name()); assert(path.at(1) == "tangentspaces"); const auto &tangentspace_name = path.at(2); return tangentspaces().at(tangentspace_name); } #endif shared_ptr<Field> Project::createField(const string &name, const shared_ptr<Configuration> &configuration, const shared_ptr<Manifold> &manifold, const shared_ptr<TangentSpace> &tangentspace, const shared_ptr<TensorType> &tensortype) { assert(configuration->project().get() == this); assert(manifold->project().get() == this); assert(tangentspace->project().get() == this); assert(tensortype->project().get() == this); auto field = Field::create(name, shared_from_this(), configuration, manifold, tangentspace, tensortype); checked_emplace(m_fields, field->name(), field, "Project", "fields"); assert(field->invariant()); return field; } shared_ptr<Field> Project::getField(const string &name, const shared_ptr<Configuration> &configuration, const shared_ptr<Manifold> &manifold, const shared_ptr<TangentSpace> &tangentspace, const shared_ptr<TensorType> &tensortype) { auto loc = m_fields.find(name); if (loc != m_fields.end()) { const auto &field = loc->second; assert(field->configuration() == configuration); assert(field->manifold() == manifold); assert(field->tangentspace() == tangentspace); assert(field->tensortype() == tensortype); return field; } return createField(name, configuration, manifold, tangentspace, tensortype); } shared_ptr<Field> Project::copyField(const shared_ptr<Field> &field, bool copy_children) { auto configuration2 = copyConfiguration(field->configuration()); auto manifold2 = copyManifold(field->manifold()); auto tangentspace2 = copyTangentSpace(field->tangentspace()); auto tensortype2 = copyTensorType(field->tensortype()); auto field2 = getField(field->name(), configuration2, manifold2, tangentspace2, tensortype2); if (copy_children) { for (const auto &discretefield_kv : field->discretefields()) { const auto &discretefield = discretefield_kv.second; auto discretefield2 = field2->copyDiscreteField(discretefield, copy_children); } } return field2; } #ifdef SIMULATIONIO_HAVE_HDF5 shared_ptr<Field> Project::readField(const H5::H5Location &loc, const string &entry) { auto field = Field::create(loc, entry, shared_from_this()); checked_emplace(m_fields, field->name(), field, "Project", "fields"); assert(field->invariant()); return field; } #endif #ifdef SIMULATIONIO_HAVE_ASDF_CXX shared_ptr<Field> Project::readField(const shared_ptr<ASDF::reader_state> &rs, const YAML::Node &node) { auto field = Field::create(rs, node, shared_from_this()); checked_emplace(m_fields, field->name(), field, "Project", "fields"); assert(field->invariant()); return field; } shared_ptr<Field> Project::getField(const shared_ptr<ASDF::reader_state> &rs, const YAML::Node &node) { auto ref = ASDF::reference(rs, node); auto doc_path = ref.get_split_target(); const auto &doc = doc_path.first; const auto &path = doc_path.second; assert(doc.empty()); assert(path.at(0) == name()); assert(path.at(1) == "fields"); const auto &field_name = path.at(2); return fields().at(field_name); } #endif shared_ptr<CoordinateSystem> Project::createCoordinateSystem(const string &name, const shared_ptr<Configuration> &configuration, const shared_ptr<Manifold> &manifold) { auto coordinatesystem = CoordinateSystem::create(name, shared_from_this(), configuration, manifold); checked_emplace(m_coordinatesystems, coordinatesystem->name(), coordinatesystem, "Project", "coordinatesystems"); assert(coordinatesystem->invariant()); return coordinatesystem; } shared_ptr<CoordinateSystem> Project::getCoordinateSystem(const string &name, const shared_ptr<Configuration> &configuration, const shared_ptr<Manifold> &manifold) { auto loc = m_coordinatesystems.find(name); if (loc != m_coordinatesystems.end()) { const auto &coordinatesystem = loc->second; assert(coordinatesystem->configuration() == configuration); assert(coordinatesystem->manifold() == manifold); return coordinatesystem; } return createCoordinateSystem(name, configuration, manifold); } shared_ptr<CoordinateSystem> Project::copyCoordinateSystem( const shared_ptr<CoordinateSystem> &coordinatesystem, bool copy_children) { auto configuration2 = copyConfiguration(coordinatesystem->configuration()); auto manifold2 = copyManifold(coordinatesystem->manifold()); auto coordinatesystem2 = getCoordinateSystem(coordinatesystem->name(), configuration2, manifold2); if (copy_children) { for (const auto &coordinatefield_kv : coordinatesystem->coordinatefields()) { const auto &coordinatefield = coordinatefield_kv.second; auto coordinatefield2 = coordinatesystem2->copyCoordinateField( coordinatefield, copy_children); } } return coordinatesystem2; } #ifdef SIMULATIONIO_HAVE_HDF5 shared_ptr<CoordinateSystem> Project::readCoordinateSystem(const H5::H5Location &loc, const string &entry) { auto coordinatesystem = CoordinateSystem::create(loc, entry, shared_from_this()); checked_emplace(m_coordinatesystems, coordinatesystem->name(), coordinatesystem, "Project", "coordinatesystems"); assert(coordinatesystem->invariant()); return coordinatesystem; } #endif #ifdef SIMULATIONIO_HAVE_ASDF_CXX shared_ptr<CoordinateSystem> Project::readCoordinateSystem(const shared_ptr<ASDF::reader_state> &rs, const YAML::Node &node) { auto coordinatesystem = CoordinateSystem::create(rs, node, shared_from_this()); checked_emplace(m_coordinatesystems, coordinatesystem->name(), coordinatesystem, "Project", "coordinatesystems"); assert(coordinatesystem->invariant()); return coordinatesystem; } #endif } // namespace SimulationIO
eschnett/SimulationIO
Project.cpp
C++
lgpl-3.0
40,794
<?php /** * Class Allegro_Web_Api_DoGetSellRatingReasonsRequest * @package Allegro_Web_Api * @author Paweł Cieślik <cieslix@gmail.com> * @licence http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later */ class Allegro_Web_Api_DoGetSellRatingReasonsRequest extends Allegro_Web_Api_Abstract { /** * @var string $webapiKey */ protected $webapiKey = null; /** * @var int $countryCode */ protected $countryCode = null; /** * @param string $webapiKey * @param int $countryCode */ public function __construct($webapiKey, $countryCode) { $this->webapiKey = $webapiKey; $this->countryCode = $countryCode; } /** * @return string */ public function getWebapiKey() { return $this->webapiKey; } /** * @param string $webapiKey * @return Allegro_Web_Api_DoGetSellRatingReasonsRequest */ public function setWebapiKey($webapiKey) { $this->webapiKey = $webapiKey; return $this; } /** * @return int */ public function getCountryCode() { return $this->countryCode; } /** * @param int $countryCode * @return Allegro_Web_Api_DoGetSellRatingReasonsRequest */ public function setCountryCode($countryCode) { $this->countryCode = $countryCode; return $this; } }
cieslix/allegro
src/Allegro/Web/Api/DoGetSellRatingReasonsRequest.php
PHP
lgpl-3.0
1,437
/** * Copyright (C) 2010-2016 Gordon Fraser, Andrea Arcuri and EvoSuite * contributors * * This file is part of EvoSuite. * * EvoSuite is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3.0 of the License, or * (at your option) any later version. * * EvoSuite is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with EvoSuite. If not, see <http://www.gnu.org/licenses/>. */ package org.evosuite.ga.operators.mutation; import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; public class MutationHistory<T extends MutationHistoryEntry> implements Iterable<T>, Serializable { private static final long serialVersionUID = -8543180637106924913L; private final List<T> mutations = new ArrayList<T>(); public void clear() { mutations.clear(); } public void addMutationEntry(T entry) { mutations.add(entry); } public List<T> getMutations() { return Collections.unmodifiableList(mutations); } @Override public Iterator<T> iterator() { return mutations.iterator(); } public int size() { return mutations.size(); } public boolean isEmpty() { return mutations.isEmpty(); } public void set(MutationHistory<T> other) { mutations.addAll(other.getMutations()); } /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { String result = ""; for (T t : mutations) result += t.toString() + "\n"; return result; } }
claudejin/evosuite
client/src/main/java/org/evosuite/ga/operators/mutation/MutationHistory.java
Java
lgpl-3.0
1,888
package com.inspirationlogical.receipt.corelib.model.entity; import com.inspirationlogical.receipt.corelib.model.enums.VATName; import com.inspirationlogical.receipt.corelib.model.enums.VATStatus; import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Tolerate; import javax.persistence.Table; import javax.persistence.*; @Entity @Builder @EqualsAndHashCode(callSuper = true) @Table(name = "VAT") @AttributeOverride(name = "id", column = @Column(name = "VAT_ID")) public @Data class VAT extends AbstractEntity { @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.REFRESH}) @JoinColumn(name = "VAT_SERIE_ID") private VATSerie serie; @Column(name = "NAME") @Enumerated(EnumType.STRING) private VATName name; @Column(name = "STATUS") @Enumerated(EnumType.STRING) VATStatus status; @Column(name = "VAT") private double VAT; @Column(name = "CASHIER_NUMBER") private int cashierNumber; @Column(name = "SERVICE_FEE_CASHIER_NUMBER") private int serviceFeeCashierNumber; @Tolerate VAT() { } }
iplogical/res
app/corelib/src/main/java/com/inspirationlogical/receipt/corelib/model/entity/VAT.java
Java
lgpl-3.0
1,142
/* * Copyright (C) 2022 Inera AB (http://www.inera.se) * * This file is part of sklintyg (https://github.com/sklintyg). * * sklintyg is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * sklintyg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package se.inera.statistics.service.report.util; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.TreeMap; public final class Ranges implements Iterable<Ranges.Range> { private final List<Range> ranges; private final Map<String, Range> idMap = new TreeMap<>(); public Ranges(Range... ranges) { this.ranges = Arrays.asList(ranges); for (Range range : this.ranges) { idMap.put(range.getName(), range); } } public static Range range(String name, int cutoff) { return new Range(name, cutoff); } public static Range range(String name, int cutoff, String color) { return new Range(name, cutoff, color); } public Range rangeFor(String id) { Range range = idMap.get(id); if (range != null) { return range; } else { throw new IllegalStateException("Ranges have not been defined correctly. No range " + id); } } public Range rangeFor(int value) { for (Range range : ranges) { if (range.cutoff > value) { return range; } } throw new IllegalStateException("Ranges have not been defined correctly. No range includes " + value); } /** * Returns list of range where at least part of the range is higher than cutoff. * * @param days days * @return groups */ public List<Range> lookupRangesLongerThan(int days) { List<Range> result = new ArrayList<>(); for (Range range : ranges) { if (range.cutoff > days) { result.add(range); } } return result; } @Override public Iterator<Range> iterator() { return ranges.iterator(); } public int getRangeCutoffForValue(int value) { for (Ranges.Range range : ranges) { final int cutoff = range.getCutoff(); if (cutoff > value) { return cutoff; } } throw new IllegalStateException("Ranges have not been defined correctly. No range includes " + value); } public static final class Range { private final String name; private final int cutoff; private final String color; private Range(String name, int cutoff) { this(name, cutoff, null); } private Range(String name, int cutoff, String color) { this.name = name; this.cutoff = cutoff; this.color = color; } public String getName() { return name; } public String getColor() { return color; } public int getCutoff() { return cutoff; } @Override public String toString() { return name + "(" + cutoff + ")"; } } }
sklintyg/statistik
service/src/main/java/se/inera/statistics/service/report/util/Ranges.java
Java
lgpl-3.0
3,722
/* * SonarQube, open source software quality management tool. * Copyright (C) 2008-2014 SonarSource * mailto:contact AT sonarsource DOT com * * SonarQube is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * SonarQube is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.batch.repository; import com.google.common.collect.ImmutableMap; import java.util.ArrayList; import java.util.List; import org.apache.commons.lang.mutable.MutableBoolean; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.sonar.api.batch.bootstrap.ProjectKey; import org.sonar.api.utils.log.LogTester; import org.sonar.api.utils.log.LoggerLevel; import org.sonar.batch.analysis.AnalysisProperties; import org.sonar.batch.analysis.DefaultAnalysisMode; import org.sonar.batch.rule.ModuleQProfiles; import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyString; import static org.mockito.Matchers.eq; import static org.mockito.Matchers.isNull; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; public class QualityProfileProviderTest { @Rule public LogTester logTester = new LogTester(); private QualityProfileProvider qualityProfileProvider; @Mock private QualityProfileLoader loader; @Mock private DefaultAnalysisMode mode; @Mock private AnalysisProperties props; @Mock private ProjectKey key; @Mock private ProjectRepositories projectRepo; private List<QualityProfile> response; @Before public void setUp() { MockitoAnnotations.initMocks(this); qualityProfileProvider = new QualityProfileProvider(); when(key.get()).thenReturn("project"); when(projectRepo.exists()).thenReturn(true); response = new ArrayList<QualityProfile>(1); response.add(QualityProfile.newBuilder().setKey("profile").setName("profile").setLanguage("lang").build()); } @Test public void testProvide() { when(mode.isNotAssociated()).thenReturn(false); when(loader.load(eq("project"), isNull(String.class), any(MutableBoolean.class))).thenReturn(response); ModuleQProfiles qps = qualityProfileProvider.provide(key, loader, projectRepo, props, mode); assertResponse(qps); verify(loader).load(eq("project"), isNull(String.class), any(MutableBoolean.class)); verifyNoMoreInteractions(loader); } @Test public void testNonAssociated() { when(mode.isNotAssociated()).thenReturn(true); when(loader.loadDefault(anyString(), any(MutableBoolean.class))).thenReturn(response); ModuleQProfiles qps = qualityProfileProvider.provide(key, loader, projectRepo, props, mode); assertResponse(qps); verify(loader).loadDefault(anyString(), any(MutableBoolean.class)); verifyNoMoreInteractions(loader); } @Test public void testProjectDoesntExist() { when(mode.isNotAssociated()).thenReturn(false); when(projectRepo.exists()).thenReturn(false); when(loader.loadDefault(anyString(), any(MutableBoolean.class))).thenReturn(response); ModuleQProfiles qps = qualityProfileProvider.provide(key, loader, projectRepo, props, mode); assertResponse(qps); verify(loader).loadDefault(anyString(), any(MutableBoolean.class)); verifyNoMoreInteractions(loader); } @Test public void testProfileProp() { when(mode.isNotAssociated()).thenReturn(false); when(loader.load(eq("project"), eq("custom"), any(MutableBoolean.class))).thenReturn(response); when(props.property(ModuleQProfiles.SONAR_PROFILE_PROP)).thenReturn("custom"); when(props.properties()).thenReturn(ImmutableMap.of(ModuleQProfiles.SONAR_PROFILE_PROP, "custom")); ModuleQProfiles qps = qualityProfileProvider.provide(key, loader, projectRepo, props, mode); assertResponse(qps); verify(loader).load(eq("project"), eq("custom"), any(MutableBoolean.class)); verifyNoMoreInteractions(loader); assertThat(logTester.logs(LoggerLevel.WARN)).contains("Ability to set quality profile from command line using '" + ModuleQProfiles.SONAR_PROFILE_PROP + "' is deprecated and will be dropped in a future SonarQube version. Please configure quality profile used by your project on SonarQube server."); } @Test public void testIgnoreSonarProfileIssuesMode() { when(mode.isNotAssociated()).thenReturn(false); when(mode.isIssues()).thenReturn(true); when(loader.load(eq("project"), (String) eq(null), any(MutableBoolean.class))).thenReturn(response); when(props.property(ModuleQProfiles.SONAR_PROFILE_PROP)).thenReturn("custom"); ModuleQProfiles qps = qualityProfileProvider.provide(key, loader, projectRepo, props, mode); assertResponse(qps); verify(loader).load(eq("project"), (String) eq(null), any(MutableBoolean.class)); verifyNoMoreInteractions(loader); } @Test public void testProfilePropDefault() { when(mode.isNotAssociated()).thenReturn(true); when(loader.loadDefault(eq("custom"), any(MutableBoolean.class))).thenReturn(response); when(props.property(ModuleQProfiles.SONAR_PROFILE_PROP)).thenReturn("custom"); when(props.properties()).thenReturn(ImmutableMap.of(ModuleQProfiles.SONAR_PROFILE_PROP, "custom")); ModuleQProfiles qps = qualityProfileProvider.provide(key, loader, projectRepo, props, mode); assertResponse(qps); verify(loader).loadDefault(eq("custom"), any(MutableBoolean.class)); verifyNoMoreInteractions(loader); assertThat(logTester.logs(LoggerLevel.WARN)).contains("Ability to set quality profile from command line using '" + ModuleQProfiles.SONAR_PROFILE_PROP + "' is deprecated and will be dropped in a future SonarQube version. Please configure quality profile used by your project on SonarQube server."); } private void assertResponse(ModuleQProfiles qps) { assertThat(qps.findAll()).hasSize(1); assertThat(qps.findAll()).extracting("key").containsExactly("profile"); } }
vamsirajendra/sonarqube
sonar-batch/src/test/java/org/sonar/batch/repository/QualityProfileProviderTest.java
Java
lgpl-3.0
6,746
/** * Copyright (C) 2015 Michael Schnell. All rights reserved. * http://www.fuin.org/ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 3 of the License, or (at your option) any * later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library. If not, see http://www.gnu.org/licenses/. */ package org.fuin.esc.test; import java.util.ArrayList; import java.util.List; import jakarta.validation.constraints.NotNull; import org.fuin.esc.api.CommonEvent; import org.fuin.esc.api.EventId; import org.fuin.esc.api.EventStore; import org.fuin.esc.api.SimpleCommonEvent; import org.fuin.esc.api.SimpleStreamId; import org.fuin.esc.api.StreamEventsSlice; import org.fuin.esc.api.StreamId; import org.fuin.esc.test.examples.BookAddedEvent; import org.fuin.objects4j.common.Nullable; import org.fuin.units4j.TestCommand; /** * Reads a stream backward. */ public final class ReadBackwardCommand implements TestCommand<TestContext> { // Creation (Initialized by Cucumber) // DO NOT CHANGE ORDER OR RENAME VARIABLES! private String streamName; private long start; private int count; private long resultFrom; private long resultNext; private boolean endOfStream; private String resultEventId1; private String resultEventId2; private String resultEventId3; private String resultEventId4; private String resultEventId5; private String resultEventId6; private String resultEventId7; private String resultEventId8; private String resultEventId9; // Initialization private StreamId streamId; private EventStore es; private StreamEventsSlice expectedSlice; // Execution private Exception actualException; private StreamEventsSlice actualSlice; /** * Default constructor used by Cucumber. */ public ReadBackwardCommand() { super(); } /** * Constructor for manual creation. * * @param streamName * Uniquely identifies the stream to create. * @param start * The starting point to read from. * @param count * The count of items to read. * @param fromEventNumber * The starting point (represented as a sequence number) of the read. * @param nextEventNumber * The next event number that can be read. * @param endOfStream * Determines whether or not this is the end of the stream. * @param events * Expected events. */ public ReadBackwardCommand(@NotNull final String streamName, final long start, final int count, final long fromEventNumber, final long nextEventNumber, final boolean endOfStream, @Nullable final String... events) { super(); this.streamName = streamName; this.start = start; this.count = count; this.resultFrom = fromEventNumber; this.resultNext = nextEventNumber; this.endOfStream = endOfStream; final List<CommonEvent> expectedEvents = new ArrayList<>(); if (events != null) { for (final String event : events) { addEvent(expectedEvents, event); } } this.expectedSlice = new StreamEventsSlice(fromEventNumber, expectedEvents, nextEventNumber, endOfStream); } @Override public void init(final TestContext context) { this.es = context.getEventStore(); this.streamName = context.getCurrentEventStoreImplType() + "_" + streamName; resultEventId1 = EscTestUtils.emptyAsNull(resultEventId1); resultEventId2 = EscTestUtils.emptyAsNull(resultEventId2); resultEventId3 = EscTestUtils.emptyAsNull(resultEventId3); resultEventId4 = EscTestUtils.emptyAsNull(resultEventId4); resultEventId5 = EscTestUtils.emptyAsNull(resultEventId5); resultEventId6 = EscTestUtils.emptyAsNull(resultEventId6); resultEventId7 = EscTestUtils.emptyAsNull(resultEventId7); resultEventId8 = EscTestUtils.emptyAsNull(resultEventId8); resultEventId9 = EscTestUtils.emptyAsNull(resultEventId9); streamId = new SimpleStreamId(streamName); final List<CommonEvent> expectedEvents = new ArrayList<>(); addEvent(expectedEvents, resultEventId1); addEvent(expectedEvents, resultEventId2); addEvent(expectedEvents, resultEventId3); addEvent(expectedEvents, resultEventId4); addEvent(expectedEvents, resultEventId5); addEvent(expectedEvents, resultEventId6); addEvent(expectedEvents, resultEventId7); addEvent(expectedEvents, resultEventId8); addEvent(expectedEvents, resultEventId9); expectedSlice = new StreamEventsSlice(resultFrom, expectedEvents, resultNext, endOfStream); } private static void addEvent(final List<CommonEvent> events, final String eventId) { if (eventId != null) { final CommonEvent ce = new SimpleCommonEvent(new EventId(eventId), BookAddedEvent.TYPE, new BookAddedEvent("Any", "John Doe")); events.add(ce); } } @Override public final void execute() { try { actualSlice = es.readEventsBackward(streamId, start, count); } catch (final Exception ex) { this.actualException = ex; } } @Override public final boolean isSuccessful() { if (actualException != null) { return false; } return expectedSlice.equals(actualSlice); } @Override public final String getFailureDescription() { if (actualException != null) { return EscTestUtils.createExceptionFailureMessage(streamId.asString(), actualException); } if (actualSlice == null) { return "[" + streamId + "] expected " + expectedSlice.toDebugString() + ", but was: null"; } return "[" + streamId + "] expected " + expectedSlice.toDebugString() + ", but was: " + actualSlice.toDebugString(); } @Override public final void verify() { if (!isSuccessful()) { throw new RuntimeException(getFailureDescription()); } } @Override public final String toString() { return "ReadBackwardCommand [streamName=" + streamName + ", start=" + start + ", count=" + count + ", expectedSlice=" + expectedSlice + ", actualSlice=" + actualSlice + "]"; } }
fuinorg/event-store-commons
test/src/test/java/org/fuin/esc/test/ReadBackwardCommand.java
Java
lgpl-3.0
6,967
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Copyright (c) 2012-2014 The plumed team (see the PEOPLE file at the root of the distribution for a list of names) See http://www.plumed-code.org for more information. This file is part of plumed, version 2. plumed is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. plumed is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with plumed. If not, see <http://www.gnu.org/licenses/>. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ #include "KernelFunctions.h" #include "IFile.h" #include <iostream> #include <cmath> namespace PLMD { //+PLUMEDOC INTERNAL kernelfunctions /* Functions that are used to construct histograms Constructing histograms is something you learnt to do relatively early in life. You perform an experiment a number of times, count the number of times each result comes up and then draw a bar graph that describes how often each of the results came up. This only works when there are a finite number of possible results. If the result a number between 0 and 1 the bar chart is less easy to draw as there are as many possible results as there are numbers between zero and one - an infinite number. To resolve this problem we replace probability, \f$P\f$ with probability density, \f$\pi\f$, and write the probability of getting a number between \f$a\f$ and \f$b\f$ as: \f[ P = \int_{a}^b \textrm{d}x \pi(x) \f] To calculate probability densities from a set of results we use a process called kernel density estimation. Histograms are accumulated by adding up kernel functions, \f$K\f$, with finite spatial extent, that integrate to one. These functions are centered on each of the \f$n\f$-dimensional data points, \f$\mathbf{x}_i\f$. The overall effect of this is that each result we obtain in our experiments contributes to the probability density in a finite sized region of the space. Expressing all this mathematically in kernel density estimation we write the probability density as: \f[ \pi(\mathbf{x}) = \sum_i K\left[ (\mathbf{x} - \mathbf{x}_i)^T \Sigma (\mathbf{x} - \mathbf{x}_i) \right] \f] where \f$\Sigma\f$ is an \f$n \times n\f$ matrix called the bandwidth that controls the spatial extent of the kernel. Whenever we accumulate a histogram (e.g. in \ref HISTOGRAM or in \ref METAD) we use this technique. There is thus some flexibility in the particular function we use for \f$K[\mathbf{r}]\f$ in the above. The following variants are available. <table align=center frame=void width=95%% cellpadding=5%%> <tr> <td> TYPE </td> <td> FUNCTION </td> </tr> <tr> <td> gaussian </td> <td> \f$f(r) = \frac{1}{(2 \pi)^{n} \sqrt{|\Sigma^{-1}|}} \exp\left(-0.5 r^2 \right)\f$ </td> </tr> <tr> <td> triangular </td> <td> \f$f(r) = \frac{3}{V} ( 1 - | r | )H(1-|r|) \f$ </td> </tr> <tr> <td> uniform </td> <td> \f$f(r) = \frac{1}{V}H(1-|r|)\f$ </td> </tr> </table> In the above \f$H(y)\f$ is a function that is equal to one when \f$y>0\f$ and zero when \f$y \le 0\f$. \f$n\f$ is the dimensionality of the vector \f$\mathbf{x}\f$ and \f$V\f$ is the volume of an elipse in an \f$n\f$ dimensional space which is given by: \f{eqnarray*}{ V &=& | \Sigma^{-1} | \frac{ \pi^{\frac{n}{2}} }{\left( \frac{n}{2} \right)! } \qquad \textrm{for even} \quad n \\ V &=& | \Sigma^{-1} | \frac{ 2^{\frac{n+1}{2}} \pi^{\frac{n-1}{2}} }{ n!! } \f} In \ref METAD the normalization constants are ignored so that the value of the function at \f$r=0\f$ is equal to one. In addition in \ref METAD we must be able to differentiate the bias in order to get forces. This limits the kernels we can use in this method. */ //+ENDPLUMEDOC KernelFunctions::KernelFunctions( const std::string& input, const bool& normed ){ std::vector<std::string> data=Tools::getWords(input); std::string name=data[0]; data.erase(data.begin()); std::vector<double> at; bool foundc = Tools::parseVector(data,"CENTER",at); if(!foundc) plumed_merror("failed to find center keyword in definition of kernel"); std::vector<double> sig; bool founds = Tools::parseVector(data,"SIGMA",sig); if(!foundc) plumed_merror("failed to find sigma keyword in definition of kernel"); bool multi=false; Tools::parseFlag(data,"MULTIVARIATE",multi); if( center.size()==1 && multi ) plumed_merror("one dimensional kernel cannot be multivariate"); if( center.size()==1 && sig.size()!=1 ) plumed_merror("size mismatch between center size and sigma size"); if( multi && center.size()>1 && sig.size()!=0.5*center.size()*(center.size()-1) ) plumed_merror("size mismatch between center size and sigma size"); if( !multi && center.size()>1 && sig.size()!=center.size() ) plumed_merror("size mismatch between center size and sigma size"); double h; bool foundh = Tools::parse(data,"HEIGHT",h); if( !foundh) h=1.0; setData( at, sig, name, multi, h, normed ); } KernelFunctions::KernelFunctions( const std::vector<double>& at, const std::vector<double>& sig, const std::string& type, const bool multivariate, const double& w, const bool norm ){ setData( at, sig, type, multivariate, w, norm ); } void KernelFunctions::setData( const std::vector<double>& at, const std::vector<double>& sig, const std::string& type, const bool multivariate, const double& w, const bool norm ){ center.resize( at.size() ); for(unsigned i=0;i<at.size();++i) center[i]=at[i]; width.resize( sig.size() ); for(unsigned i=0;i<sig.size();++i) width[i]=sig[i]; diagonal=false; if (multivariate==false || at.size()==1 ) diagonal=true; // Setup the kernel type if(type=="GAUSSIAN" || type=="gaussian"){ ktype=gaussian; } else if(type=="UNIFORM" || type=="uniform"){ ktype=uniform; } else if(type=="TRIANGULAR" || type=="triangular"){ ktype=triangular; } else { plumed_merror(type+" is an invalid kernel type\n"); } if( norm ){ double det; unsigned ncv=ndim(); if(diagonal){ det=1; for(unsigned i=0;i<width.size();++i) det*=width[i]; } else { Matrix<double> mymatrix( getMatrix() ), myinv( ncv, ncv ); Invert(mymatrix,myinv); double logd; logdet( myinv, logd ); det=std::exp(logd); } double volume; if( ktype==gaussian ){ for(unsigned i=0;i<width.size();++i) det*=width[i]; volume=pow( 2*pi, 0.5*ncv ) * pow( det, 0.5 ); } else if( ktype==uniform || ktype==triangular ){ if( ncv%2==1 ){ double dfact=1; for(unsigned i=1;i<ncv;i+=2) dfact*=static_cast<double>(i); volume=( pow( pi, (ncv-1)/2 ) ) * ( pow( 2., (ncv+1)/2 ) ) / dfact; } else { double fact=1.; for(unsigned i=1;i<ncv/2;++i) fact*=static_cast<double>(i); volume=pow( pi,ncv/2 ) / fact; } if(ktype==uniform) volume*=det; else if(ktype==triangular) volume*=det / 3.; } else { plumed_merror("not a valid kernel type"); } height=w / volume; } else { height=w; } } double KernelFunctions::getCutoff( const double& width ) const { const double DP2CUTOFF=6.25; if( ktype==gaussian ) return sqrt(2.0*DP2CUTOFF)*width; else if(ktype==triangular ) return width; else if(ktype==uniform) return width; else plumed_merror("No valid kernel type"); return 0.0; } std::vector<double> KernelFunctions::getContinuousSupport( ) const { unsigned ncv=ndim(); std::vector<double> support( ncv ); if(diagonal){ for(unsigned i=0;i<ncv;++i) support[i]=getCutoff(width[i]); } else { Matrix<double> mymatrix( getMatrix() ), myinv( ncv,ncv ); Invert(mymatrix,myinv); Matrix<double> myautovec(ncv,ncv); std::vector<double> myautoval(ncv); diagMat(myinv,myautoval,myautovec); double maxautoval;maxautoval=0.; unsigned ind_maxautoval; for (unsigned i=0;i<ncv;i++){ if(myautoval[i]>maxautoval){maxautoval=myautoval[i];ind_maxautoval=i;} } for(unsigned i=0;i<ncv;++i){ double extent=fabs(sqrt(maxautoval)*myautovec(i,ind_maxautoval)); support[i]=getCutoff( extent ); } } return support; } std::vector<unsigned> KernelFunctions::getSupport( const std::vector<double>& dx ) const { plumed_assert( ndim()==dx.size() ); std::vector<unsigned> support( dx.size() ); std::vector<double> vv=getContinuousSupport( ); for(unsigned i=0;i<dx.size();++i) support[i]=static_cast<unsigned>(ceil( vv[i]/dx[i] )); return support; } double KernelFunctions::evaluate( const std::vector<Value*>& pos, std::vector<double>& derivatives, bool usederiv, bool doInt, double lowI_, double uppI_) const { plumed_dbg_assert( pos.size()==ndim() && derivatives.size()==ndim() ); #ifndef NDEBUG if( usederiv ) plumed_massert( ktype!=uniform, "step function can not be differentiated" ); #endif if(doInt){ plumed_dbg_assert(center.size()==1); if(pos[0]->get()<lowI_) pos[0]->set(lowI_); if(pos[0]->get()>uppI_) pos[0]->set(uppI_); } double r2=0; if(diagonal){ for(unsigned i=0;i<ndim();++i){ derivatives[i]=-pos[i]->difference( center[i] ) / width[i]; r2+=derivatives[i]*derivatives[i]; derivatives[i] /= width[i]; } } else { Matrix<double> mymatrix( getMatrix() ); for(unsigned i=0;i<mymatrix.nrows();++i){ double dp_i, dp_j; derivatives[i]=0; dp_i=pos[i]->difference( center[i] ); for(unsigned j=0;j<mymatrix.ncols();++j){ if(i==j) dp_j=dp_i; else dp_j=pos[j]->difference( center[j] ); derivatives[i]+=mymatrix(i,j)*dp_j; r2+=dp_i*dp_j*mymatrix(i,j); } } } double kderiv, kval; if(ktype==gaussian){ kval=height*std::exp(-0.5*r2); kderiv=-kval; } else { double r=sqrt(r2); if(ktype==triangular){ if( r<1.0 ){ if(r==0) kderiv=0; kderiv=-1; kval=height*( 1. - fabs(r) ); } else { kval=0.; kderiv=0.; } } else if(ktype==uniform){ kderiv=0.; if(r<1.0) kval=height; else kval=0; } else { plumed_merror("Not a valid kernel type"); } kderiv*=height / r ; } for(unsigned i=0;i<ndim();++i) derivatives[i]*=kderiv; if(doInt){ if((pos[0]->get() <= lowI_ || pos[0]->get() >= uppI_) && usederiv ) for(unsigned i=0;i<ndim();++i)derivatives[i]=0; } return kval; } KernelFunctions* KernelFunctions::read( IFile* ifile, const std::vector<std::string>& valnames ){ std::string sss; ifile->scanField("multivariate",sss); std::vector<double> cc( valnames.size() ), sig; bool multivariate; if( sss=="false" ){ multivariate=false; sig.resize( valnames.size() ); for(unsigned i=0;i<valnames.size();++i){ ifile->scanField(valnames[i],cc[i]); ifile->scanField("sigma_"+valnames[i],sig[i]); } } else if( sss=="true" ){ multivariate=true; unsigned ncv=valnames.size(); sig.resize( (ncv*(ncv+1))/2 ); Matrix<double> upper(ncv,ncv), lower(ncv,ncv); for(unsigned i=0;i<ncv;++i){ ifile->scanField(valnames[i],cc[i]); for(unsigned j=0;j<ncv-i;j++){ ifile->scanField("sigma_" +valnames[j+i] + "_" + valnames[j], lower(j+i,j) ); upper(j,j+i)=lower(j+i,j); } } Matrix<double> mymult( ncv, ncv ), invmatrix(ncv,ncv); mult(lower,upper,mymult); Invert( mymult, invmatrix ); unsigned k=0; for(unsigned i=0;i<ncv;i++){ for(unsigned j=i;j<ncv;j++){ sig[k]=invmatrix(i,j); k++; } } } else { plumed_merror("multivariate flag should equal true or false"); } double h; ifile->scanField("height",h); return new KernelFunctions( cc, sig, "gaussian", multivariate ,h, false); } }
sandipde/plumed-sandip
src/tools/KernelFunctions.cpp
C++
lgpl-3.0
12,154
/** * Provides the JavaFX Scene Layout API. * <p> * The JavaFX Scene Layout API is an extension to {@code javafx.scene.layout}. * <h3>Overview</h3> * <p> * The following list contains information about the classes in this API. * <ul> * <li>{@link org.dayflower.javafx.scene.layout.CenteredVBox CenteredVBox} is a {@code VBox} that centers, fills and provides spacing for its contents.</li> * <li>{@link org.dayflower.javafx.scene.layout.GridPanes GridPanes} consists exclusively of static methods that returns or performs various operations on {@code ColumnConstraints} and {@code GridPane} instances.</li> * <li>{@link org.dayflower.javafx.scene.layout.HBoxes HBoxes} consists exclusively of static methods that returns or performs various operations on {@code HBox} instances.</li> * <li>{@link org.dayflower.javafx.scene.layout.Regions Regions} consists exclusively of static methods that returns or performs various operations on {@code Region} instances.</li> * <li>{@link org.dayflower.javafx.scene.layout.VBoxes VBoxes} consists exclusively of static methods that returns or performs various operations on {@code VBox} instances.</li> * </ul> * <h3>Dependencies</h3> * <p> * The following list shows all dependencies for this API. * <ul> * <li>The Java I/O API</li> * <li>The Java Lang API</li> * <li>The Java Util Function API</li> * <li>The JavaFX Scene Control API</li> * <li>The Utility API</li> * </ul> */ package org.dayflower.javafx.scene.layout;
macroing/Dayflower
src/main/java/org/dayflower/javafx/scene/layout/package-info.java
Java
lgpl-3.0
1,484
var printCatalog = function() { print(catalog.crawlHeaderInfo); var schemas = catalog.schemas.toArray(); for ( var i = 0; i < schemas.length; i++) { print(schemas[i].fullName); var tables = catalog.getTables(schemas[i]).toArray(); for ( var j = 0; j < tables.length; j++) { print("o--> " + tables[j].name); var columns = tables[j].columns.toArray(); for ( var k = 0; k < columns.length; k++) { print(" o--> " + columns[k].name); } } } }; printCatalog();
ceharris/SchemaCrawler
schemacrawler-tools/src/test/resources/plaintextschema.js
JavaScript
lgpl-3.0
530
/* Copyright 2013-2021 Paul Colby This file is part of QtAws. QtAws is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. QtAws is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the QtAws. If not, see <http://www.gnu.org/licenses/>. */ #include "describefhirdatastoreresponse.h" #include "describefhirdatastoreresponse_p.h" #include <QDebug> #include <QNetworkReply> #include <QXmlStreamReader> namespace QtAws { namespace HealthLake { /*! * \class QtAws::HealthLake::DescribeFHIRDatastoreResponse * \brief The DescribeFHIRDatastoreResponse class provides an interace for HealthLake DescribeFHIRDatastore responses. * * \inmodule QtAwsHealthLake * * Amazon HealthLake is a HIPAA eligibile service that allows customers to store, transform, query, and analyze their * FHIR-formatted data in a consistent fashion in the * * \sa HealthLakeClient::describeFHIRDatastore */ /*! * Constructs a DescribeFHIRDatastoreResponse object for \a reply to \a request, with parent \a parent. */ DescribeFHIRDatastoreResponse::DescribeFHIRDatastoreResponse( const DescribeFHIRDatastoreRequest &request, QNetworkReply * const reply, QObject * const parent) : HealthLakeResponse(new DescribeFHIRDatastoreResponsePrivate(this), parent) { setRequest(new DescribeFHIRDatastoreRequest(request)); setReply(reply); } /*! * \reimp */ const DescribeFHIRDatastoreRequest * DescribeFHIRDatastoreResponse::request() const { Q_D(const DescribeFHIRDatastoreResponse); return static_cast<const DescribeFHIRDatastoreRequest *>(d->request); } /*! * \reimp * Parses a successful HealthLake DescribeFHIRDatastore \a response. */ void DescribeFHIRDatastoreResponse::parseSuccess(QIODevice &response) { //Q_D(DescribeFHIRDatastoreResponse); QXmlStreamReader xml(&response); /// @todo } /*! * \class QtAws::HealthLake::DescribeFHIRDatastoreResponsePrivate * \brief The DescribeFHIRDatastoreResponsePrivate class provides private implementation for DescribeFHIRDatastoreResponse. * \internal * * \inmodule QtAwsHealthLake */ /*! * Constructs a DescribeFHIRDatastoreResponsePrivate object with public implementation \a q. */ DescribeFHIRDatastoreResponsePrivate::DescribeFHIRDatastoreResponsePrivate( DescribeFHIRDatastoreResponse * const q) : HealthLakeResponsePrivate(q) { } /*! * Parses a HealthLake DescribeFHIRDatastore response element from \a xml. */ void DescribeFHIRDatastoreResponsePrivate::parseDescribeFHIRDatastoreResponse(QXmlStreamReader &xml) { Q_ASSERT(xml.name() == QLatin1String("DescribeFHIRDatastoreResponse")); Q_UNUSED(xml) ///< @todo } } // namespace HealthLake } // namespace QtAws
pcolby/libqtaws
src/healthlake/describefhirdatastoreresponse.cpp
C++
lgpl-3.0
3,169
/* =========================================================================== Doom 3 GPL Source Code Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?). Doom 3 Source Code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Doom 3 Source Code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>. In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. =========================================================================== */ #ifndef __GAME_PROJECTILE_H__ #define __GAME_PROJECTILE_H__ /* =============================================================================== idProjectile =============================================================================== */ extern const idEventDef EV_Explode; class idProjectile : public idEntity { public : CLASS_PROTOTYPE( idProjectile ); idProjectile(); virtual ~idProjectile(); void Spawn( void ); void Save( idSaveGame *savefile ) const; void Restore( idRestoreGame *savefile ); void Create( idEntity *owner, const idVec3 &start, const idVec3 &dir ); virtual void Launch( const idVec3 &start, const idVec3 &dir, const idVec3 &pushVelocity, const float timeSinceFire = 0.0f, const float launchPower = 1.0f, const float dmgPower = 1.0f ); virtual void FreeLightDef( void ); idEntity *GetOwner( void ) const; virtual void Think( void ); virtual void Killed( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location ); virtual bool Collide( const trace_t &collision, const idVec3 &velocity ); virtual void Explode( const trace_t &collision, idEntity *ignore ); void Fizzle( void ); static idVec3 GetVelocity( const idDict *projectile ); static idVec3 GetGravity( const idDict *projectile ); enum { EVENT_DAMAGE_EFFECT = idEntity::EVENT_MAXEVENTS, EVENT_MAXEVENTS }; static void DefaultDamageEffect( idEntity *soundEnt, const idDict &projectileDef, const trace_t &collision, const idVec3 &velocity ); static bool ClientPredictionCollide( idEntity *soundEnt, const idDict &projectileDef, const trace_t &collision, const idVec3 &velocity, bool addDamageEffect ); virtual void ClientPredictionThink( void ); virtual void WriteToSnapshot( idBitMsgDelta &msg ) const; virtual void ReadFromSnapshot( const idBitMsgDelta &msg ); virtual bool ClientReceiveEvent( int event, int time, const idBitMsg &msg ); protected: idEntityPtr<idEntity> owner; struct projectileFlags_s { bool detonate_on_world : 1; bool detonate_on_actor : 1; bool randomShaderSpin : 1; bool isTracer : 1; bool noSplashDamage : 1; } projectileFlags; float thrust; int thrust_end; float damagePower; renderLight_t renderLight; qhandle_t lightDefHandle; // handle to renderer light def idVec3 lightOffset; int lightStartTime; int lightEndTime; idVec3 lightColor; idForce_Constant thruster; idPhysics_RigidBody physicsObj; const idDeclParticle *smokeFly; int smokeFlyTime; typedef enum { // must update these in script/doom_defs.script if changed SPAWNED = 0, CREATED = 1, LAUNCHED = 2, FIZZLED = 3, EXPLODED = 4 } projectileState_t; projectileState_t state; private: bool netSyncPhysics; void AddDefaultDamageEffect( const trace_t &collision, const idVec3 &velocity ); void Event_Explode( void ); void Event_Fizzle( void ); void Event_RadiusDamage( idEntity *ignore ); void Event_Touch( idEntity *other, trace_t *trace ); void Event_GetProjectileState( void ); }; class idGuidedProjectile : public idProjectile { public : CLASS_PROTOTYPE( idGuidedProjectile ); idGuidedProjectile( void ); ~idGuidedProjectile( void ); void Save( idSaveGame *savefile ) const; void Restore( idRestoreGame *savefile ); void Spawn( void ); virtual void Think( void ); virtual void Launch( const idVec3 &start, const idVec3 &dir, const idVec3 &pushVelocity, const float timeSinceFire = 0.0f, const float launchPower = 1.0f, const float dmgPower = 1.0f ); protected: float speed; idEntityPtr<idEntity> enemy; virtual void GetSeekPos( idVec3 &out ); private: idAngles rndScale; idAngles rndAng; idAngles angles; int rndUpdateTime; float turn_max; float clamp_dist; bool burstMode; bool unGuided; float burstDist; float burstVelocity; }; class idSoulCubeMissile : public idGuidedProjectile { public: CLASS_PROTOTYPE( idSoulCubeMissile ); ~idSoulCubeMissile(); void Save( idSaveGame *savefile ) const; void Restore( idRestoreGame *savefile ); void Spawn( void ); virtual void Think( void ); virtual void Launch( const idVec3 &start, const idVec3 &dir, const idVec3 &pushVelocity, const float timeSinceFire = 0.0f, const float power = 1.0f, const float dmgPower = 1.0f ); protected: virtual void GetSeekPos( idVec3 &out ); void ReturnToOwner( void ); void KillTarget( const idVec3 &dir ); private: idVec3 startingVelocity; idVec3 endingVelocity; float accelTime; int launchTime; bool killPhase; bool returnPhase; idVec3 destOrg; idVec3 orbitOrg; int orbitTime; int smokeKillTime; const idDeclParticle *smokeKill; }; struct beamTarget_t { idEntityPtr<idEntity> target; renderEntity_t renderEntity; qhandle_t modelDefHandle; }; class idBFGProjectile : public idProjectile { public : CLASS_PROTOTYPE( idBFGProjectile ); idBFGProjectile(); ~idBFGProjectile(); void Save( idSaveGame *savefile ) const; void Restore( idRestoreGame *savefile ); void Spawn( void ); virtual void Think( void ); virtual void Launch( const idVec3 &start, const idVec3 &dir, const idVec3 &pushVelocity, const float timeSinceFire = 0.0f, const float launchPower = 1.0f, const float dmgPower = 1.0f ); virtual void Explode( const trace_t &collision, idEntity *ignore ); private: idList<beamTarget_t> beamTargets; renderEntity_t secondModel; qhandle_t secondModelDefHandle; int nextDamageTime; idStr damageFreq; void FreeBeams(); void Event_RemoveBeams(); void ApplyDamage(); }; /* =============================================================================== idDebris =============================================================================== */ class idDebris : public idEntity { public : CLASS_PROTOTYPE( idDebris ); idDebris(); ~idDebris(); // save games void Save( idSaveGame *savefile ) const; // archives object for save game file void Restore( idRestoreGame *savefile ); // unarchives object from save game file void Spawn( void ); void Create( idEntity *owner, const idVec3 &start, const idMat3 &axis ); void Launch( void ); void Think( void ); void Killed( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location ); void Explode( void ); void Fizzle( void ); virtual bool Collide( const trace_t &collision, const idVec3 &velocity ); private: idEntityPtr<idEntity> owner; idPhysics_RigidBody physicsObj; const idDeclParticle *smokeFly; int smokeFlyTime; const idSoundShader *sndBounce; void Event_Explode( void ); void Event_Fizzle( void ); }; #endif /* !__GAME_PROJECTILE_H__ */
revelator/Revelation
Doom3/Extras/ModSources/sikkmod/game/Projectile.h
C
lgpl-3.0
8,425
#!/bin/bash # declaration (affectation) d'une variable STRING="Bonjour ... a tous. C'est mon premier script c'est facile!" # Afficher la variable echo $STRING #faire chmod +x script.sh pour le rendre executable
floslm/snipet
start/script.sh
Shell
lgpl-3.0
211
#include "p_rectifytovector.h" /*! * \brief RectifyToVector::init */ void RectifyToVector::init(){ //set plugin meta data this->metaData.name = "RectifyToVector"; this->metaData.pluginName = "OpenIndy Default Plugin"; this->metaData.author = "bra"; this->metaData.description = QString("%1") .arg("This function changes the orientation of a geometry according to the specified direction."); this->metaData.iid = ObjectTransformation_iidd; //set needed elements NeededElement param1; param1.description = "Select a direction used for the orientation of the target geometry."; param1.infinite = false; param1.typeOfElement = eDirectionElement; this->neededElements.append(param1); NeededElement param2; param2.description = "Select a station used for the orientation of the target geometry."; param2.infinite = false; param2.typeOfElement = eStationElement; this->neededElements.append(param2); NeededElement param3; param3.description = "Select a coordinate system used for the orientation of the target geometry."; param3.infinite = false; param3.typeOfElement = eCoordinateSystemElement; this->neededElements.append(param3); //set spplicable for this->applicableFor.append(ePlaneFeature); this->applicableFor.append(eCircleFeature); //set string parameter this->stringParameters.insert("rectify to station / coordinate system", "xAxis"); this->stringParameters.insert("rectify to station / coordinate system", "yAxis"); this->stringParameters.insert("rectify to station / coordinate system", "zAxis"); this->stringParameters.insert("sense", "negative"); this->stringParameters.insert("sense", "positive"); } /*! * \brief RectifyToVector::exec * \param plane * \return */ bool RectifyToVector::exec(Plane &plane){ return this->setUpResult(plane); } /*! * \brief RectifyToVector::exec * \param circle * \return */ bool RectifyToVector::exec(Circle &circle){ return this->setUpResult(circle); } /*! * \brief RectifyToVector::exec * \param line * \return */ bool RectifyToVector::exec(Line &line) { return this->setUpResult(line); } /*! * \brief RectifyToVector::exec * \param cylinder * \return */ bool RectifyToVector::exec(Cylinder &cylinder) { return this->setUpResult(cylinder); } /*! * \brief RectifyToPoint::direction * \param direction * \return if valid direction was found */ bool RectifyToVector::direction(OiVec &direction) { // 1. get and check position of rectify geometry if available if(this->inputElements.contains(0) && this->inputElements[0].size() == 1){ QPointer<Geometry> rectifyGeometry = this->inputElements[0].at(0).geometry; if(!rectifyGeometry.isNull() && rectifyGeometry->getIsSolved() && rectifyGeometry->hasDirection()){ direction = rectifyGeometry->getDirection().getVector(); return true; } } else if(this->inputElements.contains(1) && this->inputElements[1].size() == 1) { // 2. get and check position of rectify station if available QPointer<Station> rectifyStation = this->inputElements[1].at(0).station; if(!rectifyStation.isNull()) { switch(axis()) { case eXAxis: direction = rectifyStation->getXAxis().getVector(); return true; case eYAxis: direction = rectifyStation->getYAxis().getVector(); return true; case eZAxis: direction = rectifyStation->getZAxis().getVector(); return true; } } } else if(this->inputElements.contains(2) && this->inputElements[2].size() == 1) { // 3. get and check position of rectify station if available QPointer<CoordinateSystem> rectifyCoordinateSystem = this->inputElements[2].at(0).coordSystem; if(!rectifyCoordinateSystem.isNull()) { switch(axis()) { case eXAxis: direction = rectifyCoordinateSystem->getXAxis().getVector(); return true; case eYAxis: direction = rectifyCoordinateSystem->getYAxis().getVector(); return true; case eZAxis: direction = rectifyCoordinateSystem->getZAxis().getVector(); return true; } } } return false; } Axis RectifyToVector::axis() { if(this->scalarInputParams.stringParameter.contains("rectify to station / coordinate system")){ if(this->scalarInputParams.stringParameter.value("rectify to station / coordinate system").compare("xAxis") == 0){ return Axis::eXAxis; } else if(this->scalarInputParams.stringParameter.value("rectify to station / coordinate system").compare("yAxis") == 0){ return Axis::eYAxis; } else if(this->scalarInputParams.stringParameter.value("rectify to station / coordinate system").compare("zAxis") == 0){ return Axis::eZAxis; } } return Axis::eZAxis; } /*! * \brief RectifyToVector::setUpResult * \param plane * \return */ bool RectifyToVector::setUpResult(Geometry &geometry){ OiVec r_reference; if(!direction(r_reference)) { return false; } //get the sense (positive or negative) double sense = 1.0; if(this->scalarInputParams.stringParameter.contains("sense")){ if(this->scalarInputParams.stringParameter.value("sense").compare("negative") == 0){ sense = -1.0; } } //get the direction to compare r_reference.normalize(); OiVec r = geometry.getDirection().getVector(); r.normalize(); //calculate the angle between both directions double angle = 0.0; OiVec::dot(angle, r_reference, r); angle = qAbs(qAcos(angle)); //invert the normal vector if the angle is greater than 90° if(angle > PI/2.0){ r = -1.0 * r; } //invert the normal vector if sense is negative r = sense * r; //set result Direction direction = geometry.getDirection(); direction.setVector(r); geometry.setDirection(direction); return true; }
OpenIndy/OpenIndy-DefaultPlugin
functions/objectTransformation/p_rectifytovector.cpp
C++
lgpl-3.0
6,214
#pragma once #include <QTreeWidget> #include <QKeyEvent> class QAdvancedTreeWidget: public QTreeWidget { Q_OBJECT public: signals: void keyPress(QAdvancedTreeWidget*, QKeyEvent*); protected: virtual void keyPressEvent(QKeyEvent*); };
bokic/mkfusion
src/cfeditor/qadvancedtreewidget.h
C
lgpl-3.0
248
/** * generated by Xtext 2.23.0 */ package fr.polytech.si5.dsl.arduino.arduinoML; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Sensor</b></em>'. * <!-- end-user-doc --> * * * @see fr.polytech.si5.dsl.arduino.arduinoML.ArduinoMLPackage#getSensor() * @model * @generated */ public interface Sensor extends Brick { } // Sensor
mosser/ArduinoML-kernel
externals/xtext/fr.polytech.si5.dsl.arduino/src-gen/fr/polytech/si5/dsl/arduino/arduinoML/Sensor.java
Java
lgpl-3.0
369
from cqparts.constraint import Mate, Coincident from .base import Fastener from ..screws import Screw from ..utils import VectorEvaluator, Selector, Applicator class ScrewFastener(Fastener): """ Screw fastener assembly. Example usage can be found here: :ref:`cqparts_fasteners.built-in.screw` """ Evaluator = VectorEvaluator class Selector(Selector): ratio = 0.8 def get_components(self): end_effect = self.evaluator.eval[-1] end_point = end_effect.start_point + (end_effect.end_point - end_effect.start_point) * self.ratio return {'screw': Screw( head=('countersunk', { 'diameter': 9.5, 'height': 3.5, }), neck_length=abs(self.evaluator.eval[-1].start_point - self.evaluator.eval[0].start_point), # only the length after the neck is threaded length=abs(end_point - self.evaluator.eval[0].start_point), #length=abs(self.evaluator.eval[-1].end_point - self.evaluator.eval[0].start_point), )} def get_constraints(self): # bind fastener relative to its anchor; the part holding it in. anchor_part = self.evaluator.eval[-1].part # last effected part return [Coincident( self.components['screw'].mate_origin, Mate(anchor_part, self.evaluator.eval[0].start_coordsys - anchor_part.world_coords) )] class Applicator(Applicator): def apply_alterations(self): screw = self.selector.components['screw'] cutter = screw.make_cutter() # cutter in local coords for effect in self.evaluator.eval: relative_coordsys = screw.world_coords - effect.part.world_coords local_cutter = relative_coordsys + cutter effect.part.local_obj = effect.part.local_obj.cut(local_cutter)
jmwright/cadquery-freecad-module
ThirdParty/cqparts_fasteners/fasteners/screw.py
Python
lgpl-3.0
1,975
/* * This class was automatically generated with * <a href="http://www.castor.org">Castor 1.3.1</a>, using an XML * Schema. * $Id: ClearedStatusType.java,v 1.1.1.1 2010-05-04 22:06:02 ryan Exp $ */ package org.chocolate_milk.model.types; /** * Enumeration ClearedStatusType. * * @version $Revision: 1.1.1.1 $ $Date: 2010-05-04 22:06:02 $ */ public enum ClearedStatusType { //------------------/ //- Enum Constants -/ //------------------/ /** * Constant CLEARED */ CLEARED("Cleared"), /** * Constant NOTCLEARED */ NOTCLEARED("NotCleared"), /** * Constant PENDING */ PENDING("Pending"); //--------------------------/ //- Class/Member Variables -/ //--------------------------/ /** * Field value. */ private final java.lang.String value; /** * Field enumConstants. */ private static final java.util.Map<java.lang.String, ClearedStatusType> enumConstants = new java.util.HashMap<java.lang.String, ClearedStatusType>(); static { for (ClearedStatusType c: ClearedStatusType.values()) { ClearedStatusType.enumConstants.put(c.value, c); } }; //----------------/ //- Constructors -/ //----------------/ private ClearedStatusType(final java.lang.String value) { this.value = value; } //-----------/ //- Methods -/ //-----------/ /** * Method fromValue. * * @param value * @return the constant for this value */ public static org.chocolate_milk.model.types.ClearedStatusType fromValue( final java.lang.String value) { ClearedStatusType c = ClearedStatusType.enumConstants.get(value); if (c != null) { return c; } throw new IllegalArgumentException(value); } /** * * * @param value */ public void setValue( final java.lang.String value) { } /** * Method toString. * * @return the value of this constant */ public java.lang.String toString( ) { return this.value; } /** * Method value. * * @return the value of this constant */ public java.lang.String value( ) { return this.value; } }
galleon1/chocolate-milk
src/org/chocolate_milk/model/types/ClearedStatusType.java
Java
lgpl-3.0
2,338
/** Copyright (C) Atiyah Elsheikh (Atiyah.Elsheikh@ait.ac.at,a.m.g.Elsheikh@gmail.com) 2014,2015 AIT Austrian Institute of Technology GmbH This file is part of the software blackboxParadisEO blackboxParadisEO is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. blackboxParadisEO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with blackboxParadisEO. If not, see <http://www.gnu.org/licenses/> */ /** * \file main_population.cpp * * Main driver for testing population-based search * * @author: Atiyah Elsheikh * @date: Jan. 2015 * @last changes: Jan. 2015 */ // declaration of the namespace using namespace std; // the general include for eo #include <eo> // include for NLP #include "remo/moRealTypes.h" #include "reeo/src/algo/PopulationSearchManager.h" // objective functions #include "objfunc/simple/SimpleObj.h" //#include "objfunc/griewank/Griewank.h" //#include "objfunc/rastrigin/Rastrigin.h" #include "objfunc/rosenbrock/Rosenbrock.h" //typedef SimpleObj ObjFunc; //typedef Griewank ObjFunc; //typedef Rastrigin ObjFunc; typedef Rosenbrock ObjFunc; // include for solution initialization #include "util/Utilities.h" void main_function(int argc, char **argv) { vector<double> lowBound(10,-100); vector<double> uppBound(10,100); unsigned int seed = time(0); PopulationSearchManagerSGA<ObjFunc> gamanager(lowBound,uppBound,50,100000,seed,0.8,0.5); gamanager.setSteadySC(10,50); gamanager.setSegmentCrossover(1.0); gamanager.setHypercubeCrossover(1.0); gamanager.setUniformMutation(0.01,0.5); gamanager.setDetUniformMutation(0.1,0.5); gamanager.setNormalMutation(1,0.5); gamanager.setNormalMutation(0.1,0.5); gamanager.setNormalMutation(0.01,0.5); //gamanager.setTournamentSelect(); // default //gamanager.setProportionalSelect(); //gamanager.setStochTournamentSelect(0.99); //gamanager.setRandomSelect(); gamanager.init(3); gamanager.run(); PopulationSearchManagerEA<ObjFunc> eamanager(lowBound,uppBound,50,100000,seed,0.8,0.5); eamanager.setSteadySC(10,50); eamanager.setSegmentCrossover(1.0); eamanager.setHypercubeCrossover(1.0); eamanager.setUniformMutation(0.01,0.5); eamanager.setDetUniformMutation(0.1,0.5); eamanager.setNormalMutation(1,0.5); eamanager.setNormalMutation(0.1,0.5); eamanager.setNormalMutation(0.01,0.5); //eamanager.setTournamentSelect(); // default //eamanager.setProportionalSelect(); //eamanager.setStochTournamentSelect(0.99); //eamanager.setRandomSelect(); eamanager.setCommaReplacement(); //eamanager.setPlusReplacement(); //eamanager.setEPReplacement(5); // eamanager.setSSGAWorseReplacement(); //eamanager.setSSGADetTournamentReplacement(5); //eamanager.setSSGAStochTournamentReplacement(0.5); // eamanager.setSurviveAndDieReplacement(0.5,0.5); eamanager.init(3,1.0); eamanager.run(); } // A main that catches the exceptions int main(int argc, char **argv) { try { main_function(argc, argv); } catch (exception& e) { cout << "Exception: " << e.what() << '\n'; } return 1; }
AIT-CES/blackboxParadisEO
examples/05populationSearch/main_population.cpp
C++
lgpl-3.0
3,579
/* * invoke_instructions.h * * Copyright (c) 2008-2010 CSIRO, Delft University of Technology. * * This file is part of Darjeeling. * * Darjeeling is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Darjeeling is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with Darjeeling. If not, see <http://www.gnu.org/licenses/>. */ /** * Return from function */ static inline void RETURN() { // return returnFromMethod(); } /** * Return from short/byte/boolean/char function */ static inline void SRETURN() { // pop return value off the stack int16_t ret = popShort(); // return returnFromMethod(); // push return value on the runtime stack pushShort(ret); } /** * Return from int function */ static inline void IRETURN() { // pop return value off the stack int32_t ret = popInt(); // return returnFromMethod(); // push return value on the runtime stack pushInt(ret); } /** * Return from long function */ static inline void LRETURN() { // pop return value off the stack int64_t ret = popLong(); // return returnFromMethod(); // push return value on the runtime stack pushLong(ret); } static inline void ARETURN() { // pop return value off the stack ref_t ret = popRef(); // return returnFromMethod(); // push return value on the runtime stack pushRef(ret); } static inline void INVOKESTATIC() { dj_local_id localId = dj_fetchLocalId(); dj_global_id globalId = dj_global_id_resolve(dj_exec_getCurrentInfusion(), localId); callMethod(globalId, false); } static inline void INVOKESPECIAL() { dj_local_id localId = dj_fetchLocalId(); dj_global_id globalId = dj_global_id_resolve(dj_exec_getCurrentInfusion(), localId); callMethod(globalId, true); } static inline void INVOKEVIRTUAL() { // fetch the method definition's global id and resolve it dj_local_id dj_local_id = dj_fetchLocalId(); // fetch the number of arguments for the method. uint8_t nr_ref_args = fetch(); // peek the object on the stack dj_object *object = REF_TO_VOIDP(peekDeepRef(nr_ref_args)); // if null, throw exception if (object==NULL) { dj_exec_createAndThrow(BASE_CDEF_java_lang_NullPointerException); return; } // check if the object is still valid if (dj_object_getRuntimeId(object)==CHUNKID_INVALID) { dj_exec_createAndThrow(BASE_CDEF_javax_darjeeling_vm_ClassUnloadedException); return; } dj_global_id resolvedMethodDefId = dj_global_id_resolve(dj_exec_getCurrentInfusion(), dj_local_id); DEBUG_LOG(">>>>> invokevirtual METHOD DEF %x.%d\n", resolvedMethodDefId.infusion, resolvedMethodDefId.entity_id); // lookup the virtual method dj_global_id methodImplId = dj_global_id_lookupVirtualMethod(resolvedMethodDefId, object); DEBUG_LOG(">>>>> invokevirtual METHOD IMPL %x.%d\n", methodImplId.infusion, methodImplId.entity_id); // check if method not found, and throw an error if this is the case. else, invoke the method if (methodImplId.infusion==NULL) { DEBUG_LOG("methodImplId.infusion is NULL at INVOKEVIRTUAL %p.%d\n", resolvedMethodDefId.infusion, resolvedMethodDefId.entity_id); dj_exec_throwHere(dj_vm_createSysLibObject(dj_exec_getVM(), BASE_CDEF_java_lang_VirtualMachineError)); } else { callMethod(methodImplId, true); } } static inline void INVOKEINTERFACE() { INVOKEVIRTUAL(); }
RWTH-OS/ostfriesentee
vm/src/invoke_instructions.h
C
lgpl-3.0
3,758
corsec_major = Creature:new { objectName = "@mob/creature_names:corsec_major", socialGroup = "corsec", pvpFaction = "corsec", faction = "corsec", level = 24, chanceHit = 0.35, damageMin = 230, damageMax = 240, baseXp = 2543, baseHAM = 6800, baseHAMmax = 8300, armor = 0, resists = {15,15,10,10,10,-1,-1,-1,-1}, meatType = "", meatAmount = 0, hideType = "", hideAmount = 0, boneType = "", boneAmount = 0, milk = 0, tamingChance = 0, ferocity = 0, pvpBitmask = ATTACKABLE, creatureBitmask = PACK + KILLER, optionsBitmask = 128, diet = HERBIVORE, templates = { "object/mobile/dressed_corsec_captain_human_female_01.iff", "object/mobile/dressed_corsec_captain_human_male_01.iff", "object/mobile/dressed_corsec_pilot_human_male_01.iff" }, lootGroups = { { groups = { {group = "junk", chance = 4000000}, {group = "corsec_weapons", chance = 2500000}, {group = "wearables_common", chance = 2000000}, {group = "tailor_components", chance = 1500000} }, lootChance = 3000000 } }, weapons = {"corsec_police_weapons"}, conversationTemplate = "", attacks = merge(brawlernovice,marksmannovice) } CreatureTemplates:addCreatureTemplate(corsec_major, "corsec_major")
kidaa/Awakening-Core3
bin/scripts/mobile/corellia/corsec_major.lua
Lua
lgpl-3.0
1,223
package repack.org.bouncycastle.crypto.params; import repack.org.bouncycastle.crypto.CipherParameters; public class RC5Parameters implements CipherParameters { private byte[] key; private int rounds; public RC5Parameters( byte[] key, int rounds) { if(key.length > 255) { throw new IllegalArgumentException("RC5 key length can be no greater than 255"); } this.key = new byte[key.length]; this.rounds = rounds; System.arraycopy(key, 0, this.key, 0, key.length); } public byte[] getKey() { return key; } public int getRounds() { return rounds; } }
SafetyCulture/DroidText
app/src/main/java/bouncycastle/repack/org/bouncycastle/crypto/params/RC5Parameters.java
Java
lgpl-3.0
590
VERSION = (1, 2, 21) def get_version(): return '%d.%d.%d'%VERSION __author__ = 'Marinho Brandao' #__date__ = '$Date: 2008-07-26 14:04:51 -0300 (Ter, 26 Fev 2008) $'[7:-2] __license__ = 'GNU Lesser General Public License (LGPL)' __url__ = 'http://django-plus.googlecode.com' __version__ = get_version() def get_dynamic_template(slug, context=None): from models import DynamicTemplate return DynamicTemplate.objects.get(slug=slug).render(context or {})
marinho/django-plus
djangoplus/__init__.py
Python
lgpl-3.0
468
package org.fenixedu.learning.domain.degree.components; import static com.google.common.collect.ImmutableMap.of; import static java.util.stream.Collectors.groupingBy; import static java.util.stream.Collectors.toCollection; import static org.fenixedu.academic.domain.ExecutionSemester.readActualExecutionSemester; import static org.fenixedu.academic.domain.SchoolClass.COMPARATOR_BY_NAME; import static org.fenixedu.academic.util.PeriodState.NOT_OPEN; import static org.fenixedu.academic.util.PeriodState.OPEN; import static org.fenixedu.bennu.core.security.Authenticate.getUser; import static pt.ist.fenixframework.FenixFramework.getDomainObject; import java.util.Set; import java.util.SortedMap; import java.util.TreeMap; import java.util.function.Predicate; import org.fenixedu.academic.domain.Degree; import org.fenixedu.academic.domain.DegreeCurricularPlan; import org.fenixedu.academic.domain.ExecutionSemester; import org.fenixedu.academic.domain.Person; import org.fenixedu.academic.domain.SchoolClass; import org.fenixedu.academic.domain.person.RoleType; import org.fenixedu.academic.dto.InfoDegree; import org.fenixedu.cms.domain.Page; import org.fenixedu.cms.domain.component.ComponentType; import org.fenixedu.cms.rendering.TemplateContext; import com.google.common.collect.Sets; /** * Created by borgez on 10/9/14. */ @ComponentType(name = "Degree classes", description = "Schedule of a class") public class DegreeClassesComponent extends DegreeSiteComponent { @Override public void handle(Page page, TemplateContext componentContext, TemplateContext global) { Degree degree = degree(page); global.put("degreeInfo", InfoDegree.newInfoFromDomain(degree)); ExecutionSemester selectedSemester = getExecutionSemester(global.getRequestContext()); ExecutionSemester otherSemester = getOtherExecutionSemester(selectedSemester); SortedMap<Integer, Set<SchoolClass>> selectedClasses = classesByCurricularYear(degree, selectedSemester); SortedMap<Integer, Set<SchoolClass>> nextClasses = classesByCurricularYear(degree, otherSemester); global.put("classesByCurricularYearAndSemesters", of(selectedSemester, selectedClasses, otherSemester, nextClasses)); } private SortedMap<Integer, Set<SchoolClass>> classesByCurricularYear(Degree degree, ExecutionSemester semester) { DegreeCurricularPlan plan = degree.getMostRecentDegreeCurricularPlan(); Predicate<SchoolClass> predicate = schoolClass -> schoolClass.getExecutionDegree().getDegreeCurricularPlan() == plan; return semester .getSchoolClassesSet() .stream() .filter(predicate) .collect( groupingBy(SchoolClass::getAnoCurricular, TreeMap::new, toCollection(() -> Sets.newTreeSet(COMPARATOR_BY_NAME)))); } private ExecutionSemester getOtherExecutionSemester(ExecutionSemester semester) { ExecutionSemester next = semester.getNextExecutionPeriod(); return canViewNextExecutionSemester(next) ? next : semester.getPreviousExecutionPeriod(); } private boolean canViewNextExecutionSemester(ExecutionSemester nextExecutionSemester) { Predicate<Person> hasPerson = person -> person != null; Predicate<Person> isCoordinator = person -> RoleType.COORDINATOR.isMember(person.getUser()); Predicate<Person> isManager = person -> RoleType.RESOURCE_ALLOCATION_MANAGER.isMember(person.getUser()); return nextExecutionSemester.getState() == OPEN || (nextExecutionSemester.getState() == NOT_OPEN && getUser() != null && hasPerson.and( isManager.or(isCoordinator)).test(getUser().getPerson())); } private ExecutionSemester getExecutionSemester(String[] requestContext) { return requestContext.length > 2 ? getDomainObject(requestContext[1]) : readActualExecutionSemester(); } }
pedrosan7os/fenixedu-learning
src/main/java/org/fenixedu/learning/domain/degree/components/DegreeClassesComponent.java
Java
lgpl-3.0
3,965
/*----------------------------------------------------------------------*/ /* modul : basetype.h */ /* description: interface */ /* */ /* author : Siemens AG, Bensheim */ /* date : unknown */ /* changed by : Alireza Esmailpour */ /* date : 04.11.1994 */ /* */ /* changed by : Matthias Block */ /* date : 21.12.1999 */ /* change : Zusaetzliche Konstante "NO_MEMORY" fuer die */ /* Speicherverwaltung der Previews eingefuegt */ /*----------------------------------------------------------------------*/ #ifndef _BASETYPE_H_ #define _BASETYPE_H_ /*----------------------------------------------------------------------*/ /* common defines used by ordinary C-programmers */ /*----------------------------------------------------------------------*/ #ifndef SUCCESS #define SUCCESS (0) #endif #ifndef FAILURE #define FAILURE (-1) #endif #ifndef FOREVER #define FOREVER for(;;) #endif #ifndef NIL #define NIL (-1) #endif #ifndef NO_MEMORY #define NO_MEMORY (-2) #endif /*----------------------------------------------------------------------*/ /* defines */ /*----------------------------------------------------------------------*/ #define SHL(j,c) ((j)<<(c)) #define SHR(j,c) ((j)>>(c)) #define ADDR(var) (Pointer) &(var) #define OR || #define AND && #define XOR ^ #define MOD % #define DIV / #define NOT(arg) (! (arg)) #define NEG(arg) (~ (arg)) /*----------------------------------------------------------------------*/ /* datatypes */ /*----------------------------------------------------------------------*/ /* typedef char* String; */ typedef unsigned char uByte; /* typedef signed char sByte; */ typedef unsigned short uWord; typedef short sWord; typedef unsigned long uDoubleWord; typedef long sDoubleWord; typedef double ExtendedReal; typedef uByte* Pointer; typedef Pointer* Handle; /*----------------------------------------------------------------------*/ /* Constants */ /*----------------------------------------------------------------------*/ #define kMaxuByte 0xFF #define kMaxsByte 0x7F #define kMaxuWord 0xFFFF #define kMaxsWord 0x7FFF #define kMaxuDoubleWord 0xFFFFFFFFUL #define kMaxsDoubleWord 0x7FFFFFFFL #define kMaxReal 3.37E+38 #define kMinReal 8.43E-37 #define kEpsReal 1.19209290E-07F #define kMaxExtendedReal 1.797693E+308 #define kMinExtendedReal 2.225074E-308 #define kEpsExtendedReal 2.2204460492503131E-16 #endif /* _BASETYPE_H_ */
vogechri/PRSM
SceneFlowCode/CPP/Math/basetype.h
C
lgpl-3.0
3,304
# Generated by Django 2.2.6 on 2019-10-31 08:31 from django.db import migrations, models import multiselectfield.db.fields class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Book', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('title', models.CharField(max_length=200)), ('categories', multiselectfield.db.fields.MultiSelectField(choices=[(1, 'Handbooks and manuals by discipline'), (2, 'Business books'), (3, 'Books of literary criticism'), (4, 'Books about literary theory'), (5, 'Books about literature')], default=1, max_length=9)), ('tags', multiselectfield.db.fields.MultiSelectField(blank=True, choices=[('sex', 'Sex'), ('work', 'Work'), ('happy', 'Happy'), ('food', 'Food'), ('field', 'Field'), ('boring', 'Boring'), ('interesting', 'Interesting'), ('huge', 'Huge'), ('nice', 'Nice')], max_length=54, null=True)), ('published_in', multiselectfield.db.fields.MultiSelectField(choices=[('Canada - Provinces', (('AB', 'Alberta'), ('BC', 'British Columbia'))), ('USA - States', (('AK', 'Alaska'), ('AL', 'Alabama'), ('AZ', 'Arizona')))], max_length=2, verbose_name='Province or State')), ('chapters', multiselectfield.db.fields.MultiSelectField(choices=[(1, 'Chapter I'), (2, 'Chapter II')], default=1, max_length=3)), ], ), ]
goinnn/django-multiselectfield
example/app/migrations/0001_initial.py
Python
lgpl-3.0
1,535
<?php /** * This file is part of the highcharts-bundle package. * * (c) 2017 WEBEWEB * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace WBW\Bundle\HighchartsBundle\Tests\API\Chart\Series\Pyramid; use WBW\Bundle\HighchartsBundle\Tests\AbstractTestCase; /** * Highcharts tooltip test. * * @author webeweb <https://github.com/webeweb/> * @package WBW\Bundle\HighchartsBundle\Tests\API\Chart\Series\Pyramid * @version 5.0.14 */ final class HighchartsTooltipTest extends AbstractTestCase { /** * Tests the __construct() method. * * @return void */ public function testConstructor() { $obj1 = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Pyramid\HighchartsTooltip(true); $this->assertNull($obj1->getDateTimeLabelFormats()); $this->assertNull($obj1->getFollowPointer()); $this->assertNull($obj1->getFollowTouchMove()); $this->assertNull($obj1->getFooterFormat()); $this->assertNull($obj1->getHeaderFormat()); $this->assertNull($obj1->getHideDelay()); $this->assertNull($obj1->getPadding()); $this->assertNull($obj1->getPointFormat()); $this->assertNull($obj1->getPointFormatter()); $this->assertNull($obj1->getSplit()); $this->assertNull($obj1->getValueDecimals()); $this->assertNull($obj1->getValuePrefix()); $this->assertNull($obj1->getValueSuffix()); $this->assertNull($obj1->getXDateFormat()); $obj0 = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Pyramid\HighchartsTooltip(false); $this->assertNull($obj0->getDateTimeLabelFormats()); $this->assertEquals(false, $obj0->getFollowPointer()); $this->assertEquals(true, $obj0->getFollowTouchMove()); $this->assertEquals("false", $obj0->getFooterFormat()); $this->assertNull($obj0->getHeaderFormat()); $this->assertEquals(500, $obj0->getHideDelay()); $this->assertEquals(8, $obj0->getPadding()); $this->assertEquals("<span style=\"color:{point.color}\">\\u25CF</span> {series.name}: <b>{point.y}</b><br/>", $obj0->getPointFormat()); $this->assertNull($obj0->getPointFormatter()); $this->assertEquals(false, $obj0->getSplit()); $this->assertNull($obj0->getValueDecimals()); $this->assertNull($obj0->getValuePrefix()); $this->assertNull($obj0->getValueSuffix()); $this->assertNull($obj0->getXDateFormat()); } /** * Tests the jsonSerialize() method. * * @return void */ public function testJsonSerialize() { $obj = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Pyramid\HighchartsTooltip(true); $this->assertEquals([], $obj->jsonSerialize()); } /** * Tests the toArray() method. * * @return void */ public function testToArray() { $obj = new \WBW\Bundle\HighchartsBundle\API\Chart\Series\Pyramid\HighchartsTooltip(true); $obj->setDateTimeLabelFormats(["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"]); $res1 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"]]; $this->assertEquals($res1, $obj->toArray()); $obj->setFollowPointer(0); $res2 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0]; $this->assertEquals($res2, $obj->toArray()); $obj->setFollowTouchMove(1); $res3 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1]; $this->assertEquals($res3, $obj->toArray()); $obj->setFooterFormat("1ac32e030fc5ef01e703d5419170690e"); $res4 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1, "footerFormat" => "1ac32e030fc5ef01e703d5419170690e"]; $this->assertEquals($res4, $obj->toArray()); $obj->setHeaderFormat("937148825f6c7c8ed3376d1834b17ac6"); $res5 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1, "footerFormat" => "1ac32e030fc5ef01e703d5419170690e", "headerFormat" => "937148825f6c7c8ed3376d1834b17ac6"]; $this->assertEquals($res5, $obj->toArray()); $obj->setHideDelay(74); $res6 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1, "footerFormat" => "1ac32e030fc5ef01e703d5419170690e", "headerFormat" => "937148825f6c7c8ed3376d1834b17ac6", "hideDelay" => 74]; $this->assertEquals($res6, $obj->toArray()); $obj->setPadding(48); $res7 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1, "footerFormat" => "1ac32e030fc5ef01e703d5419170690e", "headerFormat" => "937148825f6c7c8ed3376d1834b17ac6", "hideDelay" => 74, "padding" => 48]; $this->assertEquals($res7, $obj->toArray()); $obj->setPointFormat("332dd3de68dc71de0745837cbc13e217"); $res8 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1, "footerFormat" => "1ac32e030fc5ef01e703d5419170690e", "headerFormat" => "937148825f6c7c8ed3376d1834b17ac6", "hideDelay" => 74, "padding" => 48, "pointFormat" => "332dd3de68dc71de0745837cbc13e217"]; $this->assertEquals($res8, $obj->toArray()); $obj->setPointFormatter("d0b51d7b9a5189f718d161b366d33044"); $res9 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1, "footerFormat" => "1ac32e030fc5ef01e703d5419170690e", "headerFormat" => "937148825f6c7c8ed3376d1834b17ac6", "hideDelay" => 74, "padding" => 48, "pointFormat" => "332dd3de68dc71de0745837cbc13e217", "pointFormatter" => "d0b51d7b9a5189f718d161b366d33044"]; $this->assertEquals($res9, $obj->toArray()); $obj->setSplit(1); $res10 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1, "footerFormat" => "1ac32e030fc5ef01e703d5419170690e", "headerFormat" => "937148825f6c7c8ed3376d1834b17ac6", "hideDelay" => 74, "padding" => 48, "pointFormat" => "332dd3de68dc71de0745837cbc13e217", "pointFormatter" => "d0b51d7b9a5189f718d161b366d33044", "split" => 1]; $this->assertEquals($res10, $obj->toArray()); $obj->setValueDecimals(14); $res11 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1, "footerFormat" => "1ac32e030fc5ef01e703d5419170690e", "headerFormat" => "937148825f6c7c8ed3376d1834b17ac6", "hideDelay" => 74, "padding" => 48, "pointFormat" => "332dd3de68dc71de0745837cbc13e217", "pointFormatter" => "d0b51d7b9a5189f718d161b366d33044", "split" => 1, "valueDecimals" => 14]; $this->assertEquals($res11, $obj->toArray()); $obj->setValuePrefix("5fde1c8b25eb2ea19ff8377e62564818"); $res12 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1, "footerFormat" => "1ac32e030fc5ef01e703d5419170690e", "headerFormat" => "937148825f6c7c8ed3376d1834b17ac6", "hideDelay" => 74, "padding" => 48, "pointFormat" => "332dd3de68dc71de0745837cbc13e217", "pointFormatter" => "d0b51d7b9a5189f718d161b366d33044", "split" => 1, "valueDecimals" => 14, "valuePrefix" => "5fde1c8b25eb2ea19ff8377e62564818"]; $this->assertEquals($res12, $obj->toArray()); $obj->setValueSuffix("bf995908ddff004471c953d8062bd1db"); $res13 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1, "footerFormat" => "1ac32e030fc5ef01e703d5419170690e", "headerFormat" => "937148825f6c7c8ed3376d1834b17ac6", "hideDelay" => 74, "padding" => 48, "pointFormat" => "332dd3de68dc71de0745837cbc13e217", "pointFormatter" => "d0b51d7b9a5189f718d161b366d33044", "split" => 1, "valueDecimals" => 14, "valuePrefix" => "5fde1c8b25eb2ea19ff8377e62564818", "valueSuffix" => "bf995908ddff004471c953d8062bd1db"]; $this->assertEquals($res13, $obj->toArray()); $obj->setXDateFormat("e24debfa0bc8408e1dda05cbd537a072"); $res14 = ["dateTimeLabelFormats" => ["dateTimeLabelFormats" => "e9db9b38c23127a66165e1d8cefd5ad8"], "followPointer" => 0, "followTouchMove" => 1, "footerFormat" => "1ac32e030fc5ef01e703d5419170690e", "headerFormat" => "937148825f6c7c8ed3376d1834b17ac6", "hideDelay" => 74, "padding" => 48, "pointFormat" => "332dd3de68dc71de0745837cbc13e217", "pointFormatter" => "d0b51d7b9a5189f718d161b366d33044", "split" => 1, "valueDecimals" => 14, "valuePrefix" => "5fde1c8b25eb2ea19ff8377e62564818", "valueSuffix" => "bf995908ddff004471c953d8062bd1db", "xDateFormat" => "e24debfa0bc8408e1dda05cbd537a072"]; $this->assertEquals($res14, $obj->toArray()); } }
webeweb/WBWHighchartsBundle
Tests/API/Chart/Series/Pyramid/HighchartsTooltipTest.php
PHP
lgpl-3.0
9,314
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_24) on Thu Feb 09 13:37:54 GMT 2012 --> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE> Uses of Class gate.corpora.TextualDocumentFormat (GATE JavaDoc) </TITLE> <META NAME="date" CONTENT="2012-02-09"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class gate.corpora.TextualDocumentFormat (GATE JavaDoc)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../gate/corpora/TextualDocumentFormat.html" title="class in gate.corpora"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?gate/corpora//class-useTextualDocumentFormat.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="TextualDocumentFormat.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>Uses of Class<br>gate.corpora.TextualDocumentFormat</B></H2> </CENTER> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Packages that use <A HREF="../../../gate/corpora/TextualDocumentFormat.html" title="class in gate.corpora">TextualDocumentFormat</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#gate.corpora"><B>gate.corpora</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <A NAME="gate.corpora"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Uses of <A HREF="../../../gate/corpora/TextualDocumentFormat.html" title="class in gate.corpora">TextualDocumentFormat</A> in <A HREF="../../../gate/corpora/package-summary.html">gate.corpora</A></FONT></TH> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Subclasses of <A HREF="../../../gate/corpora/TextualDocumentFormat.html" title="class in gate.corpora">TextualDocumentFormat</A> in <A HREF="../../../gate/corpora/package-summary.html">gate.corpora</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;class</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../gate/corpora/EmailDocumentFormat.html" title="class in gate.corpora">EmailDocumentFormat</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The format of Documents.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;class</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../gate/corpora/NekoHtmlDocumentFormat.html" title="class in gate.corpora">NekoHtmlDocumentFormat</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DocumentFormat that uses Andy Clark's <a href="http://people.apache.org/~andyc/neko/doc/html/">NekoHTML</a> parser to parse HTML documents.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;class</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../gate/corpora/SgmlDocumentFormat.html" title="class in gate.corpora">SgmlDocumentFormat</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The format of Documents.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;class</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../gate/corpora/UimaDocumentFormat.html" title="class in gate.corpora">UimaDocumentFormat</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;UIMA XCAS and XMICAS document formats.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;class</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../gate/corpora/XmlDocumentFormat.html" title="class in gate.corpora">XmlDocumentFormat</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The format of Documents.</TD> </TR> </TABLE> &nbsp; <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../gate/corpora/TextualDocumentFormat.html" title="class in gate.corpora"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?gate/corpora//class-useTextualDocumentFormat.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="TextualDocumentFormat.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>
liuhongchao/GATE_Developer_7.0
doc/javadoc/gate/corpora/class-use/TextualDocumentFormat.html
HTML
lgpl-3.0
9,141
/***************************************************************************** * cabac.c: h264 encoder library ***************************************************************************** * Copyright (C) 2003 Laurent Aimar * $Id: cabac.c,v 1.1 2004/06/03 19:27:08 fenrir Exp $ * * Authors: Laurent Aimar <fenrir@via.ecp.fr> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************/ #include <stdio.h> #include <string.h> #include "common/common.h" #include "macroblock.h" static inline void x264_cabac_encode_ue_bypass( x264_cabac_t *cb, int exp_bits, int val ) { #ifdef RDO_SKIP_BS cb->f8_bits_encoded += ( bs_size_ue( val + (1<<exp_bits)-1 ) - exp_bits ) << 8; #else int k; for( k = exp_bits; val >= (1<<k); k++ ) { x264_cabac_encode_bypass( cb, 1 ); val -= 1 << k; } x264_cabac_encode_bypass( cb, 0 ); while( k-- ) x264_cabac_encode_bypass( cb, (val >> k)&0x01 ); #endif } static inline void x264_cabac_mb_type_intra( x264_t *h, x264_cabac_t *cb, int i_mb_type, int ctx0, int ctx1, int ctx2, int ctx3, int ctx4, int ctx5 ) { if( i_mb_type == I_4x4 || i_mb_type == I_8x8 ) { x264_cabac_encode_decision( cb, ctx0, 0 ); } else if( i_mb_type == I_PCM ) { x264_cabac_encode_decision( cb, ctx0, 1 ); x264_cabac_encode_terminal( cb, 1 ); x264_cabac_encode_flush( cb ); } else { int i_pred = x264_mb_pred_mode16x16_fix[h->mb.i_intra16x16_pred_mode]; x264_cabac_encode_decision( cb, ctx0, 1 ); x264_cabac_encode_terminal( cb, 0 ); x264_cabac_encode_decision( cb, ctx1, ( h->mb.i_cbp_luma == 0 ? 0 : 1 )); if( h->mb.i_cbp_chroma == 0 ) { x264_cabac_encode_decision( cb, ctx2, 0 ); } else { x264_cabac_encode_decision( cb, ctx2, 1 ); x264_cabac_encode_decision( cb, ctx3, ( h->mb.i_cbp_chroma == 1 ? 0 : 1 ) ); } x264_cabac_encode_decision( cb, ctx4, ( (i_pred / 2) ? 1 : 0 )); x264_cabac_encode_decision( cb, ctx5, ( (i_pred % 2) ? 1 : 0 )); } } static void x264_cabac_mb_type( x264_t *h, x264_cabac_t *cb ) { const int i_mb_type = h->mb.i_type; if( h->sh.b_mbaff && (!(h->mb.i_mb_y & 1) || IS_SKIP(h->mb.type[h->mb.i_mb_xy - h->mb.i_mb_stride])) ) { x264_cabac_encode_decision( cb, 70 + h->mb.cache.i_neighbour_interlaced, h->mb.b_interlaced ); } if( h->sh.i_type == SLICE_TYPE_I ) { int ctx = 0; if( h->mb.i_mb_type_left >= 0 && h->mb.i_mb_type_left != I_4x4 ) { ctx++; } if( h->mb.i_mb_type_top >= 0 && h->mb.i_mb_type_top != I_4x4 ) { ctx++; } x264_cabac_mb_type_intra( h, cb, i_mb_type, 3+ctx, 3+3, 3+4, 3+5, 3+6, 3+7 ); } else if( h->sh.i_type == SLICE_TYPE_P ) { /* prefix: 14, suffix: 17 */ if( i_mb_type == P_L0 ) { if( h->mb.i_partition == D_16x16 ) { x264_cabac_encode_decision( cb, 14, 0 ); x264_cabac_encode_decision( cb, 15, 0 ); x264_cabac_encode_decision( cb, 16, 0 ); } else if( h->mb.i_partition == D_16x8 ) { x264_cabac_encode_decision( cb, 14, 0 ); x264_cabac_encode_decision( cb, 15, 1 ); x264_cabac_encode_decision( cb, 17, 1 ); } else if( h->mb.i_partition == D_8x16 ) { x264_cabac_encode_decision( cb, 14, 0 ); x264_cabac_encode_decision( cb, 15, 1 ); x264_cabac_encode_decision( cb, 17, 0 ); } } else if( i_mb_type == P_8x8 ) { x264_cabac_encode_decision( cb, 14, 0 ); x264_cabac_encode_decision( cb, 15, 0 ); x264_cabac_encode_decision( cb, 16, 1 ); } else /* intra */ { /* prefix */ x264_cabac_encode_decision( cb, 14, 1 ); /* suffix */ x264_cabac_mb_type_intra( h, cb, i_mb_type, 17+0, 17+1, 17+2, 17+2, 17+3, 17+3 ); } } else if( h->sh.i_type == SLICE_TYPE_B ) { int ctx = 0; if( h->mb.i_mb_type_left >= 0 && h->mb.i_mb_type_left != B_SKIP && h->mb.i_mb_type_left != B_DIRECT ) { ctx++; } if( h->mb.i_mb_type_top >= 0 && h->mb.i_mb_type_top != B_SKIP && h->mb.i_mb_type_top != B_DIRECT ) { ctx++; } if( i_mb_type == B_DIRECT ) { x264_cabac_encode_decision( cb, 27+ctx, 0 ); } else if( i_mb_type == B_8x8 ) { x264_cabac_encode_decision( cb, 27+ctx, 1 ); x264_cabac_encode_decision( cb, 27+3, 1 ); x264_cabac_encode_decision( cb, 27+4, 1 ); x264_cabac_encode_decision( cb, 27+5, 1 ); x264_cabac_encode_decision( cb, 27+5, 1 ); x264_cabac_encode_decision( cb, 27+5, 1 ); } else if( IS_INTRA( i_mb_type ) ) { /* prefix */ x264_cabac_encode_decision( cb, 27+ctx, 1 ); x264_cabac_encode_decision( cb, 27+3, 1 ); x264_cabac_encode_decision( cb, 27+4, 1 ); x264_cabac_encode_decision( cb, 27+5, 1 ); x264_cabac_encode_decision( cb, 27+5, 0 ); x264_cabac_encode_decision( cb, 27+5, 1 ); /* suffix */ x264_cabac_mb_type_intra( h, cb, i_mb_type, 32+0, 32+1, 32+2, 32+2, 32+3, 32+3 ); } else { static const int i_mb_len[9*3] = { 6, 6, 3, /* L0 L0 */ 6, 6, 0, /* L0 L1 */ 7, 7, 0, /* L0 BI */ 6, 6, 0, /* L1 L0 */ 6, 6, 3, /* L1 L1 */ 7, 7, 0, /* L1 BI */ 7, 7, 0, /* BI L0 */ 7, 7, 0, /* BI L1 */ 7, 7, 6, /* BI BI */ }; static const int i_mb_bits[9*3][7] = { { 1,1,0,0,0,1 }, { 1,1,0,0,1,0, }, { 1,0,0 }, /* L0 L0 */ { 1,1,0,1,0,1 }, { 1,1,0,1,1,0 }, {0}, /* L0 L1 */ { 1,1,1,0,0,0,0 }, { 1,1,1,0,0,0,1 }, {0}, /* L0 BI */ { 1,1,0,1,1,1 }, { 1,1,1,1,1,0 }, {0}, /* L1 L0 */ { 1,1,0,0,1,1 }, { 1,1,0,1,0,0 }, { 1,0,1 }, /* L1 L1 */ { 1,1,1,0,0,1,0 }, { 1,1,1,0,0,1,1 }, {0}, /* L1 BI */ { 1,1,1,0,1,0,0 }, { 1,1,1,0,1,0,1 }, {0}, /* BI L0 */ { 1,1,1,0,1,1,0 }, { 1,1,1,0,1,1,1 }, {0}, /* BI L1 */ { 1,1,1,1,0,0,0 }, { 1,1,1,1,0,0,1 }, { 1,1,0,0,0,0 }, /* BI BI */ }; const int idx = (i_mb_type - B_L0_L0) * 3 + (h->mb.i_partition - D_16x8); int i; x264_cabac_encode_decision( cb, 27+ctx, i_mb_bits[idx][0] ); x264_cabac_encode_decision( cb, 27+3, i_mb_bits[idx][1] ); x264_cabac_encode_decision( cb, 27+5-i_mb_bits[idx][1], i_mb_bits[idx][2] ); for( i = 3; i < i_mb_len[idx]; i++ ) x264_cabac_encode_decision( cb, 27+5, i_mb_bits[idx][i] ); } } else { x264_log(h, X264_LOG_ERROR, "unknown SLICE_TYPE unsupported in x264_macroblock_write_cabac\n" ); } } static void x264_cabac_mb_intra4x4_pred_mode( x264_cabac_t *cb, int i_pred, int i_mode ) { if( i_pred == i_mode ) { /* b_prev_intra4x4_pred_mode */ x264_cabac_encode_decision( cb, 68, 1 ); } else { /* b_prev_intra4x4_pred_mode */ x264_cabac_encode_decision( cb, 68, 0 ); if( i_mode > i_pred ) { i_mode--; } x264_cabac_encode_decision( cb, 69, (i_mode )&0x01 ); x264_cabac_encode_decision( cb, 69, (i_mode >> 1)&0x01 ); x264_cabac_encode_decision( cb, 69, (i_mode >> 2)&0x01 ); } } static void x264_cabac_mb_intra_chroma_pred_mode( x264_t *h, x264_cabac_t *cb ) { const int i_mode = x264_mb_pred_mode8x8c_fix[ h->mb.i_chroma_pred_mode ]; int ctx = 0; /* No need to test for I4x4 or I_16x16 as cache_save handle that */ if( (h->mb.i_neighbour & MB_LEFT) && h->mb.chroma_pred_mode[h->mb.i_mb_xy - 1] != 0 ) { ctx++; } if( (h->mb.i_neighbour & MB_TOP) && h->mb.chroma_pred_mode[h->mb.i_mb_top_xy] != 0 ) { ctx++; } x264_cabac_encode_decision( cb, 64 + ctx, i_mode > 0 ); if( i_mode > 0 ) { x264_cabac_encode_decision( cb, 64 + 3, i_mode > 1 ); if( i_mode > 1 ) { x264_cabac_encode_decision( cb, 64 + 3, i_mode > 2 ); } } } static void x264_cabac_mb_cbp_luma( x264_t *h, x264_cabac_t *cb ) { /* TODO: clean up and optimize */ int i8x8; for( i8x8 = 0; i8x8 < 4; i8x8++ ) { int i_mba_xy = -1; int i_mbb_xy = -1; int x = block_idx_x[4*i8x8]; int y = block_idx_y[4*i8x8]; int ctx = 0; if( x > 0 ) i_mba_xy = h->mb.i_mb_xy; else if( h->mb.i_neighbour & MB_LEFT ) i_mba_xy = h->mb.i_mb_xy - 1; if( y > 0 ) i_mbb_xy = h->mb.i_mb_xy; else if( h->mb.i_neighbour & MB_TOP ) i_mbb_xy = h->mb.i_mb_top_xy; /* No need to test for PCM and SKIP */ if( i_mba_xy >= 0 ) { const int i8x8a = block_idx_xy[(x-1)&0x03][y]/4; if( ((h->mb.cbp[i_mba_xy] >> i8x8a)&0x01) == 0 ) { ctx++; } } if( i_mbb_xy >= 0 ) { const int i8x8b = block_idx_xy[x][(y-1)&0x03]/4; if( ((h->mb.cbp[i_mbb_xy] >> i8x8b)&0x01) == 0 ) { ctx += 2; } } x264_cabac_encode_decision( cb, 73 + ctx, (h->mb.i_cbp_luma >> i8x8)&0x01 ); } } static void x264_cabac_mb_cbp_chroma( x264_t *h, x264_cabac_t *cb ) { int cbp_a = -1; int cbp_b = -1; int ctx; /* No need to test for SKIP/PCM */ if( h->mb.i_neighbour & MB_LEFT ) { cbp_a = (h->mb.cbp[h->mb.i_mb_xy - 1] >> 4)&0x3; } if( h->mb.i_neighbour & MB_TOP ) { cbp_b = (h->mb.cbp[h->mb.i_mb_top_xy] >> 4)&0x3; } ctx = 0; if( cbp_a > 0 ) ctx++; if( cbp_b > 0 ) ctx += 2; if( h->mb.i_cbp_chroma == 0 ) { x264_cabac_encode_decision( cb, 77 + ctx, 0 ); } else { x264_cabac_encode_decision( cb, 77 + ctx, 1 ); ctx = 4; if( cbp_a == 2 ) ctx++; if( cbp_b == 2 ) ctx += 2; x264_cabac_encode_decision( cb, 77 + ctx, h->mb.i_cbp_chroma > 1 ); } } /* TODO check it with != qp per mb */ static void x264_cabac_mb_qp_delta( x264_t *h, x264_cabac_t *cb ) { int i_mbn_xy = h->mb.i_mb_prev_xy; int i_dqp = h->mb.i_qp - h->mb.i_last_qp; int ctx; /* No need to test for PCM / SKIP */ if( h->mb.i_neighbour && h->mb.i_last_dqp != 0 && ( h->mb.type[i_mbn_xy] == I_16x16 || (h->mb.cbp[i_mbn_xy]&0x3f) ) ) ctx = 1; else ctx = 0; if( i_dqp != 0 ) { int val = i_dqp <= 0 ? (-2*i_dqp) : (2*i_dqp - 1); /* dqp is interpreted modulo 52 */ if( val >= 51 && val != 52 ) val = 103 - val; while( val-- ) { x264_cabac_encode_decision( cb, 60 + ctx, 1 ); if( ctx < 2 ) ctx = 2; else ctx = 3; } } x264_cabac_encode_decision( cb, 60 + ctx, 0 ); } void x264_cabac_mb_skip( x264_t *h, int b_skip ) { int ctx = 0; if( h->mb.i_mb_type_left >= 0 && !IS_SKIP( h->mb.i_mb_type_left ) ) { ctx++; } if( h->mb.i_mb_type_top >= 0 && !IS_SKIP( h->mb.i_mb_type_top ) ) { ctx++; } ctx += (h->sh.i_type == SLICE_TYPE_P) ? 11 : 24; x264_cabac_encode_decision( &h->cabac, ctx, b_skip ); } static inline void x264_cabac_mb_sub_p_partition( x264_cabac_t *cb, int i_sub ) { if( i_sub == D_L0_8x8 ) { x264_cabac_encode_decision( cb, 21, 1 ); } else if( i_sub == D_L0_8x4 ) { x264_cabac_encode_decision( cb, 21, 0 ); x264_cabac_encode_decision( cb, 22, 0 ); } else if( i_sub == D_L0_4x8 ) { x264_cabac_encode_decision( cb, 21, 0 ); x264_cabac_encode_decision( cb, 22, 1 ); x264_cabac_encode_decision( cb, 23, 1 ); } else if( i_sub == D_L0_4x4 ) { x264_cabac_encode_decision( cb, 21, 0 ); x264_cabac_encode_decision( cb, 22, 1 ); x264_cabac_encode_decision( cb, 23, 0 ); } } static inline void x264_cabac_mb_sub_b_partition( x264_cabac_t *cb, int i_sub ) { #define WRITE_SUB_3(a,b,c) {\ x264_cabac_encode_decision( cb, 36, a );\ x264_cabac_encode_decision( cb, 37, b );\ x264_cabac_encode_decision( cb, 39, c );\ } #define WRITE_SUB_5(a,b,c,d,e) {\ x264_cabac_encode_decision( cb, 36, a );\ x264_cabac_encode_decision( cb, 37, b );\ x264_cabac_encode_decision( cb, 38, c );\ x264_cabac_encode_decision( cb, 39, d );\ x264_cabac_encode_decision( cb, 39, e );\ } #define WRITE_SUB_6(a,b,c,d,e,f) {\ WRITE_SUB_5(a,b,c,d,e)\ x264_cabac_encode_decision( cb, 39, f );\ } switch( i_sub ) { case D_DIRECT_8x8: x264_cabac_encode_decision( cb, 36, 0 ); break; case D_L0_8x8: WRITE_SUB_3(1,0,0); break; case D_L1_8x8: WRITE_SUB_3(1,0,1); break; case D_BI_8x8: WRITE_SUB_5(1,1,0,0,0); break; case D_L0_8x4: WRITE_SUB_5(1,1,0,0,1); break; case D_L0_4x8: WRITE_SUB_5(1,1,0,1,0); break; case D_L1_8x4: WRITE_SUB_5(1,1,0,1,1); break; case D_L1_4x8: WRITE_SUB_6(1,1,1,0,0,0); break; case D_BI_8x4: WRITE_SUB_6(1,1,1,0,0,1); break; case D_BI_4x8: WRITE_SUB_6(1,1,1,0,1,0); break; case D_L0_4x4: WRITE_SUB_6(1,1,1,0,1,1); break; case D_L1_4x4: WRITE_SUB_5(1,1,1,1,0); break; case D_BI_4x4: WRITE_SUB_5(1,1,1,1,1); break; } } static inline void x264_cabac_mb_transform_size( x264_t *h, x264_cabac_t *cb ) { int ctx = 399 + h->mb.cache.i_neighbour_transform_size; x264_cabac_encode_decision( cb, ctx, h->mb.b_transform_8x8 ); } static inline void x264_cabac_mb_ref( x264_t *h, x264_cabac_t *cb, int i_list, int idx ) { const int i8 = x264_scan8[idx]; const int i_refa = h->mb.cache.ref[i_list][i8 - 1]; const int i_refb = h->mb.cache.ref[i_list][i8 - 8]; int i_ref = h->mb.cache.ref[i_list][i8]; int ctx = 0; if( i_refa > 0 && !h->mb.cache.skip[i8 - 1]) ctx++; if( i_refb > 0 && !h->mb.cache.skip[i8 - 8]) ctx += 2; while( i_ref > 0 ) { x264_cabac_encode_decision( cb, 54 + ctx, 1 ); if( ctx < 4 ) ctx = 4; else ctx = 5; i_ref--; } x264_cabac_encode_decision( cb, 54 + ctx, 0 ); } static inline void x264_cabac_mb_mvd_cpn( x264_t *h, x264_cabac_t *cb, int i_list, int idx, int l, int mvd ) { const int amvd = abs( h->mb.cache.mvd[i_list][x264_scan8[idx] - 1][l] ) + abs( h->mb.cache.mvd[i_list][x264_scan8[idx] - 8][l] ); const int i_abs = abs( mvd ); const int i_prefix = X264_MIN( i_abs, 9 ); const int ctxbase = (l == 0 ? 40 : 47); int ctx; int i; if( amvd < 3 ) ctx = 0; else if( amvd > 32 ) ctx = 2; else ctx = 1; for( i = 0; i < i_prefix; i++ ) { x264_cabac_encode_decision( cb, ctxbase + ctx, 1 ); if( ctx < 3 ) ctx = 3; else if( ctx < 6 ) ctx++; } if( i_prefix < 9 ) x264_cabac_encode_decision( cb, ctxbase + ctx, 0 ); else x264_cabac_encode_ue_bypass( cb, 3, i_abs - 9 ); /* sign */ if( mvd ) x264_cabac_encode_bypass( cb, mvd < 0 ); } static inline void x264_cabac_mb_mvd( x264_t *h, x264_cabac_t *cb, int i_list, int idx, int width, int height ) { int mvp[2]; int mdx, mdy; /* Calculate mvd */ x264_mb_predict_mv( h, i_list, idx, width, mvp ); mdx = h->mb.cache.mv[i_list][x264_scan8[idx]][0] - mvp[0]; mdy = h->mb.cache.mv[i_list][x264_scan8[idx]][1] - mvp[1]; /* encode */ x264_cabac_mb_mvd_cpn( h, cb, i_list, idx, 0, mdx ); x264_cabac_mb_mvd_cpn( h, cb, i_list, idx, 1, mdy ); /* save value */ x264_macroblock_cache_mvd( h, block_idx_x[idx], block_idx_y[idx], width, height, i_list, mdx, mdy ); } static inline void x264_cabac_mb8x8_mvd( x264_t *h, x264_cabac_t *cb, int i_list, int i ) { if( !x264_mb_partition_listX_table[i_list][ h->mb.i_sub_partition[i] ] ) return; switch( h->mb.i_sub_partition[i] ) { case D_L0_8x8: case D_L1_8x8: case D_BI_8x8: x264_cabac_mb_mvd( h, cb, i_list, 4*i, 2, 2 ); break; case D_L0_8x4: case D_L1_8x4: case D_BI_8x4: x264_cabac_mb_mvd( h, cb, i_list, 4*i+0, 2, 1 ); x264_cabac_mb_mvd( h, cb, i_list, 4*i+2, 2, 1 ); break; case D_L0_4x8: case D_L1_4x8: case D_BI_4x8: x264_cabac_mb_mvd( h, cb, i_list, 4*i+0, 1, 2 ); x264_cabac_mb_mvd( h, cb, i_list, 4*i+1, 1, 2 ); break; case D_L0_4x4: case D_L1_4x4: case D_BI_4x4: x264_cabac_mb_mvd( h, cb, i_list, 4*i+0, 1, 1 ); x264_cabac_mb_mvd( h, cb, i_list, 4*i+1, 1, 1 ); x264_cabac_mb_mvd( h, cb, i_list, 4*i+2, 1, 1 ); x264_cabac_mb_mvd( h, cb, i_list, 4*i+3, 1, 1 ); break; } } static int x264_cabac_mb_cbf_ctxidxinc( x264_t *h, int i_cat, int i_idx ) { int i_mba_xy = -1; int i_mbb_xy = -1; int i_nza = 0; int i_nzb = 0; int ctx; if( i_cat == DCT_LUMA_DC ) { if( h->mb.i_neighbour & MB_LEFT ) { i_mba_xy = h->mb.i_mb_xy - 1; if( h->mb.i_mb_type_left == I_16x16 ) i_nza = h->mb.cbp[i_mba_xy] & 0x100; } if( h->mb.i_neighbour & MB_TOP ) { i_mbb_xy = h->mb.i_mb_top_xy; if( h->mb.i_mb_type_top == I_16x16 ) i_nzb = h->mb.cbp[i_mbb_xy] & 0x100; } } else if( i_cat == DCT_LUMA_AC || i_cat == DCT_LUMA_4x4 ) { if( i_idx & ~10 ) // block_idx_x > 0 i_mba_xy = h->mb.i_mb_xy; else if( h->mb.i_neighbour & MB_LEFT ) i_mba_xy = h->mb.i_mb_xy - 1; if( i_idx & ~5 ) // block_idx_y > 0 i_mbb_xy = h->mb.i_mb_xy; else if( h->mb.i_neighbour & MB_TOP ) i_mbb_xy = h->mb.i_mb_top_xy; /* no need to test for skip/pcm */ if( i_mba_xy >= 0 ) i_nza = h->mb.cache.non_zero_count[x264_scan8[i_idx] - 1]; if( i_mbb_xy >= 0 ) i_nzb = h->mb.cache.non_zero_count[x264_scan8[i_idx] - 8]; } else if( i_cat == DCT_CHROMA_DC ) { /* no need to test skip/pcm */ if( h->mb.i_neighbour & MB_LEFT ) { i_mba_xy = h->mb.i_mb_xy - 1; i_nza = h->mb.cbp[i_mba_xy] & (0x200 << i_idx); } if( h->mb.i_neighbour & MB_TOP ) { i_mbb_xy = h->mb.i_mb_top_xy; i_nzb = h->mb.cbp[i_mbb_xy] & (0x200 << i_idx); } } else if( i_cat == DCT_CHROMA_AC ) { if( i_idx & 1 ) i_mba_xy = h->mb.i_mb_xy; else if( h->mb.i_neighbour & MB_LEFT ) i_mba_xy = h->mb.i_mb_xy - 1; if( i_idx & 2 ) i_mbb_xy = h->mb.i_mb_xy; else if( h->mb.i_neighbour & MB_TOP ) i_mbb_xy = h->mb.i_mb_top_xy; /* no need to test skip/pcm */ if( i_mba_xy >= 0 ) i_nza = h->mb.cache.non_zero_count[x264_scan8[16+i_idx] - 1]; if( i_mbb_xy >= 0 ) i_nzb = h->mb.cache.non_zero_count[x264_scan8[16+i_idx] - 8]; } if( IS_INTRA( h->mb.i_type ) ) { if( i_mba_xy < 0 ) i_nza = 1; if( i_mbb_xy < 0 ) i_nzb = 1; } ctx = 4 * i_cat; if( i_nza ) ctx += 1; if( i_nzb ) ctx += 2; return ctx; } static const int significant_coeff_flag_offset[2][6] = { { 105, 120, 134, 149, 152, 402 }, { 277, 292, 306, 321, 324, 436 } }; static const int last_coeff_flag_offset[2][6] = { { 166, 181, 195, 210, 213, 417 }, { 338, 353, 367, 382, 385, 451 } }; static const int coeff_abs_level_m1_offset[6] = { 227, 237, 247, 257, 266, 426 }; static const int significant_coeff_flag_offset_8x8[2][63] = {{ 0, 1, 2, 3, 4, 5, 5, 4, 4, 3, 3, 4, 4, 4, 5, 5, 4, 4, 4, 4, 3, 3, 6, 7, 7, 7, 8, 9,10, 9, 8, 7, 7, 6,11,12,13,11, 6, 7, 8, 9,14,10, 9, 8, 6,11, 12,13,11, 6, 9,14,10, 9,11,12,13,11,14,10,12 },{ 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 7, 7, 8, 4, 5, 6, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,13,13, 9, 9,10,10, 8,13,13, 9, 9,10,10,14,14,14,14,14 }}; static const int last_coeff_flag_offset_8x8[63] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8 }; static const int identity[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; static void block_residual_write_cabac( x264_t *h, x264_cabac_t *cb, int i_ctxBlockCat, int i_idx, int *l, int i_count ) { const int i_ctx_sig = significant_coeff_flag_offset[h->mb.b_interlaced][i_ctxBlockCat]; const int i_ctx_last = last_coeff_flag_offset[h->mb.b_interlaced][i_ctxBlockCat]; const int i_ctx_level = coeff_abs_level_m1_offset[i_ctxBlockCat]; int i_coeff_abs_m1[64]; int i_coeff_sign[64]; int i_coeff = 0; int i_last = 0; int i_sigmap_size; int i_abslevel1 = 0; int i_abslevelgt1 = 0; int i; const int *significant_coeff_flag_offset; const int *last_coeff_flag_offset; /* i_ctxBlockCat: 0-> DC 16x16 i_idx = 0 * 1-> AC 16x16 i_idx = luma4x4idx * 2-> Luma4x4 i_idx = luma4x4idx * 3-> DC Chroma i_idx = iCbCr * 4-> AC Chroma i_idx = 4 * iCbCr + chroma4x4idx * 5-> Luma8x8 i_idx = luma8x8idx */ for( i = 0; i < i_count; i++ ) { if( l[i] != 0 ) { i_coeff_abs_m1[i_coeff] = abs( l[i] ) - 1; i_coeff_sign[i_coeff] = ( l[i] < 0 ); i_coeff++; i_last = i; } } if( i_count != 64 ) { /* coded block flag */ x264_cabac_encode_decision( cb, 85 + x264_cabac_mb_cbf_ctxidxinc( h, i_ctxBlockCat, i_idx ), i_coeff != 0 ); if( i_coeff == 0 ) return; } significant_coeff_flag_offset = (i_ctxBlockCat == DCT_LUMA_8x8) ? significant_coeff_flag_offset_8x8[h->mb.b_interlaced] : identity; last_coeff_flag_offset = (i_ctxBlockCat == DCT_LUMA_8x8) ? last_coeff_flag_offset_8x8 : identity; i_sigmap_size = X264_MIN( i_last+1, i_count-1 ); for( i = 0; i < i_sigmap_size; i++ ) { x264_cabac_encode_decision( cb, i_ctx_sig + significant_coeff_flag_offset[i], l[i] != 0 ); if( l[i] != 0 ) x264_cabac_encode_decision( cb, i_ctx_last + last_coeff_flag_offset[i], i == i_last ); } for( i = i_coeff - 1; i >= 0; i-- ) { /* write coeff_abs - 1 */ const int i_prefix = X264_MIN( i_coeff_abs_m1[i], 14 ); const int i_ctxIdxInc = (i_abslevelgt1 ? 0 : X264_MIN( 4, i_abslevel1 + 1 )) + i_ctx_level; x264_cabac_encode_decision( cb, i_ctxIdxInc, i_prefix != 0 ); if( i_prefix != 0 ) { const int i_ctxIdxInc = 5 + X264_MIN( 4, i_abslevelgt1 ) + i_ctx_level; int j; for( j = 0; j < i_prefix - 1; j++ ) x264_cabac_encode_decision( cb, i_ctxIdxInc, 1 ); if( i_prefix < 14 ) x264_cabac_encode_decision( cb, i_ctxIdxInc, 0 ); else /* suffix */ x264_cabac_encode_ue_bypass( cb, 0, i_coeff_abs_m1[i] - 14 ); i_abslevelgt1++; } else i_abslevel1++; /* write sign */ x264_cabac_encode_bypass( cb, i_coeff_sign[i] ); } } void x264_macroblock_write_cabac( x264_t *h, x264_cabac_t *cb ) { const int i_mb_type = h->mb.i_type; int i_list; int i; #ifndef RDO_SKIP_BS const int i_mb_pos_start = x264_cabac_pos( cb ); int i_mb_pos_tex; #endif /* Write the MB type */ x264_cabac_mb_type( h, cb ); /* PCM special block type UNTESTED */ if( i_mb_type == I_PCM ) { #ifdef RDO_SKIP_BS cb->f8_bits_encoded += (384*8) << 8; #else bs_t *s = cb->s; bs_align_0( s ); /* not sure */ /* Luma */ for( i = 0; i < 16*16; i++ ) { const int x = 16 * h->mb.i_mb_x + (i % 16); const int y = 16 * h->mb.i_mb_y + (i / 16); bs_write( s, 8, h->fenc->plane[0][y*h->mb.pic.i_stride[0]+x] ); } /* Cb */ for( i = 0; i < 8*8; i++ ) { const int x = 8 * h->mb.i_mb_x + (i % 8); const int y = 8 * h->mb.i_mb_y + (i / 8); bs_write( s, 8, h->fenc->plane[1][y*h->mb.pic.i_stride[1]+x] ); } /* Cr */ for( i = 0; i < 8*8; i++ ) { const int x = 8 * h->mb.i_mb_x + (i % 8); const int y = 8 * h->mb.i_mb_y + (i / 8); bs_write( s, 8, h->fenc->plane[2][y*h->mb.pic.i_stride[2]+x] ); } x264_cabac_encode_init( cb, s ); #endif return; } if( IS_INTRA( i_mb_type ) ) { if( h->pps->b_transform_8x8_mode && i_mb_type != I_16x16 ) x264_cabac_mb_transform_size( h, cb ); if( i_mb_type != I_16x16 ) { int di = (i_mb_type == I_8x8) ? 4 : 1; for( i = 0; i < 16; i += di ) { const int i_pred = x264_mb_predict_intra4x4_mode( h, i ); const int i_mode = x264_mb_pred_mode4x4_fix( h->mb.cache.intra4x4_pred_mode[x264_scan8[i]] ); x264_cabac_mb_intra4x4_pred_mode( cb, i_pred, i_mode ); } } x264_cabac_mb_intra_chroma_pred_mode( h, cb ); } else if( i_mb_type == P_L0 ) { if( h->mb.i_partition == D_16x16 ) { if( h->mb.pic.i_fref[0] > 1 ) { x264_cabac_mb_ref( h, cb, 0, 0 ); } x264_cabac_mb_mvd( h, cb, 0, 0, 4, 4 ); } else if( h->mb.i_partition == D_16x8 ) { if( h->mb.pic.i_fref[0] > 1 ) { x264_cabac_mb_ref( h, cb, 0, 0 ); x264_cabac_mb_ref( h, cb, 0, 8 ); } x264_cabac_mb_mvd( h, cb, 0, 0, 4, 2 ); x264_cabac_mb_mvd( h, cb, 0, 8, 4, 2 ); } else if( h->mb.i_partition == D_8x16 ) { if( h->mb.pic.i_fref[0] > 1 ) { x264_cabac_mb_ref( h, cb, 0, 0 ); x264_cabac_mb_ref( h, cb, 0, 4 ); } x264_cabac_mb_mvd( h, cb, 0, 0, 2, 4 ); x264_cabac_mb_mvd( h, cb, 0, 4, 2, 4 ); } } else if( i_mb_type == P_8x8 ) { /* sub mb type */ x264_cabac_mb_sub_p_partition( cb, h->mb.i_sub_partition[0] ); x264_cabac_mb_sub_p_partition( cb, h->mb.i_sub_partition[1] ); x264_cabac_mb_sub_p_partition( cb, h->mb.i_sub_partition[2] ); x264_cabac_mb_sub_p_partition( cb, h->mb.i_sub_partition[3] ); /* ref 0 */ if( h->mb.pic.i_fref[0] > 1 ) { x264_cabac_mb_ref( h, cb, 0, 0 ); x264_cabac_mb_ref( h, cb, 0, 4 ); x264_cabac_mb_ref( h, cb, 0, 8 ); x264_cabac_mb_ref( h, cb, 0, 12 ); } for( i = 0; i < 4; i++ ) x264_cabac_mb8x8_mvd( h, cb, 0, i ); } else if( i_mb_type == B_8x8 ) { /* sub mb type */ x264_cabac_mb_sub_b_partition( cb, h->mb.i_sub_partition[0] ); x264_cabac_mb_sub_b_partition( cb, h->mb.i_sub_partition[1] ); x264_cabac_mb_sub_b_partition( cb, h->mb.i_sub_partition[2] ); x264_cabac_mb_sub_b_partition( cb, h->mb.i_sub_partition[3] ); /* ref */ for( i_list = 0; i_list < 2; i_list++ ) { if( ( i_list ? h->mb.pic.i_fref[1] : h->mb.pic.i_fref[0] ) == 1 ) continue; for( i = 0; i < 4; i++ ) if( x264_mb_partition_listX_table[i_list][ h->mb.i_sub_partition[i] ] ) x264_cabac_mb_ref( h, cb, i_list, 4*i ); } for( i = 0; i < 4; i++ ) x264_cabac_mb8x8_mvd( h, cb, 0, i ); for( i = 0; i < 4; i++ ) x264_cabac_mb8x8_mvd( h, cb, 1, i ); } else if( i_mb_type != B_DIRECT ) { /* All B mode */ int b_list[2][2]; /* init ref list utilisations */ for( i = 0; i < 2; i++ ) { b_list[0][i] = x264_mb_type_list0_table[i_mb_type][i]; b_list[1][i] = x264_mb_type_list1_table[i_mb_type][i]; } for( i_list = 0; i_list < 2; i_list++ ) { const int i_ref_max = i_list == 0 ? h->mb.pic.i_fref[0] : h->mb.pic.i_fref[1]; if( i_ref_max > 1 ) { if( h->mb.i_partition == D_16x16 ) { if( b_list[i_list][0] ) x264_cabac_mb_ref( h, cb, i_list, 0 ); } else if( h->mb.i_partition == D_16x8 ) { if( b_list[i_list][0] ) x264_cabac_mb_ref( h, cb, i_list, 0 ); if( b_list[i_list][1] ) x264_cabac_mb_ref( h, cb, i_list, 8 ); } else if( h->mb.i_partition == D_8x16 ) { if( b_list[i_list][0] ) x264_cabac_mb_ref( h, cb, i_list, 0 ); if( b_list[i_list][1] ) x264_cabac_mb_ref( h, cb, i_list, 4 ); } } } for( i_list = 0; i_list < 2; i_list++ ) { if( h->mb.i_partition == D_16x16 ) { if( b_list[i_list][0] ) x264_cabac_mb_mvd( h, cb, i_list, 0, 4, 4 ); } else if( h->mb.i_partition == D_16x8 ) { if( b_list[i_list][0] ) x264_cabac_mb_mvd( h, cb, i_list, 0, 4, 2 ); if( b_list[i_list][1] ) x264_cabac_mb_mvd( h, cb, i_list, 8, 4, 2 ); } else if( h->mb.i_partition == D_8x16 ) { if( b_list[i_list][0] ) x264_cabac_mb_mvd( h, cb, i_list, 0, 2, 4 ); if( b_list[i_list][1] ) x264_cabac_mb_mvd( h, cb, i_list, 4, 2, 4 ); } } } #ifndef RDO_SKIP_BS i_mb_pos_tex = x264_cabac_pos( cb ); h->stat.frame.i_hdr_bits += i_mb_pos_tex - i_mb_pos_start; #endif if( i_mb_type != I_16x16 ) { x264_cabac_mb_cbp_luma( h, cb ); x264_cabac_mb_cbp_chroma( h, cb ); } if( h->mb.cache.b_transform_8x8_allowed && h->mb.i_cbp_luma && !IS_INTRA(i_mb_type) ) { x264_cabac_mb_transform_size( h, cb ); } if( h->mb.i_cbp_luma > 0 || h->mb.i_cbp_chroma > 0 || i_mb_type == I_16x16 ) { x264_cabac_mb_qp_delta( h, cb ); /* write residual */ if( i_mb_type == I_16x16 ) { /* DC Luma */ block_residual_write_cabac( h, cb, DCT_LUMA_DC, 0, h->dct.luma16x16_dc, 16 ); /* AC Luma */ if( h->mb.i_cbp_luma != 0 ) for( i = 0; i < 16; i++ ) block_residual_write_cabac( h, cb, DCT_LUMA_AC, i, h->dct.block[i].residual_ac, 15 ); } else if( h->mb.b_transform_8x8 ) { for( i = 0; i < 4; i++ ) if( h->mb.i_cbp_luma & ( 1 << i ) ) block_residual_write_cabac( h, cb, DCT_LUMA_8x8, i, h->dct.luma8x8[i], 64 ); } else { for( i = 0; i < 16; i++ ) if( h->mb.i_cbp_luma & ( 1 << ( i / 4 ) ) ) block_residual_write_cabac( h, cb, DCT_LUMA_4x4, i, h->dct.block[i].luma4x4, 16 ); } if( h->mb.i_cbp_chroma &0x03 ) /* Chroma DC residual present */ { block_residual_write_cabac( h, cb, DCT_CHROMA_DC, 0, h->dct.chroma_dc[0], 4 ); block_residual_write_cabac( h, cb, DCT_CHROMA_DC, 1, h->dct.chroma_dc[1], 4 ); } if( h->mb.i_cbp_chroma&0x02 ) /* Chroma AC residual present */ { for( i = 0; i < 8; i++ ) block_residual_write_cabac( h, cb, DCT_CHROMA_AC, i, h->dct.block[16+i].residual_ac, 15 ); } } #ifndef RDO_SKIP_BS if( IS_INTRA( i_mb_type ) ) h->stat.frame.i_itex_bits += x264_cabac_pos( cb ) - i_mb_pos_tex; else h->stat.frame.i_ptex_bits += x264_cabac_pos( cb ) - i_mb_pos_tex; #endif } #ifdef RDO_SKIP_BS /***************************************************************************** * RD only; doesn't generate a valid bitstream * doesn't write cbp or chroma dc (I don't know how much this matters) * works on all partition sizes except 16x16 * for sub8x8, call once per 8x8 block *****************************************************************************/ void x264_partition_size_cabac( x264_t *h, x264_cabac_t *cb, int i8, int i_pixel ) { const int i_mb_type = h->mb.i_type; int j; if( i_mb_type == P_8x8 ) { x264_cabac_mb_sub_p_partition( cb, h->mb.i_sub_partition[i8] ); if( h->mb.pic.i_fref[0] > 1 ) x264_cabac_mb_ref( h, cb, 0, 4*i8 ); x264_cabac_mb8x8_mvd( h, cb, 0, i8 ); } else if( i_mb_type == P_L0 ) { if( h->mb.pic.i_fref[0] > 1 ) x264_cabac_mb_ref( h, cb, 0, 4*i8 ); if( h->mb.i_partition == D_16x8 ) x264_cabac_mb_mvd( h, cb, 0, 4*i8, 4, 2 ); else //8x16 x264_cabac_mb_mvd( h, cb, 0, 4*i8, 2, 4 ); } else if( i_mb_type == B_8x8 ) { x264_cabac_mb_sub_b_partition( cb, h->mb.i_sub_partition[i8] ); if( h->mb.pic.i_fref[0] > 1 && x264_mb_partition_listX_table[0][ h->mb.i_sub_partition[i8] ] ) x264_cabac_mb_ref( h, cb, 0, 4*i8 ); if( h->mb.pic.i_fref[1] > 1 && x264_mb_partition_listX_table[1][ h->mb.i_sub_partition[i8] ] ) x264_cabac_mb_ref( h, cb, 1, 4*i8 ); x264_cabac_mb8x8_mvd( h, cb, 0, i8 ); x264_cabac_mb8x8_mvd( h, cb, 1, i8 ); } else { x264_log(h, X264_LOG_ERROR, "invalid/unhandled mb_type\n" ); return; } for( j = (i_pixel < PIXEL_8x8); j >= 0; j-- ) { if( h->mb.i_cbp_luma & (1 << i8) ) { if( h->mb.b_transform_8x8 ) block_residual_write_cabac( h, cb, DCT_LUMA_8x8, i8, h->dct.luma8x8[i8], 64 ); else { int i4; for( i4 = 0; i4 < 4; i4++ ) block_residual_write_cabac( h, cb, DCT_LUMA_4x4, i4+i8*4, h->dct.block[i4+i8*4].luma4x4, 16 ); } } block_residual_write_cabac( h, cb, DCT_CHROMA_AC, i8, h->dct.block[16+i8 ].residual_ac, 15 ); block_residual_write_cabac( h, cb, DCT_CHROMA_AC, i8+4, h->dct.block[16+i8+4].residual_ac, 15 ); i8 += x264_pixel_size[i_pixel].h >> 3; } } static void x264_partition_i8x8_size_cabac( x264_t *h, x264_cabac_t *cb, int i8, int i_mode ) { const int i_pred = x264_mb_predict_intra4x4_mode( h, 4*i8 ); i_mode = x264_mb_pred_mode4x4_fix( i_mode ); x264_cabac_mb_intra4x4_pred_mode( cb, i_pred, i_mode ); block_residual_write_cabac( h, cb, DCT_LUMA_8x8, 4*i8, h->dct.luma8x8[i8], 64 ); } static void x264_partition_i4x4_size_cabac( x264_t *h, x264_cabac_t *cb, int i4, int i_mode ) { const int i_pred = x264_mb_predict_intra4x4_mode( h, i4 ); i_mode = x264_mb_pred_mode4x4_fix( i_mode ); x264_cabac_mb_intra4x4_pred_mode( cb, i_pred, i_mode ); block_residual_write_cabac( h, cb, DCT_LUMA_4x4, i4, h->dct.block[i4].luma4x4, 16 ); } static void x264_i8x8_chroma_size_cabac( x264_t *h, x264_cabac_t *cb ) { x264_cabac_mb_intra_chroma_pred_mode( h, cb ); if( h->mb.i_cbp_chroma > 0 ) { block_residual_write_cabac( h, cb, DCT_CHROMA_DC, 0, h->dct.chroma_dc[0], 4 ); block_residual_write_cabac( h, cb, DCT_CHROMA_DC, 1, h->dct.chroma_dc[1], 4 ); if( h->mb.i_cbp_chroma == 2 ) { int i; for( i = 0; i < 8; i++ ) block_residual_write_cabac( h, cb, DCT_CHROMA_AC, i, h->dct.block[16+i].residual_ac, 15 ); } } } #endif
csd/libraries
x264/encoder/cabac.c
C
lgpl-3.0
37,904
/* * SonarQube * Copyright (C) 2009-2019 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; import Helmet from 'react-helmet'; import { graphql } from 'gatsby'; import HeaderList from '../components/HeaderList'; import { MarkdownRemark, MarkdownRemarkConnection, MarkdownHeading } from '../@types/graphql-types'; interface Props { data: { allMarkdownRemark: Pick<MarkdownRemarkConnection, 'edges'>; markdownRemark: Pick<MarkdownRemark, 'html' | 'headings' | 'frontmatter'>; }; location: Location; } export default class Page extends React.PureComponent<Props> { baseUrl = ''; componentDidMount() { if (window) { this.baseUrl = window.location.origin + '/'; } const collapsables = document.getElementsByClassName('collapse'); for (let i = 0; i < collapsables.length; i++) { collapsables[i].classList.add('close'); const firstChild = collapsables[i].firstElementChild; if (firstChild) { firstChild.outerHTML = firstChild.outerHTML .replace(/<h2/gi, '<a href="#"') .replace(/<\/h2>/gi, '</a>'); firstChild.addEventListener('click', (event: Event & { currentTarget: HTMLElement }) => { event.preventDefault(); if (event.currentTarget.parentElement) { event.currentTarget.parentElement.classList.toggle('close'); } }); } } } render() { const page = this.props.data.markdownRemark; const version = process.env.GATSBY_DOCS_VERSION || ''; const mainTitle = 'SonarQube Docs'; const pageTitle = page.frontmatter && page.frontmatter.title; let htmlPageContent = page.html || ''; const realHeadingsList = removeExtraHeadings(htmlPageContent, page.headings || []); htmlPageContent = removeTableOfContents(htmlPageContent); htmlPageContent = createAnchorForHeadings(htmlPageContent, realHeadingsList); htmlPageContent = replaceDynamicLinks(htmlPageContent); htmlPageContent = replaceImageLinks(htmlPageContent); return ( <> <Helmet title={pageTitle ? `${pageTitle} | ${mainTitle}` : mainTitle}> <html lang="en" /> <link href={`/${version}/favicon.ico`} rel="icon" /> <link href={this.baseUrl + this.props.location.pathname.replace(version, 'latest')} rel="canonical" /> <script type="text/javascript">{` (function(window,document) { (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window, document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-1880045-11' , 'auto'); ga('send', 'pageview'); })(window,document); `}</script> </Helmet> <HeaderList headers={realHeadingsList} /> <h1>{pageTitle || mainTitle}</h1> <div className="markdown-content" dangerouslySetInnerHTML={{ __html: htmlPageContent }} /> </> ); } } export const query = graphql` query($slug: String!) { allMarkdownRemark { edges { node { html fields { slug } } } } markdownRemark(fields: { slug: { eq: $slug } }) { html headings { depth value } frontmatter { title } } } `; function replaceImageLinks(content: string) { const version = process.env.GATSBY_DOCS_VERSION || ''; if (version !== '') { content = content.replace(/<img src="\/images\/(.*?)"/gim, `<img src="/${version}/images/$1"`); } return content; } function replaceDynamicLinks(content: string) { // Make outside link open in a new tab content = content.replace( /<a href="http(.*?)">(.*?)<\/a>/gim, '<a href="http$1" target="_blank">$2</a>' ); // Render only the text part of links going inside the app return content.replace( /<a href="(.*)\/#(?:sonarqube|sonarcloud|sonarqube-admin)#.*?">(.*?)<\/a>/gim, '$2' ); } /** * For the sidebar table of content, we do not want headers for sonarcloud, * collapsable container title, of table of contents headers. */ function removeExtraHeadings(content: string, headings: MarkdownHeading[]) { return headings .filter(heading => content.indexOf(`<div class="collapse"><h2>${heading.value}</h2>`) < 0) .filter(heading => !heading.value || !heading.value.match(/Table of content/i)) .filter(heading => { const regex = new RegExp( `<!-- sonarcloud -->[\\s\\S]*<h2>${heading.value}<\\/h2>[\\s\\S]*<!-- /sonarcloud -->`, 'gim' ); return !content.match(regex); }); } function createAnchorForHeadings(content: string, headings: MarkdownHeading[]) { let counter = 1; headings.forEach(h => { if (h.depth === 2) { content = content.replace( `<h${h.depth}>${h.value}</h${h.depth}>`, `<h${h.depth} id="header-${counter}">${h.value}</h${h.depth}>` ); counter++; } }); return content; } function removeTableOfContents(content: string) { return content.replace(/<h[1-9]>Table Of Contents<\/h[1-9]>/i, ''); }
Godin/sonar
server/sonar-docs/src/templates/page.tsx
TypeScript
lgpl-3.0
6,119
/* Copyright 2013-2021 Paul Colby This file is part of QtAws. QtAws is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. QtAws is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the QtAws. If not, see <http://www.gnu.org/licenses/>. */ #ifndef QTAWS_LISTRESTOREJOBSRESPONSE_H #define QTAWS_LISTRESTOREJOBSRESPONSE_H #include "backupresponse.h" #include "listrestorejobsrequest.h" namespace QtAws { namespace Backup { class ListRestoreJobsResponsePrivate; class QTAWSBACKUP_EXPORT ListRestoreJobsResponse : public BackupResponse { Q_OBJECT public: ListRestoreJobsResponse(const ListRestoreJobsRequest &request, QNetworkReply * const reply, QObject * const parent = 0); virtual const ListRestoreJobsRequest * request() const Q_DECL_OVERRIDE; protected slots: virtual void parseSuccess(QIODevice &response) Q_DECL_OVERRIDE; private: Q_DECLARE_PRIVATE(ListRestoreJobsResponse) Q_DISABLE_COPY(ListRestoreJobsResponse) }; } // namespace Backup } // namespace QtAws #endif
pcolby/libqtaws
src/backup/listrestorejobsresponse.h
C
lgpl-3.0
1,497
/* * This file is part of the Ideal Library * Copyright (C) 2009 Rafael Fernández López <ereslibre@ereslibre.es> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef OBJECT_H #define OBJECT_H #include <ideal_export.h> #include <core/ideal_signal.h> namespace IdealCore { class Application; /** * @class Object object.h core/object.h * * The base class for Ideal library usage. Inheriting this class will allow you to use signals * and connect them to methods in any class that inherits IdealCore::Object. It contains the basic * functionality offered by the Ideal Library. * * You can check how to work with signals with several examples: * - @ref workingWithSignals * * @author Rafael Fernández López <ereslibre@ereslibre.es> */ class IDEAL_EXPORT Object : public SignalResource { // This friend classes are allowed to use the default constructor friend class Application; friend class Extension; friend class Module; friend class Timer; public: Object(Object *parent); virtual ~Object(); /** * Sets whether children of this object should be deleted recursively when this object is. */ void setDeleteChildrenRecursively(bool deleteChildrenRecursively); /** * @return Whether this object children will be removed when this object is. * * @note true by default. */ bool isDeleteChildrenRecursively() const; /** * Sets whether signals are blocked for this object or not. If @p blockedSignals is true, this * object won't receive any call coming from a signal. */ void setBlockedSignals(bool blockedSignals); /** * @return Whether signals are blocked for this object or not. * * @note false by default. */ bool areSignalsBlocked() const; /** * Sets whether emit() is blocked for all signals of this object. * * @note destroyed signal will always be emitted, even if emit() is blocked for this object. */ void setEmitBlocked(bool emitBlocked); /** * @return Whether emit() is blocked for all signals of this object. * * @note false by default. */ bool isEmitBlocked() const; /** * @return The list of children of this object. */ List<Object*> children() const; /** * @return The parent of this object. */ Object *parent() const; /** * Reparents this object to @p parent. */ void reparent(Object *parent); /** * @return The application this object belongs to. */ Application *application() const; /** * All signals in @p sender will become disconnected from their receivers. * * @note This cannot be undone. If you want to temporarily fake this effect, use setEmitBlocked. * * See @ref workingWithSignals */ static void disconnectSender(Object *sender); /** * All signals connected to @p receiver will be disconnected from it. * * @note If signals were connected to other receivers, those are still connected. * * @note This cannot be undone. If you want to temporarily fake this effect, use setBlockedSignals. * * See @ref workingWithSignals */ static void disconnectReceiver(Object *receiver); /** * Equivalent to disconnectSender() and disconnectReceiver() on @p object. * * See @ref workingWithSignals */ static void fullyDisconnect(Object *object); /** * Deletes this object right now. */ void deleteNow(); /** * Deletes this object on the next event loop. */ void deleteLater(); protected: /** * @internal */ virtual void signalCreated(const SignalBase *signal); /** * @internal */ virtual void signalConnected(const SignalBase *signal); /** * @internal */ virtual void signalDisconnected(const SignalBase *signal); /** * @internal */ virtual List<const SignalBase*> signals() const; private: /** * @internal */ Object(); class Private; Private *const d; public: IDEAL_SIGNAL(destroyed); }; } #endif //OBJECT_H
ereslibre/ideallibrary-old
src/core/object.h
C
lgpl-3.0
4,978
<?php /** * This file is part of NoiseLabs-SmartyPlugins * * NoiseLabs-SmartyPlugins is free software; you can redistribute it * and/or modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * NoiseLabs-SmartyPlugins is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with NoiseLabs-SmartyPlugins; if not, see * <http://www.gnu.org/licenses/>. * * Copyright (C) 2012 Vítor Brandão * * @category NoiseLabs * @package SmartyPlugins * @author Vítor Brandão <noisebleed@noiselabs.org> * @copyright (C) 2012 Vítor Brandão <noisebleed@noiselabs.org> * @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL-3 * @link http://www.noiselabs.org * @since 0.1.0 */ namespace NoiseLabs\SmartyPlugins\Package; /** * Base Package class. * * @since 0.1.0 * @author Vítor Brandão <noisebleed@noiselabs.org> */ abstract class AbstractPackage implements PackageInterface { /** * Returns a list of Plugins to add to the existing list. * * @return array An array of * * @since 0.1.0 * @author Vítor Brandão <noisebleed@noiselabs.org> */ public function getPlugins() { return array(); } /** * Returns a list of Filters to add to the existing list. * * @return array An array of Filters * * @since 0.1.0 * @author Vítor Brandão <noisebleed@noiselabs.org> */ public function getFilters() { return array(); } /** * Returns a list of globals to add to the existing list. * * @return array An array of globals * * @since 0.1.0 * @author Vítor Brandão <noisebleed@noiselabs.org> */ public function getGlobals() { return array(); } }
noiselabs/SmartyPlugins
src/NoiseLabs/SmartyPlugins/Core/Package/AbstractPackage.php
PHP
lgpl-3.0
2,183
#!/usr/local/bin/python # check python version import sys ver_info = sys.version_info # parse commandlines if ver_info[0] < 3 and ver_info[1] < 7: from optparse import OptionParser parser = OptionParser() parser.add_option("-f", "--file", dest="filename", help="input log file", metavar="LOG_FILE") # parser.add_option("-d", "--directory", dest="dirname", help="input directory with log files", metavar="LOG_DIR") parser.add_option("-t", "--dbtype", dest="dbtype", help="database type", default="mongodb", metavar="DB_TYPE") (options, args) = parser.parse_args(); else: import argparse parser = argparse.ArgumentParser(description="Log to database ingester") parser.add_argument("-f, --file", dest="filename", help="input log file", metavar="LOG_FILE") # parser.add_argument("-d, --directory", dest="dirname", help="input directory with log files", metavar="LOG_DIR") parser.add_argument("-t, --dbtype", dest="dbtype", help="database type", default="mongodb", metavar="DB_TYPE") options = parser.parse_args() print "file {0} ".format(options.filename) # print "dirname {0} ".format(options.dirname) print "dbtype {0}".format(options.dbtype) if options.dbtype == "mongodb": from DBDriver.MongoDBDriver import MongoDBDriver dbingester = MongoDBDriver(); elif options.dbtype == "cassandra": from DBDriver.CassandraDBDriver import CassandraDBDriver dbingester = CassandraDBDriver(); else: print "ERROR: unsupported db type {0}".format(options.dbtype); sys.exit(2); import re # open the file and iterate with open(options.filename) as f: # read the first line line = f.readline() if re.match("v2.1", line): from LogParser.LogParsers import LogParserV2_1 lparser = LogParserV2_1(options.filename) elif re.match("v2", line): from LogParser.LogParsers import LogParserV2 lparser = LogParserV2_1(options.filename) else: print "UNSUPPORTED LOG VERSION: {0}".format(line) sys.exit(1) for line in f: lparser.parseLine(line, dbingester)
EmoryUniversity/PIAT
src/common/log-analysis/python-discard/LogDBIngester.py
Python
lgpl-3.0
2,170
/* Copyright 2013-2021 Paul Colby This file is part of QtAws. QtAws is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. QtAws is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the QtAws. If not, see <http://www.gnu.org/licenses/>. */ #ifndef QTAWS_CREATEELASTICSEARCHDOMAINRESPONSE_H #define QTAWS_CREATEELASTICSEARCHDOMAINRESPONSE_H #include "elasticsearchserviceresponse.h" #include "createelasticsearchdomainrequest.h" namespace QtAws { namespace ElasticsearchService { class CreateElasticsearchDomainResponsePrivate; class QTAWSELASTICSEARCHSERVICE_EXPORT CreateElasticsearchDomainResponse : public ElasticsearchServiceResponse { Q_OBJECT public: CreateElasticsearchDomainResponse(const CreateElasticsearchDomainRequest &request, QNetworkReply * const reply, QObject * const parent = 0); virtual const CreateElasticsearchDomainRequest * request() const Q_DECL_OVERRIDE; protected slots: virtual void parseSuccess(QIODevice &response) Q_DECL_OVERRIDE; private: Q_DECLARE_PRIVATE(CreateElasticsearchDomainResponse) Q_DISABLE_COPY(CreateElasticsearchDomainResponse) }; } // namespace ElasticsearchService } // namespace QtAws #endif
pcolby/libqtaws
src/elasticsearchservice/createelasticsearchdomainresponse.h
C
lgpl-3.0
1,667
[![](https://images.microbadger.com/badges/image/qq58945591/elasticsearch.svg)](https://microbadger.com/images/qq58945591/elasticsearch "Get your own image badge on microbadger.com") # 关于本镜像. ELK官方image使用了debian做基础镜像, 体积较为臃肿, 因此便有了改造的想法,通过改造后,体积只有官方镜像的一半大. 使用轻量alpine linux 作为基础. ## 如何使用? 1. 使用方法同官方镜像一样,但是官方默认配置只监听在本地端口,本镜像修改为监听所有.官方宣称是为了安全起见,如何取舍自己考虑,也可以挂载自定义配置文件替换默认配置. 特别标注一下, 从5.0开始,传递变量不使用-Des, 而是使用-E 加上key/value的键值参数,如-Enode.name=test_node for example: 拉取镜像: ``` docker pull qq58945591/elasticsearch ``` 启动es: ``` docker run -d --name es -p 9200:9200 -p 9300:9300 qq58945591/elasticsearch -Enode.name=SERVER1 -Ecluster.name=MY_CLUSTER ```
airforce-captain/docker
elasticsearch/README.md
Markdown
lgpl-3.0
993
#ifndef GETIMAGE_GLOBAL_H #define GETIMAGE_GLOBAL_H #include <QtCore/qglobal.h> #if defined(QIMAGEGRABBER_LIBRARY) # define QIMAGEGRABBERSHARED_EXPORT Q_DECL_EXPORT #else # define QIMAGEGRABBERSHARED_EXPORT Q_DECL_IMPORT #endif #endif // GETIMAGE_GLOBAL_H
piotrbetlej/qimagegrabber
qimagegrabber/qimagegrabber_global.h
C
lgpl-3.0
261
<div class="stat-spinner"> <div ng-show="showSpinner" class="spinner"> <div class="css-spinner"><img class="fa-spin" src="/assets/images/ajax-loader.gif"></div> <p id="loading-message"> <strong><span>{{ label }}</span></strong> </p> </div> <div ng-transclude></div> </div>
sklintyg/statistik
web/src/main/webapp/components/directives/spinner/spinner.html
HTML
lgpl-3.0
296
<?php /** * This source file is part of GotCms. * * GotCms is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * GotCms is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along * with GotCms. If not, see <http://www.gnu.org/licenses/lgpl-3.0.html>. * * PHP Version >=5.3 * * @category Gc_Application * @package Content * @subpackage Config * @author Pierre Rambaud (GoT) <pierre.rambaud86@gmail.com> * @license GNU/LGPL http://www.gnu.org/licenses/lgpl-3.0.html * @link http://www.got-cms.com */ use Gc\Document\Model as DocumentModel; return array( 'controllers' => array( 'invokables' => array( 'ContentController' => 'Content\Controller\IndexController', 'DocumentController' => 'Content\Controller\DocumentController', 'MediaController' => 'Content\Controller\MediaController', 'TranslationController' => 'Content\Controller\TranslationController', ), ), 'view_manager' => array( 'template_path_stack' => array( 'content' => __DIR__ . '/../views', ), ), 'router' => array( 'routes' => array( 'content' => array( 'type' => 'Literal', 'options' => array( 'route' => '/admin/content', 'defaults' => array ( 'module' => 'content', 'controller' => 'ContentController', 'action' => 'index', ), ), 'may_terminate' => true, 'child_routes' => array( 'translation' => array( 'type' => 'Literal', 'options' => array( 'route' => '/translation', 'defaults' => array ( 'module' => 'content', 'controller' => 'TranslationController', 'action' => 'index', ), ), 'may_terminate' => true, 'child_routes' => array( 'create' => array( 'type' => 'Literal', 'options' => array( 'route' => '/create', 'defaults' => array ( 'module' => 'content', 'controller' => 'TranslationController', 'action' => 'create', ), ), ), 'download' => array( 'type' => 'Literal', 'options' => array( 'route' => '/download', 'defaults' => array ( 'module' => 'content', 'controller' => 'TranslationController', 'action' => 'download', ), ), ), 'upload' => array( 'type' => 'Literal', 'options' => array( 'route' => '/upload', 'defaults' => array ( 'module' => 'content', 'controller' => 'TranslationController', 'action' => 'upload', ), ), ), 'search' => array( 'type' => 'Segment', 'options' => array( 'route' => '/search/:query', 'defaults' => array ( 'module' => 'content', 'controller' => 'TranslationController', 'action' => 'search', ), ), ), ) ), 'document' => array( 'type' => 'Literal', 'options' => array( 'route' => '/document', ), 'may_terminate' => true, 'child_routes' => array( 'create' => array( 'type' => 'Literal', 'options' => array( 'route' => '/create', 'defaults' => array ( 'module' => 'content', 'controller' => 'DocumentController', 'action' => 'create', ), ), ), 'create-w-parent' => array( 'type' => 'Segment', 'options' => array( 'route' => '/create/parent/:id', 'defaults' => array ( 'module' => 'content', 'controller' => 'DocumentController', 'action' => 'create', ), ), ), 'edit' => array( 'type' => 'Segment', 'options' => array( 'route' => '/edit/:id', 'defaults' => array ( 'module' => 'content', 'controller' => 'DocumentController', 'action' => 'edit', ), ), ), 'delete' => array( 'type' => 'Segment', 'options' => array( 'route' => '/delete/:id', 'defaults' => array ( 'module' => 'content', 'controller' => 'DocumentController', 'action' => 'delete', ), ), ), 'copy' => array( 'type' => 'Segment', 'options' => array( 'route' => '/copy/:id', 'defaults' => array ( 'module' => 'content', 'controller' => 'DocumentController', 'action' => 'copy', ), ), ), 'cut' => array( 'type' => 'Segment', 'options' => array( 'route' => '/cut/:id', 'defaults' => array ( 'module' => 'content', 'controller' => 'DocumentController', 'action' => 'cut', ), ), ), 'paste' => array( 'type' => 'Segment', 'options' => array( 'route' => '/paste/:id', 'defaults' => array ( 'module' => 'content', 'controller' => 'DocumentController', 'action' => 'paste', ), ), ), 'refresh-treeview' => array( 'type' => 'Segment', 'options' => array( 'route' => '/refresh-treeview/:id', 'defaults' => array ( 'module' => 'content', 'controller' => 'DocumentController', 'action' => 'refresh-treeview', ), ), ), 'sort' => array( 'type' => 'Segment', 'options' => array( 'route' => '/sort', 'defaults' => array ( 'module' => 'content', 'controller' => 'DocumentController', 'action' => 'sort-order', ), ), ), 'publish' => array( 'type' => 'Segment', 'options' => array( 'route' => '/publish/:id', 'defaults' => array ( 'module' => 'content', 'controller' => 'DocumentController', 'action' => 'status', 'status' => DocumentModel::STATUS_ENABLE, ), ), ), 'unpublish' => array( 'type' => 'Segment', 'options' => array( 'route' => '/unpublish/:id', 'defaults' => array ( 'module' => 'content', 'controller' => 'DocumentController', 'action' => 'status', 'status' => DocumentModel::STATUS_DISABLE, ), ), ), ), ), 'media' => array( 'type' => 'Segment', 'options' => array( 'route' => '/media', 'defaults' => array ( 'module' => 'content', 'controller' => 'MediaController', 'action' => 'index', ), ), 'may_terminate' => true, 'child_routes' => array( 'connector' => array( 'type' => 'Segment', 'options' => array( 'route' => '/connector', 'defaults' => array ( 'module' => 'content', 'controller' => 'MediaController', 'action' => 'connector', ), ), ), 'upload' => array( 'type' => 'Segment', 'options' => array( 'route' => '/upload/document/:document_id/property/:property_id', 'defaults' => array ( 'module' => 'content', 'controller' => 'MediaController', 'action' => 'upload', ), ), ), 'remove' => array( 'type' => 'Segment', 'options' => array( 'route' => '/remove/document/:document_id/property/:property_id/:file/', 'defaults' => array ( 'module' => 'content', 'controller' => 'MediaController', 'action' => 'remove', ), ), ), ) ), ) ), ), ) );
sophpie/testCd
module/Content/config/module.config.php
PHP
lgpl-3.0
15,458
from vertebra.actor import actor class test_00_actor: def test_00_instantiate(self): """actor: can instantiate a base actor""" a = actor() assert isinstance(a,actor), "instantiated actor is actually an actor"
jvantuyl/vertebra-py
tests/test_20_actor.py
Python
lgpl-3.0
224
package org.eso.ias.asce.exceptions /** * Exception thrown by the TF when the passed property * has a wrong value * * @param value: the wrong value of the property * @param name: the name of the property * @param cause: the cause */ class WrongPropValue(name: String, value: String, cause: Throwable) extends Exception("Wrong value "+value+" for property "+name,cause) { assert(Option[String](name).isDefined && !name.isEmpty()) assert(Option[String](value).isDefined) /** * Overloaded constructor with no value * * @param name: the name of the property * @param cause: the cause */ def this(name: String, t: Throwable) = this(name,"",t) /** * Overloaded constructor with no cause and no value * * @param name: the name of the property with a wrong value */ def this(name: String) = this(name,"",null) /** * Overloaded constructor with no cause and no value * * @param name: the name of the property with a wrong value * @param value: the wrong value of the property */ def this(name: String, value: String) = this(name,value,null) }
IntegratedAlarmSystem-Group/ias
CompElement/src/main/scala/org/eso/ias/asce/exceptions/WrongPropValue.scala
Scala
lgpl-3.0
1,117
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Copyright (C) 2011-2014 German Aerospace Center DLR (Deutsches Zentrum fuer Luft- und Raumfahrt e.V.), Institute of System Dynamics and Control and BAUSCH-GALL GmbH, Munich All rights reserved. This file is licensed under the "BSD New" license (see also http://opensource.org/licenses/BSD-3-Clause): Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the German Aerospace Center nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ''' import zipfile import collections import os from operator import itemgetter import pyMtsf from ...Simulator.FMUSimulator.FMIDescription1 import FMIDescription StandardSeriesForFmi = [pyMtsf.Series('Fixed', None, 'constant', 1), pyMtsf.Series('Continuous', 'Time', 'linear', 100), pyMtsf.Series('Discrete', 'TimeDiscrete', 'constant', 10)] def convertFromFmi(fmuFilename, fmi=None): ''' Returns data to initialize an MTSF result file from an FMU. The call to initialize an MTSF result file is pyMtsf.MTSF(resultFileName, modelDescription, modelVariables, experimentSetup, simpleTypes, units, enumerationsMatrix) The missing data is resultFileName and experimentSetup to be specified before initializing the MTSF object. Inputs Type: fmuFilename String fmi FMIDescription [optional] if fmi is given, then fmuFilename is ignored. Otherwise the FMI description is loaded from the given file. Outputs modelDescription pyMtsf.ModelDescription modelVariables pyMtsf.ModelVariables simpleTypes list of pyMtsf.SimpleType units list of pyMtsf.Unit enumerationsMatrix list of pyMtsf.Enumeration ''' def _None2Str(x): if x is None: return '' else: return x # Load FMIDescription if necessary if fmi is None: fmuFile = zipfile.ZipFile(os.getcwd() + u'\\' + fmuFilename + u'.fmu', 'r') fmi = FMIDescription(fmuFile.open('modelDescription.xml')) # Prepare some variables allSeriesNames = [x.name for x in StandardSeriesForFmi] variable = collections.OrderedDict() simpleTypes = [] units = [] enumerationsMatrix = [] variable['Time'] = pyMtsf.ScalarModelVariable('Continuous Time', 'input', 0, 'continuous', allSeriesNames.index('Continuous'), pyMtsf.StandardCategoryNames.index(pyMtsf.CategoryMapping['Real']), None, 0) variable['TimeDiscrete'] = pyMtsf.ScalarModelVariable('Discrete Time at events', 'input', 0, 'discrete', allSeriesNames.index('Discrete'), pyMtsf.StandardCategoryNames.index(pyMtsf.CategoryMapping['Real']), None, 0) # Alias for var in fmi.scalarVariables.values(): if var.alias is None or var.alias.lower() == "noalias": var.alias = 'NOAlias' # To guarantee that this variable is the first # one in sorted order referenceList = [(x, y.valueReference, y.alias) for x, y in fmi.scalarVariables.iteritems()] referenceList.sort(key=itemgetter(2)) referenceList.sort(key=itemgetter(1)) for index in xrange(len(referenceList)): variableName = referenceList[index][0] if referenceList[index][2] in ['alias', 'negatedAlias']: valueReference = referenceList[index][1] prevValueReference = referenceList[index - 1][1] if prevValueReference != valueReference: raise ValueError("No original variable found for alias " + variableName) if referenceList[index - 1][2] == "NOAlias": originName = referenceList[index - 1][0] else: originName = fmi.scalarVariables[referenceList[index - 1][0]].aliasName fmi.scalarVariables[variableName].aliasName = originName else: fmi.scalarVariables[variableName].aliasName = None # Types and display units uniqueSimpleType = [] for fmiVariableName, fmiVariable in fmi.scalarVariables.iteritems(): type = fmiVariable.type unitList = [_None2Str(type.unit) + _None2Str(type.displayUnit)] if fmi.units.has_key(type.unit): for displayUnitName, displayUnit in fmi.units[type.unit].iteritems(): if displayUnitName != type.unit: unitList.append(displayUnitName + '{:.16e}'.format(displayUnit.gain) + '{:.16e}'.format(displayUnit.offset)) # unitList.sort() dataType = type.type enumerations = '' if dataType == 'Enumeration': enumerations = ''.join([_None2Str(x[0]) + _None2Str(x[1]) for x in type.item]) uniqueSimpleType.append((fmiVariableName, type, _None2Str(type.name) + str(pyMtsf.DataType[dataType]) + _None2Str(type.quantity) + str(type.relativeQuantity), ''.join(unitList), enumerations)) # Simple Types uniqueSimpleType.sort(key=itemgetter(3)) uniqueSimpleType.sort(key=itemgetter(2)) lastUniqueStr = '' rowIndex = dict() lastIndex = -1 uniqueDisplayUnit = [] uniqueEnumerations = [] for s in uniqueSimpleType: fmiVariableName = s[0] type = s[1] uniqueStr = s[2] + s[3] + s[4] if uniqueStr == lastUniqueStr: rowIndex[fmiVariableName] = lastIndex else: lastUniqueStr = uniqueStr lastIndex += 1 rowIndex[fmiVariableName] = lastIndex uniqueDisplayUnit.append((type, lastIndex, s[3])) uniqueEnumerations.append((type, lastIndex, s[4])) dataType = type.type simpleTypes.append(pyMtsf.SimpleType(type.name, pyMtsf.DataType[dataType], type.quantity, type.relativeQuantity, -1, type.description)) # Units uniqueDisplayUnit.sort(key=itemgetter(2)) lastUniqueStr = '' startRow = -1 for s in uniqueDisplayUnit: type = s[0] k = s[1] uniqueStr = s[2] if uniqueStr == lastUniqueStr: simpleTypes[k].unitOrEnumerationRow = startRow else: lastUniqueStr = uniqueStr if uniqueStr != '': # There is a unit definition startRow = len(units) units.append(pyMtsf.Unit(type.unit, 1.0, 0.0, 0)) if fmi.units.has_key(type.unit): for displayUnitName, displayUnit in fmi.units[type.unit].iteritems(): if displayUnitName != type.unit: if type.displayUnit is not None and type.displayUnit != '' and type.displayUnit == displayUnitName: mode = 2 # DefaultDisplayUnit else: mode = 1 # DisplayUnit units.append(pyMtsf.Unit(displayUnitName, displayUnit.gain, displayUnit.offset, mode)) simpleTypes[k].unitOrEnumerationRow = startRow else: startRow = -1 # Enumerations uniqueEnumerations.sort(key=itemgetter(2)) lastUniqueStr = '' startRow = -1 for s in uniqueEnumerations: type = s[0] k = s[1] uniqueStr = s[2] if uniqueStr != '': if uniqueStr == lastUniqueStr: simpleTypes[k].unitOrEnumerationRow = startRow else: lastUniqueStr = uniqueStr startRow = len(enumerationsMatrix) j = 0 for enum in type.item: j += 1 if j == 1: firstEntry = 1 else: firstEntry = 0 enumerationsMatrix.append(pyMtsf.Enumeration(enum[0], j, enum[1], firstEntry)) simpleTypes[k].unitOrEnumerationRow = startRow # Iterate over all fmi-variables for fmiVariableName, fmiVariable in fmi.scalarVariables.iteritems(): variableType = fmiVariable.type.type if variableType != "String": # Do not support strings variability = fmiVariable.variability aliasNegated = 0 aliasName = fmiVariable.aliasName if aliasName is not None: if fmiVariable.alias == 'negatedAlias': aliasNegated = 1 # Due to possibly insufficient information in xml-file variability = fmi.scalarVariables[aliasName].variability categoryIndex = pyMtsf.StandardCategoryNames.index(pyMtsf.CategoryMapping[variableType]) if variability in ['constant', 'parameter']: seriesIndex = allSeriesNames.index('Fixed') elif variability == 'discrete': seriesIndex = allSeriesNames.index('Discrete') else: seriesIndex = allSeriesNames.index('Continuous') causality = fmiVariable.causality # Due to FMI 1.0; in vers. 2.0 this should not be necessary if causality is None: causality = 'local' if variability == 'parameter': causality = 'parameter' variability = 'fixed' if causality in ['internal', 'none']: causality = 'local' simpleTypeRow = rowIndex[fmiVariableName] variable[fmiVariableName] = pyMtsf.ScalarModelVariable(fmiVariable.description, causality, simpleTypeRow, variability, seriesIndex, categoryIndex, aliasName, aliasNegated) # Some basics for independent time variables startRow = len(units) units.append(pyMtsf.Unit('s', 1.0, 0.0, 0)) units.append(pyMtsf.Unit('ms', 0.001, 0.0, 1)) units.append(pyMtsf.Unit('min', 60.0, 0.0, 1)) units.append(pyMtsf.Unit('h', 3600.0, 0.0, 1)) units.append(pyMtsf.Unit('d', 86400.0, 0.0, 1)) simpleTypes.append(pyMtsf.SimpleType('Time', pyMtsf.DataType["Real"], 'Time', False, startRow, '')) variable['Time'].simpleTypeRow = len(simpleTypes) - 1 variable['TimeDiscrete'].simpleTypeRow = len(simpleTypes) - 1 modelDescription = pyMtsf.ModelDescription(fmi.modelName, fmi.description, fmi.author, fmi.version, fmi.generationTool, fmi.generationDateAndTime, fmi.variableNamingConvention) modelVariables = pyMtsf.ModelVariables(variable, StandardSeriesForFmi, pyMtsf.StandardCategoryNames) return modelDescription, modelVariables, simpleTypes, units, enumerationsMatrix if __name__ == '__main__': import time import numpy nPoints = 60 BlockSize = 100 # Prepare information from FMU name_fmu_file = u'Examples/fullRobot' (modelDescription, modelVariables, simpleTypes, units, enumerations) = convertFromFmi(name_fmu_file) modelVariables.allSeries[1].initialRows = nPoints * BlockSize # Continuous # Phase 1 of result file generation resultFileName = name_fmu_file + unicode(nPoints) + u'.mtsf' experimentSetup = pyMtsf.ExperimentSetup(startTime=0.0, stopTime=4.78, algorithm="Dassl", relativeTolerance=1e-7, author="", description="Test experiment", generationDateAndTime=time.strftime("%a, %d %b %Y %H:%M:%S", time.gmtime()), generationTool="Python", machine=os.getenv('COMPUTERNAME'), cpuTime="") startTime = time.clock() # Create result object mtsf = pyMtsf.MTSF(resultFileName, modelDescription, modelVariables, experimentSetup, simpleTypes, units, enumerations) # Some aliases realParameter = mtsf.results.series['Fixed'].category[pyMtsf.CategoryMapping['Real']] # integerParameter = mtsf.results.series['Fixed'].category[CategoryMapping['Integer']] booleanParameter = mtsf.results.series['Fixed'].category[pyMtsf.CategoryMapping['Boolean']] realContinuous = mtsf.results.series['Continuous'].category[pyMtsf.CategoryMapping['Real']] realDiscrete = mtsf.results.series['Discrete'].category[pyMtsf.CategoryMapping['Real']] # integerDiscrete = mtsf.results.series['Discrete'].category[CategoryMapping['Integer']] booleanDiscrete = mtsf.results.series['Discrete'].category[pyMtsf.CategoryMapping['Boolean']] # ************************************* # Phase 2 of result file generation print "Write Data ..." realParameter.writeData(numpy.random.rand(1, realParameter.nColumn) * 2e5 - 1e5) # integerParameter.writeData(numpy.floor(0.5+numpy.random.rand(1,integerParameter.nColumn)*2e5-1e5).astype(int)) booleanParameter.writeData(numpy.floor(0.5 + numpy.random.rand(1, booleanParameter.nColumn)).astype(int)) for i in range(nPoints): # write continuous realContinuous.writeData(numpy.random.rand(BlockSize, realContinuous.nColumn) * 2e5 - 1e5) # write discrete # booleanDiscrete.writeData(numpy.floor(0.5+numpy.random.rand(2, booleanDiscrete.nColumn)).astype(int)) # realDiscrete.writeData(numpy.random.rand(2, realDiscrete.nColumn)*2e5 - 1e5) # integerDiscrete.writeData(numpy.floor(0.5+numpy.random.rand(2, integerDiscrete.nColumn)*2e5-1e5).astype(int)) # write String # mtsf.series['Continuous'].categories['H5T_C_S1'].writeData(numpy.ones((1,k_str),dtype=numpy.str_)) # Write times: # realContinuous.member[0].dataset[:,0] = numpy.linspace(0,1,realContinuous.member[0].dataset.shape[0]) # realDiscrete.member[0].dataset[:,0] = numpy.linspace(0,1,realDiscrete.member[0].dataset.shape[0]) print "Data written." # **************************************** # Phase 3 of result file generation mtsf.close() print "Elapsed time = " + format(time.clock() - startTime, '0.2f') + " s."
PySimulator/PySimulator
PySimulator/Plugins/SimulationResult/Mtsf/MtsfFmi.py
Python
lgpl-3.0
15,300
using System.Collections.Generic; using System.Linq; using Kingsland.MofParser.Ast; using Kingsland.MofParser.Tokens; namespace Kingsland.MofParser.Parsing { public static class Parser { public static AstNode Parse(List<Token> lexerTokens) { // remove all comments and whitespace var tokens = lexerTokens.Where(lt => !(lt is MultilineCommentToken) && !(lt is WhitespaceToken)).ToList(); var stream = new ParserStream(tokens); var program = MofSpecificationAst.Parse(stream); return program; } } }
sergey-raevskiy/MofParser
src/Kingsland.MofParser/Parsing/Parser.cs
C#
lgpl-3.0
659
/* -*- mode:C++ -*- FailCodes.h Listing of failure codes Copyright (C) 2014 The Regents of the University of New Mexico. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** \file FailCodes.h Listing of failure codes \author David H. Ackley. \date (C) 2014 All rights reserved. \lgpl */ XX(INCOMPLETE_CODE) XX(ILLEGAL_ARGUMENT) XX(NULL_POINTER) XX(ILLEGAL_STATE) XX(UNINITIALIZED_VALUE) XX(ARRAY_INDEX_OUT_OF_BOUNDS) XX(DUPLICATE_ENTRY) XX(UNCAUGHT_FAILURE) XX(UNKNOWN_ELEMENT) XX(UNREACHABLE_CODE) XX(OUT_OF_ROOM) XX(NOT_FOUND) XX(BAD_FORMAT_ARG) XX(IO_ERROR) XX(OUT_OF_RESOURCES) XX(ILLEGAL_INPUT) XX(NON_ZERO) XX(UNSUPPORTED_OPERATION) XX(INCONSISTENT_ATOM) XX(DEPRECATED) XX(LOCK_FAILURE)
Sixstring982/MFMv2-city
src/core/include/FailCodes.h
C
lgpl-3.0
1,444
/* * SonarQube * Copyright (C) 2009-2017 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonarqube.ws.client.issue; import static java.util.Objects.requireNonNull; public class EditCommentRequest { private final String comment; private final String text; public EditCommentRequest(String comment, String text) { this.comment = requireNonNull(comment, "Comment key cannot be null"); this.text = requireNonNull(text, "Text cannot be null"); } public String getComment() { return comment; } public String getText() { return text; } }
lbndev/sonarqube
sonar-ws/src/main/java/org/sonarqube/ws/client/issue/EditCommentRequest.java
Java
lgpl-3.0
1,335
/* Copyright 2013-2021 Paul Colby This file is part of QtAws. QtAws is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. QtAws is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the QtAws. If not, see <http://www.gnu.org/licenses/>. */ #include "updaterecordsrequest.h" #include "updaterecordsrequest_p.h" #include "updaterecordsresponse.h" #include "cognitosyncrequest_p.h" namespace QtAws { namespace CognitoSync { /*! * \class QtAws::CognitoSync::UpdateRecordsRequest * \brief The UpdateRecordsRequest class provides an interface for CognitoSync UpdateRecords requests. * * \inmodule QtAwsCognitoSync * * <fullname>Amazon Cognito Sync</fullname> * * Amazon Cognito Sync provides an AWS service and client library that enable cross-device syncing of application-related * user data. High-level client libraries are available for both iOS and Android. You can use these libraries to persist * data locally so that it's available even if the device is offline. Developer credentials don't need to be stored on the * mobile device to access the service. You can use Amazon Cognito to obtain a normalized user ID and credentials. User * data is persisted in a dataset that can store up to 1 MB of key-value pairs, and you can have up to 20 datasets per user * * identity> * * With Amazon Cognito Sync, the data stored for each identity is accessible only to credentials assigned to that identity. * In order to use the Cognito Sync service, you need to make API calls using credentials retrieved with <a * href="http://docs.aws.amazon.com/cognitoidentity/latest/APIReference/Welcome.html">Amazon Cognito Identity * * service</a>> * * If you want to use Cognito Sync in an Android or iOS application, you will probably want to make API calls via the AWS * Mobile SDK. To learn more, see the <a * href="http://docs.aws.amazon.com/mobile/sdkforandroid/developerguide/cognito-sync.html">Developer Guide for Android</a> * and the <a href="http://docs.aws.amazon.com/mobile/sdkforios/developerguide/cognito-sync.html">Developer Guide for * * \sa CognitoSyncClient::updateRecords */ /*! * Constructs a copy of \a other. */ UpdateRecordsRequest::UpdateRecordsRequest(const UpdateRecordsRequest &other) : CognitoSyncRequest(new UpdateRecordsRequestPrivate(*other.d_func(), this)) { } /*! * Constructs a UpdateRecordsRequest object. */ UpdateRecordsRequest::UpdateRecordsRequest() : CognitoSyncRequest(new UpdateRecordsRequestPrivate(CognitoSyncRequest::UpdateRecordsAction, this)) { } /*! * \reimp */ bool UpdateRecordsRequest::isValid() const { return false; } /*! * Returns a UpdateRecordsResponse object to process \a reply. * * \sa QtAws::Core::AwsAbstractClient::send */ QtAws::Core::AwsAbstractResponse * UpdateRecordsRequest::response(QNetworkReply * const reply) const { return new UpdateRecordsResponse(*this, reply); } /*! * \class QtAws::CognitoSync::UpdateRecordsRequestPrivate * \brief The UpdateRecordsRequestPrivate class provides private implementation for UpdateRecordsRequest. * \internal * * \inmodule QtAwsCognitoSync */ /*! * Constructs a UpdateRecordsRequestPrivate object for CognitoSync \a action, * with public implementation \a q. */ UpdateRecordsRequestPrivate::UpdateRecordsRequestPrivate( const CognitoSyncRequest::Action action, UpdateRecordsRequest * const q) : CognitoSyncRequestPrivate(action, q) { } /*! * Constructs a copy of \a other, with public implementation \a q. * * This copy-like constructor exists for the benefit of the UpdateRecordsRequest * class' copy constructor. */ UpdateRecordsRequestPrivate::UpdateRecordsRequestPrivate( const UpdateRecordsRequestPrivate &other, UpdateRecordsRequest * const q) : CognitoSyncRequestPrivate(other, q) { } } // namespace CognitoSync } // namespace QtAws
pcolby/libqtaws
src/cognitosync/updaterecordsrequest.cpp
C++
lgpl-3.0
4,342