code stringlengths 5 1.01M | repo_name stringlengths 5 84 | path stringlengths 4 311 | language stringclasses 30 values | license stringclasses 15 values | size int64 5 1.01M | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|
<?php
namespace App\Command\Import;
use App\Command\BaseCommand;
use App\Entity\Framework\LsDoc;
class MarkImportLogsAsReadCommand extends BaseCommand
{
/**
* @var LsDoc
*/
private $doc;
public function __construct(LsDoc $doc)
{
$this->doc = $doc;
}
public function getDoc(): LsDoc
{
return $this->doc;
}
}
| opensalt/opensalt | core/src/Command/Import/MarkImportLogsAsReadCommand.php | PHP | mit | 371 | [
30522,
1026,
1029,
25718,
3415,
15327,
10439,
1032,
3094,
1032,
12324,
1025,
2224,
10439,
1032,
3094,
1032,
2918,
9006,
2386,
2094,
1025,
2224,
10439,
1032,
9178,
1032,
7705,
1032,
1048,
16150,
10085,
1025,
2465,
2928,
5714,
6442,
21197,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Copyright 2020 The Cobalt Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# NOTE:
# libdav1d's build process will generate this file and populate it with defines
# that configure the project appropriately and set compilation flags. These
# flags are migrated into Cobalt's gyp and ninja build process which makes this
# file superfluous. However, we keep |config.asm| since the file is referenced
# in the includes for several source files and to keep the overall code changes
# low for ease of rebasing upstream changes from libdav1d.
| youtube/cobalt | third_party/libdav1d/include/config.asm | Assembly | bsd-3-clause | 1,067 | [
30522,
1001,
9385,
12609,
1996,
25627,
6048,
1012,
2035,
2916,
9235,
1012,
1001,
1001,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1001,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
| WARNING: You MUST set this value!
|
| If it is not set, then CodeIgniter will try guess the protocol and path
| your installation, but due to security concerns the hostname will be set
| to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise.
| The auto-detection mechanism exists only for convenience during
| development and MUST NOT be used in production!
|
| If you need to allow multiple domains, remember that this file is still
| a PHP script and you can easily do that on your own.
|
*/
$config['base_url'] = '';
/*
|-------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';
/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string. The default setting of 'REQUEST_URI' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'REQUEST_URI' Uses $_SERVER['REQUEST_URI']
| 'QUERY_STRING' Uses $_SERVER['QUERY_STRING']
| 'PATH_INFO' Uses $_SERVER['PATH_INFO']
|
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
$config['uri_protocol'] = 'REQUEST_URI';
/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| https://codeigniter.com/user_guide/general/urls.html
*/
$config['url_suffix'] = '';
/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language'] = 'english';
/*
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
|
| This determines which character set is used by default in various methods
| that require a character set to be provided.
|
| See http://php.net/htmlspecialchars for a list of supported charsets.
|
*/
$config['charset'] = 'UTF-8';
/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
| If you would like to use the 'hooks' feature you must enable it by
| setting this variable to TRUE (boolean). See the user guide for details.
|
*/
$config['enable_hooks'] = FALSE;
/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries. For more information please see the user guide:
|
| https://codeigniter.com/user_guide/general/core_classes.html
| https://codeigniter.com/user_guide/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'MY_';
/*
|--------------------------------------------------------------------------
| Composer auto-loading
|--------------------------------------------------------------------------
|
| Enabling this setting will tell CodeIgniter to look for a Composer
| package auto-loader script in application/vendor/autoload.php.
|
| $config['composer_autoload'] = TRUE;
|
| Or if you have your vendor/ directory located somewhere else, you
| can opt to set a specific path as well:
|
| $config['composer_autoload'] = '/path/to/vendor/autoload.php';
|
| For more information about Composer, please visit http://getcomposer.org/
|
| Note: This will NOT disable or override the CodeIgniter-specific
| autoloading (application/config/autoload.php)
*/
$config['composer_autoload'] = FALSE;
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify which characters are permitted within your URLs.
| When someone tries to submit a URL with disallowed characters they will
| get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| The configured value is actually a regular expression character group
| and it will be executed as: ! preg_match('/^[<permitted_uri_chars>]+$/i
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
| Options are: TRUE or FALSE (boolean)
|
| The other items let you set the query string 'words' that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
/*
|--------------------------------------------------------------------------
| Allow $_GET array
|--------------------------------------------------------------------------
|
| By default CodeIgniter enables access to the $_GET array. If for some
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['allow_get_array'] = TRUE;
/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
| 0 = Disables logging, Error logging TURNED OFF
| 1 = Error Messages (including PHP errors)
| 2 = Debug Messages
| 3 = Informational Messages
| 4 = All Messages
|
| You can also pass an array with threshold levels to show individual error types
|
| array(2) = Debug Messages, without Error Messages
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/
$config['log_threshold'] = 0;
/*
|--------------------------------------------------------------------------
| Error Logging Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/logs/ directory. Use a full server path with trailing slash.
|
*/
$config['log_path'] = '';
/*
|--------------------------------------------------------------------------
| Log File Extension
|--------------------------------------------------------------------------
|
| The default filename extension for log files. The default 'php' allows for
| protecting the log files via basic scripting, when they are to be stored
| under a publicly accessible directory.
|
| Note: Leaving it blank will default to 'php'.
|
*/
$config['log_file_extension'] = '';
/*
|--------------------------------------------------------------------------
| Log File Permissions
|--------------------------------------------------------------------------
|
| The file system permissions to be applied on newly created log files.
|
| IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
| integer notation (i.e. 0700, 0644, etc.)
*/
$config['log_file_permissions'] = 0644;
/*
|--------------------------------------------------------------------------
| Date Format for Logs
|--------------------------------------------------------------------------
|
| Each item that is logged has an associated date. You can use PHP date
| codes to set your own date formatting
|
*/
$config['log_date_format'] = 'Y-m-d H:i:s';
/*
|--------------------------------------------------------------------------
| Error Views Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/views/errors/ directory. Use a full server path with trailing slash.
|
*/
$config['error_views_path'] = '';
/*
|--------------------------------------------------------------------------
| Cache Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/cache/ directory. Use a full server path with trailing slash.
|
*/
$config['cache_path'] = '';
/*
|--------------------------------------------------------------------------
| Cache Include Query String
|--------------------------------------------------------------------------
|
| Whether to take the URL query string into consideration when generating
| output cache files. Valid options are:
|
| FALSE = Disabled
| TRUE = Enabled, take all query parameters into account.
| Please be aware that this may result in numerous cache
| files generated for the same page over and over again.
| array('q') = Enabled, but only take into account the specified list
| of query parameters.
|
*/
$config['cache_query_string'] = FALSE;
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| If you use the Encryption class, you must set an encryption key.
| See the user guide for more info.
|
| https://codeigniter.com/user_guide/libraries/encryption.html
|
*/
$config['encryption_key'] = '';
/*
|--------------------------------------------------------------------------
| Session Variables
|--------------------------------------------------------------------------
|
| 'sess_driver'
|
| The storage driver to use: files, database, redis, memcached
|
| 'sess_cookie_name'
|
| The session cookie name, must contain only [0-9a-z_-] characters
|
| 'sess_expiration'
|
| The number of SECONDS you want the session to last.
| Setting to 0 (zero) means expire when the browser is closed.
|
| 'sess_save_path'
|
| The location to save sessions to, driver dependent.
|
| For the 'files' driver, it's a path to a writable directory.
| WARNING: Only absolute paths are supported!
|
| For the 'database' driver, it's a table name.
| Please read up the manual for the format with other session drivers.
|
| IMPORTANT: You are REQUIRED to set a valid save path!
|
| 'sess_match_ip'
|
| Whether to match the user's IP address when reading the session data.
|
| WARNING: If you're using the database driver, don't forget to update
| your session table's PRIMARY KEY when changing this setting.
|
| 'sess_time_to_update'
|
| How many seconds between CI regenerating the session ID.
|
| 'sess_regenerate_destroy'
|
| Whether to destroy session data associated with the old session ID
| when auto-regenerating the session ID. When set to FALSE, the data
| will be later deleted by the garbage collector.
|
| Other session cookie settings are shared with the rest of the application,
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
|
*/
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
/*
|--------------------------------------------------------------------------
| Cookie Related Variables
|--------------------------------------------------------------------------
|
| 'cookie_prefix' = Set a cookie name prefix if you need to avoid collisions
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
| 'cookie_path' = Typically will be a forward slash
| 'cookie_secure' = Cookie will only be set if a secure HTTPS connection exists.
| 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript)
|
| Note: These settings (with the exception of 'cookie_prefix' and
| 'cookie_httponly') will also affect sessions.
|
*/
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;
/*
|--------------------------------------------------------------------------
| Standardize newlines
|--------------------------------------------------------------------------
|
| Determines whether to standardize newline characters in input data,
| meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value.
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['standardize_newlines'] = FALSE;
/*
|--------------------------------------------------------------------------
| Global XSS Filtering
|--------------------------------------------------------------------------
|
| Determines whether the XSS filter is always active when GET, POST or
| COOKIE data is encountered
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['global_xss_filtering'] = FALSE;
/*
|--------------------------------------------------------------------------
| Cross Site Request Forgery
|--------------------------------------------------------------------------
| Enables a CSRF cookie token to be set. When set to TRUE, token will be
| checked on a submitted form. If you are accepting user data, it is strongly
| recommended CSRF protection be enabled.
|
| 'csrf_token_name' = The token name
| 'csrf_cookie_name' = The cookie name
| 'csrf_expire' = The number in seconds the token should expire.
| 'csrf_regenerate' = Regenerate token on every submission
| 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks
*/
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = array();
/*
|--------------------------------------------------------------------------
| Output Compression
|--------------------------------------------------------------------------
|
| Enables Gzip output compression for faster page loads. When enabled,
| the output class will test whether your server supports Gzip.
| Even if it does, however, not all browsers support compression
| so enable only if you are reasonably sure your visitors can handle it.
|
| Only used if zlib.output_compression is turned off in your php.ini.
| Please do not use it together with httpd-level output compression.
|
| VERY IMPORTANT: If you are getting a blank page when compression is enabled it
| means you are prematurely outputting something to your browser. It could
| even be a line of whitespace at the end of one of your scripts. For
| compression to work, nothing can be sent before the output buffer is called
| by the output class. Do not 'echo' any values with compression enabled.
|
*/
$config['compress_output'] = FALSE;
/*
|--------------------------------------------------------------------------
| Master Time Reference
|--------------------------------------------------------------------------
|
| Options are 'local' or any PHP supported timezone. This preference tells
| the system whether to use your server's local time as the master 'now'
| reference, or convert it to the configured one timezone. See the 'date
| helper' page of the user guide for information regarding date handling.
|
*/
$config['time_reference'] = 'local';
/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
|--------------------------------------------------------------------------
|
| If your PHP installation does not have short tag support enabled CI
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
| in your view files. Options are TRUE or FALSE (boolean)
|
| Note: You need to have eval() enabled for this to work.
|
*/
$config['rewrite_short_tags'] = FALSE;
/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
|--------------------------------------------------------------------------
|
| If your server is behind a reverse proxy, you must whitelist the proxy
| IP addresses from which CodeIgniter should trust headers such as
| HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify
| the visitor's IP address.
|
| You can use both an array or a comma-separated list of proxy addresses,
| as well as specifying whole subnets. Here are a few examples:
|
| Comma-separated: '10.0.1.200,192.168.5.0/24'
| Array: array('10.0.1.200', '192.168.5.0/24')
*/
$config['proxy_ips'] = '';
| shreyakl/Excello | application/config/config.php | PHP | mit | 18,425 | [
30522,
1026,
1029,
25718,
4225,
1006,
1005,
2918,
15069,
1005,
1007,
2030,
6164,
1006,
1005,
2053,
3622,
5896,
3229,
3039,
1005,
1007,
1025,
1013,
1008,
1064,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php header('Content-type: text/html; charset=iso-8859-1'); ?><html>
<head>
<title>Administration Help</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body style="font-family: Verdana; font-size: 10px" link="#000000" vlink="#000000" alink="#000000" bgcolor="#FFFFFF">
<center><big><b>Calendar Administration</b></big></center><br>
<li><b>Index</b> : Events list<br>
<br>
<li><b>Add event </b> : To add an event<br>
<br>
<li><b>Edit event</b> : To edit an event<br>
<br>
<li><b>Preferences</b> : Calendar's preferences<br>
<br>
</body></html> | donaldinou/nuked-gamer | help/english/Calendar.php | PHP | gpl-2.0 | 586 | [
30522,
1026,
1029,
25718,
20346,
1006,
1005,
4180,
1011,
2828,
1024,
3793,
1013,
16129,
1025,
25869,
13462,
1027,
11163,
1011,
6070,
28154,
1011,
1015,
1005,
1007,
1025,
1029,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
2516,
1028,
344... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using Lucene.Net.Diagnostics;
using System.Runtime.CompilerServices;
namespace Lucene.Net.Util.Fst
{
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using DataInput = Lucene.Net.Store.DataInput;
using DataOutput = Lucene.Net.Store.DataOutput;
/// <summary>
/// An FST <see cref="Outputs{T}"/> implementation, holding two other outputs.
/// <para/>
/// @lucene.experimental
/// </summary>
public class PairOutputs<A, B> : Outputs<PairOutputs<A, B>.Pair>
{
private readonly Pair NO_OUTPUT;
private readonly Outputs<A> outputs1;
private readonly Outputs<B> outputs2;
/// <summary>
/// Holds a single pair of two outputs. </summary>
public class Pair
{
public A Output1 { get; private set; }
public B Output2 { get; private set; }
// use newPair
internal Pair(A output1, B output2)
{
this.Output1 = output1;
this.Output2 = output2;
}
public override bool Equals(object other)
{
// LUCENENET specific - simplified expression
return ReferenceEquals(other, this) || (other is Pair pair && Output1.Equals(pair.Output1) && Output2.Equals(pair.Output2));
}
public override int GetHashCode()
{
return Output1.GetHashCode() + Output2.GetHashCode();
}
}
public PairOutputs(Outputs<A> outputs1, Outputs<B> outputs2)
{
this.outputs1 = outputs1;
this.outputs2 = outputs2;
NO_OUTPUT = new Pair(outputs1.NoOutput, outputs2.NoOutput);
}
/// <summary>
/// Create a new <see cref="Pair"/> </summary>
public virtual Pair NewPair(A a, B b)
{
if (a.Equals(outputs1.NoOutput))
{
a = outputs1.NoOutput;
}
if (b.Equals(outputs2.NoOutput))
{
b = outputs2.NoOutput;
}
if (a.Equals(outputs1.NoOutput) && b.Equals(outputs2.NoOutput))
{
return NO_OUTPUT;
}
else
{
var p = new Pair(a, b);
if (Debugging.AssertsEnabled) Debugging.Assert(Valid(p));
return p;
}
}
// for assert
private bool Valid(Pair pair)
{
bool noOutput1 = pair.Output1.Equals(outputs1.NoOutput);
bool noOutput2 = pair.Output2.Equals(outputs2.NoOutput);
if (noOutput1 && !pair.Output1.Equals(outputs1.NoOutput))
{
return false;
}
if (noOutput2 && !pair.Output2.Equals(outputs2.NoOutput))
{
return false;
}
if (noOutput1 && noOutput2)
{
if (!pair.Equals(NO_OUTPUT))
{
return false;
}
else
{
return true;
}
}
else
{
return true;
}
}
public override Pair Common(Pair pair1, Pair pair2)
{
if (Debugging.AssertsEnabled)
{
Debugging.Assert(Valid(pair1));
Debugging.Assert(Valid(pair2));
}
return NewPair(outputs1.Common(pair1.Output1, pair2.Output1), outputs2.Common(pair1.Output2, pair2.Output2));
}
public override Pair Subtract(Pair output, Pair inc)
{
if (Debugging.AssertsEnabled)
{
Debugging.Assert(Valid(output));
Debugging.Assert(Valid(inc));
}
return NewPair(outputs1.Subtract(output.Output1, inc.Output1), outputs2.Subtract(output.Output2, inc.Output2));
}
public override Pair Add(Pair prefix, Pair output)
{
if (Debugging.AssertsEnabled)
{
Debugging.Assert(Valid(prefix));
Debugging.Assert(Valid(output));
}
return NewPair(outputs1.Add(prefix.Output1, output.Output1), outputs2.Add(prefix.Output2, output.Output2));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override void Write(Pair output, DataOutput writer)
{
if (Debugging.AssertsEnabled) Debugging.Assert(Valid(output));
outputs1.Write(output.Output1, writer);
outputs2.Write(output.Output2, writer);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override Pair Read(DataInput @in)
{
A output1 = outputs1.Read(@in);
B output2 = outputs2.Read(@in);
return NewPair(output1, output2);
}
public override Pair NoOutput => NO_OUTPUT;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string OutputToString(Pair output)
{
if (Debugging.AssertsEnabled) Debugging.Assert(Valid(output));
return "<pair:" + outputs1.OutputToString(output.Output1) + "," + outputs2.OutputToString(output.Output2) + ">";
}
public override string ToString()
{
return "PairOutputs<" + outputs1 + "," + outputs2 + ">";
}
}
} | NightOwl888/lucenenet | src/Lucene.Net/Util/Fst/PairOutputs.cs | C# | apache-2.0 | 6,273 | [
30522,
2478,
19913,
2638,
1012,
5658,
1012,
16474,
2015,
1025,
2478,
2291,
1012,
2448,
7292,
1012,
21624,
8043,
7903,
2229,
1025,
3415,
15327,
19913,
2638,
1012,
5658,
1012,
21183,
4014,
1012,
1042,
3367,
1063,
1013,
1008,
1008,
7000,
2000,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Functional Javascript
http://osteele.com/sources/javascript/functional/
## links
<http://badassjs.com/post/840846392/location-hash-is-dead-long-live-html5-pushstate> | escribano/code | research/links.md | Markdown | mit | 167 | [
30522,
8360,
9262,
22483,
8299,
1024,
1013,
1013,
9808,
17389,
2571,
1012,
4012,
1013,
4216,
1013,
9262,
22483,
1013,
8360,
1013,
1001,
1001,
6971,
1026,
8299,
1024,
1013,
1013,
2919,
12054,
22578,
1012,
4012,
1013,
2695,
1013,
28122,
2620,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//*********************************************************
namespace CompositionSampleGallery
{
public sealed partial class ShadowInterop : SamplePage
{
public ShadowInterop()
{
this.InitializeComponent();
}
public static string StaticSampleName { get { return "Shadow Interop"; } }
public override string SampleName { get { return StaticSampleName; } }
public override string SampleDescription { get { return "Demonstrates how to apply drop shadows to Xaml elements."; } }
public override string SampleCodeUri { get { return "http://go.microsoft.com/fwlink/p/?LinkID=761171"; } }
}
}
| clarkezone/composition | SampleGallery/Samples/SDK 14393/ShadowInterop/ShadowInterop.cs | C# | mit | 1,374 | [
30522,
1013,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* DB Systel GmbH / i.S.A. Dresden GmbH & Co. KG (c) 2010
*/
package org.flowr.ant.tasks;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.PropertyHelper;
/**
* Ant task evaluating the text part after a specified separator.
*<p>usage:</p>
* <pre>
* <leadString property="<i>result.prop.name</i>" separator="<i>anySeparatorText</i>" last="<i>true|false, default==false</i>" text="<i>any text or ${property.to.scan}</i>" />
* </pre>
* <p>Sample</p>
*<pre>
* <property name="build.version.full" value="1.0.0.201101012359" /><br>
* <leadString property="build.version" separator="." last="true" text="${build.version.full}" /><br>
* <echo message="build.version = ${build.version}" /><br>
*
* results "build.version = 1.0.0"
*</pre>
* @author SvenKrause
*
*/
public class LeadStringTask extends AbstractSeparatorbasedStringTask {
private boolean last;
/**
* @param last
* the last to set
*/
public void setLast(boolean last) {
this.last = last;
}
@Override
public void init() throws BuildException {
super.init();
last = false;
}
@Override
public void execute() throws BuildException {
validate();
PropertyHelper ph = PropertyHelper.getPropertyHelper(this.getProject());
int indexOf = last ? text.lastIndexOf(separator) : text.indexOf(separator);
if (indexOf != -1) {
String lead = text.substring(0, indexOf);
ph.setProperty("", propName, lead, true);
} else {
ph.setProperty("", propName, text, true);
}
}
}
| krasv/flowr | commons/ant/org.flowr.ant.tasks/src/main/java/org/flowr/ant/tasks/LeadStringTask.java | Java | epl-1.0 | 1,532 | [
30522,
1013,
1008,
1008,
1008,
16962,
25353,
13473,
2140,
18289,
1013,
1045,
1012,
1055,
1012,
1037,
1012,
12983,
18289,
1004,
2522,
1012,
4705,
1006,
1039,
1007,
2230,
1008,
1013,
7427,
8917,
1012,
4834,
2099,
1012,
14405,
1012,
8518,
1025... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// <auto-generated/>
#nullable disable
using System.Collections.Generic;
using Azure.Core;
namespace Azure.ResourceManager.Sql.Models
{
/// <summary> The response to a list server operations request. </summary>
internal partial class ServerOperationListResult
{
/// <summary> Initializes a new instance of ServerOperationListResult. </summary>
internal ServerOperationListResult()
{
Value = new ChangeTrackingList<ServerOperation>();
}
/// <summary> Initializes a new instance of ServerOperationListResult. </summary>
/// <param name="value"> Array of results. </param>
/// <param name="nextLink"> Link to retrieve next page of results. </param>
internal ServerOperationListResult(IReadOnlyList<ServerOperation> value, string nextLink)
{
Value = value;
NextLink = nextLink;
}
/// <summary> Array of results. </summary>
public IReadOnlyList<ServerOperation> Value { get; }
/// <summary> Link to retrieve next page of results. </summary>
public string NextLink { get; }
}
}
| Azure/azure-sdk-for-net | sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerOperationListResult.cs | C# | mit | 1,238 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
7513,
3840,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
7000,
2104,
1996,
10210,
6105,
1012,
1013,
1013,
1026,
8285,
1011,
7013,
1013,
1028,
1001,
19701,
3085,
4487,
19150,
2478,
2291,
1012,
6407,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: tensorflow/core/protobuf/meta_graph.proto
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "tensorflow/core/protobuf/meta_graph.pb.h"
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
namespace tensorflow {
class MetaGraphDef_MetaInfoDefDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<MetaGraphDef_MetaInfoDef> {
} _MetaGraphDef_MetaInfoDef_default_instance_;
class MetaGraphDefDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<MetaGraphDef> {
} _MetaGraphDef_default_instance_;
class CollectionDef_NodeListDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<CollectionDef_NodeList> {
} _CollectionDef_NodeList_default_instance_;
class CollectionDef_BytesListDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<CollectionDef_BytesList> {
} _CollectionDef_BytesList_default_instance_;
class CollectionDef_Int64ListDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<CollectionDef_Int64List> {
} _CollectionDef_Int64List_default_instance_;
class CollectionDef_FloatListDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<CollectionDef_FloatList> {
} _CollectionDef_FloatList_default_instance_;
class CollectionDef_AnyListDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<CollectionDef_AnyList> {
} _CollectionDef_AnyList_default_instance_;
class CollectionDefDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<CollectionDef> {
public:
const ::tensorflow::CollectionDef_NodeList* node_list_;
const ::tensorflow::CollectionDef_BytesList* bytes_list_;
const ::tensorflow::CollectionDef_Int64List* int64_list_;
const ::tensorflow::CollectionDef_FloatList* float_list_;
const ::tensorflow::CollectionDef_AnyList* any_list_;
} _CollectionDef_default_instance_;
class TensorInfoDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<TensorInfo> {
} _TensorInfo_default_instance_;
class SignatureDefDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<SignatureDef> {
} _SignatureDef_default_instance_;
class AssetFileDefDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed<AssetFileDef> {
} _AssetFileDef_default_instance_;
namespace protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto {
namespace {
::google::protobuf::Metadata file_level_metadata[15];
} // namespace
const ::google::protobuf::uint32 TableStruct::offsets[] = {
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef_MetaInfoDef, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef_MetaInfoDef, meta_graph_version_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef_MetaInfoDef, stripped_op_list_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef_MetaInfoDef, any_info_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef_MetaInfoDef, tags_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef_MetaInfoDef, tensorflow_version_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef_MetaInfoDef, tensorflow_git_version_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef, meta_info_def_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef, graph_def_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef, saver_def_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef, collection_def_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef, signature_def_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef, asset_file_def_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef_NodeList, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef_NodeList, value_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef_BytesList, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef_BytesList, value_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef_Int64List, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef_Int64List, value_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef_FloatList, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef_FloatList, value_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef_AnyList, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef_AnyList, value_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef, _internal_metadata_),
~0u, // no _extensions_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef, _oneof_case_[0]),
PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET((&_CollectionDef_default_instance_), node_list_),
PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET((&_CollectionDef_default_instance_), bytes_list_),
PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET((&_CollectionDef_default_instance_), int64_list_),
PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET((&_CollectionDef_default_instance_), float_list_),
PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET((&_CollectionDef_default_instance_), any_list_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef, kind_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TensorInfo, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TensorInfo, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TensorInfo, dtype_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TensorInfo, tensor_shape_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SignatureDef, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SignatureDef, inputs_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SignatureDef, outputs_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SignatureDef, method_name_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AssetFileDef, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AssetFileDef, tensor_info_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AssetFileDef, filename_),
};
static const ::google::protobuf::internal::MigrationSchema schemas[] = {
{ 0, -1, sizeof(MetaGraphDef_MetaInfoDef)},
{ 10, -1, sizeof(MetaGraphDef)},
{ 20, -1, sizeof(CollectionDef_NodeList)},
{ 25, -1, sizeof(CollectionDef_BytesList)},
{ 30, -1, sizeof(CollectionDef_Int64List)},
{ 35, -1, sizeof(CollectionDef_FloatList)},
{ 40, -1, sizeof(CollectionDef_AnyList)},
{ 45, -1, sizeof(CollectionDef)},
{ 55, -1, sizeof(TensorInfo)},
{ 62, -1, sizeof(SignatureDef)},
{ 69, -1, sizeof(AssetFileDef)},
};
static ::google::protobuf::Message const * const file_default_instances[] = {
reinterpret_cast<const ::google::protobuf::Message*>(&_MetaGraphDef_MetaInfoDef_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_MetaGraphDef_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_CollectionDef_NodeList_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_CollectionDef_BytesList_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_CollectionDef_Int64List_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_CollectionDef_FloatList_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_CollectionDef_AnyList_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_CollectionDef_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_TensorInfo_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_SignatureDef_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&_AssetFileDef_default_instance_),
};
namespace {
void protobuf_AssignDescriptors() {
AddDescriptors();
::google::protobuf::MessageFactory* factory = NULL;
AssignDescriptors(
"tensorflow/core/protobuf/meta_graph.proto", schemas, file_default_instances, TableStruct::offsets, factory,
file_level_metadata, NULL, NULL);
}
void protobuf_AssignDescriptorsOnce() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
}
void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 15);
const ::google::protobuf::Descriptor* MetaGraphDef_CollectionDefEntry_descriptor = protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[1].descriptor;
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
MetaGraphDef_CollectionDefEntry_descriptor,
::google::protobuf::internal::MapEntry<
::std::string,
::tensorflow::CollectionDef,
::google::protobuf::internal::WireFormatLite::TYPE_STRING,
::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
0>::CreateDefaultInstance(
MetaGraphDef_CollectionDefEntry_descriptor));
const ::google::protobuf::Descriptor* MetaGraphDef_SignatureDefEntry_descriptor = protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[2].descriptor;
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
MetaGraphDef_SignatureDefEntry_descriptor,
::google::protobuf::internal::MapEntry<
::std::string,
::tensorflow::SignatureDef,
::google::protobuf::internal::WireFormatLite::TYPE_STRING,
::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
0>::CreateDefaultInstance(
MetaGraphDef_SignatureDefEntry_descriptor));
const ::google::protobuf::Descriptor* SignatureDef_InputsEntry_descriptor = protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[11].descriptor;
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
SignatureDef_InputsEntry_descriptor,
::google::protobuf::internal::MapEntry<
::std::string,
::tensorflow::TensorInfo,
::google::protobuf::internal::WireFormatLite::TYPE_STRING,
::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
0>::CreateDefaultInstance(
SignatureDef_InputsEntry_descriptor));
const ::google::protobuf::Descriptor* SignatureDef_OutputsEntry_descriptor = protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[12].descriptor;
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
SignatureDef_OutputsEntry_descriptor,
::google::protobuf::internal::MapEntry<
::std::string,
::tensorflow::TensorInfo,
::google::protobuf::internal::WireFormatLite::TYPE_STRING,
::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
0>::CreateDefaultInstance(
SignatureDef_OutputsEntry_descriptor));
}
} // namespace
void TableStruct::Shutdown() {
_MetaGraphDef_MetaInfoDef_default_instance_.Shutdown();
delete file_level_metadata[0].reflection;
_MetaGraphDef_default_instance_.Shutdown();
delete file_level_metadata[3].reflection;
_CollectionDef_NodeList_default_instance_.Shutdown();
delete file_level_metadata[4].reflection;
_CollectionDef_BytesList_default_instance_.Shutdown();
delete file_level_metadata[5].reflection;
_CollectionDef_Int64List_default_instance_.Shutdown();
delete file_level_metadata[6].reflection;
_CollectionDef_FloatList_default_instance_.Shutdown();
delete file_level_metadata[7].reflection;
_CollectionDef_AnyList_default_instance_.Shutdown();
delete file_level_metadata[8].reflection;
_CollectionDef_default_instance_.Shutdown();
delete file_level_metadata[9].reflection;
_TensorInfo_default_instance_.Shutdown();
delete file_level_metadata[10].reflection;
_SignatureDef_default_instance_.Shutdown();
delete file_level_metadata[13].reflection;
_AssetFileDef_default_instance_.Shutdown();
delete file_level_metadata[14].reflection;
}
void TableStruct::InitDefaultsImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
::google::protobuf::internal::InitProtobufDefaults();
::google::protobuf::protobuf_google_2fprotobuf_2fany_2eproto::InitDefaults();
::tensorflow::protobuf_tensorflow_2fcore_2fframework_2fgraph_2eproto::InitDefaults();
::tensorflow::protobuf_tensorflow_2fcore_2fframework_2fop_5fdef_2eproto::InitDefaults();
::tensorflow::protobuf_tensorflow_2fcore_2fframework_2ftensor_5fshape_2eproto::InitDefaults();
::tensorflow::protobuf_tensorflow_2fcore_2fframework_2ftypes_2eproto::InitDefaults();
::tensorflow::protobuf_tensorflow_2fcore_2fprotobuf_2fsaver_2eproto::InitDefaults();
_MetaGraphDef_MetaInfoDef_default_instance_.DefaultConstruct();
_MetaGraphDef_default_instance_.DefaultConstruct();
_CollectionDef_NodeList_default_instance_.DefaultConstruct();
_CollectionDef_BytesList_default_instance_.DefaultConstruct();
_CollectionDef_Int64List_default_instance_.DefaultConstruct();
_CollectionDef_FloatList_default_instance_.DefaultConstruct();
_CollectionDef_AnyList_default_instance_.DefaultConstruct();
_CollectionDef_default_instance_.DefaultConstruct();
_TensorInfo_default_instance_.DefaultConstruct();
_SignatureDef_default_instance_.DefaultConstruct();
_AssetFileDef_default_instance_.DefaultConstruct();
_MetaGraphDef_MetaInfoDef_default_instance_.get_mutable()->stripped_op_list_ = const_cast< ::tensorflow::OpList*>(
::tensorflow::OpList::internal_default_instance());
_MetaGraphDef_MetaInfoDef_default_instance_.get_mutable()->any_info_ = const_cast< ::google::protobuf::Any*>(
::google::protobuf::Any::internal_default_instance());
_MetaGraphDef_default_instance_.get_mutable()->meta_info_def_ = const_cast< ::tensorflow::MetaGraphDef_MetaInfoDef*>(
::tensorflow::MetaGraphDef_MetaInfoDef::internal_default_instance());
_MetaGraphDef_default_instance_.get_mutable()->graph_def_ = const_cast< ::tensorflow::GraphDef*>(
::tensorflow::GraphDef::internal_default_instance());
_MetaGraphDef_default_instance_.get_mutable()->saver_def_ = const_cast< ::tensorflow::SaverDef*>(
::tensorflow::SaverDef::internal_default_instance());
_CollectionDef_default_instance_.node_list_ = const_cast< ::tensorflow::CollectionDef_NodeList*>(
::tensorflow::CollectionDef_NodeList::internal_default_instance());
_CollectionDef_default_instance_.bytes_list_ = const_cast< ::tensorflow::CollectionDef_BytesList*>(
::tensorflow::CollectionDef_BytesList::internal_default_instance());
_CollectionDef_default_instance_.int64_list_ = const_cast< ::tensorflow::CollectionDef_Int64List*>(
::tensorflow::CollectionDef_Int64List::internal_default_instance());
_CollectionDef_default_instance_.float_list_ = const_cast< ::tensorflow::CollectionDef_FloatList*>(
::tensorflow::CollectionDef_FloatList::internal_default_instance());
_CollectionDef_default_instance_.any_list_ = const_cast< ::tensorflow::CollectionDef_AnyList*>(
::tensorflow::CollectionDef_AnyList::internal_default_instance());
_TensorInfo_default_instance_.get_mutable()->tensor_shape_ = const_cast< ::tensorflow::TensorShapeProto*>(
::tensorflow::TensorShapeProto::internal_default_instance());
_AssetFileDef_default_instance_.get_mutable()->tensor_info_ = const_cast< ::tensorflow::TensorInfo*>(
::tensorflow::TensorInfo::internal_default_instance());
}
void InitDefaults() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
}
void AddDescriptorsImpl() {
InitDefaults();
static const char descriptor[] = {
"\n)tensorflow/core/protobuf/meta_graph.pr"
"oto\022\ntensorflow\032\031google/protobuf/any.pro"
"to\032%tensorflow/core/framework/graph.prot"
"o\032&tensorflow/core/framework/op_def.prot"
"o\032,tensorflow/core/framework/tensor_shap"
"e.proto\032%tensorflow/core/framework/types"
".proto\032$tensorflow/core/protobuf/saver.p"
"roto\"\303\005\n\014MetaGraphDef\022;\n\rmeta_info_def\030\001"
" \001(\0132$.tensorflow.MetaGraphDef.MetaInfoD"
"ef\022\'\n\tgraph_def\030\002 \001(\0132\024.tensorflow.Graph"
"Def\022\'\n\tsaver_def\030\003 \001(\0132\024.tensorflow.Save"
"rDef\022C\n\016collection_def\030\004 \003(\0132+.tensorflo"
"w.MetaGraphDef.CollectionDefEntry\022A\n\rsig"
"nature_def\030\005 \003(\0132*.tensorflow.MetaGraphD"
"ef.SignatureDefEntry\0220\n\016asset_file_def\030\006"
" \003(\0132\030.tensorflow.AssetFileDef\032\311\001\n\013MetaI"
"nfoDef\022\032\n\022meta_graph_version\030\001 \001(\t\022,\n\020st"
"ripped_op_list\030\002 \001(\0132\022.tensorflow.OpList"
"\022&\n\010any_info\030\003 \001(\0132\024.google.protobuf.Any"
"\022\014\n\004tags\030\004 \003(\t\022\032\n\022tensorflow_version\030\005 \001"
"(\t\022\036\n\026tensorflow_git_version\030\006 \001(\t\032O\n\022Co"
"llectionDefEntry\022\013\n\003key\030\001 \001(\t\022(\n\005value\030\002"
" \001(\0132\031.tensorflow.CollectionDef:\0028\001\032M\n\021S"
"ignatureDefEntry\022\013\n\003key\030\001 \001(\t\022\'\n\005value\030\002"
" \001(\0132\030.tensorflow.SignatureDef:\0028\001\"\337\003\n\rC"
"ollectionDef\0227\n\tnode_list\030\001 \001(\0132\".tensor"
"flow.CollectionDef.NodeListH\000\0229\n\nbytes_l"
"ist\030\002 \001(\0132#.tensorflow.CollectionDef.Byt"
"esListH\000\0229\n\nint64_list\030\003 \001(\0132#.tensorflo"
"w.CollectionDef.Int64ListH\000\0229\n\nfloat_lis"
"t\030\004 \001(\0132#.tensorflow.CollectionDef.Float"
"ListH\000\0225\n\010any_list\030\005 \001(\0132!.tensorflow.Co"
"llectionDef.AnyListH\000\032\031\n\010NodeList\022\r\n\005val"
"ue\030\001 \003(\t\032\032\n\tBytesList\022\r\n\005value\030\001 \003(\014\032\036\n\t"
"Int64List\022\021\n\005value\030\001 \003(\003B\002\020\001\032\036\n\tFloatLis"
"t\022\021\n\005value\030\001 \003(\002B\002\020\001\032.\n\007AnyList\022#\n\005value"
"\030\001 \003(\0132\024.google.protobuf.AnyB\006\n\004kind\"s\n\n"
"TensorInfo\022\014\n\004name\030\001 \001(\t\022#\n\005dtype\030\002 \001(\0162"
"\024.tensorflow.DataType\0222\n\014tensor_shape\030\003 "
"\001(\0132\034.tensorflow.TensorShapeProto\"\240\002\n\014Si"
"gnatureDef\0224\n\006inputs\030\001 \003(\0132$.tensorflow."
"SignatureDef.InputsEntry\0226\n\007outputs\030\002 \003("
"\0132%.tensorflow.SignatureDef.OutputsEntry"
"\022\023\n\013method_name\030\003 \001(\t\032E\n\013InputsEntry\022\013\n\003"
"key\030\001 \001(\t\022%\n\005value\030\002 \001(\0132\026.tensorflow.Te"
"nsorInfo:\0028\001\032F\n\014OutputsEntry\022\013\n\003key\030\001 \001("
"\t\022%\n\005value\030\002 \001(\0132\026.tensorflow.TensorInfo"
":\0028\001\"M\n\014AssetFileDef\022+\n\013tensor_info\030\001 \001("
"\0132\026.tensorflow.TensorInfo\022\020\n\010filename\030\002 "
"\001(\tB0\n\030org.tensorflow.frameworkB\017MetaGra"
"phProtosP\001\370\001\001b\006proto3"
};
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
descriptor, 2021);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"tensorflow/core/protobuf/meta_graph.proto", &protobuf_RegisterTypes);
::google::protobuf::protobuf_google_2fprotobuf_2fany_2eproto::AddDescriptors();
::tensorflow::protobuf_tensorflow_2fcore_2fframework_2fgraph_2eproto::AddDescriptors();
::tensorflow::protobuf_tensorflow_2fcore_2fframework_2fop_5fdef_2eproto::AddDescriptors();
::tensorflow::protobuf_tensorflow_2fcore_2fframework_2ftensor_5fshape_2eproto::AddDescriptors();
::tensorflow::protobuf_tensorflow_2fcore_2fframework_2ftypes_2eproto::AddDescriptors();
::tensorflow::protobuf_tensorflow_2fcore_2fprotobuf_2fsaver_2eproto::AddDescriptors();
::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
}
void AddDescriptors() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at static initialization time.
struct StaticDescriptorInitializer {
StaticDescriptorInitializer() {
AddDescriptors();
}
} static_descriptor_initializer;
} // namespace protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto
// ===================================================================
void MetaGraphDef_MetaInfoDef::_slow_mutable_stripped_op_list() {
stripped_op_list_ = ::google::protobuf::Arena::CreateMessage< ::tensorflow::OpList >(
GetArenaNoVirtual());
}
::tensorflow::OpList* MetaGraphDef_MetaInfoDef::_slow_release_stripped_op_list() {
if (stripped_op_list_ == NULL) {
return NULL;
} else {
::tensorflow::OpList* temp = new ::tensorflow::OpList(*stripped_op_list_);
stripped_op_list_ = NULL;
return temp;
}
}
::tensorflow::OpList* MetaGraphDef_MetaInfoDef::unsafe_arena_release_stripped_op_list() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.MetaGraphDef.MetaInfoDef.stripped_op_list)
::tensorflow::OpList* temp = stripped_op_list_;
stripped_op_list_ = NULL;
return temp;
}
void MetaGraphDef_MetaInfoDef::_slow_set_allocated_stripped_op_list(
::google::protobuf::Arena* message_arena, ::tensorflow::OpList** stripped_op_list) {
if (message_arena != NULL &&
::google::protobuf::Arena::GetArena(*stripped_op_list) == NULL) {
message_arena->Own(*stripped_op_list);
} else if (message_arena !=
::google::protobuf::Arena::GetArena(*stripped_op_list)) {
::tensorflow::OpList* new_stripped_op_list =
::google::protobuf::Arena::CreateMessage< ::tensorflow::OpList >(
message_arena);
new_stripped_op_list->CopyFrom(**stripped_op_list);
*stripped_op_list = new_stripped_op_list;
}
}
void MetaGraphDef_MetaInfoDef::unsafe_arena_set_allocated_stripped_op_list(
::tensorflow::OpList* stripped_op_list) {
if (GetArenaNoVirtual() == NULL) {
delete stripped_op_list_;
}
stripped_op_list_ = stripped_op_list;
if (stripped_op_list) {
} else {
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.MetaGraphDef.MetaInfoDef.stripped_op_list)
}
void MetaGraphDef_MetaInfoDef::_slow_mutable_any_info() {
any_info_ = ::google::protobuf::Arena::Create< ::google::protobuf::Any >(
GetArenaNoVirtual());
}
::google::protobuf::Any* MetaGraphDef_MetaInfoDef::_slow_release_any_info() {
if (any_info_ == NULL) {
return NULL;
} else {
::google::protobuf::Any* temp = new ::google::protobuf::Any(*any_info_);
any_info_ = NULL;
return temp;
}
}
::google::protobuf::Any* MetaGraphDef_MetaInfoDef::unsafe_arena_release_any_info() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.MetaGraphDef.MetaInfoDef.any_info)
::google::protobuf::Any* temp = any_info_;
any_info_ = NULL;
return temp;
}
void MetaGraphDef_MetaInfoDef::unsafe_arena_set_allocated_any_info(
::google::protobuf::Any* any_info) {
if (GetArenaNoVirtual() == NULL) {
delete any_info_;
}
any_info_ = any_info;
if (any_info) {
} else {
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.MetaGraphDef.MetaInfoDef.any_info)
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int MetaGraphDef_MetaInfoDef::kMetaGraphVersionFieldNumber;
const int MetaGraphDef_MetaInfoDef::kStrippedOpListFieldNumber;
const int MetaGraphDef_MetaInfoDef::kAnyInfoFieldNumber;
const int MetaGraphDef_MetaInfoDef::kTagsFieldNumber;
const int MetaGraphDef_MetaInfoDef::kTensorflowVersionFieldNumber;
const int MetaGraphDef_MetaInfoDef::kTensorflowGitVersionFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
MetaGraphDef_MetaInfoDef::MetaGraphDef_MetaInfoDef()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:tensorflow.MetaGraphDef.MetaInfoDef)
}
MetaGraphDef_MetaInfoDef::MetaGraphDef_MetaInfoDef(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena),
tags_(arena) {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
#endif // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:tensorflow.MetaGraphDef.MetaInfoDef)
}
MetaGraphDef_MetaInfoDef::MetaGraphDef_MetaInfoDef(const MetaGraphDef_MetaInfoDef& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
tags_(from.tags_),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
meta_graph_version_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.meta_graph_version().size() > 0) {
meta_graph_version_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.meta_graph_version(),
GetArenaNoVirtual());
}
tensorflow_version_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.tensorflow_version().size() > 0) {
tensorflow_version_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.tensorflow_version(),
GetArenaNoVirtual());
}
tensorflow_git_version_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.tensorflow_git_version().size() > 0) {
tensorflow_git_version_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.tensorflow_git_version(),
GetArenaNoVirtual());
}
if (from.has_stripped_op_list()) {
stripped_op_list_ = new ::tensorflow::OpList(*from.stripped_op_list_);
} else {
stripped_op_list_ = NULL;
}
if (from.has_any_info()) {
any_info_ = new ::google::protobuf::Any(*from.any_info_);
} else {
any_info_ = NULL;
}
// @@protoc_insertion_point(copy_constructor:tensorflow.MetaGraphDef.MetaInfoDef)
}
void MetaGraphDef_MetaInfoDef::SharedCtor() {
meta_graph_version_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
tensorflow_version_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
tensorflow_git_version_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(&stripped_op_list_, 0, reinterpret_cast<char*>(&any_info_) -
reinterpret_cast<char*>(&stripped_op_list_) + sizeof(any_info_));
_cached_size_ = 0;
}
MetaGraphDef_MetaInfoDef::~MetaGraphDef_MetaInfoDef() {
// @@protoc_insertion_point(destructor:tensorflow.MetaGraphDef.MetaInfoDef)
SharedDtor();
}
void MetaGraphDef_MetaInfoDef::SharedDtor() {
::google::protobuf::Arena* arena = GetArenaNoVirtual();
if (arena != NULL) {
return;
}
meta_graph_version_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
tensorflow_version_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
tensorflow_git_version_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
if (this != internal_default_instance()) {
delete stripped_op_list_;
}
if (this != internal_default_instance()) {
delete any_info_;
}
}
void MetaGraphDef_MetaInfoDef::ArenaDtor(void* object) {
MetaGraphDef_MetaInfoDef* _this = reinterpret_cast< MetaGraphDef_MetaInfoDef* >(object);
(void)_this;
}
void MetaGraphDef_MetaInfoDef::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void MetaGraphDef_MetaInfoDef::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* MetaGraphDef_MetaInfoDef::descriptor() {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[0].descriptor;
}
const MetaGraphDef_MetaInfoDef& MetaGraphDef_MetaInfoDef::default_instance() {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
return *internal_default_instance();
}
MetaGraphDef_MetaInfoDef* MetaGraphDef_MetaInfoDef::New(::google::protobuf::Arena* arena) const {
return ::google::protobuf::Arena::CreateMessage<MetaGraphDef_MetaInfoDef>(arena);
}
void MetaGraphDef_MetaInfoDef::Clear() {
// @@protoc_insertion_point(message_clear_start:tensorflow.MetaGraphDef.MetaInfoDef)
tags_.Clear();
meta_graph_version_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
tensorflow_version_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
tensorflow_git_version_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
if (GetArenaNoVirtual() == NULL && stripped_op_list_ != NULL) {
delete stripped_op_list_;
}
stripped_op_list_ = NULL;
if (GetArenaNoVirtual() == NULL && any_info_ != NULL) {
delete any_info_;
}
any_info_ = NULL;
}
bool MetaGraphDef_MetaInfoDef::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:tensorflow.MetaGraphDef.MetaInfoDef)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// string meta_graph_version = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_meta_graph_version()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->meta_graph_version().data(), this->meta_graph_version().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version"));
} else {
goto handle_unusual;
}
break;
}
// .tensorflow.OpList stripped_op_list = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_stripped_op_list()));
} else {
goto handle_unusual;
}
break;
}
// .google.protobuf.Any any_info = 3;
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_any_info()));
} else {
goto handle_unusual;
}
break;
}
// repeated string tags = 4;
case 4: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(34u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->add_tags()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->tags(this->tags_size() - 1).data(),
this->tags(this->tags_size() - 1).length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.MetaGraphDef.MetaInfoDef.tags"));
} else {
goto handle_unusual;
}
break;
}
// string tensorflow_version = 5;
case 5: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(42u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_tensorflow_version()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->tensorflow_version().data(), this->tensorflow_version().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version"));
} else {
goto handle_unusual;
}
break;
}
// string tensorflow_git_version = 6;
case 6: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(50u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_tensorflow_git_version()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->tensorflow_git_version().data(), this->tensorflow_git_version().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version"));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:tensorflow.MetaGraphDef.MetaInfoDef)
return true;
failure:
// @@protoc_insertion_point(parse_failure:tensorflow.MetaGraphDef.MetaInfoDef)
return false;
#undef DO_
}
void MetaGraphDef_MetaInfoDef::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:tensorflow.MetaGraphDef.MetaInfoDef)
// string meta_graph_version = 1;
if (this->meta_graph_version().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->meta_graph_version().data(), this->meta_graph_version().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->meta_graph_version(), output);
}
// .tensorflow.OpList stripped_op_list = 2;
if (this->has_stripped_op_list()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *this->stripped_op_list_, output);
}
// .google.protobuf.Any any_info = 3;
if (this->has_any_info()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, *this->any_info_, output);
}
// repeated string tags = 4;
for (int i = 0, n = this->tags_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->tags(i).data(), this->tags(i).length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.MetaInfoDef.tags");
::google::protobuf::internal::WireFormatLite::WriteString(
4, this->tags(i), output);
}
// string tensorflow_version = 5;
if (this->tensorflow_version().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->tensorflow_version().data(), this->tensorflow_version().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
5, this->tensorflow_version(), output);
}
// string tensorflow_git_version = 6;
if (this->tensorflow_git_version().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->tensorflow_git_version().data(), this->tensorflow_git_version().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
6, this->tensorflow_git_version(), output);
}
// @@protoc_insertion_point(serialize_end:tensorflow.MetaGraphDef.MetaInfoDef)
}
::google::protobuf::uint8* MetaGraphDef_MetaInfoDef::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:tensorflow.MetaGraphDef.MetaInfoDef)
// string meta_graph_version = 1;
if (this->meta_graph_version().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->meta_graph_version().data(), this->meta_graph_version().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->meta_graph_version(), target);
}
// .tensorflow.OpList stripped_op_list = 2;
if (this->has_stripped_op_list()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *this->stripped_op_list_, false, target);
}
// .google.protobuf.Any any_info = 3;
if (this->has_any_info()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
3, *this->any_info_, false, target);
}
// repeated string tags = 4;
for (int i = 0, n = this->tags_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->tags(i).data(), this->tags(i).length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.MetaInfoDef.tags");
target = ::google::protobuf::internal::WireFormatLite::
WriteStringToArray(4, this->tags(i), target);
}
// string tensorflow_version = 5;
if (this->tensorflow_version().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->tensorflow_version().data(), this->tensorflow_version().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
5, this->tensorflow_version(), target);
}
// string tensorflow_git_version = 6;
if (this->tensorflow_git_version().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->tensorflow_git_version().data(), this->tensorflow_git_version().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
6, this->tensorflow_git_version(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:tensorflow.MetaGraphDef.MetaInfoDef)
return target;
}
size_t MetaGraphDef_MetaInfoDef::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.MetaGraphDef.MetaInfoDef)
size_t total_size = 0;
// repeated string tags = 4;
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->tags_size());
for (int i = 0, n = this->tags_size(); i < n; i++) {
total_size += ::google::protobuf::internal::WireFormatLite::StringSize(
this->tags(i));
}
// string meta_graph_version = 1;
if (this->meta_graph_version().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->meta_graph_version());
}
// string tensorflow_version = 5;
if (this->tensorflow_version().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->tensorflow_version());
}
// string tensorflow_git_version = 6;
if (this->tensorflow_git_version().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->tensorflow_git_version());
}
// .tensorflow.OpList stripped_op_list = 2;
if (this->has_stripped_op_list()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->stripped_op_list_);
}
// .google.protobuf.Any any_info = 3;
if (this->has_any_info()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->any_info_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void MetaGraphDef_MetaInfoDef::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.MetaGraphDef.MetaInfoDef)
GOOGLE_DCHECK_NE(&from, this);
const MetaGraphDef_MetaInfoDef* source =
::google::protobuf::internal::DynamicCastToGenerated<const MetaGraphDef_MetaInfoDef>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.MetaGraphDef.MetaInfoDef)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.MetaGraphDef.MetaInfoDef)
MergeFrom(*source);
}
}
void MetaGraphDef_MetaInfoDef::MergeFrom(const MetaGraphDef_MetaInfoDef& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.MetaGraphDef.MetaInfoDef)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
tags_.MergeFrom(from.tags_);
if (from.meta_graph_version().size() > 0) {
set_meta_graph_version(from.meta_graph_version());
}
if (from.tensorflow_version().size() > 0) {
set_tensorflow_version(from.tensorflow_version());
}
if (from.tensorflow_git_version().size() > 0) {
set_tensorflow_git_version(from.tensorflow_git_version());
}
if (from.has_stripped_op_list()) {
mutable_stripped_op_list()->::tensorflow::OpList::MergeFrom(from.stripped_op_list());
}
if (from.has_any_info()) {
mutable_any_info()->::google::protobuf::Any::MergeFrom(from.any_info());
}
}
void MetaGraphDef_MetaInfoDef::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.MetaGraphDef.MetaInfoDef)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void MetaGraphDef_MetaInfoDef::CopyFrom(const MetaGraphDef_MetaInfoDef& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.MetaGraphDef.MetaInfoDef)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool MetaGraphDef_MetaInfoDef::IsInitialized() const {
return true;
}
void MetaGraphDef_MetaInfoDef::Swap(MetaGraphDef_MetaInfoDef* other) {
if (other == this) return;
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
InternalSwap(other);
} else {
MetaGraphDef_MetaInfoDef* temp = New(GetArenaNoVirtual());
temp->MergeFrom(*other);
other->CopyFrom(*this);
InternalSwap(temp);
if (GetArenaNoVirtual() == NULL) {
delete temp;
}
}
}
void MetaGraphDef_MetaInfoDef::UnsafeArenaSwap(MetaGraphDef_MetaInfoDef* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void MetaGraphDef_MetaInfoDef::InternalSwap(MetaGraphDef_MetaInfoDef* other) {
tags_.UnsafeArenaSwap(&other->tags_);
meta_graph_version_.Swap(&other->meta_graph_version_);
tensorflow_version_.Swap(&other->tensorflow_version_);
tensorflow_git_version_.Swap(&other->tensorflow_git_version_);
std::swap(stripped_op_list_, other->stripped_op_list_);
std::swap(any_info_, other->any_info_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata MetaGraphDef_MetaInfoDef::GetMetadata() const {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[0];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// MetaGraphDef_MetaInfoDef
// string meta_graph_version = 1;
void MetaGraphDef_MetaInfoDef::clear_meta_graph_version() {
meta_graph_version_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
const ::std::string& MetaGraphDef_MetaInfoDef::meta_graph_version() const {
// @@protoc_insertion_point(field_get:tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version)
return meta_graph_version_.Get();
}
void MetaGraphDef_MetaInfoDef::set_meta_graph_version(const ::std::string& value) {
meta_graph_version_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
// @@protoc_insertion_point(field_set:tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version)
}
void MetaGraphDef_MetaInfoDef::set_meta_graph_version(const char* value) {
meta_graph_version_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_char:tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version)
}
void MetaGraphDef_MetaInfoDef::set_meta_graph_version(const char* value,
size_t size) {
meta_graph_version_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version)
}
::std::string* MetaGraphDef_MetaInfoDef::mutable_meta_graph_version() {
// @@protoc_insertion_point(field_mutable:tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version)
return meta_graph_version_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* MetaGraphDef_MetaInfoDef::release_meta_graph_version() {
// @@protoc_insertion_point(field_release:tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version)
return meta_graph_version_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* MetaGraphDef_MetaInfoDef::unsafe_arena_release_meta_graph_version() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version)
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
return meta_graph_version_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
}
void MetaGraphDef_MetaInfoDef::set_allocated_meta_graph_version(::std::string* meta_graph_version) {
if (meta_graph_version != NULL) {
} else {
}
meta_graph_version_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), meta_graph_version,
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version)
}
void MetaGraphDef_MetaInfoDef::unsafe_arena_set_allocated_meta_graph_version(
::std::string* meta_graph_version) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
if (meta_graph_version != NULL) {
} else {
}
meta_graph_version_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
meta_graph_version, GetArenaNoVirtual());
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version)
}
// .tensorflow.OpList stripped_op_list = 2;
bool MetaGraphDef_MetaInfoDef::has_stripped_op_list() const {
return this != internal_default_instance() && stripped_op_list_ != NULL;
}
void MetaGraphDef_MetaInfoDef::clear_stripped_op_list() {
if (GetArenaNoVirtual() == NULL && stripped_op_list_ != NULL) delete stripped_op_list_;
stripped_op_list_ = NULL;
}
const ::tensorflow::OpList& MetaGraphDef_MetaInfoDef::stripped_op_list() const {
// @@protoc_insertion_point(field_get:tensorflow.MetaGraphDef.MetaInfoDef.stripped_op_list)
return stripped_op_list_ != NULL ? *stripped_op_list_
: *::tensorflow::OpList::internal_default_instance();
}
::tensorflow::OpList* MetaGraphDef_MetaInfoDef::mutable_stripped_op_list() {
if (stripped_op_list_ == NULL) {
_slow_mutable_stripped_op_list();
}
// @@protoc_insertion_point(field_mutable:tensorflow.MetaGraphDef.MetaInfoDef.stripped_op_list)
return stripped_op_list_;
}
::tensorflow::OpList* MetaGraphDef_MetaInfoDef::release_stripped_op_list() {
// @@protoc_insertion_point(field_release:tensorflow.MetaGraphDef.MetaInfoDef.stripped_op_list)
if (GetArenaNoVirtual() != NULL) {
return _slow_release_stripped_op_list();
} else {
::tensorflow::OpList* temp = stripped_op_list_;
stripped_op_list_ = NULL;
return temp;
}
}
void MetaGraphDef_MetaInfoDef::set_allocated_stripped_op_list(::tensorflow::OpList* stripped_op_list) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == NULL) {
delete stripped_op_list_;
}
if (stripped_op_list != NULL) {
_slow_set_allocated_stripped_op_list(message_arena, &stripped_op_list);
}
stripped_op_list_ = stripped_op_list;
if (stripped_op_list) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.MetaGraphDef.MetaInfoDef.stripped_op_list)
}
// .google.protobuf.Any any_info = 3;
bool MetaGraphDef_MetaInfoDef::has_any_info() const {
return this != internal_default_instance() && any_info_ != NULL;
}
void MetaGraphDef_MetaInfoDef::clear_any_info() {
if (GetArenaNoVirtual() == NULL && any_info_ != NULL) delete any_info_;
any_info_ = NULL;
}
const ::google::protobuf::Any& MetaGraphDef_MetaInfoDef::any_info() const {
// @@protoc_insertion_point(field_get:tensorflow.MetaGraphDef.MetaInfoDef.any_info)
return any_info_ != NULL ? *any_info_
: *::google::protobuf::Any::internal_default_instance();
}
::google::protobuf::Any* MetaGraphDef_MetaInfoDef::mutable_any_info() {
if (any_info_ == NULL) {
_slow_mutable_any_info();
}
// @@protoc_insertion_point(field_mutable:tensorflow.MetaGraphDef.MetaInfoDef.any_info)
return any_info_;
}
::google::protobuf::Any* MetaGraphDef_MetaInfoDef::release_any_info() {
// @@protoc_insertion_point(field_release:tensorflow.MetaGraphDef.MetaInfoDef.any_info)
if (GetArenaNoVirtual() != NULL) {
return _slow_release_any_info();
} else {
::google::protobuf::Any* temp = any_info_;
any_info_ = NULL;
return temp;
}
}
void MetaGraphDef_MetaInfoDef::set_allocated_any_info(::google::protobuf::Any* any_info) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == NULL) {
delete any_info_;
}
if (any_info != NULL) {
if (message_arena != NULL) {
message_arena->Own(any_info);
}
}
any_info_ = any_info;
if (any_info) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.MetaGraphDef.MetaInfoDef.any_info)
}
// repeated string tags = 4;
int MetaGraphDef_MetaInfoDef::tags_size() const {
return tags_.size();
}
void MetaGraphDef_MetaInfoDef::clear_tags() {
tags_.Clear();
}
const ::std::string& MetaGraphDef_MetaInfoDef::tags(int index) const {
// @@protoc_insertion_point(field_get:tensorflow.MetaGraphDef.MetaInfoDef.tags)
return tags_.Get(index);
}
::std::string* MetaGraphDef_MetaInfoDef::mutable_tags(int index) {
// @@protoc_insertion_point(field_mutable:tensorflow.MetaGraphDef.MetaInfoDef.tags)
return tags_.Mutable(index);
}
void MetaGraphDef_MetaInfoDef::set_tags(int index, const ::std::string& value) {
// @@protoc_insertion_point(field_set:tensorflow.MetaGraphDef.MetaInfoDef.tags)
tags_.Mutable(index)->assign(value);
}
#if LANG_CXX11
void MetaGraphDef_MetaInfoDef::set_tags(int index, ::std::string&& value) {
// @@protoc_insertion_point(field_set:tensorflow.MetaGraphDef.MetaInfoDef.tags)
tags_.Mutable(index)->assign(std::move(value));
}
#endif
void MetaGraphDef_MetaInfoDef::set_tags(int index, const char* value) {
tags_.Mutable(index)->assign(value);
// @@protoc_insertion_point(field_set_char:tensorflow.MetaGraphDef.MetaInfoDef.tags)
}
void MetaGraphDef_MetaInfoDef::set_tags(int index, const char* value, size_t size) {
tags_.Mutable(index)->assign(
reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:tensorflow.MetaGraphDef.MetaInfoDef.tags)
}
::std::string* MetaGraphDef_MetaInfoDef::add_tags() {
// @@protoc_insertion_point(field_add_mutable:tensorflow.MetaGraphDef.MetaInfoDef.tags)
return tags_.Add();
}
void MetaGraphDef_MetaInfoDef::add_tags(const ::std::string& value) {
tags_.Add()->assign(value);
// @@protoc_insertion_point(field_add:tensorflow.MetaGraphDef.MetaInfoDef.tags)
}
#if LANG_CXX11
void MetaGraphDef_MetaInfoDef::add_tags(::std::string&& value) {
tags_.Add()->assign(std::move(value));
// @@protoc_insertion_point(field_add:tensorflow.MetaGraphDef.MetaInfoDef.tags)
}
#endif
void MetaGraphDef_MetaInfoDef::add_tags(const char* value) {
tags_.Add()->assign(value);
// @@protoc_insertion_point(field_add_char:tensorflow.MetaGraphDef.MetaInfoDef.tags)
}
void MetaGraphDef_MetaInfoDef::add_tags(const char* value, size_t size) {
tags_.Add()->assign(reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_add_pointer:tensorflow.MetaGraphDef.MetaInfoDef.tags)
}
const ::google::protobuf::RepeatedPtrField< ::std::string>&
MetaGraphDef_MetaInfoDef::tags() const {
// @@protoc_insertion_point(field_list:tensorflow.MetaGraphDef.MetaInfoDef.tags)
return tags_;
}
::google::protobuf::RepeatedPtrField< ::std::string>*
MetaGraphDef_MetaInfoDef::mutable_tags() {
// @@protoc_insertion_point(field_mutable_list:tensorflow.MetaGraphDef.MetaInfoDef.tags)
return &tags_;
}
// string tensorflow_version = 5;
void MetaGraphDef_MetaInfoDef::clear_tensorflow_version() {
tensorflow_version_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
const ::std::string& MetaGraphDef_MetaInfoDef::tensorflow_version() const {
// @@protoc_insertion_point(field_get:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version)
return tensorflow_version_.Get();
}
void MetaGraphDef_MetaInfoDef::set_tensorflow_version(const ::std::string& value) {
tensorflow_version_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
// @@protoc_insertion_point(field_set:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version)
}
void MetaGraphDef_MetaInfoDef::set_tensorflow_version(const char* value) {
tensorflow_version_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_char:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version)
}
void MetaGraphDef_MetaInfoDef::set_tensorflow_version(const char* value,
size_t size) {
tensorflow_version_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version)
}
::std::string* MetaGraphDef_MetaInfoDef::mutable_tensorflow_version() {
// @@protoc_insertion_point(field_mutable:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version)
return tensorflow_version_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* MetaGraphDef_MetaInfoDef::release_tensorflow_version() {
// @@protoc_insertion_point(field_release:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version)
return tensorflow_version_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* MetaGraphDef_MetaInfoDef::unsafe_arena_release_tensorflow_version() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version)
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
return tensorflow_version_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
}
void MetaGraphDef_MetaInfoDef::set_allocated_tensorflow_version(::std::string* tensorflow_version) {
if (tensorflow_version != NULL) {
} else {
}
tensorflow_version_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), tensorflow_version,
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version)
}
void MetaGraphDef_MetaInfoDef::unsafe_arena_set_allocated_tensorflow_version(
::std::string* tensorflow_version) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
if (tensorflow_version != NULL) {
} else {
}
tensorflow_version_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
tensorflow_version, GetArenaNoVirtual());
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version)
}
// string tensorflow_git_version = 6;
void MetaGraphDef_MetaInfoDef::clear_tensorflow_git_version() {
tensorflow_git_version_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
const ::std::string& MetaGraphDef_MetaInfoDef::tensorflow_git_version() const {
// @@protoc_insertion_point(field_get:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version)
return tensorflow_git_version_.Get();
}
void MetaGraphDef_MetaInfoDef::set_tensorflow_git_version(const ::std::string& value) {
tensorflow_git_version_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
// @@protoc_insertion_point(field_set:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version)
}
void MetaGraphDef_MetaInfoDef::set_tensorflow_git_version(const char* value) {
tensorflow_git_version_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_char:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version)
}
void MetaGraphDef_MetaInfoDef::set_tensorflow_git_version(const char* value,
size_t size) {
tensorflow_git_version_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version)
}
::std::string* MetaGraphDef_MetaInfoDef::mutable_tensorflow_git_version() {
// @@protoc_insertion_point(field_mutable:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version)
return tensorflow_git_version_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* MetaGraphDef_MetaInfoDef::release_tensorflow_git_version() {
// @@protoc_insertion_point(field_release:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version)
return tensorflow_git_version_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* MetaGraphDef_MetaInfoDef::unsafe_arena_release_tensorflow_git_version() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version)
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
return tensorflow_git_version_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
}
void MetaGraphDef_MetaInfoDef::set_allocated_tensorflow_git_version(::std::string* tensorflow_git_version) {
if (tensorflow_git_version != NULL) {
} else {
}
tensorflow_git_version_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), tensorflow_git_version,
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version)
}
void MetaGraphDef_MetaInfoDef::unsafe_arena_set_allocated_tensorflow_git_version(
::std::string* tensorflow_git_version) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
if (tensorflow_git_version != NULL) {
} else {
}
tensorflow_git_version_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
tensorflow_git_version, GetArenaNoVirtual());
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version)
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if PROTOBUF_INLINE_NOT_IN_HEADERS
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if PROTOBUF_INLINE_NOT_IN_HEADERS
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
void MetaGraphDef::_slow_mutable_meta_info_def() {
meta_info_def_ = ::google::protobuf::Arena::CreateMessage< ::tensorflow::MetaGraphDef_MetaInfoDef >(
GetArenaNoVirtual());
}
::tensorflow::MetaGraphDef_MetaInfoDef* MetaGraphDef::_slow_release_meta_info_def() {
if (meta_info_def_ == NULL) {
return NULL;
} else {
::tensorflow::MetaGraphDef_MetaInfoDef* temp = new ::tensorflow::MetaGraphDef_MetaInfoDef(*meta_info_def_);
meta_info_def_ = NULL;
return temp;
}
}
::tensorflow::MetaGraphDef_MetaInfoDef* MetaGraphDef::unsafe_arena_release_meta_info_def() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.MetaGraphDef.meta_info_def)
::tensorflow::MetaGraphDef_MetaInfoDef* temp = meta_info_def_;
meta_info_def_ = NULL;
return temp;
}
void MetaGraphDef::_slow_set_allocated_meta_info_def(
::google::protobuf::Arena* message_arena, ::tensorflow::MetaGraphDef_MetaInfoDef** meta_info_def) {
if (message_arena != NULL &&
::google::protobuf::Arena::GetArena(*meta_info_def) == NULL) {
message_arena->Own(*meta_info_def);
} else if (message_arena !=
::google::protobuf::Arena::GetArena(*meta_info_def)) {
::tensorflow::MetaGraphDef_MetaInfoDef* new_meta_info_def =
::google::protobuf::Arena::CreateMessage< ::tensorflow::MetaGraphDef_MetaInfoDef >(
message_arena);
new_meta_info_def->CopyFrom(**meta_info_def);
*meta_info_def = new_meta_info_def;
}
}
void MetaGraphDef::unsafe_arena_set_allocated_meta_info_def(
::tensorflow::MetaGraphDef_MetaInfoDef* meta_info_def) {
if (GetArenaNoVirtual() == NULL) {
delete meta_info_def_;
}
meta_info_def_ = meta_info_def;
if (meta_info_def) {
} else {
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.MetaGraphDef.meta_info_def)
}
void MetaGraphDef::_slow_mutable_graph_def() {
graph_def_ = ::google::protobuf::Arena::CreateMessage< ::tensorflow::GraphDef >(
GetArenaNoVirtual());
}
::tensorflow::GraphDef* MetaGraphDef::_slow_release_graph_def() {
if (graph_def_ == NULL) {
return NULL;
} else {
::tensorflow::GraphDef* temp = new ::tensorflow::GraphDef(*graph_def_);
graph_def_ = NULL;
return temp;
}
}
::tensorflow::GraphDef* MetaGraphDef::unsafe_arena_release_graph_def() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.MetaGraphDef.graph_def)
::tensorflow::GraphDef* temp = graph_def_;
graph_def_ = NULL;
return temp;
}
void MetaGraphDef::_slow_set_allocated_graph_def(
::google::protobuf::Arena* message_arena, ::tensorflow::GraphDef** graph_def) {
if (message_arena != NULL &&
::google::protobuf::Arena::GetArena(*graph_def) == NULL) {
message_arena->Own(*graph_def);
} else if (message_arena !=
::google::protobuf::Arena::GetArena(*graph_def)) {
::tensorflow::GraphDef* new_graph_def =
::google::protobuf::Arena::CreateMessage< ::tensorflow::GraphDef >(
message_arena);
new_graph_def->CopyFrom(**graph_def);
*graph_def = new_graph_def;
}
}
void MetaGraphDef::unsafe_arena_set_allocated_graph_def(
::tensorflow::GraphDef* graph_def) {
if (GetArenaNoVirtual() == NULL) {
delete graph_def_;
}
graph_def_ = graph_def;
if (graph_def) {
} else {
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.MetaGraphDef.graph_def)
}
void MetaGraphDef::_slow_mutable_saver_def() {
saver_def_ = ::google::protobuf::Arena::CreateMessage< ::tensorflow::SaverDef >(
GetArenaNoVirtual());
}
::tensorflow::SaverDef* MetaGraphDef::_slow_release_saver_def() {
if (saver_def_ == NULL) {
return NULL;
} else {
::tensorflow::SaverDef* temp = new ::tensorflow::SaverDef(*saver_def_);
saver_def_ = NULL;
return temp;
}
}
::tensorflow::SaverDef* MetaGraphDef::unsafe_arena_release_saver_def() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.MetaGraphDef.saver_def)
::tensorflow::SaverDef* temp = saver_def_;
saver_def_ = NULL;
return temp;
}
void MetaGraphDef::_slow_set_allocated_saver_def(
::google::protobuf::Arena* message_arena, ::tensorflow::SaverDef** saver_def) {
if (message_arena != NULL &&
::google::protobuf::Arena::GetArena(*saver_def) == NULL) {
message_arena->Own(*saver_def);
} else if (message_arena !=
::google::protobuf::Arena::GetArena(*saver_def)) {
::tensorflow::SaverDef* new_saver_def =
::google::protobuf::Arena::CreateMessage< ::tensorflow::SaverDef >(
message_arena);
new_saver_def->CopyFrom(**saver_def);
*saver_def = new_saver_def;
}
}
void MetaGraphDef::unsafe_arena_set_allocated_saver_def(
::tensorflow::SaverDef* saver_def) {
if (GetArenaNoVirtual() == NULL) {
delete saver_def_;
}
saver_def_ = saver_def;
if (saver_def) {
} else {
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.MetaGraphDef.saver_def)
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int MetaGraphDef::kMetaInfoDefFieldNumber;
const int MetaGraphDef::kGraphDefFieldNumber;
const int MetaGraphDef::kSaverDefFieldNumber;
const int MetaGraphDef::kCollectionDefFieldNumber;
const int MetaGraphDef::kSignatureDefFieldNumber;
const int MetaGraphDef::kAssetFileDefFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
MetaGraphDef::MetaGraphDef()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:tensorflow.MetaGraphDef)
}
MetaGraphDef::MetaGraphDef(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena),
collection_def_(arena),
signature_def_(arena),
asset_file_def_(arena) {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
#endif // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:tensorflow.MetaGraphDef)
}
MetaGraphDef::MetaGraphDef(const MetaGraphDef& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
asset_file_def_(from.asset_file_def_),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
const ::google::protobuf::Descriptor*& MetaGraphDef_CollectionDefEntry_descriptor = protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[1].descriptor;
const ::google::protobuf::Descriptor*& MetaGraphDef_SignatureDefEntry_descriptor = protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[2].descriptor;
collection_def_.SetAssignDescriptorCallback(
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce);
collection_def_.SetEntryDescriptor(
&MetaGraphDef_CollectionDefEntry_descriptor);
collection_def_.MergeFrom(from.collection_def_);
signature_def_.SetAssignDescriptorCallback(
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce);
signature_def_.SetEntryDescriptor(
&MetaGraphDef_SignatureDefEntry_descriptor);
signature_def_.MergeFrom(from.signature_def_);
if (from.has_meta_info_def()) {
meta_info_def_ = new ::tensorflow::MetaGraphDef_MetaInfoDef(*from.meta_info_def_);
} else {
meta_info_def_ = NULL;
}
if (from.has_graph_def()) {
graph_def_ = new ::tensorflow::GraphDef(*from.graph_def_);
} else {
graph_def_ = NULL;
}
if (from.has_saver_def()) {
saver_def_ = new ::tensorflow::SaverDef(*from.saver_def_);
} else {
saver_def_ = NULL;
}
// @@protoc_insertion_point(copy_constructor:tensorflow.MetaGraphDef)
}
void MetaGraphDef::SharedCtor() {
const ::google::protobuf::Descriptor*& MetaGraphDef_CollectionDefEntry_descriptor = protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[1].descriptor;
const ::google::protobuf::Descriptor*& MetaGraphDef_SignatureDefEntry_descriptor = protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[2].descriptor;
collection_def_.SetAssignDescriptorCallback(
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce);
collection_def_.SetEntryDescriptor(
&MetaGraphDef_CollectionDefEntry_descriptor);
signature_def_.SetAssignDescriptorCallback(
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce);
signature_def_.SetEntryDescriptor(
&MetaGraphDef_SignatureDefEntry_descriptor);
::memset(&meta_info_def_, 0, reinterpret_cast<char*>(&saver_def_) -
reinterpret_cast<char*>(&meta_info_def_) + sizeof(saver_def_));
_cached_size_ = 0;
}
MetaGraphDef::~MetaGraphDef() {
// @@protoc_insertion_point(destructor:tensorflow.MetaGraphDef)
SharedDtor();
}
void MetaGraphDef::SharedDtor() {
::google::protobuf::Arena* arena = GetArenaNoVirtual();
if (arena != NULL) {
return;
}
if (this != internal_default_instance()) {
delete meta_info_def_;
}
if (this != internal_default_instance()) {
delete graph_def_;
}
if (this != internal_default_instance()) {
delete saver_def_;
}
}
void MetaGraphDef::ArenaDtor(void* object) {
MetaGraphDef* _this = reinterpret_cast< MetaGraphDef* >(object);
(void)_this;
}
void MetaGraphDef::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void MetaGraphDef::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* MetaGraphDef::descriptor() {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[3].descriptor;
}
const MetaGraphDef& MetaGraphDef::default_instance() {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
return *internal_default_instance();
}
MetaGraphDef* MetaGraphDef::New(::google::protobuf::Arena* arena) const {
return ::google::protobuf::Arena::CreateMessage<MetaGraphDef>(arena);
}
void MetaGraphDef::Clear() {
// @@protoc_insertion_point(message_clear_start:tensorflow.MetaGraphDef)
collection_def_.Clear();
signature_def_.Clear();
asset_file_def_.Clear();
if (GetArenaNoVirtual() == NULL && meta_info_def_ != NULL) {
delete meta_info_def_;
}
meta_info_def_ = NULL;
if (GetArenaNoVirtual() == NULL && graph_def_ != NULL) {
delete graph_def_;
}
graph_def_ = NULL;
if (GetArenaNoVirtual() == NULL && saver_def_ != NULL) {
delete saver_def_;
}
saver_def_ = NULL;
}
bool MetaGraphDef::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:tensorflow.MetaGraphDef)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// .tensorflow.MetaGraphDef.MetaInfoDef meta_info_def = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_meta_info_def()));
} else {
goto handle_unusual;
}
break;
}
// .tensorflow.GraphDef graph_def = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_graph_def()));
} else {
goto handle_unusual;
}
break;
}
// .tensorflow.SaverDef saver_def = 3;
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_saver_def()));
} else {
goto handle_unusual;
}
break;
}
// map<string, .tensorflow.CollectionDef> collection_def = 4;
case 4: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(34u)) {
DO_(input->IncrementRecursionDepth());
MetaGraphDef_CollectionDefEntry::Parser< ::google::protobuf::internal::MapField<
::std::string, ::tensorflow::CollectionDef,
::google::protobuf::internal::WireFormatLite::TYPE_STRING,
::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
0 >,
::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef > > parser(&collection_def_);
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, &parser));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
parser.key().data(), parser.key().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.MetaGraphDef.CollectionDefEntry.key"));
} else {
goto handle_unusual;
}
input->UnsafeDecrementRecursionDepth();
break;
}
// map<string, .tensorflow.SignatureDef> signature_def = 5;
case 5: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(42u)) {
DO_(input->IncrementRecursionDepth());
MetaGraphDef_SignatureDefEntry::Parser< ::google::protobuf::internal::MapField<
::std::string, ::tensorflow::SignatureDef,
::google::protobuf::internal::WireFormatLite::TYPE_STRING,
::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
0 >,
::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef > > parser(&signature_def_);
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, &parser));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
parser.key().data(), parser.key().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.MetaGraphDef.SignatureDefEntry.key"));
} else {
goto handle_unusual;
}
input->UnsafeDecrementRecursionDepth();
break;
}
// repeated .tensorflow.AssetFileDef asset_file_def = 6;
case 6: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(50u)) {
DO_(input->IncrementRecursionDepth());
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth(
input, add_asset_file_def()));
} else {
goto handle_unusual;
}
input->UnsafeDecrementRecursionDepth();
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:tensorflow.MetaGraphDef)
return true;
failure:
// @@protoc_insertion_point(parse_failure:tensorflow.MetaGraphDef)
return false;
#undef DO_
}
void MetaGraphDef::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:tensorflow.MetaGraphDef)
// .tensorflow.MetaGraphDef.MetaInfoDef meta_info_def = 1;
if (this->has_meta_info_def()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->meta_info_def_, output);
}
// .tensorflow.GraphDef graph_def = 2;
if (this->has_graph_def()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *this->graph_def_, output);
}
// .tensorflow.SaverDef saver_def = 3;
if (this->has_saver_def()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, *this->saver_def_, output);
}
// map<string, .tensorflow.CollectionDef> collection_def = 4;
if (!this->collection_def().empty()) {
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef >::const_pointer
ConstPtr;
typedef ConstPtr SortItem;
typedef ::google::protobuf::internal::CompareByDerefFirst<SortItem> Less;
struct Utf8Check {
static void Check(ConstPtr p) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
p->first.data(), p->first.length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.CollectionDefEntry.key");
}
};
if (output->IsSerializationDeterministic() &&
this->collection_def().size() > 1) {
::google::protobuf::scoped_array<SortItem> items(
new SortItem[this->collection_def().size()]);
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef >::size_type size_type;
size_type n = 0;
for (::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef >::const_iterator
it = this->collection_def().begin();
it != this->collection_def().end(); ++it, ++n) {
items[n] = SortItem(&*it);
}
::std::sort(&items[0], &items[n], Less());
::google::protobuf::scoped_ptr<MetaGraphDef_CollectionDefEntry> entry;
for (size_type i = 0; i < n; i++) {
entry.reset(collection_def_.NewEntryWrapper(
items[i]->first, items[i]->second));
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, *entry, output);
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(items[i]);
}
} else {
::google::protobuf::scoped_ptr<MetaGraphDef_CollectionDefEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef >::const_iterator
it = this->collection_def().begin();
it != this->collection_def().end(); ++it) {
entry.reset(collection_def_.NewEntryWrapper(
it->first, it->second));
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, *entry, output);
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(&*it);
}
}
}
// map<string, .tensorflow.SignatureDef> signature_def = 5;
if (!this->signature_def().empty()) {
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef >::const_pointer
ConstPtr;
typedef ConstPtr SortItem;
typedef ::google::protobuf::internal::CompareByDerefFirst<SortItem> Less;
struct Utf8Check {
static void Check(ConstPtr p) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
p->first.data(), p->first.length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.SignatureDefEntry.key");
}
};
if (output->IsSerializationDeterministic() &&
this->signature_def().size() > 1) {
::google::protobuf::scoped_array<SortItem> items(
new SortItem[this->signature_def().size()]);
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef >::size_type size_type;
size_type n = 0;
for (::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef >::const_iterator
it = this->signature_def().begin();
it != this->signature_def().end(); ++it, ++n) {
items[n] = SortItem(&*it);
}
::std::sort(&items[0], &items[n], Less());
::google::protobuf::scoped_ptr<MetaGraphDef_SignatureDefEntry> entry;
for (size_type i = 0; i < n; i++) {
entry.reset(signature_def_.NewEntryWrapper(
items[i]->first, items[i]->second));
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
5, *entry, output);
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(items[i]);
}
} else {
::google::protobuf::scoped_ptr<MetaGraphDef_SignatureDefEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef >::const_iterator
it = this->signature_def().begin();
it != this->signature_def().end(); ++it) {
entry.reset(signature_def_.NewEntryWrapper(
it->first, it->second));
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
5, *entry, output);
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(&*it);
}
}
}
// repeated .tensorflow.AssetFileDef asset_file_def = 6;
for (unsigned int i = 0, n = this->asset_file_def_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
6, this->asset_file_def(i), output);
}
// @@protoc_insertion_point(serialize_end:tensorflow.MetaGraphDef)
}
::google::protobuf::uint8* MetaGraphDef::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:tensorflow.MetaGraphDef)
// .tensorflow.MetaGraphDef.MetaInfoDef meta_info_def = 1;
if (this->has_meta_info_def()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->meta_info_def_, false, target);
}
// .tensorflow.GraphDef graph_def = 2;
if (this->has_graph_def()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *this->graph_def_, false, target);
}
// .tensorflow.SaverDef saver_def = 3;
if (this->has_saver_def()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
3, *this->saver_def_, false, target);
}
// map<string, .tensorflow.CollectionDef> collection_def = 4;
if (!this->collection_def().empty()) {
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef >::const_pointer
ConstPtr;
typedef ConstPtr SortItem;
typedef ::google::protobuf::internal::CompareByDerefFirst<SortItem> Less;
struct Utf8Check {
static void Check(ConstPtr p) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
p->first.data(), p->first.length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.CollectionDefEntry.key");
}
};
if (deterministic &&
this->collection_def().size() > 1) {
::google::protobuf::scoped_array<SortItem> items(
new SortItem[this->collection_def().size()]);
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef >::size_type size_type;
size_type n = 0;
for (::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef >::const_iterator
it = this->collection_def().begin();
it != this->collection_def().end(); ++it, ++n) {
items[n] = SortItem(&*it);
}
::std::sort(&items[0], &items[n], Less());
::google::protobuf::scoped_ptr<MetaGraphDef_CollectionDefEntry> entry;
for (size_type i = 0; i < n; i++) {
entry.reset(collection_def_.NewEntryWrapper(
items[i]->first, items[i]->second));
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
4, *entry, deterministic, target);
;
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(items[i]);
}
} else {
::google::protobuf::scoped_ptr<MetaGraphDef_CollectionDefEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef >::const_iterator
it = this->collection_def().begin();
it != this->collection_def().end(); ++it) {
entry.reset(collection_def_.NewEntryWrapper(
it->first, it->second));
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
4, *entry, deterministic, target);
;
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(&*it);
}
}
}
// map<string, .tensorflow.SignatureDef> signature_def = 5;
if (!this->signature_def().empty()) {
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef >::const_pointer
ConstPtr;
typedef ConstPtr SortItem;
typedef ::google::protobuf::internal::CompareByDerefFirst<SortItem> Less;
struct Utf8Check {
static void Check(ConstPtr p) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
p->first.data(), p->first.length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.SignatureDefEntry.key");
}
};
if (deterministic &&
this->signature_def().size() > 1) {
::google::protobuf::scoped_array<SortItem> items(
new SortItem[this->signature_def().size()]);
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef >::size_type size_type;
size_type n = 0;
for (::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef >::const_iterator
it = this->signature_def().begin();
it != this->signature_def().end(); ++it, ++n) {
items[n] = SortItem(&*it);
}
::std::sort(&items[0], &items[n], Less());
::google::protobuf::scoped_ptr<MetaGraphDef_SignatureDefEntry> entry;
for (size_type i = 0; i < n; i++) {
entry.reset(signature_def_.NewEntryWrapper(
items[i]->first, items[i]->second));
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
5, *entry, deterministic, target);
;
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(items[i]);
}
} else {
::google::protobuf::scoped_ptr<MetaGraphDef_SignatureDefEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef >::const_iterator
it = this->signature_def().begin();
it != this->signature_def().end(); ++it) {
entry.reset(signature_def_.NewEntryWrapper(
it->first, it->second));
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
5, *entry, deterministic, target);
;
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(&*it);
}
}
}
// repeated .tensorflow.AssetFileDef asset_file_def = 6;
for (unsigned int i = 0, n = this->asset_file_def_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
6, this->asset_file_def(i), false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:tensorflow.MetaGraphDef)
return target;
}
size_t MetaGraphDef::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.MetaGraphDef)
size_t total_size = 0;
// map<string, .tensorflow.CollectionDef> collection_def = 4;
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->collection_def_size());
{
::google::protobuf::scoped_ptr<MetaGraphDef_CollectionDefEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef >::const_iterator
it = this->collection_def().begin();
it != this->collection_def().end(); ++it) {
if (entry.get() != NULL && entry->GetArena() != NULL) {
entry.release();
}
entry.reset(collection_def_.NewEntryWrapper(it->first, it->second));
total_size += ::google::protobuf::internal::WireFormatLite::
MessageSizeNoVirtual(*entry);
}
if (entry.get() != NULL && entry->GetArena() != NULL) {
entry.release();
}
}
// map<string, .tensorflow.SignatureDef> signature_def = 5;
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->signature_def_size());
{
::google::protobuf::scoped_ptr<MetaGraphDef_SignatureDefEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef >::const_iterator
it = this->signature_def().begin();
it != this->signature_def().end(); ++it) {
if (entry.get() != NULL && entry->GetArena() != NULL) {
entry.release();
}
entry.reset(signature_def_.NewEntryWrapper(it->first, it->second));
total_size += ::google::protobuf::internal::WireFormatLite::
MessageSizeNoVirtual(*entry);
}
if (entry.get() != NULL && entry->GetArena() != NULL) {
entry.release();
}
}
// repeated .tensorflow.AssetFileDef asset_file_def = 6;
{
unsigned int count = this->asset_file_def_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->asset_file_def(i));
}
}
// .tensorflow.MetaGraphDef.MetaInfoDef meta_info_def = 1;
if (this->has_meta_info_def()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->meta_info_def_);
}
// .tensorflow.GraphDef graph_def = 2;
if (this->has_graph_def()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->graph_def_);
}
// .tensorflow.SaverDef saver_def = 3;
if (this->has_saver_def()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->saver_def_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void MetaGraphDef::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.MetaGraphDef)
GOOGLE_DCHECK_NE(&from, this);
const MetaGraphDef* source =
::google::protobuf::internal::DynamicCastToGenerated<const MetaGraphDef>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.MetaGraphDef)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.MetaGraphDef)
MergeFrom(*source);
}
}
void MetaGraphDef::MergeFrom(const MetaGraphDef& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.MetaGraphDef)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
collection_def_.MergeFrom(from.collection_def_);
signature_def_.MergeFrom(from.signature_def_);
asset_file_def_.MergeFrom(from.asset_file_def_);
if (from.has_meta_info_def()) {
mutable_meta_info_def()->::tensorflow::MetaGraphDef_MetaInfoDef::MergeFrom(from.meta_info_def());
}
if (from.has_graph_def()) {
mutable_graph_def()->::tensorflow::GraphDef::MergeFrom(from.graph_def());
}
if (from.has_saver_def()) {
mutable_saver_def()->::tensorflow::SaverDef::MergeFrom(from.saver_def());
}
}
void MetaGraphDef::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.MetaGraphDef)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void MetaGraphDef::CopyFrom(const MetaGraphDef& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.MetaGraphDef)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool MetaGraphDef::IsInitialized() const {
return true;
}
void MetaGraphDef::Swap(MetaGraphDef* other) {
if (other == this) return;
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
InternalSwap(other);
} else {
MetaGraphDef* temp = New(GetArenaNoVirtual());
temp->MergeFrom(*other);
other->CopyFrom(*this);
InternalSwap(temp);
if (GetArenaNoVirtual() == NULL) {
delete temp;
}
}
}
void MetaGraphDef::UnsafeArenaSwap(MetaGraphDef* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void MetaGraphDef::InternalSwap(MetaGraphDef* other) {
collection_def_.Swap(&other->collection_def_);
signature_def_.Swap(&other->signature_def_);
asset_file_def_.UnsafeArenaSwap(&other->asset_file_def_);
std::swap(meta_info_def_, other->meta_info_def_);
std::swap(graph_def_, other->graph_def_);
std::swap(saver_def_, other->saver_def_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata MetaGraphDef::GetMetadata() const {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[3];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// MetaGraphDef
// .tensorflow.MetaGraphDef.MetaInfoDef meta_info_def = 1;
bool MetaGraphDef::has_meta_info_def() const {
return this != internal_default_instance() && meta_info_def_ != NULL;
}
void MetaGraphDef::clear_meta_info_def() {
if (GetArenaNoVirtual() == NULL && meta_info_def_ != NULL) delete meta_info_def_;
meta_info_def_ = NULL;
}
const ::tensorflow::MetaGraphDef_MetaInfoDef& MetaGraphDef::meta_info_def() const {
// @@protoc_insertion_point(field_get:tensorflow.MetaGraphDef.meta_info_def)
return meta_info_def_ != NULL ? *meta_info_def_
: *::tensorflow::MetaGraphDef_MetaInfoDef::internal_default_instance();
}
::tensorflow::MetaGraphDef_MetaInfoDef* MetaGraphDef::mutable_meta_info_def() {
if (meta_info_def_ == NULL) {
_slow_mutable_meta_info_def();
}
// @@protoc_insertion_point(field_mutable:tensorflow.MetaGraphDef.meta_info_def)
return meta_info_def_;
}
::tensorflow::MetaGraphDef_MetaInfoDef* MetaGraphDef::release_meta_info_def() {
// @@protoc_insertion_point(field_release:tensorflow.MetaGraphDef.meta_info_def)
if (GetArenaNoVirtual() != NULL) {
return _slow_release_meta_info_def();
} else {
::tensorflow::MetaGraphDef_MetaInfoDef* temp = meta_info_def_;
meta_info_def_ = NULL;
return temp;
}
}
void MetaGraphDef::set_allocated_meta_info_def(::tensorflow::MetaGraphDef_MetaInfoDef* meta_info_def) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == NULL) {
delete meta_info_def_;
}
if (meta_info_def != NULL) {
_slow_set_allocated_meta_info_def(message_arena, &meta_info_def);
}
meta_info_def_ = meta_info_def;
if (meta_info_def) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.MetaGraphDef.meta_info_def)
}
// .tensorflow.GraphDef graph_def = 2;
bool MetaGraphDef::has_graph_def() const {
return this != internal_default_instance() && graph_def_ != NULL;
}
void MetaGraphDef::clear_graph_def() {
if (GetArenaNoVirtual() == NULL && graph_def_ != NULL) delete graph_def_;
graph_def_ = NULL;
}
const ::tensorflow::GraphDef& MetaGraphDef::graph_def() const {
// @@protoc_insertion_point(field_get:tensorflow.MetaGraphDef.graph_def)
return graph_def_ != NULL ? *graph_def_
: *::tensorflow::GraphDef::internal_default_instance();
}
::tensorflow::GraphDef* MetaGraphDef::mutable_graph_def() {
if (graph_def_ == NULL) {
_slow_mutable_graph_def();
}
// @@protoc_insertion_point(field_mutable:tensorflow.MetaGraphDef.graph_def)
return graph_def_;
}
::tensorflow::GraphDef* MetaGraphDef::release_graph_def() {
// @@protoc_insertion_point(field_release:tensorflow.MetaGraphDef.graph_def)
if (GetArenaNoVirtual() != NULL) {
return _slow_release_graph_def();
} else {
::tensorflow::GraphDef* temp = graph_def_;
graph_def_ = NULL;
return temp;
}
}
void MetaGraphDef::set_allocated_graph_def(::tensorflow::GraphDef* graph_def) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == NULL) {
delete graph_def_;
}
if (graph_def != NULL) {
_slow_set_allocated_graph_def(message_arena, &graph_def);
}
graph_def_ = graph_def;
if (graph_def) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.MetaGraphDef.graph_def)
}
// .tensorflow.SaverDef saver_def = 3;
bool MetaGraphDef::has_saver_def() const {
return this != internal_default_instance() && saver_def_ != NULL;
}
void MetaGraphDef::clear_saver_def() {
if (GetArenaNoVirtual() == NULL && saver_def_ != NULL) delete saver_def_;
saver_def_ = NULL;
}
const ::tensorflow::SaverDef& MetaGraphDef::saver_def() const {
// @@protoc_insertion_point(field_get:tensorflow.MetaGraphDef.saver_def)
return saver_def_ != NULL ? *saver_def_
: *::tensorflow::SaverDef::internal_default_instance();
}
::tensorflow::SaverDef* MetaGraphDef::mutable_saver_def() {
if (saver_def_ == NULL) {
_slow_mutable_saver_def();
}
// @@protoc_insertion_point(field_mutable:tensorflow.MetaGraphDef.saver_def)
return saver_def_;
}
::tensorflow::SaverDef* MetaGraphDef::release_saver_def() {
// @@protoc_insertion_point(field_release:tensorflow.MetaGraphDef.saver_def)
if (GetArenaNoVirtual() != NULL) {
return _slow_release_saver_def();
} else {
::tensorflow::SaverDef* temp = saver_def_;
saver_def_ = NULL;
return temp;
}
}
void MetaGraphDef::set_allocated_saver_def(::tensorflow::SaverDef* saver_def) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == NULL) {
delete saver_def_;
}
if (saver_def != NULL) {
_slow_set_allocated_saver_def(message_arena, &saver_def);
}
saver_def_ = saver_def;
if (saver_def) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.MetaGraphDef.saver_def)
}
// map<string, .tensorflow.CollectionDef> collection_def = 4;
int MetaGraphDef::collection_def_size() const {
return collection_def_.size();
}
void MetaGraphDef::clear_collection_def() {
collection_def_.Clear();
}
const ::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef >&
MetaGraphDef::collection_def() const {
// @@protoc_insertion_point(field_map:tensorflow.MetaGraphDef.collection_def)
return collection_def_.GetMap();
}
::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef >*
MetaGraphDef::mutable_collection_def() {
// @@protoc_insertion_point(field_mutable_map:tensorflow.MetaGraphDef.collection_def)
return collection_def_.MutableMap();
}
// map<string, .tensorflow.SignatureDef> signature_def = 5;
int MetaGraphDef::signature_def_size() const {
return signature_def_.size();
}
void MetaGraphDef::clear_signature_def() {
signature_def_.Clear();
}
const ::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef >&
MetaGraphDef::signature_def() const {
// @@protoc_insertion_point(field_map:tensorflow.MetaGraphDef.signature_def)
return signature_def_.GetMap();
}
::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef >*
MetaGraphDef::mutable_signature_def() {
// @@protoc_insertion_point(field_mutable_map:tensorflow.MetaGraphDef.signature_def)
return signature_def_.MutableMap();
}
// repeated .tensorflow.AssetFileDef asset_file_def = 6;
int MetaGraphDef::asset_file_def_size() const {
return asset_file_def_.size();
}
void MetaGraphDef::clear_asset_file_def() {
asset_file_def_.Clear();
}
const ::tensorflow::AssetFileDef& MetaGraphDef::asset_file_def(int index) const {
// @@protoc_insertion_point(field_get:tensorflow.MetaGraphDef.asset_file_def)
return asset_file_def_.Get(index);
}
::tensorflow::AssetFileDef* MetaGraphDef::mutable_asset_file_def(int index) {
// @@protoc_insertion_point(field_mutable:tensorflow.MetaGraphDef.asset_file_def)
return asset_file_def_.Mutable(index);
}
::tensorflow::AssetFileDef* MetaGraphDef::add_asset_file_def() {
// @@protoc_insertion_point(field_add:tensorflow.MetaGraphDef.asset_file_def)
return asset_file_def_.Add();
}
::google::protobuf::RepeatedPtrField< ::tensorflow::AssetFileDef >*
MetaGraphDef::mutable_asset_file_def() {
// @@protoc_insertion_point(field_mutable_list:tensorflow.MetaGraphDef.asset_file_def)
return &asset_file_def_;
}
const ::google::protobuf::RepeatedPtrField< ::tensorflow::AssetFileDef >&
MetaGraphDef::asset_file_def() const {
// @@protoc_insertion_point(field_list:tensorflow.MetaGraphDef.asset_file_def)
return asset_file_def_;
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int CollectionDef_NodeList::kValueFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
CollectionDef_NodeList::CollectionDef_NodeList()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:tensorflow.CollectionDef.NodeList)
}
CollectionDef_NodeList::CollectionDef_NodeList(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena),
value_(arena) {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
#endif // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:tensorflow.CollectionDef.NodeList)
}
CollectionDef_NodeList::CollectionDef_NodeList(const CollectionDef_NodeList& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
value_(from.value_),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:tensorflow.CollectionDef.NodeList)
}
void CollectionDef_NodeList::SharedCtor() {
_cached_size_ = 0;
}
CollectionDef_NodeList::~CollectionDef_NodeList() {
// @@protoc_insertion_point(destructor:tensorflow.CollectionDef.NodeList)
SharedDtor();
}
void CollectionDef_NodeList::SharedDtor() {
::google::protobuf::Arena* arena = GetArenaNoVirtual();
if (arena != NULL) {
return;
}
}
void CollectionDef_NodeList::ArenaDtor(void* object) {
CollectionDef_NodeList* _this = reinterpret_cast< CollectionDef_NodeList* >(object);
(void)_this;
}
void CollectionDef_NodeList::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void CollectionDef_NodeList::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CollectionDef_NodeList::descriptor() {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[4].descriptor;
}
const CollectionDef_NodeList& CollectionDef_NodeList::default_instance() {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
return *internal_default_instance();
}
CollectionDef_NodeList* CollectionDef_NodeList::New(::google::protobuf::Arena* arena) const {
return ::google::protobuf::Arena::CreateMessage<CollectionDef_NodeList>(arena);
}
void CollectionDef_NodeList::Clear() {
// @@protoc_insertion_point(message_clear_start:tensorflow.CollectionDef.NodeList)
value_.Clear();
}
bool CollectionDef_NodeList::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:tensorflow.CollectionDef.NodeList)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated string value = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->add_value()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->value(this->value_size() - 1).data(),
this->value(this->value_size() - 1).length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.CollectionDef.NodeList.value"));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:tensorflow.CollectionDef.NodeList)
return true;
failure:
// @@protoc_insertion_point(parse_failure:tensorflow.CollectionDef.NodeList)
return false;
#undef DO_
}
void CollectionDef_NodeList::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:tensorflow.CollectionDef.NodeList)
// repeated string value = 1;
for (int i = 0, n = this->value_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->value(i).data(), this->value(i).length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.CollectionDef.NodeList.value");
::google::protobuf::internal::WireFormatLite::WriteString(
1, this->value(i), output);
}
// @@protoc_insertion_point(serialize_end:tensorflow.CollectionDef.NodeList)
}
::google::protobuf::uint8* CollectionDef_NodeList::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:tensorflow.CollectionDef.NodeList)
// repeated string value = 1;
for (int i = 0, n = this->value_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->value(i).data(), this->value(i).length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.CollectionDef.NodeList.value");
target = ::google::protobuf::internal::WireFormatLite::
WriteStringToArray(1, this->value(i), target);
}
// @@protoc_insertion_point(serialize_to_array_end:tensorflow.CollectionDef.NodeList)
return target;
}
size_t CollectionDef_NodeList::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.CollectionDef.NodeList)
size_t total_size = 0;
// repeated string value = 1;
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->value_size());
for (int i = 0, n = this->value_size(); i < n; i++) {
total_size += ::google::protobuf::internal::WireFormatLite::StringSize(
this->value(i));
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CollectionDef_NodeList::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.CollectionDef.NodeList)
GOOGLE_DCHECK_NE(&from, this);
const CollectionDef_NodeList* source =
::google::protobuf::internal::DynamicCastToGenerated<const CollectionDef_NodeList>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.CollectionDef.NodeList)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.CollectionDef.NodeList)
MergeFrom(*source);
}
}
void CollectionDef_NodeList::MergeFrom(const CollectionDef_NodeList& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.CollectionDef.NodeList)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
value_.MergeFrom(from.value_);
}
void CollectionDef_NodeList::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.CollectionDef.NodeList)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CollectionDef_NodeList::CopyFrom(const CollectionDef_NodeList& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.CollectionDef.NodeList)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CollectionDef_NodeList::IsInitialized() const {
return true;
}
void CollectionDef_NodeList::Swap(CollectionDef_NodeList* other) {
if (other == this) return;
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
InternalSwap(other);
} else {
CollectionDef_NodeList* temp = New(GetArenaNoVirtual());
temp->MergeFrom(*other);
other->CopyFrom(*this);
InternalSwap(temp);
if (GetArenaNoVirtual() == NULL) {
delete temp;
}
}
}
void CollectionDef_NodeList::UnsafeArenaSwap(CollectionDef_NodeList* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void CollectionDef_NodeList::InternalSwap(CollectionDef_NodeList* other) {
value_.UnsafeArenaSwap(&other->value_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata CollectionDef_NodeList::GetMetadata() const {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[4];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// CollectionDef_NodeList
// repeated string value = 1;
int CollectionDef_NodeList::value_size() const {
return value_.size();
}
void CollectionDef_NodeList::clear_value() {
value_.Clear();
}
const ::std::string& CollectionDef_NodeList::value(int index) const {
// @@protoc_insertion_point(field_get:tensorflow.CollectionDef.NodeList.value)
return value_.Get(index);
}
::std::string* CollectionDef_NodeList::mutable_value(int index) {
// @@protoc_insertion_point(field_mutable:tensorflow.CollectionDef.NodeList.value)
return value_.Mutable(index);
}
void CollectionDef_NodeList::set_value(int index, const ::std::string& value) {
// @@protoc_insertion_point(field_set:tensorflow.CollectionDef.NodeList.value)
value_.Mutable(index)->assign(value);
}
#if LANG_CXX11
void CollectionDef_NodeList::set_value(int index, ::std::string&& value) {
// @@protoc_insertion_point(field_set:tensorflow.CollectionDef.NodeList.value)
value_.Mutable(index)->assign(std::move(value));
}
#endif
void CollectionDef_NodeList::set_value(int index, const char* value) {
value_.Mutable(index)->assign(value);
// @@protoc_insertion_point(field_set_char:tensorflow.CollectionDef.NodeList.value)
}
void CollectionDef_NodeList::set_value(int index, const char* value, size_t size) {
value_.Mutable(index)->assign(
reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:tensorflow.CollectionDef.NodeList.value)
}
::std::string* CollectionDef_NodeList::add_value() {
// @@protoc_insertion_point(field_add_mutable:tensorflow.CollectionDef.NodeList.value)
return value_.Add();
}
void CollectionDef_NodeList::add_value(const ::std::string& value) {
value_.Add()->assign(value);
// @@protoc_insertion_point(field_add:tensorflow.CollectionDef.NodeList.value)
}
#if LANG_CXX11
void CollectionDef_NodeList::add_value(::std::string&& value) {
value_.Add()->assign(std::move(value));
// @@protoc_insertion_point(field_add:tensorflow.CollectionDef.NodeList.value)
}
#endif
void CollectionDef_NodeList::add_value(const char* value) {
value_.Add()->assign(value);
// @@protoc_insertion_point(field_add_char:tensorflow.CollectionDef.NodeList.value)
}
void CollectionDef_NodeList::add_value(const char* value, size_t size) {
value_.Add()->assign(reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_add_pointer:tensorflow.CollectionDef.NodeList.value)
}
const ::google::protobuf::RepeatedPtrField< ::std::string>&
CollectionDef_NodeList::value() const {
// @@protoc_insertion_point(field_list:tensorflow.CollectionDef.NodeList.value)
return value_;
}
::google::protobuf::RepeatedPtrField< ::std::string>*
CollectionDef_NodeList::mutable_value() {
// @@protoc_insertion_point(field_mutable_list:tensorflow.CollectionDef.NodeList.value)
return &value_;
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int CollectionDef_BytesList::kValueFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
CollectionDef_BytesList::CollectionDef_BytesList()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:tensorflow.CollectionDef.BytesList)
}
CollectionDef_BytesList::CollectionDef_BytesList(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena),
value_(arena) {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
#endif // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:tensorflow.CollectionDef.BytesList)
}
CollectionDef_BytesList::CollectionDef_BytesList(const CollectionDef_BytesList& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
value_(from.value_),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:tensorflow.CollectionDef.BytesList)
}
void CollectionDef_BytesList::SharedCtor() {
_cached_size_ = 0;
}
CollectionDef_BytesList::~CollectionDef_BytesList() {
// @@protoc_insertion_point(destructor:tensorflow.CollectionDef.BytesList)
SharedDtor();
}
void CollectionDef_BytesList::SharedDtor() {
::google::protobuf::Arena* arena = GetArenaNoVirtual();
if (arena != NULL) {
return;
}
}
void CollectionDef_BytesList::ArenaDtor(void* object) {
CollectionDef_BytesList* _this = reinterpret_cast< CollectionDef_BytesList* >(object);
(void)_this;
}
void CollectionDef_BytesList::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void CollectionDef_BytesList::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CollectionDef_BytesList::descriptor() {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[5].descriptor;
}
const CollectionDef_BytesList& CollectionDef_BytesList::default_instance() {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
return *internal_default_instance();
}
CollectionDef_BytesList* CollectionDef_BytesList::New(::google::protobuf::Arena* arena) const {
return ::google::protobuf::Arena::CreateMessage<CollectionDef_BytesList>(arena);
}
void CollectionDef_BytesList::Clear() {
// @@protoc_insertion_point(message_clear_start:tensorflow.CollectionDef.BytesList)
value_.Clear();
}
bool CollectionDef_BytesList::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:tensorflow.CollectionDef.BytesList)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated bytes value = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
input, this->add_value()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:tensorflow.CollectionDef.BytesList)
return true;
failure:
// @@protoc_insertion_point(parse_failure:tensorflow.CollectionDef.BytesList)
return false;
#undef DO_
}
void CollectionDef_BytesList::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:tensorflow.CollectionDef.BytesList)
// repeated bytes value = 1;
for (int i = 0, n = this->value_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteBytes(
1, this->value(i), output);
}
// @@protoc_insertion_point(serialize_end:tensorflow.CollectionDef.BytesList)
}
::google::protobuf::uint8* CollectionDef_BytesList::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:tensorflow.CollectionDef.BytesList)
// repeated bytes value = 1;
for (int i = 0, n = this->value_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteBytesToArray(1, this->value(i), target);
}
// @@protoc_insertion_point(serialize_to_array_end:tensorflow.CollectionDef.BytesList)
return target;
}
size_t CollectionDef_BytesList::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.CollectionDef.BytesList)
size_t total_size = 0;
// repeated bytes value = 1;
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->value_size());
for (int i = 0, n = this->value_size(); i < n; i++) {
total_size += ::google::protobuf::internal::WireFormatLite::BytesSize(
this->value(i));
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CollectionDef_BytesList::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.CollectionDef.BytesList)
GOOGLE_DCHECK_NE(&from, this);
const CollectionDef_BytesList* source =
::google::protobuf::internal::DynamicCastToGenerated<const CollectionDef_BytesList>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.CollectionDef.BytesList)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.CollectionDef.BytesList)
MergeFrom(*source);
}
}
void CollectionDef_BytesList::MergeFrom(const CollectionDef_BytesList& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.CollectionDef.BytesList)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
value_.MergeFrom(from.value_);
}
void CollectionDef_BytesList::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.CollectionDef.BytesList)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CollectionDef_BytesList::CopyFrom(const CollectionDef_BytesList& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.CollectionDef.BytesList)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CollectionDef_BytesList::IsInitialized() const {
return true;
}
void CollectionDef_BytesList::Swap(CollectionDef_BytesList* other) {
if (other == this) return;
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
InternalSwap(other);
} else {
CollectionDef_BytesList* temp = New(GetArenaNoVirtual());
temp->MergeFrom(*other);
other->CopyFrom(*this);
InternalSwap(temp);
if (GetArenaNoVirtual() == NULL) {
delete temp;
}
}
}
void CollectionDef_BytesList::UnsafeArenaSwap(CollectionDef_BytesList* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void CollectionDef_BytesList::InternalSwap(CollectionDef_BytesList* other) {
value_.UnsafeArenaSwap(&other->value_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata CollectionDef_BytesList::GetMetadata() const {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[5];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// CollectionDef_BytesList
// repeated bytes value = 1;
int CollectionDef_BytesList::value_size() const {
return value_.size();
}
void CollectionDef_BytesList::clear_value() {
value_.Clear();
}
const ::std::string& CollectionDef_BytesList::value(int index) const {
// @@protoc_insertion_point(field_get:tensorflow.CollectionDef.BytesList.value)
return value_.Get(index);
}
::std::string* CollectionDef_BytesList::mutable_value(int index) {
// @@protoc_insertion_point(field_mutable:tensorflow.CollectionDef.BytesList.value)
return value_.Mutable(index);
}
void CollectionDef_BytesList::set_value(int index, const ::std::string& value) {
// @@protoc_insertion_point(field_set:tensorflow.CollectionDef.BytesList.value)
value_.Mutable(index)->assign(value);
}
#if LANG_CXX11
void CollectionDef_BytesList::set_value(int index, ::std::string&& value) {
// @@protoc_insertion_point(field_set:tensorflow.CollectionDef.BytesList.value)
value_.Mutable(index)->assign(std::move(value));
}
#endif
void CollectionDef_BytesList::set_value(int index, const char* value) {
value_.Mutable(index)->assign(value);
// @@protoc_insertion_point(field_set_char:tensorflow.CollectionDef.BytesList.value)
}
void CollectionDef_BytesList::set_value(int index, const void* value, size_t size) {
value_.Mutable(index)->assign(
reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:tensorflow.CollectionDef.BytesList.value)
}
::std::string* CollectionDef_BytesList::add_value() {
// @@protoc_insertion_point(field_add_mutable:tensorflow.CollectionDef.BytesList.value)
return value_.Add();
}
void CollectionDef_BytesList::add_value(const ::std::string& value) {
value_.Add()->assign(value);
// @@protoc_insertion_point(field_add:tensorflow.CollectionDef.BytesList.value)
}
#if LANG_CXX11
void CollectionDef_BytesList::add_value(::std::string&& value) {
value_.Add()->assign(std::move(value));
// @@protoc_insertion_point(field_add:tensorflow.CollectionDef.BytesList.value)
}
#endif
void CollectionDef_BytesList::add_value(const char* value) {
value_.Add()->assign(value);
// @@protoc_insertion_point(field_add_char:tensorflow.CollectionDef.BytesList.value)
}
void CollectionDef_BytesList::add_value(const void* value, size_t size) {
value_.Add()->assign(reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_add_pointer:tensorflow.CollectionDef.BytesList.value)
}
const ::google::protobuf::RepeatedPtrField< ::std::string>&
CollectionDef_BytesList::value() const {
// @@protoc_insertion_point(field_list:tensorflow.CollectionDef.BytesList.value)
return value_;
}
::google::protobuf::RepeatedPtrField< ::std::string>*
CollectionDef_BytesList::mutable_value() {
// @@protoc_insertion_point(field_mutable_list:tensorflow.CollectionDef.BytesList.value)
return &value_;
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int CollectionDef_Int64List::kValueFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
CollectionDef_Int64List::CollectionDef_Int64List()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:tensorflow.CollectionDef.Int64List)
}
CollectionDef_Int64List::CollectionDef_Int64List(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena),
value_(arena) {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
#endif // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:tensorflow.CollectionDef.Int64List)
}
CollectionDef_Int64List::CollectionDef_Int64List(const CollectionDef_Int64List& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
value_(from.value_),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:tensorflow.CollectionDef.Int64List)
}
void CollectionDef_Int64List::SharedCtor() {
_cached_size_ = 0;
}
CollectionDef_Int64List::~CollectionDef_Int64List() {
// @@protoc_insertion_point(destructor:tensorflow.CollectionDef.Int64List)
SharedDtor();
}
void CollectionDef_Int64List::SharedDtor() {
::google::protobuf::Arena* arena = GetArenaNoVirtual();
if (arena != NULL) {
return;
}
}
void CollectionDef_Int64List::ArenaDtor(void* object) {
CollectionDef_Int64List* _this = reinterpret_cast< CollectionDef_Int64List* >(object);
(void)_this;
}
void CollectionDef_Int64List::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void CollectionDef_Int64List::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CollectionDef_Int64List::descriptor() {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[6].descriptor;
}
const CollectionDef_Int64List& CollectionDef_Int64List::default_instance() {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
return *internal_default_instance();
}
CollectionDef_Int64List* CollectionDef_Int64List::New(::google::protobuf::Arena* arena) const {
return ::google::protobuf::Arena::CreateMessage<CollectionDef_Int64List>(arena);
}
void CollectionDef_Int64List::Clear() {
// @@protoc_insertion_point(message_clear_start:tensorflow.CollectionDef.Int64List)
value_.Clear();
}
bool CollectionDef_Int64List::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:tensorflow.CollectionDef.Int64List)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated int64 value = 1 [packed = true];
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive<
::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
input, this->mutable_value())));
} else if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(8u)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline<
::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
1, 10u, input, this->mutable_value())));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:tensorflow.CollectionDef.Int64List)
return true;
failure:
// @@protoc_insertion_point(parse_failure:tensorflow.CollectionDef.Int64List)
return false;
#undef DO_
}
void CollectionDef_Int64List::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:tensorflow.CollectionDef.Int64List)
// repeated int64 value = 1 [packed = true];
if (this->value_size() > 0) {
::google::protobuf::internal::WireFormatLite::WriteTag(1, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
output->WriteVarint32(_value_cached_byte_size_);
}
for (int i = 0, n = this->value_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteInt64NoTag(
this->value(i), output);
}
// @@protoc_insertion_point(serialize_end:tensorflow.CollectionDef.Int64List)
}
::google::protobuf::uint8* CollectionDef_Int64List::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:tensorflow.CollectionDef.Int64List)
// repeated int64 value = 1 [packed = true];
if (this->value_size() > 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
1,
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
target);
target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
_value_cached_byte_size_, target);
}
for (int i = 0, n = this->value_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteInt64NoTagToArray(this->value(i), target);
}
// @@protoc_insertion_point(serialize_to_array_end:tensorflow.CollectionDef.Int64List)
return target;
}
size_t CollectionDef_Int64List::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.CollectionDef.Int64List)
size_t total_size = 0;
// repeated int64 value = 1 [packed = true];
{
size_t data_size = ::google::protobuf::internal::WireFormatLite::
Int64Size(this->value_);
if (data_size > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(data_size);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_value_cached_byte_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
total_size += data_size;
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CollectionDef_Int64List::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.CollectionDef.Int64List)
GOOGLE_DCHECK_NE(&from, this);
const CollectionDef_Int64List* source =
::google::protobuf::internal::DynamicCastToGenerated<const CollectionDef_Int64List>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.CollectionDef.Int64List)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.CollectionDef.Int64List)
MergeFrom(*source);
}
}
void CollectionDef_Int64List::MergeFrom(const CollectionDef_Int64List& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.CollectionDef.Int64List)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
value_.MergeFrom(from.value_);
}
void CollectionDef_Int64List::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.CollectionDef.Int64List)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CollectionDef_Int64List::CopyFrom(const CollectionDef_Int64List& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.CollectionDef.Int64List)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CollectionDef_Int64List::IsInitialized() const {
return true;
}
void CollectionDef_Int64List::Swap(CollectionDef_Int64List* other) {
if (other == this) return;
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
InternalSwap(other);
} else {
CollectionDef_Int64List* temp = New(GetArenaNoVirtual());
temp->MergeFrom(*other);
other->CopyFrom(*this);
InternalSwap(temp);
if (GetArenaNoVirtual() == NULL) {
delete temp;
}
}
}
void CollectionDef_Int64List::UnsafeArenaSwap(CollectionDef_Int64List* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void CollectionDef_Int64List::InternalSwap(CollectionDef_Int64List* other) {
value_.UnsafeArenaSwap(&other->value_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata CollectionDef_Int64List::GetMetadata() const {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[6];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// CollectionDef_Int64List
// repeated int64 value = 1 [packed = true];
int CollectionDef_Int64List::value_size() const {
return value_.size();
}
void CollectionDef_Int64List::clear_value() {
value_.Clear();
}
::google::protobuf::int64 CollectionDef_Int64List::value(int index) const {
// @@protoc_insertion_point(field_get:tensorflow.CollectionDef.Int64List.value)
return value_.Get(index);
}
void CollectionDef_Int64List::set_value(int index, ::google::protobuf::int64 value) {
value_.Set(index, value);
// @@protoc_insertion_point(field_set:tensorflow.CollectionDef.Int64List.value)
}
void CollectionDef_Int64List::add_value(::google::protobuf::int64 value) {
value_.Add(value);
// @@protoc_insertion_point(field_add:tensorflow.CollectionDef.Int64List.value)
}
const ::google::protobuf::RepeatedField< ::google::protobuf::int64 >&
CollectionDef_Int64List::value() const {
// @@protoc_insertion_point(field_list:tensorflow.CollectionDef.Int64List.value)
return value_;
}
::google::protobuf::RepeatedField< ::google::protobuf::int64 >*
CollectionDef_Int64List::mutable_value() {
// @@protoc_insertion_point(field_mutable_list:tensorflow.CollectionDef.Int64List.value)
return &value_;
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int CollectionDef_FloatList::kValueFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
CollectionDef_FloatList::CollectionDef_FloatList()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:tensorflow.CollectionDef.FloatList)
}
CollectionDef_FloatList::CollectionDef_FloatList(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena),
value_(arena) {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
#endif // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:tensorflow.CollectionDef.FloatList)
}
CollectionDef_FloatList::CollectionDef_FloatList(const CollectionDef_FloatList& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
value_(from.value_),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:tensorflow.CollectionDef.FloatList)
}
void CollectionDef_FloatList::SharedCtor() {
_cached_size_ = 0;
}
CollectionDef_FloatList::~CollectionDef_FloatList() {
// @@protoc_insertion_point(destructor:tensorflow.CollectionDef.FloatList)
SharedDtor();
}
void CollectionDef_FloatList::SharedDtor() {
::google::protobuf::Arena* arena = GetArenaNoVirtual();
if (arena != NULL) {
return;
}
}
void CollectionDef_FloatList::ArenaDtor(void* object) {
CollectionDef_FloatList* _this = reinterpret_cast< CollectionDef_FloatList* >(object);
(void)_this;
}
void CollectionDef_FloatList::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void CollectionDef_FloatList::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CollectionDef_FloatList::descriptor() {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[7].descriptor;
}
const CollectionDef_FloatList& CollectionDef_FloatList::default_instance() {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
return *internal_default_instance();
}
CollectionDef_FloatList* CollectionDef_FloatList::New(::google::protobuf::Arena* arena) const {
return ::google::protobuf::Arena::CreateMessage<CollectionDef_FloatList>(arena);
}
void CollectionDef_FloatList::Clear() {
// @@protoc_insertion_point(message_clear_start:tensorflow.CollectionDef.FloatList)
value_.Clear();
}
bool CollectionDef_FloatList::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:tensorflow.CollectionDef.FloatList)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated float value = 1 [packed = true];
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive<
float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>(
input, this->mutable_value())));
} else if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(13u)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline<
float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>(
1, 10u, input, this->mutable_value())));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:tensorflow.CollectionDef.FloatList)
return true;
failure:
// @@protoc_insertion_point(parse_failure:tensorflow.CollectionDef.FloatList)
return false;
#undef DO_
}
void CollectionDef_FloatList::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:tensorflow.CollectionDef.FloatList)
// repeated float value = 1 [packed = true];
if (this->value_size() > 0) {
::google::protobuf::internal::WireFormatLite::WriteTag(1, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
output->WriteVarint32(_value_cached_byte_size_);
::google::protobuf::internal::WireFormatLite::WriteFloatArray(
this->value().data(), this->value_size(), output);
}
// @@protoc_insertion_point(serialize_end:tensorflow.CollectionDef.FloatList)
}
::google::protobuf::uint8* CollectionDef_FloatList::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:tensorflow.CollectionDef.FloatList)
// repeated float value = 1 [packed = true];
if (this->value_size() > 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
1,
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
target);
target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
_value_cached_byte_size_, target);
}
for (int i = 0, n = this->value_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteFloatNoTagToArray(this->value(i), target);
}
// @@protoc_insertion_point(serialize_to_array_end:tensorflow.CollectionDef.FloatList)
return target;
}
size_t CollectionDef_FloatList::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.CollectionDef.FloatList)
size_t total_size = 0;
// repeated float value = 1 [packed = true];
{
unsigned int count = this->value_size();
size_t data_size = 4UL * count;
if (data_size > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(data_size);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_value_cached_byte_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
total_size += data_size;
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CollectionDef_FloatList::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.CollectionDef.FloatList)
GOOGLE_DCHECK_NE(&from, this);
const CollectionDef_FloatList* source =
::google::protobuf::internal::DynamicCastToGenerated<const CollectionDef_FloatList>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.CollectionDef.FloatList)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.CollectionDef.FloatList)
MergeFrom(*source);
}
}
void CollectionDef_FloatList::MergeFrom(const CollectionDef_FloatList& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.CollectionDef.FloatList)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
value_.MergeFrom(from.value_);
}
void CollectionDef_FloatList::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.CollectionDef.FloatList)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CollectionDef_FloatList::CopyFrom(const CollectionDef_FloatList& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.CollectionDef.FloatList)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CollectionDef_FloatList::IsInitialized() const {
return true;
}
void CollectionDef_FloatList::Swap(CollectionDef_FloatList* other) {
if (other == this) return;
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
InternalSwap(other);
} else {
CollectionDef_FloatList* temp = New(GetArenaNoVirtual());
temp->MergeFrom(*other);
other->CopyFrom(*this);
InternalSwap(temp);
if (GetArenaNoVirtual() == NULL) {
delete temp;
}
}
}
void CollectionDef_FloatList::UnsafeArenaSwap(CollectionDef_FloatList* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void CollectionDef_FloatList::InternalSwap(CollectionDef_FloatList* other) {
value_.UnsafeArenaSwap(&other->value_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata CollectionDef_FloatList::GetMetadata() const {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[7];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// CollectionDef_FloatList
// repeated float value = 1 [packed = true];
int CollectionDef_FloatList::value_size() const {
return value_.size();
}
void CollectionDef_FloatList::clear_value() {
value_.Clear();
}
float CollectionDef_FloatList::value(int index) const {
// @@protoc_insertion_point(field_get:tensorflow.CollectionDef.FloatList.value)
return value_.Get(index);
}
void CollectionDef_FloatList::set_value(int index, float value) {
value_.Set(index, value);
// @@protoc_insertion_point(field_set:tensorflow.CollectionDef.FloatList.value)
}
void CollectionDef_FloatList::add_value(float value) {
value_.Add(value);
// @@protoc_insertion_point(field_add:tensorflow.CollectionDef.FloatList.value)
}
const ::google::protobuf::RepeatedField< float >&
CollectionDef_FloatList::value() const {
// @@protoc_insertion_point(field_list:tensorflow.CollectionDef.FloatList.value)
return value_;
}
::google::protobuf::RepeatedField< float >*
CollectionDef_FloatList::mutable_value() {
// @@protoc_insertion_point(field_mutable_list:tensorflow.CollectionDef.FloatList.value)
return &value_;
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int CollectionDef_AnyList::kValueFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
CollectionDef_AnyList::CollectionDef_AnyList()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:tensorflow.CollectionDef.AnyList)
}
CollectionDef_AnyList::CollectionDef_AnyList(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena),
value_(arena) {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
#endif // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:tensorflow.CollectionDef.AnyList)
}
CollectionDef_AnyList::CollectionDef_AnyList(const CollectionDef_AnyList& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
value_(from.value_),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:tensorflow.CollectionDef.AnyList)
}
void CollectionDef_AnyList::SharedCtor() {
_cached_size_ = 0;
}
CollectionDef_AnyList::~CollectionDef_AnyList() {
// @@protoc_insertion_point(destructor:tensorflow.CollectionDef.AnyList)
SharedDtor();
}
void CollectionDef_AnyList::SharedDtor() {
::google::protobuf::Arena* arena = GetArenaNoVirtual();
if (arena != NULL) {
return;
}
}
void CollectionDef_AnyList::ArenaDtor(void* object) {
CollectionDef_AnyList* _this = reinterpret_cast< CollectionDef_AnyList* >(object);
(void)_this;
}
void CollectionDef_AnyList::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void CollectionDef_AnyList::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CollectionDef_AnyList::descriptor() {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[8].descriptor;
}
const CollectionDef_AnyList& CollectionDef_AnyList::default_instance() {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
return *internal_default_instance();
}
CollectionDef_AnyList* CollectionDef_AnyList::New(::google::protobuf::Arena* arena) const {
return ::google::protobuf::Arena::CreateMessage<CollectionDef_AnyList>(arena);
}
void CollectionDef_AnyList::Clear() {
// @@protoc_insertion_point(message_clear_start:tensorflow.CollectionDef.AnyList)
value_.Clear();
}
bool CollectionDef_AnyList::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:tensorflow.CollectionDef.AnyList)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated .google.protobuf.Any value = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_(input->IncrementRecursionDepth());
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth(
input, add_value()));
} else {
goto handle_unusual;
}
input->UnsafeDecrementRecursionDepth();
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:tensorflow.CollectionDef.AnyList)
return true;
failure:
// @@protoc_insertion_point(parse_failure:tensorflow.CollectionDef.AnyList)
return false;
#undef DO_
}
void CollectionDef_AnyList::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:tensorflow.CollectionDef.AnyList)
// repeated .google.protobuf.Any value = 1;
for (unsigned int i = 0, n = this->value_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->value(i), output);
}
// @@protoc_insertion_point(serialize_end:tensorflow.CollectionDef.AnyList)
}
::google::protobuf::uint8* CollectionDef_AnyList::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:tensorflow.CollectionDef.AnyList)
// repeated .google.protobuf.Any value = 1;
for (unsigned int i = 0, n = this->value_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, this->value(i), false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:tensorflow.CollectionDef.AnyList)
return target;
}
size_t CollectionDef_AnyList::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.CollectionDef.AnyList)
size_t total_size = 0;
// repeated .google.protobuf.Any value = 1;
{
unsigned int count = this->value_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->value(i));
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CollectionDef_AnyList::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.CollectionDef.AnyList)
GOOGLE_DCHECK_NE(&from, this);
const CollectionDef_AnyList* source =
::google::protobuf::internal::DynamicCastToGenerated<const CollectionDef_AnyList>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.CollectionDef.AnyList)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.CollectionDef.AnyList)
MergeFrom(*source);
}
}
void CollectionDef_AnyList::MergeFrom(const CollectionDef_AnyList& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.CollectionDef.AnyList)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
value_.MergeFrom(from.value_);
}
void CollectionDef_AnyList::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.CollectionDef.AnyList)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CollectionDef_AnyList::CopyFrom(const CollectionDef_AnyList& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.CollectionDef.AnyList)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CollectionDef_AnyList::IsInitialized() const {
return true;
}
void CollectionDef_AnyList::Swap(CollectionDef_AnyList* other) {
if (other == this) return;
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
InternalSwap(other);
} else {
CollectionDef_AnyList* temp = New(GetArenaNoVirtual());
temp->MergeFrom(*other);
other->CopyFrom(*this);
InternalSwap(temp);
if (GetArenaNoVirtual() == NULL) {
delete temp;
}
}
}
void CollectionDef_AnyList::UnsafeArenaSwap(CollectionDef_AnyList* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void CollectionDef_AnyList::InternalSwap(CollectionDef_AnyList* other) {
value_.UnsafeArenaSwap(&other->value_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata CollectionDef_AnyList::GetMetadata() const {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[8];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// CollectionDef_AnyList
// repeated .google.protobuf.Any value = 1;
int CollectionDef_AnyList::value_size() const {
return value_.size();
}
void CollectionDef_AnyList::clear_value() {
value_.Clear();
}
const ::google::protobuf::Any& CollectionDef_AnyList::value(int index) const {
// @@protoc_insertion_point(field_get:tensorflow.CollectionDef.AnyList.value)
return value_.Get(index);
}
::google::protobuf::Any* CollectionDef_AnyList::mutable_value(int index) {
// @@protoc_insertion_point(field_mutable:tensorflow.CollectionDef.AnyList.value)
return value_.Mutable(index);
}
::google::protobuf::Any* CollectionDef_AnyList::add_value() {
// @@protoc_insertion_point(field_add:tensorflow.CollectionDef.AnyList.value)
return value_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::Any >*
CollectionDef_AnyList::mutable_value() {
// @@protoc_insertion_point(field_mutable_list:tensorflow.CollectionDef.AnyList.value)
return &value_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Any >&
CollectionDef_AnyList::value() const {
// @@protoc_insertion_point(field_list:tensorflow.CollectionDef.AnyList.value)
return value_;
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int CollectionDef::kNodeListFieldNumber;
const int CollectionDef::kBytesListFieldNumber;
const int CollectionDef::kInt64ListFieldNumber;
const int CollectionDef::kFloatListFieldNumber;
const int CollectionDef::kAnyListFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
CollectionDef::CollectionDef()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:tensorflow.CollectionDef)
}
CollectionDef::CollectionDef(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena) {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
#endif // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:tensorflow.CollectionDef)
}
CollectionDef::CollectionDef(const CollectionDef& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
clear_has_kind();
switch (from.kind_case()) {
case kNodeList: {
mutable_node_list()->::tensorflow::CollectionDef_NodeList::MergeFrom(from.node_list());
break;
}
case kBytesList: {
mutable_bytes_list()->::tensorflow::CollectionDef_BytesList::MergeFrom(from.bytes_list());
break;
}
case kInt64List: {
mutable_int64_list()->::tensorflow::CollectionDef_Int64List::MergeFrom(from.int64_list());
break;
}
case kFloatList: {
mutable_float_list()->::tensorflow::CollectionDef_FloatList::MergeFrom(from.float_list());
break;
}
case kAnyList: {
mutable_any_list()->::tensorflow::CollectionDef_AnyList::MergeFrom(from.any_list());
break;
}
case KIND_NOT_SET: {
break;
}
}
// @@protoc_insertion_point(copy_constructor:tensorflow.CollectionDef)
}
void CollectionDef::SharedCtor() {
clear_has_kind();
_cached_size_ = 0;
}
CollectionDef::~CollectionDef() {
// @@protoc_insertion_point(destructor:tensorflow.CollectionDef)
SharedDtor();
}
void CollectionDef::SharedDtor() {
::google::protobuf::Arena* arena = GetArenaNoVirtual();
if (arena != NULL) {
return;
}
if (has_kind()) {
clear_kind();
}
}
void CollectionDef::ArenaDtor(void* object) {
CollectionDef* _this = reinterpret_cast< CollectionDef* >(object);
(void)_this;
}
void CollectionDef::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void CollectionDef::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CollectionDef::descriptor() {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[9].descriptor;
}
const CollectionDef& CollectionDef::default_instance() {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
return *internal_default_instance();
}
CollectionDef* CollectionDef::New(::google::protobuf::Arena* arena) const {
return ::google::protobuf::Arena::CreateMessage<CollectionDef>(arena);
}
void CollectionDef::clear_kind() {
// @@protoc_insertion_point(one_of_clear_start:tensorflow.CollectionDef)
switch (kind_case()) {
case kNodeList: {
if (GetArenaNoVirtual() == NULL) {
delete kind_.node_list_;
}
break;
}
case kBytesList: {
if (GetArenaNoVirtual() == NULL) {
delete kind_.bytes_list_;
}
break;
}
case kInt64List: {
if (GetArenaNoVirtual() == NULL) {
delete kind_.int64_list_;
}
break;
}
case kFloatList: {
if (GetArenaNoVirtual() == NULL) {
delete kind_.float_list_;
}
break;
}
case kAnyList: {
if (GetArenaNoVirtual() == NULL) {
delete kind_.any_list_;
}
break;
}
case KIND_NOT_SET: {
break;
}
}
_oneof_case_[0] = KIND_NOT_SET;
}
void CollectionDef::Clear() {
// @@protoc_insertion_point(message_clear_start:tensorflow.CollectionDef)
clear_kind();
}
bool CollectionDef::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:tensorflow.CollectionDef)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// .tensorflow.CollectionDef.NodeList node_list = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_node_list()));
} else {
goto handle_unusual;
}
break;
}
// .tensorflow.CollectionDef.BytesList bytes_list = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_bytes_list()));
} else {
goto handle_unusual;
}
break;
}
// .tensorflow.CollectionDef.Int64List int64_list = 3;
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_int64_list()));
} else {
goto handle_unusual;
}
break;
}
// .tensorflow.CollectionDef.FloatList float_list = 4;
case 4: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(34u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_float_list()));
} else {
goto handle_unusual;
}
break;
}
// .tensorflow.CollectionDef.AnyList any_list = 5;
case 5: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(42u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_any_list()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:tensorflow.CollectionDef)
return true;
failure:
// @@protoc_insertion_point(parse_failure:tensorflow.CollectionDef)
return false;
#undef DO_
}
void CollectionDef::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:tensorflow.CollectionDef)
// .tensorflow.CollectionDef.NodeList node_list = 1;
if (has_node_list()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *kind_.node_list_, output);
}
// .tensorflow.CollectionDef.BytesList bytes_list = 2;
if (has_bytes_list()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *kind_.bytes_list_, output);
}
// .tensorflow.CollectionDef.Int64List int64_list = 3;
if (has_int64_list()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, *kind_.int64_list_, output);
}
// .tensorflow.CollectionDef.FloatList float_list = 4;
if (has_float_list()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, *kind_.float_list_, output);
}
// .tensorflow.CollectionDef.AnyList any_list = 5;
if (has_any_list()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
5, *kind_.any_list_, output);
}
// @@protoc_insertion_point(serialize_end:tensorflow.CollectionDef)
}
::google::protobuf::uint8* CollectionDef::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:tensorflow.CollectionDef)
// .tensorflow.CollectionDef.NodeList node_list = 1;
if (has_node_list()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *kind_.node_list_, false, target);
}
// .tensorflow.CollectionDef.BytesList bytes_list = 2;
if (has_bytes_list()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *kind_.bytes_list_, false, target);
}
// .tensorflow.CollectionDef.Int64List int64_list = 3;
if (has_int64_list()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
3, *kind_.int64_list_, false, target);
}
// .tensorflow.CollectionDef.FloatList float_list = 4;
if (has_float_list()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
4, *kind_.float_list_, false, target);
}
// .tensorflow.CollectionDef.AnyList any_list = 5;
if (has_any_list()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
5, *kind_.any_list_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:tensorflow.CollectionDef)
return target;
}
size_t CollectionDef::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.CollectionDef)
size_t total_size = 0;
switch (kind_case()) {
// .tensorflow.CollectionDef.NodeList node_list = 1;
case kNodeList: {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*kind_.node_list_);
break;
}
// .tensorflow.CollectionDef.BytesList bytes_list = 2;
case kBytesList: {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*kind_.bytes_list_);
break;
}
// .tensorflow.CollectionDef.Int64List int64_list = 3;
case kInt64List: {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*kind_.int64_list_);
break;
}
// .tensorflow.CollectionDef.FloatList float_list = 4;
case kFloatList: {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*kind_.float_list_);
break;
}
// .tensorflow.CollectionDef.AnyList any_list = 5;
case kAnyList: {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*kind_.any_list_);
break;
}
case KIND_NOT_SET: {
break;
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CollectionDef::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.CollectionDef)
GOOGLE_DCHECK_NE(&from, this);
const CollectionDef* source =
::google::protobuf::internal::DynamicCastToGenerated<const CollectionDef>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.CollectionDef)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.CollectionDef)
MergeFrom(*source);
}
}
void CollectionDef::MergeFrom(const CollectionDef& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.CollectionDef)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
switch (from.kind_case()) {
case kNodeList: {
mutable_node_list()->::tensorflow::CollectionDef_NodeList::MergeFrom(from.node_list());
break;
}
case kBytesList: {
mutable_bytes_list()->::tensorflow::CollectionDef_BytesList::MergeFrom(from.bytes_list());
break;
}
case kInt64List: {
mutable_int64_list()->::tensorflow::CollectionDef_Int64List::MergeFrom(from.int64_list());
break;
}
case kFloatList: {
mutable_float_list()->::tensorflow::CollectionDef_FloatList::MergeFrom(from.float_list());
break;
}
case kAnyList: {
mutable_any_list()->::tensorflow::CollectionDef_AnyList::MergeFrom(from.any_list());
break;
}
case KIND_NOT_SET: {
break;
}
}
}
void CollectionDef::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.CollectionDef)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CollectionDef::CopyFrom(const CollectionDef& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.CollectionDef)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CollectionDef::IsInitialized() const {
return true;
}
void CollectionDef::Swap(CollectionDef* other) {
if (other == this) return;
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
InternalSwap(other);
} else {
CollectionDef* temp = New(GetArenaNoVirtual());
temp->MergeFrom(*other);
other->CopyFrom(*this);
InternalSwap(temp);
if (GetArenaNoVirtual() == NULL) {
delete temp;
}
}
}
void CollectionDef::UnsafeArenaSwap(CollectionDef* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void CollectionDef::InternalSwap(CollectionDef* other) {
std::swap(kind_, other->kind_);
std::swap(_oneof_case_[0], other->_oneof_case_[0]);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata CollectionDef::GetMetadata() const {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[9];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// CollectionDef
// .tensorflow.CollectionDef.NodeList node_list = 1;
bool CollectionDef::has_node_list() const {
return kind_case() == kNodeList;
}
void CollectionDef::set_has_node_list() {
_oneof_case_[0] = kNodeList;
}
void CollectionDef::clear_node_list() {
if (has_node_list()) {
if (GetArenaNoVirtual() == NULL) {
delete kind_.node_list_;
}
clear_has_kind();
}
}
const ::tensorflow::CollectionDef_NodeList& CollectionDef::node_list() const {
// @@protoc_insertion_point(field_get:tensorflow.CollectionDef.node_list)
return has_node_list()
? *kind_.node_list_
: ::tensorflow::CollectionDef_NodeList::default_instance();
}
::tensorflow::CollectionDef_NodeList* CollectionDef::mutable_node_list() {
if (!has_node_list()) {
clear_kind();
set_has_node_list();
kind_.node_list_ =
::google::protobuf::Arena::CreateMessage< ::tensorflow::CollectionDef_NodeList >(
GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:tensorflow.CollectionDef.node_list)
return kind_.node_list_;
}
::tensorflow::CollectionDef_NodeList* CollectionDef::release_node_list() {
// @@protoc_insertion_point(field_release:tensorflow.CollectionDef.node_list)
if (has_node_list()) {
clear_has_kind();
if (GetArenaNoVirtual() != NULL) {
::tensorflow::CollectionDef_NodeList* temp = new ::tensorflow::CollectionDef_NodeList(*kind_.node_list_);
kind_.node_list_ = NULL;
return temp;
} else {
::tensorflow::CollectionDef_NodeList* temp = kind_.node_list_;
kind_.node_list_ = NULL;
return temp;
}
} else {
return NULL;
}
}
void CollectionDef::set_allocated_node_list(::tensorflow::CollectionDef_NodeList* node_list) {
clear_kind();
if (node_list) {
if (GetArenaNoVirtual() != NULL &&
::google::protobuf::Arena::GetArena(node_list) == NULL) {
GetArenaNoVirtual()->Own(node_list);
} else if (GetArenaNoVirtual() !=
::google::protobuf::Arena::GetArena(node_list)) {
::tensorflow::CollectionDef_NodeList* new_node_list =
::google::protobuf::Arena::CreateMessage< ::tensorflow::CollectionDef_NodeList >(
GetArenaNoVirtual());
new_node_list->CopyFrom(*node_list);
node_list = new_node_list;
}
set_has_node_list();
kind_.node_list_ = node_list;
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.CollectionDef.node_list)
}
::tensorflow::CollectionDef_NodeList* CollectionDef::unsafe_arena_release_node_list() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.CollectionDef.node_list)
if (has_node_list()) {
clear_has_kind();
::tensorflow::CollectionDef_NodeList* temp = kind_.node_list_;
kind_.node_list_ = NULL;
return temp;
} else {
return NULL;
}
}
void CollectionDef::unsafe_arena_set_allocated_node_list(::tensorflow::CollectionDef_NodeList* node_list) {
clear_kind();
if (node_list) {
set_has_node_list();
kind_.node_list_ = node_list;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.CollectionDef.node_list)
}
// .tensorflow.CollectionDef.BytesList bytes_list = 2;
bool CollectionDef::has_bytes_list() const {
return kind_case() == kBytesList;
}
void CollectionDef::set_has_bytes_list() {
_oneof_case_[0] = kBytesList;
}
void CollectionDef::clear_bytes_list() {
if (has_bytes_list()) {
if (GetArenaNoVirtual() == NULL) {
delete kind_.bytes_list_;
}
clear_has_kind();
}
}
const ::tensorflow::CollectionDef_BytesList& CollectionDef::bytes_list() const {
// @@protoc_insertion_point(field_get:tensorflow.CollectionDef.bytes_list)
return has_bytes_list()
? *kind_.bytes_list_
: ::tensorflow::CollectionDef_BytesList::default_instance();
}
::tensorflow::CollectionDef_BytesList* CollectionDef::mutable_bytes_list() {
if (!has_bytes_list()) {
clear_kind();
set_has_bytes_list();
kind_.bytes_list_ =
::google::protobuf::Arena::CreateMessage< ::tensorflow::CollectionDef_BytesList >(
GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:tensorflow.CollectionDef.bytes_list)
return kind_.bytes_list_;
}
::tensorflow::CollectionDef_BytesList* CollectionDef::release_bytes_list() {
// @@protoc_insertion_point(field_release:tensorflow.CollectionDef.bytes_list)
if (has_bytes_list()) {
clear_has_kind();
if (GetArenaNoVirtual() != NULL) {
::tensorflow::CollectionDef_BytesList* temp = new ::tensorflow::CollectionDef_BytesList(*kind_.bytes_list_);
kind_.bytes_list_ = NULL;
return temp;
} else {
::tensorflow::CollectionDef_BytesList* temp = kind_.bytes_list_;
kind_.bytes_list_ = NULL;
return temp;
}
} else {
return NULL;
}
}
void CollectionDef::set_allocated_bytes_list(::tensorflow::CollectionDef_BytesList* bytes_list) {
clear_kind();
if (bytes_list) {
if (GetArenaNoVirtual() != NULL &&
::google::protobuf::Arena::GetArena(bytes_list) == NULL) {
GetArenaNoVirtual()->Own(bytes_list);
} else if (GetArenaNoVirtual() !=
::google::protobuf::Arena::GetArena(bytes_list)) {
::tensorflow::CollectionDef_BytesList* new_bytes_list =
::google::protobuf::Arena::CreateMessage< ::tensorflow::CollectionDef_BytesList >(
GetArenaNoVirtual());
new_bytes_list->CopyFrom(*bytes_list);
bytes_list = new_bytes_list;
}
set_has_bytes_list();
kind_.bytes_list_ = bytes_list;
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.CollectionDef.bytes_list)
}
::tensorflow::CollectionDef_BytesList* CollectionDef::unsafe_arena_release_bytes_list() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.CollectionDef.bytes_list)
if (has_bytes_list()) {
clear_has_kind();
::tensorflow::CollectionDef_BytesList* temp = kind_.bytes_list_;
kind_.bytes_list_ = NULL;
return temp;
} else {
return NULL;
}
}
void CollectionDef::unsafe_arena_set_allocated_bytes_list(::tensorflow::CollectionDef_BytesList* bytes_list) {
clear_kind();
if (bytes_list) {
set_has_bytes_list();
kind_.bytes_list_ = bytes_list;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.CollectionDef.bytes_list)
}
// .tensorflow.CollectionDef.Int64List int64_list = 3;
bool CollectionDef::has_int64_list() const {
return kind_case() == kInt64List;
}
void CollectionDef::set_has_int64_list() {
_oneof_case_[0] = kInt64List;
}
void CollectionDef::clear_int64_list() {
if (has_int64_list()) {
if (GetArenaNoVirtual() == NULL) {
delete kind_.int64_list_;
}
clear_has_kind();
}
}
const ::tensorflow::CollectionDef_Int64List& CollectionDef::int64_list() const {
// @@protoc_insertion_point(field_get:tensorflow.CollectionDef.int64_list)
return has_int64_list()
? *kind_.int64_list_
: ::tensorflow::CollectionDef_Int64List::default_instance();
}
::tensorflow::CollectionDef_Int64List* CollectionDef::mutable_int64_list() {
if (!has_int64_list()) {
clear_kind();
set_has_int64_list();
kind_.int64_list_ =
::google::protobuf::Arena::CreateMessage< ::tensorflow::CollectionDef_Int64List >(
GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:tensorflow.CollectionDef.int64_list)
return kind_.int64_list_;
}
::tensorflow::CollectionDef_Int64List* CollectionDef::release_int64_list() {
// @@protoc_insertion_point(field_release:tensorflow.CollectionDef.int64_list)
if (has_int64_list()) {
clear_has_kind();
if (GetArenaNoVirtual() != NULL) {
::tensorflow::CollectionDef_Int64List* temp = new ::tensorflow::CollectionDef_Int64List(*kind_.int64_list_);
kind_.int64_list_ = NULL;
return temp;
} else {
::tensorflow::CollectionDef_Int64List* temp = kind_.int64_list_;
kind_.int64_list_ = NULL;
return temp;
}
} else {
return NULL;
}
}
void CollectionDef::set_allocated_int64_list(::tensorflow::CollectionDef_Int64List* int64_list) {
clear_kind();
if (int64_list) {
if (GetArenaNoVirtual() != NULL &&
::google::protobuf::Arena::GetArena(int64_list) == NULL) {
GetArenaNoVirtual()->Own(int64_list);
} else if (GetArenaNoVirtual() !=
::google::protobuf::Arena::GetArena(int64_list)) {
::tensorflow::CollectionDef_Int64List* new_int64_list =
::google::protobuf::Arena::CreateMessage< ::tensorflow::CollectionDef_Int64List >(
GetArenaNoVirtual());
new_int64_list->CopyFrom(*int64_list);
int64_list = new_int64_list;
}
set_has_int64_list();
kind_.int64_list_ = int64_list;
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.CollectionDef.int64_list)
}
::tensorflow::CollectionDef_Int64List* CollectionDef::unsafe_arena_release_int64_list() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.CollectionDef.int64_list)
if (has_int64_list()) {
clear_has_kind();
::tensorflow::CollectionDef_Int64List* temp = kind_.int64_list_;
kind_.int64_list_ = NULL;
return temp;
} else {
return NULL;
}
}
void CollectionDef::unsafe_arena_set_allocated_int64_list(::tensorflow::CollectionDef_Int64List* int64_list) {
clear_kind();
if (int64_list) {
set_has_int64_list();
kind_.int64_list_ = int64_list;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.CollectionDef.int64_list)
}
// .tensorflow.CollectionDef.FloatList float_list = 4;
bool CollectionDef::has_float_list() const {
return kind_case() == kFloatList;
}
void CollectionDef::set_has_float_list() {
_oneof_case_[0] = kFloatList;
}
void CollectionDef::clear_float_list() {
if (has_float_list()) {
if (GetArenaNoVirtual() == NULL) {
delete kind_.float_list_;
}
clear_has_kind();
}
}
const ::tensorflow::CollectionDef_FloatList& CollectionDef::float_list() const {
// @@protoc_insertion_point(field_get:tensorflow.CollectionDef.float_list)
return has_float_list()
? *kind_.float_list_
: ::tensorflow::CollectionDef_FloatList::default_instance();
}
::tensorflow::CollectionDef_FloatList* CollectionDef::mutable_float_list() {
if (!has_float_list()) {
clear_kind();
set_has_float_list();
kind_.float_list_ =
::google::protobuf::Arena::CreateMessage< ::tensorflow::CollectionDef_FloatList >(
GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:tensorflow.CollectionDef.float_list)
return kind_.float_list_;
}
::tensorflow::CollectionDef_FloatList* CollectionDef::release_float_list() {
// @@protoc_insertion_point(field_release:tensorflow.CollectionDef.float_list)
if (has_float_list()) {
clear_has_kind();
if (GetArenaNoVirtual() != NULL) {
::tensorflow::CollectionDef_FloatList* temp = new ::tensorflow::CollectionDef_FloatList(*kind_.float_list_);
kind_.float_list_ = NULL;
return temp;
} else {
::tensorflow::CollectionDef_FloatList* temp = kind_.float_list_;
kind_.float_list_ = NULL;
return temp;
}
} else {
return NULL;
}
}
void CollectionDef::set_allocated_float_list(::tensorflow::CollectionDef_FloatList* float_list) {
clear_kind();
if (float_list) {
if (GetArenaNoVirtual() != NULL &&
::google::protobuf::Arena::GetArena(float_list) == NULL) {
GetArenaNoVirtual()->Own(float_list);
} else if (GetArenaNoVirtual() !=
::google::protobuf::Arena::GetArena(float_list)) {
::tensorflow::CollectionDef_FloatList* new_float_list =
::google::protobuf::Arena::CreateMessage< ::tensorflow::CollectionDef_FloatList >(
GetArenaNoVirtual());
new_float_list->CopyFrom(*float_list);
float_list = new_float_list;
}
set_has_float_list();
kind_.float_list_ = float_list;
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.CollectionDef.float_list)
}
::tensorflow::CollectionDef_FloatList* CollectionDef::unsafe_arena_release_float_list() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.CollectionDef.float_list)
if (has_float_list()) {
clear_has_kind();
::tensorflow::CollectionDef_FloatList* temp = kind_.float_list_;
kind_.float_list_ = NULL;
return temp;
} else {
return NULL;
}
}
void CollectionDef::unsafe_arena_set_allocated_float_list(::tensorflow::CollectionDef_FloatList* float_list) {
clear_kind();
if (float_list) {
set_has_float_list();
kind_.float_list_ = float_list;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.CollectionDef.float_list)
}
// .tensorflow.CollectionDef.AnyList any_list = 5;
bool CollectionDef::has_any_list() const {
return kind_case() == kAnyList;
}
void CollectionDef::set_has_any_list() {
_oneof_case_[0] = kAnyList;
}
void CollectionDef::clear_any_list() {
if (has_any_list()) {
if (GetArenaNoVirtual() == NULL) {
delete kind_.any_list_;
}
clear_has_kind();
}
}
const ::tensorflow::CollectionDef_AnyList& CollectionDef::any_list() const {
// @@protoc_insertion_point(field_get:tensorflow.CollectionDef.any_list)
return has_any_list()
? *kind_.any_list_
: ::tensorflow::CollectionDef_AnyList::default_instance();
}
::tensorflow::CollectionDef_AnyList* CollectionDef::mutable_any_list() {
if (!has_any_list()) {
clear_kind();
set_has_any_list();
kind_.any_list_ =
::google::protobuf::Arena::CreateMessage< ::tensorflow::CollectionDef_AnyList >(
GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:tensorflow.CollectionDef.any_list)
return kind_.any_list_;
}
::tensorflow::CollectionDef_AnyList* CollectionDef::release_any_list() {
// @@protoc_insertion_point(field_release:tensorflow.CollectionDef.any_list)
if (has_any_list()) {
clear_has_kind();
if (GetArenaNoVirtual() != NULL) {
::tensorflow::CollectionDef_AnyList* temp = new ::tensorflow::CollectionDef_AnyList(*kind_.any_list_);
kind_.any_list_ = NULL;
return temp;
} else {
::tensorflow::CollectionDef_AnyList* temp = kind_.any_list_;
kind_.any_list_ = NULL;
return temp;
}
} else {
return NULL;
}
}
void CollectionDef::set_allocated_any_list(::tensorflow::CollectionDef_AnyList* any_list) {
clear_kind();
if (any_list) {
if (GetArenaNoVirtual() != NULL &&
::google::protobuf::Arena::GetArena(any_list) == NULL) {
GetArenaNoVirtual()->Own(any_list);
} else if (GetArenaNoVirtual() !=
::google::protobuf::Arena::GetArena(any_list)) {
::tensorflow::CollectionDef_AnyList* new_any_list =
::google::protobuf::Arena::CreateMessage< ::tensorflow::CollectionDef_AnyList >(
GetArenaNoVirtual());
new_any_list->CopyFrom(*any_list);
any_list = new_any_list;
}
set_has_any_list();
kind_.any_list_ = any_list;
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.CollectionDef.any_list)
}
::tensorflow::CollectionDef_AnyList* CollectionDef::unsafe_arena_release_any_list() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.CollectionDef.any_list)
if (has_any_list()) {
clear_has_kind();
::tensorflow::CollectionDef_AnyList* temp = kind_.any_list_;
kind_.any_list_ = NULL;
return temp;
} else {
return NULL;
}
}
void CollectionDef::unsafe_arena_set_allocated_any_list(::tensorflow::CollectionDef_AnyList* any_list) {
clear_kind();
if (any_list) {
set_has_any_list();
kind_.any_list_ = any_list;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.CollectionDef.any_list)
}
bool CollectionDef::has_kind() const {
return kind_case() != KIND_NOT_SET;
}
void CollectionDef::clear_has_kind() {
_oneof_case_[0] = KIND_NOT_SET;
}
CollectionDef::KindCase CollectionDef::kind_case() const {
return CollectionDef::KindCase(_oneof_case_[0]);
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
void TensorInfo::_slow_mutable_tensor_shape() {
tensor_shape_ = ::google::protobuf::Arena::CreateMessage< ::tensorflow::TensorShapeProto >(
GetArenaNoVirtual());
}
::tensorflow::TensorShapeProto* TensorInfo::_slow_release_tensor_shape() {
if (tensor_shape_ == NULL) {
return NULL;
} else {
::tensorflow::TensorShapeProto* temp = new ::tensorflow::TensorShapeProto(*tensor_shape_);
tensor_shape_ = NULL;
return temp;
}
}
::tensorflow::TensorShapeProto* TensorInfo::unsafe_arena_release_tensor_shape() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.TensorInfo.tensor_shape)
::tensorflow::TensorShapeProto* temp = tensor_shape_;
tensor_shape_ = NULL;
return temp;
}
void TensorInfo::_slow_set_allocated_tensor_shape(
::google::protobuf::Arena* message_arena, ::tensorflow::TensorShapeProto** tensor_shape) {
if (message_arena != NULL &&
::google::protobuf::Arena::GetArena(*tensor_shape) == NULL) {
message_arena->Own(*tensor_shape);
} else if (message_arena !=
::google::protobuf::Arena::GetArena(*tensor_shape)) {
::tensorflow::TensorShapeProto* new_tensor_shape =
::google::protobuf::Arena::CreateMessage< ::tensorflow::TensorShapeProto >(
message_arena);
new_tensor_shape->CopyFrom(**tensor_shape);
*tensor_shape = new_tensor_shape;
}
}
void TensorInfo::unsafe_arena_set_allocated_tensor_shape(
::tensorflow::TensorShapeProto* tensor_shape) {
if (GetArenaNoVirtual() == NULL) {
delete tensor_shape_;
}
tensor_shape_ = tensor_shape;
if (tensor_shape) {
} else {
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.TensorInfo.tensor_shape)
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int TensorInfo::kNameFieldNumber;
const int TensorInfo::kDtypeFieldNumber;
const int TensorInfo::kTensorShapeFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
TensorInfo::TensorInfo()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:tensorflow.TensorInfo)
}
TensorInfo::TensorInfo(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena) {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
#endif // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:tensorflow.TensorInfo)
}
TensorInfo::TensorInfo(const TensorInfo& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.name().size() > 0) {
name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name(),
GetArenaNoVirtual());
}
if (from.has_tensor_shape()) {
tensor_shape_ = new ::tensorflow::TensorShapeProto(*from.tensor_shape_);
} else {
tensor_shape_ = NULL;
}
dtype_ = from.dtype_;
// @@protoc_insertion_point(copy_constructor:tensorflow.TensorInfo)
}
void TensorInfo::SharedCtor() {
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(&tensor_shape_, 0, reinterpret_cast<char*>(&dtype_) -
reinterpret_cast<char*>(&tensor_shape_) + sizeof(dtype_));
_cached_size_ = 0;
}
TensorInfo::~TensorInfo() {
// @@protoc_insertion_point(destructor:tensorflow.TensorInfo)
SharedDtor();
}
void TensorInfo::SharedDtor() {
::google::protobuf::Arena* arena = GetArenaNoVirtual();
if (arena != NULL) {
return;
}
name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
if (this != internal_default_instance()) {
delete tensor_shape_;
}
}
void TensorInfo::ArenaDtor(void* object) {
TensorInfo* _this = reinterpret_cast< TensorInfo* >(object);
(void)_this;
}
void TensorInfo::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void TensorInfo::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* TensorInfo::descriptor() {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[10].descriptor;
}
const TensorInfo& TensorInfo::default_instance() {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
return *internal_default_instance();
}
TensorInfo* TensorInfo::New(::google::protobuf::Arena* arena) const {
return ::google::protobuf::Arena::CreateMessage<TensorInfo>(arena);
}
void TensorInfo::Clear() {
// @@protoc_insertion_point(message_clear_start:tensorflow.TensorInfo)
name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
if (GetArenaNoVirtual() == NULL && tensor_shape_ != NULL) {
delete tensor_shape_;
}
tensor_shape_ = NULL;
dtype_ = 0;
}
bool TensorInfo::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:tensorflow.TensorInfo)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// string name = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.TensorInfo.name"));
} else {
goto handle_unusual;
}
break;
}
// .tensorflow.DataType dtype = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(16u)) {
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
set_dtype(static_cast< ::tensorflow::DataType >(value));
} else {
goto handle_unusual;
}
break;
}
// .tensorflow.TensorShapeProto tensor_shape = 3;
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_tensor_shape()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:tensorflow.TensorInfo)
return true;
failure:
// @@protoc_insertion_point(parse_failure:tensorflow.TensorInfo)
return false;
#undef DO_
}
void TensorInfo::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:tensorflow.TensorInfo)
// string name = 1;
if (this->name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.TensorInfo.name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->name(), output);
}
// .tensorflow.DataType dtype = 2;
if (this->dtype() != 0) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
2, this->dtype(), output);
}
// .tensorflow.TensorShapeProto tensor_shape = 3;
if (this->has_tensor_shape()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, *this->tensor_shape_, output);
}
// @@protoc_insertion_point(serialize_end:tensorflow.TensorInfo)
}
::google::protobuf::uint8* TensorInfo::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:tensorflow.TensorInfo)
// string name = 1;
if (this->name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.TensorInfo.name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->name(), target);
}
// .tensorflow.DataType dtype = 2;
if (this->dtype() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
2, this->dtype(), target);
}
// .tensorflow.TensorShapeProto tensor_shape = 3;
if (this->has_tensor_shape()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
3, *this->tensor_shape_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:tensorflow.TensorInfo)
return target;
}
size_t TensorInfo::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.TensorInfo)
size_t total_size = 0;
// string name = 1;
if (this->name().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->name());
}
// .tensorflow.TensorShapeProto tensor_shape = 3;
if (this->has_tensor_shape()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->tensor_shape_);
}
// .tensorflow.DataType dtype = 2;
if (this->dtype() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->dtype());
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void TensorInfo::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.TensorInfo)
GOOGLE_DCHECK_NE(&from, this);
const TensorInfo* source =
::google::protobuf::internal::DynamicCastToGenerated<const TensorInfo>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.TensorInfo)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.TensorInfo)
MergeFrom(*source);
}
}
void TensorInfo::MergeFrom(const TensorInfo& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.TensorInfo)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from.name().size() > 0) {
set_name(from.name());
}
if (from.has_tensor_shape()) {
mutable_tensor_shape()->::tensorflow::TensorShapeProto::MergeFrom(from.tensor_shape());
}
if (from.dtype() != 0) {
set_dtype(from.dtype());
}
}
void TensorInfo::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.TensorInfo)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void TensorInfo::CopyFrom(const TensorInfo& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.TensorInfo)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool TensorInfo::IsInitialized() const {
return true;
}
void TensorInfo::Swap(TensorInfo* other) {
if (other == this) return;
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
InternalSwap(other);
} else {
TensorInfo* temp = New(GetArenaNoVirtual());
temp->MergeFrom(*other);
other->CopyFrom(*this);
InternalSwap(temp);
if (GetArenaNoVirtual() == NULL) {
delete temp;
}
}
}
void TensorInfo::UnsafeArenaSwap(TensorInfo* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void TensorInfo::InternalSwap(TensorInfo* other) {
name_.Swap(&other->name_);
std::swap(tensor_shape_, other->tensor_shape_);
std::swap(dtype_, other->dtype_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata TensorInfo::GetMetadata() const {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[10];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// TensorInfo
// string name = 1;
void TensorInfo::clear_name() {
name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
const ::std::string& TensorInfo::name() const {
// @@protoc_insertion_point(field_get:tensorflow.TensorInfo.name)
return name_.Get();
}
void TensorInfo::set_name(const ::std::string& value) {
name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
// @@protoc_insertion_point(field_set:tensorflow.TensorInfo.name)
}
void TensorInfo::set_name(const char* value) {
name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_char:tensorflow.TensorInfo.name)
}
void TensorInfo::set_name(const char* value,
size_t size) {
name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:tensorflow.TensorInfo.name)
}
::std::string* TensorInfo::mutable_name() {
// @@protoc_insertion_point(field_mutable:tensorflow.TensorInfo.name)
return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* TensorInfo::release_name() {
// @@protoc_insertion_point(field_release:tensorflow.TensorInfo.name)
return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* TensorInfo::unsafe_arena_release_name() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.TensorInfo.name)
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
}
void TensorInfo::set_allocated_name(::std::string* name) {
if (name != NULL) {
} else {
}
name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name,
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:tensorflow.TensorInfo.name)
}
void TensorInfo::unsafe_arena_set_allocated_name(
::std::string* name) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
if (name != NULL) {
} else {
}
name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
name, GetArenaNoVirtual());
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.TensorInfo.name)
}
// .tensorflow.DataType dtype = 2;
void TensorInfo::clear_dtype() {
dtype_ = 0;
}
::tensorflow::DataType TensorInfo::dtype() const {
// @@protoc_insertion_point(field_get:tensorflow.TensorInfo.dtype)
return static_cast< ::tensorflow::DataType >(dtype_);
}
void TensorInfo::set_dtype(::tensorflow::DataType value) {
dtype_ = value;
// @@protoc_insertion_point(field_set:tensorflow.TensorInfo.dtype)
}
// .tensorflow.TensorShapeProto tensor_shape = 3;
bool TensorInfo::has_tensor_shape() const {
return this != internal_default_instance() && tensor_shape_ != NULL;
}
void TensorInfo::clear_tensor_shape() {
if (GetArenaNoVirtual() == NULL && tensor_shape_ != NULL) delete tensor_shape_;
tensor_shape_ = NULL;
}
const ::tensorflow::TensorShapeProto& TensorInfo::tensor_shape() const {
// @@protoc_insertion_point(field_get:tensorflow.TensorInfo.tensor_shape)
return tensor_shape_ != NULL ? *tensor_shape_
: *::tensorflow::TensorShapeProto::internal_default_instance();
}
::tensorflow::TensorShapeProto* TensorInfo::mutable_tensor_shape() {
if (tensor_shape_ == NULL) {
_slow_mutable_tensor_shape();
}
// @@protoc_insertion_point(field_mutable:tensorflow.TensorInfo.tensor_shape)
return tensor_shape_;
}
::tensorflow::TensorShapeProto* TensorInfo::release_tensor_shape() {
// @@protoc_insertion_point(field_release:tensorflow.TensorInfo.tensor_shape)
if (GetArenaNoVirtual() != NULL) {
return _slow_release_tensor_shape();
} else {
::tensorflow::TensorShapeProto* temp = tensor_shape_;
tensor_shape_ = NULL;
return temp;
}
}
void TensorInfo::set_allocated_tensor_shape(::tensorflow::TensorShapeProto* tensor_shape) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == NULL) {
delete tensor_shape_;
}
if (tensor_shape != NULL) {
_slow_set_allocated_tensor_shape(message_arena, &tensor_shape);
}
tensor_shape_ = tensor_shape;
if (tensor_shape) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.TensorInfo.tensor_shape)
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if PROTOBUF_INLINE_NOT_IN_HEADERS
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if PROTOBUF_INLINE_NOT_IN_HEADERS
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int SignatureDef::kInputsFieldNumber;
const int SignatureDef::kOutputsFieldNumber;
const int SignatureDef::kMethodNameFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
SignatureDef::SignatureDef()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:tensorflow.SignatureDef)
}
SignatureDef::SignatureDef(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena),
inputs_(arena),
outputs_(arena) {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
#endif // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:tensorflow.SignatureDef)
}
SignatureDef::SignatureDef(const SignatureDef& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
const ::google::protobuf::Descriptor*& SignatureDef_InputsEntry_descriptor = protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[11].descriptor;
const ::google::protobuf::Descriptor*& SignatureDef_OutputsEntry_descriptor = protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[12].descriptor;
inputs_.SetAssignDescriptorCallback(
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce);
inputs_.SetEntryDescriptor(
&SignatureDef_InputsEntry_descriptor);
inputs_.MergeFrom(from.inputs_);
outputs_.SetAssignDescriptorCallback(
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce);
outputs_.SetEntryDescriptor(
&SignatureDef_OutputsEntry_descriptor);
outputs_.MergeFrom(from.outputs_);
method_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.method_name().size() > 0) {
method_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.method_name(),
GetArenaNoVirtual());
}
// @@protoc_insertion_point(copy_constructor:tensorflow.SignatureDef)
}
void SignatureDef::SharedCtor() {
const ::google::protobuf::Descriptor*& SignatureDef_InputsEntry_descriptor = protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[11].descriptor;
const ::google::protobuf::Descriptor*& SignatureDef_OutputsEntry_descriptor = protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[12].descriptor;
inputs_.SetAssignDescriptorCallback(
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce);
inputs_.SetEntryDescriptor(
&SignatureDef_InputsEntry_descriptor);
outputs_.SetAssignDescriptorCallback(
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce);
outputs_.SetEntryDescriptor(
&SignatureDef_OutputsEntry_descriptor);
method_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
_cached_size_ = 0;
}
SignatureDef::~SignatureDef() {
// @@protoc_insertion_point(destructor:tensorflow.SignatureDef)
SharedDtor();
}
void SignatureDef::SharedDtor() {
::google::protobuf::Arena* arena = GetArenaNoVirtual();
if (arena != NULL) {
return;
}
method_name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
}
void SignatureDef::ArenaDtor(void* object) {
SignatureDef* _this = reinterpret_cast< SignatureDef* >(object);
(void)_this;
}
void SignatureDef::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void SignatureDef::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* SignatureDef::descriptor() {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[13].descriptor;
}
const SignatureDef& SignatureDef::default_instance() {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
return *internal_default_instance();
}
SignatureDef* SignatureDef::New(::google::protobuf::Arena* arena) const {
return ::google::protobuf::Arena::CreateMessage<SignatureDef>(arena);
}
void SignatureDef::Clear() {
// @@protoc_insertion_point(message_clear_start:tensorflow.SignatureDef)
inputs_.Clear();
outputs_.Clear();
method_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
bool SignatureDef::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:tensorflow.SignatureDef)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// map<string, .tensorflow.TensorInfo> inputs = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_(input->IncrementRecursionDepth());
SignatureDef_InputsEntry::Parser< ::google::protobuf::internal::MapField<
::std::string, ::tensorflow::TensorInfo,
::google::protobuf::internal::WireFormatLite::TYPE_STRING,
::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
0 >,
::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo > > parser(&inputs_);
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, &parser));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
parser.key().data(), parser.key().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.SignatureDef.InputsEntry.key"));
} else {
goto handle_unusual;
}
input->UnsafeDecrementRecursionDepth();
break;
}
// map<string, .tensorflow.TensorInfo> outputs = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u)) {
DO_(input->IncrementRecursionDepth());
SignatureDef_OutputsEntry::Parser< ::google::protobuf::internal::MapField<
::std::string, ::tensorflow::TensorInfo,
::google::protobuf::internal::WireFormatLite::TYPE_STRING,
::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
0 >,
::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo > > parser(&outputs_);
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, &parser));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
parser.key().data(), parser.key().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.SignatureDef.OutputsEntry.key"));
} else {
goto handle_unusual;
}
input->UnsafeDecrementRecursionDepth();
break;
}
// string method_name = 3;
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_method_name()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->method_name().data(), this->method_name().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.SignatureDef.method_name"));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:tensorflow.SignatureDef)
return true;
failure:
// @@protoc_insertion_point(parse_failure:tensorflow.SignatureDef)
return false;
#undef DO_
}
void SignatureDef::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:tensorflow.SignatureDef)
// map<string, .tensorflow.TensorInfo> inputs = 1;
if (!this->inputs().empty()) {
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_pointer
ConstPtr;
typedef ConstPtr SortItem;
typedef ::google::protobuf::internal::CompareByDerefFirst<SortItem> Less;
struct Utf8Check {
static void Check(ConstPtr p) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
p->first.data(), p->first.length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.SignatureDef.InputsEntry.key");
}
};
if (output->IsSerializationDeterministic() &&
this->inputs().size() > 1) {
::google::protobuf::scoped_array<SortItem> items(
new SortItem[this->inputs().size()]);
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::size_type size_type;
size_type n = 0;
for (::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_iterator
it = this->inputs().begin();
it != this->inputs().end(); ++it, ++n) {
items[n] = SortItem(&*it);
}
::std::sort(&items[0], &items[n], Less());
::google::protobuf::scoped_ptr<SignatureDef_InputsEntry> entry;
for (size_type i = 0; i < n; i++) {
entry.reset(inputs_.NewEntryWrapper(
items[i]->first, items[i]->second));
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *entry, output);
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(items[i]);
}
} else {
::google::protobuf::scoped_ptr<SignatureDef_InputsEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_iterator
it = this->inputs().begin();
it != this->inputs().end(); ++it) {
entry.reset(inputs_.NewEntryWrapper(
it->first, it->second));
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *entry, output);
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(&*it);
}
}
}
// map<string, .tensorflow.TensorInfo> outputs = 2;
if (!this->outputs().empty()) {
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_pointer
ConstPtr;
typedef ConstPtr SortItem;
typedef ::google::protobuf::internal::CompareByDerefFirst<SortItem> Less;
struct Utf8Check {
static void Check(ConstPtr p) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
p->first.data(), p->first.length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.SignatureDef.OutputsEntry.key");
}
};
if (output->IsSerializationDeterministic() &&
this->outputs().size() > 1) {
::google::protobuf::scoped_array<SortItem> items(
new SortItem[this->outputs().size()]);
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::size_type size_type;
size_type n = 0;
for (::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_iterator
it = this->outputs().begin();
it != this->outputs().end(); ++it, ++n) {
items[n] = SortItem(&*it);
}
::std::sort(&items[0], &items[n], Less());
::google::protobuf::scoped_ptr<SignatureDef_OutputsEntry> entry;
for (size_type i = 0; i < n; i++) {
entry.reset(outputs_.NewEntryWrapper(
items[i]->first, items[i]->second));
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *entry, output);
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(items[i]);
}
} else {
::google::protobuf::scoped_ptr<SignatureDef_OutputsEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_iterator
it = this->outputs().begin();
it != this->outputs().end(); ++it) {
entry.reset(outputs_.NewEntryWrapper(
it->first, it->second));
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *entry, output);
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(&*it);
}
}
}
// string method_name = 3;
if (this->method_name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->method_name().data(), this->method_name().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.SignatureDef.method_name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
3, this->method_name(), output);
}
// @@protoc_insertion_point(serialize_end:tensorflow.SignatureDef)
}
::google::protobuf::uint8* SignatureDef::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:tensorflow.SignatureDef)
// map<string, .tensorflow.TensorInfo> inputs = 1;
if (!this->inputs().empty()) {
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_pointer
ConstPtr;
typedef ConstPtr SortItem;
typedef ::google::protobuf::internal::CompareByDerefFirst<SortItem> Less;
struct Utf8Check {
static void Check(ConstPtr p) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
p->first.data(), p->first.length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.SignatureDef.InputsEntry.key");
}
};
if (deterministic &&
this->inputs().size() > 1) {
::google::protobuf::scoped_array<SortItem> items(
new SortItem[this->inputs().size()]);
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::size_type size_type;
size_type n = 0;
for (::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_iterator
it = this->inputs().begin();
it != this->inputs().end(); ++it, ++n) {
items[n] = SortItem(&*it);
}
::std::sort(&items[0], &items[n], Less());
::google::protobuf::scoped_ptr<SignatureDef_InputsEntry> entry;
for (size_type i = 0; i < n; i++) {
entry.reset(inputs_.NewEntryWrapper(
items[i]->first, items[i]->second));
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *entry, deterministic, target);
;
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(items[i]);
}
} else {
::google::protobuf::scoped_ptr<SignatureDef_InputsEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_iterator
it = this->inputs().begin();
it != this->inputs().end(); ++it) {
entry.reset(inputs_.NewEntryWrapper(
it->first, it->second));
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *entry, deterministic, target);
;
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(&*it);
}
}
}
// map<string, .tensorflow.TensorInfo> outputs = 2;
if (!this->outputs().empty()) {
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_pointer
ConstPtr;
typedef ConstPtr SortItem;
typedef ::google::protobuf::internal::CompareByDerefFirst<SortItem> Less;
struct Utf8Check {
static void Check(ConstPtr p) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
p->first.data(), p->first.length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.SignatureDef.OutputsEntry.key");
}
};
if (deterministic &&
this->outputs().size() > 1) {
::google::protobuf::scoped_array<SortItem> items(
new SortItem[this->outputs().size()]);
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::size_type size_type;
size_type n = 0;
for (::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_iterator
it = this->outputs().begin();
it != this->outputs().end(); ++it, ++n) {
items[n] = SortItem(&*it);
}
::std::sort(&items[0], &items[n], Less());
::google::protobuf::scoped_ptr<SignatureDef_OutputsEntry> entry;
for (size_type i = 0; i < n; i++) {
entry.reset(outputs_.NewEntryWrapper(
items[i]->first, items[i]->second));
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *entry, deterministic, target);
;
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(items[i]);
}
} else {
::google::protobuf::scoped_ptr<SignatureDef_OutputsEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_iterator
it = this->outputs().begin();
it != this->outputs().end(); ++it) {
entry.reset(outputs_.NewEntryWrapper(
it->first, it->second));
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *entry, deterministic, target);
;
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(&*it);
}
}
}
// string method_name = 3;
if (this->method_name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->method_name().data(), this->method_name().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.SignatureDef.method_name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
3, this->method_name(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:tensorflow.SignatureDef)
return target;
}
size_t SignatureDef::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.SignatureDef)
size_t total_size = 0;
// map<string, .tensorflow.TensorInfo> inputs = 1;
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->inputs_size());
{
::google::protobuf::scoped_ptr<SignatureDef_InputsEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_iterator
it = this->inputs().begin();
it != this->inputs().end(); ++it) {
if (entry.get() != NULL && entry->GetArena() != NULL) {
entry.release();
}
entry.reset(inputs_.NewEntryWrapper(it->first, it->second));
total_size += ::google::protobuf::internal::WireFormatLite::
MessageSizeNoVirtual(*entry);
}
if (entry.get() != NULL && entry->GetArena() != NULL) {
entry.release();
}
}
// map<string, .tensorflow.TensorInfo> outputs = 2;
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->outputs_size());
{
::google::protobuf::scoped_ptr<SignatureDef_OutputsEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_iterator
it = this->outputs().begin();
it != this->outputs().end(); ++it) {
if (entry.get() != NULL && entry->GetArena() != NULL) {
entry.release();
}
entry.reset(outputs_.NewEntryWrapper(it->first, it->second));
total_size += ::google::protobuf::internal::WireFormatLite::
MessageSizeNoVirtual(*entry);
}
if (entry.get() != NULL && entry->GetArena() != NULL) {
entry.release();
}
}
// string method_name = 3;
if (this->method_name().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->method_name());
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void SignatureDef::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.SignatureDef)
GOOGLE_DCHECK_NE(&from, this);
const SignatureDef* source =
::google::protobuf::internal::DynamicCastToGenerated<const SignatureDef>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.SignatureDef)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.SignatureDef)
MergeFrom(*source);
}
}
void SignatureDef::MergeFrom(const SignatureDef& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.SignatureDef)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
inputs_.MergeFrom(from.inputs_);
outputs_.MergeFrom(from.outputs_);
if (from.method_name().size() > 0) {
set_method_name(from.method_name());
}
}
void SignatureDef::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.SignatureDef)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void SignatureDef::CopyFrom(const SignatureDef& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.SignatureDef)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool SignatureDef::IsInitialized() const {
return true;
}
void SignatureDef::Swap(SignatureDef* other) {
if (other == this) return;
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
InternalSwap(other);
} else {
SignatureDef* temp = New(GetArenaNoVirtual());
temp->MergeFrom(*other);
other->CopyFrom(*this);
InternalSwap(temp);
if (GetArenaNoVirtual() == NULL) {
delete temp;
}
}
}
void SignatureDef::UnsafeArenaSwap(SignatureDef* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void SignatureDef::InternalSwap(SignatureDef* other) {
inputs_.Swap(&other->inputs_);
outputs_.Swap(&other->outputs_);
method_name_.Swap(&other->method_name_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata SignatureDef::GetMetadata() const {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[13];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// SignatureDef
// map<string, .tensorflow.TensorInfo> inputs = 1;
int SignatureDef::inputs_size() const {
return inputs_.size();
}
void SignatureDef::clear_inputs() {
inputs_.Clear();
}
const ::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >&
SignatureDef::inputs() const {
// @@protoc_insertion_point(field_map:tensorflow.SignatureDef.inputs)
return inputs_.GetMap();
}
::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >*
SignatureDef::mutable_inputs() {
// @@protoc_insertion_point(field_mutable_map:tensorflow.SignatureDef.inputs)
return inputs_.MutableMap();
}
// map<string, .tensorflow.TensorInfo> outputs = 2;
int SignatureDef::outputs_size() const {
return outputs_.size();
}
void SignatureDef::clear_outputs() {
outputs_.Clear();
}
const ::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >&
SignatureDef::outputs() const {
// @@protoc_insertion_point(field_map:tensorflow.SignatureDef.outputs)
return outputs_.GetMap();
}
::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >*
SignatureDef::mutable_outputs() {
// @@protoc_insertion_point(field_mutable_map:tensorflow.SignatureDef.outputs)
return outputs_.MutableMap();
}
// string method_name = 3;
void SignatureDef::clear_method_name() {
method_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
const ::std::string& SignatureDef::method_name() const {
// @@protoc_insertion_point(field_get:tensorflow.SignatureDef.method_name)
return method_name_.Get();
}
void SignatureDef::set_method_name(const ::std::string& value) {
method_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
// @@protoc_insertion_point(field_set:tensorflow.SignatureDef.method_name)
}
void SignatureDef::set_method_name(const char* value) {
method_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_char:tensorflow.SignatureDef.method_name)
}
void SignatureDef::set_method_name(const char* value,
size_t size) {
method_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:tensorflow.SignatureDef.method_name)
}
::std::string* SignatureDef::mutable_method_name() {
// @@protoc_insertion_point(field_mutable:tensorflow.SignatureDef.method_name)
return method_name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* SignatureDef::release_method_name() {
// @@protoc_insertion_point(field_release:tensorflow.SignatureDef.method_name)
return method_name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* SignatureDef::unsafe_arena_release_method_name() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.SignatureDef.method_name)
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
return method_name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
}
void SignatureDef::set_allocated_method_name(::std::string* method_name) {
if (method_name != NULL) {
} else {
}
method_name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), method_name,
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:tensorflow.SignatureDef.method_name)
}
void SignatureDef::unsafe_arena_set_allocated_method_name(
::std::string* method_name) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
if (method_name != NULL) {
} else {
}
method_name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
method_name, GetArenaNoVirtual());
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.SignatureDef.method_name)
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
void AssetFileDef::_slow_mutable_tensor_info() {
tensor_info_ = ::google::protobuf::Arena::CreateMessage< ::tensorflow::TensorInfo >(
GetArenaNoVirtual());
}
::tensorflow::TensorInfo* AssetFileDef::_slow_release_tensor_info() {
if (tensor_info_ == NULL) {
return NULL;
} else {
::tensorflow::TensorInfo* temp = new ::tensorflow::TensorInfo(*tensor_info_);
tensor_info_ = NULL;
return temp;
}
}
::tensorflow::TensorInfo* AssetFileDef::unsafe_arena_release_tensor_info() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.AssetFileDef.tensor_info)
::tensorflow::TensorInfo* temp = tensor_info_;
tensor_info_ = NULL;
return temp;
}
void AssetFileDef::_slow_set_allocated_tensor_info(
::google::protobuf::Arena* message_arena, ::tensorflow::TensorInfo** tensor_info) {
if (message_arena != NULL &&
::google::protobuf::Arena::GetArena(*tensor_info) == NULL) {
message_arena->Own(*tensor_info);
} else if (message_arena !=
::google::protobuf::Arena::GetArena(*tensor_info)) {
::tensorflow::TensorInfo* new_tensor_info =
::google::protobuf::Arena::CreateMessage< ::tensorflow::TensorInfo >(
message_arena);
new_tensor_info->CopyFrom(**tensor_info);
*tensor_info = new_tensor_info;
}
}
void AssetFileDef::unsafe_arena_set_allocated_tensor_info(
::tensorflow::TensorInfo* tensor_info) {
if (GetArenaNoVirtual() == NULL) {
delete tensor_info_;
}
tensor_info_ = tensor_info;
if (tensor_info) {
} else {
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.AssetFileDef.tensor_info)
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int AssetFileDef::kTensorInfoFieldNumber;
const int AssetFileDef::kFilenameFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
AssetFileDef::AssetFileDef()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
}
SharedCtor();
// @@protoc_insertion_point(constructor:tensorflow.AssetFileDef)
}
AssetFileDef::AssetFileDef(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena) {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
#endif // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:tensorflow.AssetFileDef)
}
AssetFileDef::AssetFileDef(const AssetFileDef& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.filename().size() > 0) {
filename_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.filename(),
GetArenaNoVirtual());
}
if (from.has_tensor_info()) {
tensor_info_ = new ::tensorflow::TensorInfo(*from.tensor_info_);
} else {
tensor_info_ = NULL;
}
// @@protoc_insertion_point(copy_constructor:tensorflow.AssetFileDef)
}
void AssetFileDef::SharedCtor() {
filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
tensor_info_ = NULL;
_cached_size_ = 0;
}
AssetFileDef::~AssetFileDef() {
// @@protoc_insertion_point(destructor:tensorflow.AssetFileDef)
SharedDtor();
}
void AssetFileDef::SharedDtor() {
::google::protobuf::Arena* arena = GetArenaNoVirtual();
if (arena != NULL) {
return;
}
filename_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
if (this != internal_default_instance()) {
delete tensor_info_;
}
}
void AssetFileDef::ArenaDtor(void* object) {
AssetFileDef* _this = reinterpret_cast< AssetFileDef* >(object);
(void)_this;
}
void AssetFileDef::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void AssetFileDef::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* AssetFileDef::descriptor() {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[14].descriptor;
}
const AssetFileDef& AssetFileDef::default_instance() {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::InitDefaults();
return *internal_default_instance();
}
AssetFileDef* AssetFileDef::New(::google::protobuf::Arena* arena) const {
return ::google::protobuf::Arena::CreateMessage<AssetFileDef>(arena);
}
void AssetFileDef::Clear() {
// @@protoc_insertion_point(message_clear_start:tensorflow.AssetFileDef)
filename_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
if (GetArenaNoVirtual() == NULL && tensor_info_ != NULL) {
delete tensor_info_;
}
tensor_info_ = NULL;
}
bool AssetFileDef::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:tensorflow.AssetFileDef)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// .tensorflow.TensorInfo tensor_info = 1;
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_tensor_info()));
} else {
goto handle_unusual;
}
break;
}
// string filename = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_filename()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->filename().data(), this->filename().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.AssetFileDef.filename"));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:tensorflow.AssetFileDef)
return true;
failure:
// @@protoc_insertion_point(parse_failure:tensorflow.AssetFileDef)
return false;
#undef DO_
}
void AssetFileDef::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:tensorflow.AssetFileDef)
// .tensorflow.TensorInfo tensor_info = 1;
if (this->has_tensor_info()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->tensor_info_, output);
}
// string filename = 2;
if (this->filename().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->filename().data(), this->filename().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.AssetFileDef.filename");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->filename(), output);
}
// @@protoc_insertion_point(serialize_end:tensorflow.AssetFileDef)
}
::google::protobuf::uint8* AssetFileDef::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:tensorflow.AssetFileDef)
// .tensorflow.TensorInfo tensor_info = 1;
if (this->has_tensor_info()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->tensor_info_, false, target);
}
// string filename = 2;
if (this->filename().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->filename().data(), this->filename().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.AssetFileDef.filename");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->filename(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:tensorflow.AssetFileDef)
return target;
}
size_t AssetFileDef::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.AssetFileDef)
size_t total_size = 0;
// string filename = 2;
if (this->filename().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->filename());
}
// .tensorflow.TensorInfo tensor_info = 1;
if (this->has_tensor_info()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->tensor_info_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void AssetFileDef::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.AssetFileDef)
GOOGLE_DCHECK_NE(&from, this);
const AssetFileDef* source =
::google::protobuf::internal::DynamicCastToGenerated<const AssetFileDef>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.AssetFileDef)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.AssetFileDef)
MergeFrom(*source);
}
}
void AssetFileDef::MergeFrom(const AssetFileDef& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.AssetFileDef)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from.filename().size() > 0) {
set_filename(from.filename());
}
if (from.has_tensor_info()) {
mutable_tensor_info()->::tensorflow::TensorInfo::MergeFrom(from.tensor_info());
}
}
void AssetFileDef::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.AssetFileDef)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void AssetFileDef::CopyFrom(const AssetFileDef& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.AssetFileDef)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool AssetFileDef::IsInitialized() const {
return true;
}
void AssetFileDef::Swap(AssetFileDef* other) {
if (other == this) return;
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
InternalSwap(other);
} else {
AssetFileDef* temp = New(GetArenaNoVirtual());
temp->MergeFrom(*other);
other->CopyFrom(*this);
InternalSwap(temp);
if (GetArenaNoVirtual() == NULL) {
delete temp;
}
}
}
void AssetFileDef::UnsafeArenaSwap(AssetFileDef* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void AssetFileDef::InternalSwap(AssetFileDef* other) {
filename_.Swap(&other->filename_);
std::swap(tensor_info_, other->tensor_info_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata AssetFileDef::GetMetadata() const {
protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto::file_level_metadata[14];
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// AssetFileDef
// .tensorflow.TensorInfo tensor_info = 1;
bool AssetFileDef::has_tensor_info() const {
return this != internal_default_instance() && tensor_info_ != NULL;
}
void AssetFileDef::clear_tensor_info() {
if (GetArenaNoVirtual() == NULL && tensor_info_ != NULL) delete tensor_info_;
tensor_info_ = NULL;
}
const ::tensorflow::TensorInfo& AssetFileDef::tensor_info() const {
// @@protoc_insertion_point(field_get:tensorflow.AssetFileDef.tensor_info)
return tensor_info_ != NULL ? *tensor_info_
: *::tensorflow::TensorInfo::internal_default_instance();
}
::tensorflow::TensorInfo* AssetFileDef::mutable_tensor_info() {
if (tensor_info_ == NULL) {
_slow_mutable_tensor_info();
}
// @@protoc_insertion_point(field_mutable:tensorflow.AssetFileDef.tensor_info)
return tensor_info_;
}
::tensorflow::TensorInfo* AssetFileDef::release_tensor_info() {
// @@protoc_insertion_point(field_release:tensorflow.AssetFileDef.tensor_info)
if (GetArenaNoVirtual() != NULL) {
return _slow_release_tensor_info();
} else {
::tensorflow::TensorInfo* temp = tensor_info_;
tensor_info_ = NULL;
return temp;
}
}
void AssetFileDef::set_allocated_tensor_info(::tensorflow::TensorInfo* tensor_info) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == NULL) {
delete tensor_info_;
}
if (tensor_info != NULL) {
_slow_set_allocated_tensor_info(message_arena, &tensor_info);
}
tensor_info_ = tensor_info;
if (tensor_info) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.AssetFileDef.tensor_info)
}
// string filename = 2;
void AssetFileDef::clear_filename() {
filename_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
const ::std::string& AssetFileDef::filename() const {
// @@protoc_insertion_point(field_get:tensorflow.AssetFileDef.filename)
return filename_.Get();
}
void AssetFileDef::set_filename(const ::std::string& value) {
filename_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
// @@protoc_insertion_point(field_set:tensorflow.AssetFileDef.filename)
}
void AssetFileDef::set_filename(const char* value) {
filename_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_char:tensorflow.AssetFileDef.filename)
}
void AssetFileDef::set_filename(const char* value,
size_t size) {
filename_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:tensorflow.AssetFileDef.filename)
}
::std::string* AssetFileDef::mutable_filename() {
// @@protoc_insertion_point(field_mutable:tensorflow.AssetFileDef.filename)
return filename_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* AssetFileDef::release_filename() {
// @@protoc_insertion_point(field_release:tensorflow.AssetFileDef.filename)
return filename_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* AssetFileDef::unsafe_arena_release_filename() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.AssetFileDef.filename)
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
return filename_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
}
void AssetFileDef::set_allocated_filename(::std::string* filename) {
if (filename != NULL) {
} else {
}
filename_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), filename,
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:tensorflow.AssetFileDef.filename)
}
void AssetFileDef::unsafe_arena_set_allocated_filename(
::std::string* filename) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
if (filename != NULL) {
} else {
}
filename_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
filename, GetArenaNoVirtual());
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.AssetFileDef.filename)
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// @@protoc_insertion_point(namespace_scope)
} // namespace tensorflow
// @@protoc_insertion_point(global_scope)
| ikaee/bfr-attendant | facerecognitionlibrary/jni-build/jni/genfiles/tensorflow/core/protobuf/meta_graph.pb.cc | C++ | apache-2.0 | 258,053 | [
30522,
1013,
1013,
7013,
2011,
1996,
8778,
17698,
21624,
1012,
2079,
2025,
10086,
999,
1013,
1013,
3120,
1024,
23435,
12314,
1013,
4563,
1013,
15053,
8569,
2546,
1013,
18804,
1035,
10629,
1012,
15053,
1001,
9375,
4722,
1035,
16081,
1035,
15... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
})();
Clazz._coreLoaded = true;
| xavierprat/chemEdData | libs/jsmol/jmol-14.8.0/jsmol/js/core/corebottom.js | JavaScript | mit | 44 | [
30522,
1065,
1007,
1006,
1007,
1025,
18856,
10936,
2480,
1012,
1035,
4563,
17468,
1027,
2995,
1025,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
title: Event History
toc: [Documentation, Programming Guide, WAMP Features, PubSub, Event History]
# Event History
Event history allows a WAMP client to retrieve a set of past events for a subscription. Retrieval is by subscription ID, and for a set number of events.
## Configuration in Crossbar.io
Crossbar.io does not normally store PubSub events. To enable event history for a topic, you need to configure an event store as part of the Crossbar.io config.
An example for this is
```json
{
"name": "realm1",
"roles": [
],
"store": {
"type": "memory",
"event-history": [
{
"uri": "com.example.oncounter",
"limit": 10000
}
]
}
}
```
The above configures a store on the realm `realm1` which resides in memory, and which stores the last 1000 events for the topic `com.example.oncounter`.
For the time being, `memory` is the only valid argument for where the store is kept, so there is no event history across restarts of Crossbar.io. We are going to implement an LMDB database which will allow persistence across program restarts.
For the time being, event history can only be stored for a specific topic URI. Use of pattern-based subscriptions is not supported.
## Required Client Permissions
To be able to retrieve event history, a client needs to have two permissions:
* It must be allowed to call the retrieval procedure ('wamp.subscription.get_events').
* It must be allowed to subscribe to the subscription (as identified by the subscription ID given in the call). This requirement is necessary to prevent clients for circumeventing the subscription permissions by simply periodically retrieving events for a subscription.
For the time being, the only way to get that subscription ID locally is to actually subscribe to to the topic. (We are thinking about implementing a call to retrieve the subscription ID without subscribing, or an extra argument for the subscribe request to allow this.)
## Calling to Get the Events
The actual call to retrieve events is
```javascript
session.call('wamp.subscription.get_events', [subcriptionID, 20]).then(
function (history) {
console.log("got history for " + history.length + " events");
for (var i = 0; i < history.length; ++i) {
console.log(history[i].timestamp, history[i].publication, history[i].args[0]);
}
},
function (err) {
console.log("could not retrieve event history", err);
}
);
```
where the arguments are the subscription ID to retrieve events for and the number of past events to be retrieved.
The event history is returned as an array of event objects. | w1z2g3/crossbar | docs/pages/programming-guide/pubsub/Event-History.md | Markdown | agpl-3.0 | 2,653 | [
30522,
2516,
1024,
2724,
2381,
2000,
2278,
1024,
1031,
12653,
1010,
4730,
5009,
1010,
11333,
8737,
2838,
1010,
23598,
12083,
1010,
2724,
2381,
1033,
1001,
2724,
2381,
2724,
2381,
4473,
1037,
11333,
8737,
7396,
2000,
12850,
1037,
2275,
1997,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-ccp1" } */
typedef char char16[16] __attribute__ ((aligned (16)));
char16 c16[4] __attribute__ ((aligned (4)));
int f5 (int i)
{
__SIZE_TYPE__ s = (__SIZE_TYPE__)&c16[i];
/* 0 */
return 3 & s;
}
/* { dg-final { scan-tree-dump "return 0;" "ccp1" } } */
/* { dg-final { cleanup-tree-dump "ccp1" } } */
| totalspectrum/gcc-propeller | gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-35.c | C | gpl-2.0 | 366 | [
30522,
1013,
1008,
1063,
1040,
2290,
1011,
2079,
4012,
22090,
1065,
1008,
1013,
1013,
1008,
1063,
1040,
2290,
1011,
7047,
1000,
1011,
1051,
2475,
1011,
1042,
8566,
8737,
1011,
3392,
1011,
10507,
2361,
2487,
1000,
1065,
1008,
1013,
21189,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Component.Toolkit
{
public interface IWorkspaceService
{
IEnumerable<WorkspaceViewModel> GetWorkspaces();
}
public interface INotifyService
{
void Notify(string text);
}
public interface IDispatcherService
{
void Invoke(Action action);
Task InvokeAsync(Action action);
}
}
| balazs4/mef | MEF/Component.Toolkit/CommonServices.cs | C# | unlicense | 474 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
3793,
1025,
2478,
2291,
1012,
11689,
2075,
1012,
8518,
1025,
3415,
15327,
6922,
1012,
6994,
23615,
1063,
2270,
8278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace NetsuiteEnvironmentViewer
{
//http://stackoverflow.com/questions/6442911/how-do-i-sync-scrolling-in-2-treeviews-using-the-slider
public partial class MyTreeView : TreeView
{
public MyTreeView() : base()
{
}
private List<MyTreeView> linkedTreeViews = new List<MyTreeView>();
/// <summary>
/// Links the specified tree view to this tree view. Whenever either treeview
/// scrolls, the other will scroll too.
/// </summary>
/// <param name="treeView">The TreeView to link.</param>
public void AddLinkedTreeView(MyTreeView treeView)
{
if (treeView == this)
throw new ArgumentException("Cannot link a TreeView to itself!", "treeView");
if (!linkedTreeViews.Contains(treeView))
{
//add the treeview to our list of linked treeviews
linkedTreeViews.Add(treeView);
//add this to the treeview's list of linked treeviews
treeView.AddLinkedTreeView(this);
//make sure the TreeView is linked to all of the other TreeViews that this TreeView is linked to
for (int i = 0; i < linkedTreeViews.Count; i++)
{
//get the linked treeview
var linkedTreeView = linkedTreeViews[i];
//link the treeviews together
if (linkedTreeView != treeView)
linkedTreeView.AddLinkedTreeView(treeView);
}
}
}
/// <summary>
/// Sets the destination's scroll positions to that of the source.
/// </summary>
/// <param name="source">The source of the scroll positions.</param>
/// <param name="dest">The destinations to set the scroll positions for.</param>
private void SetScrollPositions(MyTreeView source, MyTreeView dest)
{
//get the scroll positions of the source
int horizontal = User32.GetScrollPos(source.Handle, Orientation.Horizontal);
int vertical = User32.GetScrollPos(source.Handle, Orientation.Vertical);
//set the scroll positions of the destination
User32.SetScrollPos(dest.Handle, Orientation.Horizontal, horizontal, true);
User32.SetScrollPos(dest.Handle, Orientation.Vertical, vertical, true);
}
protected override void WndProc(ref Message m)
{
//process the message
base.WndProc(ref m);
//pass scroll messages onto any linked views
if (m.Msg == User32.WM_VSCROLL || m.Msg == User32.WM_MOUSEWHEEL)
{
foreach (var linkedTreeView in linkedTreeViews)
{
//set the scroll positions of the linked tree view
SetScrollPositions(this, linkedTreeView);
//copy the windows message
Message copy = new Message
{
HWnd = linkedTreeView.Handle,
LParam = m.LParam,
Msg = m.Msg,
Result = m.Result,
WParam = m.WParam
};
//pass the message onto the linked tree view
linkedTreeView.ReceiveWndProc(ref copy);
}
}
}
/// <summary>
/// Recieves a WndProc message without passing it onto any linked treeviews. This is useful to avoid infinite loops.
/// </summary>
/// <param name="m">The windows message.</param>
private void ReceiveWndProc(ref Message m)
{
base.WndProc(ref m);
}
/// <summary>
/// Imported functions from the User32.dll
/// </summary>
private class User32
{
public const int WM_VSCROLL = 0x115;
public const int WM_MOUSEWHEEL = 0x020A;
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int GetScrollPos(IntPtr hWnd, System.Windows.Forms.Orientation nBar);
[DllImport("user32.dll")]
public static extern int SetScrollPos(IntPtr hWnd, System.Windows.Forms.Orientation nBar, int nPos, bool bRedraw);
}
}
}
| zacarius89/NetsuiteEnvironmentViewer | NetsuiteEnvironmentViewer/windowsFormClients/treeViewClient.cs | C# | mit | 3,736 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
2448,
7292,
1012,
6970,
11923,
2121,
7903,
2229,
1025,
2478,
2291,
1012,
3645,
1012,
3596,
1025,
3415,
15327,
16996,
14663,
12129,
21663,
2239,
3672,
8584... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*! Responsive JS Library v1.2.2 */
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
window.matchMedia = window.matchMedia || (function(doc, undefined){
var bool,
docElem = doc.documentElement,
refNode = docElem.firstElementChild || docElem.firstChild,
// fakeBody required for <FF4 when executed in <head>
fakeBody = doc.createElement('body'),
div = doc.createElement('div');
div.id = 'mq-test-1';
div.style.cssText = "position:absolute;top:-100em";
fakeBody.style.background = "none";
fakeBody.appendChild(div);
return function(q){
div.innerHTML = '­<style media="'+q+'"> #mq-test-1 { width: 42px; }</style>';
docElem.insertBefore(fakeBody, refNode);
bool = div.offsetWidth == 42;
docElem.removeChild(fakeBody);
return { matches: bool, media: q };
};
})(document);
/*! Respond.js v1.1.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */
(function( win ){
//exposed namespace
win.respond = {};
//define update even in native-mq-supporting browsers, to avoid errors
respond.update = function(){};
//expose media query support flag for external use
respond.mediaQueriesSupported = win.matchMedia && win.matchMedia( "only all" ).matches;
//if media queries are supported, exit here
if( respond.mediaQueriesSupported ){ return; }
//define vars
var doc = win.document,
docElem = doc.documentElement,
mediastyles = [],
rules = [],
appendedEls = [],
parsedSheets = {},
resizeThrottle = 30,
head = doc.getElementsByTagName( "head" )[0] || docElem,
base = doc.getElementsByTagName( "base" )[0],
links = head.getElementsByTagName( "link" ),
requestQueue = [],
//loop stylesheets, send text content to translate
ripCSS = function(){
var sheets = links,
sl = sheets.length,
i = 0,
//vars for loop:
sheet, href, media, isCSS;
for( ; i < sl; i++ ){
sheet = sheets[ i ],
href = sheet.href,
media = sheet.media,
isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet";
//only links plz and prevent re-parsing
if( !!href && isCSS && !parsedSheets[ href ] ){
// selectivizr exposes css through the rawCssText expando
if (sheet.styleSheet && sheet.styleSheet.rawCssText) {
translate( sheet.styleSheet.rawCssText, href, media );
parsedSheets[ href ] = true;
} else {
if( (!/^([a-zA-Z:]*\/\/)/.test( href ) && !base)
|| href.replace( RegExp.$1, "" ).split( "/" )[0] === win.location.host ){
requestQueue.push( {
href: href,
media: media
} );
}
}
}
}
makeRequests();
},
//recurse through request queue, get css text
makeRequests = function(){
if( requestQueue.length ){
var thisRequest = requestQueue.shift();
ajax( thisRequest.href, function( styles ){
translate( styles, thisRequest.href, thisRequest.media );
parsedSheets[ thisRequest.href ] = true;
makeRequests();
} );
}
},
//find media blocks in css text, convert to style blocks
translate = function( styles, href, media ){
var qs = styles.match( /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi ),
ql = qs && qs.length || 0,
//try to get CSS path
href = href.substring( 0, href.lastIndexOf( "/" )),
repUrls = function( css ){
return css.replace( /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, "$1" + href + "$2$3" );
},
useMedia = !ql && media,
//vars used in loop
i = 0,
j, fullq, thisq, eachq, eql;
//if path exists, tack on trailing slash
if( href.length ){ href += "/"; }
//if no internal queries exist, but media attr does, use that
//note: this currently lacks support for situations where a media attr is specified on a link AND
//its associated stylesheet has internal CSS media queries.
//In those cases, the media attribute will currently be ignored.
if( useMedia ){
ql = 1;
}
for( ; i < ql; i++ ){
j = 0;
//media attr
if( useMedia ){
fullq = media;
rules.push( repUrls( styles ) );
}
//parse for styles
else{
fullq = qs[ i ].match( /@media *([^\{]+)\{([\S\s]+?)$/ ) && RegExp.$1;
rules.push( RegExp.$2 && repUrls( RegExp.$2 ) );
}
eachq = fullq.split( "," );
eql = eachq.length;
for( ; j < eql; j++ ){
thisq = eachq[ j ];
mediastyles.push( {
media : thisq.split( "(" )[ 0 ].match( /(only\s+)?([a-zA-Z]+)\s?/ ) && RegExp.$2 || "all",
rules : rules.length - 1,
hasquery: thisq.indexOf("(") > -1,
minw : thisq.match( /\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ),
maxw : thisq.match( /\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" )
} );
}
}
applyMedia();
},
lastCall,
resizeDefer,
// returns the value of 1em in pixels
getEmValue = function() {
var ret,
div = doc.createElement('div'),
body = doc.body,
fakeUsed = false;
div.style.cssText = "position:absolute;font-size:1em;width:1em";
if( !body ){
body = fakeUsed = doc.createElement( "body" );
body.style.background = "none";
}
body.appendChild( div );
docElem.insertBefore( body, docElem.firstChild );
ret = div.offsetWidth;
if( fakeUsed ){
docElem.removeChild( body );
}
else {
body.removeChild( div );
}
//also update eminpx before returning
ret = eminpx = parseFloat(ret);
return ret;
},
//cached container for 1em value, populated the first time it's needed
eminpx,
//enable/disable styles
applyMedia = function( fromResize ){
var name = "clientWidth",
docElemProp = docElem[ name ],
currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[ name ] || docElemProp,
styleBlocks = {},
lastLink = links[ links.length-1 ],
now = (new Date()).getTime();
//throttle resize calls
if( fromResize && lastCall && now - lastCall < resizeThrottle ){
clearTimeout( resizeDefer );
resizeDefer = setTimeout( applyMedia, resizeThrottle );
return;
}
else {
lastCall = now;
}
for( var i in mediastyles ){
var thisstyle = mediastyles[ i ],
min = thisstyle.minw,
max = thisstyle.maxw,
minnull = min === null,
maxnull = max === null,
em = "em";
if( !!min ){
min = parseFloat( min ) * ( min.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 );
}
if( !!max ){
max = parseFloat( max ) * ( max.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 );
}
// if there's no media query at all (the () part), or min or max is not null, and if either is present, they're true
if( !thisstyle.hasquery || ( !minnull || !maxnull ) && ( minnull || currWidth >= min ) && ( maxnull || currWidth <= max ) ){
if( !styleBlocks[ thisstyle.media ] ){
styleBlocks[ thisstyle.media ] = [];
}
styleBlocks[ thisstyle.media ].push( rules[ thisstyle.rules ] );
}
}
//remove any existing respond style element(s)
for( var i in appendedEls ){
if( appendedEls[ i ] && appendedEls[ i ].parentNode === head ){
head.removeChild( appendedEls[ i ] );
}
}
//inject active styles, grouped by media type
for( var i in styleBlocks ){
var ss = doc.createElement( "style" ),
css = styleBlocks[ i ].join( "\n" );
ss.type = "text/css";
ss.media = i;
//originally, ss was appended to a documentFragment and sheets were appended in bulk.
//this caused crashes in IE in a number of circumstances, such as when the HTML element had a bg image set, so appending beforehand seems best. Thanks to @dvelyk for the initial research on this one!
head.insertBefore( ss, lastLink.nextSibling );
if ( ss.styleSheet ){
ss.styleSheet.cssText = css;
}
else {
ss.appendChild( doc.createTextNode( css ) );
}
//push to appendedEls to track for later removal
appendedEls.push( ss );
}
},
//tweaked Ajax functions from Quirksmode
ajax = function( url, callback ) {
var req = xmlHttp();
if (!req){
return;
}
req.open( "GET", url, true );
req.onreadystatechange = function () {
if ( req.readyState != 4 || req.status != 200 && req.status != 304 ){
return;
}
callback( req.responseText );
}
if ( req.readyState == 4 ){
return;
}
req.send( null );
},
//define ajax obj
xmlHttp = (function() {
var xmlhttpmethod = false;
try {
xmlhttpmethod = new XMLHttpRequest();
}
catch( e ){
xmlhttpmethod = new ActiveXObject( "Microsoft.XMLHTTP" );
}
return function(){
return xmlhttpmethod;
};
})();
//translate CSS
ripCSS();
//expose update for re-running respond later on
respond.update = ripCSS;
//adjust on resize
function callMedia(){
applyMedia( true );
}
if( win.addEventListener ){
win.addEventListener( "resize", callMedia, false );
}
else if( win.attachEvent ){
win.attachEvent( "onresize", callMedia );
}
})(this);
/**
* jQuery Scroll Top Plugin 1.0.0
*/
jQuery(document).ready(function ($) {
$('a[href=#scroll-top]').click(function () {
$('html, body').animate({
scrollTop: 0
}, 'slow');
return false;
});
});
/*! http://mths.be/placeholder v2.0.7 by @mathias */
;(function(window, document, $) {
var isInputSupported = 'placeholder' in document.createElement('input'),
isTextareaSupported = 'placeholder' in document.createElement('textarea'),
prototype = $.fn,
valHooks = $.valHooks,
hooks,
placeholder;
if (isInputSupported && isTextareaSupported) {
placeholder = prototype.placeholder = function() {
return this;
};
placeholder.input = placeholder.textarea = true;
} else {
placeholder = prototype.placeholder = function() {
var $this = this;
$this
.filter((isInputSupported ? 'textarea' : ':input') + '[placeholder]')
.not('.placeholder')
.bind({
'focus.placeholder': clearPlaceholder,
'blur.placeholder': setPlaceholder
})
.data('placeholder-enabled', true)
.trigger('blur.placeholder');
return $this;
};
placeholder.input = isInputSupported;
placeholder.textarea = isTextareaSupported;
hooks = {
'get': function(element) {
var $element = $(element);
return $element.data('placeholder-enabled') && $element.hasClass('placeholder') ? '' : element.value;
},
'set': function(element, value) {
var $element = $(element);
if (!$element.data('placeholder-enabled')) {
return element.value = value;
}
if (value == '') {
element.value = value;
// Issue #56: Setting the placeholder causes problems if the element continues to have focus.
if (element != document.activeElement) {
// We can't use `triggerHandler` here because of dummy text/password inputs :(
setPlaceholder.call(element);
}
} else if ($element.hasClass('placeholder')) {
clearPlaceholder.call(element, true, value) || (element.value = value);
} else {
element.value = value;
}
// `set` can not return `undefined`; see http://jsapi.info/jquery/1.7.1/val#L2363
return $element;
}
};
isInputSupported || (valHooks.input = hooks);
isTextareaSupported || (valHooks.textarea = hooks);
$(function() {
// Look for forms
$(document).delegate('form', 'submit.placeholder', function() {
// Clear the placeholder values so they don't get submitted
var $inputs = $('.placeholder', this).each(clearPlaceholder);
setTimeout(function() {
$inputs.each(setPlaceholder);
}, 10);
});
});
// Clear placeholder values upon page reload
$(window).bind('beforeunload.placeholder', function() {
$('.placeholder').each(function() {
this.value = '';
});
});
}
function args(elem) {
// Return an object of element attributes
var newAttrs = {},
rinlinejQuery = /^jQuery\d+$/;
$.each(elem.attributes, function(i, attr) {
if (attr.specified && !rinlinejQuery.test(attr.name)) {
newAttrs[attr.name] = attr.value;
}
});
return newAttrs;
}
function clearPlaceholder(event, value) {
var input = this,
$input = $(input);
if (input.value == $input.attr('placeholder') && $input.hasClass('placeholder')) {
if ($input.data('placeholder-password')) {
$input = $input.hide().next().show().attr('id', $input.removeAttr('id').data('placeholder-id'));
// If `clearPlaceholder` was called from `$.valHooks.input.set`
if (event === true) {
return $input[0].value = value;
}
$input.focus();
} else {
input.value = '';
$input.removeClass('placeholder');
input == document.activeElement && input.select();
}
}
}
function setPlaceholder() {
var $replacement,
input = this,
$input = $(input),
$origInput = $input,
id = this.id;
if (input.value == '') {
if (input.type == 'password') {
if (!$input.data('placeholder-textinput')) {
try {
$replacement = $input.clone().attr({ 'type': 'text' });
} catch(e) {
$replacement = $('<input>').attr($.extend(args(this), { 'type': 'text' }));
}
$replacement
.removeAttr('name')
.data({
'placeholder-password': true,
'placeholder-id': id
})
.bind('focus.placeholder', clearPlaceholder);
$input
.data({
'placeholder-textinput': $replacement,
'placeholder-id': id
})
.before($replacement);
}
$input = $input.removeAttr('id').hide().prev().attr('id', id).show();
// Note: `$input[0] != input` now!
}
$input.addClass('placeholder');
$input[0].value = $input.attr('placeholder');
} else {
$input.removeClass('placeholder');
}
}
}(this, document, jQuery));
/*global jQuery */
/*jshint multistr:true browser:true */
/*!
* FitVids 1.0
*
* Copyright 2011, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
*
* Date: Thu Sept 01 18:00:00 2011 -0500
*/
(function( $ ){
"use strict";
$.fn.fitVids = function( options ) {
var settings = {
customSelector: null
};
var div = document.createElement('div'),
ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0];
div.className = 'fit-vids-style';
div.innerHTML = '­<style> \
.fluid-width-video-wrapper { \
width: 100%; \
position: relative; \
padding: 0; \
} \
\
.fluid-width-video-wrapper iframe, \
.fluid-width-video-wrapper object, \
.fluid-width-video-wrapper embed { \
position: absolute; \
top: 0; \
left: 0; \
width: 100%; \
height: 100%; \
} \
</style>';
ref.parentNode.insertBefore(div,ref);
if ( options ) {
$.extend( settings, options );
}
return this.each(function(){
var selectors = [
"iframe[src*='player.vimeo.com']",
"iframe[src*='www.youtube.com']",
"iframe[src*='www.youtube-nocookie.com']",
"iframe[src*='fast.wistia.com']",
"embed"
];
if (settings.customSelector) {
selectors.push(settings.customSelector);
}
var $allVideos = $(this).find(selectors.join(','));
$allVideos.each(function(){
var $this = $(this);
if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),
width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
aspectRatio = height / width;
if(!$this.attr('id')){
var videoID = 'fitvid' + Math.floor(Math.random()*999999);
$this.attr('id', videoID);
}
$this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%");
$this.removeAttr('height').removeAttr('width');
});
});
};
})( jQuery );
/*!
* Mobile Menu
*/
(function($) {
var current = $('.main-nav li.current-menu-item a').html();
current = $('.main-nav li.current_page_item a').html();
if( $('span').hasClass('custom-mobile-menu-title') ) {
current = $('span.custom-mobile-menu-title').html();
}
else if( typeof current == 'undefined' || current === null ) {
if( $('body').hasClass('home') ) {
if( $('#logo span').hasClass('site-name') ) {
current = $('#logo .site-name a').html();
}
else {
current = $('#logo img').attr('alt');
}
}
else {
if( $('body').hasClass('woocommerce') ) {
current = $('h1.page-title').html();
}
else if( $('body').hasClass('archive') ) {
current = $('h6.title-archive').html();
}
else if( $('body').hasClass('search-results') ) {
current = $('h6.title-search-results').html();
}
else if( $('body').hasClass('page-template-blog-excerpt-php') ) {
current = $('.current_page_item').text();
}
else if( $('body').hasClass('page-template-blog-php') ) {
current = $('.current_page_item').text();
}
else {
current = $('h1.post-title').html();
}
}
};
$('.main-nav').append('<a id="responsive_menu_button"></a>');
$('.main-nav').prepend('<div id="responsive_current_menu_item">Menu</div>');
$('a#responsive_menu_button, #responsive_current_menu_item').click(function(){
$('.js .main-nav .menu').slideToggle( function() {
if( $(this).is(':visible') ) {
$('a#responsive_menu_button').addClass('responsive-toggle-open');
}
else {
$('a#responsive_menu_button').removeClass('responsive-toggle-open');
$('.js .main-nav .menu').removeAttr('style');
}
});
});
})(jQuery);
// Close the mobile menu when clicked outside of it.
(function($) {
$('html').click(function() {
// Check if the menu is open, close in that case.
if( $('a#responsive_menu_button').hasClass('responsive-toggle-open') ){
$('.js .main-nav .menu').slideToggle( function() {
$('a#responsive_menu_button').removeClass('responsive-toggle-open');
$('.js .main-nav .menu').removeAttr('style');
});
}
})
})(jQuery);
// Stop propagation on click on menu.
jQuery('.main-nav').click(function(event){
var pathname = window.location.pathname;
if( pathname != '/wp-admin/customize.php' ){
event.stopPropagation();
}
});
// Placeholder
jQuery(function(){
jQuery('input[placeholder], textarea[placeholder]').placeholder();
});
// FitVids
jQuery(document).ready(function(){
// Target your #container, #wrapper etc.
jQuery("#wrapper").fitVids();
});
// Have a custom video player? We now have a customSelector option where you can add your own specific video vendor selector (mileage may vary depending on vendor and fluidity of player):
// jQuery("#thing-with-videos").fitVids({ customSelector: "iframe[src^='http://example.com'], iframe[src^='http://example.org']"});
// Selectors are comma separated, just like CSS
// Note: This will be the quickest way to add your own custom vendor as well as test your player's compatibility with FitVids. | kevinreilly/ivsn-wp | wp-content/themes/responsive/core/js-dev/responsive-scripts.js | JavaScript | gpl-2.0 | 21,660 | [
30522,
1013,
1008,
999,
26651,
1046,
2015,
3075,
1058,
2487,
1012,
1016,
1012,
1016,
1008,
1013,
1013,
1008,
999,
2674,
16969,
1006,
1007,
26572,
8873,
3363,
1011,
3231,
1037,
20116,
2015,
2865,
2828,
1013,
23032,
1999,
1046,
2015,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import os
import operator
import sys
import uuid
import warnings
from abc import ABCMeta, abstractmethod, abstractproperty
from multiprocessing.pool import ThreadPool
from pyspark import keyword_only, since, SparkContext
from pyspark.ml import Estimator, Predictor, PredictionModel, Model
from pyspark.ml.param.shared import HasRawPredictionCol, HasProbabilityCol, HasThresholds, \
HasRegParam, HasMaxIter, HasFitIntercept, HasTol, HasStandardization, HasWeightCol, \
HasAggregationDepth, HasThreshold, HasBlockSize, HasMaxBlockSizeInMB, Param, Params, \
TypeConverters, HasElasticNetParam, HasSeed, HasStepSize, HasSolver, HasParallelism
from pyspark.ml.tree import _DecisionTreeModel, _DecisionTreeParams, \
_TreeEnsembleModel, _RandomForestParams, _GBTParams, \
_HasVarianceImpurity, _TreeClassifierParams
from pyspark.ml.regression import _FactorizationMachinesParams, DecisionTreeRegressionModel
from pyspark.ml.base import _PredictorParams
from pyspark.ml.util import DefaultParamsReader, DefaultParamsWriter, \
JavaMLReadable, JavaMLReader, JavaMLWritable, JavaMLWriter, \
MLReader, MLReadable, MLWriter, MLWritable, HasTrainingSummary
from pyspark.ml.wrapper import JavaParams, \
JavaPredictor, JavaPredictionModel, JavaWrapper
from pyspark.ml.common import inherit_doc
from pyspark.ml.linalg import Vectors, VectorUDT
from pyspark.sql import DataFrame
from pyspark.sql.functions import udf, when
from pyspark.sql.types import ArrayType, DoubleType
from pyspark.storagelevel import StorageLevel
__all__ = ['LinearSVC', 'LinearSVCModel',
'LinearSVCSummary', 'LinearSVCTrainingSummary',
'LogisticRegression', 'LogisticRegressionModel',
'LogisticRegressionSummary', 'LogisticRegressionTrainingSummary',
'BinaryLogisticRegressionSummary', 'BinaryLogisticRegressionTrainingSummary',
'DecisionTreeClassifier', 'DecisionTreeClassificationModel',
'GBTClassifier', 'GBTClassificationModel',
'RandomForestClassifier', 'RandomForestClassificationModel',
'RandomForestClassificationSummary', 'RandomForestClassificationTrainingSummary',
'BinaryRandomForestClassificationSummary',
'BinaryRandomForestClassificationTrainingSummary',
'NaiveBayes', 'NaiveBayesModel',
'MultilayerPerceptronClassifier', 'MultilayerPerceptronClassificationModel',
'MultilayerPerceptronClassificationSummary',
'MultilayerPerceptronClassificationTrainingSummary',
'OneVsRest', 'OneVsRestModel',
'FMClassifier', 'FMClassificationModel', 'FMClassificationSummary',
'FMClassificationTrainingSummary']
class _ClassifierParams(HasRawPredictionCol, _PredictorParams):
"""
Classifier Params for classification tasks.
.. versionadded:: 3.0.0
"""
pass
@inherit_doc
class Classifier(Predictor, _ClassifierParams, metaclass=ABCMeta):
"""
Classifier for classification tasks.
Classes are indexed {0, 1, ..., numClasses - 1}.
"""
@since("3.0.0")
def setRawPredictionCol(self, value):
"""
Sets the value of :py:attr:`rawPredictionCol`.
"""
return self._set(rawPredictionCol=value)
@inherit_doc
class ClassificationModel(PredictionModel, _ClassifierParams, metaclass=ABCMeta):
"""
Model produced by a ``Classifier``.
Classes are indexed {0, 1, ..., numClasses - 1}.
"""
@since("3.0.0")
def setRawPredictionCol(self, value):
"""
Sets the value of :py:attr:`rawPredictionCol`.
"""
return self._set(rawPredictionCol=value)
@abstractproperty
@since("2.1.0")
def numClasses(self):
"""
Number of classes (values which the label can take).
"""
raise NotImplementedError()
@abstractmethod
@since("3.0.0")
def predictRaw(self, value):
"""
Raw prediction for each possible label.
"""
raise NotImplementedError()
class _ProbabilisticClassifierParams(HasProbabilityCol, HasThresholds, _ClassifierParams):
"""
Params for :py:class:`ProbabilisticClassifier` and
:py:class:`ProbabilisticClassificationModel`.
.. versionadded:: 3.0.0
"""
pass
@inherit_doc
class ProbabilisticClassifier(Classifier, _ProbabilisticClassifierParams,
metaclass=ABCMeta):
"""
Probabilistic Classifier for classification tasks.
"""
@since("3.0.0")
def setProbabilityCol(self, value):
"""
Sets the value of :py:attr:`probabilityCol`.
"""
return self._set(probabilityCol=value)
@since("3.0.0")
def setThresholds(self, value):
"""
Sets the value of :py:attr:`thresholds`.
"""
return self._set(thresholds=value)
@inherit_doc
class ProbabilisticClassificationModel(ClassificationModel,
_ProbabilisticClassifierParams,
metaclass=ABCMeta):
"""
Model produced by a ``ProbabilisticClassifier``.
"""
@since("3.0.0")
def setProbabilityCol(self, value):
"""
Sets the value of :py:attr:`probabilityCol`.
"""
return self._set(probabilityCol=value)
@since("3.0.0")
def setThresholds(self, value):
"""
Sets the value of :py:attr:`thresholds`.
"""
return self._set(thresholds=value)
@abstractmethod
@since("3.0.0")
def predictProbability(self, value):
"""
Predict the probability of each class given the features.
"""
raise NotImplementedError()
@inherit_doc
class _JavaClassifier(Classifier, JavaPredictor, metaclass=ABCMeta):
"""
Java Classifier for classification tasks.
Classes are indexed {0, 1, ..., numClasses - 1}.
"""
@since("3.0.0")
def setRawPredictionCol(self, value):
"""
Sets the value of :py:attr:`rawPredictionCol`.
"""
return self._set(rawPredictionCol=value)
@inherit_doc
class _JavaClassificationModel(ClassificationModel, JavaPredictionModel):
"""
Java Model produced by a ``Classifier``.
Classes are indexed {0, 1, ..., numClasses - 1}.
To be mixed in with :class:`pyspark.ml.JavaModel`
"""
@property
@since("2.1.0")
def numClasses(self):
"""
Number of classes (values which the label can take).
"""
return self._call_java("numClasses")
@since("3.0.0")
def predictRaw(self, value):
"""
Raw prediction for each possible label.
"""
return self._call_java("predictRaw", value)
@inherit_doc
class _JavaProbabilisticClassifier(ProbabilisticClassifier, _JavaClassifier,
metaclass=ABCMeta):
"""
Java Probabilistic Classifier for classification tasks.
"""
pass
@inherit_doc
class _JavaProbabilisticClassificationModel(ProbabilisticClassificationModel,
_JavaClassificationModel):
"""
Java Model produced by a ``ProbabilisticClassifier``.
"""
@since("3.0.0")
def predictProbability(self, value):
"""
Predict the probability of each class given the features.
"""
return self._call_java("predictProbability", value)
@inherit_doc
class _ClassificationSummary(JavaWrapper):
"""
Abstraction for multiclass classification results for a given model.
.. versionadded:: 3.1.0
"""
@property
@since("3.1.0")
def predictions(self):
"""
Dataframe outputted by the model's `transform` method.
"""
return self._call_java("predictions")
@property
@since("3.1.0")
def predictionCol(self):
"""
Field in "predictions" which gives the prediction of each class.
"""
return self._call_java("predictionCol")
@property
@since("3.1.0")
def labelCol(self):
"""
Field in "predictions" which gives the true label of each
instance.
"""
return self._call_java("labelCol")
@property
@since("3.1.0")
def weightCol(self):
"""
Field in "predictions" which gives the weight of each instance
as a vector.
"""
return self._call_java("weightCol")
@property
def labels(self):
"""
Returns the sequence of labels in ascending order. This order matches the order used
in metrics which are specified as arrays over labels, e.g., truePositiveRateByLabel.
.. versionadded:: 3.1.0
Notes
-----
In most cases, it will be values {0.0, 1.0, ..., numClasses-1}, However, if the
training set is missing a label, then all of the arrays over labels
(e.g., from truePositiveRateByLabel) will be of length numClasses-1 instead of the
expected numClasses.
"""
return self._call_java("labels")
@property
@since("3.1.0")
def truePositiveRateByLabel(self):
"""
Returns true positive rate for each label (category).
"""
return self._call_java("truePositiveRateByLabel")
@property
@since("3.1.0")
def falsePositiveRateByLabel(self):
"""
Returns false positive rate for each label (category).
"""
return self._call_java("falsePositiveRateByLabel")
@property
@since("3.1.0")
def precisionByLabel(self):
"""
Returns precision for each label (category).
"""
return self._call_java("precisionByLabel")
@property
@since("3.1.0")
def recallByLabel(self):
"""
Returns recall for each label (category).
"""
return self._call_java("recallByLabel")
@since("3.1.0")
def fMeasureByLabel(self, beta=1.0):
"""
Returns f-measure for each label (category).
"""
return self._call_java("fMeasureByLabel", beta)
@property
@since("3.1.0")
def accuracy(self):
"""
Returns accuracy.
(equals to the total number of correctly classified instances
out of the total number of instances.)
"""
return self._call_java("accuracy")
@property
@since("3.1.0")
def weightedTruePositiveRate(self):
"""
Returns weighted true positive rate.
(equals to precision, recall and f-measure)
"""
return self._call_java("weightedTruePositiveRate")
@property
@since("3.1.0")
def weightedFalsePositiveRate(self):
"""
Returns weighted false positive rate.
"""
return self._call_java("weightedFalsePositiveRate")
@property
@since("3.1.0")
def weightedRecall(self):
"""
Returns weighted averaged recall.
(equals to precision, recall and f-measure)
"""
return self._call_java("weightedRecall")
@property
@since("3.1.0")
def weightedPrecision(self):
"""
Returns weighted averaged precision.
"""
return self._call_java("weightedPrecision")
@since("3.1.0")
def weightedFMeasure(self, beta=1.0):
"""
Returns weighted averaged f-measure.
"""
return self._call_java("weightedFMeasure", beta)
@inherit_doc
class _TrainingSummary(JavaWrapper):
"""
Abstraction for Training results.
.. versionadded:: 3.1.0
"""
@property
@since("3.1.0")
def objectiveHistory(self):
"""
Objective function (scaled loss + regularization) at each
iteration. It contains one more element, the initial state,
than number of iterations.
"""
return self._call_java("objectiveHistory")
@property
@since("3.1.0")
def totalIterations(self):
"""
Number of training iterations until termination.
"""
return self._call_java("totalIterations")
@inherit_doc
class _BinaryClassificationSummary(_ClassificationSummary):
"""
Binary classification results for a given model.
.. versionadded:: 3.1.0
"""
@property
@since("3.1.0")
def scoreCol(self):
"""
Field in "predictions" which gives the probability or raw prediction
of each class as a vector.
"""
return self._call_java("scoreCol")
@property
def roc(self):
"""
Returns the receiver operating characteristic (ROC) curve,
which is a Dataframe having two fields (FPR, TPR) with
(0.0, 0.0) prepended and (1.0, 1.0) appended to it.
.. versionadded:: 3.1.0
Notes
-----
`Wikipedia reference <http://en.wikipedia.org/wiki/Receiver_operating_characteristic>`_
"""
return self._call_java("roc")
@property
@since("3.1.0")
def areaUnderROC(self):
"""
Computes the area under the receiver operating characteristic
(ROC) curve.
"""
return self._call_java("areaUnderROC")
@property
@since("3.1.0")
def pr(self):
"""
Returns the precision-recall curve, which is a Dataframe
containing two fields recall, precision with (0.0, 1.0) prepended
to it.
"""
return self._call_java("pr")
@property
@since("3.1.0")
def fMeasureByThreshold(self):
"""
Returns a dataframe with two fields (threshold, F-Measure) curve
with beta = 1.0.
"""
return self._call_java("fMeasureByThreshold")
@property
@since("3.1.0")
def precisionByThreshold(self):
"""
Returns a dataframe with two fields (threshold, precision) curve.
Every possible probability obtained in transforming the dataset
are used as thresholds used in calculating the precision.
"""
return self._call_java("precisionByThreshold")
@property
@since("3.1.0")
def recallByThreshold(self):
"""
Returns a dataframe with two fields (threshold, recall) curve.
Every possible probability obtained in transforming the dataset
are used as thresholds used in calculating the recall.
"""
return self._call_java("recallByThreshold")
class _LinearSVCParams(_ClassifierParams, HasRegParam, HasMaxIter, HasFitIntercept, HasTol,
HasStandardization, HasWeightCol, HasAggregationDepth, HasThreshold,
HasMaxBlockSizeInMB):
"""
Params for :py:class:`LinearSVC` and :py:class:`LinearSVCModel`.
.. versionadded:: 3.0.0
"""
threshold = Param(Params._dummy(), "threshold",
"The threshold in binary classification applied to the linear model"
" prediction. This threshold can be any real number, where Inf will make"
" all predictions 0.0 and -Inf will make all predictions 1.0.",
typeConverter=TypeConverters.toFloat)
def __init__(self, *args):
super(_LinearSVCParams, self).__init__(*args)
self._setDefault(maxIter=100, regParam=0.0, tol=1e-6, fitIntercept=True,
standardization=True, threshold=0.0, aggregationDepth=2,
maxBlockSizeInMB=0.0)
@inherit_doc
class LinearSVC(_JavaClassifier, _LinearSVCParams, JavaMLWritable, JavaMLReadable):
"""
This binary classifier optimizes the Hinge Loss using the OWLQN optimizer.
Only supports L2 regularization currently.
.. versionadded:: 2.2.0
Notes
-----
`Linear SVM Classifier <https://en.wikipedia.org/wiki/Support_vector_machine#Linear_SVM>`_
Examples
--------
>>> from pyspark.sql import Row
>>> from pyspark.ml.linalg import Vectors
>>> df = sc.parallelize([
... Row(label=1.0, features=Vectors.dense(1.0, 1.0, 1.0)),
... Row(label=0.0, features=Vectors.dense(1.0, 2.0, 3.0))]).toDF()
>>> svm = LinearSVC()
>>> svm.getMaxIter()
100
>>> svm.setMaxIter(5)
LinearSVC...
>>> svm.getMaxIter()
5
>>> svm.getRegParam()
0.0
>>> svm.setRegParam(0.01)
LinearSVC...
>>> svm.getRegParam()
0.01
>>> model = svm.fit(df)
>>> model.setPredictionCol("newPrediction")
LinearSVCModel...
>>> model.getPredictionCol()
'newPrediction'
>>> model.setThreshold(0.5)
LinearSVCModel...
>>> model.getThreshold()
0.5
>>> model.getMaxBlockSizeInMB()
0.0
>>> model.coefficients
DenseVector([0.0, -0.2792, -0.1833])
>>> model.intercept
1.0206118982229047
>>> model.numClasses
2
>>> model.numFeatures
3
>>> test0 = sc.parallelize([Row(features=Vectors.dense(-1.0, -1.0, -1.0))]).toDF()
>>> model.predict(test0.head().features)
1.0
>>> model.predictRaw(test0.head().features)
DenseVector([-1.4831, 1.4831])
>>> result = model.transform(test0).head()
>>> result.newPrediction
1.0
>>> result.rawPrediction
DenseVector([-1.4831, 1.4831])
>>> svm_path = temp_path + "/svm"
>>> svm.save(svm_path)
>>> svm2 = LinearSVC.load(svm_path)
>>> svm2.getMaxIter()
5
>>> model_path = temp_path + "/svm_model"
>>> model.save(model_path)
>>> model2 = LinearSVCModel.load(model_path)
>>> model.coefficients[0] == model2.coefficients[0]
True
>>> model.intercept == model2.intercept
True
>>> model.transform(test0).take(1) == model2.transform(test0).take(1)
True
"""
@keyword_only
def __init__(self, *, featuresCol="features", labelCol="label", predictionCol="prediction",
maxIter=100, regParam=0.0, tol=1e-6, rawPredictionCol="rawPrediction",
fitIntercept=True, standardization=True, threshold=0.0, weightCol=None,
aggregationDepth=2, maxBlockSizeInMB=0.0):
"""
__init__(self, \\*, featuresCol="features", labelCol="label", predictionCol="prediction", \
maxIter=100, regParam=0.0, tol=1e-6, rawPredictionCol="rawPrediction", \
fitIntercept=True, standardization=True, threshold=0.0, weightCol=None, \
aggregationDepth=2, maxBlockSizeInMB=0.0):
"""
super(LinearSVC, self).__init__()
self._java_obj = self._new_java_obj(
"org.apache.spark.ml.classification.LinearSVC", self.uid)
kwargs = self._input_kwargs
self.setParams(**kwargs)
@keyword_only
@since("2.2.0")
def setParams(self, *, featuresCol="features", labelCol="label", predictionCol="prediction",
maxIter=100, regParam=0.0, tol=1e-6, rawPredictionCol="rawPrediction",
fitIntercept=True, standardization=True, threshold=0.0, weightCol=None,
aggregationDepth=2, maxBlockSizeInMB=0.0):
"""
setParams(self, \\*, featuresCol="features", labelCol="label", predictionCol="prediction", \
maxIter=100, regParam=0.0, tol=1e-6, rawPredictionCol="rawPrediction", \
fitIntercept=True, standardization=True, threshold=0.0, weightCol=None, \
aggregationDepth=2, maxBlockSizeInMB=0.0):
Sets params for Linear SVM Classifier.
"""
kwargs = self._input_kwargs
return self._set(**kwargs)
def _create_model(self, java_model):
return LinearSVCModel(java_model)
@since("2.2.0")
def setMaxIter(self, value):
"""
Sets the value of :py:attr:`maxIter`.
"""
return self._set(maxIter=value)
@since("2.2.0")
def setRegParam(self, value):
"""
Sets the value of :py:attr:`regParam`.
"""
return self._set(regParam=value)
@since("2.2.0")
def setTol(self, value):
"""
Sets the value of :py:attr:`tol`.
"""
return self._set(tol=value)
@since("2.2.0")
def setFitIntercept(self, value):
"""
Sets the value of :py:attr:`fitIntercept`.
"""
return self._set(fitIntercept=value)
@since("2.2.0")
def setStandardization(self, value):
"""
Sets the value of :py:attr:`standardization`.
"""
return self._set(standardization=value)
@since("2.2.0")
def setThreshold(self, value):
"""
Sets the value of :py:attr:`threshold`.
"""
return self._set(threshold=value)
@since("2.2.0")
def setWeightCol(self, value):
"""
Sets the value of :py:attr:`weightCol`.
"""
return self._set(weightCol=value)
@since("2.2.0")
def setAggregationDepth(self, value):
"""
Sets the value of :py:attr:`aggregationDepth`.
"""
return self._set(aggregationDepth=value)
@since("3.1.0")
def setMaxBlockSizeInMB(self, value):
"""
Sets the value of :py:attr:`maxBlockSizeInMB`.
"""
return self._set(maxBlockSizeInMB=value)
class LinearSVCModel(_JavaClassificationModel, _LinearSVCParams, JavaMLWritable, JavaMLReadable,
HasTrainingSummary):
"""
Model fitted by LinearSVC.
.. versionadded:: 2.2.0
"""
@since("3.0.0")
def setThreshold(self, value):
"""
Sets the value of :py:attr:`threshold`.
"""
return self._set(threshold=value)
@property
@since("2.2.0")
def coefficients(self):
"""
Model coefficients of Linear SVM Classifier.
"""
return self._call_java("coefficients")
@property
@since("2.2.0")
def intercept(self):
"""
Model intercept of Linear SVM Classifier.
"""
return self._call_java("intercept")
@since("3.1.0")
def summary(self):
"""
Gets summary (e.g. accuracy/precision/recall, objective history, total iterations) of model
trained on the training set. An exception is thrown if `trainingSummary is None`.
"""
if self.hasSummary:
return LinearSVCTrainingSummary(super(LinearSVCModel, self).summary)
else:
raise RuntimeError("No training summary available for this %s" %
self.__class__.__name__)
def evaluate(self, dataset):
"""
Evaluates the model on a test dataset.
.. versionadded:: 3.1.0
Parameters
----------
dataset : :py:class:`pyspark.sql.DataFrame`
Test dataset to evaluate model on.
"""
if not isinstance(dataset, DataFrame):
raise ValueError("dataset must be a DataFrame but got %s." % type(dataset))
java_lsvc_summary = self._call_java("evaluate", dataset)
return LinearSVCSummary(java_lsvc_summary)
class LinearSVCSummary(_BinaryClassificationSummary):
"""
Abstraction for LinearSVC Results for a given model.
.. versionadded:: 3.1.0
"""
pass
@inherit_doc
class LinearSVCTrainingSummary(LinearSVCSummary, _TrainingSummary):
"""
Abstraction for LinearSVC Training results.
.. versionadded:: 3.1.0
"""
pass
class _LogisticRegressionParams(_ProbabilisticClassifierParams, HasRegParam,
HasElasticNetParam, HasMaxIter, HasFitIntercept, HasTol,
HasStandardization, HasWeightCol, HasAggregationDepth,
HasThreshold, HasMaxBlockSizeInMB):
"""
Params for :py:class:`LogisticRegression` and :py:class:`LogisticRegressionModel`.
.. versionadded:: 3.0.0
"""
threshold = Param(Params._dummy(), "threshold",
"Threshold in binary classification prediction, in range [0, 1]." +
" If threshold and thresholds are both set, they must match." +
"e.g. if threshold is p, then thresholds must be equal to [1-p, p].",
typeConverter=TypeConverters.toFloat)
family = Param(Params._dummy(), "family",
"The name of family which is a description of the label distribution to " +
"be used in the model. Supported options: auto, binomial, multinomial",
typeConverter=TypeConverters.toString)
lowerBoundsOnCoefficients = Param(Params._dummy(), "lowerBoundsOnCoefficients",
"The lower bounds on coefficients if fitting under bound "
"constrained optimization. The bound matrix must be "
"compatible with the shape "
"(1, number of features) for binomial regression, or "
"(number of classes, number of features) "
"for multinomial regression.",
typeConverter=TypeConverters.toMatrix)
upperBoundsOnCoefficients = Param(Params._dummy(), "upperBoundsOnCoefficients",
"The upper bounds on coefficients if fitting under bound "
"constrained optimization. The bound matrix must be "
"compatible with the shape "
"(1, number of features) for binomial regression, or "
"(number of classes, number of features) "
"for multinomial regression.",
typeConverter=TypeConverters.toMatrix)
lowerBoundsOnIntercepts = Param(Params._dummy(), "lowerBoundsOnIntercepts",
"The lower bounds on intercepts if fitting under bound "
"constrained optimization. The bounds vector size must be"
"equal with 1 for binomial regression, or the number of"
"lasses for multinomial regression.",
typeConverter=TypeConverters.toVector)
upperBoundsOnIntercepts = Param(Params._dummy(), "upperBoundsOnIntercepts",
"The upper bounds on intercepts if fitting under bound "
"constrained optimization. The bound vector size must be "
"equal with 1 for binomial regression, or the number of "
"classes for multinomial regression.",
typeConverter=TypeConverters.toVector)
def __init__(self, *args):
super(_LogisticRegressionParams, self).__init__(*args)
self._setDefault(maxIter=100, regParam=0.0, tol=1E-6, threshold=0.5, family="auto",
maxBlockSizeInMB=0.0)
@since("1.4.0")
def setThreshold(self, value):
"""
Sets the value of :py:attr:`threshold`.
Clears value of :py:attr:`thresholds` if it has been set.
"""
self._set(threshold=value)
self.clear(self.thresholds)
return self
@since("1.4.0")
def getThreshold(self):
"""
Get threshold for binary classification.
If :py:attr:`thresholds` is set with length 2 (i.e., binary classification),
this returns the equivalent threshold:
:math:`\\frac{1}{1 + \\frac{thresholds(0)}{thresholds(1)}}`.
Otherwise, returns :py:attr:`threshold` if set or its default value if unset.
"""
self._checkThresholdConsistency()
if self.isSet(self.thresholds):
ts = self.getOrDefault(self.thresholds)
if len(ts) != 2:
raise ValueError("Logistic Regression getThreshold only applies to" +
" binary classification, but thresholds has length != 2." +
" thresholds: " + ",".join(ts))
return 1.0/(1.0 + ts[0]/ts[1])
else:
return self.getOrDefault(self.threshold)
@since("1.5.0")
def setThresholds(self, value):
"""
Sets the value of :py:attr:`thresholds`.
Clears value of :py:attr:`threshold` if it has been set.
"""
self._set(thresholds=value)
self.clear(self.threshold)
return self
@since("1.5.0")
def getThresholds(self):
"""
If :py:attr:`thresholds` is set, return its value.
Otherwise, if :py:attr:`threshold` is set, return the equivalent thresholds for binary
classification: (1-threshold, threshold).
If neither are set, throw an error.
"""
self._checkThresholdConsistency()
if not self.isSet(self.thresholds) and self.isSet(self.threshold):
t = self.getOrDefault(self.threshold)
return [1.0-t, t]
else:
return self.getOrDefault(self.thresholds)
def _checkThresholdConsistency(self):
if self.isSet(self.threshold) and self.isSet(self.thresholds):
ts = self.getOrDefault(self.thresholds)
if len(ts) != 2:
raise ValueError("Logistic Regression getThreshold only applies to" +
" binary classification, but thresholds has length != 2." +
" thresholds: {0}".format(str(ts)))
t = 1.0/(1.0 + ts[0]/ts[1])
t2 = self.getOrDefault(self.threshold)
if abs(t2 - t) >= 1E-5:
raise ValueError("Logistic Regression getThreshold found inconsistent values for" +
" threshold (%g) and thresholds (equivalent to %g)" % (t2, t))
@since("2.1.0")
def getFamily(self):
"""
Gets the value of :py:attr:`family` or its default value.
"""
return self.getOrDefault(self.family)
@since("2.3.0")
def getLowerBoundsOnCoefficients(self):
"""
Gets the value of :py:attr:`lowerBoundsOnCoefficients`
"""
return self.getOrDefault(self.lowerBoundsOnCoefficients)
@since("2.3.0")
def getUpperBoundsOnCoefficients(self):
"""
Gets the value of :py:attr:`upperBoundsOnCoefficients`
"""
return self.getOrDefault(self.upperBoundsOnCoefficients)
@since("2.3.0")
def getLowerBoundsOnIntercepts(self):
"""
Gets the value of :py:attr:`lowerBoundsOnIntercepts`
"""
return self.getOrDefault(self.lowerBoundsOnIntercepts)
@since("2.3.0")
def getUpperBoundsOnIntercepts(self):
"""
Gets the value of :py:attr:`upperBoundsOnIntercepts`
"""
return self.getOrDefault(self.upperBoundsOnIntercepts)
@inherit_doc
class LogisticRegression(_JavaProbabilisticClassifier, _LogisticRegressionParams, JavaMLWritable,
JavaMLReadable):
"""
Logistic regression.
This class supports multinomial logistic (softmax) and binomial logistic regression.
.. versionadded:: 1.3.0
Examples
--------
>>> from pyspark.sql import Row
>>> from pyspark.ml.linalg import Vectors
>>> bdf = sc.parallelize([
... Row(label=1.0, weight=1.0, features=Vectors.dense(0.0, 5.0)),
... Row(label=0.0, weight=2.0, features=Vectors.dense(1.0, 2.0)),
... Row(label=1.0, weight=3.0, features=Vectors.dense(2.0, 1.0)),
... Row(label=0.0, weight=4.0, features=Vectors.dense(3.0, 3.0))]).toDF()
>>> blor = LogisticRegression(weightCol="weight")
>>> blor.getRegParam()
0.0
>>> blor.setRegParam(0.01)
LogisticRegression...
>>> blor.getRegParam()
0.01
>>> blor.setMaxIter(10)
LogisticRegression...
>>> blor.getMaxIter()
10
>>> blor.clear(blor.maxIter)
>>> blorModel = blor.fit(bdf)
>>> blorModel.setFeaturesCol("features")
LogisticRegressionModel...
>>> blorModel.setProbabilityCol("newProbability")
LogisticRegressionModel...
>>> blorModel.getProbabilityCol()
'newProbability'
>>> blorModel.getMaxBlockSizeInMB()
0.0
>>> blorModel.setThreshold(0.1)
LogisticRegressionModel...
>>> blorModel.getThreshold()
0.1
>>> blorModel.coefficients
DenseVector([-1.080..., -0.646...])
>>> blorModel.intercept
3.112...
>>> blorModel.evaluate(bdf).accuracy == blorModel.summary.accuracy
True
>>> data_path = "data/mllib/sample_multiclass_classification_data.txt"
>>> mdf = spark.read.format("libsvm").load(data_path)
>>> mlor = LogisticRegression(regParam=0.1, elasticNetParam=1.0, family="multinomial")
>>> mlorModel = mlor.fit(mdf)
>>> mlorModel.coefficientMatrix
SparseMatrix(3, 4, [0, 1, 2, 3], [3, 2, 1], [1.87..., -2.75..., -0.50...], 1)
>>> mlorModel.interceptVector
DenseVector([0.04..., -0.42..., 0.37...])
>>> test0 = sc.parallelize([Row(features=Vectors.dense(-1.0, 1.0))]).toDF()
>>> blorModel.predict(test0.head().features)
1.0
>>> blorModel.predictRaw(test0.head().features)
DenseVector([-3.54..., 3.54...])
>>> blorModel.predictProbability(test0.head().features)
DenseVector([0.028, 0.972])
>>> result = blorModel.transform(test0).head()
>>> result.prediction
1.0
>>> result.newProbability
DenseVector([0.02..., 0.97...])
>>> result.rawPrediction
DenseVector([-3.54..., 3.54...])
>>> test1 = sc.parallelize([Row(features=Vectors.sparse(2, [0], [1.0]))]).toDF()
>>> blorModel.transform(test1).head().prediction
1.0
>>> blor.setParams("vector")
Traceback (most recent call last):
...
TypeError: Method setParams forces keyword arguments.
>>> lr_path = temp_path + "/lr"
>>> blor.save(lr_path)
>>> lr2 = LogisticRegression.load(lr_path)
>>> lr2.getRegParam()
0.01
>>> model_path = temp_path + "/lr_model"
>>> blorModel.save(model_path)
>>> model2 = LogisticRegressionModel.load(model_path)
>>> blorModel.coefficients[0] == model2.coefficients[0]
True
>>> blorModel.intercept == model2.intercept
True
>>> model2
LogisticRegressionModel: uid=..., numClasses=2, numFeatures=2
>>> blorModel.transform(test0).take(1) == model2.transform(test0).take(1)
True
"""
@keyword_only
def __init__(self, *, featuresCol="features", labelCol="label", predictionCol="prediction",
maxIter=100, regParam=0.0, elasticNetParam=0.0, tol=1e-6, fitIntercept=True,
threshold=0.5, thresholds=None, probabilityCol="probability",
rawPredictionCol="rawPrediction", standardization=True, weightCol=None,
aggregationDepth=2, family="auto",
lowerBoundsOnCoefficients=None, upperBoundsOnCoefficients=None,
lowerBoundsOnIntercepts=None, upperBoundsOnIntercepts=None,
maxBlockSizeInMB=0.0):
"""
__init__(self, \\*, featuresCol="features", labelCol="label", predictionCol="prediction", \
maxIter=100, regParam=0.0, elasticNetParam=0.0, tol=1e-6, fitIntercept=True, \
threshold=0.5, thresholds=None, probabilityCol="probability", \
rawPredictionCol="rawPrediction", standardization=True, weightCol=None, \
aggregationDepth=2, family="auto", \
lowerBoundsOnCoefficients=None, upperBoundsOnCoefficients=None, \
lowerBoundsOnIntercepts=None, upperBoundsOnIntercepts=None, \
maxBlockSizeInMB=0.0):
If the threshold and thresholds Params are both set, they must be equivalent.
"""
super(LogisticRegression, self).__init__()
self._java_obj = self._new_java_obj(
"org.apache.spark.ml.classification.LogisticRegression", self.uid)
kwargs = self._input_kwargs
self.setParams(**kwargs)
self._checkThresholdConsistency()
@keyword_only
@since("1.3.0")
def setParams(self, *, featuresCol="features", labelCol="label", predictionCol="prediction",
maxIter=100, regParam=0.0, elasticNetParam=0.0, tol=1e-6, fitIntercept=True,
threshold=0.5, thresholds=None, probabilityCol="probability",
rawPredictionCol="rawPrediction", standardization=True, weightCol=None,
aggregationDepth=2, family="auto",
lowerBoundsOnCoefficients=None, upperBoundsOnCoefficients=None,
lowerBoundsOnIntercepts=None, upperBoundsOnIntercepts=None,
maxBlockSizeInMB=0.0):
"""
setParams(self, \\*, featuresCol="features", labelCol="label", predictionCol="prediction", \
maxIter=100, regParam=0.0, elasticNetParam=0.0, tol=1e-6, fitIntercept=True, \
threshold=0.5, thresholds=None, probabilityCol="probability", \
rawPredictionCol="rawPrediction", standardization=True, weightCol=None, \
aggregationDepth=2, family="auto", \
lowerBoundsOnCoefficients=None, upperBoundsOnCoefficients=None, \
lowerBoundsOnIntercepts=None, upperBoundsOnIntercepts=None, \
maxBlockSizeInMB=0.0):
Sets params for logistic regression.
If the threshold and thresholds Params are both set, they must be equivalent.
"""
kwargs = self._input_kwargs
self._set(**kwargs)
self._checkThresholdConsistency()
return self
def _create_model(self, java_model):
return LogisticRegressionModel(java_model)
@since("2.1.0")
def setFamily(self, value):
"""
Sets the value of :py:attr:`family`.
"""
return self._set(family=value)
@since("2.3.0")
def setLowerBoundsOnCoefficients(self, value):
"""
Sets the value of :py:attr:`lowerBoundsOnCoefficients`
"""
return self._set(lowerBoundsOnCoefficients=value)
@since("2.3.0")
def setUpperBoundsOnCoefficients(self, value):
"""
Sets the value of :py:attr:`upperBoundsOnCoefficients`
"""
return self._set(upperBoundsOnCoefficients=value)
@since("2.3.0")
def setLowerBoundsOnIntercepts(self, value):
"""
Sets the value of :py:attr:`lowerBoundsOnIntercepts`
"""
return self._set(lowerBoundsOnIntercepts=value)
@since("2.3.0")
def setUpperBoundsOnIntercepts(self, value):
"""
Sets the value of :py:attr:`upperBoundsOnIntercepts`
"""
return self._set(upperBoundsOnIntercepts=value)
def setMaxIter(self, value):
"""
Sets the value of :py:attr:`maxIter`.
"""
return self._set(maxIter=value)
def setRegParam(self, value):
"""
Sets the value of :py:attr:`regParam`.
"""
return self._set(regParam=value)
def setTol(self, value):
"""
Sets the value of :py:attr:`tol`.
"""
return self._set(tol=value)
def setElasticNetParam(self, value):
"""
Sets the value of :py:attr:`elasticNetParam`.
"""
return self._set(elasticNetParam=value)
def setFitIntercept(self, value):
"""
Sets the value of :py:attr:`fitIntercept`.
"""
return self._set(fitIntercept=value)
def setStandardization(self, value):
"""
Sets the value of :py:attr:`standardization`.
"""
return self._set(standardization=value)
def setWeightCol(self, value):
"""
Sets the value of :py:attr:`weightCol`.
"""
return self._set(weightCol=value)
def setAggregationDepth(self, value):
"""
Sets the value of :py:attr:`aggregationDepth`.
"""
return self._set(aggregationDepth=value)
@since("3.1.0")
def setMaxBlockSizeInMB(self, value):
"""
Sets the value of :py:attr:`maxBlockSizeInMB`.
"""
return self._set(maxBlockSizeInMB=value)
class LogisticRegressionModel(_JavaProbabilisticClassificationModel, _LogisticRegressionParams,
JavaMLWritable, JavaMLReadable, HasTrainingSummary):
"""
Model fitted by LogisticRegression.
.. versionadded:: 1.3.0
"""
@property
@since("2.0.0")
def coefficients(self):
"""
Model coefficients of binomial logistic regression.
An exception is thrown in the case of multinomial logistic regression.
"""
return self._call_java("coefficients")
@property
@since("1.4.0")
def intercept(self):
"""
Model intercept of binomial logistic regression.
An exception is thrown in the case of multinomial logistic regression.
"""
return self._call_java("intercept")
@property
@since("2.1.0")
def coefficientMatrix(self):
"""
Model coefficients.
"""
return self._call_java("coefficientMatrix")
@property
@since("2.1.0")
def interceptVector(self):
"""
Model intercept.
"""
return self._call_java("interceptVector")
@property
@since("2.0.0")
def summary(self):
"""
Gets summary (e.g. accuracy/precision/recall, objective history, total iterations) of model
trained on the training set. An exception is thrown if `trainingSummary is None`.
"""
if self.hasSummary:
if self.numClasses <= 2:
return BinaryLogisticRegressionTrainingSummary(super(LogisticRegressionModel,
self).summary)
else:
return LogisticRegressionTrainingSummary(super(LogisticRegressionModel,
self).summary)
else:
raise RuntimeError("No training summary available for this %s" %
self.__class__.__name__)
def evaluate(self, dataset):
"""
Evaluates the model on a test dataset.
.. versionadded:: 2.0.0
Parameters
----------
dataset : :py:class:`pyspark.sql.DataFrame`
Test dataset to evaluate model on.
"""
if not isinstance(dataset, DataFrame):
raise ValueError("dataset must be a DataFrame but got %s." % type(dataset))
java_blr_summary = self._call_java("evaluate", dataset)
if self.numClasses <= 2:
return BinaryLogisticRegressionSummary(java_blr_summary)
else:
return LogisticRegressionSummary(java_blr_summary)
class LogisticRegressionSummary(_ClassificationSummary):
"""
Abstraction for Logistic Regression Results for a given model.
.. versionadded:: 2.0.0
"""
@property
@since("2.0.0")
def probabilityCol(self):
"""
Field in "predictions" which gives the probability
of each class as a vector.
"""
return self._call_java("probabilityCol")
@property
@since("2.0.0")
def featuresCol(self):
"""
Field in "predictions" which gives the features of each instance
as a vector.
"""
return self._call_java("featuresCol")
@inherit_doc
class LogisticRegressionTrainingSummary(LogisticRegressionSummary, _TrainingSummary):
"""
Abstraction for multinomial Logistic Regression Training results.
.. versionadded:: 2.0.0
"""
pass
@inherit_doc
class BinaryLogisticRegressionSummary(_BinaryClassificationSummary,
LogisticRegressionSummary):
"""
Binary Logistic regression results for a given model.
.. versionadded:: 2.0.0
"""
pass
@inherit_doc
class BinaryLogisticRegressionTrainingSummary(BinaryLogisticRegressionSummary,
LogisticRegressionTrainingSummary):
"""
Binary Logistic regression training results for a given model.
.. versionadded:: 2.0.0
"""
pass
@inherit_doc
class _DecisionTreeClassifierParams(_DecisionTreeParams, _TreeClassifierParams):
"""
Params for :py:class:`DecisionTreeClassifier` and :py:class:`DecisionTreeClassificationModel`.
"""
def __init__(self, *args):
super(_DecisionTreeClassifierParams, self).__init__(*args)
self._setDefault(maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10,
impurity="gini", leafCol="", minWeightFractionPerNode=0.0)
@inherit_doc
class DecisionTreeClassifier(_JavaProbabilisticClassifier, _DecisionTreeClassifierParams,
JavaMLWritable, JavaMLReadable):
"""
`Decision tree <http://en.wikipedia.org/wiki/Decision_tree_learning>`_
learning algorithm for classification.
It supports both binary and multiclass labels, as well as both continuous and categorical
features.
.. versionadded:: 1.4.0
Examples
--------
>>> from pyspark.ml.linalg import Vectors
>>> from pyspark.ml.feature import StringIndexer
>>> df = spark.createDataFrame([
... (1.0, Vectors.dense(1.0)),
... (0.0, Vectors.sparse(1, [], []))], ["label", "features"])
>>> stringIndexer = StringIndexer(inputCol="label", outputCol="indexed")
>>> si_model = stringIndexer.fit(df)
>>> td = si_model.transform(df)
>>> dt = DecisionTreeClassifier(maxDepth=2, labelCol="indexed", leafCol="leafId")
>>> model = dt.fit(td)
>>> model.getLabelCol()
'indexed'
>>> model.setFeaturesCol("features")
DecisionTreeClassificationModel...
>>> model.numNodes
3
>>> model.depth
1
>>> model.featureImportances
SparseVector(1, {0: 1.0})
>>> model.numFeatures
1
>>> model.numClasses
2
>>> print(model.toDebugString)
DecisionTreeClassificationModel...depth=1, numNodes=3...
>>> test0 = spark.createDataFrame([(Vectors.dense(-1.0),)], ["features"])
>>> model.predict(test0.head().features)
0.0
>>> model.predictRaw(test0.head().features)
DenseVector([1.0, 0.0])
>>> model.predictProbability(test0.head().features)
DenseVector([1.0, 0.0])
>>> result = model.transform(test0).head()
>>> result.prediction
0.0
>>> result.probability
DenseVector([1.0, 0.0])
>>> result.rawPrediction
DenseVector([1.0, 0.0])
>>> result.leafId
0.0
>>> test1 = spark.createDataFrame([(Vectors.sparse(1, [0], [1.0]),)], ["features"])
>>> model.transform(test1).head().prediction
1.0
>>> dtc_path = temp_path + "/dtc"
>>> dt.save(dtc_path)
>>> dt2 = DecisionTreeClassifier.load(dtc_path)
>>> dt2.getMaxDepth()
2
>>> model_path = temp_path + "/dtc_model"
>>> model.save(model_path)
>>> model2 = DecisionTreeClassificationModel.load(model_path)
>>> model.featureImportances == model2.featureImportances
True
>>> model.transform(test0).take(1) == model2.transform(test0).take(1)
True
>>> df3 = spark.createDataFrame([
... (1.0, 0.2, Vectors.dense(1.0)),
... (1.0, 0.8, Vectors.dense(1.0)),
... (0.0, 1.0, Vectors.sparse(1, [], []))], ["label", "weight", "features"])
>>> si3 = StringIndexer(inputCol="label", outputCol="indexed")
>>> si_model3 = si3.fit(df3)
>>> td3 = si_model3.transform(df3)
>>> dt3 = DecisionTreeClassifier(maxDepth=2, weightCol="weight", labelCol="indexed")
>>> model3 = dt3.fit(td3)
>>> print(model3.toDebugString)
DecisionTreeClassificationModel...depth=1, numNodes=3...
"""
@keyword_only
def __init__(self, *, featuresCol="features", labelCol="label", predictionCol="prediction",
probabilityCol="probability", rawPredictionCol="rawPrediction",
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, impurity="gini",
seed=None, weightCol=None, leafCol="", minWeightFractionPerNode=0.0):
"""
__init__(self, \\*, featuresCol="features", labelCol="label", predictionCol="prediction", \
probabilityCol="probability", rawPredictionCol="rawPrediction", \
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0, \
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, impurity="gini", \
seed=None, weightCol=None, leafCol="", minWeightFractionPerNode=0.0)
"""
super(DecisionTreeClassifier, self).__init__()
self._java_obj = self._new_java_obj(
"org.apache.spark.ml.classification.DecisionTreeClassifier", self.uid)
kwargs = self._input_kwargs
self.setParams(**kwargs)
@keyword_only
@since("1.4.0")
def setParams(self, *, featuresCol="features", labelCol="label", predictionCol="prediction",
probabilityCol="probability", rawPredictionCol="rawPrediction",
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10,
impurity="gini", seed=None, weightCol=None, leafCol="",
minWeightFractionPerNode=0.0):
"""
setParams(self, \\*, featuresCol="features", labelCol="label", predictionCol="prediction", \
probabilityCol="probability", rawPredictionCol="rawPrediction", \
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0, \
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, impurity="gini", \
seed=None, weightCol=None, leafCol="", minWeightFractionPerNode=0.0)
Sets params for the DecisionTreeClassifier.
"""
kwargs = self._input_kwargs
return self._set(**kwargs)
def _create_model(self, java_model):
return DecisionTreeClassificationModel(java_model)
def setMaxDepth(self, value):
"""
Sets the value of :py:attr:`maxDepth`.
"""
return self._set(maxDepth=value)
def setMaxBins(self, value):
"""
Sets the value of :py:attr:`maxBins`.
"""
return self._set(maxBins=value)
def setMinInstancesPerNode(self, value):
"""
Sets the value of :py:attr:`minInstancesPerNode`.
"""
return self._set(minInstancesPerNode=value)
@since("3.0.0")
def setMinWeightFractionPerNode(self, value):
"""
Sets the value of :py:attr:`minWeightFractionPerNode`.
"""
return self._set(minWeightFractionPerNode=value)
def setMinInfoGain(self, value):
"""
Sets the value of :py:attr:`minInfoGain`.
"""
return self._set(minInfoGain=value)
def setMaxMemoryInMB(self, value):
"""
Sets the value of :py:attr:`maxMemoryInMB`.
"""
return self._set(maxMemoryInMB=value)
def setCacheNodeIds(self, value):
"""
Sets the value of :py:attr:`cacheNodeIds`.
"""
return self._set(cacheNodeIds=value)
@since("1.4.0")
def setImpurity(self, value):
"""
Sets the value of :py:attr:`impurity`.
"""
return self._set(impurity=value)
@since("1.4.0")
def setCheckpointInterval(self, value):
"""
Sets the value of :py:attr:`checkpointInterval`.
"""
return self._set(checkpointInterval=value)
def setSeed(self, value):
"""
Sets the value of :py:attr:`seed`.
"""
return self._set(seed=value)
@since("3.0.0")
def setWeightCol(self, value):
"""
Sets the value of :py:attr:`weightCol`.
"""
return self._set(weightCol=value)
@inherit_doc
class DecisionTreeClassificationModel(_DecisionTreeModel, _JavaProbabilisticClassificationModel,
_DecisionTreeClassifierParams, JavaMLWritable,
JavaMLReadable):
"""
Model fitted by DecisionTreeClassifier.
.. versionadded:: 1.4.0
"""
@property
def featureImportances(self):
"""
Estimate of the importance of each feature.
This generalizes the idea of "Gini" importance to other losses,
following the explanation of Gini importance from "Random Forests" documentation
by Leo Breiman and Adele Cutler, and following the implementation from scikit-learn.
This feature importance is calculated as follows:
- importance(feature j) = sum (over nodes which split on feature j) of the gain,
where gain is scaled by the number of instances passing through node
- Normalize importances for tree to sum to 1.
.. versionadded:: 2.0.0
Notes
-----
Feature importance for single decision trees can have high variance due to
correlated predictor variables. Consider using a :py:class:`RandomForestClassifier`
to determine feature importance instead.
"""
return self._call_java("featureImportances")
@inherit_doc
class _RandomForestClassifierParams(_RandomForestParams, _TreeClassifierParams):
"""
Params for :py:class:`RandomForestClassifier` and :py:class:`RandomForestClassificationModel`.
"""
def __init__(self, *args):
super(_RandomForestClassifierParams, self).__init__(*args)
self._setDefault(maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10,
impurity="gini", numTrees=20, featureSubsetStrategy="auto",
subsamplingRate=1.0, leafCol="", minWeightFractionPerNode=0.0,
bootstrap=True)
@inherit_doc
class RandomForestClassifier(_JavaProbabilisticClassifier, _RandomForestClassifierParams,
JavaMLWritable, JavaMLReadable):
"""
`Random Forest <http://en.wikipedia.org/wiki/Random_forest>`_
learning algorithm for classification.
It supports both binary and multiclass labels, as well as both continuous and categorical
features.
.. versionadded:: 1.4.0
Examples
--------
>>> import numpy
>>> from numpy import allclose
>>> from pyspark.ml.linalg import Vectors
>>> from pyspark.ml.feature import StringIndexer
>>> df = spark.createDataFrame([
... (1.0, Vectors.dense(1.0)),
... (0.0, Vectors.sparse(1, [], []))], ["label", "features"])
>>> stringIndexer = StringIndexer(inputCol="label", outputCol="indexed")
>>> si_model = stringIndexer.fit(df)
>>> td = si_model.transform(df)
>>> rf = RandomForestClassifier(numTrees=3, maxDepth=2, labelCol="indexed", seed=42,
... leafCol="leafId")
>>> rf.getMinWeightFractionPerNode()
0.0
>>> model = rf.fit(td)
>>> model.getLabelCol()
'indexed'
>>> model.setFeaturesCol("features")
RandomForestClassificationModel...
>>> model.setRawPredictionCol("newRawPrediction")
RandomForestClassificationModel...
>>> model.getBootstrap()
True
>>> model.getRawPredictionCol()
'newRawPrediction'
>>> model.featureImportances
SparseVector(1, {0: 1.0})
>>> allclose(model.treeWeights, [1.0, 1.0, 1.0])
True
>>> test0 = spark.createDataFrame([(Vectors.dense(-1.0),)], ["features"])
>>> model.predict(test0.head().features)
0.0
>>> model.predictRaw(test0.head().features)
DenseVector([2.0, 0.0])
>>> model.predictProbability(test0.head().features)
DenseVector([1.0, 0.0])
>>> result = model.transform(test0).head()
>>> result.prediction
0.0
>>> numpy.argmax(result.probability)
0
>>> numpy.argmax(result.newRawPrediction)
0
>>> result.leafId
DenseVector([0.0, 0.0, 0.0])
>>> test1 = spark.createDataFrame([(Vectors.sparse(1, [0], [1.0]),)], ["features"])
>>> model.transform(test1).head().prediction
1.0
>>> model.trees
[DecisionTreeClassificationModel...depth=..., DecisionTreeClassificationModel...]
>>> rfc_path = temp_path + "/rfc"
>>> rf.save(rfc_path)
>>> rf2 = RandomForestClassifier.load(rfc_path)
>>> rf2.getNumTrees()
3
>>> model_path = temp_path + "/rfc_model"
>>> model.save(model_path)
>>> model2 = RandomForestClassificationModel.load(model_path)
>>> model.featureImportances == model2.featureImportances
True
>>> model.transform(test0).take(1) == model2.transform(test0).take(1)
True
"""
@keyword_only
def __init__(self, *, featuresCol="features", labelCol="label", predictionCol="prediction",
probabilityCol="probability", rawPredictionCol="rawPrediction",
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, impurity="gini",
numTrees=20, featureSubsetStrategy="auto", seed=None, subsamplingRate=1.0,
leafCol="", minWeightFractionPerNode=0.0, weightCol=None, bootstrap=True):
"""
__init__(self, \\*, featuresCol="features", labelCol="label", predictionCol="prediction", \
probabilityCol="probability", rawPredictionCol="rawPrediction", \
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0, \
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, impurity="gini", \
numTrees=20, featureSubsetStrategy="auto", seed=None, subsamplingRate=1.0, \
leafCol="", minWeightFractionPerNode=0.0, weightCol=None, bootstrap=True)
"""
super(RandomForestClassifier, self).__init__()
self._java_obj = self._new_java_obj(
"org.apache.spark.ml.classification.RandomForestClassifier", self.uid)
kwargs = self._input_kwargs
self.setParams(**kwargs)
@keyword_only
@since("1.4.0")
def setParams(self, *, featuresCol="features", labelCol="label", predictionCol="prediction",
probabilityCol="probability", rawPredictionCol="rawPrediction",
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, seed=None,
impurity="gini", numTrees=20, featureSubsetStrategy="auto", subsamplingRate=1.0,
leafCol="", minWeightFractionPerNode=0.0, weightCol=None, bootstrap=True):
"""
setParams(self, featuresCol="features", labelCol="label", predictionCol="prediction", \
probabilityCol="probability", rawPredictionCol="rawPrediction", \
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0, \
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, seed=None, \
impurity="gini", numTrees=20, featureSubsetStrategy="auto", subsamplingRate=1.0, \
leafCol="", minWeightFractionPerNode=0.0, weightCol=None, bootstrap=True)
Sets params for linear classification.
"""
kwargs = self._input_kwargs
return self._set(**kwargs)
def _create_model(self, java_model):
return RandomForestClassificationModel(java_model)
def setMaxDepth(self, value):
"""
Sets the value of :py:attr:`maxDepth`.
"""
return self._set(maxDepth=value)
def setMaxBins(self, value):
"""
Sets the value of :py:attr:`maxBins`.
"""
return self._set(maxBins=value)
def setMinInstancesPerNode(self, value):
"""
Sets the value of :py:attr:`minInstancesPerNode`.
"""
return self._set(minInstancesPerNode=value)
def setMinInfoGain(self, value):
"""
Sets the value of :py:attr:`minInfoGain`.
"""
return self._set(minInfoGain=value)
def setMaxMemoryInMB(self, value):
"""
Sets the value of :py:attr:`maxMemoryInMB`.
"""
return self._set(maxMemoryInMB=value)
def setCacheNodeIds(self, value):
"""
Sets the value of :py:attr:`cacheNodeIds`.
"""
return self._set(cacheNodeIds=value)
@since("1.4.0")
def setImpurity(self, value):
"""
Sets the value of :py:attr:`impurity`.
"""
return self._set(impurity=value)
@since("1.4.0")
def setNumTrees(self, value):
"""
Sets the value of :py:attr:`numTrees`.
"""
return self._set(numTrees=value)
@since("3.0.0")
def setBootstrap(self, value):
"""
Sets the value of :py:attr:`bootstrap`.
"""
return self._set(bootstrap=value)
@since("1.4.0")
def setSubsamplingRate(self, value):
"""
Sets the value of :py:attr:`subsamplingRate`.
"""
return self._set(subsamplingRate=value)
@since("2.4.0")
def setFeatureSubsetStrategy(self, value):
"""
Sets the value of :py:attr:`featureSubsetStrategy`.
"""
return self._set(featureSubsetStrategy=value)
def setSeed(self, value):
"""
Sets the value of :py:attr:`seed`.
"""
return self._set(seed=value)
def setCheckpointInterval(self, value):
"""
Sets the value of :py:attr:`checkpointInterval`.
"""
return self._set(checkpointInterval=value)
@since("3.0.0")
def setWeightCol(self, value):
"""
Sets the value of :py:attr:`weightCol`.
"""
return self._set(weightCol=value)
@since("3.0.0")
def setMinWeightFractionPerNode(self, value):
"""
Sets the value of :py:attr:`minWeightFractionPerNode`.
"""
return self._set(minWeightFractionPerNode=value)
class RandomForestClassificationModel(_TreeEnsembleModel, _JavaProbabilisticClassificationModel,
_RandomForestClassifierParams, JavaMLWritable,
JavaMLReadable, HasTrainingSummary):
"""
Model fitted by RandomForestClassifier.
.. versionadded:: 1.4.0
"""
@property
def featureImportances(self):
"""
Estimate of the importance of each feature.
Each feature's importance is the average of its importance across all trees in the ensemble
The importance vector is normalized to sum to 1. This method is suggested by Hastie et al.
(Hastie, Tibshirani, Friedman. "The Elements of Statistical Learning, 2nd Edition." 2001.)
and follows the implementation from scikit-learn.
.. versionadded:: 2.0.0
See Also
--------
DecisionTreeClassificationModel.featureImportances
"""
return self._call_java("featureImportances")
@property
@since("2.0.0")
def trees(self):
"""Trees in this ensemble. Warning: These have null parent Estimators."""
return [DecisionTreeClassificationModel(m) for m in list(self._call_java("trees"))]
@property
@since("3.1.0")
def summary(self):
"""
Gets summary (e.g. accuracy/precision/recall, objective history, total iterations) of model
trained on the training set. An exception is thrown if `trainingSummary is None`.
"""
if self.hasSummary:
if self.numClasses <= 2:
return BinaryRandomForestClassificationTrainingSummary(
super(RandomForestClassificationModel, self).summary)
else:
return RandomForestClassificationTrainingSummary(
super(RandomForestClassificationModel, self).summary)
else:
raise RuntimeError("No training summary available for this %s" %
self.__class__.__name__)
def evaluate(self, dataset):
"""
Evaluates the model on a test dataset.
.. versionadded:: 3.1.0
Parameters
----------
dataset : :py:class:`pyspark.sql.DataFrame`
Test dataset to evaluate model on.
"""
if not isinstance(dataset, DataFrame):
raise ValueError("dataset must be a DataFrame but got %s." % type(dataset))
java_rf_summary = self._call_java("evaluate", dataset)
if self.numClasses <= 2:
return BinaryRandomForestClassificationSummary(java_rf_summary)
else:
return RandomForestClassificationSummary(java_rf_summary)
class RandomForestClassificationSummary(_ClassificationSummary):
"""
Abstraction for RandomForestClassification Results for a given model.
.. versionadded:: 3.1.0
"""
pass
@inherit_doc
class RandomForestClassificationTrainingSummary(RandomForestClassificationSummary,
_TrainingSummary):
"""
Abstraction for RandomForestClassificationTraining Training results.
.. versionadded:: 3.1.0
"""
pass
@inherit_doc
class BinaryRandomForestClassificationSummary(_BinaryClassificationSummary):
"""
BinaryRandomForestClassification results for a given model.
.. versionadded:: 3.1.0
"""
pass
@inherit_doc
class BinaryRandomForestClassificationTrainingSummary(BinaryRandomForestClassificationSummary,
RandomForestClassificationTrainingSummary):
"""
BinaryRandomForestClassification training results for a given model.
.. versionadded:: 3.1.0
"""
pass
class _GBTClassifierParams(_GBTParams, _HasVarianceImpurity):
"""
Params for :py:class:`GBTClassifier` and :py:class:`GBTClassifierModel`.
.. versionadded:: 3.0.0
"""
supportedLossTypes = ["logistic"]
lossType = Param(Params._dummy(), "lossType",
"Loss function which GBT tries to minimize (case-insensitive). " +
"Supported options: " + ", ".join(supportedLossTypes),
typeConverter=TypeConverters.toString)
def __init__(self, *args):
super(_GBTClassifierParams, self).__init__(*args)
self._setDefault(maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10,
lossType="logistic", maxIter=20, stepSize=0.1, subsamplingRate=1.0,
impurity="variance", featureSubsetStrategy="all", validationTol=0.01,
leafCol="", minWeightFractionPerNode=0.0)
@since("1.4.0")
def getLossType(self):
"""
Gets the value of lossType or its default value.
"""
return self.getOrDefault(self.lossType)
@inherit_doc
class GBTClassifier(_JavaProbabilisticClassifier, _GBTClassifierParams,
JavaMLWritable, JavaMLReadable):
"""
`Gradient-Boosted Trees (GBTs) <http://en.wikipedia.org/wiki/Gradient_boosting>`_
learning algorithm for classification.
It supports binary labels, as well as both continuous and categorical features.
.. versionadded:: 1.4.0
Notes
-----
Multiclass labels are not currently supported.
The implementation is based upon: J.H. Friedman. "Stochastic Gradient Boosting." 1999.
Gradient Boosting vs. TreeBoost:
- This implementation is for Stochastic Gradient Boosting, not for TreeBoost.
- Both algorithms learn tree ensembles by minimizing loss functions.
- TreeBoost (Friedman, 1999) additionally modifies the outputs at tree leaf nodes
based on the loss function, whereas the original gradient boosting method does not.
- We expect to implement TreeBoost in the future:
`SPARK-4240 <https://issues.apache.org/jira/browse/SPARK-4240>`_
Examples
--------
>>> from numpy import allclose
>>> from pyspark.ml.linalg import Vectors
>>> from pyspark.ml.feature import StringIndexer
>>> df = spark.createDataFrame([
... (1.0, Vectors.dense(1.0)),
... (0.0, Vectors.sparse(1, [], []))], ["label", "features"])
>>> stringIndexer = StringIndexer(inputCol="label", outputCol="indexed")
>>> si_model = stringIndexer.fit(df)
>>> td = si_model.transform(df)
>>> gbt = GBTClassifier(maxIter=5, maxDepth=2, labelCol="indexed", seed=42,
... leafCol="leafId")
>>> gbt.setMaxIter(5)
GBTClassifier...
>>> gbt.setMinWeightFractionPerNode(0.049)
GBTClassifier...
>>> gbt.getMaxIter()
5
>>> gbt.getFeatureSubsetStrategy()
'all'
>>> model = gbt.fit(td)
>>> model.getLabelCol()
'indexed'
>>> model.setFeaturesCol("features")
GBTClassificationModel...
>>> model.setThresholds([0.3, 0.7])
GBTClassificationModel...
>>> model.getThresholds()
[0.3, 0.7]
>>> model.featureImportances
SparseVector(1, {0: 1.0})
>>> allclose(model.treeWeights, [1.0, 0.1, 0.1, 0.1, 0.1])
True
>>> test0 = spark.createDataFrame([(Vectors.dense(-1.0),)], ["features"])
>>> model.predict(test0.head().features)
0.0
>>> model.predictRaw(test0.head().features)
DenseVector([1.1697, -1.1697])
>>> model.predictProbability(test0.head().features)
DenseVector([0.9121, 0.0879])
>>> result = model.transform(test0).head()
>>> result.prediction
0.0
>>> result.leafId
DenseVector([0.0, 0.0, 0.0, 0.0, 0.0])
>>> test1 = spark.createDataFrame([(Vectors.sparse(1, [0], [1.0]),)], ["features"])
>>> model.transform(test1).head().prediction
1.0
>>> model.totalNumNodes
15
>>> print(model.toDebugString)
GBTClassificationModel...numTrees=5...
>>> gbtc_path = temp_path + "gbtc"
>>> gbt.save(gbtc_path)
>>> gbt2 = GBTClassifier.load(gbtc_path)
>>> gbt2.getMaxDepth()
2
>>> model_path = temp_path + "gbtc_model"
>>> model.save(model_path)
>>> model2 = GBTClassificationModel.load(model_path)
>>> model.featureImportances == model2.featureImportances
True
>>> model.treeWeights == model2.treeWeights
True
>>> model.transform(test0).take(1) == model2.transform(test0).take(1)
True
>>> model.trees
[DecisionTreeRegressionModel...depth=..., DecisionTreeRegressionModel...]
>>> validation = spark.createDataFrame([(0.0, Vectors.dense(-1.0),)],
... ["indexed", "features"])
>>> model.evaluateEachIteration(validation)
[0.25..., 0.23..., 0.21..., 0.19..., 0.18...]
>>> model.numClasses
2
>>> gbt = gbt.setValidationIndicatorCol("validationIndicator")
>>> gbt.getValidationIndicatorCol()
'validationIndicator'
>>> gbt.getValidationTol()
0.01
"""
@keyword_only
def __init__(self, *, featuresCol="features", labelCol="label", predictionCol="prediction",
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, lossType="logistic",
maxIter=20, stepSize=0.1, seed=None, subsamplingRate=1.0, impurity="variance",
featureSubsetStrategy="all", validationTol=0.01, validationIndicatorCol=None,
leafCol="", minWeightFractionPerNode=0.0, weightCol=None):
"""
__init__(self, \\*, featuresCol="features", labelCol="label", predictionCol="prediction", \
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0, \
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, \
lossType="logistic", maxIter=20, stepSize=0.1, seed=None, subsamplingRate=1.0, \
impurity="variance", featureSubsetStrategy="all", validationTol=0.01, \
validationIndicatorCol=None, leafCol="", minWeightFractionPerNode=0.0, \
weightCol=None)
"""
super(GBTClassifier, self).__init__()
self._java_obj = self._new_java_obj(
"org.apache.spark.ml.classification.GBTClassifier", self.uid)
kwargs = self._input_kwargs
self.setParams(**kwargs)
@keyword_only
@since("1.4.0")
def setParams(self, *, featuresCol="features", labelCol="label", predictionCol="prediction",
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10,
lossType="logistic", maxIter=20, stepSize=0.1, seed=None, subsamplingRate=1.0,
impurity="variance", featureSubsetStrategy="all", validationTol=0.01,
validationIndicatorCol=None, leafCol="", minWeightFractionPerNode=0.0,
weightCol=None):
"""
setParams(self, \\*, featuresCol="features", labelCol="label", predictionCol="prediction", \
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0, \
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, \
lossType="logistic", maxIter=20, stepSize=0.1, seed=None, subsamplingRate=1.0, \
impurity="variance", featureSubsetStrategy="all", validationTol=0.01, \
validationIndicatorCol=None, leafCol="", minWeightFractionPerNode=0.0, \
weightCol=None)
Sets params for Gradient Boosted Tree Classification.
"""
kwargs = self._input_kwargs
return self._set(**kwargs)
def _create_model(self, java_model):
return GBTClassificationModel(java_model)
def setMaxDepth(self, value):
"""
Sets the value of :py:attr:`maxDepth`.
"""
return self._set(maxDepth=value)
def setMaxBins(self, value):
"""
Sets the value of :py:attr:`maxBins`.
"""
return self._set(maxBins=value)
def setMinInstancesPerNode(self, value):
"""
Sets the value of :py:attr:`minInstancesPerNode`.
"""
return self._set(minInstancesPerNode=value)
def setMinInfoGain(self, value):
"""
Sets the value of :py:attr:`minInfoGain`.
"""
return self._set(minInfoGain=value)
def setMaxMemoryInMB(self, value):
"""
Sets the value of :py:attr:`maxMemoryInMB`.
"""
return self._set(maxMemoryInMB=value)
def setCacheNodeIds(self, value):
"""
Sets the value of :py:attr:`cacheNodeIds`.
"""
return self._set(cacheNodeIds=value)
@since("1.4.0")
def setImpurity(self, value):
"""
Sets the value of :py:attr:`impurity`.
"""
return self._set(impurity=value)
@since("1.4.0")
def setLossType(self, value):
"""
Sets the value of :py:attr:`lossType`.
"""
return self._set(lossType=value)
@since("1.4.0")
def setSubsamplingRate(self, value):
"""
Sets the value of :py:attr:`subsamplingRate`.
"""
return self._set(subsamplingRate=value)
@since("2.4.0")
def setFeatureSubsetStrategy(self, value):
"""
Sets the value of :py:attr:`featureSubsetStrategy`.
"""
return self._set(featureSubsetStrategy=value)
@since("3.0.0")
def setValidationIndicatorCol(self, value):
"""
Sets the value of :py:attr:`validationIndicatorCol`.
"""
return self._set(validationIndicatorCol=value)
@since("1.4.0")
def setMaxIter(self, value):
"""
Sets the value of :py:attr:`maxIter`.
"""
return self._set(maxIter=value)
@since("1.4.0")
def setCheckpointInterval(self, value):
"""
Sets the value of :py:attr:`checkpointInterval`.
"""
return self._set(checkpointInterval=value)
@since("1.4.0")
def setSeed(self, value):
"""
Sets the value of :py:attr:`seed`.
"""
return self._set(seed=value)
@since("1.4.0")
def setStepSize(self, value):
"""
Sets the value of :py:attr:`stepSize`.
"""
return self._set(stepSize=value)
@since("3.0.0")
def setWeightCol(self, value):
"""
Sets the value of :py:attr:`weightCol`.
"""
return self._set(weightCol=value)
@since("3.0.0")
def setMinWeightFractionPerNode(self, value):
"""
Sets the value of :py:attr:`minWeightFractionPerNode`.
"""
return self._set(minWeightFractionPerNode=value)
class GBTClassificationModel(_TreeEnsembleModel, _JavaProbabilisticClassificationModel,
_GBTClassifierParams, JavaMLWritable, JavaMLReadable):
"""
Model fitted by GBTClassifier.
.. versionadded:: 1.4.0
"""
@property
def featureImportances(self):
"""
Estimate of the importance of each feature.
Each feature's importance is the average of its importance across all trees in the ensemble
The importance vector is normalized to sum to 1. This method is suggested by Hastie et al.
(Hastie, Tibshirani, Friedman. "The Elements of Statistical Learning, 2nd Edition." 2001.)
and follows the implementation from scikit-learn.
.. versionadded:: 2.0.0
See Also
--------
DecisionTreeClassificationModel.featureImportances
"""
return self._call_java("featureImportances")
@property
@since("2.0.0")
def trees(self):
"""Trees in this ensemble. Warning: These have null parent Estimators."""
return [DecisionTreeRegressionModel(m) for m in list(self._call_java("trees"))]
def evaluateEachIteration(self, dataset):
"""
Method to compute error or loss for every iteration of gradient boosting.
.. versionadded:: 2.4.0
Parameters
----------
dataset : :py:class:`pyspark.sql.DataFrame`
Test dataset to evaluate model on.
"""
return self._call_java("evaluateEachIteration", dataset)
class _NaiveBayesParams(_PredictorParams, HasWeightCol):
"""
Params for :py:class:`NaiveBayes` and :py:class:`NaiveBayesModel`.
.. versionadded:: 3.0.0
"""
smoothing = Param(Params._dummy(), "smoothing", "The smoothing parameter, should be >= 0, " +
"default is 1.0", typeConverter=TypeConverters.toFloat)
modelType = Param(Params._dummy(), "modelType", "The model type which is a string " +
"(case-sensitive). Supported options: multinomial (default), bernoulli " +
"and gaussian.",
typeConverter=TypeConverters.toString)
def __init__(self, *args):
super(_NaiveBayesParams, self).__init__(*args)
self._setDefault(smoothing=1.0, modelType="multinomial")
@since("1.5.0")
def getSmoothing(self):
"""
Gets the value of smoothing or its default value.
"""
return self.getOrDefault(self.smoothing)
@since("1.5.0")
def getModelType(self):
"""
Gets the value of modelType or its default value.
"""
return self.getOrDefault(self.modelType)
@inherit_doc
class NaiveBayes(_JavaProbabilisticClassifier, _NaiveBayesParams, HasThresholds, HasWeightCol,
JavaMLWritable, JavaMLReadable):
"""
Naive Bayes Classifiers.
It supports both Multinomial and Bernoulli NB. `Multinomial NB \
<http://nlp.stanford.edu/IR-book/html/htmledition/naive-bayes-text-classification-1.html>`_
can handle finitely supported discrete data. For example, by converting documents into
TF-IDF vectors, it can be used for document classification. By making every vector a
binary (0/1) data, it can also be used as `Bernoulli NB \
<http://nlp.stanford.edu/IR-book/html/htmledition/the-bernoulli-model-1.html>`_.
The input feature values for Multinomial NB and Bernoulli NB must be nonnegative.
Since 3.0.0, it supports Complement NB which is an adaptation of the Multinomial NB.
Specifically, Complement NB uses statistics from the complement of each class to compute
the model's coefficients. The inventors of Complement NB show empirically that the parameter
estimates for CNB are more stable than those for Multinomial NB. Like Multinomial NB, the
input feature values for Complement NB must be nonnegative.
Since 3.0.0, it also supports `Gaussian NB \
<https://en.wikipedia.org/wiki/Naive_Bayes_classifier#Gaussian_naive_Bayes>`_.
which can handle continuous data.
.. versionadded:: 1.5.0
Examples
--------
>>> from pyspark.sql import Row
>>> from pyspark.ml.linalg import Vectors
>>> df = spark.createDataFrame([
... Row(label=0.0, weight=0.1, features=Vectors.dense([0.0, 0.0])),
... Row(label=0.0, weight=0.5, features=Vectors.dense([0.0, 1.0])),
... Row(label=1.0, weight=1.0, features=Vectors.dense([1.0, 0.0]))])
>>> nb = NaiveBayes(smoothing=1.0, modelType="multinomial", weightCol="weight")
>>> model = nb.fit(df)
>>> model.setFeaturesCol("features")
NaiveBayesModel...
>>> model.getSmoothing()
1.0
>>> model.pi
DenseVector([-0.81..., -0.58...])
>>> model.theta
DenseMatrix(2, 2, [-0.91..., -0.51..., -0.40..., -1.09...], 1)
>>> model.sigma
DenseMatrix(0, 0, [...], ...)
>>> test0 = sc.parallelize([Row(features=Vectors.dense([1.0, 0.0]))]).toDF()
>>> model.predict(test0.head().features)
1.0
>>> model.predictRaw(test0.head().features)
DenseVector([-1.72..., -0.99...])
>>> model.predictProbability(test0.head().features)
DenseVector([0.32..., 0.67...])
>>> result = model.transform(test0).head()
>>> result.prediction
1.0
>>> result.probability
DenseVector([0.32..., 0.67...])
>>> result.rawPrediction
DenseVector([-1.72..., -0.99...])
>>> test1 = sc.parallelize([Row(features=Vectors.sparse(2, [0], [1.0]))]).toDF()
>>> model.transform(test1).head().prediction
1.0
>>> nb_path = temp_path + "/nb"
>>> nb.save(nb_path)
>>> nb2 = NaiveBayes.load(nb_path)
>>> nb2.getSmoothing()
1.0
>>> model_path = temp_path + "/nb_model"
>>> model.save(model_path)
>>> model2 = NaiveBayesModel.load(model_path)
>>> model.pi == model2.pi
True
>>> model.theta == model2.theta
True
>>> model.transform(test0).take(1) == model2.transform(test0).take(1)
True
>>> nb = nb.setThresholds([0.01, 10.00])
>>> model3 = nb.fit(df)
>>> result = model3.transform(test0).head()
>>> result.prediction
0.0
>>> nb3 = NaiveBayes().setModelType("gaussian")
>>> model4 = nb3.fit(df)
>>> model4.getModelType()
'gaussian'
>>> model4.sigma
DenseMatrix(2, 2, [0.0, 0.25, 0.0, 0.0], 1)
>>> nb5 = NaiveBayes(smoothing=1.0, modelType="complement", weightCol="weight")
>>> model5 = nb5.fit(df)
>>> model5.getModelType()
'complement'
>>> model5.theta
DenseMatrix(2, 2, [...], 1)
>>> model5.sigma
DenseMatrix(0, 0, [...], ...)
"""
@keyword_only
def __init__(self, *, featuresCol="features", labelCol="label", predictionCol="prediction",
probabilityCol="probability", rawPredictionCol="rawPrediction", smoothing=1.0,
modelType="multinomial", thresholds=None, weightCol=None):
"""
__init__(self, \\*, featuresCol="features", labelCol="label", predictionCol="prediction", \
probabilityCol="probability", rawPredictionCol="rawPrediction", smoothing=1.0, \
modelType="multinomial", thresholds=None, weightCol=None)
"""
super(NaiveBayes, self).__init__()
self._java_obj = self._new_java_obj(
"org.apache.spark.ml.classification.NaiveBayes", self.uid)
kwargs = self._input_kwargs
self.setParams(**kwargs)
@keyword_only
@since("1.5.0")
def setParams(self, *, featuresCol="features", labelCol="label", predictionCol="prediction",
probabilityCol="probability", rawPredictionCol="rawPrediction", smoothing=1.0,
modelType="multinomial", thresholds=None, weightCol=None):
"""
setParams(self, \\*, featuresCol="features", labelCol="label", predictionCol="prediction", \
probabilityCol="probability", rawPredictionCol="rawPrediction", smoothing=1.0, \
modelType="multinomial", thresholds=None, weightCol=None)
Sets params for Naive Bayes.
"""
kwargs = self._input_kwargs
return self._set(**kwargs)
def _create_model(self, java_model):
return NaiveBayesModel(java_model)
@since("1.5.0")
def setSmoothing(self, value):
"""
Sets the value of :py:attr:`smoothing`.
"""
return self._set(smoothing=value)
@since("1.5.0")
def setModelType(self, value):
"""
Sets the value of :py:attr:`modelType`.
"""
return self._set(modelType=value)
def setWeightCol(self, value):
"""
Sets the value of :py:attr:`weightCol`.
"""
return self._set(weightCol=value)
class NaiveBayesModel(_JavaProbabilisticClassificationModel, _NaiveBayesParams, JavaMLWritable,
JavaMLReadable):
"""
Model fitted by NaiveBayes.
.. versionadded:: 1.5.0
"""
@property
@since("2.0.0")
def pi(self):
"""
log of class priors.
"""
return self._call_java("pi")
@property
@since("2.0.0")
def theta(self):
"""
log of class conditional probabilities.
"""
return self._call_java("theta")
@property
@since("3.0.0")
def sigma(self):
"""
variance of each feature.
"""
return self._call_java("sigma")
class _MultilayerPerceptronParams(_ProbabilisticClassifierParams, HasSeed, HasMaxIter,
HasTol, HasStepSize, HasSolver, HasBlockSize):
"""
Params for :py:class:`MultilayerPerceptronClassifier`.
.. versionadded:: 3.0.0
"""
layers = Param(Params._dummy(), "layers", "Sizes of layers from input layer to output layer " +
"E.g., Array(780, 100, 10) means 780 inputs, one hidden layer with 100 " +
"neurons and output layer of 10 neurons.",
typeConverter=TypeConverters.toListInt)
solver = Param(Params._dummy(), "solver", "The solver algorithm for optimization. Supported " +
"options: l-bfgs, gd.", typeConverter=TypeConverters.toString)
initialWeights = Param(Params._dummy(), "initialWeights", "The initial weights of the model.",
typeConverter=TypeConverters.toVector)
def __init__(self, *args):
super(_MultilayerPerceptronParams, self).__init__(*args)
self._setDefault(maxIter=100, tol=1E-6, blockSize=128, stepSize=0.03, solver="l-bfgs")
@since("1.6.0")
def getLayers(self):
"""
Gets the value of layers or its default value.
"""
return self.getOrDefault(self.layers)
@since("2.0.0")
def getInitialWeights(self):
"""
Gets the value of initialWeights or its default value.
"""
return self.getOrDefault(self.initialWeights)
@inherit_doc
class MultilayerPerceptronClassifier(_JavaProbabilisticClassifier, _MultilayerPerceptronParams,
JavaMLWritable, JavaMLReadable):
"""
Classifier trainer based on the Multilayer Perceptron.
Each layer has sigmoid activation function, output layer has softmax.
Number of inputs has to be equal to the size of feature vectors.
Number of outputs has to be equal to the total number of labels.
.. versionadded:: 1.6.0
Examples
--------
>>> from pyspark.ml.linalg import Vectors
>>> df = spark.createDataFrame([
... (0.0, Vectors.dense([0.0, 0.0])),
... (1.0, Vectors.dense([0.0, 1.0])),
... (1.0, Vectors.dense([1.0, 0.0])),
... (0.0, Vectors.dense([1.0, 1.0]))], ["label", "features"])
>>> mlp = MultilayerPerceptronClassifier(layers=[2, 2, 2], seed=123)
>>> mlp.setMaxIter(100)
MultilayerPerceptronClassifier...
>>> mlp.getMaxIter()
100
>>> mlp.getBlockSize()
128
>>> mlp.setBlockSize(1)
MultilayerPerceptronClassifier...
>>> mlp.getBlockSize()
1
>>> model = mlp.fit(df)
>>> model.setFeaturesCol("features")
MultilayerPerceptronClassificationModel...
>>> model.getMaxIter()
100
>>> model.getLayers()
[2, 2, 2]
>>> model.weights.size
12
>>> testDF = spark.createDataFrame([
... (Vectors.dense([1.0, 0.0]),),
... (Vectors.dense([0.0, 0.0]),)], ["features"])
>>> model.predict(testDF.head().features)
1.0
>>> model.predictRaw(testDF.head().features)
DenseVector([-16.208, 16.344])
>>> model.predictProbability(testDF.head().features)
DenseVector([0.0, 1.0])
>>> model.transform(testDF).select("features", "prediction").show()
+---------+----------+
| features|prediction|
+---------+----------+
|[1.0,0.0]| 1.0|
|[0.0,0.0]| 0.0|
+---------+----------+
...
>>> mlp_path = temp_path + "/mlp"
>>> mlp.save(mlp_path)
>>> mlp2 = MultilayerPerceptronClassifier.load(mlp_path)
>>> mlp2.getBlockSize()
1
>>> model_path = temp_path + "/mlp_model"
>>> model.save(model_path)
>>> model2 = MultilayerPerceptronClassificationModel.load(model_path)
>>> model.getLayers() == model2.getLayers()
True
>>> model.weights == model2.weights
True
>>> model.transform(testDF).take(1) == model2.transform(testDF).take(1)
True
>>> mlp2 = mlp2.setInitialWeights(list(range(0, 12)))
>>> model3 = mlp2.fit(df)
>>> model3.weights != model2.weights
True
>>> model3.getLayers() == model.getLayers()
True
"""
@keyword_only
def __init__(self, *, featuresCol="features", labelCol="label", predictionCol="prediction",
maxIter=100, tol=1e-6, seed=None, layers=None, blockSize=128, stepSize=0.03,
solver="l-bfgs", initialWeights=None, probabilityCol="probability",
rawPredictionCol="rawPrediction"):
"""
__init__(self, \\*, featuresCol="features", labelCol="label", predictionCol="prediction", \
maxIter=100, tol=1e-6, seed=None, layers=None, blockSize=128, stepSize=0.03, \
solver="l-bfgs", initialWeights=None, probabilityCol="probability", \
rawPredictionCol="rawPrediction")
"""
super(MultilayerPerceptronClassifier, self).__init__()
self._java_obj = self._new_java_obj(
"org.apache.spark.ml.classification.MultilayerPerceptronClassifier", self.uid)
kwargs = self._input_kwargs
self.setParams(**kwargs)
@keyword_only
@since("1.6.0")
def setParams(self, *, featuresCol="features", labelCol="label", predictionCol="prediction",
maxIter=100, tol=1e-6, seed=None, layers=None, blockSize=128, stepSize=0.03,
solver="l-bfgs", initialWeights=None, probabilityCol="probability",
rawPredictionCol="rawPrediction"):
"""
setParams(self, \\*, featuresCol="features", labelCol="label", predictionCol="prediction", \
maxIter=100, tol=1e-6, seed=None, layers=None, blockSize=128, stepSize=0.03, \
solver="l-bfgs", initialWeights=None, probabilityCol="probability", \
rawPredictionCol="rawPrediction"):
Sets params for MultilayerPerceptronClassifier.
"""
kwargs = self._input_kwargs
return self._set(**kwargs)
def _create_model(self, java_model):
return MultilayerPerceptronClassificationModel(java_model)
@since("1.6.0")
def setLayers(self, value):
"""
Sets the value of :py:attr:`layers`.
"""
return self._set(layers=value)
@since("1.6.0")
def setBlockSize(self, value):
"""
Sets the value of :py:attr:`blockSize`.
"""
return self._set(blockSize=value)
@since("2.0.0")
def setInitialWeights(self, value):
"""
Sets the value of :py:attr:`initialWeights`.
"""
return self._set(initialWeights=value)
def setMaxIter(self, value):
"""
Sets the value of :py:attr:`maxIter`.
"""
return self._set(maxIter=value)
def setSeed(self, value):
"""
Sets the value of :py:attr:`seed`.
"""
return self._set(seed=value)
def setTol(self, value):
"""
Sets the value of :py:attr:`tol`.
"""
return self._set(tol=value)
@since("2.0.0")
def setStepSize(self, value):
"""
Sets the value of :py:attr:`stepSize`.
"""
return self._set(stepSize=value)
def setSolver(self, value):
"""
Sets the value of :py:attr:`solver`.
"""
return self._set(solver=value)
class MultilayerPerceptronClassificationModel(_JavaProbabilisticClassificationModel,
_MultilayerPerceptronParams, JavaMLWritable,
JavaMLReadable, HasTrainingSummary):
"""
Model fitted by MultilayerPerceptronClassifier.
.. versionadded:: 1.6.0
"""
@property
@since("2.0.0")
def weights(self):
"""
the weights of layers.
"""
return self._call_java("weights")
@since("3.1.0")
def summary(self):
"""
Gets summary (e.g. accuracy/precision/recall, objective history, total iterations) of model
trained on the training set. An exception is thrown if `trainingSummary is None`.
"""
if self.hasSummary:
return MultilayerPerceptronClassificationTrainingSummary(
super(MultilayerPerceptronClassificationModel, self).summary)
else:
raise RuntimeError("No training summary available for this %s" %
self.__class__.__name__)
def evaluate(self, dataset):
"""
Evaluates the model on a test dataset.
.. versionadded:: 3.1.0
Parameters
----------
dataset : :py:class:`pyspark.sql.DataFrame`
Test dataset to evaluate model on.
"""
if not isinstance(dataset, DataFrame):
raise ValueError("dataset must be a DataFrame but got %s." % type(dataset))
java_mlp_summary = self._call_java("evaluate", dataset)
return MultilayerPerceptronClassificationSummary(java_mlp_summary)
class MultilayerPerceptronClassificationSummary(_ClassificationSummary):
"""
Abstraction for MultilayerPerceptronClassifier Results for a given model.
.. versionadded:: 3.1.0
"""
pass
@inherit_doc
class MultilayerPerceptronClassificationTrainingSummary(MultilayerPerceptronClassificationSummary,
_TrainingSummary):
"""
Abstraction for MultilayerPerceptronClassifier Training results.
.. versionadded:: 3.1.0
"""
pass
class _OneVsRestParams(_ClassifierParams, HasWeightCol):
"""
Params for :py:class:`OneVsRest` and :py:class:`OneVsRestModelModel`.
"""
classifier = Param(Params._dummy(), "classifier", "base binary classifier")
@since("2.0.0")
def getClassifier(self):
"""
Gets the value of classifier or its default value.
"""
return self.getOrDefault(self.classifier)
@inherit_doc
class OneVsRest(Estimator, _OneVsRestParams, HasParallelism, MLReadable, MLWritable):
"""
Reduction of Multiclass Classification to Binary Classification.
Performs reduction using one against all strategy.
For a multiclass classification with k classes, train k models (one per class).
Each example is scored against all k models and the model with highest score
is picked to label the example.
.. versionadded:: 2.0.0
Examples
--------
>>> from pyspark.sql import Row
>>> from pyspark.ml.linalg import Vectors
>>> data_path = "data/mllib/sample_multiclass_classification_data.txt"
>>> df = spark.read.format("libsvm").load(data_path)
>>> lr = LogisticRegression(regParam=0.01)
>>> ovr = OneVsRest(classifier=lr)
>>> ovr.getRawPredictionCol()
'rawPrediction'
>>> ovr.setPredictionCol("newPrediction")
OneVsRest...
>>> model = ovr.fit(df)
>>> model.models[0].coefficients
DenseVector([0.5..., -1.0..., 3.4..., 4.2...])
>>> model.models[1].coefficients
DenseVector([-2.1..., 3.1..., -2.6..., -2.3...])
>>> model.models[2].coefficients
DenseVector([0.3..., -3.4..., 1.0..., -1.1...])
>>> [x.intercept for x in model.models]
[-2.7..., -2.5..., -1.3...]
>>> test0 = sc.parallelize([Row(features=Vectors.dense(-1.0, 0.0, 1.0, 1.0))]).toDF()
>>> model.transform(test0).head().newPrediction
0.0
>>> test1 = sc.parallelize([Row(features=Vectors.sparse(4, [0], [1.0]))]).toDF()
>>> model.transform(test1).head().newPrediction
2.0
>>> test2 = sc.parallelize([Row(features=Vectors.dense(0.5, 0.4, 0.3, 0.2))]).toDF()
>>> model.transform(test2).head().newPrediction
0.0
>>> model_path = temp_path + "/ovr_model"
>>> model.save(model_path)
>>> model2 = OneVsRestModel.load(model_path)
>>> model2.transform(test0).head().newPrediction
0.0
>>> model.transform(test0).take(1) == model2.transform(test0).take(1)
True
>>> model.transform(test2).columns
['features', 'rawPrediction', 'newPrediction']
"""
@keyword_only
def __init__(self, *, featuresCol="features", labelCol="label", predictionCol="prediction",
rawPredictionCol="rawPrediction", classifier=None, weightCol=None, parallelism=1):
"""
__init__(self, \\*, featuresCol="features", labelCol="label", predictionCol="prediction", \
rawPredictionCol="rawPrediction", classifier=None, weightCol=None, parallelism=1):
"""
super(OneVsRest, self).__init__()
self._setDefault(parallelism=1)
kwargs = self._input_kwargs
self._set(**kwargs)
@keyword_only
@since("2.0.0")
def setParams(self, *, featuresCol="features", labelCol="label", predictionCol="prediction",
rawPredictionCol="rawPrediction", classifier=None, weightCol=None, parallelism=1):
"""
setParams(self, \\*, featuresCol="features", labelCol="label", predictionCol="prediction", \
rawPredictionCol="rawPrediction", classifier=None, weightCol=None, parallelism=1):
Sets params for OneVsRest.
"""
kwargs = self._input_kwargs
return self._set(**kwargs)
@since("2.0.0")
def setClassifier(self, value):
"""
Sets the value of :py:attr:`classifier`.
"""
return self._set(classifier=value)
def setLabelCol(self, value):
"""
Sets the value of :py:attr:`labelCol`.
"""
return self._set(labelCol=value)
def setFeaturesCol(self, value):
"""
Sets the value of :py:attr:`featuresCol`.
"""
return self._set(featuresCol=value)
def setPredictionCol(self, value):
"""
Sets the value of :py:attr:`predictionCol`.
"""
return self._set(predictionCol=value)
def setRawPredictionCol(self, value):
"""
Sets the value of :py:attr:`rawPredictionCol`.
"""
return self._set(rawPredictionCol=value)
def setWeightCol(self, value):
"""
Sets the value of :py:attr:`weightCol`.
"""
return self._set(weightCol=value)
def setParallelism(self, value):
"""
Sets the value of :py:attr:`parallelism`.
"""
return self._set(parallelism=value)
def _fit(self, dataset):
labelCol = self.getLabelCol()
featuresCol = self.getFeaturesCol()
predictionCol = self.getPredictionCol()
classifier = self.getClassifier()
numClasses = int(dataset.agg({labelCol: "max"}).head()["max("+labelCol+")"]) + 1
weightCol = None
if (self.isDefined(self.weightCol) and self.getWeightCol()):
if isinstance(classifier, HasWeightCol):
weightCol = self.getWeightCol()
else:
warnings.warn("weightCol is ignored, "
"as it is not supported by {} now.".format(classifier))
if weightCol:
multiclassLabeled = dataset.select(labelCol, featuresCol, weightCol)
else:
multiclassLabeled = dataset.select(labelCol, featuresCol)
# persist if underlying dataset is not persistent.
handlePersistence = dataset.storageLevel == StorageLevel(False, False, False, False)
if handlePersistence:
multiclassLabeled.persist(StorageLevel.MEMORY_AND_DISK)
def trainSingleClass(index):
binaryLabelCol = "mc2b$" + str(index)
trainingDataset = multiclassLabeled.withColumn(
binaryLabelCol,
when(multiclassLabeled[labelCol] == float(index), 1.0).otherwise(0.0))
paramMap = dict([(classifier.labelCol, binaryLabelCol),
(classifier.featuresCol, featuresCol),
(classifier.predictionCol, predictionCol)])
if weightCol:
paramMap[classifier.weightCol] = weightCol
return classifier.fit(trainingDataset, paramMap)
pool = ThreadPool(processes=min(self.getParallelism(), numClasses))
models = pool.map(trainSingleClass, range(numClasses))
if handlePersistence:
multiclassLabeled.unpersist()
return self._copyValues(OneVsRestModel(models=models))
def copy(self, extra=None):
"""
Creates a copy of this instance with a randomly generated uid
and some extra params. This creates a deep copy of the embedded paramMap,
and copies the embedded and extra parameters over.
.. versionadded:: 2.0.0
Examples
--------
extra : dict, optional
Extra parameters to copy to the new instance
Returns
-------
:py:class:`OneVsRest`
Copy of this instance
"""
if extra is None:
extra = dict()
newOvr = Params.copy(self, extra)
if self.isSet(self.classifier):
newOvr.setClassifier(self.getClassifier().copy(extra))
return newOvr
@classmethod
def _from_java(cls, java_stage):
"""
Given a Java OneVsRest, create and return a Python wrapper of it.
Used for ML persistence.
"""
featuresCol = java_stage.getFeaturesCol()
labelCol = java_stage.getLabelCol()
predictionCol = java_stage.getPredictionCol()
rawPredictionCol = java_stage.getRawPredictionCol()
classifier = JavaParams._from_java(java_stage.getClassifier())
parallelism = java_stage.getParallelism()
py_stage = cls(featuresCol=featuresCol, labelCol=labelCol, predictionCol=predictionCol,
rawPredictionCol=rawPredictionCol, classifier=classifier,
parallelism=parallelism)
if java_stage.isDefined(java_stage.getParam("weightCol")):
py_stage.setWeightCol(java_stage.getWeightCol())
py_stage._resetUid(java_stage.uid())
return py_stage
def _to_java(self):
"""
Transfer this instance to a Java OneVsRest. Used for ML persistence.
Returns
-------
py4j.java_gateway.JavaObject
Java object equivalent to this instance.
"""
_java_obj = JavaParams._new_java_obj("org.apache.spark.ml.classification.OneVsRest",
self.uid)
_java_obj.setClassifier(self.getClassifier()._to_java())
_java_obj.setParallelism(self.getParallelism())
_java_obj.setFeaturesCol(self.getFeaturesCol())
_java_obj.setLabelCol(self.getLabelCol())
_java_obj.setPredictionCol(self.getPredictionCol())
if (self.isDefined(self.weightCol) and self.getWeightCol()):
_java_obj.setWeightCol(self.getWeightCol())
_java_obj.setRawPredictionCol(self.getRawPredictionCol())
return _java_obj
@classmethod
def read(cls):
return OneVsRestReader(cls)
def write(self):
if isinstance(self.getClassifier(), JavaMLWritable):
return JavaMLWriter(self)
else:
return OneVsRestWriter(self)
class _OneVsRestSharedReadWrite:
@staticmethod
def saveImpl(instance, sc, path, extraMetadata=None):
skipParams = ['classifier']
jsonParams = DefaultParamsWriter.extractJsonParams(instance, skipParams)
DefaultParamsWriter.saveMetadata(instance, path, sc, paramMap=jsonParams,
extraMetadata=extraMetadata)
classifierPath = os.path.join(path, 'classifier')
instance.getClassifier().save(classifierPath)
@staticmethod
def loadClassifier(path, sc):
classifierPath = os.path.join(path, 'classifier')
return DefaultParamsReader.loadParamsInstance(classifierPath, sc)
@staticmethod
def validateParams(instance):
elems_to_check = [instance.getClassifier()]
if isinstance(instance, OneVsRestModel):
elems_to_check.extend(instance.models)
for elem in elems_to_check:
if not isinstance(elem, MLWritable):
raise ValueError(f'OneVsRest write will fail because it contains {elem.uid} '
f'which is not writable.')
@inherit_doc
class OneVsRestReader(MLReader):
def __init__(self, cls):
super(OneVsRestReader, self).__init__()
self.cls = cls
def load(self, path):
metadata = DefaultParamsReader.loadMetadata(path, self.sc)
if not DefaultParamsReader.isPythonParamsInstance(metadata):
return JavaMLReader(self.cls).load(path)
else:
classifier = _OneVsRestSharedReadWrite.loadClassifier(path, self.sc)
ova = OneVsRest(classifier=classifier)._resetUid(metadata['uid'])
DefaultParamsReader.getAndSetParams(ova, metadata, skipParams=['classifier'])
return ova
@inherit_doc
class OneVsRestWriter(MLWriter):
def __init__(self, instance):
super(OneVsRestWriter, self).__init__()
self.instance = instance
def saveImpl(self, path):
_OneVsRestSharedReadWrite.validateParams(self.instance)
_OneVsRestSharedReadWrite.saveImpl(self.instance, self.sc, path)
class OneVsRestModel(Model, _OneVsRestParams, MLReadable, MLWritable):
"""
Model fitted by OneVsRest.
This stores the models resulting from training k binary classifiers: one for each class.
Each example is scored against all k models, and the model with the highest score
is picked to label the example.
.. versionadded:: 2.0.0
"""
def setFeaturesCol(self, value):
"""
Sets the value of :py:attr:`featuresCol`.
"""
return self._set(featuresCol=value)
def setPredictionCol(self, value):
"""
Sets the value of :py:attr:`predictionCol`.
"""
return self._set(predictionCol=value)
def setRawPredictionCol(self, value):
"""
Sets the value of :py:attr:`rawPredictionCol`.
"""
return self._set(rawPredictionCol=value)
def __init__(self, models):
super(OneVsRestModel, self).__init__()
self.models = models
if not isinstance(models[0], JavaMLWritable):
return
# set java instance
java_models = [model._to_java() for model in self.models]
sc = SparkContext._active_spark_context
java_models_array = JavaWrapper._new_java_array(java_models,
sc._gateway.jvm.org.apache.spark.ml
.classification.ClassificationModel)
# TODO: need to set metadata
metadata = JavaParams._new_java_obj("org.apache.spark.sql.types.Metadata")
self._java_obj = \
JavaParams._new_java_obj("org.apache.spark.ml.classification.OneVsRestModel",
self.uid, metadata.empty(), java_models_array)
def _transform(self, dataset):
# determine the input columns: these need to be passed through
origCols = dataset.columns
# add an accumulator column to store predictions of all the models
accColName = "mbc$acc" + str(uuid.uuid4())
initUDF = udf(lambda _: [], ArrayType(DoubleType()))
newDataset = dataset.withColumn(accColName, initUDF(dataset[origCols[0]]))
# persist if underlying dataset is not persistent.
handlePersistence = dataset.storageLevel == StorageLevel(False, False, False, False)
if handlePersistence:
newDataset.persist(StorageLevel.MEMORY_AND_DISK)
# update the accumulator column with the result of prediction of models
aggregatedDataset = newDataset
for index, model in enumerate(self.models):
rawPredictionCol = self.getRawPredictionCol()
columns = origCols + [rawPredictionCol, accColName]
# add temporary column to store intermediate scores and update
tmpColName = "mbc$tmp" + str(uuid.uuid4())
updateUDF = udf(
lambda predictions, prediction: predictions + [prediction.tolist()[1]],
ArrayType(DoubleType()))
transformedDataset = model.transform(aggregatedDataset).select(*columns)
updatedDataset = transformedDataset.withColumn(
tmpColName,
updateUDF(transformedDataset[accColName], transformedDataset[rawPredictionCol]))
newColumns = origCols + [tmpColName]
# switch out the intermediate column with the accumulator column
aggregatedDataset = updatedDataset\
.select(*newColumns).withColumnRenamed(tmpColName, accColName)
if handlePersistence:
newDataset.unpersist()
if self.getRawPredictionCol():
def func(predictions):
predArray = []
for x in predictions:
predArray.append(x)
return Vectors.dense(predArray)
rawPredictionUDF = udf(func, VectorUDT())
aggregatedDataset = aggregatedDataset.withColumn(
self.getRawPredictionCol(), rawPredictionUDF(aggregatedDataset[accColName]))
if self.getPredictionCol():
# output the index of the classifier with highest confidence as prediction
labelUDF = udf(lambda predictions: float(max(enumerate(predictions),
key=operator.itemgetter(1))[0]), DoubleType())
aggregatedDataset = aggregatedDataset.withColumn(
self.getPredictionCol(), labelUDF(aggregatedDataset[accColName]))
return aggregatedDataset.drop(accColName)
def copy(self, extra=None):
"""
Creates a copy of this instance with a randomly generated uid
and some extra params. This creates a deep copy of the embedded paramMap,
and copies the embedded and extra parameters over.
.. versionadded:: 2.0.0
Parameters
----------
extra : dict, optional
Extra parameters to copy to the new instance
Returns
-------
:py:class:`OneVsRestModel`
Copy of this instance
"""
if extra is None:
extra = dict()
newModel = Params.copy(self, extra)
newModel.models = [model.copy(extra) for model in self.models]
return newModel
@classmethod
def _from_java(cls, java_stage):
"""
Given a Java OneVsRestModel, create and return a Python wrapper of it.
Used for ML persistence.
"""
featuresCol = java_stage.getFeaturesCol()
labelCol = java_stage.getLabelCol()
predictionCol = java_stage.getPredictionCol()
classifier = JavaParams._from_java(java_stage.getClassifier())
models = [JavaParams._from_java(model) for model in java_stage.models()]
py_stage = cls(models=models).setPredictionCol(predictionCol)\
.setFeaturesCol(featuresCol)
py_stage._set(labelCol=labelCol)
if java_stage.isDefined(java_stage.getParam("weightCol")):
py_stage._set(weightCol=java_stage.getWeightCol())
py_stage._set(classifier=classifier)
py_stage._resetUid(java_stage.uid())
return py_stage
def _to_java(self):
"""
Transfer this instance to a Java OneVsRestModel. Used for ML persistence.
Returns
-------
py4j.java_gateway.JavaObject
Java object equivalent to this instance.
"""
sc = SparkContext._active_spark_context
java_models = [model._to_java() for model in self.models]
java_models_array = JavaWrapper._new_java_array(
java_models, sc._gateway.jvm.org.apache.spark.ml.classification.ClassificationModel)
metadata = JavaParams._new_java_obj("org.apache.spark.sql.types.Metadata")
_java_obj = JavaParams._new_java_obj("org.apache.spark.ml.classification.OneVsRestModel",
self.uid, metadata.empty(), java_models_array)
_java_obj.set("classifier", self.getClassifier()._to_java())
_java_obj.set("featuresCol", self.getFeaturesCol())
_java_obj.set("labelCol", self.getLabelCol())
_java_obj.set("predictionCol", self.getPredictionCol())
if (self.isDefined(self.weightCol) and self.getWeightCol()):
_java_obj.set("weightCol", self.getWeightCol())
return _java_obj
@classmethod
def read(cls):
return OneVsRestModelReader(cls)
def write(self):
if all(map(lambda elem: isinstance(elem, JavaMLWritable),
[self.getClassifier()] + self.models)):
return JavaMLWriter(self)
else:
return OneVsRestModelWriter(self)
@inherit_doc
class OneVsRestModelReader(MLReader):
def __init__(self, cls):
super(OneVsRestModelReader, self).__init__()
self.cls = cls
def load(self, path):
metadata = DefaultParamsReader.loadMetadata(path, self.sc)
if not DefaultParamsReader.isPythonParamsInstance(metadata):
return JavaMLReader(self.cls).load(path)
else:
classifier = _OneVsRestSharedReadWrite.loadClassifier(path, self.sc)
numClasses = metadata['numClasses']
subModels = [None] * numClasses
for idx in range(numClasses):
subModelPath = os.path.join(path, f'model_{idx}')
subModels[idx] = DefaultParamsReader.loadParamsInstance(subModelPath, self.sc)
ovaModel = OneVsRestModel(subModels)._resetUid(metadata['uid'])
ovaModel.set(ovaModel.classifier, classifier)
DefaultParamsReader.getAndSetParams(ovaModel, metadata, skipParams=['classifier'])
return ovaModel
@inherit_doc
class OneVsRestModelWriter(MLWriter):
def __init__(self, instance):
super(OneVsRestModelWriter, self).__init__()
self.instance = instance
def saveImpl(self, path):
_OneVsRestSharedReadWrite.validateParams(self.instance)
instance = self.instance
numClasses = len(instance.models)
extraMetadata = {'numClasses': numClasses}
_OneVsRestSharedReadWrite.saveImpl(instance, self.sc, path, extraMetadata=extraMetadata)
for idx in range(numClasses):
subModelPath = os.path.join(path, f'model_{idx}')
instance.models[idx].save(subModelPath)
@inherit_doc
class FMClassifier(_JavaProbabilisticClassifier, _FactorizationMachinesParams, JavaMLWritable,
JavaMLReadable):
"""
Factorization Machines learning algorithm for classification.
Solver supports:
* gd (normal mini-batch gradient descent)
* adamW (default)
.. versionadded:: 3.0.0
Examples
--------
>>> from pyspark.ml.linalg import Vectors
>>> from pyspark.ml.classification import FMClassifier
>>> df = spark.createDataFrame([
... (1.0, Vectors.dense(1.0)),
... (0.0, Vectors.sparse(1, [], []))], ["label", "features"])
>>> fm = FMClassifier(factorSize=2)
>>> fm.setSeed(11)
FMClassifier...
>>> model = fm.fit(df)
>>> model.getMaxIter()
100
>>> test0 = spark.createDataFrame([
... (Vectors.dense(-1.0),),
... (Vectors.dense(0.5),),
... (Vectors.dense(1.0),),
... (Vectors.dense(2.0),)], ["features"])
>>> model.predictRaw(test0.head().features)
DenseVector([22.13..., -22.13...])
>>> model.predictProbability(test0.head().features)
DenseVector([1.0, 0.0])
>>> model.transform(test0).select("features", "probability").show(10, False)
+--------+------------------------------------------+
|features|probability |
+--------+------------------------------------------+
|[-1.0] |[0.9999999997574736,2.425264676902229E-10]|
|[0.5] |[0.47627851732981163,0.5237214826701884] |
|[1.0] |[5.491554426243495E-4,0.9994508445573757] |
|[2.0] |[2.005766663870645E-10,0.9999999997994233]|
+--------+------------------------------------------+
...
>>> model.intercept
-7.316665276826291
>>> model.linear
DenseVector([14.8232])
>>> model.factors
DenseMatrix(1, 2, [0.0163, -0.0051], 1)
>>> model_path = temp_path + "/fm_model"
>>> model.save(model_path)
>>> model2 = FMClassificationModel.load(model_path)
>>> model2.intercept
-7.316665276826291
>>> model2.linear
DenseVector([14.8232])
>>> model2.factors
DenseMatrix(1, 2, [0.0163, -0.0051], 1)
>>> model.transform(test0).take(1) == model2.transform(test0).take(1)
True
"""
@keyword_only
def __init__(self, *, featuresCol="features", labelCol="label", predictionCol="prediction",
probabilityCol="probability", rawPredictionCol="rawPrediction",
factorSize=8, fitIntercept=True, fitLinear=True, regParam=0.0,
miniBatchFraction=1.0, initStd=0.01, maxIter=100, stepSize=1.0,
tol=1e-6, solver="adamW", thresholds=None, seed=None):
"""
__init__(self, \\*, featuresCol="features", labelCol="label", predictionCol="prediction", \
probabilityCol="probability", rawPredictionCol="rawPrediction", \
factorSize=8, fitIntercept=True, fitLinear=True, regParam=0.0, \
miniBatchFraction=1.0, initStd=0.01, maxIter=100, stepSize=1.0, \
tol=1e-6, solver="adamW", thresholds=None, seed=None)
"""
super(FMClassifier, self).__init__()
self._java_obj = self._new_java_obj(
"org.apache.spark.ml.classification.FMClassifier", self.uid)
kwargs = self._input_kwargs
self.setParams(**kwargs)
@keyword_only
@since("3.0.0")
def setParams(self, *, featuresCol="features", labelCol="label", predictionCol="prediction",
probabilityCol="probability", rawPredictionCol="rawPrediction",
factorSize=8, fitIntercept=True, fitLinear=True, regParam=0.0,
miniBatchFraction=1.0, initStd=0.01, maxIter=100, stepSize=1.0,
tol=1e-6, solver="adamW", thresholds=None, seed=None):
"""
setParams(self, \\*, featuresCol="features", labelCol="label", predictionCol="prediction", \
probabilityCol="probability", rawPredictionCol="rawPrediction", \
factorSize=8, fitIntercept=True, fitLinear=True, regParam=0.0, \
miniBatchFraction=1.0, initStd=0.01, maxIter=100, stepSize=1.0, \
tol=1e-6, solver="adamW", thresholds=None, seed=None)
Sets Params for FMClassifier.
"""
kwargs = self._input_kwargs
return self._set(**kwargs)
def _create_model(self, java_model):
return FMClassificationModel(java_model)
@since("3.0.0")
def setFactorSize(self, value):
"""
Sets the value of :py:attr:`factorSize`.
"""
return self._set(factorSize=value)
@since("3.0.0")
def setFitLinear(self, value):
"""
Sets the value of :py:attr:`fitLinear`.
"""
return self._set(fitLinear=value)
@since("3.0.0")
def setMiniBatchFraction(self, value):
"""
Sets the value of :py:attr:`miniBatchFraction`.
"""
return self._set(miniBatchFraction=value)
@since("3.0.0")
def setInitStd(self, value):
"""
Sets the value of :py:attr:`initStd`.
"""
return self._set(initStd=value)
@since("3.0.0")
def setMaxIter(self, value):
"""
Sets the value of :py:attr:`maxIter`.
"""
return self._set(maxIter=value)
@since("3.0.0")
def setStepSize(self, value):
"""
Sets the value of :py:attr:`stepSize`.
"""
return self._set(stepSize=value)
@since("3.0.0")
def setTol(self, value):
"""
Sets the value of :py:attr:`tol`.
"""
return self._set(tol=value)
@since("3.0.0")
def setSolver(self, value):
"""
Sets the value of :py:attr:`solver`.
"""
return self._set(solver=value)
@since("3.0.0")
def setSeed(self, value):
"""
Sets the value of :py:attr:`seed`.
"""
return self._set(seed=value)
@since("3.0.0")
def setFitIntercept(self, value):
"""
Sets the value of :py:attr:`fitIntercept`.
"""
return self._set(fitIntercept=value)
@since("3.0.0")
def setRegParam(self, value):
"""
Sets the value of :py:attr:`regParam`.
"""
return self._set(regParam=value)
class FMClassificationModel(_JavaProbabilisticClassificationModel, _FactorizationMachinesParams,
JavaMLWritable, JavaMLReadable, HasTrainingSummary):
"""
Model fitted by :class:`FMClassifier`.
.. versionadded:: 3.0.0
"""
@property
@since("3.0.0")
def intercept(self):
"""
Model intercept.
"""
return self._call_java("intercept")
@property
@since("3.0.0")
def linear(self):
"""
Model linear term.
"""
return self._call_java("linear")
@property
@since("3.0.0")
def factors(self):
"""
Model factor term.
"""
return self._call_java("factors")
@since("3.1.0")
def summary(self):
"""
Gets summary (e.g. accuracy/precision/recall, objective history, total iterations) of model
trained on the training set. An exception is thrown if `trainingSummary is None`.
"""
if self.hasSummary:
return FMClassificationTrainingSummary(super(FMClassificationModel, self).summary)
else:
raise RuntimeError("No training summary available for this %s" %
self.__class__.__name__)
def evaluate(self, dataset):
"""
Evaluates the model on a test dataset.
.. versionadded:: 3.1.0
Parameters
----------
dataset : :py:class:`pyspark.sql.DataFrame`
Test dataset to evaluate model on.
"""
if not isinstance(dataset, DataFrame):
raise ValueError("dataset must be a DataFrame but got %s." % type(dataset))
java_fm_summary = self._call_java("evaluate", dataset)
return FMClassificationSummary(java_fm_summary)
class FMClassificationSummary(_BinaryClassificationSummary):
"""
Abstraction for FMClassifier Results for a given model.
.. versionadded:: 3.1.0
"""
pass
@inherit_doc
class FMClassificationTrainingSummary(FMClassificationSummary, _TrainingSummary):
"""
Abstraction for FMClassifier Training results.
.. versionadded:: 3.1.0
"""
pass
if __name__ == "__main__":
import doctest
import pyspark.ml.classification
from pyspark.sql import SparkSession
globs = pyspark.ml.classification.__dict__.copy()
# The small batch size here ensures that we see multiple batches,
# even in these small test examples:
spark = SparkSession.builder\
.master("local[2]")\
.appName("ml.classification tests")\
.getOrCreate()
sc = spark.sparkContext
globs['sc'] = sc
globs['spark'] = spark
import tempfile
temp_path = tempfile.mkdtemp()
globs['temp_path'] = temp_path
try:
(failure_count, test_count) = doctest.testmod(globs=globs, optionflags=doctest.ELLIPSIS)
spark.stop()
finally:
from shutil import rmtree
try:
rmtree(temp_path)
except OSError:
pass
if failure_count:
sys.exit(-1)
| BryanCutler/spark | python/pyspark/ml/classification.py | Python | apache-2.0 | 126,641 | [
30522,
1001,
1001,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
2030,
2062,
1001,
12130,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
5500,
2007,
1001,
2023,
2147,
2005,
3176,
2592,
4953,
9385,
6095,
1012,
1001,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/usr/bin/env python
import numpy as np
import os,sys
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import pyplot as plt
import argparse
ap=argparse.ArgumentParser()
ap.add_argument('-vis') # 1 plot cropped point cloud
ap.add_argument('-refine') # 1 refine mesh
ap.add_argument('-clean') # 1 remove tmp files
if ap.parse_args().vis==None:
vis=0
else:
vis=int(ap.parse_args().vis)
if ap.parse_args().refine==None:
refine=0
else:
refine=int(ap.parse_args().refine)
if ap.parse_args().clean==None:
clean=0
else:
clean=int(ap.parse_args().clean)
# Synthetic fault pixels
z=np.linspace(.2, -.8, num=100)
y=np.linspace(-.625,.625, num=120)
grid=np.meshgrid(y,z)
x=np.zeros((len(z)*len(y),1),dtype=np.float)
dat_vert=np.hstack((x,grid[0].reshape(x.shape),grid[1].reshape(x.shape)))
# weak
wl=np.linspace(.12,.18,num=8); amp=.03125*np.sqrt(wl)
e=1.025; r=-.2
dip=70.; zcnt=-.35
omg=[ 0.82976173, 0.89624834, 0.03829284, -0.50016345, -1.06606012, 1.40505898, -1.24256034, 1.28623393]
#omg=(np.random.rand(wl.shape[0])-.5)*np.pi
L=dat_vert[1,:].max()-dat_vert[1,:].min()
zmax=z.max(); zmin=z.min()
for i in range(len(wl)):
phs=dat_vert[:,1]/wl[i]*np.pi+omg[i]
dat_vert[:,0]=dat_vert[:,0]+amp[i]*np.cos(phs)*(e*zmax-dat_vert[:,2])/(e*zmax-zmin)*np.exp(r*abs(phs)/np.pi)
dat_vert[:,0]=dat_vert[:,0]+(zcnt-dat_vert[:,2])*np.tan((90.-dip)/180.*np.pi)
# ridge patch
def flt_patch(dat_vert,slope1,slope2,trunc1,trunc2,hlw,hup):
b1=-slope1*trunc1-.7
b2=-slope2*trunc2-.7
in_id=np.where(np.logical_and(dat_vert[:,2]-slope1*dat_vert[:,1]<b1, dat_vert[:,2]-slope2*dat_vert[:,1]<b2))[0]
out_id=np.setdiff1d(np.array(range(len(dat_vert)),dtype=np.int32),in_id)
x_shift=dat_vert[in_id,0]
# ridge patch
k=0
zup=dat_vert[:,2].max()
zlw=dat_vert[:,2].min()
for i in in_id:
r=abs(dat_vert[i,1]-.5*(trunc1+trunc2))
R=.5*((dat_vert[i,2]-b2)/slope2-(dat_vert[i,2]-b1)/slope1)
h=hlw+(dat_vert[i,2]-zlw)/(zup-zlw)*(hup-hlw)
x_shift[k]=x_shift[k]+np.cos(r/R*np.pi/2.)*h
k+=1
dat_vert=np.vstack((dat_vert[out_id,:],
np.hstack((x_shift.reshape(len(in_id),1),
dat_vert[in_id,1].reshape(len(in_id),1),
dat_vert[in_id,2].reshape(len(in_id),1)))))
return dat_vert
slope1=10.;slope2=-10.
trunc1=.1;trunc2=.6
hup=0.;hlw=.08
#dat_vert=flt_patch(dat_vert,slope1,slope2,trunc1,trunc2,hlw,hup)
print omg
fout='F3D_syn.xyz'
f=open(fout,'w+')
np.savetxt(f,dat_vert,delimiter=' ', fmt='%.6f '*3)
f.close()
from subprocess import call
fin=fout
fout=fout.rsplit('.')[0]+'.stl'
mxl='xyz2stl.mlx'
call(['meshlabserver', '-i',fin,'-o',fout,'-s',mxl])
if clean==1: os.remove(fin)
# Mesh
fin=fout
if refine==1:
fout=fout.rsplit('.')[0]+'_dns.exo'
else:
fout=fout.rsplit('.')[0]+'.exo'
jou='F3D_tet.jou'
txt_jou=open(jou,'r')
txt_jou_tmp=open('tmp.jou','w+')
hf=0.0025 # fault grid length (0.0025 for ~100 m tet model, 0.003 for ~40 m)
hm=0.0075 # matrix grid length (0.0075 for ~100 m tet model, 0.010 for ~40 m)
for line in txt_jou:
line=line.strip('\r\n')
if 'import' in line.lower():
line='import stl "'+fin+'"'
if 'export' in line.lower():
line='export mesh "'+fout+'" dimension 3 overwrite'
if 'surface 46 94 95 97 size' in line.lower():
line='surface 46 94 95 97 size %0.6f' %(2*hf)
if 'volume all size' in line.lower():
line='volume all size %0.6f' %(2*hm)
txt_jou_tmp.write(line+'\n')
if 'mesh volume all' in line.lower() and refine==1:
txt_jou_tmp.write('refine volume all\n')
txt_jou.close();txt_jou_tmp.close()
call(['trelis','-nojournal','-nographics','tmp.jou'])
if clean==1: os.remove('tmp.jou')
# Preprocessing msh=>inp
dt_dyn=2E-5 #1E-5 for dns 100 m tet model, 8E-5 for 40 m tet, 8E-4 for ~1 m tet
import F3D_msh2inp
_=F3D_msh2inp.msh2inp(fout,dt_dyn)
# Fault plot
if vis==1:
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(dat_vert[:,0], dat_vert[:,1], dat_vert[:,2], c='b', marker='.')
# Create cubic bounding box to simulate equal aspect ratio
max_range = np.array([np.max(dat_vert[:,0])-np.min(dat_vert[:,0]),np.max(dat_vert[:,1])\
-np.min(dat_vert[:,1]), np.max(dat_vert[:,2])-np.min(dat_vert[:,2])]).max()
Xb = 0.5*max_range*np.mgrid[-1:2:2,-1:2:2,-1:2:2][0].flatten()
Yb = 0.5*max_range*np.mgrid[-1:2:2,-1:2:2,-1:2:2][1].flatten()
Zb = 0.5*max_range*np.mgrid[-1:2:2,-1:2:2,-1:2:2][2].flatten()
for xb, yb, zb in zip(Xb, Yb, Zb):
ax.plot([xb], [yb], [zb], 'w',)
plt.title('fault [km]')
plt.grid()
plt.show()
| Chunfang/defmod-swpc | example/F3Dp/F3D_syn.py | Python | mit | 4,626 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
4372,
2615,
18750,
12324,
16371,
8737,
2100,
2004,
27937,
12324,
9808,
1010,
25353,
2015,
2013,
6131,
2140,
1035,
6994,
23615,
2015,
1012,
6131,
10994,
29097,
12324,
19589,
29097,
2013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
require_relative 'api_fixtures_helper'
class FakeApiResponse
include ApiFixturesHelper
def app_init
parse(app_init_plist)
end
def all_cinemas
parse(all_cinemas_plist)
end
def film_times(cinema_id, film_id)
parse(film_times_plist(cinema_id, film_id))
end
end
| andycroll/odeon_uk | test/support/fake_api_response.rb | Ruby | agpl-3.0 | 288 | [
30522,
5478,
1035,
5816,
1005,
17928,
1035,
17407,
1035,
2393,
2121,
1005,
2465,
8275,
9331,
7442,
13102,
5644,
2063,
2421,
17928,
8873,
18413,
14900,
16001,
4842,
13366,
10439,
1035,
1999,
4183,
11968,
3366,
1006,
10439,
1035,
1999,
4183,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
$woo_options = get_option( 'woo_options' );
/*------------------------------------------------------------------------------------
TABLE OF CONTENTS
- Theme Setup
- Woo Conditionals
- Add Google Maps to HEAD
- Load style.css in the <head>
- Add custom styling
- Add layout to body_class output
- WooSlider Setup
- WooSlider Magazine template
- Navigation
- Post More
- Video Embed
- Single Post Author
- Yoast Breadcrumbs
- Subscribe & Connect
- Optional Top Navigation (WP Menus)
- Footer Widgetized Areas
- Add customisable footer areas
- Add customisable post meta
- Add Post Thumbnail to Single posts on Archives
- Post Inside After
- Modify the default "comment" form field.
- Add theme default comment form fields.
- Add theme default comment form arguments.
- Activate shortcode compatibility in our new custom areas.
- woo_content_templates_magazine()
- woo_feedburner_link()
- Help WooTumblog to recognise if it's on the "Magazine" page template
- Enqueue Dynamic CSS
- Load responsive IE scripts
- Load site width CSS in the header
- Function to optionally remove responsive design and load in fallback CSS styling.
- Remove responsive design in IE8
- Adjust the homepage query, if using the "Magazine" page template as the homepage.
- Enable Tumblog
- Full width header
- Full width footer
- Full Width Markup Functions
- Full width body classes
- Optionally load custom logo.
- Optionally load the mobile navigation toggle.
- Optionally load top ad section into the header.
------------------------------------------------------------------------------------*/
// Check for and enqueue custom styles, if necessary.
add_action( 'woothemes_wp_head_before', 'woo_enqueue_custom_styling', 9 );
// Add layout to body_class output
add_filter( 'body_class','woo_layout_body_class', 10 );
// WooSlider Setup
add_action( 'woo_head','woo_slider', 10 );
// Navigation
add_action( 'woo_header_after','woo_nav', 10 );
// Subscribe links in navigation
add_action( 'woo_nav_inside','woo_nav_subscribe', 20 );
// Woo Conditionals
add_action( 'woo_head', 'woo_conditionals', 10 );
// Author Box
add_action( 'wp_head', 'woo_author', 10 );
// Single post navigation
add_action( 'woo_post_after', 'woo_postnav', 10 );
// Add Google Fonts output to HEAD
add_action( 'wp_head', 'woo_google_webfonts', 10 );
// Breadcrumbs
if ( isset( $woo_options['woo_breadcrumbs_show'] ) && $woo_options['woo_breadcrumbs_show'] == 'true' ) {
add_action( 'woo_loop_before', 'woo_breadcrumbs', 10 );
}
// Subscribe & Connect
add_action( 'wp_head', 'woo_subscribe_connect_action', 10 );
// Optional Top Navigation (WP Menus)
add_action( 'woo_top', 'woo_top_navigation', 10 );
// Remove responsive design
if ( isset( $woo_options['woo_remove_responsive'] ) && $woo_options['woo_remove_responsive'] == 'true' ) {
add_action( 'init', 'woo_remove_responsive_design', 10 );
}
// Remove the banner warning about static home page
if ( is_admin() && current_user_can( 'manage_options' ) && ( 0 < intval( get_option( 'page_on_front' ) ) ) ) {
remove_action( 'wooframework_container_inside', 'wooframework_add_static_front_page_banner' );
}
/*-----------------------------------------------------------------------------------*/
/* Theme Setup */
/*-----------------------------------------------------------------------------------*/
/**
* Theme Setup
*
* This is the general theme setup, where we add_theme_support(), create global variables
* and setup default generic filters and actions to be used across our theme.
*
* @package WooFramework
* @subpackage Logic
*/
/**
* Set the content width based on the theme's design and stylesheet.
*
* Used to set the width of images and content. Should be equal to the width the theme
* is designed for, generally via the style.css stylesheet.
*/
if ( ! isset( $content_width ) ) $content_width = 640;
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which runs
* before the init hook. The init hook is too late for some features, such as indicating
* support for post thumbnails.
*
* To override woothemes_setup() in a child theme, add your own woothemes_setup to your child theme's
* functions.php file.
*
* @uses add_theme_support() To add support for post thumbnails and automatic feed links.
* @uses add_editor_style() To style the visual editor.
*/
add_action( 'after_setup_theme', 'woothemes_setup' );
if ( ! function_exists( 'woothemes_setup' ) ) {
function woothemes_setup () {
// This theme styles the visual editor with editor-style.css to match the theme style.
add_editor_style();
// This theme uses post thumbnails
add_theme_support( 'post-thumbnails' );
// Add default posts and comments RSS feed links to head
add_theme_support( 'automatic-feed-links' );
} // End woothemes_setup()
}
/*-----------------------------------------------------------------------------------*/
/* Woo Conditionals */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_conditionals' ) ) {
function woo_conditionals () {
// Video Embed
if( is_single() && ( 'portfolio' != get_post_type() ) ) {
add_action( 'woo_post_inside_before', 'canvas_get_embed' );
}
// Post More
if ( ! is_singular() && ! is_404() || is_page_template( 'template-blog.php' ) || is_page_template( 'template-magazine.php' ) || is_page_template( 'template-widgets.php' ) ) {
add_action( 'woo_post_inside_after', 'woo_post_more' );
}
// Tumblog Content
if ( 'true' == get_option( 'woo_woo_tumblog_switch' ) ) {
add_action( 'woo_tumblog_content_before', 'woo_tumblog_content' );
add_action( 'woo_tumblog_content_after', 'woo_tumblog_content' );
}
} // End woo_conditionals()
}
/*-----------------------------------------------------------------------------------*/
/* Add Google Maps to HEAD */
/*-----------------------------------------------------------------------------------*/
add_action( 'woo_head', 'woo_google_maps', 10 ); // Add custom styling to HEAD
if ( ! function_exists( 'woo_google_maps' ) ) {
function woo_google_maps() {
if ( is_page_template( 'template-contact.php' ) ) {
$maps_url = 'http://maps.google.com/maps/api/js?sensor=false';
if ( is_ssl() ) $maps_url = str_replace( 'http://', 'https://', $maps_url );
?>
<script type="text/javascript" src="<?php echo esc_url( $maps_url ); ?>"></script>
<?php
}
} // End woo_google_maps()
}
/*-----------------------------------------------------------------------------------*/
/* Load style.css in the <head> */
/*-----------------------------------------------------------------------------------*/
if ( ! is_admin() ) { add_action( 'wp_enqueue_scripts', 'woo_load_frontend_css', 20 ); }
if ( ! function_exists( 'woo_load_frontend_css' ) ) {
function woo_load_frontend_css () {
wp_register_style( 'theme-stylesheet', get_stylesheet_uri(), array(), '5.2.0', 'all' );
wp_enqueue_style( 'theme-stylesheet' );
wp_register_style( 'woo-layout', get_template_directory_uri() . '/css/layout.css' );
wp_enqueue_style( 'woo-layout' );
} // End woo_load_frontend_css()
}
/*-----------------------------------------------------------------------------------*/
/* Load responsive <meta> tags in the <head> */
/*-----------------------------------------------------------------------------------*/
add_action( 'wp_head', 'woo_load_responsive_meta_tags', 10 );
if ( ! function_exists( 'woo_load_responsive_meta_tags' ) ) {
function woo_load_responsive_meta_tags () {
$html = '';
$html .= "\n" . '<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame -->' . "\n";
$html .= '<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />' . "\n";
/* Remove this if not responsive design */
$html .= "\n" . '<!-- Mobile viewport scale -->' . "\n";
$html .= '<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=yes" name="viewport"/>' . "\n";
echo $html;
} // End woo_load_responsive_meta_tags()
}
/*-----------------------------------------------------------------------------------*/
/* // Add custom styling */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_custom_styling' ) ) {
function woo_custom_styling() {
global $woo_options;
$output = '';
// Logo
if ( isset( $woo_options['woo_logo'] ) && $woo_options['woo_logo'] ) $output .= '#logo .site-title, #logo .site-description { display:none; }' . "\n";
// Check if we are wanting to generate the custom styling or not.
if ( isset( $woo_options['woo_style_disable'] ) && $woo_options['woo_style_disable'] != 'true' ) {} else {
if ( $output != '' ) { echo $output; }
return;
}
// Layout styling
$bg = $woo_options['woo_style_bg'];
$bg_image = $woo_options['woo_style_bg_image'];
$bg_image_repeat = $woo_options['woo_style_bg_image_repeat'];
$bg_image_pos = $woo_options['woo_style_bg_image_pos'];
$bg_image_attach = $woo_options['woo_style_bg_image_attach'];
$border_top = $woo_options['woo_border_top'];
$border_general = $woo_options['woo_style_border'];
$body = '';
if ($bg)
$body .= 'background-color:'.$bg.';';
if ($bg_image)
$body .= 'background-image:url('.$bg_image.');';
if ($bg_image_repeat)
$body .= 'background-repeat:'.$bg_image_repeat.';';
if ($bg_image_pos)
$body .= 'background-position:'.$bg_image_pos.';';
if ($bg_image_attach)
$body .= 'background-attachment:'.$bg_image_attach.';';
if ($border_top && $border_top['width'] >= 0)
$body .= 'border-top:'.$border_top["width"].'px '.$border_top["style"].' '.$border_top["color"].';';
if ( $body != '' )
$output .= 'body {'. $body . '}'. "\n";
if ( $border_general )
$output .= 'hr, .entry img, img.thumbnail, .entry .wp-caption, #footer-widgets, #comments, #comments .comment.thread-even, #comments ul.children li, .entry h1{border-color:'. $border_general . '}'. "\n";
// General styling
$link = $woo_options['woo_link_color'];
$hover = $woo_options['woo_link_hover_color'];
$button = $woo_options['woo_button_color'];
$button_hover = $woo_options['woo_button_hover_color'];
if ($link)
$output .= 'a:link, a:visited {color:'.$link.'}' . "\n";
if ($hover)
$output .= 'a:hover, .post-more a:hover, .post-meta a:hover, .post p.tags a:hover {color:'.$hover.'}' . "\n";
if ($button)
$output .= 'body #wrapper #content .button, body #wrapper #content .button:visited, body #wrapper #content .reply a, body #wrapper #content #respond .form-submit input#submit, input[type=submit] {border: none; background:'.$button.'}' . "\n";
if ($button_hover)
$output .= 'body #wrapper #content .button:hover, body #wrapper #content .reply a:hover, body #wrapper #content #respond .form-submit input#submit:hover, input[type=submit]:hover {border: none; background:'.$button_hover.'}' . "\n";
// Header styling
$header_bg = $woo_options['woo_header_bg'];
$header_bg_image = $woo_options['woo_header_bg_image'];
$header_bg_image_repeat = $woo_options['woo_header_bg_image_repeat'];
$header_border = $woo_options['woo_header_border'];
$header_margin_top = $woo_options['woo_header_margin_top'];
$header_margin_bottom = $woo_options['woo_header_margin_bottom'];
$header_padding_top = $woo_options['woo_header_padding_top'];
$header_padding_bottom = $woo_options['woo_header_padding_bottom'];
$header_padding_left = $woo_options['woo_header_padding_left'];
$header_padding_right = $woo_options['woo_header_padding_right'];
$font_logo = $woo_options['woo_font_logo'];
$font_desc = $woo_options['woo_font_desc'];
$header_css = '';
if ( $header_bg )
$header_css .= 'background-color:'.$header_bg.';';
if ( $header_bg_image )
$header_css .= 'background-image:url('.$header_bg_image.');';
if ( $header_bg_image_repeat )
$header_css .= 'background-repeat:'.$header_bg_image_repeat.';background-position:left top;';
if ( $header_margin_top <> '' || $header_margin_bottom <> '' )
$header_css .= 'margin-top:'.$header_margin_top.'px;margin-bottom:'.$header_margin_bottom.'px;';
if ( $header_padding_top <> '' || $header_padding_bottom <> '' )
$header_css .= 'padding-top:'.$header_padding_top.'px;padding-bottom:'.$header_padding_bottom.'px;';
if ( $header_border && $header_border['width'] >= 0)
$header_css .= 'border:'.$header_border["width"].'px '.$header_border["style"].' '.$header_border["color"].';';
/*if ( $header_border && $header_border['width'] > 0) {
$width = get_option('woo_layout_width') - $header_border['width']*2;
if ( $width > 0 )
$header_css .= 'width:'.$width.'px;';
}*/
if ( $header_css != '' )
$output .= '#header {'. $header_css . '}'. "\n";
if ( $header_padding_left <> '' )
$output .= '#logo {padding-left:'.$header_padding_left.'px;}';
if ( $header_padding_right <> '' )
$output .= '#topad {padding-right:'.$header_padding_right.'px;}'. "\n";
if ( $font_logo )
$output .= '#logo .site-title a {' . woo_generate_font_css( $font_logo ) . '}' . "\n";
if ( $font_desc )
$output .= '#logo .site-description {' . woo_generate_font_css( $font_desc ) . '}' . "\n";
// Boxed styling
$boxed = $woo_options['woo_layout_boxed'];
$box_bg = $woo_options['woo_style_box_bg'];
$box_margin_top = $woo_options['woo_box_margin_top'];
$box_margin_bottom = $woo_options['woo_box_margin_bottom'];
$box_border_tb = $woo_options['woo_box_border_tb'];
$box_border_lr = $woo_options['woo_box_border_lr'];
$box_border_radius = $woo_options['woo_box_border_radius'];
$box_shadow = $woo_options['woo_box_shadow'];
$wrapper = '';
if ($boxed == "true") {
//$wrapper .= 'margin:0 auto;padding:0 0 20px 0;width:'.get_option('woo_layout_width').';';
if ( get_option('woo_layout_width') == '940px' )
$wrapper .= 'padding-left:20px; padding-right:20px;';
else
$wrapper .= 'padding-left:30px; padding-right:30px;';
}
if ($boxed == "true" && $box_bg)
$wrapper .= 'background-color:'.$box_bg.';';
if ($boxed == "true" && ($box_margin_top || $box_margin_bottom) )
$wrapper .= 'margin-top:'.$box_margin_top.'px;margin-bottom:'.$box_margin_bottom.'px;';
if ($boxed == "true" && $box_border_tb["width"] > 0 )
$wrapper .= 'border-top:'.$box_border_tb["width"].'px '.$box_border_tb["style"].' '.$box_border_tb["color"].';border-bottom:'.$box_border_tb["width"].'px '.$box_border_tb["style"].' '.$box_border_tb["color"].';';
if ($boxed == "true" && $box_border_lr["width"] > 0 )
$wrapper .= 'border-left:'.$box_border_lr["width"].'px '.$box_border_lr["style"].' '.$box_border_lr["color"].';border-right:'.$box_border_lr["width"].'px '.$box_border_lr["style"].' '.$box_border_lr["color"].';';
if ( $boxed == "true" && $box_border_radius )
$wrapper .= 'border-radius:'.$box_border_radius.';';
if ( $boxed == "true" && $box_shadow == "true" )
$wrapper .= 'box-shadow: 0px 1px 5px rgba(0,0,0,.1);';
if ( $wrapper != '' )
$output .= '#inner-wrapper {'. $wrapper . '} .col-full { width: auto; } @media only screen and (max-width:767px) { #inner-wrapper { margin:0; border-radius:none; padding-left:1em; padding-right: 1em; border: none; } } '. "\n";
// Full width layout
if ( $boxed != "true" && (isset( $woo_options['woo_header_full_width'] ) && ( $woo_options['woo_header_full_width'] == 'true' ) || isset( $woo_options['woo_footer_full_width'] ) && ( $woo_options['woo_footer_full_width'] == 'true' ) ) ) {
if ( isset( $woo_options['woo_header_full_width'] ) && $woo_options['woo_header_full_width'] == 'true' ) {
$full_head_bg = $woo_options['woo_full_header_full_width_bg'];
$full_header_bg_image = $woo_options['woo_full_header_bg_image'];
$full_header_bg_image_repeat = $woo_options['woo_full_header_bg_image_repeat'];
$full_nav_bg = $woo_options['woo_nav_bg'];
$full_nav_border = $woo_options['woo_nav_divider_border'];
$full_nav_border_top = $woo_options['woo_nav_border_top'];
$full_nav_border_bot = $woo_options['woo_nav_border_bot'];
if ( $full_head_bg )
$output .= '#header-container{background-color:' . $full_head_bg . ';}';
if ( $full_header_bg_image )
$output .= '#header-container{background-image:url('.$full_header_bg_image.');background-repeat:'.$full_header_bg_image_repeat.';background-position:top center;}';
if ( $full_nav_bg )
$output .= '#nav-container{background:' . $full_nav_bg . ';}';
if ( $full_nav_border_top && $full_nav_border_top["width"] >= 0 )
$output .= '#nav-container{border-top:'.$full_nav_border_top["width"].'px '.$full_nav_border_top["style"].' '.$full_nav_border_top["color"].';border-bottom:'.$full_nav_border_bot["width"].'px '.$full_nav_border_bot["style"].' '.$full_nav_border_bot["color"].';border-left:none;border-right:none;}';
if ( $full_nav_border && $full_nav_border["width"] >= 0 )
$output .= '#nav-container #navigation ul#main-nav > li:first-child{border-left: '.$full_nav_border["width"].'px '.$full_nav_border["style"].' '.$full_nav_border["color"].';}';
}
if ( isset( $woo_options['woo_footer_full_width'] ) && ( 'true' == $woo_options['woo_footer_full_width'] ) ) {
$full_foot_widget_bg = $woo_options['woo_foot_full_width_widget_bg'];
$full_foot_bg = $woo_options['woo_footer_full_width_bg'];
$footer_bg = $woo_options['woo_footer_bg'];
$full_footer_border_top = $woo_options['woo_footer_border_top'];
if ( $full_foot_widget_bg )
$output .= '#footer-widgets-container{background-color:' . $full_foot_widget_bg . '}#footer-widgets{border:none;}';
if ( $full_foot_bg )
$output .= '#footer-container{background-color:' . $full_foot_bg . '}';
if ( $full_footer_border_top && $full_footer_border_top["width"] >= 0 )
$output .= '#footer-container{border-top:'.$full_footer_border_top["width"].'px '.$full_footer_border_top["style"].' '.$full_footer_border_top["color"].';}#footer {border-width: 0 !important;}';
}
$output .= "\n";
}
// General Typography
$font_text = $woo_options['woo_font_text'];
$font_h1 = $woo_options['woo_font_h1'];
$font_h2 = $woo_options['woo_font_h2'];
$font_h3 = $woo_options['woo_font_h3'];
$font_h4 = $woo_options['woo_font_h4'];
$font_h5 = $woo_options['woo_font_h5'];
$font_h6 = $woo_options['woo_font_h6'];
if ( $font_text )
$output .= 'body, p { ' . woo_generate_font_css( $font_text, 1.5 ) . ' }' . "\n";
if ( $font_h1 )
$output .= 'h1 { ' . woo_generate_font_css( $font_h1, 1.2 ) . ' }';
if ( $font_h2 )
$output .= 'h2 { ' . woo_generate_font_css( $font_h2, 1.2 ) . ' }';
if ( $font_h3 )
$output .= 'h3 { ' . woo_generate_font_css( $font_h3, 1.2 ) . ' }';
if ( $font_h4 )
$output .= 'h4 { ' . woo_generate_font_css( $font_h4, 1.2 ) . ' }';
if ( $font_h5 )
$output .= 'h5 { ' . woo_generate_font_css( $font_h5, 1.2 ) . ' }';
if ( $font_h6 )
$output .= 'h6 { ' . woo_generate_font_css( $font_h6, 1.2 ) . ' }' . "\n";
// Post Styling
$font_post_title = $woo_options['woo_font_post_title'];
$font_post_meta = $woo_options['woo_font_post_meta'];
$font_post_text = $woo_options['woo_font_post_text'];
$font_post_more = $woo_options['woo_font_post_more'];
$post_more_border_top = $woo_options['woo_post_more_border_top'];
$post_more_border_bottom = $woo_options['woo_post_more_border_bottom'];
$post_comments_bg = $woo_options['woo_post_comments_bg'];
$post_author_border_top = $woo_options['woo_post_author_border_top'];
$post_author_border_bottom = $woo_options['woo_post_author_border_bottom'];
$post_author_border_lr = $woo_options['woo_post_author_border_lr'];
$post_author_border_radius = $woo_options['woo_post_author_border_radius'];
$post_author_bg = $woo_options['woo_post_author_bg'];
if ( $font_post_title )
$output .= '.page-title, .post .title, .page .title {'.woo_generate_font_css( $font_post_title, 1.1 ).'}' . "\n";
$output .= '.post .title a:link, .post .title a:visited, .page .title a:link, .page .title a:visited {color:'.$font_post_title["color"].'}' . "\n";
if ( $font_post_meta )
$output .= '.post-meta { ' . woo_generate_font_css( $font_post_meta, 1.5 ) . ' }' . "\n";
if ( $font_post_text )
$output .= '.entry, .entry p{ ' . woo_generate_font_css( $font_post_text, 1.5 ) . ' }' . "\n";
$post_more_border = '';
if ( $font_post_more )
$post_more_border .= 'font:'.$font_post_more["style"].' '.$font_post_more["size"].$font_post_more["unit"].'/1.5em '.stripslashes($font_post_more["face"]).';color:'.$font_post_more["color"].';';
if ( $post_more_border_top )
$post_more_border .= 'border-top:'.$post_more_border_top["width"].'px '.$post_more_border_top["style"].' '.$post_more_border_top["color"].';';
if ( $post_more_border_bottom )
$post_more_border .= 'border-bottom:'.$post_more_border_bottom["width"].'px '.$post_more_border_bottom["style"].' '.$post_more_border_bottom["color"].';';
if ( $post_more_border )
$output .= '.post-more {'.$post_more_border .'}' . "\n";
if ( $post_comments_bg )
$output .= '#comments .comment.thread-even {background-color:'.$post_comments_bg.';}' . "\n";
$post_author = '';
if ( $post_author_border_top )
$post_author .= 'border-top:'.$post_author_border_top["width"].'px '.$post_author_border_top["style"].' '.$post_author_border_top["color"].';';
if ( $post_author_border_bottom )
$post_author .= 'border-bottom:'.$post_author_border_bottom["width"].'px '.$post_author_border_bottom["style"].' '.$post_author_border_bottom["color"].';';
if ( $post_author_border_lr )
$post_author .= 'border-left:'.$post_author_border_lr["width"].'px '.$post_author_border_lr["style"].' '.$post_author_border_lr["color"].';border-right:'.$post_author_border_lr["width"].'px '.$post_author_border_lr["style"].' '.$post_author_border_lr["color"].';';
if ( $post_author_border_radius )
$post_author .= 'border-radius:'.$post_author_border_radius.';-moz-border-radius:'.$post_author_border_radius.';-webkit-border-radius:'.$post_author_border_radius.';';
if ( $post_author_bg )
$post_author .= 'background-color:'.$post_author_bg;
if ( $post_author )
$output .= '#post-author, #connect {'.$post_author .'}' . "\n";
if ( $post_comments_bg )
$output .= '#comments .comment.thread-even {background-color:'.$post_comments_bg.';}' . "\n";
// Page Nav Styling
$pagenav_font = $woo_options['woo_pagenav_font'];
$pagenav_bg = $woo_options['woo_pagenav_bg'];
$pagenav_border_top = $woo_options['woo_pagenav_border_top'];
$pagenav_border_bottom = $woo_options['woo_pagenav_border_bottom'];
$pagenav_css = '';
if ( $pagenav_bg )
$pagenav_css .= 'background-color:'.$pagenav_bg.';';
if ( $pagenav_border_top && $pagenav_border_top["width"] > 0 )
$pagenav_css .= 'border-top:'.$pagenav_border_top["width"].'px '.$pagenav_border_top["style"].' '.$pagenav_border_top["color"].';';
if ( $pagenav_border_bottom && $pagenav_border_bottom["width"] > 0 )
$pagenav_css .= 'border-bottom:'.$pagenav_border_bottom["width"].'px '.$pagenav_border_bottom["style"].' '.$pagenav_border_bottom["color"].';';
if ( $pagenav_css != '' )
$output .= '.nav-entries, .woo-pagination {'. $pagenav_css . ' padding: 12px 0px; }'. "\n";
if ( $pagenav_font ) {
$output .= '.nav-entries a, .woo-pagination { ' . woo_generate_font_css( $pagenav_font ) . ' }' . "\n";
$output .= '.woo-pagination a, .woo-pagination a:hover {color:'.$pagenav_font["color"].'!important}' . "\n";
}
// Widget Styling
$widget_font_title = $woo_options['woo_widget_font_title'];
$widget_font_text = $woo_options['woo_widget_font_text'];
$widget_padding_tb = $woo_options['woo_widget_padding_tb'];
$widget_padding_lr = $woo_options['woo_widget_padding_lr'];
$widget_bg = $woo_options['woo_widget_bg'];
$widget_border = $woo_options['woo_widget_border'];
$widget_title_border = $woo_options['woo_widget_title_border'];
$widget_border_radius = $woo_options['woo_widget_border_radius'];
$h3_css = '';
if ( $widget_font_title )
$h3_css .= 'font:'.$widget_font_title["style"].' '.$widget_font_title["size"].$widget_font_title["unit"].'/1.2em '.stripslashes($widget_font_title["face"]).';color:'.$widget_font_title["color"].';';
if ( $widget_title_border )
$h3_css .= 'border-bottom:'.$widget_title_border["width"].'px '.$widget_title_border["style"].' '.$widget_title_border["color"].';';
if ( isset( $widget_title_border["width"] ) AND $widget_title_border["width"] == 0 )
$h3_css .= 'margin-bottom:0;';
if ( $h3_css != '' )
$output .= '.widget h3 {'. $h3_css . '}'. "\n";
if ( $widget_title_border )
$output .= '.widget_recent_comments li, #twitter li { border-color: '.$widget_title_border["color"].';}'. "\n";
if ( $widget_font_text )
$output .= '.widget p, .widget .textwidget { ' . woo_generate_font_css( $widget_font_text, 1.5 ) . ' }' . "\n";
$widget_css = '';
if ( $widget_font_text )
$widget_css .= 'font:'.$widget_font_text["style"].' '.$widget_font_text["size"].$widget_font_text["unit"].'/1.5em '.stripslashes($widget_font_text["face"]).';color:'.$widget_font_text["color"].';';
if ( $widget_padding_tb || $widget_padding_lr )
$widget_css .= 'padding:'.$widget_padding_tb.'px '.$widget_padding_lr.'px;';
if ( $widget_bg )
$widget_css .= 'background-color:'.$widget_bg.';';
if ( $widget_border["width"] > 0 )
$widget_css .= 'border:'.$widget_border["width"].'px '.$widget_border["style"].' '.$widget_border["color"].';';
if ( $widget_border_radius )
$widget_css .= 'border-radius:'.$widget_border_radius.';-moz-border-radius:'.$widget_border_radius.';-webkit-border-radius:'.$widget_border_radius.';';
if ( $widget_css != '' )
$output .= '.widget {'. $widget_css . '}'. "\n";
if ( $widget_border["width"] > 0 )
$output .= '#tabs {border:'.$widget_border["width"].'px '.$widget_border["style"].' '.$widget_border["color"].';}'. "\n";
// Tabs Widget
$widget_tabs_bg = $woo_options['woo_widget_tabs_bg'];
$widget_tabs_bg_inside = $woo_options['woo_widget_tabs_bg_inside'];
$widget_tabs_font = $woo_options['woo_widget_tabs_font'];
$widget_tabs_font_meta = $woo_options['woo_widget_tabs_font_meta'];
if ( $widget_tabs_bg )
$output .= '#tabs, .widget_woodojo_tabs .tabbable {background-color:'.$widget_tabs_bg.';}'. "\n";
if ( $widget_tabs_bg_inside )
$output .= '#tabs .inside, #tabs ul.wooTabs li a.selected, #tabs ul.wooTabs li a:hover {background-color:'.$widget_tabs_bg_inside.';}'. "\n";
if ( $widget_tabs_font )
$output .= '#tabs .inside li a, .widget_woodojo_tabs .tabbable .tab-pane li a { ' . woo_generate_font_css( $widget_tabs_font, 1.5 ) . ' }'. "\n";
if ( $widget_tabs_font_meta )
$output .= '#tabs .inside li span.meta, .widget_woodojo_tabs .tabbable .tab-pane li span.meta { ' . woo_generate_font_css( $widget_tabs_font_meta, 1.5 ) . ' }'. "\n";
$output .= '#tabs ul.wooTabs li a, .widget_woodojo_tabs .tabbable .nav-tabs li a { ' . woo_generate_font_css( $widget_tabs_font_meta, 2 ) . ' }'. "\n";
//Navigation
$nav_bg = $woo_options['woo_nav_bg'];
$nav_font = $woo_options['woo_nav_font'];
$nav_hover = $woo_options['woo_nav_hover'];
$nav_hover_bg = $woo_options['woo_nav_hover_bg'];
$nav_currentitem = $woo_options['woo_nav_currentitem'];
$nav_currentitem_bg = $woo_options['woo_nav_currentitem_bg'];
$nav_divider_border = $woo_options['woo_nav_divider_border'];
$nav_dropdown_border = $woo_options['woo_nav_dropdown_border'];
$nav_border_lr = $woo_options['woo_nav_border_lr'];
$nav_border_radius = $woo_options['woo_nav_border_radius'];
$nav_border_top = $woo_options['woo_nav_border_top'];
$nav_border_bot = $woo_options['woo_nav_border_bot'];
$top_nav_bg = $woo_options['woo_top_nav_bg'];
$top_nav_hover = $woo_options['woo_top_nav_hover'];
$top_nav_hover_bg = $woo_options['woo_top_nav_hover_bg'];
$top_nav_font = $woo_options['woo_top_nav_font'];
global $is_IE;
if ( !$is_IE )
$output .= '@media only screen and (min-width:768px) {' . "\n";
if ( $nav_font )
$output .= 'ul.nav li a, #navigation ul.rss a, #navigation .cart-contents, #navigation ul.rss { ' . woo_generate_font_css( $nav_font ) . ' } #navigation ul.rss li a:before { color:' . $nav_font['color'] . ';}' . "\n";
if ( $nav_hover )
$output .= '#navigation ul.nav > li a:hover, #navigation ul.nav > li:hover a, #navigation ul.nav li ul li a { color:'.$nav_hover.'!important; }' . "\n";
if ( $nav_hover_bg )
$output .= '#navigation ul.nav > li a:hover, #navigation ul.nav > li:hover, #navigation ul.nav li ul {background-color:'.$nav_hover_bg.'!important}' . "\n";
if ( $nav_dropdown_border && $nav_dropdown_border["width"] >= 0 ) {
$output .= '#navigation ul.nav li ul { border: '.$nav_dropdown_border["width"].'px '.$nav_dropdown_border["style"].' '.$nav_dropdown_border["color"].'; }' . "\n";
if ($nav_dropdown_border["width"] == 0) {
$output .= '#navigation ul.nav > li > ul { left: 0; }' . "\n";
}
}
if ( $nav_divider_border && $nav_divider_border["width"] >= 0 ) {
$output .= '#navigation ul.nav > li { border-right: '.$nav_divider_border["width"].'px '.$nav_divider_border["style"].' '.$nav_divider_border["color"].'; }';
if ($nav_divider_border["width"] == 0) {
$output .= '#navigation ul.nav > li > ul { left: 0; }' . "\n";
}
}
// If we have a hover colour and don't have a current item colour, we use the hover colour as current item colour.
if ( $nav_currentitem_bg == '' && $nav_hover != '' ) { $nav_currentitem_bg = $nav_hover; }
if ( $nav_currentitem_bg ) {
$output .= '#navigation ul.nav li.current_page_item a, #navigation ul.nav li.current_page_parent a, #navigation ul.nav li.current-menu-ancestor a, #navigation ul.nav li.current-cat a, #navigation ul.nav li.current-menu-item a { background-color:' . $nav_currentitem_bg . '; }' . "\n";
}
if ( $nav_currentitem ) {
$output .= '#navigation ul.nav li.current_page_item a, #navigation ul.nav li.current_page_parent a, #navigation ul.nav li.current-menu-ancestor a, #navigation ul.nav li.current-cat a, #navigation ul.nav li.current-menu-item a { color:' . $nav_currentitem . '; }' . "\n";
}
$navigation_css = '';
if ( $nav_bg )
$navigation_css .= 'background:'.$nav_bg.';';
if ( $nav_border_top && $nav_border_top["width"] >= 0 )
$navigation_css .= 'border-top:'.$nav_border_top["width"].'px '.$nav_border_top["style"].' '.$nav_border_top["color"].';border-bottom:'.$nav_border_bot["width"].'px '.$nav_border_bot["style"].' '.$nav_border_bot["color"].';border-left:'.$nav_border_lr["width"].'px '.$nav_border_lr["style"].' '.$nav_border_lr["color"].';border-right:'.$nav_border_lr["width"].'px '.$nav_border_lr["style"].' '.$nav_border_lr["color"].';';
if ( $nav_border_bot && $nav_border_bot["width"] == 0 )
$output .= '#navigation { box-shadow: none; -moz-box-shadow: none; -webkit-box-shadow: none; }';
if ( $nav_border_radius )
$navigation_css .= 'border-radius:'.$nav_border_radius.'; -moz-border-radius:'.$nav_border_radius.'; -webkit-border-radius:'.$nav_border_radius.';';
if ( $nav_border_radius )
$output .= '#navigation ul li:first-child, #navigation ul li:first-child a { border-radius:'.$nav_border_radius.' 0 0 '.$nav_border_radius.'; -moz-border-radius:'.$nav_border_radius.' 0 0 '.$nav_border_radius.'; -webkit-border-radius:'.$nav_border_radius.' 0 0 '.$nav_border_radius.'; }' . "\n";
if ( $navigation_css != '' )
$output .= '#navigation {'. $navigation_css . '}'. "\n";
if ( $top_nav_bg )
$output .= '#top, #top ul.nav li ul li a:hover { background:'.$top_nav_bg.';}'. "\n";
if ( $top_nav_hover )
$output .= '#top ul.nav li a:hover, #top ul.nav li.current_page_item a, #top ul.nav li.current_page_parent a,#top ul.nav li.current-menu-ancestor a,#top ul.nav li.current-cat a,#top ul.nav li.current-menu-item a,#top ul.nav li.sfHover, #top ul.nav li ul, #top ul.nav > li:hover a, #top ul.nav li ul li a { color:'.$top_nav_hover.'!important;}'. "\n";
if ( $top_nav_hover_bg )
$output .= '#top ul.nav li a:hover, #top ul.nav li.current_page_item a, #top ul.nav li.current_page_parent a,#top ul.nav li.current-menu-ancestor a,#top ul.nav li.current-cat a,#top ul.nav li.current-menu-item a,#top ul.nav li.sfHover, #top ul.nav li ul, #top ul.nav > li:hover { background:'.$top_nav_hover_bg.';}'. "\n";
if ( $top_nav_font ) {
$output .= '#top ul.nav li a { ' . woo_generate_font_css( $top_nav_font, 1.6 ) . ' }' . "\n";
if ( isset( $top_nav_font['color'] ) && strlen( $top_nav_font['color'] ) == 7 ) {
$output .= '#top ul.nav li.parent > a:after { border-top-color:'. esc_attr( $top_nav_font['color'] ) .';}'. "\n";
}
}
if ( !$is_IE )
$output .= '}' . "\n";
// Footer
$footer_font = $woo_options['woo_footer_font'];
$footer_bg = $woo_options['woo_footer_bg'];
$footer_border_top = $woo_options['woo_footer_border_top'];
$footer_border_bottom = $woo_options['woo_footer_border_bottom'];
$footer_border_lr = $woo_options['woo_footer_border_lr'];
$footer_border_radius = $woo_options['woo_footer_border_radius'];
if ( $footer_font )
$output .= '#footer, #footer p { ' . woo_generate_font_css( $footer_font, 1.4 ) . ' }' . "\n";
$footer_css = '';
if ( $footer_bg )
$footer_css .= 'background-color:'.$footer_bg.';';
if ( $footer_border_top )
$footer_css .= 'border-top:'.$footer_border_top["width"].'px '.$footer_border_top["style"].' '.$footer_border_top["color"].';';
if ( $footer_border_bottom )
$footer_css .= 'border-bottom:'.$footer_border_bottom["width"].'px '.$footer_border_bottom["style"].' '.$footer_border_bottom["color"].';';
if ( $footer_border_lr )
$footer_css .= 'border-left:'.$footer_border_lr["width"].'px '.$footer_border_lr["style"].' '.$footer_border_lr["color"].';border-right:'.$footer_border_lr["width"].'px '.$footer_border_lr["style"].' '.$footer_border_lr["color"].';';
if ( $footer_border_radius )
$footer_css .= 'border-radius:'.$footer_border_radius.'; -moz-border-radius:'.$footer_border_radius.'; -webkit-border-radius:'.$footer_border_radius.';';
if ( $footer_css != '' )
$output .= '#footer {'. $footer_css . '}' . "\n";
// Magazine Template
$slider_magazine_font_title = $woo_options['woo_slider_magazine_font_title'];
$slider_magazine_font_excerpt = $woo_options['woo_slider_magazine_font_excerpt'];
$magazine_grid_font_post_title = $woo_options['woo_magazine_grid_font_post_title'];
if ( $slider_magazine_font_title )
$output .= '.magazine #loopedSlider .content h2.title a { ' . woo_generate_font_css( $slider_magazine_font_title ) . ' }'. "\n";
if ( $slider_magazine_font_excerpt )
$output .= '.magazine #loopedSlider .content .excerpt p { ' . woo_generate_font_css( $slider_magazine_font_excerpt, 1.5 ) . ' }'. "\n";
if ( $magazine_grid_font_post_title )
$output .= '.magazine .block .post .title, .magazine .block .post .title a { ' . woo_generate_font_css( $magazine_grid_font_post_title, 1.2 ) . ' }'. "\n";
// Business Template
$slider_biz_font_title = $woo_options['woo_slider_biz_font_title'];
$slider_biz_font_excerpt = $woo_options['woo_slider_biz_font_excerpt'];
if ( $slider_biz_font_title )
$output .= '.business #loopedSlider .content h2 { ' . woo_generate_font_css( $slider_biz_font_title ) . ' }'. "\n";
$output .= '.business #loopedSlider .content h2.title a { ' . woo_generate_font_css( $slider_biz_font_title ) . ' }'. "\n";
if ( $slider_biz_font_excerpt )
$output .= '#wrapper .business #loopedSlider .content p { ' . woo_generate_font_css( $slider_biz_font_excerpt, 1.5 ) . ' }'. "\n";
// Archive Header
$woo_archive_header_font = $woo_options['woo_archive_header_font'];
if ( $woo_archive_header_font )
$output .= '.archive_header { ' . woo_generate_font_css( $woo_archive_header_font ) . ' }'. "\n";
$output .= '.archive_header {border-bottom:'.$woo_options['woo_archive_header_border_bottom']["width"].'px '.$woo_options['woo_archive_header_border_bottom']["style"].' '.$woo_options['woo_archive_header_border_bottom']["color"].';}'. "\n";
if ( $woo_options['woo_archive_header_disable_rss'] == "true" )
$output .= '.archive_header .catrss { display:none; }' . "\n";
// Output styles
if (isset($output)) {
// $output = "\n<!-- Woo Custom Styling -->\n<style type=\"text/css\">\n" . $output . "</style>\n<!-- /Woo Custom Styling -->\n\n";
echo $output;
}
} // End woo_custom_styling()
}
// Returns proper font css output
if ( ! function_exists( 'woo_generate_font_css' ) ) {
function woo_generate_font_css( $option, $em = '1' ) {
// Test if font-face is a Google font
global $google_fonts;
foreach ( $google_fonts as $google_font ) {
// Add single quotation marks to font name and default arial sans-serif ending
if ( $option['face'] == $google_font['name'] )
$option['face'] = "'" . $option['face'] . "', arial, sans-serif";
} // END foreach
if ( !@$option['style'] && !@$option['size'] && !@$option['unit'] && !@$option['color'] )
return 'font-family: '.stripslashes($option["face"]).';';
else
return 'font:'.$option['style'].' '.$option['size'].$option['unit'].'/'.$em.'em '.stripslashes($option['face']).';color:'.$option['color'].';';
} // End woo_generate_font_css()
}
/*-----------------------------------------------------------------------------------*/
/* Add layout to body_class output */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_layout_body_class' ) ) {
function woo_layout_body_class( $classes ) {
global $post, $wp_query, $woo_options;
$layout = '';
// Single post layout
if ( is_singular() ) {
// Get layout setting from single post Custom Settings panel
$layout = get_post_meta( $post->ID, 'layout', true );
// Set to single post layout if selected
if ( $layout != '' ) {
$woo_options['woo_layout'] = $layout;
// Portfolio single post layout option.
} elseif ( get_post_type() == 'portfolio' ) {
$portfolio_single_layout = get_option( 'woo_portfolio_layout_single' );
if ( $portfolio_single_layout != '' ) {
$layout = $portfolio_single_layout;
$woo_options['woo_layout'] = $portfolio_single_layout;
}
}
}
// Set default global layout
if ( $layout == '' ) {
$layout = get_option( 'woo_layout' );
if ( $layout == '' )
$layout = 'two-col-left';
}
// Portfolio gallery layout option.
if ( is_tax( 'portfolio-gallery' ) || is_post_type_archive( 'portfolio' ) || is_page_template( 'template-portfolio.php' ) ) {
$portfolio_gallery_layout = get_option( 'woo_portfolio_layout' );
if ( $portfolio_gallery_layout != '' ) {
$layout = $portfolio_gallery_layout;
}
}
if ( is_tax( 'portfolio-gallery' ) || is_post_type_archive( 'portfolio' ) || is_page_template( 'template-portfolio.php' ) || ( is_singular() && get_post_type() == 'portfolio' ) ) {
$classes[] = 'portfolio-component';
}
// WooCommerce Layout
if ( class_exists( 'woocommerce' ) && function_exists( 'is_shop' ) && function_exists( 'is_cart' ) && function_exists( 'is_checkout' ) && function_exists( 'is_account_page' ) && function_exists( 'is_product' ) && ( is_woocommerce() || is_shop() || is_cart() || is_checkout() || is_account_page() || is_product() ) ) {
// Set defaul layout
$woocommerce_layout = get_option( 'woo_wc_layout' );
if ( $woocommerce_layout != '' ) {
$layout = $woocommerce_layout;
$woo_options['woo_layout'] = $woocommerce_layout;
}
// WooCommerce single post/page
if ( is_singular() ) {
// Get layout setting from single post Custom Settings panel
$single_layout = get_post_meta( $post->ID, 'layout', true );
// Set to single post layout if selected
if ( $single_layout != '' ) {
$woo_options['woo_layout'] = $single_layout;
$layout = $single_layout;
}
}
}
// Specify site width
$width = intval( str_replace( 'px', '', get_option( 'woo_layout_width', '960' ) ) );
// Add classes to body_class() output
$classes[] = $layout;
$classes[] = 'width-' . $width;
$classes[] = $layout . '-' . $width;
return $classes;
} // End woo_layout_body_class()
}
/*-----------------------------------------------------------------------------------*/
/* Woo Slider Setup */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_slider' ) ) {
function woo_slider( $load_slider_js = false ) {
global $woo_options;
$load_slider_js = false;
if ( ( is_page_template( 'template-biz.php' ) && isset( $woo_options['woo_slider_biz'] ) && $woo_options['woo_slider_biz'] == 'true' ) ||
( is_page_template( 'template-magazine.php' ) && isset( $woo_options['woo_slider_magazine'] ) && $woo_options['woo_slider_magazine'] == 'true' ) ||
is_page_template( 'template-widgets.php' ) ||
is_active_sidebar( 'homepage' ) ) { $load_slider_js = true; }
// Allow child themes/plugins to load the slider JavaScript when they need it.
$load_slider_js = (bool)apply_filters( 'woo_load_slider_js', $load_slider_js );
if ( $load_slider_js != false ) {
// Default slider settings.
$defaults = array(
'autoStart' => 0,
'autoHeight' => 'false',
'hoverPause' => 'false',
'containerClick' => 'false',
'slideSpeed' => 600,
'canAutoStart' => 'false',
'next' => 'next',
'prev' => 'previous',
'container' => 'slides',
'generatePagination' => 'false',
'crossfade' => 'true',
'fadeSpeed' => 600,
'effect' => 'slide'
);
// Dynamic settings from the "Theme Options" screen.
$args = array();
if ( isset( $woo_options['woo_slider_pagination'] ) && $woo_options['woo_slider_pagination'] == 'true' ) { $args['generatePagination'] = 'true'; }
if ( isset( $woo_options['woo_slider_effect'] ) && $woo_options['woo_slider_effect'] != '' ) { $args['effect'] = $woo_options['woo_slider_effect']; }
if ( isset( $woo_options['woo_slider_autoheight'] ) && $woo_options['woo_slider_autoheight'] == 'true' ) { $args['autoHeight'] = 'true'; }
if ( isset( $woo_options['woo_slider_hover'] ) && $woo_options['woo_slider_hover'] == 'true' ) { $args['hoverPause'] = 'true'; }
if ( isset( $woo_options['woo_slider_containerclick'] ) && $woo_options['woo_slider_containerclick'] == 'true' ) { $args['containerClick'] = 'true'; }
if ( isset( $woo_options['woo_slider_speed'] ) && $woo_options['woo_slider_speed'] != '' ) { $args['slideSpeed'] = $woo_options['woo_slider_speed'] * 1000; }
if ( isset( $woo_options['woo_slider_speed'] ) && $woo_options['woo_slider_speed'] != '' ) { $args['fadeSpeed'] = $woo_options['woo_slider_speed'] * 1000; }
if ( isset( $woo_options['woo_slider_auto'] ) && $woo_options['woo_slider_auto'] == 'true' ) {
$args['canAutoStart'] = 'true';
$args['autoStart'] = $woo_options['woo_slider_interval'] * 1000;
}
// Merge the arguments with defaults.
$args = wp_parse_args( $args, $defaults );
// Allow child themes/plugins to filter these arguments.
$args = apply_filters( 'woo_slider_args', $args );
?>
<!-- Woo Slider Setup -->
<script type="text/javascript">
jQuery(window).load(function() {
var args = {};
args.useCSS = false;
<?php if ( $args['effect'] == 'fade' ) { ?>args.animation = 'fade';
<?php } else { ?>args.animation = 'slide';<?php } ?>
<?php echo "\n"; ?>
<?php if ( $args['canAutoStart'] == 'true' ) { ?>args.slideshow = true;
<?php } else { ?>args.slideshow = false;<?php } ?>
<?php echo "\n"; ?>
<?php if ( intval( $args['autoStart'] ) > 0 ) { ?>args.slideshowSpeed = <?php echo intval( $args['autoStart'] ) ?>;<?php } ?>
<?php echo "\n"; ?>
<?php if ( intval( $args['slideSpeed'] ) >= 0 ) { ?>args.animationSpeed = <?php echo intval( $args['slideSpeed'] ) ?>;<?php } ?>
<?php echo "\n"; ?>
<?php if ( $args['generatePagination'] == 'true' ) { ?>args.controlNav = true;
<?php } else { ?>args.controlNav = false;<?php } ?>
<?php echo "\n"; ?>
<?php if ( $args['hoverPause'] == 'true' ) { ?>args.pauseOnHover = true;
<?php } else { ?>args.pauseOnHover = false;<?php } ?>
<?php echo "\n"; ?>
<?php if ( $args['autoHeight'] == 'true' ) { ?>args.smoothHeight = true;<?php } ?>
args.manualControls = '.pagination-wrap .flex-control-nav > li';
args.start = function ( slider ) {
slider.next( '.slider-pagination' ).fadeIn();
}
jQuery( '.woo-slideshow' ).each( function ( i ) {
jQuery( this ).flexslider( args );
jQuery( this ) .find( 'a.flex-prev, a.flex-next' ).addClass( 'icon' );
});
});
</script>
<!-- /Woo Slider Setup -->
<?php
}
} // End woo_slider()
}
/*-----------------------------------------------------------------------------------*/
/* Woo Slider Magazine */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_slider_magazine' ) ) {
function woo_slider_magazine( $args = null, $tags = null ) {
global $woo_options, $wp_query;
// Exit if this isn't the first page in the loop
if ( is_paged() ) return;
// This is where our output will be added.
$html = '';
// Default slider settings.
$defaults = array(
'id' => 'loopedSlider',
'echo' => true,
'excerpt_length' => '15',
'pagination' => false,
'width' => '960',
'height' => '350',
'order' => 'ASC',
'posts_per_page' => '5'
);
// Setup width of slider and images
$width = '623';
if ( isset( $woo_options['woo_layout'] ) && 'one-col' == $woo_options['woo_layout'] && isset( $woo_options['woo_layout_width'] ) && '' != $woo_options['woo_layout_width'] ) {
$width = intval( str_replace( 'px', '', $woo_options['woo_layout_width'] ) );
}
// Setup slider tags array
$slider_tags = array();
if ( is_array( $tags ) && ( 0 < count( $tags ) ) ) {
$slider_tags = $tags;
}
if ( ! is_array( $tags ) && '' != $tags && ! is_null( $tags ) ) {
$slider_tags = explode( ',', $tags );
}
if ( 0 >= count( $slider_tags ) ) {
$slider_tags = explode( ',', $woo_options['woo_slider_magazine_tags'] ); // Tags to be shown
}
if ( 0 < count( $slider_tags ) ) {
foreach ( $slider_tags as $tags ) {
$tag = get_term_by( 'name', trim($tags), 'post_tag', 'ARRAY_A' );
if ( $tag['term_id'] > 0 )
$tag_array[] = $tag['term_id'];
}
}
if ( empty( $tag_array ) ) {
echo '<p class="woo-sc-box note">Please setup Featured Slider Tag(s) in your options panel. You must setup tags that are used on active posts.</p>';
return;
}
// Setup the slider CSS class.
$slider_css = '';
if ( isset( $woo_options['woo_slider_pagination'] ) && $woo_options['woo_slider_pagination'] == 'true' ) {
$slider_css = ' class="has-pagination woo-slideshow"';
} else {
$slider_css = ' class="woo-slideshow"';
}
// Setup height of slider.
$height = $woo_options['woo_slider_magazine_height'];
if ( $height != '' ) { $defaults['height'] = $height; }
// Setup the number of posts to show.
$posts_per_page = $woo_options['woo_slider_magazine_entries'];
if ( $posts_per_page != '' ) { $defaults['posts_per_page'] = $posts_per_page; }
// Setup the excerpt length.
$excerpt_length = $woo_options['woo_slider_magazine_excerpt_length'];
if ( $excerpt_length != '' ) { $defaults['excerpt_length'] = $excerpt_length; }
if ( $width > 0 && $args['width'] == '' ) { $defaults['width'] = $width; }
// Merge the arguments with defaults.
$args = wp_parse_args( $args, $defaults );
if ( ( ( isset($args['width']) ) && ( ( $args['width'] <= 0 ) || ( $args['width'] == '') ) ) || ( !isset($args['width']) ) ) { $args['width'] = '100'; }
if ( ( isset($args['height']) ) && ( $args['height'] <= 0 ) ) { $args['height'] = '100'; }
// Allow child themes/plugins to filter these arguments.
$args = apply_filters( 'woo_magazine_slider_args', $args );
// Begin setting up HTML output.
$image_args = 'width=' . $args['width'] . '&link=img&return=true&noheight=true';
if ( isset( $woo_options['woo_slider_autoheight'] ) && $woo_options['woo_slider_autoheight'] != 'true' ) {
$html .= '<div id="' . $args['id'] . '"' . $slider_css . ' style="max-height:' . $args['height'] . 'px;">' . "\n";
$image_args .= '&height=' . $args['height'];
} else {
$html .= '<div id="' . $args['id'] . '"' . $slider_css . ' style="height:auto;">' . "\n";
}
$saved = $wp_query; $query = new WP_Query( array( 'tag__in' => $tag_array, 'posts_per_page' => $args['posts_per_page'] ) );
if ( $query->have_posts() ) : $count = 0;
if ( isset( $woo_options['woo_slider_autoheight'] ) && $woo_options['woo_slider_autoheight'] != 'true' )
$html .= '<ul class="slides" style="max-height:' . esc_attr( $args['height'] ) . 'px;">' . "\n";
else
$html .= '<ul class="slides">' . "\n";
while ( $query->have_posts() ) : $query->the_post(); global $post; $shownposts[$count] = $post->ID; $count++;
$styles = 'width: ' . $args['width'] . 'px;';
if ( $count >= 2 ) { $styles .= ' display:none;'; } else { $styles = ''; }
$url = get_permalink( $post->ID );
$html .= '<li id="slide-' . esc_attr( $post->ID ) . '" class="slide slide-number-' . esc_attr( $count ) . '" style="' . $styles . '">' . "\n";
$html .= '<a href="' . $url . '" title="' . the_title_attribute( array( 'echo' => 0 ) ) . '">' . woo_image( $image_args ) . '</a>' . "\n";
$html .= '<div class="content">' . "\n";
if ( $woo_options['woo_slider_magazine_title'] == 'true' ) {
$html .= '<h2 class="title"><a href="' . $url . '" title="' . the_title_attribute( array( 'echo' => 0 ) ) . '">' . get_the_title( $post->ID ) . '</a></h2>'; }
if ( $woo_options['woo_slider_magazine_excerpt'] == 'true' ) {
$excerpt = woo_text_trim( get_the_excerpt(), $excerpt_length );
if ( '' != $excerpt )
$html .= '<div class="excerpt"><p>' . $excerpt . '</p></div>' . "\n";
}
$html .= '</div>' . "\n";
$html .= '</li>' . "\n";
endwhile;
endif; $wp_query = $saved;
$html .= '</ul><!-- /.slides -->' . "\n";
$html .= '</div>' . "\n";
if ( isset( $woo_options['woo_slider_pagination'] ) && $woo_options['woo_slider_pagination'] == 'true' ) {
$html .= '<div class="pagination-wrap slider-pagination"><ol class="flex-control-nav flex-control-paging">';
for ( $i = 0; $i < $count; $i++ ) {
$html .= '<li><a>' . ( $i + 1 ) . '</a></li>';
}
$html .= '</ol></div>';
}
if ( get_option( 'woo_exclude' ) != $shownposts ) { update_option( "woo_exclude", $shownposts ); }
if ( $args['echo'] ) {
echo $html;
}
return $html;
} // End woo_slider_magazine()
}
/*-----------------------------------------------------------------------------------*/
/* Woo Slider Business */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_slider_biz' ) ) {
function woo_slider_biz( $args = null ) {
global $woo_options, $post;
// Exit if this isn't the first page in the loop
if ( is_paged() ) return;
// This is where our output will be added.
$html = '';
$options = woo_get_dynamic_values( array( 'slider_biz_slide_group' => 'all' ) );
// Default slider settings.
$defaults = array(
'id' => 'loopedSlider',
'echo' => true,
'excerpt_length' => '15',
'pagination' => false,
'width' => '960',
'height' => '350',
'order' => 'ASC',
'posts_per_page' => '5',
'slide_page' => $options['slider_biz_slide_group'],
'use_slide_page' => false
);
if ( 'all' != $defaults['slide_page'] ) $defaults['use_slide_page'] = true;
// Setup the "Slide Page", if one is set.
if ( isset( $post->ID ) ) {
$slide_page = 'all';
$stored_slide_page = get_post_meta( $post->ID, '_slide-page', true );
if ( $stored_slide_page != '' && $stored_slide_page != 'all' ) {
$slide_page = $stored_slide_page;
$defaults['use_slide_page'] = true; // Instruct the slider to apply the necessary conditional.
$defaults['slide_page'] = $slide_page;
}
}
// Setup height of slider.
$height = $woo_options['woo_slider_biz_height'];
if ( $height != '' ) { $defaults['height'] = $height; }
// Setup width of slider and images.
$layout = $woo_options['woo_layout'];
if ( !$layout )
$layout = get_option( 'woo_layout' );
$layout_width = get_option('woo_layout_width');
// Setup the number of posts to show.
$posts_per_page = $woo_options['woo_slider_biz_number'];
if ( $posts_per_page != '' ) { $defaults['posts_per_page'] = $posts_per_page; }
// Setup the order of posts.
$post_order = $woo_options['woo_slider_biz_order'];
if ( $post_order != '' ) { $defaults['order'] = $post_order; }
// Setup the excerpt length.
if ( isset($woo_options['woo_slider_biz_excerpt_length']) ) {
$excerpt_length = $woo_options['woo_slider_biz_excerpt_length'];
if ( $excerpt_length != '' ) { $defaults['excerpt_length'] = $excerpt_length; }
}
$width = intval( $layout_width );
//if ( ( 0 < $width ) && isset( $args['width'] ) && '' == $args['width'] ) { $defaults['width'] = $width; }
if ( ( 0 < $width ) && !isset( $args['width'] ) ) { $defaults['width'] = $width; }
// Merge the arguments with defaults.
$args = wp_parse_args( $args, $defaults );
if ( ( ( isset( $args['width'] ) ) && ( ( $args['width'] <= 0 ) || ( $args['width'] == '' ) ) ) || ( ! isset( $args['width'] ) ) ) { $args['width'] = '100'; }
if ( ( isset( $args['height'] ) ) && ( $args['height'] <= 0 ) ) { $args['height'] = '100'; }
// Allow child themes/plugins to filter these arguments.
$args = apply_filters( 'woo_biz_slider_args', $args );
// Setup slider page id's
$query_args = array(
'post_type' => 'slide',
'order' => $args['order'],
'orderby' => 'date',
'posts_per_page' => $args['posts_per_page']
);
if ( true == $args['use_slide_page'] ) {
$type = 'slug';
if ( is_numeric( $args['slide_page'] ) ) $type = 'id';
$query_args['tax_query'] = array( array(
'taxonomy' => 'slide-page',
'field' => $type,
'terms' => $args['slide_page']
) );
}
$slide_query = new WP_Query( $query_args );
if ( ( ! $slide_query->have_posts() ) ) {
echo '<p class="note">' . __( 'Please add some slider posts using the Slide custom post type.', 'woothemes' ) . '</p>';
return;
}
if ( ( $slide_query->found_posts < 1 ) ) {
echo '<p class="note">' . __( 'Please note that this slider requires 2 or more slides in order to function. Please assign another slide.', 'woothemes' ) . '</p>';
return;
}
// Disable auto image functionality
$auto_img = false;
if ( get_option( 'woo_auto_img' ) == 'true' ) {
update_option( 'woo_auto_img', 'false' );
$auto_img = true;
}
// Disable placeholder image functionality
$placeholder_img = get_option( 'framework_woo_default_image' );
if ( $placeholder_img ) {
update_option( 'framework_woo_default_image', '' );
}
// Setup the slider CSS class.
$slider_css = '';
if ( isset( $woo_options['woo_slider_pagination'] ) && $woo_options['woo_slider_pagination'] == 'true' ) {
$slider_css = ' class="has-pagination woo-slideshow"';
} else {
$slider_css = ' class="woo-slideshow"';
}
// Begin setting up HTML output.
if ( isset( $woo_options['woo_slider_autoheight'] ) && $woo_options['woo_slider_autoheight'] != 'true' ) {
$html .= '<div id="' . $args['id'] . '"' . $slider_css . ' style="height:' . $args['height'] . 'px;">' . "\n";
// $html .= '<div class="container" style="height:' . $args['height'] . 'px">' . "\n";
} else {
$html .= '<div id="' . $args['id'] . '"' . $slider_css . ' style="height:auto;">' . "\n";
// $html .= '<div class="container" style="height:auto;">' . "\n";
}
global $post;
if ( isset( $woo_options['woo_slider_autoheight'] ) && $woo_options['woo_slider_autoheight'] != 'true' )
$html .= '<ul class="slides" style="height:' . $args['height'] . 'px;">' . "\n";
else
$html .= '<ul class="slides">' . "\n";
if ( $slide_query->have_posts() ) { $count = 0; while ( $slide_query->have_posts() ) { $slide_query->the_post(); $count++;
$styles = 'width: ' . $args['width'] . 'px;';
if ( $count >= 2 ) { $styles .= ' display:none;'; } else { $styles = ''; }
$html .= '<li id="slide-' . esc_attr( $post->ID ) . '" class="slide slide-number-' . esc_attr( $count ) . '" style="' . $styles . '">' . "\n";
$type = woo_image('return=true');
if ( $type ) {
$url = get_post_meta( $post->ID, 'url', true );
if ( $url ) {
$html .= '<a href="' . $url . '" title="' . the_title_attribute( array( 'echo' => 0 ) ) . '">' . woo_image( 'width=' . $args['width'] . '&height=' . $args['height'] . '&link=img&return=true&noheight=true' ) . '</a>' . "\n";
} else {
$html .= woo_image( 'width=' . $args['width'] . '&height=' . $args['height'] . '&link=img&return=true&noheight=true' );
}
$html .= '<div class="content">' . "\n";
if ( $woo_options['woo_slider_biz_title'] == 'true' ) {
if ( $url ) {
$html .= '<div class="title"><h2 class="title"><a href="' . $url . '">' . get_the_title( $post->ID ) . '</a></h2></div>' . "\n";
} else {
$html .= '<div class="title"><h2 class="title">' . get_the_title( $post->ID ) . '</h2></div>' . "\n";
}
}
$content = get_the_excerpt();
$content = do_shortcode( $content );
$html .= '<div class="excerpt">' . wpautop( $content ) . '</div>' . "\n";
$html .= '</div>' . "\n";
} else {
$content = get_the_content( $post->ID );
$content = do_shortcode( $content );
$html .= '<section class="entry">' . wpautop( $content ) . '</section>' . "\n";
}
$html .= '</li>' . "\n";
} // End WHILE Loop
} // End IF Statement
$html .= '</ul><!-- /.slides -->' . "\n";
//$html .= '</div><!-- /.container --> ' . "\n";
$html .= '</div><!-- /#' . $args['id'] . ' -->' . "\n";
if ( isset( $woo_options['woo_slider_pagination'] ) && $woo_options['woo_slider_pagination'] == 'true' ) {
$html .= '<div class="pagination-wrap slider-pagination"><ol class="flex-control-nav flex-control-paging">';
for ( $i = 0; $i < $count; $i++ ) {
$html .= '<li><a>' . ( $i + 1 ) . '</a></li>';
}
$html .= '</ol></div>';
}
if ( $args['echo'] ) { echo $html; }
// Enable auto img functionality
if ( $auto_img )
update_option( 'woo_auto_img', 'true' );
// Enable placeholder functionality
if ( '' != $placeholder_img )
update_option( 'framework_woo_default_image', $placeholder_img );
return $html;
} // End woo_slider_biz()
}
/*-----------------------------------------------------------------------------------*/
/* Navigation */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_nav' ) ) {
function woo_nav() {
global $woo_options;
woo_nav_before();
?>
<nav id="navigation" class="col-full" role="navigation">
<section class="menus">
<?php woo_nav_inside(); ?>
<a href="<?php echo home_url(); ?>" class="nav-home"><span><?php _e( 'Home', 'woothemes' ); ?></span></a>
<?php
if ( function_exists( 'has_nav_menu' ) && has_nav_menu( 'primary-menu' ) ) {
echo '<h3>' . woo_get_menu_name( 'primary-menu' ) . '</h3>';
wp_nav_menu( array( 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'main-nav', 'menu_class' => 'nav fl', 'theme_location' => 'primary-menu' ) );
} else {
?>
<ul id="main-nav" class="nav fl">
<?php
if ( get_option( 'woo_custom_nav_menu' ) == 'true' ) {
if ( function_exists( 'woo_custom_navigation_output' ) ) { woo_custom_navigation_output( 'name=Woo Menu 1' ); }
} else { ?>
<?php if ( is_page() ) { $highlight = 'page_item'; } else { $highlight = 'page_item current_page_item'; } ?>
<li class="<?php echo esc_attr( $highlight ); ?>"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php _e( 'Home', 'woothemes' ); ?></a></li>
<?php wp_list_pages( 'sort_column=menu_order&depth=6&title_li=&exclude=' ); ?>
<?php } ?>
</ul><!-- /#nav -->
<?php } ?>
</section><!-- /.menus -->
<a href="#top" class="nav-close"><span><?php _e('Return to Content', 'woothemes' ); ?></span></a>
</nav>
<?php
woo_nav_after();
} // End woo_nav()
}
/*-----------------------------------------------------------------------------------*/
/* Add subscription links to the navigation bar */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_nav_subscribe' ) ) {
function woo_nav_subscribe() {
global $woo_options;
$class = '';
if ( isset( $woo_options['woo_header_cart_link'] ) && 'true' == $woo_options['woo_header_cart_link'] )
$class = ' cart-enabled';
if ( ( isset( $woo_options['woo_nav_rss'] ) ) && ( $woo_options['woo_nav_rss'] == 'true' ) || ( isset( $woo_options['woo_subscribe_email'] ) ) && ( $woo_options['woo_subscribe_email'] ) ) { ?>
<ul class="rss fr<?php echo $class; ?>">
<?php if ( ( isset( $woo_options['woo_subscribe_email'] ) ) && ( $woo_options['woo_subscribe_email'] ) ) { ?>
<li class="sub-email"><a href="<?php echo esc_url( $woo_options['woo_subscribe_email'] ); ?>"></a></li>
<?php } ?>
<?php if ( isset( $woo_options['woo_nav_rss'] ) && ( $woo_options['woo_nav_rss'] == 'true' ) ) { ?>
<li class="sub-rss"><a href="<?php if ( $woo_options['woo_feed_url'] ) { echo esc_url( $woo_options['woo_feed_url'] ); } else { echo esc_url( get_bloginfo_rss( 'rss2_url' ) ); } ?>"></a></li>
<?php } ?>
</ul>
<?php }
} // End woo_nav_subscribe()
}
/*-----------------------------------------------------------------------------------*/
/* Post More */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_post_more' ) ) {
function woo_post_more() {
if ( get_option( 'woo_disable_post_more' ) != 'true' ) {
$html = '';
if ( get_option('woo_post_content') == 'excerpt' ) { $html .= '[view_full_article] '; }
$html .= '[post_comments]';
$html = apply_filters( 'woo_post_more', $html );
if ( $html != '' ) {
?>
<div class="post-more">
<?php
echo $html;
?>
</div>
<?php
}
}
} // End woo_post_more()
}
/*-----------------------------------------------------------------------------------*/
/* Video Embed */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'canvas_get_embed' ) ) {
function canvas_get_embed() {
// Setup height & width of embed
$width = '610';
$height = '343';
$embed = woo_embed( 'width=' . $width . '&height=' . $height );
if ( '' != $embed ) {
?>
<div class="post-embed">
<?php echo $embed; ?>
</div><!-- /.post-embed -->
<?php
}
} // End canvas_get_embed()
}
/*-----------------------------------------------------------------------------------*/
/* Author Box */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_author' ) ) {
function woo_author () {
// Author box single post page
if ( is_single() && get_option( 'woo_disable_post_author' ) != 'true' ) { add_action( 'woo_post_inside_after', 'woo_author_box', 10 ); }
// Author box author page
if ( is_author() ) { add_action( 'woo_loop_before', 'woo_author_box', 10 ); }
} // End woo_author()
}
/*-----------------------------------------------------------------------------------*/
/* Single Post Author */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_author_box' ) ) {
function woo_author_box () {
global $post;
$author_id=$post->post_author;
?>
<aside id="post-author">
<div class="profile-image"><?php echo get_avatar( $author_id, '80' ); ?></div>
<div class="profile-content">
<h4><?php printf( esc_attr__( 'About %s', 'woothemes' ), get_the_author_meta( 'display_name', $author_id ) ); ?></h4>
<?php echo get_the_author_meta( 'description', $author_id ); ?>
<?php if ( is_singular() ) { ?>
<div class="profile-link">
<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID', $author_id ) ) ); ?>">
<?php printf( __( 'View all posts by %s <span class="meta-nav">→</span>', 'woothemes' ), get_the_author_meta( 'display_name', $author_id ) ); ?>
</a>
</div><!--#profile-link-->
<?php } ?>
</div>
<div class="fix"></div>
</aside>
<?php
} // End woo_author_box()
}
/*-----------------------------------------------------------------------------------*/
/* Yoast Breadcrumbs */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( '_dep_woo_breadcrumbs' ) ) {
function _dep_woo_breadcrumbs() {
if ( function_exists( 'yoast_breadcrumb' ) ) {
yoast_breadcrumb( '<div id="breadcrumb"><p>', '</p></div>' );
}
} // End _dep_woo_breadcrumbs()
}
/*-----------------------------------------------------------------------------------*/
/* Subscribe & Connect */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_subscribe_connect_action' ) ) {
function woo_subscribe_connect_action() {
if ( is_single() && 'true' == get_option( 'woo_connect' ) ) { add_action('woo_post_inside_after', 'woo_subscribe_connect'); }
} // End woo_subscribe_connect_action()
}
/*-----------------------------------------------------------------------------------*/
/* Optional Top Navigation (WP Menus) */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_top_navigation' ) ) {
function woo_top_navigation() {
if ( function_exists( 'has_nav_menu' ) && has_nav_menu( 'top-menu' ) ) {
?>
<div id="top">
<div class="col-full">
<?php
echo '<h3 class="top-menu">' . woo_get_menu_name( 'top-menu' ) . '</h3>';
wp_nav_menu( array( 'depth' => 6, 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'top-nav', 'menu_class' => 'nav top-navigation fl', 'theme_location' => 'top-menu' ) );
?>
</div>
</div><!-- /#top -->
<?php
}
} // End woo_top_navigation()
}
/*-----------------------------------------------------------------------------------*/
/* Footer Widgetized Areas */
/*-----------------------------------------------------------------------------------*/
add_action( 'woo_footer_top', 'woo_footer_sidebars', 30 );
if ( ! function_exists( 'woo_footer_sidebars' ) ) {
function woo_footer_sidebars() {
$settings = woo_get_dynamic_values( array( 'biz_disable_footer_widgets' => '', 'footer_sidebars' => '4' ) );
$footer_sidebar_total = 4;
$has_footer_sidebars = false;
// Check if we have footer sidebars to display.
for ( $i = 1; $i <= $footer_sidebar_total; $i++ ) {
if ( woo_active_sidebar( 'footer-' . $i ) && ( $has_footer_sidebars == false ) ) {
$has_footer_sidebars = true;
}
}
// If footer sidebars are available, we're on the "Business" page template and we want to disable them, do so.
if ( $has_footer_sidebars && is_page_template( 'template-biz.php' ) && ( 'true' == $settings['biz_disable_footer_widgets'] ) ) {
$has_footer_sidebars = false;
}
$total = $settings['footer_sidebars'];
if ( '0' == $settings['footer_sidebars'] ) { $total = 0; } // Make sure the footer widgets don't display if the "none" option is set under "Theme Options".
// Lastly, we display the sidebars.
if ( $has_footer_sidebars && $total > 0 ) {
?>
<section id="footer-widgets" class="col-full col-<?php echo esc_attr( intval( $total ) ); ?>">
<?php $i = 0; while ( $i < intval( $total ) ) { $i++; ?>
<?php if ( woo_active_sidebar( 'footer-' . $i ) ) { ?>
<div class="block footer-widget-<?php echo $i; ?>">
<?php woo_sidebar( 'footer-' . $i ); ?>
</div>
<?php } ?>
<?php } // End WHILE Loop ?>
<div class="fix"></div>
</section><!--/#footer-widgets-->
<?php
} // End IF Statement
} // End woo_footer_sidebars()
}
/*-----------------------------------------------------------------------------------*/
/* Add customisable footer areas */
/*-----------------------------------------------------------------------------------*/
/**
* Add customisable footer areas.
*
* @package WooFramework
* @subpackage Actions
*/
if ( ! function_exists( 'woo_footer_left' ) ) {
function woo_footer_left () {
$settings = woo_get_dynamic_values( array( 'footer_left' => 'true', 'footer_left_text' => '[site_copyright]' ) );
woo_do_atomic( 'woo_footer_left_before' );
$html = '';
if( 'true' == $settings['footer_left'] ) {
$html .= '<p>' . stripslashes( $settings['footer_left_text'] ) . '</p>';
} else {
$html .= '[site_copyright]';
}
$html = apply_filters( 'woo_footer_left', $html );
echo $html;
woo_do_atomic( 'woo_footer_left_after' );
} // End woo_footer_left()
}
if ( ! function_exists( 'woo_footer_right' ) ) {
function woo_footer_right () {
$settings = woo_get_dynamic_values( array( 'footer_right' => 'true', 'footer_right_text' => '[site_credit]' ) );
woo_do_atomic( 'woo_footer_right_before' );
$html = '';
if( 'true' == $settings['footer_right'] ) {
$html .= '<p>' . stripslashes( $settings['footer_right_text'] ) . '</p>';
} else {
$html .= '[site_credit]';
}
$html = apply_filters( 'woo_footer_right', $html );
echo $html;
woo_do_atomic( 'woo_footer_right_after' );
} // End woo_footer_right()
}
/*-----------------------------------------------------------------------------------*/
/* Add customisable post meta */
/*-----------------------------------------------------------------------------------*/
/**
* Add customisable post meta.
*
* Add customisable post meta, using shortcodes,
* to be added/modified where necessary.
*
* @package WooFramework
* @subpackage Actions
*/
if ( ! function_exists( 'woo_post_meta' ) ) {
function woo_post_meta() {
if ( is_page() ) { return; }
$post_info = '<span class="small">' . __( 'By', 'woothemes' ) . '</span> [post_author_posts_link] <span class="small">' . _x( 'on', 'post datetime', 'woothemes' ) . '</span> [post_date] <span class="small">' . __( 'in', 'woothemes' ) . '</span> [post_categories before=""] ';
printf( '<div class="post-meta">%s</div>' . "\n", apply_filters( 'woo_filter_post_meta', $post_info ) );
} // End woo_post_meta()
}
/*-----------------------------------------------------------------------------------*/
/* Add Post Thumbnail to Single posts on Archives */
/*-----------------------------------------------------------------------------------*/
/**
* Add Post Thumbnail to Single posts on Archives
*
* Add code to the woo_post_inside_before() hook.
*
* @package WooFramework
* @subpackage Actions
*/
add_action( 'woo_post_inside_before', 'woo_display_post_image', 10 );
if ( ! function_exists( 'woo_display_post_image' ) ) {
function woo_display_post_image() {
$display_image = false;
$options = woo_get_dynamic_values( array( 'thumb_w' => '100', 'thumb_h' => '100', 'thumb_align' => 'alignleft', 'single_w' => '100', 'single_h' => '100', 'thumb_align_single' => 'alignright', 'thumb_single' => 'false' ) );
$width = $options['thumb_w'];
$height = $options['thumb_h'];
$align = $options['thumb_align'];
if ( is_single() && ( 'true' == $options['thumb_single'] ) ) {
$width = $options['single_w'];
$height = $options['single_h'];
$align = $options['thumb_align_single'];
$display_image = true;
}
if ( 'true' == get_option( 'woo_woo_tumblog_switch') ) { $is_tumblog = woo_tumblog_test(); } else { $is_tumblog = false; }
if ( $is_tumblog || ( is_single() && 'false' == $options['thumb_single'] ) ) { $display_image = false; }
if ( true == $display_image && ! woo_embed( '' ) ) { woo_image( 'width=' . esc_attr( $width ) . '&height=' . esc_attr( $height ) . '&class=thumbnail ' . esc_attr( $align ) ); }
} // End woo_display_post_image()
}
/*-----------------------------------------------------------------------------------*/
/* Post Inside After */
/*-----------------------------------------------------------------------------------*/
/**
* Post Inside After
*
* Add code to the woo_post_inside_after() hook.
*
* @package WooFramework
* @subpackage Actions
*/
add_action( 'woo_post_inside_after_singular-post', 'woo_post_inside_after_default', 10 );
if ( ! function_exists( 'woo_post_inside_after_default' ) ) {
function woo_post_inside_after_default() {
$post_info ='[post_tags before=""]';
printf( '<div class="post-utility">%s</div>' . "\n", apply_filters( 'woo_post_inside_after_default', $post_info ) );
} // End woo_post_inside_after_default()
}
/*-----------------------------------------------------------------------------------*/
/* Modify the default "comment" form field. */
/*-----------------------------------------------------------------------------------*/
/**
* Modify the default "comment" form field.
*
* @package WooFramework
* @subpackage Filters
*/
add_filter( 'comment_form_field_comment', 'woo_comment_form_comment', 10 );
if ( ! function_exists( 'woo_comment_form_comment' ) ) {
function woo_comment_form_comment ( $field ) {
$field = str_replace( '<label ', '<label class="hide" ', $field );
$field = str_replace( 'cols="45"', 'cols="50"', $field );
$field = str_replace( 'rows="8"', 'rows="10"', $field );
return $field;
} // End woo_comment_form_comment()
}
/*-----------------------------------------------------------------------------------*/
/* Add theme default comment form fields. */
/*-----------------------------------------------------------------------------------*/
/**
* Add theme default comment form fields.
*
* @package WooFramework
* @subpackage Filters
*/
add_filter( 'comment_form_default_fields', 'woo_comment_form_fields', 10 );
if ( ! function_exists( 'woo_comment_form_fields' ) ) {
function woo_comment_form_fields ( $fields ) {
$commenter = wp_get_current_commenter();
$req = get_option( 'require_name_email' );
$aria_req = ( $req ? " aria-required='true'" : '' );
$fields = array(
'author' => '<p class="comment-form-author"><input id="author" name="author" type="text" class="txt" tabindex="1" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' />' .
'<label for="author">' . __( 'Name', 'woothemes' ) . ( $req ? ' <span class="required">(' . __( 'required', 'woothemes' ) . ')</span>' : '' ) . '</label> ' . '</p>',
'email' => '<p class="comment-form-email"><input id="email" name="email" type="text" class="txt" tabindex="2" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' />' .
'<label for="email">' . __( 'Email (will not be published)', 'woothemes' ) . ( $req ? ' <span class="required">(' . __( 'required', 'woothemes' ) . ')</span>' : '' ) . '</label> ' . '</p>',
'url' => '<p class="comment-form-url"><input id="url" name="url" type="text" class="txt" tabindex="3" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" />' .
'<label for="url">' . __( 'Website', 'woothemes' ) . '</label></p>',
);
return $fields;
} // End woo_comment_form_fields()
}
/*-----------------------------------------------------------------------------------*/
/* Add theme default comment form arguments. */
/*-----------------------------------------------------------------------------------*/
/**
* Add theme default comment form arguments.
*
* @package WooFramework
* @subpackage Filters
*/
add_filter( 'comment_form_defaults', 'woo_comment_form_args', 10 );
if ( ! function_exists( 'woo_comment_form_args' ) ) {
function woo_comment_form_args ( $args ) {
// Add tabindex of "field count + 1" to the comment textarea. This lets us cater for additional fields and have a dynamic tab index.
$tabindex = count( $args['fields'] ) + 1;
$args['comment_field'] = str_replace( '<textarea ', '<textarea tabindex="' . $tabindex . '" ', $args['comment_field'] );
// Adjust tabindex for "submit" button.
$tabindex++;
$args['label_submit'] = __( 'Submit Comment', 'woothemes' );
$args['comment_notes_before'] = '';
$args['comment_notes_after'] = '';
$args['cancel_reply_link'] = __( 'Click here to cancel reply.', 'woothemes' );
return $args;
} // End woo_comment_form_args()
}
/*-----------------------------------------------------------------------------------*/
/* Activate shortcode compatibility in our new custom areas. */
/*-----------------------------------------------------------------------------------*/
/**
* Activate shortcode compatibility in our new custom areas.
*
* @package WooFramework
* @subpackage Filters
*/
$sections = array( 'woo_filter_post_meta', 'woo_post_inside_after_default', 'woo_post_more', 'woo_footer_left', 'woo_footer_right' );
foreach ( $sections as $s ) { add_filter( $s, 'do_shortcode', 20 ); }
/*-----------------------------------------------------------------------------------*/
/* woo_content_templates_magazine() */
/*-----------------------------------------------------------------------------------*/
/**
* woo_content_templates_magazine()
*
* Remove the tumblog content template from the templates
* to search through, if on the "Magazine" page template.
*
* @package WooFramework
* @subpackage Filters
*/
add_filter( 'woo_content_templates', 'woo_content_templates_magazine', 10 );
if ( ! function_exists( 'woo_content_templates_magazine' ) ) {
function woo_content_templates_magazine ( $templates ) {
global $page_template;
if ( $page_template == 'template-magazine.php' ) {
foreach ( $templates as $k => $v ) {
$v = str_replace( '.php', '', $v );
$bits = explode( '-', $v );
if ( $bits[1] == 'tumblog' ) {
unset( $templates[$k] );
}
}
}
return $templates;
} // End woo_content_templates_magazine()
}
/*-----------------------------------------------------------------------------------*/
/* woo_feedburner_link() */
/*-----------------------------------------------------------------------------------*/
/**
* woo_feedburner_link()
*
* Replace the default RSS feed link with the Feedburner URL, if one
* has been provided by the user.
*
* @package WooFramework
* @subpackage Filters
*/
add_filter( 'feed_link', 'woo_feedburner_link', 10 );
if ( ! function_exists( 'woo_feedburner_link' ) ) {
function woo_feedburner_link ( $output, $feed = null ) {
global $woo_options;
$default = get_default_feed();
if ( ! $feed ) $feed = $default;
if ( isset( $woo_options['woo_feed_url'] ) && $woo_options['woo_feed_url'] && ( $feed == $default ) && ( ! stristr( $output, 'comments' ) ) ) $output = $woo_options['woo_feed_url'];
return esc_url( $output );
} // End woo_feedburner_link()
}
/*-----------------------------------------------------------------------------------*/
/* Help WooTumblog to recognise if it's on the "Magazine" page template */
/*-----------------------------------------------------------------------------------*/
add_action( 'get_template_part_content', 'woo_magazine_adjust_tumblog_widths', 2, 10 );
/**
* woo_magazine_adjust_tumblog_widths function.
*
* @access public
* @param string $slug
* @param string $name
* @return void
*/
if ( ! function_exists( 'woo_magazine_adjust_tumblog_widths' ) ) {
function woo_magazine_adjust_tumblog_widths ( $slug, $name ) {
if ( $name == 'magazine-grid' ) {
woo_magazine_apply_tumblog_width_adjustments();
}
} // End woo_magazine_adjust_tumblog_widths()
}
/**
* woo_magazine_apply_tumblog_width_adjustments function.
*
* @access public
* @return void
*/
if ( ! function_exists( 'woo_magazine_apply_tumblog_width_adjustments' ) ) {
function woo_magazine_apply_tumblog_width_adjustments () {
add_filter( 'option_woo_tumblog_image_width', 'woo_magazine_tumblog_adjust_width_grid', 10 );
add_filter( 'option_woo_tumblog_video_width', 'woo_magazine_tumblog_adjust_width_grid', 10 );
add_filter( 'option_woo_tumblog_audio_width', 'woo_magazine_tumblog_adjust_width_grid', 10 );
} // End woo_magazine_apply_tumblog_width_adjustments()
}
/**
* woo_magazine_tumblog_adjust_width_grid function.
*
* @access public
* @param string $width
* @return int $width
*/
if ( ! function_exists( 'woo_magazine_tumblog_adjust_width_grid' ) ) {
function woo_magazine_tumblog_adjust_width_grid ( $width ) {
return woo_magazine_determine_tumblog_width( current_filter() );
} // End woo_magazine_tumblog_adjust_width_grid()
}
/**
* woo_magazine_determine_tumblog_width function.
*
* @access public
* @param string $filter
* @return int $width
*/
if ( ! function_exists( 'woo_magazine_determine_tumblog_width' ) ) {
function woo_magazine_determine_tumblog_width ( $filter ) {
global $woo_options;
$width = 300;
if ( isset( $woo_options['woo_tumblog_magazine_media_width'] ) && ( $woo_options['woo_tumblog_magazine_media_width'] != '' ) ) {
$width = $woo_options['woo_tumblog_magazine_media_width'];
}
return apply_filters( 'woo_magazine_tumblog_width', $width, $filter );
} // End woo_magazine_determine_tumblog_width()
}
/*-----------------------------------------------------------------------------------*/
/* Enqueue dynamic CSS */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_enqueue_custom_styling' ) ) {
function woo_enqueue_custom_styling () {
echo "\n" . '<!-- Custom CSS Styling -->' . "\n";
echo '<style type="text/css">' . "\n";
woo_custom_styling();
echo '</style>' . "\n";
} // End woo_enqueue_custom_styling()
}
/*-----------------------------------------------------------------------------------*/
/* Load site width CSS in the header */
/*-----------------------------------------------------------------------------------*/
add_action( 'wp_head', 'woo_load_site_width_css', 9 );
if ( ! function_exists( 'woo_load_site_width_css' ) ) {
function woo_load_site_width_css () {
$settings = woo_get_dynamic_values( array( 'layout_width' => 960 ) );
$layout_width = intval( $settings['layout_width'] );
if ( 0 < $layout_width && 960 != $layout_width ) { /* Has legitimate width */ } else { return; } // Use default width from stylesheet
?>
<!-- Adjust the website width -->
<style type="text/css">
.col-full, #wrapper { max-width: <?php echo intval( $layout_width ); ?>px !important; }
</style>
<?php
} // End woo_load_site_width_css()
}
/*-----------------------------------------------------------------------------------*/
/* Function to optionally remove responsive design and load in fallback CSS styling. */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_remove_responsive_design' ) ) {
/**
* Trigger items for removing responsive design from Canvas.
* @since 5.0.13
* @return void
*/
function woo_remove_responsive_design () {
remove_action( 'wp_head', 'woo_load_site_width_css', 10 );
// Load in CSS file for non-responsive layouts.
wp_enqueue_style( 'non-responsive' );
// Load non-responsive site width CSS.
add_action( 'wp_print_scripts', 'woo_load_site_width_css_nomedia', 10 );
// Remove mobile viewport scale meta tag
remove_action( 'wp_head', 'woo_load_responsive_meta_tags', 10 );
} // End woo_remove_responsive_design()
}
if ( ! function_exists( 'woo_load_site_width_css_nomedia' ) ) {
/**
* Load the layout width CSS without a media query wrapping it.
* @since 5.0.13
* @return void
*/
function woo_load_site_width_css_nomedia () {
$settings = woo_get_dynamic_values( array( 'layout_width' => 960 ) );
$layout_width = intval( $settings['layout_width'] );
if ( 0 < $layout_width ) { /* Has legitimate width */ } else { $layout_width = 960; } // Default Width
?>
<style type="text/css">.col-full, #wrapper { width: <?php echo intval( $layout_width ); ?>px; max-width: <?php echo intval( $layout_width ); ?>px; } #inner-wrapper { padding: 0; } body.full-width #header, #nav-container, body.full-width #content, body.full-width #footer-widgets, body.full-width #footer { padding-left: 0; padding-right: 0; } body.fixed-mobile #top, body.fixed-mobile #header-container, body.fixed-mobile #footer-container, body.fixed-mobile #nav-container, body.fixed-mobile #footer-widgets-container { min-width: <?php echo intval( $layout_width ); ?>px; padding: 0 1em; } body.full-width #content { width: auto; padding: 0 1em;}</style>
<?php
} // End woo_load_site_width_css_nomedia()
}
if ( ! function_exists( 'woo_load_responsive_design_removal' ) ) {
/**
* Trigger the removal of the responsive design in Canvas. Must be hooked onto "init".
* @since 5.0.13
* @uses woo_remove_responsive_design()
* @return void
*/
function woo_load_responsive_design_removal () {
add_action( 'wp_print_styles', 'woo_remove_responsive_design', 10 );
} // End woo_load_responsive_design_removal()
}
/*-----------------------------------------------------------------------------------*/
/* Load non-responsive.css for IE8 */
/*-----------------------------------------------------------------------------------*/
add_action( 'wp_head', 'woo_load_non_responsive_css', 8 );
if ( ! function_exists( 'woo_load_non_responsive_css' ) ) {
function woo_load_non_responsive_css() {
// Load conditional CSS for IE8
echo '<!--[if lt IE 9]>'. "\n";
echo '<link href="'. esc_url( get_template_directory_uri() . '/css/non-responsive.css' ) . '" rel="stylesheet" type="text/css" />' . "\n";
// Load the site width in addition to max-width to make it fixed
woo_load_site_width_css_nomedia();
echo '<![endif]-->'. "\n";
}
}
/*-----------------------------------------------------------------------------------*/
/* Adjust the homepage query, if using the "Magazine" page template as the homepage. */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_modify_magazine_homepage_query' ) ) {
function woo_modify_magazine_homepage_query ( $q ) {
if ( ! is_admin() && $q->is_main_query() && ( 0 < $q->query_vars['page_id'] ) && ( $q->query_vars['page_id'] == get_option( 'page_on_front' ) ) && ( 'template-magazine.php' == get_post_meta( intval( $q->query_vars['page_id'] ), '_wp_page_template', true ) ) ) {
$settings = woo_get_dynamic_values( array( 'magazine_limit' => get_option( 'posts_per_page' ) ) );
$q->set( 'posts_per_page', intval( $settings['magazine_limit'] ) );
$q->set( 'paged', intval( $q->query_vars['page'] ) );
$q->parse_query();
}
return $q;
} // End woo_modify_magazine_homepage_query()
}
add_filter( 'pre_get_posts', 'woo_modify_magazine_homepage_query' );
/*-----------------------------------------------------------------------------------*/
/* WooTumblog Loader. */
/*-----------------------------------------------------------------------------------*/
if ( get_option( 'woo_woo_tumblog_switch' ) == 'true' ) {
$includes_path = get_template_directory() . '/includes/';
define( 'WOOTUMBLOG_ACTIVE', true ); // Define a constant for use in our theme's templating engine.
require_once ( $includes_path . 'tumblog/theme-tumblog.php' ); // Tumblog Output Functions
// Test for Post Formats
if ( get_option( 'woo_tumblog_content_method' ) == 'post_format' ) {
require_once( $includes_path . 'tumblog/wootumblog_postformat.class.php' );
} else {
require_once ( $includes_path . 'tumblog/theme-custom-post-types.php' ); // Custom Post Types and Taxonomies
}
// Test for Post Formats
if ( get_option( 'woo_tumblog_content_method' ) == 'post_format' ) {
global $woo_tumblog_post_format;
$woo_tumblog_post_format = new WooTumblogPostFormat();
if ( $woo_tumblog_post_format->woo_tumblog_upgrade_existing_taxonomy_posts_to_post_formats()) {
update_option( 'woo_tumblog_post_formats_upgraded', 'true' );
}
}
// Show in RSS feed
if ( get_option( 'woo_custom_rss' ) == 'true' ) {
add_filter( 'the_excerpt_rss', 'woo_custom_tumblog_rss_output' );
add_filter( 'the_content_rss', 'woo_custom_tumblog_rss_output' );
}
}
/*-----------------------------------------------------------------------------------*/
/* Full width header */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_full_width_header' ) ) {
function woo_full_width_header() {
$settings = woo_get_dynamic_values( array( 'header_full_width' => '', 'layout_boxed' => '' ) );
if ( 'true' == $settings['layout_boxed'] ) return;
if ( 'true' != $settings['header_full_width'] ) return;
// Add header container
add_action( 'woo_header_before', 'woo_header_container_start' );
add_action( 'woo_header_after', 'woo_header_container_end', 8 );
// Add navigation container
add_action( 'woo_nav_before', 'woo_nav_container_start' );
add_action( 'woo_nav_after', 'woo_nav_container_end' );
} // End woo_full_width_header()
}
add_action( 'get_header', 'woo_full_width_header', 10 );
/*-----------------------------------------------------------------------------------*/
/* Full width footer */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_full_width_footer' ) ) {
function woo_full_width_footer() {
$settings = woo_get_dynamic_values( array( 'footer_full_width' => '', 'layout_boxed' => '' ) );
if ( 'true' == $settings['layout_boxed'] ) return;
if ( 'true' != $settings['footer_full_width'] ) return;
// Add footer widget container
add_action( 'woo_footer_top', 'woo_footer_widgets_container_start', 8 );
add_action( 'woo_footer_before', 'woo_footer_widgets_container_end' );
// Add footer container
add_action( 'woo_footer_before', 'woo_footer_container_start' );
add_action( 'woo_footer_after', 'woo_footer_container_end' );
} // End woo_full_width_footer()
}
add_action( 'get_header', 'woo_full_width_footer', 10 );
/*-----------------------------------------------------------------------------------*/
/* Full Width Markup Functions */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_header_container_start' ) ) {
function woo_header_container_start () {
?>
<!--#header-container-->
<div id="header-container">
<?php
} // End woo_header_container_start()
}
if ( ! function_exists( 'woo_header_container_end' ) ) {
function woo_header_container_end () {
?>
</div><!--/#header-container-->
<?php
} // End woo_header_container_end()
}
if ( ! function_exists( 'woo_nav_container_start' ) ) {
function woo_nav_container_start () {
?>
<!--#nav-container-->
<div id="nav-container">
<?php
} // End woo_nav_container_start()
}
if ( ! function_exists( 'woo_nav_container_end' ) ) {
function woo_nav_container_end () {
?>
</div><!--/#nav-container-->
<?php
} // End woo_nav_container_end()
}
if ( ! function_exists( 'woo_footer_widgets_container_start' ) ) {
function woo_footer_widgets_container_start () {
?>
<!--#footer-widgets-container-->
<div id="footer-widgets-container">
<?php
} // End woo_footer_widgets_container_start()
}
if ( ! function_exists( 'woo_footer_widgets_container_end' ) ) {
function woo_footer_widgets_container_end () {
?>
</div><!--/#footer_widgets_container_end-->
<?php
}
}
if ( ! function_exists( 'woo_footer_container_start' ) ) {
function woo_footer_container_start () { ?>
<!--#footer_container_start-->
<div id="footer-container">
<?php
} // End woo_footer_container_start()
}
if ( ! function_exists( 'woo_footer_container_end' ) ) {
function woo_footer_container_end () { ?>
</div><!--/#footer_container_end-->
<?php
} // End woo_footer_container_end()
}
/*-----------------------------------------------------------------------------------*/
/* Full width body classes */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_add_full_width_class' ) ) {
function woo_add_full_width_class ( $classes ) {
$settings = woo_get_dynamic_values( array( 'header_full_width' => 'false', 'footer_full_width' => 'false', 'layout_boxed' => '' ) );
if ( 'true' == $settings['layout_boxed'] ) return $classes; // Don't add the full width CSS classes if boxed layout is enabled.
if ( 'true' == $settings['header_full_width'] || 'true' == $settings['footer_full_width'] ) {
$classes[] = 'full-width';
if ( 'true' == $settings['header_full_width'] ) {
$classes[] = 'full-header';
}
if ( 'true' == $settings['footer_full_width'] ) {
$classes[] = 'full-footer';
}
}
return $classes;
} // End woo_add_full_width_class()
}
add_filter( 'body_class', 'woo_add_full_width_class', 10 );
/*-----------------------------------------------------------------------------------*/
/* Optionally load custom logo. */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_logo' ) ) {
function woo_logo () {
$settings = woo_get_dynamic_values( array( 'logo' => '' ) );
// Setup the tag to be used for the header area (`h1` on the front page and `span` on all others).
$heading_tag = 'span';
if ( is_home() || is_front_page() ) { $heading_tag = 'h1'; }
// Get our website's name, description and URL. We use them several times below so lets get them once.
$site_title = get_bloginfo( 'name' );
$site_url = home_url( '/' );
$site_description = get_bloginfo( 'description' );
?>
<div id="logo">
<?php
// Website heading/logo and description text.
if ( ( '' != $settings['logo'] ) ) {
$logo_url = $settings['logo'];
if ( is_ssl() ) $logo_url = str_replace( 'http://', 'https://', $logo_url );
echo '<a href="' . esc_url( $site_url ) . '" title="' . esc_attr( $site_description ) . '"><img src="' . esc_url( $logo_url ) . '" alt="' . esc_attr( $site_title ) . '" /></a>' . "\n";
} // End IF Statement
echo '<' . $heading_tag . ' class="site-title"><a href="' . esc_url( $site_url ) . '">' . $site_title . '</a></' . $heading_tag . '>' . "\n";
if ( $site_description ) { echo '<span class="site-description">' . $site_description . '</span>' . "\n"; }
?>
</div>
<?php
} // End woo_logo()
}
add_action( 'woo_header_inside', 'woo_logo', 10 );
/*-----------------------------------------------------------------------------------*/
/* Optionally load the mobile navigation toggle. */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_nav_toggle' ) ) {
function woo_nav_toggle () {
?>
<h3 class="nav-toggle icon"><a href="#navigation"><?php _e( 'Navigation', 'woothemes' ); ?></a></h3>
<?php
} // End woo_nav_toggle()
}
add_action( 'woo_header_before', 'woo_nav_toggle', 20 );
/*-----------------------------------------------------------------------------------*/
/* Optionally load top ad section into the header. */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_top_ad' ) ) {
function woo_top_ad () {
$settings = woo_get_dynamic_values( array( 'ad_top' => 'false', 'ad_top_adsense' => '', 'ad_top_image' => '', 'ad_top_url' => '' ) );
if ( 'true' == $settings['ad_top'] ) {
?>
<div id="topad">
<?php
if ( '' != $settings['ad_top_adsense'] ) {
echo stripslashes( $settings['ad_top_adsense'] );
} else {
if ( '' != $settings['ad_top_url'] && '' != $settings['ad_top_image'] ) {
$top_ad_image = $settings['ad_top_image'];
if ( is_ssl() ) $top_ad_image = str_replace( 'http://', 'https://', $top_ad_image );
?>
<a href="<?php echo esc_url( $settings['ad_top_url'] ); ?>"><img src="<?php echo esc_url( $top_ad_image ); ?>" /></a>
<?php } } ?>
</div><!-- /#topad -->
<?php
}
} // End woo_top_ad()
}
add_action( 'woo_header_inside', 'woo_top_ad', 30 );
/*-----------------------------------------------------------------------------------*/
/* END */
/*-----------------------------------------------------------------------------------*/
?> | arckinteractive/mt-landing | wp-content/themes/canvas/includes/theme-actions.php | PHP | gpl-2.0 | 98,696 | [
30522,
1026,
1029,
25718,
1002,
15854,
1035,
7047,
1027,
2131,
1035,
5724,
1006,
1005,
15854,
1035,
7047,
1005,
1007,
1025,
1013,
1008,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>QueryStringParameters | The Traveler</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.js" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">The Traveler</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
<input type="checkbox" id="tsd-filter-externals" checked />
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
<input type="checkbox" id="tsd-filter-only-exported" />
<label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="../globals.html">Globals</a>
</li>
<li>
<a href="querystringparameters.html">QueryStringParameters</a>
</li>
</ul>
<h1>Interface QueryStringParameters</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel tsd-comment">
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Interface for defining an object for the endpoint query strings</p>
</div>
<dl class="tsd-comment-tags">
<dt>interface</dt>
<dd></dd>
</dl>
</div>
</section>
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<span class="target">QueryStringParameters</span>
</li>
</ul>
</section>
<section class="tsd-panel tsd-kind-interface">
<h3 class="tsd-before-signature">Indexable</h3>
<div class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">[</span>key: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]: </span><span class="tsd-signature-type">any</span></div>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Interface for defining an object for the endpoint query strings</p>
</div>
</div>
</section>
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="querystringparameters.html#components" class="tsd-kind-icon">components</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="querystringparameters.html#count" class="tsd-kind-icon">count</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="querystringparameters.html#dayend" class="tsd-kind-icon">dayend</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="querystringparameters.html#daystart" class="tsd-kind-icon">daystart</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="querystringparameters.html#groups" class="tsd-kind-icon">groups</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="querystringparameters.html#maxtop" class="tsd-kind-icon">maxtop</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="querystringparameters.html#mode" class="tsd-kind-icon">mode</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="querystringparameters.html#modes" class="tsd-kind-icon">modes</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="querystringparameters.html#page" class="tsd-kind-icon">page</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="querystringparameters.html#periodtype" class="tsd-kind-icon">period<wbr>Type</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="querystringparameters.html#statid" class="tsd-kind-icon">statid</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="components" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> components</h3>
<div class="tsd-signature tsd-kind-icon">components<span class="tsd-signature-symbol">:</span> <a href="../enums/destinycomponenttype.html" class="tsd-signature-type">DestinyComponentType</a><span class="tsd-signature-symbol">[]</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/alexanderwe/the-traveler/blob/bfd7db0/src/type-definitions/additions.ts#L332">type-definitions/additions.ts:332</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="count" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> count</h3>
<div class="tsd-signature tsd-kind-icon">count<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/alexanderwe/the-traveler/blob/bfd7db0/src/type-definitions/additions.ts#L342">type-definitions/additions.ts:342</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="dayend" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> dayend</h3>
<div class="tsd-signature tsd-kind-icon">dayend<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/alexanderwe/the-traveler/blob/bfd7db0/src/type-definitions/additions.ts#L338">type-definitions/additions.ts:338</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="daystart" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> daystart</h3>
<div class="tsd-signature tsd-kind-icon">daystart<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/alexanderwe/the-traveler/blob/bfd7db0/src/type-definitions/additions.ts#L339">type-definitions/additions.ts:339</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="groups" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> groups</h3>
<div class="tsd-signature tsd-kind-icon">groups<span class="tsd-signature-symbol">:</span> <a href="../enums/destinystatsgrouptype.html" class="tsd-signature-type">DestinyStatsGroupType</a><span class="tsd-signature-symbol">[]</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/alexanderwe/the-traveler/blob/bfd7db0/src/type-definitions/additions.ts#L340">type-definitions/additions.ts:340</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="maxtop" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> maxtop</h3>
<div class="tsd-signature tsd-kind-icon">maxtop<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/alexanderwe/the-traveler/blob/bfd7db0/src/type-definitions/additions.ts#L335">type-definitions/additions.ts:335</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="mode" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> mode</h3>
<div class="tsd-signature tsd-kind-icon">mode<span class="tsd-signature-symbol">:</span> <a href="../enums/destinyactivitymodetype.html" class="tsd-signature-type">DestinyActivityModeType</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/alexanderwe/the-traveler/blob/bfd7db0/src/type-definitions/additions.ts#L334">type-definitions/additions.ts:334</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="modes" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> modes</h3>
<div class="tsd-signature tsd-kind-icon">modes<span class="tsd-signature-symbol">:</span> <a href="../enums/destinyactivitymodetype.html" class="tsd-signature-type">DestinyActivityModeType</a><span class="tsd-signature-symbol">[]</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/alexanderwe/the-traveler/blob/bfd7db0/src/type-definitions/additions.ts#L333">type-definitions/additions.ts:333</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="page" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> page</h3>
<div class="tsd-signature tsd-kind-icon">page<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/alexanderwe/the-traveler/blob/bfd7db0/src/type-definitions/additions.ts#L337">type-definitions/additions.ts:337</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="periodtype" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> period<wbr>Type</h3>
<div class="tsd-signature tsd-kind-icon">period<wbr>Type<span class="tsd-signature-symbol">:</span> <a href="../enums/periodtype.html" class="tsd-signature-type">PeriodType</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/alexanderwe/the-traveler/blob/bfd7db0/src/type-definitions/additions.ts#L341">type-definitions/additions.ts:341</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="statid" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> statid</h3>
<div class="tsd-signature tsd-kind-icon">statid<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/alexanderwe/the-traveler/blob/bfd7db0/src/type-definitions/additions.ts#L336">type-definitions/additions.ts:336</a></li>
</ul>
</aside>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class="globals ">
<a href="../globals.html"><em>Globals</em></a>
</li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
</ul>
<ul class="current">
<li class="current tsd-kind-interface">
<a href="querystringparameters.html" class="tsd-kind-icon">Query<wbr>String<wbr>Parameters</a>
<ul>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="querystringparameters.html#components" class="tsd-kind-icon">components</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="querystringparameters.html#count" class="tsd-kind-icon">count</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="querystringparameters.html#dayend" class="tsd-kind-icon">dayend</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="querystringparameters.html#daystart" class="tsd-kind-icon">daystart</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="querystringparameters.html#groups" class="tsd-kind-icon">groups</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="querystringparameters.html#maxtop" class="tsd-kind-icon">maxtop</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="querystringparameters.html#mode" class="tsd-kind-icon">mode</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="querystringparameters.html#modes" class="tsd-kind-icon">modes</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="querystringparameters.html#page" class="tsd-kind-icon">page</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="querystringparameters.html#periodtype" class="tsd-kind-icon">period<wbr>Type</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="querystringparameters.html#statid" class="tsd-kind-icon">statid</a>
</li>
</ul>
</li>
</ul>
<ul class="after-current">
</ul>
</nav>
</div>
</div>
</div>
<footer>
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<li class="tsd-kind-module"><span class="tsd-kind-icon">Module</span></li>
<li class="tsd-kind-object-literal"><span class="tsd-kind-icon">Object literal</span></li>
<li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
<li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
<li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li>
<li class="tsd-kind-index-signature"><span class="tsd-kind-icon">Index signature</span></li>
<li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li>
<li class="tsd-kind-enum-member"><span class="tsd-kind-icon">Enumeration member</span></li>
<li class="tsd-kind-property tsd-parent-kind-enum"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-enum"><span class="tsd-kind-icon">Method</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
<li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-interface"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
<li class="tsd-kind-index-signature tsd-parent-kind-interface"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
<li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><span class="tsd-kind-icon">Accessor</span></li>
<li class="tsd-kind-index-signature tsd-parent-kind-class"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li>
<li class="tsd-kind-call-signature tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
</ul>
</div>
</div>
</footer>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
<script>if (location.protocol == 'file:') document.write('<script src="../assets/js/search.js"><' + '/script>');</script>
</body>
</html> | alexanderwe/the-traveler | docs/interfaces/querystringparameters.html | HTML | mit | 19,754 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
2465,
1027,
1000,
12398,
30524,
1026,
2516,
1028,
23032,
3367,
4892,
28689,
22828,
2015,
1064,
1996,
20174,
1026,
1013,
2516,
1028,
1026,
18804,
2171,
1027,
1000,
6412,
1000,
4180,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
## Primo Central
### Known Facets
* creator
* lcc
* Library of Congress Classification (https://www.loc.gov/catdir/cpso/lcco)
* lang
* ISO 639-2/B language codes
* rtype
* books
* reviews
* articles
* journals
* other
* text_resources
* websites
* newspaper_articles
* reference_entrys
* technical_reports
* research_datasets
* databases
* Dissertations
* images
* conference_proceedings
* media
* topic
* tlevel
* online_resources
* peer_reviewed
* pfilter
* same types as rtype
* creationdate
* four digit strings like "2008"
* domain
* something like publisher, but with a more wide meaning
* examples
* Literature Resource Center (Gale)
* ITPro (Books24x7)
* SpringerLink
* jtitle
* the journal title
| ubpb/skala | README.primo_adapter.md | Markdown | mit | 769 | [
30522,
1001,
1001,
26927,
5302,
2430,
1001,
1001,
1001,
2124,
2227,
3215,
1008,
8543,
1008,
29215,
2278,
1008,
3075,
1997,
3519,
5579,
1006,
16770,
1024,
1013,
1013,
7479,
1012,
8840,
2278,
1012,
18079,
1013,
4937,
4305,
2099,
1013,
18133,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* @version $Id: library.php 20457 2011-01-27 07:51:58Z infograf768 $
* @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access
defined('JPATH_BASE') or die;
jimport('joomla.installer.librarymanifest');
jimport('joomla.base.adapterinstance');
/**
* Library installer
*
* @package Joomla.Framework
* @subpackage Installer
* @since 1.6
*/
class JInstallerLibrary extends JAdapterInstance
{
/**
* Custom loadLanguage method
*
* @access public
* @param string $path the path where to find language files
* @since 1.6
*/
public function loadLanguage($path=null)
{
$source = $this->parent->getPath('source');
if (!$source) {
$this->parent->setPath('source', JPATH_LIBRARIES . '/'.$this->parent->extension->element);
}
$this->manifest = $this->parent->getManifest();
$extension = 'lib_' . strtolower(JFilterInput::getInstance()->clean((string)$this->manifest->name, 'cmd'));
$name = strtolower((string)$this->manifest->libraryname);
$lang = JFactory::getLanguage();
$source = $path ? $path : JPATH_LIBRARIES . "/$name";
$lang->load($extension . '.sys', $source, null, false, false)
|| $lang->load($extension . '.sys', JPATH_SITE, null, false, false)
|| $lang->load($extension . '.sys', $source, $lang->getDefault(), false, false)
|| $lang->load($extension . '.sys', JPATH_SITE, $lang->getDefault(), false, false);
}
/**
* Custom install method
*
* @access public
* @return boolean True on success
* @since 1.5
*/
public function install()
{
// Get the extension manifest object
$this->manifest = $this->parent->getManifest();
/**
* ---------------------------------------------------------------------------------------------
* Manifest Document Setup Section
* ---------------------------------------------------------------------------------------------
*/
// Set the extensions name
$name = JFilterInput::getInstance()->clean((string)$this->manifest->name, 'string');
$element = str_replace('.xml','',basename($this->parent->getPath('manifest')));
$this->set('name', $name);
$this->set('element', $element);
$db = $this->parent->getDbo();
$db->setQuery('SELECT extension_id FROM #__extensions WHERE type="library" AND element = "'. $element .'"');
$result = $db->loadResult();
if ($result)
{
// already installed, can we upgrade?
if ($this->parent->getOverwrite() || $this->parent->getUpgrade())
{
// we can upgrade, so uninstall the old one
$installer = new JInstaller(); // we don't want to compromise this instance!
$installer->uninstall('library', $result);
}
else
{
// abort the install, no upgrade possible
$this->parent->abort(JText::_('JLIB_INSTALLER_ABORT_LIB_INSTALL_ALREADY_INSTALLED'));
return false;
}
}
// Get the libraries description
$description = (string)$this->manifest->description;
if ($description) {
$this->parent->set('message', JText::_($description));
}
else {
$this->parent->set('message', '');
}
// Set the installation path
$group = (string)$this->manifest->libraryname;
if ( ! $group) {
$this->parent->abort(JText::_('JLIB_INSTALLER_ABORT_LIB_INSTALL_NOFILE'));
return false;
}
else
{
$this->parent->setPath('extension_root', JPATH_LIBRARIES.DS.implode(DS,explode('/',$group)));
}
/**
* ---------------------------------------------------------------------------------------------
* Filesystem Processing Section
* ---------------------------------------------------------------------------------------------
*/
// If the plugin directory does not exist, lets create it
$created = false;
if (!file_exists($this->parent->getPath('extension_root')))
{
if (!$created = JFolder::create($this->parent->getPath('extension_root')))
{
$this->parent->abort(JText::sprintf('JLIB_INSTALLER_ABORT_LIB_INSTALL_FAILED_TO_CREATE_DIRECTORY', $this->parent->getPath('extension_root')));
return false;
}
}
/*
* If we created the plugin directory and will want to remove it if we
* have to roll back the installation, lets add it to the installation
* step stack
*/
if ($created) {
$this->parent->pushStep(array ('type' => 'folder', 'path' => $this->parent->getPath('extension_root')));
}
// Copy all necessary files
if ($this->parent->parseFiles($this->manifest->files, -1) === false)
{
// Install failed, roll back changes
$this->parent->abort();
return false;
}
// Parse optional tags
$this->parent->parseLanguages($this->manifest->languages);
$this->parent->parseMedia($this->manifest->media);
/**
* ---------------------------------------------------------------------------------------------
* Extension Registration
* ---------------------------------------------------------------------------------------------
*/
$row = JTable::getInstance('extension');
$row->name = $this->get('name');
$row->type = 'library';
$row->element = $this->get('element');
$row->folder = ''; // There is no folder for modules
$row->enabled = 1;
$row->protected = 0;
$row->access = 1;
$row->client_id = 0;
$row->params = $this->parent->getParams();
$row->custom_data = ''; // custom data
$row->manifest_cache = $this->parent->generateManifestCache();
if (!$row->store())
{
// Install failed, roll back changes
$this->parent->abort(JText::sprintf('JLIB_INSTALLER_ABORT_LIB_INSTALL_ROLLBACK', $db->stderr(true)));
return false;
}
/**
* ---------------------------------------------------------------------------------------------
* Finalization and Cleanup Section
* ---------------------------------------------------------------------------------------------
*/
// Lastly, we will copy the manifest file to its appropriate place.
$manifest = Array();
$manifest['src'] = $this->parent->getPath('manifest');
$manifest['dest'] = JPATH_MANIFESTS.DS.'libraries'.DS.basename($this->parent->getPath('manifest'));
if (!$this->parent->copyFiles(array($manifest), true))
{
// Install failed, rollback changes
$this->parent->abort(JText::_('JLIB_INSTALLER_ABORT_LIB_INSTALL_COPY_SETUP'));
return false;
}
return $row->get('extension_id');
}
/**
* Custom update method
* @access public
* @return boolean True on success
* @since 1.5
*/
public function update()
{
// since this is just files, an update removes old files
// Get the extension manifest object
$this->manifest = $this->parent->getManifest();
/**
* ---------------------------------------------------------------------------------------------
* Manifest Document Setup Section
* ---------------------------------------------------------------------------------------------
*/
// Set the extensions name
$name = (string)$this->manifest->name;
$name = JFilterInput::getInstance()->clean($name, 'string');
$element = str_replace('.xml','',basename($this->parent->getPath('manifest')));
$this->set('name', $name);
$this->set('element', $element);
$installer = new JInstaller(); // we don't want to compromise this instance!
$db = $this->parent->getDbo();
$db->setQuery('SELECT extension_id FROM #__extensions WHERE type="library" AND element = "'. $element .'"');
$result = $db->loadResult();
if ($result) {
// already installed, which would make sense
$installer->uninstall('library', $result);
}
// now create the new files
return $this->install();
}
/**
* Custom uninstall method
*
* @access public
* @param string $id The id of the library to uninstall
* @return boolean True on success
* @since 1.5
*/
public function uninstall($id)
{
// Initialise variables.
$retval = true;
// First order of business will be to load the module object table from the database.
// This should give us the necessary information to proceed.
$row = JTable::getInstance('extension');
if (!$row->load((int) $id) || !strlen($row->element))
{
JError::raiseWarning(100, JText::_('ERRORUNKOWNEXTENSION'));
return false;
}
// Is the library we are trying to uninstall a core one?
// Because that is not a good idea...
if ($row->protected)
{
JError::raiseWarning(100, JText::_('JLIB_INSTALLER_ERROR_LIB_UNINSTALL_WARNCORELIBRARY'));
return false;
}
$manifestFile = JPATH_MANIFESTS.DS.'libraries' . DS . $row->element .'.xml';
// Because libraries may not have their own folders we cannot use the standard method of finding an installation manifest
if (file_exists($manifestFile))
{
$manifest = new JLibraryManifest($manifestFile);
// Set the plugin root path
$this->parent->setPath('extension_root', JPATH_LIBRARIES.DS.$manifest->libraryname);
$xml = JFactory::getXML($manifestFile);
// If we cannot load the xml file return null
if ( ! $xml)
{
JError::raiseWarning(100, JText::_('JLIB_INSTALLER_ERROR_LIB_UNINSTALL_LOAD_MANIFEST'));
return false;
}
/*
* Check for a valid XML root tag.
* @todo: Remove backwards compatability in a future version
* Should be 'extension', but for backward compatability we will accept 'install'.
*/
if ($xml->getName() != 'install' && $xml->getName() != 'extension')
{
JError::raiseWarning(100, JText::_('JLIB_INSTALLER_ERROR_LIB_UNINSTALL_INVALID_MANIFEST'));
return false;
}
$this->parent->removeFiles($xml->files, -1);
JFile::delete($manifestFile);
}
else
{
// remove this row entry since its invalid
$row->delete($row->extension_id);
unset($row);
JError::raiseWarning(100, JText::_('JLIB_INSTALLER_ERROR_LIB_UNINSTALL_INVALID_NOTFOUND_MANIFEST'));
return false;
}
// TODO: Change this so it walked up the path backwards so we clobber multiple empties
// If the folder is empty, let's delete it
if (JFolder::exists($this->parent->getPath('extension_root')))
{
if (is_dir($this->parent->getPath('extension_root')))
{
$files = JFolder::files($this->parent->getPath('extension_root'));
if (!count($files)) {
JFolder::delete($this->parent->getPath('extension_root'));
}
}
}
$this->parent->removeFiles($xml->languages);
$row->delete($row->extension_id);
unset($row);
return $retval;
}
/**
* Custom discover method
*
* @access public
* @return array(JExtension) list of extensions available
* @since 1.6
*/
public function discover()
{
$results = Array();
$file_list = JFolder::files(JPATH_MANIFESTS.DS.'libraries','\.xml$');
foreach ($file_list as $file)
{
$manifest_details = JApplicationHelper::parseXMLInstallFile(JPATH_MANIFESTS.'/libraries/'.$file);
$file = JFile::stripExt($file);
$extension = JTable::getInstance('extension');
$extension->set('type', 'library');
$extension->set('client_id', 0);
$extension->set('element', $file);
$extension->set('name', $file);
$extension->set('state', -1);
$extension->set('manifest_cache', json_encode($manifest_details));
$results[] = $extension;
}
return $results;
}
/**
* Custom discover_install method
*
* @access public
* @param int $id The id of the extension to install (from #__discoveredextensions)
* @return void
* @since 1.6
*/
public function discover_install()
{
/* Libraries are a strange beast, they are actually references to files
* There are two parts to a library which are disjunct in their locations
* 1) The manifest file (stored in /JPATH_MANIFESTS/libraries)
* 2) The actual files (stored in /JPATH_LIBRARIES/libraryname)
* Thus installation of a library is the process of dumping files
* in two different places. As such it is impossible to perform
* any operation beyond mere registration of a library under the presumption
* that the files exist in the appropriate location so that come uninstall
* time they can be adequately removed.
*/
$manifestPath = JPATH_MANIFESTS . DS . 'libraries' . DS . $this->parent->extension->element . '.xml';
$this->parent->manifest = $this->parent->isManifest($manifestPath);
$this->parent->setPath('manifest', $manifestPath);
$manifest_details = JApplicationHelper::parseXMLInstallFile($this->parent->getPath('manifest'));
$this->parent->extension->manifest_cache = json_encode($manifest_details);
$this->parent->extension->state = 0;
$this->parent->extension->name = $manifest_details['name'];
$this->parent->extension->enabled = 1;
$this->parent->extension->params = $this->parent->getParams();
if ($this->parent->extension->store()) {
return true;
}
else
{
JError::raiseWarning(101, JText::_('JLIB_INSTALLER_ERROR_LIB_DISCOVER_STORE_DETAILS'));
return false;
}
}
/**
* Refreshes the extension table cache
* @return boolean result of operation, true if updated, false on failure
* @since 1.6
*/
public function refreshManifestCache()
{
// Need to find to find where the XML file is since we don't store this normally
$manifestPath = JPATH_MANIFESTS.DS.'libraries'. DS.$this->parent->extension->element.'.xml';
$this->parent->manifest = $this->parent->isManifest($manifestPath);
$this->parent->setPath('manifest', $manifestPath);
$manifest_details = JApplicationHelper::parseXMLInstallFile($this->parent->getPath('manifest'));
$this->parent->extension->manifest_cache = json_encode($manifest_details);
$this->parent->extension->name = $manifest_details['name'];
try {
return $this->parent->extension->store();
}
catch(JException $e) {
JError::raiseWarning(101, JText::_('JLIB_INSTALLER_ERROR_LIB_REFRESH_MANIFEST_CACHE'));
return false;
}
}
}
| nopticon/jcg | libraries/joomla/installer/adapters/library.php | PHP | gpl-2.0 | 13,710 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
1030,
2544,
1002,
8909,
1024,
3075,
1012,
25718,
19627,
28311,
2249,
1011,
5890,
1011,
2676,
5718,
1024,
4868,
1024,
5388,
2480,
18558,
17643,
2546,
2581,
2575,
2620,
1002,
1008,
1030,
9385,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var q = require('q');
var _ = require('lodash');
var moment = require('moment');
var trello = require('../libs/trello_client');
var ORGANIZATIONS = [
{ id: '4ffb85c372c8548a030144e5', name: 'HuaJiao' },
{ id: '4ffb861572c8548a03015a66', name: 'Asimov' },
{ id: '544765a39570e08b7e6aeccb', name: 'NextTao' },
];
var NEXTTAO = { id: '544765a39570e08b7e6aeccb', name: 'NextTao' };
var SCRUM_NAMES = [ 'Features', 'Bugs', 'Upcoming', 'Today', 'Re-Open', 'Close', ];
function _mapListIds(lists) {
return _.reduce(lists, function (memo, next) {
memo[next.name] = next.id;
return memo;
}, {});
}
function _summarizeBoard(brd) {
var d = q.defer();
q
.all([trello.getCardsOfBoard(brd.id), trello.getListsOfBoard(brd.id)])
.spread(function (cards, lists) {
var aggregated = _.groupBy(cards, 'idList');
var mapping = _mapListIds(lists);
var result = _.map(SCRUM_NAMES, function (name) {
var listId = mapping[name];
var cards = aggregated[listId];
if (cards) {
return name + ": " + cards.length;
} else {
return name + ": 0";
}
});
d.resolve('# ' + brd.name + '\n' + result.join(', '))
})
.fail(function (error) {
d.reject(error);
})
.done();
return d.promise;
}
function _summarizeOrg(org, msg) {
trello.getOpenBoardsOfOrg(org.id)
.then(function (boards) {
var results = _.map(boards, function (brd) {
return _summarizeBoard(brd);
})
return q.all(results);
})
.then(function (results) {
msg.send([
org.name,
'----------------',
results.join('\n'),
].join('\n'));
})
.fail(function (error) {
console.log(error);
})
.done();
}
function _weeklyBoard(board) {
var d = q.defer();
trello.activeCards(board.id, -7)
.then(function (cards) {
var text = [
board.name,
'----------------',
_.map(cards, function (c) {
return [ c.list.name, c.name, c.updated ].join(' ');
}).join('\n')
].join('\n');
d.resolve(text);
})
.fail()
.done();
return d.promise;
}
function _weeklyOrg(org, msg) {
trello.getOpenBoardsOfOrg(org.id)
.then(function (boards) {
var results = _.map(boards, function (brd) {
return _weeklyBoard(brd);
})
return q.all(results);
})
.then(function (results) {
_.each(results, function (r) {
msg.send(r);
})
})
.fail()
.done();
}
module.exports = {
summary: function (msg) {
_.each(ORGANIZATIONS, function (org) {
_summarizeOrg(org, msg);
});
},
weekly: function (msg) {
msg.send('// working on the weekly report of ' + NEXTTAO.name);
_weeklyOrg(NEXTTAO, msg);
}
};
| hbrls/magii | scripts/trello/index.js | JavaScript | mit | 2,803 | [
30522,
13075,
1053,
1027,
5478,
1006,
1005,
1053,
1005,
1007,
1025,
13075,
1035,
1027,
5478,
1006,
1005,
8840,
8883,
2232,
1005,
1007,
1025,
13075,
2617,
1027,
5478,
1006,
1005,
2617,
1005,
1007,
1025,
13075,
29461,
7174,
1027,
5478,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System.Diagnostics;
namespace AdventOfCode.Day07.SignalProviders
{
[DebuggerDisplay("{DebuggerDisplay}")]
public class Wire : SignalProvider
{
#region | Properties & fields
private readonly Circut _parentCircut;
private readonly string _rawProvider;
public string ID { get; }
private SignalProvider Connection { get; set; }
public string DebuggerDisplay => $"{ID}{_rawProvider}";
#endregion
#region | ctors
public Wire(Circut circut, string wireId, string rawSignalProvider)
{
_parentCircut = circut;
ID = wireId;
_rawProvider = rawSignalProvider;
}
#endregion
#region | Non-public members
private void ResolveProvider()
{
Connection = ProviderParser.ParseProviderType(_rawProvider, _parentCircut);
}
#endregion
#region | Overrides
public override ushort GetValue()
{
if (!IsResolved) // cache the value
{
ResolveProvider();
Value = Connection.GetValue();
IsResolved = true;
}
return Value;
}
#endregion
}
} | vatioz/AdventOfCode | AdventOfCode/Day07/SignalProviders/Wire.cs | C# | mit | 1,265 | [
30522,
2478,
2291,
1012,
16474,
2015,
1025,
3415,
15327,
13896,
11253,
16044,
1012,
2154,
2692,
2581,
1012,
4742,
21572,
17258,
2545,
1063,
1031,
2139,
8569,
13327,
10521,
13068,
1006,
1000,
1063,
2139,
8569,
13327,
10521,
13068,
1065,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.minecolonies.coremod.client.gui;
import com.ldtteam.blockout.Pane;
import com.ldtteam.blockout.controls.Button;
import com.ldtteam.blockout.controls.ButtonHandler;
import com.ldtteam.blockout.controls.Text;
import com.ldtteam.blockout.views.ScrollingList;
import com.ldtteam.blockout.views.Window;
import com.ldtteam.structurize.util.LanguageHandler;
import com.minecolonies.api.colony.ICitizenDataView;
import com.minecolonies.api.colony.IColonyView;
import com.minecolonies.api.colony.buildings.views.IBuildingView;
import com.minecolonies.api.util.BlockPosUtil;
import com.minecolonies.api.util.constant.Constants;
import com.minecolonies.coremod.Network;
import com.minecolonies.coremod.colony.buildings.AbstractBuildingGuards;
import com.minecolonies.coremod.colony.buildings.views.LivingBuildingView;
import com.minecolonies.coremod.network.messages.server.colony.building.home.AssignUnassignMessage;
import net.minecraft.util.math.BlockPos;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import static com.minecolonies.api.util.constant.WindowConstants.*;
import static com.minecolonies.coremod.client.gui.huts.WindowHutBuilderModule.DARKGREEN;
import static com.minecolonies.coremod.client.gui.huts.WindowHutBuilderModule.RED;
/**
* Window for the hiring or firing of a worker.
*/
public class WindowAssignCitizen extends Window implements ButtonHandler
{
/**
* Threshold that defines when the living quarters are too far away.
*/
private static final double FAR_DISTANCE_THRESHOLD = 250;
/**
* The view of the current building.
*/
private final IBuildingView building;
/**
* List of citizens which can be assigned.
*/
private final ScrollingList citizenList;
/**
* The colony.
*/
private final IColonyView colony;
/**
* Contains all the citizens.
*/
private List<ICitizenDataView> citizens = new ArrayList<>();
/**
* Constructor for the window when the player wants to assign a worker for a certain home building.
*
* @param c the colony view.
* @param buildingId the building position.
*/
public WindowAssignCitizen(final IColonyView c, final BlockPos buildingId)
{
super(Constants.MOD_ID + ASSIGN_CITIZEN_RESOURCE_SUFFIX);
this.colony = c;
building = colony.getBuilding(buildingId);
citizenList = findPaneOfTypeByID(CITIZEN_LIST, ScrollingList.class);
updateCitizens();
}
/**
* Clears and resets/updates all citizens.
*/
private void updateCitizens()
{
citizens.clear();
citizens.addAll(colony.getCitizens().values());
//Removes all citizens which already have a job.
citizens = colony.getCitizens().values().stream()
.filter(cit -> cit.getHomeBuilding() == null
|| !(colony.getBuilding(cit.getHomeBuilding()) instanceof AbstractBuildingGuards.View)
&& !cit.getHomeBuilding().equals(building.getID()))
.sorted(Comparator.comparing(cit -> ((ICitizenDataView) cit).getHomeBuilding() == null ? 0 : 1)
.thenComparingLong(cit -> {
if (((ICitizenDataView) cit).getWorkBuilding() == null)
{
return 0;
}
return BlockPosUtil.getDistance2D(((ICitizenDataView) cit).getWorkBuilding(), building.getPosition());
})).collect(Collectors.toList());
}
/**
* Called when the GUI has been opened. Will fill the fields and lists.
*/
@Override
public void onOpened()
{
updateCitizens();
citizenList.enable();
citizenList.show();
//Creates a dataProvider for the homeless citizenList.
citizenList.setDataProvider(new ScrollingList.DataProvider()
{
/**
* The number of rows of the list.
* @return the number.
*/
@Override
public int getElementCount()
{
return citizens.size();
}
/**
* Inserts the elements into each row.
* @param index the index of the row/list element.
* @param rowPane the parent Pane for the row, containing the elements to update.
*/
@Override
public void updateElement(final int index, @NotNull final Pane rowPane)
{
@NotNull final ICitizenDataView citizen = citizens.get(index);
if (building instanceof LivingBuildingView)
{
rowPane.findPaneOfTypeByID(CITIZEN_LABEL, Text.class).setText(citizen.getName());
final BlockPos work = citizen.getWorkBuilding();
String workString = "";
double newDistance = 0;
if (work != null)
{
newDistance = BlockPosUtil.getDistance2D(work, building.getPosition());;
workString = " " + newDistance + " blocks";
}
final BlockPos home = citizen.getHomeBuilding();
String homeString = "";
boolean better = false;
boolean badCurrentLiving = false;
if (home != null)
{
if (work != null)
{
final double oldDistance = BlockPosUtil.getDistance2D(work, home);
homeString = LanguageHandler.format("com.minecolonies.coremod.gui.homeHut.currently", oldDistance);
better = newDistance < oldDistance;
if (oldDistance >= FAR_DISTANCE_THRESHOLD)
{
badCurrentLiving = true;
}
}
else
{
homeString = LanguageHandler.format("com.minecolonies.coremod.gui.homeHut.current", home.getX(), home.getY(), home.getZ());
}
}
final Text newLivingLabel = rowPane.findPaneOfTypeByID(CITIZEN_JOB, Text.class);
newLivingLabel.setText(LanguageHandler.format(citizen.getJob()) + workString);
if (better)
{
newLivingLabel.setColors(DARKGREEN);
}
final Text currentLivingLabel = rowPane.findPaneOfTypeByID(CITIZEN_LIVING, Text.class);
currentLivingLabel.setText(homeString);
if (badCurrentLiving)
{
currentLivingLabel.setColors(RED);
}
final Button done = rowPane.findPaneOfTypeByID(CITIZEN_DONE, Button.class);
if (colony.isManualHousing())
{
done.enable();
}
else
{
done.disable();
}
}
}
});
}
@Override
public void onUpdate()
{
updateCitizens();
window.findPaneOfTypeByID(CITIZEN_LIST, ScrollingList.class).refreshElementPanes();
}
/**
* Called when any button has been clicked.
*
* @param button the clicked button.
*/
@Override
public void onButtonClicked(@NotNull final Button button)
{
if (button.getID().equals(BUTTON_DONE))
{
final int row = citizenList.getListElementIndexByPane(button);
final ICitizenDataView data = citizens.get(row);
if (building instanceof LivingBuildingView)
{
((LivingBuildingView) building).addResident(data.getId());
}
Network.getNetwork().sendToServer(new AssignUnassignMessage(this.building, true, data.getId()));
}
else if (!button.getID().equals(BUTTON_CANCEL))
{
return;
}
if (colony.getTownHall() != null)
{
building.openGui(false);
}
}
}
| Minecolonies/minecolonies | src/main/java/com/minecolonies/coremod/client/gui/WindowAssignCitizen.java | Java | gpl-3.0 | 8,602 | [
30522,
7427,
4012,
1012,
3067,
25778,
10698,
2229,
1012,
4563,
5302,
2094,
1012,
7396,
1012,
26458,
1025,
12324,
4012,
1012,
25510,
4674,
3286,
1012,
3796,
5833,
1012,
6090,
2063,
1025,
12324,
4012,
1012,
25510,
4674,
3286,
1012,
3796,
5833... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Created with JetBrains WebStorm.
* User: gbox3d
* Date: 13. 3. 30.
* Time: 오후 3:35
* version : 0.8
* it is parts of pig2d engine
* this engine is base on html5 css3
최종수정 2015.11.5
- 배경적용안되는 버그 수정, 2015.11.5
*/
Pig2d = {
version : '1.0.0'
};
/////////////////////
///model
Pig2d.model = Backbone.Model.extend({
initialize: function() {
var element = document.createElement('div');
var name = this.get('name');
if(name != undefined) {
element.setAttribute('id',name);
}
//2.3 이전 버전을 위한
if(element.classList != undefined) {
element.classList.add('pig2d-node');
}
else {
$(element).addClass('pig2d-node');
}
this.attributes.element = element;
this.attributes.update_signal = 'none';
this.attributes.translation = new gbox3d.core.Vect2d(0,0);
this.attributes.scale = new gbox3d.core.Vect2d(1,1);
//this.attributes.matrix = mat2d.create();
//this.attributes.matrix = new WebKitCSSMatrix();
this.attributes.flipX = false;
this.attributes.flipY = false;
this.attributes.cssupdate = true;
this.attributes.cancelTransition = false;
this.attributes.offset = {
x:0,
y:0
};
},
defaults: {
rotation : 0
},
getPosition : function() {
//if(decompose == true) {
//행렬분해후 적용
// this.decomposeCssMatrix(this.getCssMatrix());
//}
return this.attributes.translation;
},
getRotation : function() {
return this.attributes.rotation;
},
setPosition : function(x,y) {
this.attributes.translation.set(x,y);
return this;
},
setRotation : function(angle) {
this.attributes.rotation = angle;
return this;
},
rotate : function(angle_delata) {
this.attributes.rotation += angle_delata;
return this;
},
setScale : function(x,y) {
this.attributes.scale.set(x,y);
return this;
},
getScale : function() {
return this.attributes.scale;
},
translate: function () {
var v1 = new gbox3d.core.Vect2d();
var center = new gbox3d.core.Vect2d(0,0);
return function ( distance, axis ) {
// axis is assumed to be normalized
v1.copy( axis );
v1.multiply( distance );
v1.rotate( gbox3d.core.degToRad(-this.attributes.rotation),center);
if(this.attributes.flipX) {
v1.X *= -1;
}
if(this.attributes.flipY) {
v1.Y *= -1;
}
this.attributes.translation.addToThis( v1 );
return this;
};
}(),
show : function(visible) {
this.get('element').style.visibility = visible ? 'inherit' : 'hidden';
},
isVisible : function() {
return (this.get('element').style.visibility == 'hidden') ? false : true;
},
/////////////////////
////행렬관련
//////////////////
getCssMatrix : function() {
var el = this.get('element');
var computedStyle = window.getComputedStyle(el);
var trans = computedStyle.getPropertyValue('-webkit-transform');
var cssmat = new WebKitCSSMatrix(trans);
return cssmat;
},
//주어진 행렬을 분해하여 노드변환값에 역적용하기
decomposeCssMatrix : function(cssmat) {
//var cssmat = this.getCssMatrix();
//이동변환 얻기
this.attributes.translation.X = cssmat.e;
this.attributes.translation.Y = cssmat.f;
//스케일 얻기
var scalex = Math.sqrt(cssmat.a*cssmat.a + cssmat.b*cssmat.b);
var scaley = Math.sqrt(cssmat.c*cssmat.c + cssmat.d*cssmat.d);
this.attributes.scale.X = scalex;
this.attributes.scale.Y = scaley;
//회전 얻기
var angle = Math.round(Math.atan2(cssmat.b/scalex, cssmat.a/scalex) * (180/Math.PI));
this.attributes.rotation = angle;
},
getDecomposePosition : function() {
var cssmat = this.getCssMatrix();
return new gbox3d.core.Vect2d(cssmat.e,cssmat.f);
},
////////////// animator
setupTransition : function(param) {
var element = this.get('element');
element.style.WebkitTransition = '';
this.attributes.TransitionEndCallBack = param.TransitionEndCallBack;
if(this.attributes._TransitionEndCallBack != undefined) {
element.removeEventListener('webkitTransitionEnd',this.attributes._TransitionEndCallBack);
}
this.attributes._TransitionEndCallBack = function(event) {
if(this.attributes.cancelTransition == true) {
this.attributes.cancelTransition = false;
}
else {
this.attributes.cssupdate = true;
element.style.WebkitTransition = '';
if(this.attributes.TransitionEndCallBack != undefined) {
this.attributes.TransitionEndCallBack.apply(this);
}
}
//이밴트 전달 금지
event.cancelBubble = true;
event.stopPropagation();
}.bind(this);
element.addEventListener('webkitTransitionEnd',this.attributes._TransitionEndCallBack,false);
// if(param.timing_function != undefined) {
// element.style.webkitTransitionTimingFunction = 'linear';
// }
return this;
},
transition : function(param) {
var element = this.get('element');
param.timing_function = param.timing_function ? param.timing_function : 'linear';
if(element.style.WebkitTransition !== '')
return;
if(param.position != undefined) {
if(param.position.X == this.attributes.translation.X && param.position.Y == this.attributes.translation.Y ) {
}
else {
if(element.style.WebkitTransition === '') {
element.style.WebkitTransition = '-webkit-transform ' + param.time + 's ' + param.timing_function;
this.setPosition(param.position.X,param.position.Y);
}
}
}
if(param.rotation != undefined) {
if(param.rotation == this.attributes.rotation) {
}
else {
if(element.style.WebkitTransition === '') {
element.style.WebkitTransition = '-webkit-transform ' + param.time + 's '+ param.timing_function;
}
this.setRotation(param.rotation);
}
}
if(param.scale != undefined) {
if(param.scale.X == this.attributes.scale.X && param.scale.Y == this.attributes.scale.Y) {
}
else {
if(element.style.WebkitTransition === '') {
element.style.WebkitTransition = '-webkit-transform ' + param.time + 's ' + param.timing_function;
}
this.setScale(param.scale.X,param.scale.Y);
}
}
},
stopTransition : function(param) {
this.attributes.update_signal = 'stop_transition';
this.attributes.cancelTransition = true;
return this;
},
clearTransition : function() {
var el = this.get('element');
el.removeEventListener('webkitTransitionEnd',this.attributes._TransitionEndCallBack);
this.attributes.update_signal = 'stop_transition';
},
////////////////////
updateCSS : function() {
//if(this.attributes.cssupdate == false) return;
var el = this.get('element');
switch (this.attributes.update_signal) {
case 'none':
(function() {
//오브잭트변환값을 앨리먼트쪽으로 갱신해주기
if(this.attributes.cssupdate == true) {
var trans = this.attributes.translation;
var rot = this.attributes.rotation;
var scalex = this.attributes.scale.X;
var scaley = this.attributes.scale.Y;
//반전 적용
if(this.attributes.flipX) {
scaley = -scaley;
}
if(this.attributes.flipY) {
scalex = -scalex;
}
var css_val = 'translate(' + trans.X + 'px,' + trans.Y +'px) ' +
'rotate(' + rot + 'deg) ' +
'scale(' + scalex + ',' + scaley + ')';
//브라우져 호환성을 위한 코드
el.style.WebkitTransform = css_val;
el.style.MozTransform = css_val;
el.style.oTransform = css_val;
el.style.transform = css_val;
//트랜지션 상태이면 css를 더이상 업데이트 못하게 한다
if(el.style.WebkitTransition !== '') {
this.attributes.cssupdate = false;
}
}
else {
//현재 트랜지션 상태이므로 트래지션 취소는 무효화 된다.
this.attributes.cancelTransition = false;
}
}).bind(this)();
break;
case 'stop_transition':
(function() {
//행렬분해후 적용
this.decomposeCssMatrix(this.getCssMatrix());
el.style.WebkitTransition = '';
this.attributes.update_signal = 'none';
this.attributes.cssupdate = true;
this.updateCSS();
}).bind(this)();
break;
}
return this;
},
///////////////////////////////////////////
setupCssAnimation : function(option) {
var element = this.get('element');
element.style.WebkitAnimationName = option.name;
element.style.WebkitAnimationDuration = option.duration;
if(option.timing_function) {
element.style.WebkitAnimationTimingFunction = option.timing_function;
}
if(option.delay) {
element.style.WebkitAnimationDelay = option.delay;
}
if(option.direction) {
element.style.WebkitAnimationDirection = option.direction;
}
if(option.iteration_count) {
element.style.WebkitAnimationIterationCount = option.iteration_count;
}
element.style.WebkitAnimationPlayState = 'running';
this.attributes.CssAnimationEndCallBack = option.EndCallBack;
if(this.attributes._CssAnimationEndCallBack != undefined) {
element.removeEventListener('webkitAnimationEnd',this.attributes._CssAnimationEndCallBack);
}
this.attributes._CssAnimationEndCallBack = function(event) {
element.style.WebkitAnimation = '';
if(this.attributes.CssAnimationEndCallBack != undefined) {
this.attributes.CssAnimationEndCallBack.apply(this);
}
//이밴트 전달 금지
event.cancelBubble = true;
event.stopPropagation();
}.bind(this);
element.addEventListener('webkitAnimationEnd',this.attributes._CssAnimationEndCallBack,false);
return this;
},
//////////////////////////
//노드에서 완전히 제거할때 사용됨
destroy : function() {
var el = this.get('element');
//el.removeEventListener('webkitTransitionEnd');
this.clearTransition();
el.parentNode.removeChild(el);
},
clone : function() {
var model = Backbone.Model.prototype.clone.call(this);
// console.log(model);
model.set("element",this.get('element').cloneNode(true));
return model;
}
});
//end of base model
//////////////////////
Pig2d.SpriteModel = Pig2d.model.extend({
initialize: function(param) {
Pig2d.model.prototype.initialize.call(this);
this.attributes.currentFrame = 0;
//애니메이션 타이머 핸들
this.attributes.animationHID = null;
var sheet = document.createElement('canvas');
sheet.classList.add('pig2d-sheet');
sheet.style.position = 'absolute';
this.get('element').appendChild(sheet);
this.set('sheet',sheet);
this.set('sheetCTX',sheet.getContext('2d'));
this.attributes.currentTick = 0;
this.attributes.scaler = 1;
if(this.attributes.data.canvas_size) {
sheet.width = this.attributes.data.canvas_size.width;
sheet.height = this.attributes.data.canvas_size.height;
}
//캔버스 클리어 일부 삼성폰들은 초기화를 안할경우 잔상이 생긴다.
//this.get('sheetCTX').clearRect(0,0,sheet.width,sheet.height);
//this.setFrame(-1);
//this.attributes.AnimationStatus = 'ready';
},
setScaler : function(scale) {
this.attributes.scaler = scale;
if(this.attributes.data.canvas_size) {
var sheet = this.get('sheet');
this.attributes.data.canvas_size.width *= scale;
this.attributes.data.canvas_size.height *= scale;
sheet.width = this.attributes.data.canvas_size.width;
sheet.height = this.attributes.data.canvas_size.height;
}
},
changeDress : function(param) {
this.attributes.imgObj = param.texture;
this.attributes.data = param.animation;
var sheet = this.get('sheet');
if(this.attributes.data.canvas_size) {
sheet.width = this.attributes.data.canvas_size.width;
sheet.height = this.attributes.data.canvas_size.height;
}
this.setFrame(this.attributes.currentFrame);
},
clone : function() {
var model = Backbone.Model.prototype.clone.call(this);
console.log('SpriteModel clone');
//model.set("element",this.get('element').cloneNode(true));
return model;
},
updateCSS : function (deltaTime) {
deltaTime = deltaTime || 0;
this.applyAnimation(deltaTime);
return Pig2d.model.prototype.updateCSS.call(this);
},
//////////////////////////////////////////////
//애니메이션 관련 기능
//////////////////////////////////////////////
setFrame : function(index) {
//프레임 노드 얻기
var imgObj = this.attributes.imgObj;
if(this.attributes.data.frames.length <= index) {
console.log('error exeed frame number : ' + index + ',' + this.attributes.data.frames.length);
index = 0;
}
if(imgObj != undefined) {
this.set('currentFrame',index);
var sheet = this.attributes.sheet;
var ctx = this.attributes.sheetCTX;
/*
공백프레임을 만든 이유 :
일부 폰들(삼성폰)에서 캔버스를 처음생성한후 맨처음 랜더링된 이미지가 지워지지않고 남아 있는 현상들이 발생함
그래서 캔버스처음생성할때(changeDress,createSprite)할때는 반드시 공백프레임을 화면에 한번출력을 해주어야함
*/
if(index < 0) { //공프레임 이면..
if(this.attributes.data.canvas_size) {
sheet.width = this.attributes.data.canvas_size.width;
sheet.height = this.attributes.data.canvas_size.height;
ctx.clearRect(0,0,this.attributes.data.canvas_size.width,this.attributes.data.canvas_size.height);
}
}
else {
var frame = this.attributes.data.frames[this.attributes.currentFrame];
//console.log(this.attributes.currentFrame);
var sheet_data = frame.sheets[0];
var scaler = this.attributes.scaler;
if(this.attributes.data.canvas_size) {
ctx.clearRect(0,0,this.attributes.data.canvas_size.width,this.attributes.data.canvas_size.height);
//sheet.width = 1;
//sheet.width = this.attributes.data.canvas_size.width;
}
else {
sheet.width = sheet_data.width;
sheet.height = sheet_data.height;
}
var offsetX = sheet_data.centerOffset.x;
var offsetY = sheet_data.centerOffset.y;
var destW = sheet_data.width;
var destH = sheet_data.height;
var cutx = -sheet_data.bp_x;
var cuty = -sheet_data.bp_y;
var srcW = sheet_data.width;
var srcH = sheet_data.height;
if(scaler < 1.0) {
offsetX *= scaler;
offsetY *= scaler;
destW *= scaler;
destH *= scaler;
}
sheet.style.webkitTransform = "translate(" + offsetX + "px," + offsetY + "px)";
ctx.drawImage(
imgObj,
cutx,cuty,srcW,srcH,
0,0,destW,destH
);
}
}
return this;
},
/////////////////////////////////////////////
/////new animation system////////////////////
/////////////////////////////////////////////
setupAnimation : function(param) {
param = param ? param : {};
this.attributes.startFrame = param.startFrame ? param.startFrame : 0 ;
this.attributes.endFrame = param.endFrame ? param.endFrame : (this.get('data').frames.length-1);
if(param.isAnimationLoop !== undefined) {
this.attributes.isAnimationLoop = param.isAnimationLoop;
}
else {
this.attributes.isAnimationLoop = true;
}
this.attributes.AnimationEndCallback = param.AnimationEndCallback;
this.attributes.AnimationStatus = param.AnimationStatus ? param.AnimationStatus : 'stop';
this.setFrame(this.attributes.startFrame);
},
applyAnimation : function(delataTick) {
if(this.attributes.AnimationStatus == 'play') {
this.attributes.currentTick += delataTick;
var frameindex = this.attributes.currentFrame;
var Ani_data = this.get('data');
var delay = 300;
if(frameindex >= 0) {
delay = Ani_data.frames[frameindex].delay / 1000;
}
//var delay = Ani_data.frames[frameindex].delay / 1000;
if(this.attributes.currentTick > delay) {
this.attributes.currentTick = 0;
++frameindex;
if(frameindex > this.attributes.endFrame) {//마지막 프레임이면
if(this.attributes.isAnimationLoop) {
frameindex = this.attributes.startFrame;
this.setFrame(frameindex);
}
else {
this.attributes.AnimationStatus = 'stop';
frameindex = this.attributes.endFrame;
}
if(this.attributes.AnimationEndCallback != undefined) {
this.attributes.AnimationEndCallback.bind(this)();
}
}
else {
this.setFrame(frameindex);
}
}
}
else if(this.attributes.AnimationStatus == 'ready') {
this.setFrame(-1);
this.attributes.AnimationStatus = 'play';
this.attributes.currentFrame = this.attributes.startFrame;
}
},
stopAnimation : function() {
this.attributes.AnimationStatus = 'stop';
},
////////////////////////
destroy : function() {
//this.stop_animate();
//슈퍼 클래싱
Pig2d.model.prototype.destroy.call(this);
}
});
//end of sprite model
///////////////////////
//////////////////node//
/////////////////////////
Pig2d.node = Backbone.Model.extend({
initialize: function() {
this.attributes.children = this.attributes.chiledren = new Array();
// _.bindAll(this,"update","clone");
},
traverse : function(callback,param) {
callback.bind(this)(param);
for(var index = 0;index < this.attributes.chiledren.length;index++ ) {
this.attributes.chiledren[index].traverse(callback,param);
}
},
update: function(applyChild,deltaTime) {
this.get('model').updateCSS(deltaTime);
if( applyChild == true) {
for(var index = 0;index < this.attributes.chiledren.length;index++ ) {
this.attributes.chiledren[index].update(applyChild,deltaTime);
}
}
return this;
},
clone : function() {
//딥 클로닝
var node = Backbone.Model.prototype.clone.call(this);
if(node.get('model')) {
var model = node.get('model').clone();
node.set({model:model});
}
var chiledren = this.get('chiledren');
for(var i=0;i<chiledren.length;i++) {
node.add(chiledren[i].clone());
}
return node;
},
findByName : function(name) {
if(name == this.attributes.name) return this;
for(var index in this.attributes.chiledren ) {
var obj = this.attributes.chiledren[index].findByName(name);
if(obj != null)
return obj;
}
return null;
},
findByID : function(cid) {
if(cid == this.cid) return this;
for(var index in this.attributes.chiledren ) {
var obj = this.attributes.chiledren[index].findByID(cid);
if(obj != null)
return obj;
}
return null;
},
add : function(child_node,parents) {
if(parents == undefined || parents == null) {
parents = this;
}
parents.get('chiledren').push(child_node);
//child_node.setParent(parents);
//모델이 존재하면
if(parents.get('model')) {
var par_el = parents.get('model').get('element');
var child_el = child_node.get('model').get('element');
}
par_el.appendChild(child_el);
child_node.attributes.parent = parents;
return this;
},
//부모노드 바꾸기
setParent : function(parent) {
var old_parent = this.get('parent');
var chiledren = old_parent.get('chiledren');
for(var i= chiledren.length-1;i >= 0;i--) {
if(chiledren[i] === this) {
chiledren.splice(i,1);
parent.add(this);
}
}
},
removeChild : function(node) {
for(var i= this.attributes.chiledren.length-1;i >= 0;i--) {
var _node = this.attributes.chiledren[i];
if(_node === node) {
this.attributes.chiledren.splice(i,1);
node.get('model').destroy();
return true;
}
else {
_node.removeChild(node); //자식노드까지 검사
}
}
return false;
},
removeChildAll : function() {
for(var i= this.attributes.chiledren.length-1;i >= 0;i--) {
this.removeChild(this.attributes.chiledren[i]);
}
return false;
},
show : function(visible) {
//console.log(this.get('model').get('element'));
//this.get('model').get('element').style.visibility = visible ? 'inherit' : 'hidden';
this.get('model').show(visible);
},
isVisible : function() {
//return (this.get('model').get('element').style.visibility == 'hidden') ? false : true;
return this.get('model').isVisible();
}
});
//end of node
///////////////
///
Pig2d.SceneManager = Backbone.Model.extend({
initialize: function(param) {
var rootNode = new Pig2d.node(
{
model : new Pig2d.model({
name : 'root_' + (new Date()).getTime() + '_'
})
}
);
rootNode.get('model').setPosition(0,0);
//this.attributes.container.append(rootNode.get('model').get('element'));
var rootElement = rootNode.get('model').get('element');
//console.log(rootElement);
if(param.window_size != undefined) {
rootElement.style.overflow = 'hidden';
rootElement.style.width = param.window_size.width + 'px' ;
rootElement.style.height = param.window_size.height + 'px' ;
}
if(param.bkg_color != undefined) {
//2015.11.5 수정 ,배경적용안되는 버그 수정
this.attributes.container.style.backgroundColor = param.bkg_color;
}
this.attributes.container.appendChild(rootElement);
this.attributes.rootNode = rootNode;
},
getRootNode : function() {
return this.attributes.rootNode;
},
updateAll : function(deltaTime) {
deltaTime = deltaTime ? deltaTime : 0.01;
this.attributes.rootNode.update(true,deltaTime);
},
add : function(node,parent) {
if(parent == undefined) {
this.attributes.rootNode.add(node);
}
else {
parent.add(node);
}
},
addImageNode : function(param) {
//var node = Pig2d.util.createImage(param.img_info);
//this.add(node,param.parent);
var center_x = param.center ? param.center.x : 0;
var center_y = param.center ? param.center.y : 0;
var node = Pig2d.util.createDummy();
var imgObj = new Image();
imgObj.onload = function(evt) {
//console.log(this.width);
imgObj.style.position = 'absolute';
imgObj.style.left = -this.width/2 + parseInt(center_x) + 'px';
imgObj.style.top = -this.height/2 + parseInt(center_y) + 'px';
var element = node.get('model').get('element');
element.appendChild(imgObj);
node.get('model').set('imgObj', imgObj);
if(param.onload) {
param.onload(node);
}
}
imgObj.src = param.src;
this.add(node,param.parent);
return node;
},
addSpriteSceneNode : function(param) {
var node = Pig2d.util.createSprite(param.spr_info);
node.show(true);
this.add(node,param.parent);
return node;
}
});
//end of scene manager
| gbox3d/pig2d | from_old/libs/pig2d/js/node2d.js | JavaScript | mit | 27,176 | [
30522,
1013,
1008,
1008,
1008,
2580,
2007,
6892,
10024,
7076,
4773,
19718,
1012,
1008,
5310,
1024,
16351,
11636,
29097,
1008,
3058,
1024,
2410,
1012,
1017,
1012,
2382,
1012,
1008,
2051,
1024,
1463,
30011,
30005,
30014,
1017,
1024,
3486,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
class Mapbox_Post_Map_Base {
private $new_map_nonce_name = 'mb_create_map';
// private $new_map_nonce = null;
function __construct() {
// nothing to see here
}
function create_new_map_nonce() {
// This nonce is used to verify intent on fetching post location data for map creation. That action is an AJAX call to get_post_locations().
$this->new_map_nonce = wp_create_nonce($this->new_map_nonce_name);
}
function get_post_locations_from_wp($mb_country) {
// Set up output data structure
$geojson_output_data = new stdClass();
$geojson_output_data->type = "FeatureCollection";
$geojson_output_data->features = array();
// Set up WP query
$args = array(
'post_type' => 'post',
'posts_per_page' => '-1'
);
$post_query = new WP_Query($args);
// Loop through posts
if($post_query->have_posts() ) {
while($post_query->have_posts() ) {
$post_query->the_post();
// Check if post is published, skip if not
if (get_post_status() != 'publish') {
continue;
}
// If country is set, get the tag to check if we care about this post
if ((!$mb_country) or (($mb_country) and (has_tag($mb_country)))) {
// Get location
$location = get_field('map_location');
if( !empty($location)) {
$post_obj = new stdClass();
// Create GeoJSON structure
$post_obj->type = "Feature";
$post_obj->geometry->type = "Point";
// Set location
$post_obj->geometry->coordinates = array($location['lng'], $location['lat']);
// Get the post title
$post_obj->properties->postTitle = the_title('', '', false);
$post_obj->properties->postLink = get_permalink();
// Get the category name, link, and color
if (($cat_label = Bunyad::posts()->meta('cat_label'))) {
$post_obj->properties->postCatId = get_category($cat_label)->cat_ID;
$post_obj->properties->postCatName = esc_html(get_category($cat_label)->name);
}
else {
$post_obj->properties->postCatId = current(get_the_category())->cat_ID;
$post_obj->properties->postCatName = esc_html(current(get_the_category())->name);
}
$post_obj->properties->postCatLink = esc_url(get_category_link($post_obj->properties->postCatId));
// Get the post thumbnail url
$thumbnail_url = get_the_post_thumbnail_url(null, 'grid-slider-small');
if ($thumbnail_url == "false") {
$post_obj->properties->postThumbnailUrl = "";
}
else {
$post_obj->properties->postThumbnailUrl = $thumbnail_url;
}
// Get post id
$postid = get_the_ID();
if ($postid == "false") {
$post_obj->properties->postID = "";
}
else {
$post_obj->properties->postID = $postid;
}
array_push($geojson_output_data->features, $post_obj);
}
}
}
}
return $geojson_output_data;
}
function get_post_locations() {
// Check nonce
if( ! wp_verify_nonce( $_REQUEST['nonce'], $this->new_map_nonce_name) ){
wp_send_json_error();
}
// Get country filter through AJAX
$mb_country = $_POST['country'];
// Get output data and send it as JSON
wp_send_json($this->get_post_locations_from_wp($mb_country));
}
function register_ajax_callback() {
add_action('wp_ajax_nopriv_mb_get_post_locations', array($this, 'get_post_locations'));
add_action('wp_ajax_mb_get_post_locations', array($this, 'get_post_locations'));
}
} | SvenChmie/Mapbox-Postmap-Plugin | includes/class-mapbox-post-map-base.php | PHP | gpl-3.0 | 3,996 | [
30522,
1026,
1029,
25718,
2465,
4949,
8758,
1035,
2695,
1035,
4949,
1035,
2918,
1063,
2797,
1002,
2047,
1035,
4949,
1035,
2512,
3401,
1035,
2171,
1027,
1005,
16914,
1035,
3443,
1035,
4949,
1005,
1025,
1013,
1013,
2797,
1002,
2047,
1035,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package dbfit.environment;
import dbfit.annotations.DatabaseEnvironment;
import dbfit.api.AbstractDbEnvironment;
import dbfit.util.DbParameterAccessor;
import dbfit.util.DbParameterAccessorsMapBuilder;
import dbfit.util.Direction;
import static dbfit.util.Direction.*;
import static dbfit.util.LangUtils.enquoteAndJoin;
import dbfit.util.TypeNormaliserFactory;
import static dbfit.environment.SqlServerTypeNameNormaliser.normaliseTypeName;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
@DatabaseEnvironment(name="SqlServer", driver="com.microsoft.sqlserver.jdbc.SQLServerDriver")
public class SqlServerEnvironment extends AbstractDbEnvironment {
public SqlServerEnvironment(String driverClassName) {
super(driverClassName);
defaultParamPatternString = "@([A-Za-z0-9_]+)";
TypeNormaliserFactory.setNormaliser(java.sql.Time.class,
new MillisecondTimeNormaliser());
}
public boolean supportsOuputOnInsert() {
return false;
}
@Override
protected String getConnectionString(String dataSource) {
return "jdbc:sqlserver://" + dataSource;
}
@Override
protected String getConnectionString(String dataSource, String database) {
return getConnectionString(dataSource) + ";database=" + database;
}
@Override
public void connect(String connectionString, Properties info) throws SQLException {
// Add sendTimeAsDatetime=false option to enforce sending Time as
// java.sql.Time (otherwise some precision is lost in conversions)
super.connect(connectionString + ";sendTimeAsDatetime=false", info);
}
public Map<String, DbParameterAccessor> getAllColumns(String tableOrViewName)
throws SQLException {
String qry = " select c.[name], TYPE_NAME(c.system_type_id) as [Type], c.max_length, "
+ " 0 As is_output, 0 As is_cursor_ref "
+ " from " + objectDatabasePrefix(tableOrViewName) + "sys.columns c "
+ " where c.object_id = OBJECT_ID(?) "
+ " order by column_id";
return readIntoParams(tableOrViewName, qry);
}
private Map<String, DbParameterAccessor> readIntoParams(String objname,
String query) throws SQLException {
DbParameterAccessorsMapBuilder params = new DbParameterAccessorsMapBuilder(dbfitToJdbcTransformerFactory);
objname = objname.replaceAll("[^a-zA-Z0-9_.#$]", "");
String bracketedName = enquoteAndJoin(objname.split("\\."), ".", "[", "]");
try (PreparedStatement dc = currentConnection.prepareStatement(query)) {
dc.setString(1, bracketedName);
ResultSet rs = dc.executeQuery();
while (rs.next()) {
String paramName = defaultIfNull(rs.getString(1), "");
params.add(paramName,
getParameterDirection(rs.getInt(4), paramName),
getSqlType(rs.getString(2)),
getJavaClass(rs.getString(2)));
}
}
return params.toMap();
}
// List interface has sequential search, so using list instead of array to
// map types
private static List<String> stringTypes = Arrays.asList(new String[] {
"VARCHAR", "NVARCHAR", "CHAR", "NCHAR", "TEXT", "NTEXT",
"UNIQUEIDENTIFIER" });
private static List<String> intTypes = Arrays
.asList(new String[] { "INT" });
private static List<String> booleanTypes = Arrays
.asList(new String[] { "BIT" });
private static List<String> floatTypes = Arrays
.asList(new String[] { "REAL" });
private static List<String> doubleTypes = Arrays
.asList(new String[] { "FLOAT" });
private static List<String> longTypes = Arrays
.asList(new String[] { "BIGINT" });
private static List<String> shortTypes = Arrays.asList(new String[] {
"TINYINT", "SMALLINT" });
private static List<String> numericTypes = Arrays.asList("NUMERIC");
private static List<String> decimalTypes = Arrays.asList(new String[] {
"DECIMAL", "MONEY", "SMALLMONEY" });
private static List<String> timestampTypes = Arrays.asList(new String[] {
"SMALLDATETIME", "DATETIME", "DATETIME2" });
private static List<String> dateTypes = Arrays.asList("DATE");
private static List<String> timeTypes = Arrays.asList("TIME");
// private static List<String> refCursorTypes = Arrays.asList(new String[] {
// });
// private static List<String> doubleTypes=Arrays.asList(new
// String[]{"DOUBLE"});
// private static string[] BinaryTypes=new string[] {"BINARY","VARBINARY", "TIMESTAMP"};
// private static string[] GuidTypes = new string[] { "UNIQUEIDENTIFIER" };
// private static string[] VariantTypes = new string[] { "SQL_VARIANT" };
private String objectDatabasePrefix(String dbObjectName) {
String objectDatabasePrefix = "";
String[] objnameParts = dbObjectName.split("\\.");
if (objnameParts.length == 3) {
objectDatabasePrefix = objnameParts[0] + ".";
}
return objectDatabasePrefix;
}
private static Direction getParameterDirection(int isOutput, String name) {
if (name.isEmpty()) {
return RETURN_VALUE;
}
return (isOutput == 1) ? INPUT_OUTPUT : INPUT;
}
private static int getSqlType(String dataType) {
// todo:strip everything from first blank
dataType = normaliseTypeName(dataType);
if (stringTypes.contains(dataType))
return java.sql.Types.VARCHAR;
if (numericTypes.contains(dataType))
return java.sql.Types.NUMERIC;
if (decimalTypes.contains(dataType))
return java.sql.Types.DECIMAL;
if (intTypes.contains(dataType))
return java.sql.Types.INTEGER;
if (timestampTypes.contains(dataType))
return java.sql.Types.TIMESTAMP;
if (dateTypes.contains(dataType))
return java.sql.Types.DATE;
if (timeTypes.contains(dataType))
return java.sql.Types.TIME;
if (booleanTypes.contains(dataType))
return java.sql.Types.BOOLEAN;
if (floatTypes.contains(dataType))
return java.sql.Types.FLOAT;
if (doubleTypes.contains(dataType))
return java.sql.Types.DOUBLE;
if (longTypes.contains(dataType))
return java.sql.Types.BIGINT;
if (shortTypes.contains(dataType))
return java.sql.Types.SMALLINT;
throw new UnsupportedOperationException("Type " + dataType
+ " is not supported");
}
public Class<?> getJavaClass(String dataType) {
dataType = normaliseTypeName(dataType);
if (stringTypes.contains(dataType))
return String.class;
if (numericTypes.contains(dataType))
return BigDecimal.class;
if (decimalTypes.contains(dataType))
return BigDecimal.class;
if (intTypes.contains(dataType))
return Integer.class;
if (timestampTypes.contains(dataType))
return java.sql.Timestamp.class;
if (dateTypes.contains(dataType))
return java.sql.Date.class;
if (timeTypes.contains(dataType))
return java.sql.Time.class;
if (booleanTypes.contains(dataType))
return Boolean.class;
if (floatTypes.contains(dataType))
return Float.class;
if (doubleTypes.contains(dataType))
return Double.class;
if (longTypes.contains(dataType))
return Long.class;
if (shortTypes.contains(dataType))
return Short.class;
throw new UnsupportedOperationException("Type " + dataType
+ " is not supported");
}
public Map<String, DbParameterAccessor> getAllProcedureParameters(
String procName) throws SQLException {
return readIntoParams(
procName,
"select [name], [Type], max_length, is_output, is_cursor_ref from "
+ "("
+ " select "
+ " p.[name], TYPE_NAME(p.system_type_id) as [Type], "
+ " p.max_length, p.is_output, p.is_cursor_ref, "
+ " p.parameter_id, 0 as set_id, p.object_id "
+ " from " + objectDatabasePrefix(procName) + "sys.parameters p "
+ " union all select "
+ " '' as [name], 'int' as [Type], "
+ " 4 as max_length, 1 as is_output, 0 as is_cursor_ref, "
+ " null as parameter_id, 1 as set_id, object_id "
+ " from " + objectDatabasePrefix(procName) + "sys.objects where type in (N'P', N'PC') "
+ ") as u where object_id = OBJECT_ID(?) order by set_id, parameter_id");
}
public String buildInsertCommand(String tableName,
DbParameterAccessor[] accessors) {
StringBuilder sb = new StringBuilder("insert into ");
sb.append(tableName).append("(");
String comma = "";
StringBuilder values = new StringBuilder();
for (DbParameterAccessor accessor : accessors) {
if (accessor.hasDirection(Direction.INPUT)) {
sb.append(comma);
values.append(comma);
//This will allow column names that have spaces or are keywords.
sb.append("[" + accessor.getName() + "]");
values.append("?");
comma = ",";
}
}
sb.append(") values (");
sb.append(values);
sb.append(")");
return sb.toString();
}
}
| dbfit/dbfit | dbfit-java/sqlserver/src/main/java/dbfit/environment/SqlServerEnvironment.java | Java | gpl-2.0 | 10,073 | [
30522,
7427,
16962,
8873,
2102,
1012,
4044,
1025,
12324,
16962,
8873,
2102,
1012,
5754,
17287,
9285,
1012,
7809,
2368,
21663,
2239,
3672,
1025,
12324,
16962,
8873,
2102,
1012,
17928,
1012,
10061,
18939,
2368,
21663,
2239,
3672,
1025,
12324,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<div class="commune_descr limited">
<p>
Beauvoir est
un village
situé dans le département de l'Oise en Picardie. Elle totalisait 269 habitants en 2008.</p>
<p>Si vous pensez venir habiter à Beauvoir, vous pourrez facilement trouver une maison à acheter. </p>
<p>La ville propose quelques équipements, elle dispose, entre autres, de une boucle de randonnée.</p>
<p>À proximité de Beauvoir sont situées les villes de
<a href="{{VLROOT}}/immobilier/bonvillers_60085/">Bonvillers</a> à 2 km, 201 habitants,
<a href="{{VLROOT}}/immobilier/rouvroy-les-merles_60555/">Rouvroy-les-Merles</a> localisée à 5 km, 72 habitants,
<a href="{{VLROOT}}/immobilier/tartigny_60627/">Tartigny</a> à 4 km, 237 habitants,
<a href="{{VLROOT}}/immobilier/vendeuil-caply_60664/">Vendeuil-Caply</a> située à 2 km, 417 habitants,
<a href="{{VLROOT}}/immobilier/troussencourt_60648/">Troussencourt</a> à 5 km, 326 habitants,
<a href="{{VLROOT}}/immobilier/breteuil_60104/">Breteuil</a> à 3 km, 4 267 habitants,
entre autres. De plus, Beauvoir est située à seulement 26 km de <a href="{{VLROOT}}/immobilier/beauvais_60057/">Beauvais</a>.</p>
<p>Le parc d'habitations, à Beauvoir, était réparti en 2011 en zero appartements et 122 maisons soit
un marché relativement équilibré.</p>
</div>
| donaldinou/frontend | src/Viteloge/CoreBundle/Resources/descriptions/60058.html | HTML | mit | 1,343 | [
30522,
1026,
4487,
2615,
2465,
1027,
1000,
5715,
1035,
4078,
26775,
3132,
1000,
1028,
1026,
1052,
1028,
17935,
6767,
4313,
9765,
4895,
2352,
26179,
2063,
18033,
3393,
18280,
13665,
2139,
1048,
1005,
1051,
5562,
4372,
27263,
4232,
2666,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Gulp tasks for wrapping Browserify modules.
*/
const browserify = require("browserify");
const gulp = require("gulp");
const sourcemaps = require("gulp-sourcemaps");
const uglify = require("gulp-uglify");
const path = require("path");
const through2 = require("through2");
const buffer = require("vinyl-buffer");
const source = require("vinyl-source-stream");
const asyncUtil = require("../../util/async-util");
const clientPackages = require("../../util/client-packages");
const display = require("../../util/display");
const uc = require("../../util/unite-config");
gulp.task("build-bundle-app", async () => {
const uniteConfig = await uc.getUniteConfig();
const buildConfiguration = uc.getBuildConfiguration(uniteConfig, false);
if (buildConfiguration.bundle) {
display.info("Running", "Browserify for App");
const bApp = browserify({
debug: buildConfiguration.sourcemaps,
entries: `./${path.join(uniteConfig.dirs.www.dist, "entryPoint.js")}`
});
const vendorPackages = await clientPackages.getBundleVendorPackages(uniteConfig);
let hasStyleLoader = false;
Object.keys(vendorPackages).forEach((key) => {
bApp.exclude(key);
const idx = key.indexOf("systemjs");
if (idx >= 0 && !hasStyleLoader) {
hasStyleLoader = key === "systemjs-plugin-css";
}
});
bApp.transform("envify", {
NODE_ENV: buildConfiguration.minify ? "production" : "development",
global: true
});
bApp.transform("browserify-css", {
autoInject: hasStyleLoader
});
bApp.transform("stringify", {
appliesTo: {
includeExtensions: uniteConfig.viewExtensions.map(ext => `.${ext}`)
}
});
bApp.transform("babelify", {
global: true,
presets: ["@babel/preset-env"]
});
return asyncUtil.stream(bApp.bundle().on("error", (err) => {
display.error(err);
})
.pipe(source("app-bundle.js"))
.pipe(buffer())
.pipe(buildConfiguration.minify ? uglify()
.on("error", (err) => {
display.error(err.toString());
}) : through2.obj())
.pipe(buildConfiguration.sourcemaps ? sourcemaps.init({
loadMaps: true
}) : through2.obj())
.pipe(buildConfiguration.sourcemaps ?
sourcemaps.mapSources((sourcePath) => sourcePath.replace(/dist\//, "./")) : through2.obj())
.pipe(buildConfiguration.sourcemaps ? sourcemaps.write({
includeContent: true
}) : through2.obj())
.pipe(gulp.dest(uniteConfig.dirs.www.dist)));
}
});
// Generated by UniteJS
| unitejs/engine | assets/gulp/dist/tasks/bundler/browserify/build-bundle-app.js | JavaScript | mit | 2,848 | [
30522,
1013,
1008,
1008,
1008,
26546,
8518,
2005,
12252,
16602,
8757,
14184,
1012,
1008,
1013,
9530,
3367,
16602,
8757,
1027,
5478,
1006,
1000,
16602,
8757,
1000,
1007,
1025,
9530,
3367,
26546,
1027,
5478,
1006,
1000,
26546,
1000,
1007,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#money
Node.js module to perform precise common money calculations.
This library is a partial javascript implementation of the [Money Pattern](http://martinfowler.com/eaaCatalog/money.html) as described by Martin Fowler in his book *Patterns of Enterprise Application Architecture*.
## Using the library
```javascript
var money = require('path/to/lib/money.js');
// Show me those monies
var inheritance = money.dollar(1234567.89);
// Subtract taxes
var TAXMAN = 0.69;
var netSum = inheritance.mult(TAXMAN);
console.log(netSum.toNumber());
// 851851.84
// Hand out loot to heirs.
// The oldest will receive 40% of the money, the next one 30% etc.
var heirs = netSum.allocate([4,3,2,1]);
heirs.forEach(function(heir) { console.log(heir.toNumber()); });
// 340740.74
// 255555.56
// 170370.36
// 85185.18
var addBack = heirs[0].add(heirs[1]).add(heirs[2]).add(heirs[3]);
assert.deepEqual(addBack, netSum);
// undefined (wow so money much precise)
```
## Running the tests (*nix only)
1. Clone and install [node-jscoverage](https://github.com/visionmedia/node-jscoverage) in your system
2. Enter the money repository and run `jscoverage lib/ lib-cov/` to instrument the library
3. Install [Mocha](http://mochajs.org/) as a command via npm `sudo npm install -g mocha`
* a. To run the tests execute the following command: `mocha --ui tdd test/test.js`
* b. To view a coverage report use the `html-cov` reporter: `mocha --ui tdd -R html-cov test/test.js > report.html` and open the HTML file with your browser of choice.
| Jautenim/money | README.md | Markdown | mit | 1,530 | [
30522,
1001,
2769,
13045,
1012,
1046,
2015,
11336,
2000,
4685,
10480,
2691,
2769,
16268,
1012,
2023,
3075,
2003,
1037,
7704,
9262,
22483,
7375,
1997,
1996,
1031,
2769,
5418,
1033,
1006,
8299,
1024,
1013,
1013,
3235,
14876,
13668,
2121,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package org.lightadmin.core.view.preparer;
import org.apache.tiles.AttributeContext;
import org.apache.tiles.context.TilesRequestContext;
import org.lightadmin.core.config.domain.DomainTypeAdministrationConfiguration;
public class FormViewPreparer extends ConfigurationAwareViewPreparer {
@Override
protected void execute(final TilesRequestContext tilesContext, final AttributeContext attributeContext, final DomainTypeAdministrationConfiguration configuration) {
super.execute(tilesContext, attributeContext, configuration);
addAttribute(attributeContext, "fields", configuration.getFormViewFragment().getFields());
}
} | pramoth/light-admin | lightadmin-core/src/main/java/org/lightadmin/core/view/preparer/FormViewPreparer.java | Java | apache-2.0 | 652 | [
30522,
7427,
8917,
1012,
2422,
4215,
10020,
1012,
4563,
1012,
3193,
1012,
7374,
2099,
1025,
12324,
8917,
1012,
15895,
1012,
13262,
1012,
17961,
8663,
18209,
1025,
12324,
8917,
1012,
15895,
1012,
13262,
1012,
6123,
1012,
13262,
2890,
15500,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#ifndef COIN_SOSHADOWSTYLEELEMENT_H
#define COIN_SOSHADOWSTYLEELEMENT_H
/**************************************************************************\
*
* This file is part of the Coin 3D visualization library.
* Copyright (C) 1998-2008 by Kongsberg SIM. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* ("GPL") version 2 as published by the Free Software Foundation.
* See the file LICENSE.GPL at the root directory of this source
* distribution for additional information about the GNU GPL.
*
* For using Coin with software that can not be combined with the GNU
* GPL, and for taking advantage of the additional benefits of our
* support services, please contact Kongsberg SIM about acquiring
* a Coin Professional Edition License.
*
* See http://www.coin3d.org/ for more information.
*
* Kongsberg SIM, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
* http://www.sim.no/ sales@sim.no coin-support@coin3d.org
*
\**************************************************************************/
#include <Inventor/elements/SoInt32Element.h>
class COIN_DLL_API SoShadowStyleElement : public SoInt32Element {
typedef SoInt32Element inherited;
SO_ELEMENT_HEADER(SoShadowStyleElement);
public:
static void initClass(void);
protected:
virtual ~SoShadowStyleElement();
public:
enum StyleFlags {
NO_SHADOWING = 0x0,
CASTS_SHADOW = 0x1,
SHADOWED = 0x2,
CASTS_SHADOW_AND_SHADOWED = CASTS_SHADOW|SHADOWED
};
virtual void init(SoState * state);
static void set(SoState * const state, SoNode * const node,
const int styleflags);
static void set(SoState * const state, const int styleflags);
static int get(SoState * const state);
static int getDefault(void);
};
#endif // !COIN_SOSHADOWSTYLEELEMENT_H
| erik132/MolekelCUDA | deps/include/Inventor/annex/FXViz/elements/SoShadowStyleElement.h | C | gpl-2.0 | 1,904 | [
30522,
1001,
2065,
13629,
2546,
9226,
1035,
2061,
7377,
3527,
9333,
27983,
12260,
3672,
1035,
1044,
1001,
9375,
9226,
1035,
2061,
7377,
3527,
9333,
27983,
12260,
3672,
1035,
1044,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* Client-side router settings */
Router.configure({
layoutTemplate:"layout",
notFoundTemplate:"page_not_found",
loadingTemplate:"loading"
});
Router.route("/", {
name:"home",
template:"home"
});
Router.route("/profile", {
name:"profile",
template:"profile"
});
Router.route("/admin", {
name:"admin",
template:"admin"
});
Router.route("/user/:_id", {
name:"user",
template:"user",
data: function(){
return Meteor.users.findOne({_id: this.params._id});
}
});
| RadioRevolt/DABelFish | client/router.js | JavaScript | mit | 494 | [
30522,
1013,
1008,
7396,
1011,
2217,
2799,
2099,
10906,
1008,
1013,
2799,
2099,
1012,
9530,
8873,
27390,
2063,
1006,
1063,
9621,
18532,
15725,
1024,
1000,
9621,
1000,
1010,
2025,
14876,
8630,
18532,
15725,
1024,
1000,
3931,
1035,
2025,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* @BEGIN LICENSE
*
* Psi4: an open-source quantum chemistry software package
*
* Copyright (c) 2007-2017 The Psi4 Developers.
*
* The copyrights for code used from other parties are included in
* the corresponding files.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* @END LICENSE
*/
/*! \file
\ingroup CCHBAR
\brief Enter brief description of file here
*/
#include <cstdio>
#include "psi4/libdpd/dpd.h"
#include "MOInfo.h"
#include "Params.h"
#define EXTERN
#include "globals.h"
namespace psi { namespace cchbar {
/* compute remaining matrix elements for [ H, e^T1 ] which are not needed by
* ccenergy for CC3 but are needed for CC3 EOM and CC3 Lambda and CC3 response.
*
* Wmbej = <mb||ej> + t_j^f <mb||ef> - t_n^b <mn||ej> - t_j^f t_n^b <mn||ef>
*
*/
void HET1_Wmbej(void);
void purge_HET1_Wmbej(void);
void HET1_Wabef(void);
void cc3_HET1(void) {
HET1_Wmbej();
if (params.ref == 1) purge_HET1_Wmbej();
HET1_Wabef();
return;
}
void HET1_Wmbej(void)
{
dpdbuf4 WMBEJ, Wmbej, WMbEj, WmBeJ, WmBEj, WMbeJ;
dpdbuf4 D, C, F, E, X, Y, t2, W, Z;
dpdfile2 tIA, tia;
int i;
if(params.ref == 0) { /** RHF **/
/* <mb||ej> -> Wmbej */
global_dpd_->buf4_init(&C, PSIF_CC_CINTS, 0, 10, 10, 10, 10, 0, "C <ia|jb>");
global_dpd_->buf4_scmcopy(&C, PSIF_CC_TMP0, "WMbeJ", -1);
global_dpd_->buf4_close(&C);
global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 10, 11, 10, 11, 0, "D <ij|ab> (ib,aj)");
global_dpd_->buf4_copy(&D, PSIF_CC_TMP0, "WMbEj");
global_dpd_->buf4_close(&D);
global_dpd_->file2_init(&tIA, PSIF_CC_OEI, 0, 0, 1, "tIA");
/* F -> Wmbej */
global_dpd_->buf4_init(&F, PSIF_CC_FINTS, 0, 10, 5, 10, 5, 0, "F <ia|bc>");
global_dpd_->buf4_init(&WMbEj, PSIF_CC_TMP0, 0, 10, 11, 10, 11, 0, "WMbEj");
global_dpd_->contract424(&F, &tIA, &WMbEj, 3, 1, 0, 1, 1);
global_dpd_->buf4_close(&WMbEj);
global_dpd_->buf4_close(&F);
global_dpd_->buf4_init(&F, PSIF_CC_FINTS, 0, 11, 5, 11, 5, 0, "F <ai|bc>");
global_dpd_->buf4_init(&Z, PSIF_CC_TMP0, 0, 11, 11, 11, 11, 0, "Z(bM,eJ)");
global_dpd_->contract424(&F, &tIA, &Z, 3, 1, 0, -1, 0);
global_dpd_->buf4_sort(&Z, PSIF_CC_TMP0, qpsr, 10, 10, "Z(Mb,Je)");
global_dpd_->buf4_close(&Z);
global_dpd_->buf4_init(&Z, PSIF_CC_TMP0, 0, 10, 10, 10, 10, 0, "Z(Mb,Je)");
global_dpd_->buf4_init(&WMbeJ, PSIF_CC_TMP0, 0, 10, 10, 10, 10, 0, "WMbeJ");
global_dpd_->buf4_axpy(&Z, &WMbeJ, 1.0);
global_dpd_->buf4_close(&WMbeJ);
global_dpd_->buf4_close(&Z);
global_dpd_->buf4_close(&F);
global_dpd_->file2_close(&tIA);
/* E -> Wmbej */
global_dpd_->file2_init(&tIA, PSIF_CC_OEI, 0, 0, 1, "tIA");
global_dpd_->buf4_init(&E, PSIF_CC_EINTS, 0, 11, 0, 11, 0, 0, "E <ai|jk>");
global_dpd_->buf4_init(&WMbEj, PSIF_CC_TMP0, 0, 10, 11, 10, 11, 0, "WMbEj");
global_dpd_->contract424(&E, &tIA, &WMbEj, 3, 0, 1, -1, 1);
global_dpd_->buf4_close(&WMbEj);
global_dpd_->buf4_close(&E);
global_dpd_->buf4_init(&E, PSIF_CC_EINTS, 0, 0, 10, 0, 10, 0, "E <ij|ka>");
global_dpd_->buf4_init(&WMbeJ, PSIF_CC_TMP0, 0, 10, 10, 10, 10, 0, "WMbeJ");
global_dpd_->contract424(&E, &tIA, &WMbeJ, 1, 0, 1, 1, 1);
global_dpd_->buf4_close(&WMbeJ);
global_dpd_->buf4_close(&E);
global_dpd_->file2_close(&tIA);
/* Sort to (ME,JB) */
global_dpd_->buf4_init(&WMbEj, PSIF_CC_TMP0, 0, 10, 11, 10, 11, 0, "WMbEj");
global_dpd_->buf4_sort(&WMbEj, PSIF_CC3_HET1, prsq, 10, 10, "CC3 WMbEj (ME,jb)");
global_dpd_->buf4_close(&WMbEj);
global_dpd_->buf4_init(&WMbeJ, PSIF_CC_TMP0, 0, 10, 10, 10, 10, 0, "WMbeJ");
global_dpd_->buf4_sort(&WMbeJ, PSIF_CC3_HET1, psrq, 10, 10, "CC3 WMbeJ (Me,Jb)");
global_dpd_->buf4_close(&WMbeJ);
/* T1^2 -> Wmbej */
global_dpd_->file2_init(&tIA, PSIF_CC_OEI, 0, 0, 1, "tIA");
global_dpd_->buf4_init(&Y, PSIF_CC_TMP0, 0, 10, 0, 10, 0, 0, "Y (ME,JN)");
global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 10, 11, 10, 11, 0, "D <ij|ab> (ia,bj)");
global_dpd_->contract244(&tIA, &D, &Y, 1, 2, 1, 1, 0);
global_dpd_->buf4_close(&D);
global_dpd_->buf4_init(&W, PSIF_CC3_HET1, 0, 10, 10, 10, 10, 0, "CC3 WMbEj (ME,jb)");
global_dpd_->contract424(&Y, &tIA, &W, 3, 0, 0, -1, 1);
global_dpd_->buf4_close(&W);
global_dpd_->buf4_close(&Y);
global_dpd_->buf4_init(&Y, PSIF_CC_TMP0, 0, 10, 0, 10, 0, 0, "Y (ME,JN)");
global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 10, 11, 10, 11, 0, "D <ij|ab> (ib,aj)");
global_dpd_->contract244(&tIA, &D, &Y, 1, 2, 1, 1, 0);
global_dpd_->buf4_close(&D);
global_dpd_->buf4_init(&W, PSIF_CC3_HET1, 0, 10, 10, 10, 10, 0, "CC3 WMbeJ (Me,Jb)");
global_dpd_->contract424(&Y, &tIA, &W, 3, 0, 0, 1, 1);
global_dpd_->buf4_close(&W);
global_dpd_->buf4_close(&Y);
global_dpd_->file2_close(&tIA);
/* also store WMbEj (Mb,Ej) WMbeJ (bM,eJ)*/
global_dpd_->buf4_init(&WMbEj, PSIF_CC3_HET1, 0, 10, 10, 10, 10, 0, "CC3 WMbEj (ME,jb)");
global_dpd_->buf4_sort(&WMbEj, PSIF_CC3_HET1, psqr, 10, 11, "CC3 WMbEj (Mb,Ej)");
global_dpd_->buf4_close(&WMbEj);
global_dpd_->buf4_init(&WMbEj, PSIF_CC3_HET1, 0, 10, 10, 10, 10, 0, "CC3 WMbeJ (Me,Jb)");
global_dpd_->buf4_sort(&WMbEj, PSIF_CC3_HET1, spqr, 11, 11, "CC3 WMbeJ (bM,eJ)");
global_dpd_->buf4_close(&WMbEj);
}
else if(params.ref == 1) { /** ROHF **/
/* W(mb,je) <-- <mb||ej> */
global_dpd_->buf4_init(&C, PSIF_CC_CINTS, 0, 10, 11, 10, 11, 0, "C <ia||jb> (ia,bj)");
global_dpd_->buf4_scmcopy(&C, PSIF_CC_TMP0, "WMBEJ", -1);
global_dpd_->buf4_scmcopy(&C, PSIF_CC_TMP0, "Wmbej", -1);
global_dpd_->buf4_close(&C);
global_dpd_->buf4_init(&C, PSIF_CC_CINTS, 0, 10, 10, 10, 10, 0, "C <ia|jb>");
global_dpd_->buf4_scmcopy(&C, PSIF_CC_TMP0, "WmBEj", -1);
global_dpd_->buf4_scmcopy(&C, PSIF_CC_TMP0, "WMbeJ", -1);
global_dpd_->buf4_close(&C);
global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 10, 11, 10, 11, 0, "D <ij|ab> (ib,aj)");
global_dpd_->buf4_copy(&D, PSIF_CC_TMP0, "WMbEj");
global_dpd_->buf4_copy(&D, PSIF_CC_TMP0, "WmBeJ");
global_dpd_->buf4_close(&D);
/* F -> Wmbej */
global_dpd_->file2_init(&tIA, PSIF_CC_OEI, 0, 0, 1, "tIA");
global_dpd_->file2_init(&tia, PSIF_CC_OEI, 0, 0, 1, "tia");
global_dpd_->buf4_init(&F, PSIF_CC_FINTS, 0, 10, 5, 10, 5, 1, "F <ia|bc>");
global_dpd_->buf4_init(&WMBEJ, PSIF_CC_TMP0, 0, 10, 11, 10, 11, 0, "WMBEJ");
global_dpd_->contract424(&F, &tIA, &WMBEJ, 3, 1, 0, 1, 1);
global_dpd_->buf4_close(&WMBEJ);
global_dpd_->buf4_init(&Wmbej, PSIF_CC_TMP0, 0, 10, 11, 10, 11, 0, "Wmbej");
global_dpd_->contract424(&F, &tia, &Wmbej, 3, 1, 0, 1, 1);
global_dpd_->buf4_close(&Wmbej);
global_dpd_->buf4_close(&F);
global_dpd_->buf4_init(&F, PSIF_CC_FINTS, 0, 10, 5, 10, 5, 0, "F <ia|bc>");
global_dpd_->buf4_init(&WMbEj, PSIF_CC_TMP0, 0, 10, 11, 10, 11, 0, "WMbEj");
global_dpd_->contract424(&F, &tia, &WMbEj, 3, 1, 0, 1, 1);
global_dpd_->buf4_close(&WMbEj);
global_dpd_->buf4_init(&WmBeJ, PSIF_CC_TMP0, 0, 10, 11, 10, 11, 0, "WmBeJ");
global_dpd_->contract424(&F, &tIA, &WmBeJ, 3, 1, 0, 1, 1);
global_dpd_->buf4_close(&WmBeJ);
global_dpd_->buf4_init(&WMbeJ, PSIF_CC_TMP0, 0, 10, 10, 10, 10, 0, "WMbeJ");
global_dpd_->contract244(&tIA, &F, &WMbeJ, 1, 2, 1, -1, 1);
global_dpd_->buf4_close(&WMbeJ);
global_dpd_->buf4_init(&WmBEj, PSIF_CC_TMP0, 0, 10, 10, 10, 10, 0, "WmBEj");
global_dpd_->contract244(&tia, &F, &WmBEj, 1, 2, 1, -1, 1);
global_dpd_->buf4_close(&WmBEj);
global_dpd_->buf4_close(&F);
global_dpd_->file2_close(&tIA);
global_dpd_->file2_close(&tia);
/* E -> Wmbej */
global_dpd_->file2_init(&tIA, PSIF_CC_OEI, 0, 0, 1, "tIA");
global_dpd_->file2_init(&tia, PSIF_CC_OEI, 0, 0, 1, "tia");
global_dpd_->buf4_init(&E, PSIF_CC_EINTS, 0, 0, 11, 2, 11, 0, "E <ij||ka> (i>j,ak)");
global_dpd_->buf4_init(&WMBEJ, PSIF_CC_TMP0, 0, 10, 11, 10, 11, 0, "WMBEJ");
global_dpd_->contract424(&E, &tIA, &WMBEJ, 1, 0, 1, 1, 1);
global_dpd_->buf4_close(&WMBEJ);
global_dpd_->buf4_init(&Wmbej, PSIF_CC_TMP0, 0, 10, 11, 10, 11, 0, "Wmbej");
global_dpd_->contract424(&E, &tia, &Wmbej, 1, 0, 1, 1, 1);
global_dpd_->buf4_close(&Wmbej);
global_dpd_->buf4_close(&E);
global_dpd_->buf4_init(&E, PSIF_CC_EINTS, 0, 11, 0, 11, 0, 0, "E <ai|jk>");
global_dpd_->buf4_init(&WMbEj, PSIF_CC_TMP0, 0, 10, 11, 10, 11, 0, "WMbEj");
global_dpd_->contract424(&E, &tia, &WMbEj, 3, 0, 1, -1, 1);
global_dpd_->buf4_close(&WMbEj);
global_dpd_->buf4_init(&WmBeJ, PSIF_CC_TMP0, 0, 10, 11, 10, 11, 0, "WmBeJ");
global_dpd_->contract424(&E, &tIA, &WmBeJ, 3, 0, 1, -1, 1);
global_dpd_->buf4_close(&WmBeJ);
global_dpd_->buf4_close(&E);
global_dpd_->buf4_init(&E, PSIF_CC_EINTS, 0, 0, 10, 0, 10, 0, "E <ij|ka>");
global_dpd_->buf4_init(&WMbeJ, PSIF_CC_TMP0, 0, 10, 10, 10, 10, 0, "WMbeJ");
global_dpd_->contract424(&E, &tia, &WMbeJ, 1, 0, 1, 1, 1);
global_dpd_->buf4_close(&WMbeJ);
global_dpd_->buf4_init(&WmBEj, PSIF_CC_TMP0, 0, 10, 10, 10, 10, 0, "WmBEj");
global_dpd_->contract424(&E, &tIA, &WmBEj, 1, 0, 1, 1, 1);
global_dpd_->buf4_close(&WmBEj);
global_dpd_->buf4_close(&E);
global_dpd_->file2_close(&tIA);
global_dpd_->file2_close(&tia);
/* Convert to (ME,JB) for remaining terms */
global_dpd_->buf4_init(&WMBEJ, PSIF_CC_TMP0, 0, 10, 11, 10, 11, 0, "WMBEJ");
global_dpd_->buf4_sort(&WMBEJ, PSIF_CC3_HET1, prsq, 10, 10, "CC3 WMBEJ (ME,JB)");
global_dpd_->buf4_close(&WMBEJ);
global_dpd_->buf4_init(&Wmbej, PSIF_CC_TMP0, 0, 10, 11, 10, 11, 0, "Wmbej");
global_dpd_->buf4_sort(&Wmbej, PSIF_CC3_HET1, prsq, 10, 10, "CC3 Wmbej (me,jb)");
global_dpd_->buf4_close(&Wmbej);
global_dpd_->buf4_init(&WMbEj, PSIF_CC_TMP0, 0, 10, 11, 10, 11, 0, "WMbEj");
global_dpd_->buf4_sort(&WMbEj, PSIF_CC3_HET1, prsq, 10, 10, "CC3 WMbEj (ME,jb)");
global_dpd_->buf4_close(&WMbEj);
global_dpd_->buf4_init(&WmBeJ, PSIF_CC_TMP0, 0, 10, 11, 10, 11, 0, "WmBeJ");
global_dpd_->buf4_sort(&WmBeJ, PSIF_CC3_HET1, prsq, 10, 10, "CC3 WmBeJ (me,JB)");
global_dpd_->buf4_close(&WmBeJ);
global_dpd_->buf4_init(&WMbeJ, PSIF_CC_TMP0, 0, 10, 10, 10, 10, 0, "WMbeJ");
global_dpd_->buf4_sort(&WMbeJ, PSIF_CC3_HET1, psrq, 10, 10, "CC3 WMbeJ (Me,Jb)");
global_dpd_->buf4_close(&WMbeJ);
global_dpd_->buf4_init(&WmBEj, PSIF_CC_TMP0, 0, 10, 10, 10, 10, 0, "WmBEj");
global_dpd_->buf4_sort(&WmBEj, PSIF_CC3_HET1, psrq, 10, 10, "CC3 WmBEj (mE,jB)");
global_dpd_->buf4_close(&WmBEj);
/* X -> Wmbej */
global_dpd_->file2_init(&tIA, PSIF_CC_OEI, 0, 0, 1, "tIA");
global_dpd_->file2_init(&tia, PSIF_CC_OEI, 0, 0, 1, "tia");
/*** AAAA ***/
global_dpd_->buf4_init(&Y, PSIF_CC_TMP0, 0, 10, 0, 10, 0, 0, "Y (ME,JN)");
global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 10, 11, 10, 11, 0, "D <ij||ab> (ia,bj)");
global_dpd_->contract244(&tIA, &D, &Y, 1, 2, 1, 1, 0);
global_dpd_->buf4_close(&D);
global_dpd_->buf4_init(&W, PSIF_CC3_HET1, 0, 10, 10, 10, 10, 0, "CC3 WMBEJ (ME,JB)");
global_dpd_->contract424(&Y, &tIA, &W, 3, 0, 0, -1, 1);
global_dpd_->buf4_sort(&W, PSIF_CC3_HET1, psqr, 10, 11, "CC3 WMBEJ (MB,EJ)");
global_dpd_->buf4_close(&W);
global_dpd_->buf4_close(&Y);
/*** BBBB ***/
global_dpd_->buf4_init(&Y, PSIF_CC_TMP0, 0, 10, 0, 10, 0, 0, "Y (ME,JN)");
global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 10, 11, 10, 11, 0, "D <ij||ab> (ia,bj)");
global_dpd_->contract244(&tia, &D, &Y, 1, 2, 1, 1, 0);
global_dpd_->buf4_close(&D);
global_dpd_->buf4_init(&W, PSIF_CC3_HET1, 0, 10, 10, 10, 10, 0, "CC3 Wmbej (me,jb)");
global_dpd_->contract424(&Y, &tia, &W, 3, 0, 0, -1, 1);
global_dpd_->buf4_sort(&W, PSIF_CC3_HET1, psqr, 10, 11, "CC3 Wmbej (mb,ej)");
global_dpd_->buf4_close(&W);
global_dpd_->buf4_close(&Y);
/*** ABAB ***/
global_dpd_->buf4_init(&Y, PSIF_CC_TMP0, 0, 10, 0, 10, 0, 0, "Y (ME,JN)");
global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 10, 11, 10, 11, 0, "D <ij|ab> (ia,bj)");
global_dpd_->contract244(&tia, &D, &Y, 1, 2, 1, 1, 0);
global_dpd_->buf4_close(&D);
global_dpd_->buf4_init(&W, PSIF_CC3_HET1, 0, 10, 10, 10, 10, 0, "CC3 WMbEj (ME,jb)");
global_dpd_->contract424(&Y, &tia, &W, 3, 0, 0, -1, 1);
global_dpd_->buf4_sort(&W, PSIF_CC3_HET1, psqr, 10, 11, "CC3 WMbEj (Mb,Ej)");
global_dpd_->buf4_close(&W);
global_dpd_->buf4_close(&Y);
/*** BABA ***/
global_dpd_->buf4_init(&Y, PSIF_CC_TMP0, 0, 10, 0, 10, 0, 0, "Y (ME,JN)");
global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 10, 11, 10, 11, 0, "D <ij|ab> (ia,bj)");
global_dpd_->contract244(&tIA, &D, &Y, 1, 2, 1, 1, 0);
global_dpd_->buf4_close(&D);
global_dpd_->buf4_init(&W, PSIF_CC3_HET1, 0, 10, 10, 10, 10, 0, "CC3 WmBeJ (me,JB)");
global_dpd_->contract424(&Y, &tIA, &W, 3, 0, 0, -1, 1);
global_dpd_->buf4_sort(&W, PSIF_CC3_HET1, psqr, 10, 11, "CC3 WmBeJ (mB,eJ)");
global_dpd_->buf4_close(&W);
global_dpd_->buf4_close(&Y);
/*** ABBA ***/
global_dpd_->buf4_init(&Y, PSIF_CC_TMP0, 0, 10, 0, 10, 0, 0, "Y (ME,JN)");
global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 10, 11, 10, 11, 0, "D <ij|ab> (ib,aj)");
global_dpd_->contract244(&tIA, &D, &Y, 1, 2, 1, 1, 0);
global_dpd_->buf4_close(&D);
global_dpd_->buf4_init(&W, PSIF_CC3_HET1, 0, 10, 10, 10, 10, 0, "CC3 WMbeJ (Me,Jb)");
global_dpd_->contract424(&Y, &tia, &W, 3, 0, 0, 1, 1);
global_dpd_->buf4_sort(&W, PSIF_CC3_HET1, psqr, 10, 11, "CC3 WMbeJ (Mb,eJ)");
global_dpd_->buf4_close(&W);
global_dpd_->buf4_close(&Y);
/*** BAAB ***/
global_dpd_->buf4_init(&Y, PSIF_CC_TMP0, 0, 10, 0, 10, 0, 0, "Y (ME,JN)");
global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 10, 11, 10, 11, 0, "D <ij|ab> (ib,aj)");
global_dpd_->contract244(&tia, &D, &Y, 1, 2, 1, 1, 0);
global_dpd_->buf4_close(&D);
global_dpd_->buf4_init(&W, PSIF_CC3_HET1, 0, 10, 10, 10, 10, 0, "CC3 WmBEj (mE,jB)");
global_dpd_->contract424(&Y, &tIA, &W, 3, 0, 0, 1, 1);
global_dpd_->buf4_sort(&W, PSIF_CC3_HET1, psqr, 10, 11, "CC3 WmBEj (mB,Ej)");
global_dpd_->buf4_close(&W);
global_dpd_->buf4_close(&Y);
global_dpd_->file2_close(&tIA);
global_dpd_->file2_close(&tia);
} /** ROHF **/
else if(params.ref == 2) { /** UHF **/
/* W(mb,je) <-- <mb||ej> */
global_dpd_->buf4_init(&C, PSIF_CC_CINTS, 0, 20, 21, 20, 21, 0, "C <IA||JB> (IA,BJ)");
global_dpd_->buf4_scmcopy(&C, PSIF_CC_TMP0, "WMBEJ", -1);
global_dpd_->buf4_close(&C);
global_dpd_->buf4_init(&C, PSIF_CC_CINTS, 0, 30, 31, 30, 31, 0, "C <ia||jb> (ia,bj)");
global_dpd_->buf4_scmcopy(&C, PSIF_CC_TMP0, "Wmbej", -1);
global_dpd_->buf4_close(&C);
global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 24, 26, 24, 26, 0, "D <Ij|Ab> (Ib,Aj)");
global_dpd_->buf4_scmcopy(&D, PSIF_CC_TMP0, "WMbEj", 1);
global_dpd_->buf4_close(&D);
global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 27, 25, 27, 25, 0, "D <iJ|aB> (iB,aJ)");
global_dpd_->buf4_scmcopy(&D, PSIF_CC_TMP0, "WmBeJ", 1);
global_dpd_->buf4_close(&D);
global_dpd_->buf4_init(&C, PSIF_CC_CINTS, 0, 27, 27, 27, 27, 0, "C <iA|jB>");
global_dpd_->buf4_scmcopy(&C, PSIF_CC_TMP0, "WmBEj", -1);
global_dpd_->buf4_close(&C);
global_dpd_->buf4_init(&C, PSIF_CC_CINTS, 0, 24, 24, 24, 24, 0, "C <Ia|Jb>");
global_dpd_->buf4_scmcopy(&C, PSIF_CC_TMP0, "WMbeJ", -1);
global_dpd_->buf4_close(&C);
/* F -> Wmbej */
global_dpd_->file2_init(&tIA, PSIF_CC_OEI, 0, 0, 1, "tIA");
global_dpd_->file2_init(&tia, PSIF_CC_OEI, 0, 2, 3, "tia");
global_dpd_->buf4_init(&W, PSIF_CC_TMP0, 0, 20, 21, 20, 21, 0, "WMBEJ");
global_dpd_->buf4_init(&F, PSIF_CC_FINTS, 0, 20, 5, 20, 5, 1, "F <IA|BC>");
global_dpd_->contract424(&F, &tIA, &W, 3, 1, 0, 1, 1);
global_dpd_->buf4_close(&F);
global_dpd_->buf4_close(&W);
global_dpd_->buf4_init(&W, PSIF_CC_TMP0, 0, 30, 31, 30, 31, 0, "Wmbej");
global_dpd_->buf4_init(&F, PSIF_CC_FINTS, 0, 30, 15, 30, 15, 1, "F <ia|bc>");
global_dpd_->contract424(&F, &tia, &W, 3, 1, 0, 1, 1);
global_dpd_->buf4_close(&F);
global_dpd_->buf4_close(&W);
global_dpd_->buf4_init(&W, PSIF_CC_TMP0, 0, 24, 26, 24, 26, 0, "WMbEj");
global_dpd_->buf4_init(&F, PSIF_CC_FINTS, 0, 24, 28, 24, 28, 0, "F <Ia|Bc>");
global_dpd_->contract424(&F, &tia, &W, 3, 1, 0, 1, 1);
global_dpd_->buf4_close(&F);
global_dpd_->buf4_close(&W);
global_dpd_->buf4_init(&W, PSIF_CC_TMP0, 0, 27, 25, 27, 25, 0, "WmBeJ");
global_dpd_->buf4_init(&F, PSIF_CC_FINTS, 0, 27, 29, 27, 29, 0, "F <iA|bC>");
global_dpd_->contract424(&F, &tIA, &W, 3, 1, 0, 1, 1);
global_dpd_->buf4_close(&F);
global_dpd_->buf4_close(&W);
global_dpd_->buf4_init(&W, PSIF_CC_TMP0, 0, 24, 24, 24, 24, 0, "WMbeJ");
global_dpd_->buf4_init(&F, PSIF_CC_FINTS, 0, 24, 28, 24, 28, 0, "F <Ia|Bc>");
global_dpd_->contract244(&tIA, &F, &W, 1, 2, 1, -1, 1);
global_dpd_->buf4_close(&F);
global_dpd_->buf4_close(&W);
global_dpd_->buf4_init(&W, PSIF_CC_TMP0, 0, 27, 27, 27, 27, 0, "WmBEj");
global_dpd_->buf4_init(&F, PSIF_CC_FINTS, 0, 27, 29, 27, 29, 0, "F <iA|bC>");
global_dpd_->contract244(&tia, &F, &W, 1, 2, 1, -1, 1);
global_dpd_->buf4_close(&F);
global_dpd_->buf4_close(&W);
global_dpd_->file2_close(&tIA);
global_dpd_->file2_close(&tia);
/* E -> Wmbej */
global_dpd_->file2_init(&tIA, PSIF_CC_OEI, 0, 0, 1, "tIA");
global_dpd_->file2_init(&tia, PSIF_CC_OEI, 0, 2, 3, "tia");
global_dpd_->buf4_init(&W, PSIF_CC_TMP0, 0, 20, 21, 20, 21, 0, "WMBEJ");
global_dpd_->buf4_init(&E, PSIF_CC_EINTS, 0, 0, 21, 2, 21, 0, "E <IJ||KA> (I>J,AK)");
global_dpd_->contract424(&E, &tIA, &W, 1, 0, 1, 1, 1);
global_dpd_->buf4_close(&E);
global_dpd_->buf4_close(&W);
global_dpd_->buf4_init(&W, PSIF_CC_TMP0, 0, 30, 31, 30, 31, 0, "Wmbej");
global_dpd_->buf4_init(&E, PSIF_CC_EINTS, 0, 10, 31, 12, 31, 0, "E <ij||ka> (i>j,ak)");
global_dpd_->contract424(&E, &tia, &W, 1, 0, 1, 1, 1);
global_dpd_->buf4_close(&E);
global_dpd_->buf4_close(&W);
global_dpd_->buf4_init(&W, PSIF_CC_TMP0, 0, 24, 26, 24, 26, 0, "WMbEj");
global_dpd_->buf4_init(&E, PSIF_CC_EINTS, 0, 22, 26, 22, 26, 0, "E <Ij|Ak>");
global_dpd_->contract424(&E, &tia, &W, 1, 0, 1, -1, 1);
global_dpd_->buf4_close(&E);
global_dpd_->buf4_close(&W);
global_dpd_->buf4_init(&W, PSIF_CC_TMP0, 0, 27, 25, 27, 25, 0, "WmBeJ");
global_dpd_->buf4_init(&E, PSIF_CC_EINTS, 0, 23, 25, 23, 25, 0, "E <iJ|aK>");
global_dpd_->contract424(&E, &tIA, &W, 1, 0, 1, -1, 1);
global_dpd_->buf4_close(&E);
global_dpd_->buf4_close(&W);
global_dpd_->buf4_init(&W, PSIF_CC_TMP0, 0, 24, 24, 24, 24, 0, "WMbeJ");
global_dpd_->buf4_init(&E, PSIF_CC_EINTS, 0, 22, 24, 22, 24, 0, "E <Ij|Ka>");
global_dpd_->contract424(&E, &tia, &W, 1, 0, 1, 1, 1);
global_dpd_->buf4_close(&E);
global_dpd_->buf4_close(&W);
global_dpd_->buf4_init(&W, PSIF_CC_TMP0, 0, 27, 27, 27, 27, 0, "WmBEj");
global_dpd_->buf4_init(&E, PSIF_CC_EINTS, 0, 23, 27, 23, 27, 0, "E <iJ|kA>");
global_dpd_->contract424(&E, &tIA, &W, 1, 0, 1, 1, 1);
global_dpd_->buf4_close(&E);
global_dpd_->buf4_close(&W);
global_dpd_->file2_close(&tIA);
global_dpd_->file2_close(&tia);
/* Convert to (ME,JB) for remaining terms */
global_dpd_->buf4_init(&W, PSIF_CC_TMP0, 0, 20, 21, 20, 21, 0, "WMBEJ");
global_dpd_->buf4_sort(&W, PSIF_CC3_HET1, prsq, 20, 20, "CC3 WMBEJ (ME,JB)");
global_dpd_->buf4_close(&W);
global_dpd_->buf4_init(&W, PSIF_CC_TMP0, 0, 30, 31, 30, 31, 0, "Wmbej");
global_dpd_->buf4_sort(&W, PSIF_CC3_HET1, prsq, 30, 30, "CC3 Wmbej (me,jb)");
global_dpd_->buf4_close(&W);
global_dpd_->buf4_init(&W, PSIF_CC_TMP0, 0, 24, 26, 24, 26, 0, "WMbEj");
global_dpd_->buf4_sort(&W, PSIF_CC3_HET1, prsq, 20, 30, "CC3 WMbEj (ME,jb)");
global_dpd_->buf4_close(&W);
global_dpd_->buf4_init(&W, PSIF_CC_TMP0, 0, 27, 25, 27, 25, 0, "WmBeJ");
global_dpd_->buf4_sort(&W, PSIF_CC3_HET1, prsq, 30, 20, "CC3 WmBeJ (me,JB)");
global_dpd_->buf4_close(&W);
global_dpd_->buf4_init(&W, PSIF_CC_TMP0, 0, 24, 24, 24, 24, 0, "WMbeJ");
global_dpd_->buf4_sort(&W, PSIF_CC3_HET1, psrq, 24, 24, "CC3 WMbeJ (Me,Jb)");
global_dpd_->buf4_close(&W);
global_dpd_->buf4_init(&W, PSIF_CC_TMP0, 0, 27, 27, 27, 27, 0, "WmBEj");
global_dpd_->buf4_sort(&W, PSIF_CC3_HET1, psrq, 27, 27, "CC3 WmBEj (mE,jB)");
global_dpd_->buf4_close(&W);
/* X -> Wmbej */
global_dpd_->file2_init(&tIA, PSIF_CC_OEI, 0, 0, 1, "tIA");
global_dpd_->file2_init(&tia, PSIF_CC_OEI, 0, 2, 3, "tia");
/*** AAAA ***/
global_dpd_->buf4_init(&Y, PSIF_CC_TMP0, 0, 20, 0, 20, 0, 0, "Y (ME,JN)");
global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 20, 21, 20, 21, 0, "D <IJ||AB> (IA,BJ)");
global_dpd_->contract244(&tIA, &D, &Y, 1, 2, 1, 1, 0);
global_dpd_->buf4_close(&D);
global_dpd_->buf4_init(&W, PSIF_CC3_HET1, 0, 20, 20, 20, 20, 0, "CC3 WMBEJ (ME,JB)");
global_dpd_->contract424(&Y, &tIA, &W, 3, 0, 0, -1, 1);
global_dpd_->buf4_close(&W);
global_dpd_->buf4_close(&Y);
/*** BBBB ***/
global_dpd_->buf4_init(&Y, PSIF_CC_TMP0, 0, 30, 10, 30, 10, 0, "Y (me,jn)");
global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 30, 31, 30, 31, 0, "D <ij||ab> (ia,bj)");
global_dpd_->contract244(&tia, &D, &Y, 1, 2, 1, 1, 0);
global_dpd_->buf4_close(&D);
global_dpd_->buf4_init(&W, PSIF_CC3_HET1, 0, 30, 30, 30, 30, 0, "CC3 Wmbej (me,jb)");
global_dpd_->contract424(&Y, &tia, &W, 3, 0, 0, -1, 1);
global_dpd_->buf4_close(&W);
global_dpd_->buf4_close(&Y);
/*** ABAB ***/
global_dpd_->buf4_init(&Y, PSIF_CC_TMP0, 0, 20, 10, 20, 10, 0, "Y (ME,jn)");
global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 20, 31, 20, 31, 0, "D <Ij|Ab> (IA,bj)");
global_dpd_->contract244(&tia, &D, &Y, 1, 2, 1, 1, 0);
global_dpd_->buf4_close(&D);
global_dpd_->buf4_init(&W, PSIF_CC3_HET1, 0, 20, 30, 20, 30, 0, "CC3 WMbEj (ME,jb)");
global_dpd_->contract424(&Y, &tia, &W, 3, 0, 0, -1, 1);
global_dpd_->buf4_close(&W);
global_dpd_->buf4_close(&Y);
/*** BABA ***/
global_dpd_->buf4_init(&Y, PSIF_CC_TMP0, 0, 30, 0, 30, 0, 0, "Y (me,JN)");
global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 30, 21, 30, 21, 0, "D <Ij|Ab> (ia,BJ)");
global_dpd_->contract244(&tIA, &D, &Y, 1, 2, 1, 1, 0);
global_dpd_->buf4_close(&D);
global_dpd_->buf4_init(&W, PSIF_CC3_HET1, 0, 30, 20, 30, 20, 0, "CC3 WmBeJ (me,JB)");
global_dpd_->contract424(&Y, &tIA, &W, 3, 0, 0, -1, 1);
global_dpd_->buf4_close(&W);
global_dpd_->buf4_close(&Y);
/*** ABBA ***/
global_dpd_->buf4_init(&Y, PSIF_CC_TMP0, 0, 24, 22, 24, 22, 0, "Y (Me,Jn)");
global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 24, 26, 24, 26, 0, "D <Ij|Ab> (Ib,Aj)");
global_dpd_->contract244(&tIA, &D, &Y, 1, 2, 1, 1, 0);
global_dpd_->buf4_close(&D);
global_dpd_->buf4_init(&W, PSIF_CC3_HET1, 0, 24, 24, 24, 24, 0, "CC3 WMbeJ (Me,Jb)");
global_dpd_->contract424(&Y, &tia, &W, 3, 0, 0, 1, 1);
global_dpd_->buf4_close(&W);
global_dpd_->buf4_close(&Y);
/*** BAAB ***/
global_dpd_->buf4_init(&Y, PSIF_CC_TMP0, 0, 27, 23, 27, 23, 0, "Y (mE,jN)");
global_dpd_->buf4_init(&D, PSIF_CC_DINTS, 0, 27, 25, 27, 25, 0, "D <iJ|aB> (iB,aJ)");
global_dpd_->contract244(&tia, &D, &Y, 1, 2, 1, 1, 0);
global_dpd_->buf4_close(&D);
global_dpd_->buf4_init(&W, PSIF_CC3_HET1, 0, 27, 27, 27, 27, 0, "CC3 WmBEj (mE,jB)");
global_dpd_->contract424(&Y, &tIA, &W, 3, 0, 0, 1, 1);
global_dpd_->buf4_close(&W);
global_dpd_->buf4_close(&Y);
global_dpd_->file2_close(&tIA);
global_dpd_->file2_close(&tia);
/* also store lists as Wmbej (mb,ej) */
global_dpd_->buf4_init(&W, PSIF_CC3_HET1, 0, 20, 20, 20, 20, 0, "CC3 WMBEJ (ME,JB)");
global_dpd_->buf4_sort(&W, PSIF_CC3_HET1, psqr, 20, 21, "CC3 WMBEJ (MB,EJ)");
global_dpd_->buf4_close(&W);
global_dpd_->buf4_init(&W, PSIF_CC3_HET1, 0, 30, 30, 30, 30, 0, "CC3 Wmbej (me,jb)");
global_dpd_->buf4_sort(&W, PSIF_CC3_HET1, psqr, 30, 31, "CC3 Wmbej (mb,ej)");
global_dpd_->buf4_close(&W);
global_dpd_->buf4_init(&W, PSIF_CC3_HET1, 0, 20, 30, 20, 30, 0, "CC3 WMbEj (ME,jb)");
global_dpd_->buf4_sort(&W, PSIF_CC3_HET1, psqr, 24, 26, "CC3 WMbEj (Mb,Ej)");
global_dpd_->buf4_close(&W);
global_dpd_->buf4_init(&W, PSIF_CC3_HET1, 0, 30, 20, 30, 20, 0, "CC3 WmBeJ (me,JB)");
global_dpd_->buf4_sort(&W, PSIF_CC3_HET1, psqr, 27, 25, "CC3 WmBeJ (mB,eJ)");
global_dpd_->buf4_close(&W);
global_dpd_->buf4_init(&W, PSIF_CC3_HET1, 0, 24, 24, 24, 24, 0, "CC3 WMbeJ (Me,Jb)");
global_dpd_->buf4_sort(&W, PSIF_CC3_HET1, psqr, 24, 25, "CC3 WMbeJ (Mb,eJ)");
global_dpd_->buf4_close(&W);
global_dpd_->buf4_init(&W, PSIF_CC3_HET1, 0, 27, 27, 27, 27, 0, "CC3 WmBEj (mE,jB)");
global_dpd_->buf4_sort(&W, PSIF_CC3_HET1, psqr, 27, 26, "CC3 WmBEj (mB,Ej)");
global_dpd_->buf4_close(&W);
/* also make some Wmbej (bm,ej) */
global_dpd_->buf4_init(&W, PSIF_CC3_HET1, 0, 24, 25, 24, 25, 0, "CC3 WMbeJ (Mb,eJ)");
global_dpd_->buf4_sort(&W, PSIF_CC3_HET1, qprs, 25, 25, "CC3 WMbeJ (bM,eJ)");
global_dpd_->buf4_close(&W);
global_dpd_->buf4_init(&W, PSIF_CC3_HET1, 0, 27, 26, 27, 26, 0, "CC3 WmBEj (mB,Ej)");
global_dpd_->buf4_sort(&W, PSIF_CC3_HET1, qprs, 26, 26, "CC3 WmBEj (Bm,Ej)");
global_dpd_->buf4_close(&W);
} /** UHF **/
return;
}
/* Purge Wmbej matrix elements for ROHF */
void purge_HET1_Wmbej(void) {
dpdfile4 W;
int *occpi, *virtpi;
int h, a, b, e, f, i, j, m, n;
int A, B, E, F, I, J, M, N;
int mn, ei, ma, ef, me, jb, mb, ij, ab;
int asym, bsym, esym, fsym, isym, jsym, msym, nsym;
int *occ_off, *vir_off;
int *occ_sym, *vir_sym;
int *openpi, nirreps;
nirreps = moinfo.nirreps;
occpi = moinfo.occpi; virtpi = moinfo.virtpi;
occ_off = moinfo.occ_off; vir_off = moinfo.vir_off;
occ_sym = moinfo.occ_sym; vir_sym = moinfo.vir_sym;
openpi = moinfo.openpi;
global_dpd_->file4_init(&W, PSIF_CC3_HET1, 0, 10, 10,"CC3 WMBEJ (ME,JB)");
for(h=0; h < nirreps; h++) {
global_dpd_->file4_mat_irrep_init(&W, h);
global_dpd_->file4_mat_irrep_rd(&W, h);
for(me=0; me < W.params->rowtot[h]; me++) {
e = W.params->roworb[h][me][1];
esym = W.params->qsym[e];
E = e - vir_off[esym];
for(jb=0; jb < W.params->coltot[h]; jb++) {
b = W.params->colorb[h][jb][1];
bsym = W.params->ssym[b];
B = b - vir_off[bsym];
if ((E >= (virtpi[esym] - openpi[esym])) ||
(B >= (virtpi[bsym] - openpi[bsym])) )
W.matrix[h][me][jb] = 0.0;
}
}
global_dpd_->file4_mat_irrep_wrt(&W, h);
global_dpd_->file4_mat_irrep_close(&W, h);
}
global_dpd_->file4_close(&W);
global_dpd_->file4_init(&W, PSIF_CC3_HET1, 0, 10, 10,"CC3 Wmbej (me,jb)");
for(h=0; h < nirreps; h++) {
global_dpd_->file4_mat_irrep_init(&W, h);
global_dpd_->file4_mat_irrep_rd(&W, h);
for(me=0; me < W.params->rowtot[h]; me++) {
m = W.params->roworb[h][me][0];
msym = W.params->psym[m];
M = m - occ_off[msym];
for(jb=0; jb < W.params->coltot[h]; jb++) {
j = W.params->colorb[h][jb][0];
jsym = W.params->rsym[j];
J = j - occ_off[jsym];
if ((M >= (occpi[msym] - openpi[msym])) ||
(J >= (occpi[jsym] - openpi[jsym])) )
W.matrix[h][me][jb] = 0.0;
}
}
global_dpd_->file4_mat_irrep_wrt(&W, h);
global_dpd_->file4_mat_irrep_close(&W, h);
}
global_dpd_->file4_close(&W);
global_dpd_->file4_init(&W, PSIF_CC3_HET1, 0, 10, 10,"CC3 WMbEj (ME,jb)");
for(h=0; h < nirreps; h++) {
global_dpd_->file4_mat_irrep_init(&W, h);
global_dpd_->file4_mat_irrep_rd(&W, h);
for(me=0; me < W.params->rowtot[h]; me++) {
e = W.params->roworb[h][me][1];
esym = W.params->qsym[e];
E = e - vir_off[esym];
for(jb=0; jb < W.params->coltot[h]; jb++) {
j = W.params->colorb[h][jb][0];
jsym = W.params->rsym[j];
J = j - occ_off[jsym];
if ((E >= (virtpi[esym] - openpi[esym])) ||
(J >= (occpi[jsym] - openpi[jsym])) )
W.matrix[h][me][jb] = 0.0;
}
}
global_dpd_->file4_mat_irrep_wrt(&W, h);
global_dpd_->file4_mat_irrep_close(&W, h);
}
global_dpd_->file4_close(&W);
global_dpd_->file4_init(&W, PSIF_CC3_HET1, 0, 10, 10,"CC3 WmBeJ (me,JB)");
for(h=0; h < nirreps; h++) {
global_dpd_->file4_mat_irrep_init(&W, h);
global_dpd_->file4_mat_irrep_rd(&W, h);
for(me=0; me < W.params->rowtot[h]; me++) {
m = W.params->roworb[h][me][0];
msym = W.params->psym[m];
M = m - occ_off[msym];
for(jb=0; jb < W.params->coltot[h]; jb++) {
b = W.params->colorb[h][jb][1];
bsym = W.params->ssym[b];
B = b - vir_off[bsym];
if ((M >= (occpi[msym] - openpi[msym])) ||
(B >= (virtpi[bsym] - openpi[bsym])) )
W.matrix[h][me][jb] = 0.0;
}
}
global_dpd_->file4_mat_irrep_wrt(&W, h);
global_dpd_->file4_mat_irrep_close(&W, h);
}
global_dpd_->file4_close(&W);
global_dpd_->file4_init(&W, PSIF_CC3_HET1, 0, 10, 10,"CC3 WmBEj (mE,jB)");
for(h=0; h < nirreps; h++) {
global_dpd_->file4_mat_irrep_init(&W, h);
global_dpd_->file4_mat_irrep_rd(&W, h);
for(me=0; me < W.params->rowtot[h]; me++) {
m = W.params->roworb[h][me][0];
e = W.params->roworb[h][me][1];
msym = W.params->psym[m];
esym = W.params->qsym[e];
M = m - occ_off[msym];
E = e - vir_off[esym];
for(jb=0; jb < W.params->coltot[h]; jb++) {
j = W.params->colorb[h][jb][0];
b = W.params->colorb[h][jb][1];
jsym = W.params->rsym[j];
bsym = W.params->ssym[b];
J = j - occ_off[jsym];
B = b - vir_off[bsym];
if ((M >= (occpi[msym] - openpi[msym])) ||
(E >= (virtpi[esym] - openpi[esym])) ||
(J >= (occpi[jsym] - openpi[jsym])) ||
(B >= (virtpi[bsym] - openpi[bsym])) )
W.matrix[h][me][jb] = 0.0;
}
}
global_dpd_->file4_mat_irrep_wrt(&W, h);
global_dpd_->file4_mat_irrep_close(&W, h);
}
global_dpd_->file4_close(&W);
return;
}
}} // namespace psi::cchbar
| andysim/psi4 | psi4/src/psi4/cchbar/cc3_HET1.cc | C++ | gpl-2.0 | 30,830 | [
30522,
1013,
1008,
1008,
1030,
4088,
6105,
1008,
1008,
17816,
2549,
1024,
2019,
2330,
1011,
3120,
8559,
6370,
4007,
7427,
1008,
1008,
9385,
1006,
1039,
1007,
2289,
1011,
2418,
1996,
17816,
2549,
9797,
1012,
1008,
1008,
1996,
9385,
2015,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// FriendlyNameAttribute.cs created with MonoDevelop
// User: ben at 1:31 P 19/03/2008
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
//
using System;
namespace EmergeTk.Model
{
public class FriendlyNameAttribute : Attribute
{
string name;
public string Name {
get {
return name;
}
set {
name = value;
}
}
public string[] FieldNames {
get {
return fieldNames;
}
set {
fieldNames = value;
}
}
//field names are used for generating friendly names for vector types, such as enums.
string[] fieldNames;
public FriendlyNameAttribute()
{
}
public FriendlyNameAttribute( string name )
{
this.name = name;
}
}
}
| bennidhamma/EmergeTk | server/Model/FriendlyNameAttribute.cs | C# | mit | 736 | [
30522,
1013,
1013,
5379,
18442,
19321,
3089,
8569,
2618,
1012,
20116,
2580,
2007,
18847,
24844,
18349,
2361,
1013,
1013,
5310,
1024,
3841,
2012,
1015,
1024,
2861,
1052,
2539,
1013,
6021,
1013,
2263,
1013,
1013,
1013,
1013,
2000,
2689,
3115,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
public partial class CMSModules_RecycleBin_Pages_ViewVersion {
/// <summary>
/// viewVersion control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::CMSModules_Content_Controls_ViewVersion viewVersion;
}
| CCChapel/ccchapel.com | CMS/CMSModules/RecycleBin/Pages/ViewVersion.aspx.designer.cs | C# | gpl-3.0 | 723 | [
30522,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Linq;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using DynamicData;
using TailBlazer.Domain.FileHandling.Search;
using TailBlazer.Domain.Settings;
namespace TailBlazer.Views.Searching
{
public class GlobalSearchOptions : IGlobalSearchOptions, IDisposable
{
private readonly IDisposable _cleanUp;
public ISearchMetadataCollection Metadata { get; }
public GlobalSearchOptions(ISearchMetadataCollection metadata,
ISearchStateToMetadataMapper converter,
ISetting<SearchState[]> searchStateSettings)
{
Metadata = metadata;
var loader = searchStateSettings.Value
.Take(1)
.Select(items => items.Select(state => converter.Map(state,true)))
.Subscribe(metadata.Add);
var writer = metadata.Metadata.Connect()
.ToCollection()
.Select(metaData => metaData.ToArray())
.Throttle(TimeSpan.FromMilliseconds(250))
.Select(searchStateItems => searchStateItems.Select(converter.Map).ToArray())
.Subscribe(searchStateSettings.Write);
_cleanUp = new CompositeDisposable(loader, writer);
}
public void Dispose()
{
_cleanUp.Dispose();
}
}
} | RolandPheasant/TailBlazer | Source/TailBlazer/Views/Searching/GlobalSearchOptions.cs | C# | gpl-3.0 | 1,361 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
22643,
1012,
4487,
13102,
8820,
13510,
1025,
2478,
2291,
1012,
22643,
1012,
11409,
4160,
1025,
2478,
8790,
2850,
2696,
1025,
2478,
5725,
28522,
6290,
1012,
5884... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import React, { Component } from 'react';
import { View, TextInput, Text } from 'react-native';
const Input = ({ label, securetxt, maxlen, keytype, value, onChangeText, placeHolder }) => {
return (
<View style={styles.containerStyle}>
<Text style={styles.labelStyle}>{label}</Text>
<TextInput
secureTextEntry={securetxt}
keyboardType={keytype}
maxLength={maxlen}
autoCorrect={false}
placeholder={placeHolder}
placeholderTextColor={'#e0e2e1'}
multiline={false}
value={value}
onChangeText={onChangeText}
style={styles.inputStyle}
/>
</View>
);
};
const styles = {
inputStyle: {
color: '#000',
paddingRight: 10,
paddingLeft: 5,
fontSize: 18,
lineHeight: 23,
flex: 2,
width: 150
},
labelStyle: {
paddingLeft: 5,
fontSize: 18,
flex: 2
},
containerStyle: {
height: 40,
flex: 1,
flexDirection: 'row',
alignItems: 'center'
}
};
export { Input } | Moshikol/DaiabetesJournal | app/Components/common/Input.js | JavaScript | mit | 1,197 | [
30522,
12324,
10509,
1010,
1063,
6922,
1065,
2013,
1005,
10509,
1005,
1025,
12324,
1063,
3193,
1010,
3793,
2378,
18780,
1010,
3793,
1065,
2013,
1005,
10509,
1011,
3128,
1005,
1025,
9530,
3367,
7953,
1027,
1006,
1063,
3830,
1010,
5851,
2102,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import React from 'react';
import { assert } from 'chai';
import { createShallow, getClasses } from '../test-utils';
import CardContent from './CardContent';
describe('<CardContent />', () => {
let shallow;
let classes;
before(() => {
shallow = createShallow({ untilSelector: 'CardContent' });
classes = getClasses(<CardContent />);
});
it('should render a div with the root class', () => {
const wrapper = shallow(<CardContent />);
assert.strictEqual(wrapper.name(), 'div');
assert.strictEqual(wrapper.hasClass(classes.root), true);
});
});
| cherniavskii/material-ui | packages/material-ui/src/Card/CardContent.test.js | JavaScript | mit | 577 | [
30522,
12324,
10509,
2013,
1005,
10509,
1005,
1025,
12324,
1063,
20865,
1065,
2013,
1005,
15775,
2072,
1005,
1025,
12324,
1063,
9005,
9892,
5004,
1010,
2131,
26266,
2229,
1065,
2013,
1005,
1012,
1012,
1013,
3231,
1011,
21183,
12146,
1005,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_151) on Thu Mar 08 14:17:41 MST 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>org.wildfly.swarm.microprofile.health.detect (BOM: * : All 2018.3.3 API)</title>
<meta name="date" content="2018-03-08">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../script.js"></script>
</head>
<body>
<h1 class="bar"><a href="../../../../../../org/wildfly/swarm/microprofile/health/detect/package-summary.html" target="classFrame">org.wildfly.swarm.microprofile.health.detect</a></h1>
<div class="indexContainer">
<h2 title="Classes">Classes</h2>
<ul title="Classes">
<li><a href="HealthPackageDetector.html" title="class in org.wildfly.swarm.microprofile.health.detect" target="classFrame">HealthPackageDetector</a></li>
</ul>
</div>
</body>
</html>
| wildfly-swarm/wildfly-swarm-javadocs | 2018.3.3/apidocs/org/wildfly/swarm/microprofile/health/detect/package-frame.html | HTML | apache-2.0 | 1,049 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* layer2.c: Mpeg Layer-2 audio decoder
*
* Copyright (C) 1999-2010 The L.A.M.E. project
*
* Initially written by Michael Hipp, see also AUTHORS and README.
*
* 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 2 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; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* $Id: layer2.c,v 1.23.2.2 2010/03/22 14:17:14 robert Exp $ */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "common.h"
#include "layer2.h"
#include "l2tables.h"
#include "decode_i386.h"
#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif
static int grp_3tab[32 * 3] = { 0, }; /* used: 27 */
static int grp_5tab[128 * 3] = { 0, }; /* used: 125 */
static int grp_9tab[1024 * 3] = { 0, }; /* used: 729 */
void
init_layer2(void)
{
static const double mulmul[27] = {
0.0, -2.0 / 3.0, 2.0 / 3.0,
2.0 / 7.0, 2.0 / 15.0, 2.0 / 31.0, 2.0 / 63.0, 2.0 / 127.0, 2.0 / 255.0,
2.0 / 511.0, 2.0 / 1023.0, 2.0 / 2047.0, 2.0 / 4095.0, 2.0 / 8191.0,
2.0 / 16383.0, 2.0 / 32767.0, 2.0 / 65535.0,
-4.0 / 5.0, -2.0 / 5.0, 2.0 / 5.0, 4.0 / 5.0,
-8.0 / 9.0, -4.0 / 9.0, -2.0 / 9.0, 2.0 / 9.0, 4.0 / 9.0, 8.0 / 9.0
};
static const int base[3][9] = {
{1, 0, 2,},
{17, 18, 0, 19, 20,},
{21, 1, 22, 23, 0, 24, 25, 2, 26}
};
int i, j, k, l, len;
real *table;
static const int tablen[3] = { 3, 5, 9 };
static int *itable, *tables[3] = { grp_3tab, grp_5tab, grp_9tab };
for (i = 0; i < 3; i++) {
itable = tables[i];
len = tablen[i];
for (j = 0; j < len; j++)
for (k = 0; k < len; k++)
for (l = 0; l < len; l++) {
*itable++ = base[i][l];
*itable++ = base[i][k];
*itable++ = base[i][j];
}
}
for (k = 0; k < 27; k++) {
double m = mulmul[k];
table = muls[k];
for (j = 3, i = 0; i < 63; i++, j--)
*table++ = (real) (m * pow(2.0, (double) j / 3.0));
*table++ = 0.0;
}
}
static void
II_step_one(PMPSTR mp, unsigned int *bit_alloc, int *scale, struct frame *fr)
{
int stereo = fr->stereo - 1;
int sblimit = fr->II_sblimit;
int jsbound = fr->jsbound;
int sblimit2 = fr->II_sblimit << stereo;
struct al_table2 const *alloc1 = fr->alloc;
int i;
static unsigned int scfsi_buf[64];
unsigned int *scfsi, *bita;
int sc, step;
bita = bit_alloc;
if (stereo) {
for (i = jsbound; i; i--, alloc1 += (1 << step)) {
*bita++ = (char) getbits(mp, step = alloc1->bits);
*bita++ = (char) getbits(mp, step);
}
for (i = sblimit - jsbound; i; i--, alloc1 += (1 << step)) {
bita[0] = (char) getbits(mp, step = alloc1->bits);
bita[1] = bita[0];
bita += 2;
}
bita = bit_alloc;
scfsi = scfsi_buf;
for (i = sblimit2; i; i--)
if (*bita++)
*scfsi++ = (char) getbits_fast(mp, 2);
}
else { /* mono */
for (i = sblimit; i; i--, alloc1 += (1 << step))
*bita++ = (char) getbits(mp, step = alloc1->bits);
bita = bit_alloc;
scfsi = scfsi_buf;
for (i = sblimit; i; i--)
if (*bita++)
*scfsi++ = (char) getbits_fast(mp, 2);
}
bita = bit_alloc;
scfsi = scfsi_buf;
for (i = sblimit2; i; i--)
if (*bita++)
switch (*scfsi++) {
case 0:
*scale++ = getbits_fast(mp, 6);
*scale++ = getbits_fast(mp, 6);
*scale++ = getbits_fast(mp, 6);
break;
case 1:
*scale++ = sc = getbits_fast(mp, 6);
*scale++ = sc;
*scale++ = getbits_fast(mp, 6);
break;
case 2:
*scale++ = sc = getbits_fast(mp, 6);
*scale++ = sc;
*scale++ = sc;
break;
default: /* case 3 */
*scale++ = getbits_fast(mp, 6);
*scale++ = sc = getbits_fast(mp, 6);
*scale++ = sc;
break;
}
}
static void
II_step_two(PMPSTR mp, unsigned int *bit_alloc, real fraction[2][4][SBLIMIT], int *scale,
struct frame *fr, int x1)
{
int i, j, k, ba;
int stereo = fr->stereo;
int sblimit = fr->II_sblimit;
int jsbound = fr->jsbound;
struct al_table2 const *alloc2, *alloc1 = fr->alloc;
unsigned int *bita = bit_alloc;
int d1, step;
for (i = 0; i < jsbound; i++, alloc1 += (1 << step)) {
step = alloc1->bits;
for (j = 0; j < stereo; j++) {
ba = *bita++;
if (ba) {
k = (alloc2 = alloc1 + ba)->bits;
if ((d1 = alloc2->d) < 0) {
real cm = muls[k][scale[x1]];
fraction[j][0][i] = ((real) ((int) getbits(mp, k) + d1)) * cm;
fraction[j][1][i] = ((real) ((int) getbits(mp, k) + d1)) * cm;
fraction[j][2][i] = ((real) ((int) getbits(mp, k) + d1)) * cm;
}
else {
static int *table[] = { 0, 0, 0, grp_3tab, 0, grp_5tab, 0, 0, 0, grp_9tab };
unsigned int idx, *tab, m = scale[x1];
idx = (unsigned int) getbits(mp, k);
tab = (unsigned int *) (table[d1] + idx + idx + idx);
fraction[j][0][i] = muls[*tab++][m];
fraction[j][1][i] = muls[*tab++][m];
fraction[j][2][i] = muls[*tab][m];
}
scale += 3;
}
else
fraction[j][0][i] = fraction[j][1][i] = fraction[j][2][i] = 0.0;
}
}
for (i = jsbound; i < sblimit; i++, alloc1 += (1 << step)) {
step = alloc1->bits;
bita++; /* channel 1 and channel 2 bitalloc are the same */
ba = *bita++;
if (ba) {
k = (alloc2 = alloc1 + ba)->bits;
if ((d1 = alloc2->d) < 0) {
real cm;
cm = muls[k][scale[x1 + 3]];
fraction[1][0][i] = (fraction[0][0][i] = (real) ((int) getbits(mp, k) + d1)) * cm;
fraction[1][1][i] = (fraction[0][1][i] = (real) ((int) getbits(mp, k) + d1)) * cm;
fraction[1][2][i] = (fraction[0][2][i] = (real) ((int) getbits(mp, k) + d1)) * cm;
cm = muls[k][scale[x1]];
fraction[0][0][i] *= cm;
fraction[0][1][i] *= cm;
fraction[0][2][i] *= cm;
}
else {
static int *table[] = { 0, 0, 0, grp_3tab, 0, grp_5tab, 0, 0, 0, grp_9tab };
unsigned int idx, *tab, m1, m2;
m1 = scale[x1];
m2 = scale[x1 + 3];
idx = (unsigned int) getbits(mp, k);
tab = (unsigned int *) (table[d1] + idx + idx + idx);
fraction[0][0][i] = muls[*tab][m1];
fraction[1][0][i] = muls[*tab++][m2];
fraction[0][1][i] = muls[*tab][m1];
fraction[1][1][i] = muls[*tab++][m2];
fraction[0][2][i] = muls[*tab][m1];
fraction[1][2][i] = muls[*tab][m2];
}
scale += 6;
}
else {
fraction[0][0][i] = fraction[0][1][i] = fraction[0][2][i] =
fraction[1][0][i] = fraction[1][1][i] = fraction[1][2][i] = 0.0;
}
/*
should we use individual scalefac for channel 2 or
is the current way the right one , where we just copy channel 1 to
channel 2 ??
The current 'strange' thing is, that we throw away the scalefac
values for the second channel ...!!
-> changed .. now we use the scalefac values of channel one !!
*/
}
/* if(sblimit > (fr->down_sample_sblimit) ) */
/* sblimit = fr->down_sample_sblimit; */
for (i = sblimit; i < SBLIMIT; i++)
for (j = 0; j < stereo; j++)
fraction[j][0][i] = fraction[j][1][i] = fraction[j][2][i] = 0.0;
}
static void
II_select_table(struct frame *fr)
{
/* *INDENT-OFF* */
static const int translate[3][2][16] =
{ { { 0,2,2,2,2,2,2,0,0,0,1,1,1,1,1,0 } ,
{ 0,2,2,0,0,0,1,1,1,1,1,1,1,1,1,0 } } ,
{ { 0,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0 } ,
{ 0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0 } } ,
{ { 0,3,3,3,3,3,3,0,0,0,1,1,1,1,1,0 } ,
{ 0,3,3,0,0,0,1,1,1,1,1,1,1,1,1,0 } } };
/* *INDENT-ON* */
int table, sblim;
static const struct al_table2 *tables[5] = { alloc_0, alloc_1, alloc_2, alloc_3, alloc_4 };
static const int sblims[5] = { 27, 30, 8, 12, 30 };
if (fr->lsf)
table = 4;
else
table = translate[fr->sampling_frequency][2 - fr->stereo][fr->bitrate_index];
sblim = sblims[table];
fr->alloc = (struct al_table2 const *) tables[table];
fr->II_sblimit = sblim;
}
int
do_layer2(PMPSTR mp, unsigned char *pcm_sample, int *pcm_point)
/*int do_layer2(struct frame *fr,int outmode,struct audio_info_struct *ai) */
{
int clip = 0;
int i, j;
real fraction[2][4][SBLIMIT]; /* pick_table clears unused subbands */
unsigned int bit_alloc[64];
int scale[192];
struct frame *fr = &(mp->fr);
int stereo = fr->stereo;
int single = fr->single;
II_select_table(fr);
fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext << 2) + 4 : fr->II_sblimit;
if (stereo == 1 || single == 3)
single = 0;
II_step_one(mp, bit_alloc, scale, fr);
for (i = 0; i < SCALE_BLOCK; i++) {
II_step_two(mp, bit_alloc, fraction, scale, fr, i >> 2);
for (j = 0; j < 3; j++) {
if (single >= 0) {
clip += synth_1to1_mono(mp, fraction[single][j], pcm_sample, pcm_point);
}
else {
int p1 = *pcm_point;
clip += synth_1to1(mp, fraction[0][j], 0, pcm_sample, &p1);
clip += synth_1to1(mp, fraction[1][j], 1, pcm_sample, pcm_point);
}
}
}
return clip;
}
| inn1983/teropi | lib/liblame/mpglib/layer2.c | C | gpl-2.0 | 10,825 | [
30522,
1013,
1008,
1008,
6741,
2475,
1012,
1039,
1024,
6131,
13910,
6741,
1011,
1016,
5746,
21933,
4063,
1008,
1008,
9385,
1006,
1039,
1007,
2639,
1011,
2230,
1996,
1048,
1012,
1037,
1012,
1049,
1012,
1041,
1012,
2622,
30524,
27004,
3075,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Hl7.Fhir.Publication
{
public interface ISelector
{
string Mask { get; set; }
IEnumerable<Document> Documents { get; }
}
}
| furore-fhir/Fhir.Publication | Fhir.Publication/Framework/ISelector.cs | C# | bsd-3-clause | 287 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
3793,
1025,
2478,
2291,
1012,
11689,
2075,
1012,
8518,
1025,
3415,
15327,
1044,
2140,
2581,
1012,
1042,
11961,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
Copyright(c) 2014 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#include <UnitTest++/UnitTest++.h>
#include <iterator>
#include <string>
#include <vector>
#include <stdint.h>
#include "../hash.h"
namespace
{
SUITE(test_hash)
{
//*************************************************************************
TEST(test_hash_bool)
{
size_t hash = etl::hash<bool>()(false);
CHECK_EQUAL(0, hash);
hash = etl::hash<bool>()(true);
CHECK_EQUAL(1, hash);
}
//*************************************************************************
TEST(test_hash_char)
{
size_t hash = etl::hash<char>()((char)(0x5A));
CHECK_EQUAL(0x5A, hash);
}
//*************************************************************************
TEST(test_hash_signed_char)
{
size_t hash = etl::hash<signed char>()((signed char)(0x5A));
CHECK_EQUAL(0x5A, hash);
}
//*************************************************************************
TEST(test_hash_unsigned_char)
{
size_t hash = etl::hash<unsigned char>()((unsigned char)(0x5A));
CHECK_EQUAL(0x5A, hash);
}
//*************************************************************************
TEST(test_hash_short)
{
size_t hash = etl::hash<short>()((short)(0x5AA5));
CHECK_EQUAL(0x5AA5, hash);
}
//*************************************************************************
TEST(test_hash_unsigned_short)
{
size_t hash = etl::hash<unsigned short>()((unsigned short)(0x5AA5));
CHECK_EQUAL(0x5AA5, hash);
}
//*************************************************************************
TEST(test_hash_int)
{
size_t hash = etl::hash<int>()((int)(0x5AA555AA));
CHECK_EQUAL(0x5AA555AA, hash);
}
//*************************************************************************
TEST(test_hash_unsigned_int)
{
size_t hash = etl::hash<unsigned int>()((unsigned int)(0x5AA555AA));
CHECK_EQUAL(0x5AA555AA, hash);
}
//*************************************************************************
TEST(test_hash_long)
{
size_t hash = etl::hash<long>()((long)(0x5AA555AA));
CHECK_EQUAL(0x5AA555AA, hash);
}
//*************************************************************************
TEST(test_hash_unsigned_long)
{
size_t hash = etl::hash<unsigned long>()((unsigned long)(0x5AA555AA));
CHECK_EQUAL(0x5AA555AA, hash);
}
//*************************************************************************
TEST(test_hash_long_long)
{
size_t hash = etl::hash<long long>()((long long)(0x5AA555AA3CC333CC));
CHECK_EQUAL(0xEC6A8D69, hash);
}
//*************************************************************************
TEST(test_hash_unsigned_long_long)
{
size_t hash = etl::hash<unsigned long long>()((unsigned long long)(0x5AA555AA3CC333CC));
CHECK_EQUAL(0xEC6A8D69, hash);
}
//*************************************************************************
TEST(test_hash_float)
{
size_t hash = etl::hash<float>()((float)(1.2345));
CHECK_EQUAL(0x3F9E0419, hash);
}
//*************************************************************************
TEST(test_hash_double)
{
size_t hash = etl::hash<double>()((double)(1.2345));
CHECK_EQUAL(0x86FBF224, hash);
}
//*************************************************************************
TEST(test_hash_pointer)
{
int i;
size_t hash = etl::hash<int*>()(&i);
CHECK_EQUAL(size_t(&i), hash);
}
};
}
| 17twenty/etl | test/test_hash.cpp | C++ | mit | 4,863 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package C4::Members::AttributeTypes;
# Copyright (C) 2008 LibLime
#
# This file is part of Koha.
#
# Koha 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.
#
# Koha 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 Koha; if not, see <http://www.gnu.org/licenses>.
use strict;
#use warnings; FIXME - Bug 2505
use C4::Context;
=head1 NAME
C4::Members::AttributeTypes - mananage extended patron attribute types
=head1 SYNOPSIS
my @attribute_types = C4::Members::AttributeTypes::GetAttributeTypes();
my $attr_type = C4::Members::AttributeTypes->new($code, $description);
$attr_type->code($code);
$attr_type->description($description);
$attr_type->repeatable($repeatable);
$attr_type->unique_id($unique_id);
$attr_type->opac_display($opac_display);
$attr_type->opac_editable($opac_editable);
$attr_type->staff_searchable($staff_searchable);
$attr_type->authorised_value_category($authorised_value_category);
$attr_type->store();
$attr_type->delete();
my $attr_type = C4::Members::AttributeTypes->fetch($code);
$attr_type = C4::Members::AttributeTypes->delete($code);
=head1 FUNCTIONS
=head2 GetAttributeTypes
my @attribute_types = C4::Members::AttributeTypes::GetAttributeTypes($all_fields);
Returns an array of hashrefs of each attribute type defined
in the database. The array is sorted by code. Each hashref contains
at least the following fields:
- code
- description
If $all_fields is true, then each hashref also contains the other fields from borrower_attribute_types.
=cut
sub GetAttributeTypes {
my $all = @_ ? shift : 0;
my $no_branch_limit = @_ ? shift : 0;
my $branch_limit = $no_branch_limit
? 0
: C4::Context->userenv ? C4::Context->userenv->{"branch"} : 0;
my $select = $all ? '*' : 'DISTINCT(code), description, class';
my $dbh = C4::Context->dbh;
my $query = "SELECT $select FROM borrower_attribute_types";
$query .= qq{
LEFT JOIN borrower_attribute_types_branches ON bat_code = code
WHERE b_branchcode = ? OR b_branchcode IS NULL
} if $branch_limit;
$query .= " ORDER BY code";
my $sth = $dbh->prepare($query);
$sth->execute( $branch_limit ? $branch_limit : () );
my $results = $sth->fetchall_arrayref({});
$sth->finish;
return @$results;
}
sub GetAttributeTypes_hashref {
my %hash = map {$_->{code} => $_} GetAttributeTypes(@_);
return \%hash;
}
=head1 METHODS
my $attr_type = C4::Members::AttributeTypes->new($code, $description);
Create a new attribute type.
=cut
sub new {
my $class = shift;
my $self = {};
$self->{'code'} = shift;
$self->{'description'} = shift;
$self->{'repeatable'} = 0;
$self->{'unique_id'} = 0;
$self->{'opac_display'} = 0;
$self->{'opac_editable'} = 0;
$self->{'staff_searchable'} = 0;
$self->{'display_checkout'} = 0;
$self->{'authorised_value_category'} = '';
$self->{'category_code'} = '';
$self->{'category_description'} = '';
$self->{'class'} = '';
bless $self, $class;
return $self;
}
=head2 fetch
my $attr_type = C4::Members::AttributeTypes->fetch($code);
Fetches an attribute type from the database. If no
type with the given C<$code> exists, returns undef.
=cut
sub fetch {
my $class = shift;
my $code = shift;
my $self = {};
my $dbh = C4::Context->dbh();
my $sth = $dbh->prepare_cached("
SELECT borrower_attribute_types.*, categories.description AS category_description
FROM borrower_attribute_types
LEFT JOIN categories ON borrower_attribute_types.category_code=categories.categorycode
WHERE code =?");
$sth->execute($code);
my $row = $sth->fetchrow_hashref;
$sth->finish();
return unless defined $row;
$self->{'code'} = $row->{'code'};
$self->{'description'} = $row->{'description'};
$self->{'repeatable'} = $row->{'repeatable'};
$self->{'unique_id'} = $row->{'unique_id'};
$self->{'opac_display'} = $row->{'opac_display'};
$self->{'opac_editable'} = $row->{'opac_editable'};
$self->{'staff_searchable'} = $row->{'staff_searchable'};
$self->{'display_checkout'} = $row->{'display_checkout'};
$self->{'authorised_value_category'} = $row->{'authorised_value_category'};
$self->{'category_code'} = $row->{'category_code'};
$self->{'category_description'} = $row->{'category_description'};
$self->{'class'} = $row->{'class'};
$sth = $dbh->prepare("SELECT branchcode, branchname FROM borrower_attribute_types_branches, branches WHERE b_branchcode = branchcode AND bat_code = ?;");
$sth->execute( $code );
while ( my $data = $sth->fetchrow_hashref ) {
push @{ $self->{branches} }, $data;
}
$sth->finish();
bless $self, $class;
return $self;
}
=head2 store
$attr_type->store();
Stores attribute type in the database. If the type
previously retrieved from the database via the fetch()
method, the DB representation of the type is replaced.
=cut
sub store {
my $self = shift;
my $dbh = C4::Context->dbh;
my $sth;
my $existing = __PACKAGE__->fetch($self->{'code'});
if (defined $existing) {
$sth = $dbh->prepare_cached("UPDATE borrower_attribute_types
SET description = ?,
repeatable = ?,
unique_id = ?,
opac_display = ?,
opac_editable = ?,
staff_searchable = ?,
authorised_value_category = ?,
display_checkout = ?,
category_code = ?,
class = ?
WHERE code = ?");
} else {
$sth = $dbh->prepare_cached("INSERT INTO borrower_attribute_types
( description,
repeatable,
unique_id,
opac_display,
opac_editable,
staff_searchable,
authorised_value_category,
display_checkout,
category_code,
class,
code
)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
}
$sth->execute(
$self->{'description'},
$self->{'repeatable'},
$self->{'unique_id'},
$self->{'opac_display'},
$self->{'opac_editable'},
$self->{'staff_searchable'} || 0,
$self->{'authorised_value_category'},
$self->{'display_checkout'},
$self->{'category_code'} || undef,
$self->{'class'},
$self->{'code'}
);
if ( defined $$self{branches} ) {
$sth = $dbh->prepare("DELETE FROM borrower_attribute_types_branches WHERE bat_code = ?");
$sth->execute( $$self{code} );
$sth = $dbh->prepare(
"INSERT INTO borrower_attribute_types_branches
( bat_code, b_branchcode )
VALUES ( ?, ? )"
);
for my $branchcode ( @{$$self{branches}} ) {
next if not $branchcode;
$sth->bind_param( 1, $$self{code} );
$sth->bind_param( 2, $branchcode );
$sth->execute;
}
}
$sth->finish;
}
=head2 code
my $code = $attr_type->code();
$attr_type->code($code);
Accessor. Note that the code is immutable once
a type is created or fetched from the database.
=cut
sub code {
my $self = shift;
return $self->{'code'};
}
=head2 description
my $description = $attr_type->description();
$attr_type->description($description);
Accessor.
=cut
sub description {
my $self = shift;
@_ ? $self->{'description'} = shift : $self->{'description'};
}
=head2 branches
my $branches = $attr_type->branches();
$attr_type->branches($branches);
Accessor.
=cut
sub branches {
my $self = shift;
@_ ? $self->{branches} = shift : $self->{branches};
}
=head2 repeatable
my $repeatable = $attr_type->repeatable();
$attr_type->repeatable($repeatable);
Accessor. The C<$repeatable> argument
is interpreted as a Perl boolean.
=cut
sub repeatable {
my $self = shift;
@_ ? $self->{'repeatable'} = ((shift) ? 1 : 0) : $self->{'repeatable'};
}
=head2 unique_id
my $unique_id = $attr_type->unique_id();
$attr_type->unique_id($unique_id);
Accessor. The C<$unique_id> argument
is interpreted as a Perl boolean.
=cut
sub unique_id {
my $self = shift;
@_ ? $self->{'unique_id'} = ((shift) ? 1 : 0) : $self->{'unique_id'};
}
=head2 opac_display
my $opac_display = $attr_type->opac_display();
$attr_type->opac_display($opac_display);
Accessor. The C<$opac_display> argument
is interpreted as a Perl boolean.
=cut
sub opac_display {
my $self = shift;
@_ ? $self->{'opac_display'} = ((shift) ? 1 : 0) : $self->{'opac_display'};
}
=head2 opac_editable
my $opac_editable = $attr_type->opac_editable();
$attr_type->opac_editable($opac_editable);
Accessor. The C<$opac_editable> argument
is interpreted as a Perl boolean.
=cut
sub opac_editable {
my $self = shift;
@_ ? $self->{'opac_editable'} = ((shift) ? 1 : 0) : $self->{'opac_editable'};
}
=head2 staff_searchable
my $staff_searchable = $attr_type->staff_searchable();
$attr_type->staff_searchable($staff_searchable);
Accessor. The C<$staff_searchable> argument
is interpreted as a Perl boolean.
=cut
sub staff_searchable {
my $self = shift;
@_ ? $self->{'staff_searchable'} = ((shift) ? 1 : 0) : $self->{'staff_searchable'};
}
=head2 display_checkout
my $display_checkout = $attr_type->display_checkout();
$attr_type->display_checkout($display_checkout);
Accessor. The C<$display_checkout> argument
is interpreted as a Perl boolean.
=cut
sub display_checkout {
my $self = shift;
@_ ? $self->{'display_checkout'} = ((shift) ? 1 : 0) : $self->{'display_checkout'};
}
=head2 authorised_value_category
my $authorised_value_category = $attr_type->authorised_value_category();
$attr_type->authorised_value_category($authorised_value_category);
Accessor.
=cut
sub authorised_value_category {
my $self = shift;
@_ ? $self->{'authorised_value_category'} = shift : $self->{'authorised_value_category'};
}
=head2 category_code
my $category_code = $attr_type->category_code();
$attr_type->category_code($category_code);
Accessor.
=cut
sub category_code {
my $self = shift;
@_ ? $self->{'category_code'} = shift : $self->{'category_code'};
}
=head2 category_description
my $category_description = $attr_type->category_description();
$attr_type->category_description($category_description);
Accessor.
=cut
sub category_description {
my $self = shift;
@_ ? $self->{'category_description'} = shift : $self->{'category_description'};
}
=head2 class
my $class = $attr_type->class();
$attr_type->class($class);
Accessor.
=cut
sub class {
my $self = shift;
@_ ? $self->{'class'} = shift : $self->{'class'};
}
=head2 delete
$attr_type->delete();
C4::Members::AttributeTypes->delete($code);
Delete an attribute type from the database. The attribute
type may be specified either by an object or by a code.
=cut
sub delete {
my $arg = shift;
my $code;
if (ref($arg) eq __PACKAGE__) {
$code = $arg->{'code'};
} else {
$code = shift;
}
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare_cached("DELETE FROM borrower_attribute_types WHERE code = ?");
$sth->execute($code);
$sth->finish;
}
=head2 num_patrons
my $count = $attr_type->num_patrons();
Returns the number of patron records that use
this attribute type.
=cut
sub num_patrons {
my $self = shift;
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare_cached("SELECT COUNT(DISTINCT borrowernumber)
FROM borrower_attributes
WHERE code = ?");
$sth->execute($self->{code});
my ($count) = $sth->fetchrow_array;
$sth->finish;
return $count;
}
=head2 get_patrons
my @borrowernumbers = $attr_type->get_patrons($attribute);
Returns the borrowernumber of the patron records that
have an attribute with the specifie value.
=cut
sub get_patrons {
my $self = shift;
my $value = shift;
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare_cached("SELECT DISTINCT borrowernumber
FROM borrower_attributes
WHERE code = ?
AND attribute = ?");
$sth->execute($self->{code}, $value);
my @results;
while (my ($borrowernumber) = $sth->fetchrow_array) {
push @results, $borrowernumber;
}
return @results;
}
=head1 AUTHOR
Koha Development Team <http://koha-community.org/>
Galen Charlton <galen.charlton@liblime.com>
=cut
1;
| joubu/Koha | C4/Members/AttributeTypes.pm | Perl | gpl-3.0 | 13,923 | [
30522,
7427,
1039,
2549,
1024,
1024,
2372,
1024,
1024,
17961,
13874,
2015,
1025,
1001,
9385,
1006,
1039,
1007,
2263,
5622,
16558,
14428,
1001,
1001,
2023,
5371,
2003,
2112,
1997,
12849,
3270,
1012,
1001,
1001,
12849,
3270,
2003,
2489,
4007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* @file
* This is the template file for the metadata description for an object.
*
* Available variables:
* - $islandora_object: The Islandora object rendered in this template file
* - $found: Boolean indicating if a Solr doc was found for the current object.
*
* @see template_preprocess_islandora_solr_metadata_description()
* @see template_process_islandora_solr_metadata_description()
*/
?>
<?php if ($found && !empty($description)): ?>
<div class="islandora-solr-metadata-sidebar">
<?php if ($combine): ?>
<h2><?php if (count($description) > 1):
print (t('Description'));
else:
$desc_array = reset($description);
print ($desc_array['display_label']); ?>
<?php endif; ?></h2>
<?php foreach($description as $value): ?>
<p property="description"><?php print check_markup(implode("\n", $value['value']), 'filtered_html'); ?></p>
<?php endforeach; ?>
<?php else: ?>
<?php foreach ($description as $value): ?>
<h2><?php print $value['display_label']; ?></h2>
<p><?php print check_markup(implode("\n", $value['value']), 'filtered_html'); ?></p>
<?php endforeach; ?>
<?php endif; ?>
</div>
<?php endif; ?>
| jordandukart/islandora_solr_metadata | theme/islandora-solr-metadata-description.tpl.php | PHP | gpl-3.0 | 1,232 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
1030,
5371,
1008,
2023,
2003,
1996,
23561,
5371,
2005,
1996,
27425,
6412,
2005,
2019,
4874,
1012,
1008,
1008,
2800,
10857,
1024,
1008,
1011,
1002,
2479,
6525,
1035,
4874,
1024,
1996,
2479,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# attack_csrf.rb
# model of a cross-site request forgery attack
require 'sdsl/view.rb'
u = mod :User do
stores set(:intentsA, :URI)
invokes(:visitA,
# user only types dest address that he/she intends to visit
:when => [:intentsA.contains(o.destA)])
end
goodServer = mod :TrustedServer do
stores :cookies, :Op, :Cookie
stores :addrA, :Hostname
stores set(:protected, :Op)
creates :DOM
creates :Cookie
exports(:httpReqA,
:args => [item(:cookie, :Cookie),
item(:addrA, :URI)],
# if op is protected, only accept when it provides a valid cookie
:when => [implies(:protected.contains(o),
o.cookie.eq(:cookies[o]))])
invokes(:httpRespA,
:when => [triggeredBy :httpReqA])
end
badServer = mod :MaliciousServer do
stores :addrA, :Hostname
creates :DOM
exports(:httpReqA2,
:args => [item(:cookie, :Cookie),
item(:addrA, :URI)])
invokes(:httpRespA,
:when => [triggeredBy :httpReqA2])
end
goodClient = mod :Client do
stores :cookies, :URI, :Cookie
exports(:visitA,
:args => [item(:destA, :URI)])
exports(:httpRespA,
:args => [item(:dom, :DOM),
item(:addrA, :URI)])
invokes([:httpReqA, :httpReqA2],
:when => [
# req always contains any associated cookie
implies(some(:cookies[o.addrA]),
o.cookie.eq(:cookies[o.addrA])),
disj(
# sends a http request only when
# the user initiates a connection
conj(triggeredBy(:visitA),
o.addrA.eq(trig.destA)),
# or in response to a src tag
conjs([triggeredBy(:httpRespA),
trig.dom.tags.src.contains(o.addrA)]
))
])
end
dom = datatype :DOM do
field set(:tags, :HTMLTag)
extends :Payload
end
addr = datatype :Addr do end
uri = datatype :URI do
field item(:addr, :Addr)
field set(:vals, :Payload)
end
imgTag = datatype :ImgTag do
field item(:src, :URI)
extends :HTMLTag
end
tag = datatype :HTMLTag do setAbstract end
cookie = datatype :Cookie do extends :Payload end
otherPayload = datatype :OtherPayload do extends :Payload end
payload = datatype :Payload do setAbstract end
VIEW_CSRF = view :AttackCSRF do
modules u, goodServer, badServer, goodClient
trusted goodServer, goodClient, u
data uri, :Hostname, cookie, otherPayload, payload, dom, tag, imgTag, addr
end
drawView VIEW_CSRF, "csrf.dot"
dumpAlloy VIEW_CSRF, "csrf.als"
# puts goodServer
# puts badServer
# puts goodClient
# writeDot mods
| kyessenov/poirot | lib/sdsl/case_studies/attack_csrf.rb | Ruby | gpl-2.0 | 2,814 | [
30522,
1001,
2886,
1035,
20116,
12881,
1012,
21144,
1001,
2944,
1997,
1037,
2892,
1011,
2609,
5227,
15681,
2854,
2886,
5478,
1005,
17371,
14540,
1013,
3193,
1012,
21144,
1005,
1057,
1027,
16913,
1024,
5310,
2079,
5324,
2275,
1006,
1024,
784... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Project858.Net
{
/// <summary>
/// Base frame item from tcp protocol
/// </summary>
public interface IPackageItem
{
#region - Properties -
/// <summary>
/// Item type
/// </summary>
PackageItemTypes ItemType { get; }
/// <summary>
/// Item address
/// </summary>
UInt32 Address { get; }
/// <summary>
/// Data item
/// </summary>
Byte[] Data { get; }
#endregion
#region - Public Methods -
/// <summary>
/// this function returns value
/// </summary>
/// <returns>Value</returns>
Object GetValue();
/// <summary>
/// This function returns item data
/// </summary>
/// <returns>Item array data</returns>
Byte[] ToByteArray();
#endregion
}
}
| 858project/net.858project.dll | 858project/858project.Net/IPackageItem.cs | C# | mit | 972 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
3793,
1025,
3415,
15327,
2622,
27531,
2620,
30524,
1013,
1026,
12654,
1028,
1013,
1013,
1013,
8875,
2828,
1013,
1013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/*
* This file is part of PHP-FFmpeg.
*
* (c) Alchemy <info@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace FFMpeg\Media;
use Alchemy\BinaryDriver\Exception\ExecutionFailureException;
use FFMpeg\Filters\Audio\AudioFilters;
use FFMpeg\Format\FormatInterface;
use FFMpeg\Filters\Audio\SimpleFilter;
use FFMpeg\Exception\RuntimeException;
use FFMpeg\Exception\InvalidArgumentException;
use FFMpeg\Filters\Audio\AudioFilterInterface;
use FFMpeg\Filters\FilterInterface;
use FFMpeg\Format\ProgressableInterface;
class Audio extends AbstractStreamableMedia
{
/**
* {@inheritdoc}
*
* @return AudioFilters
*/
public function filters()
{
return new AudioFilters($this);
}
/**
* {@inheritdoc}
*
* @return Audio
*/
public function addFilter(FilterInterface $filter)
{
if (!$filter instanceof AudioFilterInterface) {
throw new InvalidArgumentException('Audio only accepts AudioFilterInterface filters');
}
$this->filters->add($filter);
return $this;
}
/**
* Exports the audio in the desired format, applies registered filters.
*
* @param FormatInterface $format
* @param string $outputPathfile
* @return Audio
* @throws RuntimeException
*/
public function save(FormatInterface $format, $outputPathfile)
{
$listeners = null;
if ($format instanceof ProgressableInterface) {
$listeners = $format->createProgressListener($this, $this->ffprobe, 1, 1, 0);
}
$commands = $this->buildCommand($format, $outputPathfile);
try {
$this->driver->command($commands, false, $listeners);
} catch (ExecutionFailureException $e) {
$this->cleanupTemporaryFile($outputPathfile);
throw new RuntimeException('Encoding failed', $e->getCode(), $e);
}
return $this;
}
/**
* Returns the final command as a string, useful for debugging purposes.
*
* @param FormatInterface $format
* @param string $outputPathfile
* @return string
* @since 0.11.0
*/
public function getFinalCommand(FormatInterface $format, $outputPathfile) {
return implode(' ', $this->buildCommand($format, $outputPathfile));
}
/**
* Builds the command which will be executed with the provided format
*
* @param FormatInterface $format
* @param string $outputPathfile
* @return string[] An array which are the components of the command
* @since 0.11.0
*/
protected function buildCommand(FormatInterface $format, $outputPathfile) {
$commands = array('-y', '-i', $this->pathfile);
$filters = clone $this->filters;
$filters->add(new SimpleFilter($format->getExtraParams(), 10));
if ($this->driver->getConfiguration()->has('ffmpeg.threads')) {
$filters->add(new SimpleFilter(array('-threads', $this->driver->getConfiguration()->get('ffmpeg.threads'))));
}
if (null !== $format->getAudioCodec()) {
$filters->add(new SimpleFilter(array('-acodec', $format->getAudioCodec())));
}
foreach ($filters as $filter) {
$commands = array_merge($commands, $filter->apply($this, $format));
}
if (null !== $format->getAudioKiloBitrate()) {
$commands[] = '-b:a';
$commands[] = $format->getAudioKiloBitrate() . 'k';
}
if (null !== $format->getAudioChannels()) {
$commands[] = '-ac';
$commands[] = $format->getAudioChannels();
}
$commands[] = $outputPathfile;
return $commands;
}
/**
* Gets the waveform of the video.
*
* @param integer $width
* @param integer $height
* @param array $colors Array of colors for ffmpeg to use. Color format is #000000 (RGB hex string with #)
* @return Waveform
*/
public function waveform($width = 640, $height = 120, $colors = array(Waveform::DEFAULT_COLOR))
{
return new Waveform($this, $this->driver, $this->ffprobe, $width, $height, $colors);
}
/**
* Concatenates a list of audio files into one unique audio file.
*
* @param array $sources
* @return Concat
*/
public function concat($sources)
{
return new Concat($sources, $this->driver, $this->ffprobe);
}
}
| vfremaux/moodle-mod_mplayer | extralib/PHP-FFMpeg-master/src/FFMpeg/Media/Audio.php | PHP | gpl-3.0 | 4,582 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
25718,
1011,
21461,
8737,
13910,
1012,
1008,
1008,
1006,
1039,
1007,
2632,
5403,
8029,
1026,
18558,
1030,
2632,
5403,
8029,
1012,
10424,
1028,
1008,
1008,
2005,
1996,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var URL = require('url');
var Pagination = function(request, model){
this.request = request;
this.model = model;
this.paginate = function(query, limit, sort, selected, onDataReception){
var url = URL.parse(this.request.url).pathname;
var page = this.request.param('page');
page = page === undefined ? 0 : page;
this.model.find(query).sort(sort).skip(page*limit).limit( (limit + 1) ).select( selected ).exec(function(err, members){
//Fetched more than the limit
members.splice(limit, 1);
var paginatedMembers = {
data : members
};
if(members.length >= limit ){
nextPage = parseInt(page) + 1;
paginatedMembers["next"] = url + "?page=" + nextPage;
}
if (page >= 1) {
prevPage = parseInt(page) - 1;
paginatedMembers["prev"] = url + "?page=" + prevPage;
};
onDataReception(paginatedMembers);
});
};
}
module.exports = function(request, model){
return new Pagination(request, model);
}
| mz52arsi/NODEJS-Express-bootstrap | app/models/pagination/paginate.js | JavaScript | mit | 965 | [
30522,
13075,
24471,
2140,
1027,
5478,
1006,
1005,
24471,
2140,
1005,
1007,
1025,
13075,
6643,
20876,
3508,
1027,
3853,
1006,
5227,
1010,
2944,
1007,
1063,
2023,
1012,
5227,
1027,
5227,
1025,
2023,
1012,
2944,
1027,
2944,
1025,
2023,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2005-2007 Maarten Billemont
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.lyndir.lhunath.opal.gui;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
/**
* <i>{@link ListenerAction} - [in short] (TODO).</i><br> <br> [description / usage].<br> <br>
*
* @author lhunath
*/
public class ListenerAction extends AbstractAction {
private final ActionListener listener;
/**
* Create a new {@link ListenerAction} instance.
*
* @param listener The listener that will be notified of this action.
*/
public ListenerAction(final ActionListener listener) {
this.listener = listener;
}
/**
* Create a new {@link ListenerAction} instance.
*
* @param name The name of the action.
* @param listener The listener that will be notified of this action.
*/
public ListenerAction(final String name, final ActionListener listener) {
super( name );
this.listener = listener;
}
/**
* Create a new {@link ListenerAction} instance.
*
* @param name The name of the action.
* @param command The string that will identify the action that must be taken.
* @param icon The icon of the action.
* @param listener The listener that will be notified of this action.
*/
public ListenerAction(final String name, final String command, final Icon icon, final ActionListener listener) {
super( name, icon );
this.listener = listener;
setActionCommand( command );
}
/**
* Specify an action command string for this action.
*
* @param command The string that will identify the action that must be taken.
*/
public void setActionCommand(final String command) {
putValue( ACTION_COMMAND_KEY, command );
}
/**
* Specify an action command string for this action.
*
* @return The string that will identify the action that must be taken.
*/
public String getActionCommand() {
return getValue( ACTION_COMMAND_KEY ) == null? null: getValue( ACTION_COMMAND_KEY ).toString();
}
/**
* {@inheritDoc}
*/
@Override
public void actionPerformed(final ActionEvent e) {
if (listener != null)
listener.actionPerformed( e );
}
}
| Lyndir/Opal | discontinued/opal-geo/src/main/java/com/lyndir/lhunath/opal/gui/ListenerAction.java | Java | apache-2.0 | 2,900 | [
30522,
1013,
1008,
1008,
9385,
2384,
1011,
2289,
5003,
24847,
2078,
3021,
26941,
2102,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
class MediaData extends Data {
public $dataFile = 'autocms-media.json';
public function createFile() {
if (!file_exists($this->dataLoc . $this->dataFile)) {
$this->data = Array();
$this->data['images'] = Array();
$fp = fopen($this->dataLoc . $this->dataFile, 'w');
fwrite($fp, json_encode($this->data));
fclose($fp);
}
}
public function addToMediaLibrary($type, $location, $originalLocation = null) {
if (is_null($originalLocation) || trim($originalLocation) != '') {
$imgId = uniqid();
$this->data[$type][$imgId] = Array('original-location' => $originalLocation, 'location' => $location);
}
}
public function checkMediaLibrary($type, $originalLocation) {
foreach ($this->data[$type] as $entry) {
if ($entry['original-location'] == $originalLocation) return true;
}
return false;
}
public function getFromMediaLibrary($type, $originalLocation) {
foreach ($this->data[$type] as $entry) {
if ($entry['original-location'] == $originalLocation) return $entry['location'];
}
return '';
}
public function deleteImage($type, $id) {
foreach ($this->data[$type] as $key => $entry) {
if ($key == $id) {
if (file_exists($_SERVER['DOCUMENT_ROOT'] . $entry['location'])) unlink($_SERVER['DOCUMENT_ROOT'] . $entry['location']);
}
}
unset($this->data[$type][$id]);
}
public function uploadFiles($page, $isBlog = false) {
foreach ($_FILES as $key => $data) {
if ($_FILES[$key]['error'] == 0) {
$sourceName = $_FILES[$key]['name'];
$fileExt = pathinfo($sourceName, PATHINFO_EXTENSION);
if ($fileExt === '') {
$detect = exif_imagetype($sourceName);
if ($detect == IMAGETYPE_GIF) {
$fileExt = 'gif';
} else if ($detect == IMAGETYPE_JPEG) {
$fileExt = 'jpg';
} else if ($detect == IMAGETYPE_PNG) {
$fileExt = 'jpg';
} else {
$fileExt = 'error';
}
}
if ($fileExt != 'error') {
$imgFileName = $this->makeDateFolders() . uniqid() . '.' . $fileExt;
move_uploaded_file($_FILES[$key]['tmp_name'], $_SERVER['DOCUMENT_ROOT'] . $imgFileName);
$this->addToMediaLibrary('images', $imgFileName);
$dataFile = null;
$json = null;
if (!$isBlog && $page != 'media') {
$dataFile = 'data/page-' . $page . '.json';
$json = json_decode(file_get_contents($dataFile), true);
foreach ($json as $jsonKey => $datum) {
if ($key == $jsonKey && $json[$key]['type'] == 'image' && isset($json[$key])) {
$json[$key]['image'] = $imgFileName;
} else {
list($repeatKey, $iteration, $itemKey) = explode("-", $key);
if (isset($json[$repeatKey]['repeat'][$iteration][$itemKey]) && $json[$repeatKey]['repeat'][$iteration][$itemKey]['type'] == 'image') {
$json[$repeatKey]['repeat'][$iteration][$itemKey]['image'] = $imgFileName;
}
}
}
} else if ($isBlog) {
$dataFile = 'data/blog/blog-' . $page . '.json';
$json = json_decode(file_get_contents($dataFile), true);
$json['image'] = $imgFileName;
}
if ($page != 'media') {
$fp = fopen($dataFile, 'w');
fwrite($fp, json_encode($json));
fclose($fp);
}
}
}
}
}
public function makeDateFolders() {
if (!is_dir($_SERVER['DOCUMENT_ROOT'] . '/assets/')) {
mkdir($_SERVER['DOCUMENT_ROOT'] . '/assets/');
}
if (!is_dir($_SERVER['DOCUMENT_ROOT'] . '/assets/auto-images/')) {
mkdir($_SERVER['DOCUMENT_ROOT'] . '/assets/auto-images/');
}
$year = date("Y", time());
if (!is_dir($_SERVER['DOCUMENT_ROOT'] . '/assets/auto-images/'.$year.'/')) {
mkdir($_SERVER['DOCUMENT_ROOT'] . '/assets/auto-images/'.$year.'/');
}
$month = date("m", time());
if (!is_dir($_SERVER['DOCUMENT_ROOT'] . '/assets/auto-images/'.$year.'/'.$month.'/')) {
mkdir($_SERVER['DOCUMENT_ROOT'] . '/assets/auto-images/'.$year.'/'.$month.'/');
}
return '/assets/auto-images/'.$year.'/'.$month.'/';
}
static public function getImageType($fileExt, $source) {
if ($fileExt === '' && file_exists($source)) {
$detect = exif_imagetype($source);
if ($detect == IMAGETYPE_GIF) {
$fileExt = 'gif';
} else if ($detect == IMAGETYPE_JPEG) {
$fileExt = 'jpg';
} else if ($detect == IMAGETYPE_PNG) {
$fileExt = 'jpg';
} else {
$fileExt = 'error';
}
}
return $fileExt;
}
}
class Media {
function get() {
$users = new UsersData();
if ($users->checkPass() && !$users->authNeeded()) {
include_once('admin-pages/media.php');
} else {
include_once('401.html');
}
}
function post() {
$users = new UsersData();
if ($users->checkPass() && !$users->authNeeded()) {
$media = new MediaData();
if (isset($_POST['delete'])) {
$media->deleteImage('images', $_POST['delete']);
}
if (!empty($_FILES)) {
$media->uploadFiles('media');
}
header('Location: /admin/media/?updated=true');
} else {
include_once('401.html');
}
}
} | rapidDevGroup/autoCMS | admin/system/classes/media.php | PHP | mit | 6,337 | [
30522,
1026,
1029,
25718,
2465,
2865,
2850,
2696,
8908,
2951,
1063,
2270,
1002,
2951,
8873,
2571,
1027,
1005,
8285,
27487,
2015,
1011,
2865,
1012,
1046,
3385,
1005,
1025,
2270,
3853,
3443,
8873,
2571,
1006,
1007,
1063,
2065,
1006,
999,
53... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using UnityEngine;
using System.Collections;
public class Rotate : MonoBehaviour {
void Start () {
}
void Update () {
transform.Rotate (1, 2, 3);
}
}
| yoggy/unity_test | test03_logger/Assets/Rotate.cs | C# | mit | 167 | [
30522,
2478,
8499,
13159,
3170,
1025,
2478,
2291,
1012,
6407,
1025,
2270,
2465,
24357,
1024,
18847,
4783,
3270,
25500,
3126,
1063,
11675,
2707,
1006,
1007,
1063,
1065,
11675,
10651,
1006,
1007,
1063,
10938,
1012,
24357,
1006,
1015,
1010,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# snomed-browser
FIXME: description
## Installation
Download from http://example.com/FIXME.
## Usage
FIXME: explanation
$ java -jar snomed-browser-0.1.0-standalone.jar [args]
## Options
FIXME: listing of options this app accepts.
## Examples
...
### Bugs
...
### Any Other Sections
### That You Think
### Might be Useful
## License
Copyright © 2015 FIXME
Distributed under the Eclipse Public License either version 1.0 or (at
your option) any later version.
| dkincaid/snomed-browser | README.md | Markdown | epl-1.0 | 479 | [
30522,
1001,
1055,
3630,
7583,
1011,
16602,
8081,
4168,
1024,
6412,
1001,
1001,
8272,
8816,
2013,
8299,
1024,
1013,
1013,
2742,
1012,
4012,
1013,
8081,
4168,
1012,
1001,
1001,
8192,
8081,
4168,
1024,
7526,
1002,
9262,
1011,
15723,
1055,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Psychotria marcgravii (A.St.-Hil.) Spreng. SPECIES
#### Status
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Magnoliopsida/Gentianales/Rubiaceae/Palicourea/Palicourea marcgravii/ Syn. Psychotria marcgravii/README.md | Markdown | apache-2.0 | 199 | [
30522,
1001,
18224,
18886,
2050,
7871,
17643,
5737,
2072,
1006,
1037,
1012,
2358,
1012,
1011,
7632,
2140,
1012,
1007,
11867,
7389,
2290,
1012,
2427,
1001,
1001,
1001,
1001,
3570,
10675,
1001,
1001,
1001,
1001,
2429,
2000,
1996,
10161,
1997,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
*
* WPA supplicant library with GLib integration
*
* Copyright (C) 2012 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 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 General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <dbus/dbus.h>
#include "dbus.h"
#define TIMEOUT 5000
static DBusConnection *connection;
void supplicant_dbus_setup(DBusConnection *conn)
{
connection = conn;
}
void supplicant_dbus_array_foreach(DBusMessageIter *iter,
supplicant_dbus_array_function function,
void *user_data)
{
DBusMessageIter entry;
if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY)
return;
dbus_message_iter_recurse(iter, &entry);
while (dbus_message_iter_get_arg_type(&entry) != DBUS_TYPE_INVALID) {
if (function != NULL)
function(&entry, user_data);
dbus_message_iter_next(&entry);
}
}
void supplicant_dbus_property_foreach(DBusMessageIter *iter,
supplicant_dbus_property_function function,
void *user_data)
{
DBusMessageIter dict;
if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY)
return;
dbus_message_iter_recurse(iter, &dict);
while (dbus_message_iter_get_arg_type(&dict) == DBUS_TYPE_DICT_ENTRY) {
DBusMessageIter entry, value;
const char *key;
dbus_message_iter_recurse(&dict, &entry);
if (dbus_message_iter_get_arg_type(&entry) != DBUS_TYPE_STRING)
return;
dbus_message_iter_get_basic(&entry, &key);
dbus_message_iter_next(&entry);
if (dbus_message_iter_get_arg_type(&entry) != DBUS_TYPE_VARIANT)
return;
dbus_message_iter_recurse(&entry, &value);
if (key != NULL) {
if (strcmp(key, "Properties") == 0)
supplicant_dbus_property_foreach(&value,
function, user_data);
else if (function != NULL)
function(key, &value, user_data);
}
dbus_message_iter_next(&dict);
}
}
struct property_get_data {
supplicant_dbus_property_function function;
void *user_data;
};
static void property_get_all_reply(DBusPendingCall *call, void *user_data)
{
struct property_get_data *data = user_data;
DBusMessage *reply;
DBusMessageIter iter;
reply = dbus_pending_call_steal_reply(call);
if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR)
goto done;
if (dbus_message_iter_init(reply, &iter) == FALSE)
goto done;
supplicant_dbus_property_foreach(&iter, data->function,
data->user_data);
if (data->function != NULL)
data->function(NULL, NULL, data->user_data);
done:
dbus_message_unref(reply);
dbus_pending_call_unref(call);
}
int supplicant_dbus_property_get_all(const char *path, const char *interface,
supplicant_dbus_property_function function,
void *user_data)
{
struct property_get_data *data;
DBusMessage *message;
DBusPendingCall *call;
if (connection == NULL)
return -EINVAL;
if (path == NULL || interface == NULL)
return -EINVAL;
data = dbus_malloc0(sizeof(*data));
if (data == NULL)
return -ENOMEM;
message = dbus_message_new_method_call(SUPPLICANT_SERVICE, path,
DBUS_INTERFACE_PROPERTIES, "GetAll");
if (message == NULL) {
dbus_free(data);
return -ENOMEM;
}
dbus_message_set_auto_start(message, FALSE);
dbus_message_append_args(message, DBUS_TYPE_STRING, &interface, NULL);
if (dbus_connection_send_with_reply(connection, message,
&call, TIMEOUT) == FALSE) {
dbus_message_unref(message);
dbus_free(data);
return -EIO;
}
if (call == NULL) {
dbus_message_unref(message);
dbus_free(data);
return -EIO;
}
data->function = function;
data->user_data = user_data;
dbus_pending_call_set_notify(call, property_get_all_reply,
data, dbus_free);
dbus_message_unref(message);
return 0;
}
static void property_get_reply(DBusPendingCall *call, void *user_data)
{
struct property_get_data *data = user_data;
DBusMessage *reply;
DBusMessageIter iter;
reply = dbus_pending_call_steal_reply(call);
if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR)
goto done;
if (dbus_message_iter_init(reply, &iter) == FALSE)
goto done;
if (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_VARIANT) {
DBusMessageIter variant;
dbus_message_iter_recurse(&iter, &variant);
if (data->function != NULL)
data->function(NULL, &variant, data->user_data);
}
done:
dbus_message_unref(reply);
dbus_pending_call_unref(call);
}
int supplicant_dbus_property_get(const char *path, const char *interface,
const char *method,
supplicant_dbus_property_function function,
void *user_data)
{
struct property_get_data *data;
DBusMessage *message;
DBusPendingCall *call;
if (connection == NULL)
return -EINVAL;
if (path == NULL || interface == NULL || method == NULL)
return -EINVAL;
data = dbus_malloc0(sizeof(*data));
if (data == NULL)
return -ENOMEM;
message = dbus_message_new_method_call(SUPPLICANT_SERVICE, path,
DBUS_INTERFACE_PROPERTIES, "Get");
if (message == NULL) {
dbus_free(data);
return -ENOMEM;
}
dbus_message_set_auto_start(message, FALSE);
dbus_message_append_args(message, DBUS_TYPE_STRING, &interface,
DBUS_TYPE_STRING, &method, NULL);
if (dbus_connection_send_with_reply(connection, message,
&call, TIMEOUT) == FALSE) {
dbus_message_unref(message);
dbus_free(data);
return -EIO;
}
if (call == NULL) {
dbus_message_unref(message);
dbus_free(data);
return -EIO;
}
data->function = function;
data->user_data = user_data;
dbus_pending_call_set_notify(call, property_get_reply,
data, dbus_free);
dbus_message_unref(message);
return 0;
}
struct property_set_data {
supplicant_dbus_result_function function;
void *user_data;
};
static void property_set_reply(DBusPendingCall *call, void *user_data)
{
struct property_set_data *data = user_data;
DBusMessage *reply;
DBusMessageIter iter;
const char *error;
reply = dbus_pending_call_steal_reply(call);
if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR)
error = dbus_message_get_error_name(reply);
else
error = NULL;
dbus_message_iter_init(reply, &iter);
if (data->function != NULL)
data->function(error, &iter, data->user_data);
dbus_message_unref(reply);
dbus_pending_call_unref(call);
}
int supplicant_dbus_property_set(const char *path, const char *interface,
const char *key, const char *signature,
supplicant_dbus_setup_function setup,
supplicant_dbus_result_function function,
void *user_data)
{
struct property_set_data *data;
DBusMessage *message;
DBusMessageIter iter, value;
DBusPendingCall *call;
if (connection == NULL)
return -EINVAL;
if (path == NULL || interface == NULL)
return -EINVAL;
if (key == NULL || signature == NULL || setup == NULL)
return -EINVAL;
data = dbus_malloc0(sizeof(*data));
if (data == NULL)
return -ENOMEM;
message = dbus_message_new_method_call(SUPPLICANT_SERVICE, path,
DBUS_INTERFACE_PROPERTIES, "Set");
if (message == NULL) {
dbus_free(data);
return -ENOMEM;
}
dbus_message_set_auto_start(message, FALSE);
dbus_message_iter_init_append(message, &iter);
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &interface);
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &key);
dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT,
signature, &value);
setup(&value, user_data);
dbus_message_iter_close_container(&iter, &value);
if (dbus_connection_send_with_reply(connection, message,
&call, TIMEOUT) == FALSE) {
dbus_message_unref(message);
dbus_free(data);
return -EIO;
}
if (call == NULL) {
dbus_message_unref(message);
dbus_free(data);
return -EIO;
}
data->function = function;
data->user_data = user_data;
dbus_pending_call_set_notify(call, property_set_reply,
data, dbus_free);
dbus_message_unref(message);
return 0;
}
struct method_call_data {
supplicant_dbus_result_function function;
void *user_data;
};
static void method_call_reply(DBusPendingCall *call, void *user_data)
{
struct method_call_data *data = user_data;
DBusMessage *reply;
DBusMessageIter iter;
const char *error;
reply = dbus_pending_call_steal_reply(call);
if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR)
error = dbus_message_get_error_name(reply);
else
error = NULL;
dbus_message_iter_init(reply, &iter);
if (data->function != NULL)
data->function(error, &iter, data->user_data);
dbus_message_unref(reply);
dbus_pending_call_unref(call);
}
int supplicant_dbus_method_call(const char *path,
const char *interface, const char *method,
supplicant_dbus_setup_function setup,
supplicant_dbus_result_function function,
void *user_data)
{
struct method_call_data *data;
DBusMessage *message;
DBusMessageIter iter;
DBusPendingCall *call;
if (connection == NULL)
return -EINVAL;
if (path == NULL || interface == NULL || method == NULL)
return -EINVAL;
data = dbus_malloc0(sizeof(*data));
if (data == NULL)
return -ENOMEM;
message = dbus_message_new_method_call(SUPPLICANT_SERVICE, path,
interface, method);
if (message == NULL) {
dbus_free(data);
return -ENOMEM;
}
dbus_message_set_auto_start(message, FALSE);
dbus_message_iter_init_append(message, &iter);
if (setup != NULL)
setup(&iter, user_data);
if (dbus_connection_send_with_reply(connection, message,
&call, TIMEOUT) == FALSE) {
dbus_message_unref(message);
dbus_free(data);
return -EIO;
}
if (call == NULL) {
dbus_message_unref(message);
dbus_free(data);
return -EIO;
}
data->function = function;
data->user_data = user_data;
dbus_pending_call_set_notify(call, method_call_reply,
data, dbus_free);
dbus_message_unref(message);
return 0;
}
void supplicant_dbus_property_append_basic(DBusMessageIter *iter,
const char *key, int type, void *val)
{
DBusMessageIter value;
const char *signature;
dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &key);
switch (type) {
case DBUS_TYPE_BOOLEAN:
signature = DBUS_TYPE_BOOLEAN_AS_STRING;
break;
case DBUS_TYPE_STRING:
signature = DBUS_TYPE_STRING_AS_STRING;
break;
case DBUS_TYPE_BYTE:
signature = DBUS_TYPE_BYTE_AS_STRING;
break;
case DBUS_TYPE_UINT16:
signature = DBUS_TYPE_UINT16_AS_STRING;
break;
case DBUS_TYPE_INT16:
signature = DBUS_TYPE_INT16_AS_STRING;
break;
case DBUS_TYPE_UINT32:
signature = DBUS_TYPE_UINT32_AS_STRING;
break;
case DBUS_TYPE_INT32:
signature = DBUS_TYPE_INT32_AS_STRING;
break;
case DBUS_TYPE_OBJECT_PATH:
signature = DBUS_TYPE_OBJECT_PATH_AS_STRING;
break;
default:
signature = DBUS_TYPE_VARIANT_AS_STRING;
break;
}
dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
signature, &value);
dbus_message_iter_append_basic(&value, type, val);
dbus_message_iter_close_container(iter, &value);
}
void supplicant_dbus_property_append_fixed_array(DBusMessageIter *iter,
const char *key, int type, void *val, int len)
{
DBusMessageIter value, array;
const char *variant_sig, *array_sig;
switch (type) {
case DBUS_TYPE_BYTE:
variant_sig = DBUS_TYPE_ARRAY_AS_STRING
DBUS_TYPE_BYTE_AS_STRING;
array_sig = DBUS_TYPE_BYTE_AS_STRING;
break;
default:
return;
}
dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &key);
dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
variant_sig, &value);
dbus_message_iter_open_container(&value, DBUS_TYPE_ARRAY,
array_sig, &array);
dbus_message_iter_append_fixed_array(&array, type, val, len);
dbus_message_iter_close_container(&value, &array);
dbus_message_iter_close_container(iter, &value);
}
void supplicant_dbus_property_append_array(DBusMessageIter *iter,
const char *key, int type,
supplicant_dbus_array_function function,
void *user_data)
{
DBusMessageIter value, array;
const char *variant_sig, *array_sig;
switch (type) {
case DBUS_TYPE_STRING:
variant_sig = DBUS_TYPE_ARRAY_AS_STRING
DBUS_TYPE_ARRAY_AS_STRING
DBUS_TYPE_BYTE_AS_STRING;
array_sig = DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_BYTE_AS_STRING;
break;
default:
return;
}
dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &key);
dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
variant_sig, &value);
dbus_message_iter_open_container(&value, DBUS_TYPE_ARRAY,
array_sig, &array);
if (function)
function(&array, user_data);
dbus_message_iter_close_container(&value, &array);
dbus_message_iter_close_container(iter, &value);
}
| raininja/connman-release | gsupplicant/dbus.c | C | gpl-2.0 | 13,045 | [
30522,
1013,
1008,
1008,
1008,
1059,
4502,
10514,
9397,
19341,
3372,
3075,
2007,
1043,
29521,
8346,
1008,
1008,
9385,
1006,
1039,
1007,
2262,
13420,
3840,
1012,
2035,
2916,
9235,
1012,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//===-- llvm-nm.cpp - Symbol table dumping utility for llvm ---------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This program is a utility that works like traditional Unix "nm", that is, it
// prints out the names of symbols in a bitcode or object file, along with some
// information about each symbol.
//
// This "nm" supports many of the features of GNU "nm", including its different
// output formats.
//
//===----------------------------------------------------------------------===//
#include "llvm/IR/LLVMContext.h"
#include "llvm/Bitcode/Archive.h"
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/IR/Module.h"
#include "llvm/Object/Archive.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/Program.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/system_error.h"
#include <algorithm>
#include <cctype>
#include <cerrno>
#include <cstring>
#include <vector>
using namespace llvm;
using namespace object;
namespace {
enum OutputFormatTy { bsd, sysv, posix };
cl::opt<OutputFormatTy>
OutputFormat("format",
cl::desc("Specify output format"),
cl::values(clEnumVal(bsd, "BSD format"),
clEnumVal(sysv, "System V format"),
clEnumVal(posix, "POSIX.2 format"),
clEnumValEnd), cl::init(bsd));
cl::alias OutputFormat2("f", cl::desc("Alias for --format"),
cl::aliasopt(OutputFormat));
cl::list<std::string>
InputFilenames(cl::Positional, cl::desc("<input bitcode files>"),
cl::ZeroOrMore);
cl::opt<bool> UndefinedOnly("undefined-only",
cl::desc("Show only undefined symbols"));
cl::alias UndefinedOnly2("u", cl::desc("Alias for --undefined-only"),
cl::aliasopt(UndefinedOnly));
cl::opt<bool> DynamicSyms("dynamic",
cl::desc("Display the dynamic symbols instead "
"of normal symbols."));
cl::alias DynamicSyms2("D", cl::desc("Alias for --dynamic"),
cl::aliasopt(DynamicSyms));
cl::opt<bool> DefinedOnly("defined-only",
cl::desc("Show only defined symbols"));
cl::opt<bool> ExternalOnly("extern-only",
cl::desc("Show only external symbols"));
cl::alias ExternalOnly2("g", cl::desc("Alias for --extern-only"),
cl::aliasopt(ExternalOnly));
cl::opt<bool> BSDFormat("B", cl::desc("Alias for --format=bsd"));
cl::opt<bool> POSIXFormat("P", cl::desc("Alias for --format=posix"));
cl::opt<bool> PrintFileName("print-file-name",
cl::desc("Precede each symbol with the object file it came from"));
cl::alias PrintFileNameA("A", cl::desc("Alias for --print-file-name"),
cl::aliasopt(PrintFileName));
cl::alias PrintFileNameo("o", cl::desc("Alias for --print-file-name"),
cl::aliasopt(PrintFileName));
cl::opt<bool> DebugSyms("debug-syms",
cl::desc("Show all symbols, even debugger only"));
cl::alias DebugSymsa("a", cl::desc("Alias for --debug-syms"),
cl::aliasopt(DebugSyms));
cl::opt<bool> NumericSort("numeric-sort",
cl::desc("Sort symbols by address"));
cl::alias NumericSortn("n", cl::desc("Alias for --numeric-sort"),
cl::aliasopt(NumericSort));
cl::alias NumericSortv("v", cl::desc("Alias for --numeric-sort"),
cl::aliasopt(NumericSort));
cl::opt<bool> NoSort("no-sort",
cl::desc("Show symbols in order encountered"));
cl::alias NoSortp("p", cl::desc("Alias for --no-sort"),
cl::aliasopt(NoSort));
cl::opt<bool> PrintSize("print-size",
cl::desc("Show symbol size instead of address"));
cl::alias PrintSizeS("S", cl::desc("Alias for --print-size"),
cl::aliasopt(PrintSize));
cl::opt<bool> SizeSort("size-sort", cl::desc("Sort symbols by size"));
cl::opt<bool> WithoutAliases("without-aliases", cl::Hidden,
cl::desc("Exclude aliases from output"));
cl::opt<bool> ArchiveMap("print-armap",
cl::desc("Print the archive map"));
cl::alias ArchiveMaps("s", cl::desc("Alias for --print-armap"),
cl::aliasopt(ArchiveMap));
bool PrintAddress = true;
bool MultipleFiles = false;
std::string ToolName;
}
static void error(Twine message, Twine path = Twine()) {
errs() << ToolName << ": " << path << ": " << message << ".\n";
}
static bool error(error_code ec, Twine path = Twine()) {
if (ec) {
error(ec.message(), path);
return true;
}
return false;
}
namespace {
struct NMSymbol {
uint64_t Address;
uint64_t Size;
char TypeChar;
StringRef Name;
};
static bool CompareSymbolAddress(const NMSymbol &a, const NMSymbol &b) {
if (a.Address < b.Address)
return true;
else if (a.Address == b.Address && a.Name < b.Name)
return true;
else if (a.Address == b.Address && a.Name == b.Name && a.Size < b.Size)
return true;
else
return false;
}
static bool CompareSymbolSize(const NMSymbol &a, const NMSymbol &b) {
if (a.Size < b.Size)
return true;
else if (a.Size == b.Size && a.Name < b.Name)
return true;
else if (a.Size == b.Size && a.Name == b.Name && a.Address < b.Address)
return true;
else
return false;
}
static bool CompareSymbolName(const NMSymbol &a, const NMSymbol &b) {
if (a.Name < b.Name)
return true;
else if (a.Name == b.Name && a.Size < b.Size)
return true;
else if (a.Name == b.Name && a.Size == b.Size && a.Address < b.Address)
return true;
else
return false;
}
StringRef CurrentFilename;
typedef std::vector<NMSymbol> SymbolListT;
SymbolListT SymbolList;
}
static void SortAndPrintSymbolList() {
if (!NoSort) {
if (NumericSort)
std::sort(SymbolList.begin(), SymbolList.end(), CompareSymbolAddress);
else if (SizeSort)
std::sort(SymbolList.begin(), SymbolList.end(), CompareSymbolSize);
else
std::sort(SymbolList.begin(), SymbolList.end(), CompareSymbolName);
}
if (OutputFormat == posix && MultipleFiles) {
outs() << '\n' << CurrentFilename << ":\n";
} else if (OutputFormat == bsd && MultipleFiles) {
outs() << "\n" << CurrentFilename << ":\n";
} else if (OutputFormat == sysv) {
outs() << "\n\nSymbols from " << CurrentFilename << ":\n\n"
<< "Name Value Class Type"
<< " Size Line Section\n";
}
for (SymbolListT::iterator i = SymbolList.begin(),
e = SymbolList.end(); i != e; ++i) {
if ((i->TypeChar != 'U') && UndefinedOnly)
continue;
if ((i->TypeChar == 'U') && DefinedOnly)
continue;
if (SizeSort && !PrintAddress && i->Size == UnknownAddressOrSize)
continue;
char SymbolAddrStr[10] = "";
char SymbolSizeStr[10] = "";
if (OutputFormat == sysv || i->Address == object::UnknownAddressOrSize)
strcpy(SymbolAddrStr, " ");
if (OutputFormat == sysv)
strcpy(SymbolSizeStr, " ");
if (i->Address != object::UnknownAddressOrSize)
format("%08" PRIx64, i->Address).print(SymbolAddrStr,
sizeof(SymbolAddrStr));
if (i->Size != object::UnknownAddressOrSize)
format("%08" PRIx64, i->Size).print(SymbolSizeStr, sizeof(SymbolSizeStr));
if (OutputFormat == posix) {
outs() << i->Name << " " << i->TypeChar << " "
<< SymbolAddrStr << SymbolSizeStr << "\n";
} else if (OutputFormat == bsd) {
if (PrintAddress)
outs() << SymbolAddrStr << ' ';
if (PrintSize) {
outs() << SymbolSizeStr;
if (i->Size != object::UnknownAddressOrSize)
outs() << ' ';
}
outs() << i->TypeChar << " " << i->Name << "\n";
} else if (OutputFormat == sysv) {
std::string PaddedName (i->Name);
while (PaddedName.length () < 20)
PaddedName += " ";
outs() << PaddedName << "|" << SymbolAddrStr << "| "
<< i->TypeChar
<< " | |" << SymbolSizeStr << "| |\n";
}
}
SymbolList.clear();
}
static char TypeCharForSymbol(GlobalValue &GV) {
if (GV.isDeclaration()) return 'U';
if (GV.hasLinkOnceLinkage()) return 'C';
if (GV.hasCommonLinkage()) return 'C';
if (GV.hasWeakLinkage()) return 'W';
if (isa<Function>(GV) && GV.hasInternalLinkage()) return 't';
if (isa<Function>(GV)) return 'T';
if (isa<GlobalVariable>(GV) && GV.hasInternalLinkage()) return 'd';
if (isa<GlobalVariable>(GV)) return 'D';
if (const GlobalAlias *GA = dyn_cast<GlobalAlias>(&GV)) {
const GlobalValue *AliasedGV = GA->getAliasedGlobal();
if (isa<Function>(AliasedGV)) return 'T';
if (isa<GlobalVariable>(AliasedGV)) return 'D';
}
return '?';
}
static void DumpSymbolNameForGlobalValue(GlobalValue &GV) {
// Private linkage and available_externally linkage don't exist in symtab.
if (GV.hasPrivateLinkage() ||
GV.hasLinkerPrivateLinkage() ||
GV.hasLinkerPrivateWeakLinkage() ||
GV.hasAvailableExternallyLinkage())
return;
char TypeChar = TypeCharForSymbol(GV);
if (GV.hasLocalLinkage () && ExternalOnly)
return;
NMSymbol s;
s.Address = object::UnknownAddressOrSize;
s.Size = object::UnknownAddressOrSize;
s.TypeChar = TypeChar;
s.Name = GV.getName();
SymbolList.push_back(s);
}
static void DumpSymbolNamesFromModule(Module *M) {
CurrentFilename = M->getModuleIdentifier();
std::for_each (M->begin(), M->end(), DumpSymbolNameForGlobalValue);
std::for_each (M->global_begin(), M->global_end(),
DumpSymbolNameForGlobalValue);
if (!WithoutAliases)
std::for_each (M->alias_begin(), M->alias_end(),
DumpSymbolNameForGlobalValue);
SortAndPrintSymbolList();
}
static void DumpSymbolNamesFromObject(ObjectFile *obj) {
error_code ec;
symbol_iterator ibegin = obj->begin_symbols();
symbol_iterator iend = obj->end_symbols();
if (DynamicSyms) {
ibegin = obj->begin_dynamic_symbols();
iend = obj->end_dynamic_symbols();
}
for (symbol_iterator i = ibegin; i != iend; i.increment(ec)) {
if (error(ec)) break;
uint32_t symflags;
if (error(i->getFlags(symflags))) break;
if (!DebugSyms && (symflags & SymbolRef::SF_FormatSpecific))
continue;
NMSymbol s;
s.Size = object::UnknownAddressOrSize;
s.Address = object::UnknownAddressOrSize;
if (PrintSize || SizeSort) {
if (error(i->getSize(s.Size))) break;
}
if (PrintAddress)
if (error(i->getAddress(s.Address))) break;
if (error(i->getNMTypeChar(s.TypeChar))) break;
if (error(i->getName(s.Name))) break;
SymbolList.push_back(s);
}
CurrentFilename = obj->getFileName();
SortAndPrintSymbolList();
}
static void DumpSymbolNamesFromFile(std::string &Filename) {
if (Filename != "-" && !sys::fs::exists(Filename)) {
errs() << ToolName << ": '" << Filename << "': " << "No such file\n";
return;
}
OwningPtr<MemoryBuffer> Buffer;
if (error(MemoryBuffer::getFileOrSTDIN(Filename, Buffer), Filename))
return;
sys::fs::file_magic magic = sys::fs::identify_magic(Buffer->getBuffer());
LLVMContext &Context = getGlobalContext();
std::string ErrorMessage;
if (magic == sys::fs::file_magic::bitcode) {
Module *Result = 0;
Result = ParseBitcodeFile(Buffer.get(), Context, &ErrorMessage);
if (Result) {
DumpSymbolNamesFromModule(Result);
delete Result;
} else {
error(ErrorMessage, Filename);
return;
}
} else if (magic == sys::fs::file_magic::archive) {
OwningPtr<Binary> arch;
if (error(object::createBinary(Buffer.take(), arch), Filename))
return;
if (object::Archive *a = dyn_cast<object::Archive>(arch.get())) {
if (ArchiveMap) {
outs() << "Archive map" << "\n";
for (object::Archive::symbol_iterator i = a->begin_symbols(),
e = a->end_symbols(); i != e; ++i) {
object::Archive::child_iterator c;
StringRef symname;
StringRef filename;
if (error(i->getMember(c)))
return;
if (error(i->getName(symname)))
return;
if (error(c->getName(filename)))
return;
outs() << symname << " in " << filename << "\n";
}
outs() << "\n";
}
for (object::Archive::child_iterator i = a->begin_children(),
e = a->end_children(); i != e; ++i) {
OwningPtr<Binary> child;
if (i->getAsBinary(child)) {
// Try opening it as a bitcode file.
OwningPtr<MemoryBuffer> buff;
if (error(i->getMemoryBuffer(buff)))
return;
Module *Result = 0;
if (buff)
Result = ParseBitcodeFile(buff.get(), Context, &ErrorMessage);
if (Result) {
DumpSymbolNamesFromModule(Result);
delete Result;
}
continue;
}
if (object::ObjectFile *o = dyn_cast<ObjectFile>(child.get())) {
outs() << o->getFileName() << ":\n";
DumpSymbolNamesFromObject(o);
}
}
}
} else if (magic.is_object()) {
OwningPtr<Binary> obj;
if (error(object::createBinary(Buffer.take(), obj), Filename))
return;
if (object::ObjectFile *o = dyn_cast<ObjectFile>(obj.get()))
DumpSymbolNamesFromObject(o);
} else {
errs() << ToolName << ": " << Filename << ": "
<< "unrecognizable file type\n";
return;
}
}
int main(int argc, char **argv) {
// Print a stack trace if we signal out.
sys::PrintStackTraceOnErrorSignal();
PrettyStackTraceProgram X(argc, argv);
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
cl::ParseCommandLineOptions(argc, argv, "llvm symbol table dumper\n");
// llvm-nm only reads binary files.
if (error(sys::Program::ChangeStdinToBinary()))
return 1;
ToolName = argv[0];
if (BSDFormat) OutputFormat = bsd;
if (POSIXFormat) OutputFormat = posix;
// The relative order of these is important. If you pass --size-sort it should
// only print out the size. However, if you pass -S --size-sort, it should
// print out both the size and address.
if (SizeSort && !PrintSize) PrintAddress = false;
if (OutputFormat == sysv || SizeSort) PrintSize = true;
switch (InputFilenames.size()) {
case 0: InputFilenames.push_back("-");
case 1: break;
default: MultipleFiles = true;
}
std::for_each(InputFilenames.begin(), InputFilenames.end(),
DumpSymbolNamesFromFile);
return 0;
}
| dbrumley/recfi | llvm-3.3/tools/llvm-nm/llvm-nm.cpp | C++ | mit | 15,595 | [
30522,
1013,
1013,
1027,
1027,
1027,
1011,
1011,
2222,
2615,
2213,
1011,
13221,
1012,
18133,
2361,
1011,
6454,
2795,
23642,
9710,
2005,
2222,
2615,
2213,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package cs.ox.ac.uk.sors;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.deri.iris.api.basics.ITuple;
public class TopKAlgorithms {
protected static Set<ITuple> getSkiline(PreferencesGraph preferenceModel) {
Set<ITuple> vertices = new HashSet<ITuple>();
for (ITuple tuple : preferenceModel.g.vertexSet()) {
if (preferenceModel.g.inDegreeOf(tuple) == 0) {
vertices.add(tuple);
}
}
return vertices;
}
public static List<ITuple> getTopK(PreferencesGraph p, int k) {
PreferencesGraph preferenceModel = new PreferencesGraph(p);
List<ITuple> topk = new ArrayList<ITuple>();
int nbNodes = preferenceModel.getVertexesSize();
int toBeAdded = 0;
if (k > nbNodes)
toBeAdded = nbNodes;
else
toBeAdded = k;
//System.out.println("Nodes before: "+preferenceModel.getVertexesSize());
while (toBeAdded > 0) {
Set<ITuple> skiline = getSkiline(preferenceModel);
int sizeSkiline = skiline.size();
if (toBeAdded >= sizeSkiline) {
topk.addAll(skiline);
preferenceModel.g.removeAllVertices(skiline);
toBeAdded -= sizeSkiline;
} else {
for (Iterator<ITuple> it = skiline.iterator(); it.hasNext()
&& toBeAdded > 0;) {
ITuple t = it.next();
topk.add(t);
toBeAdded--;
}
}
if (preferenceModel.getVertexesSize()==0) toBeAdded=0;
}
//System.out.println("Nodes after: "+preferenceModel.getVertexesSize());
return topk;
}
public static List<ITuple> topkPrefsGen(PreferencesGraph pg,
Map<String, Double> probabilisticModel, double t, int k) {
PreferencesGraph g = CombinationAlgorithms.combPrefsGen(pg,
probabilisticModel, t);
//System.out.println(g);
return getTopK(g, k);
}
public static List<ITuple> topkPrefsRank(Map<ITuple, Integer> ranks, int k) {
List<ITuple> topk = new ArrayList<ITuple>();
List<Integer> orderedValues = CombinationAlgorithms
.rmDuplicatesInt(CombinationAlgorithms.asSortedListAsc(ranks
.values()));
Map<Integer, Set<ITuple>> depthMap = new HashMap<Integer, Set<ITuple>>();
for (ITuple t : ranks.keySet()) {
int rank = ranks.get(t);
if (!depthMap.containsKey(rank)) {
depthMap.put(rank, new HashSet<ITuple>());
}
depthMap.get(rank).add(t);
}
int toBeAdded = (k > ranks.keySet().size()) ? ranks.keySet().size() : k;
int i = 0;
System.out.println("Nodes before: "+ ranks.keySet().size());
while (toBeAdded > 0) {
Set<ITuple> skiline = depthMap.get(orderedValues.get(i));
int sizeSkiline = skiline.size();
if (toBeAdded >= sizeSkiline) {
topk.addAll(skiline);
toBeAdded -= sizeSkiline;
} else {
for (Iterator<ITuple> it = skiline.iterator(); it.hasNext()
&& toBeAdded > 0;) {
ITuple t = it.next();
topk.add(t);
toBeAdded--;
}
}
i++;
}
System.out.println("Nodes after: "+ ranks.keySet().size());
return topk;
}
public static List<ITuple> topkPrefsRank(PreferencesGraph pg,
Map<String, Double> probabilisticModel, Function f, int k) {
Map<ITuple, Integer> ranks = CombinationAlgorithms.combPrefsRank(pg,
probabilisticModel, Function.Max);
List<ITuple> topk = new ArrayList<ITuple>();
List<Integer> orderedValues = CombinationAlgorithms
.rmDuplicatesInt(CombinationAlgorithms.asSortedListAsc(ranks
.values()));
Map<Integer, Set<ITuple>> depthMap = new HashMap<Integer, Set<ITuple>>();
for (ITuple t : ranks.keySet()) {
int rank = ranks.get(t);
if (!depthMap.containsKey(rank)) {
depthMap.put(rank, new HashSet<ITuple>());
}
depthMap.get(rank).add(t);
}
int toBeAdded = (k >= ranks.keySet().size()) ? ranks.keySet().size()
: k;
int i = 0;
while (toBeAdded > 0) {
Set<ITuple> skiline = depthMap.get(orderedValues.get(i));
int sizeSkiline = skiline.size();
if (toBeAdded >= sizeSkiline) {
topk.addAll(skiline);
toBeAdded -= sizeSkiline;
} else {
for (Iterator<ITuple> it = skiline.iterator(); it.hasNext()
&& toBeAdded > 0;) {
ITuple t = it.next();
topk.add(t);
toBeAdded--;
}
}
i++;
}
return topk;
}
public static List<ITuple> topkPrefsPT(PreferencesGraph pg,
Map<String, Double> probabilisticModel, double p, int k) {
PreferencesGraph g = CombinationAlgorithms.combPrefsPT(pg,
probabilisticModel, p);
return getTopK(g, k);
}
public static List<ITuple> topkPrefsSort(PreferencesGraph pg,
Map<String, Double> probabilisticModel, int k) {
PreferencesGraph g = CombinationAlgorithms.combPrefsSort(pg,
probabilisticModel);
return getTopK(g, k);
}
}
| personalised-semantic-search/GSorsOx | GSorsOx/src/cs/ox/ac/uk/sors/TopKAlgorithms.java | Java | mit | 4,675 | [
30522,
7427,
20116,
1012,
23060,
1012,
9353,
1012,
2866,
1012,
2061,
2869,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
9140,
9863,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
23325,
2863,
2361,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
23... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (C) 2010-2011
* "Mu Lei" known as "NalaGinrut" <NalaGinrut@gmail.com>
* 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/>.
*/
#include <debug/trace.h>
#include <types.h>
#include <retval.h>
#include <cpu.h>
// FIXME: we implement this backtrace for IA32-convention,
// but we need a generic trace frameworks.
retval pcall_backtrace(frame_info_t fi ,u32_t dep_count)
{
/*
u32_t *frame=(u32_t*)get_frame_head();
u8_t frame_head=0,return_ip=1,args=2;
while(dep_count-- > 0)
{
kprintf("frame_head:%x\n"
"return_ip:%x\n"
"args:%x\n",
frame ,frame[return_ip] ,frame[args]);
frame=(u32_t*)frame[frame_head];
}
*/
return OK;
}
| NalaGinrut/mimosa | debug/trace.c | C | gpl-3.0 | 1,301 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2230,
1011,
2249,
1008,
1000,
14163,
26947,
1000,
2124,
2004,
1000,
6583,
17802,
2378,
22134,
1000,
1026,
6583,
17802,
2378,
22134,
1030,
20917,
4014,
1012,
4012,
1028,
1008,
2023,
2565,
2003... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Simple Reliable UDP (rudp)
* Copyright (c) 2009, Adrian Granados (agranados@ihmc.us)
* All rights reserved.
*
* 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 copyright holder 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
* HOLDERS AND 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.
*
*/
package u14.udpx.frames;
/*
* SYN Frame<br/>
* [flag|headerLength|seq|ack]
*/
public class SYNFrame extends Frame
{
protected SYNFrame()
{
}
public SYNFrame(int seqn)
{
init(SYN_FLAG, seqn, HEADER_LEN);
}
@Override
public byte[] getBytes() {
return sum(super.getBytes());
}
public String type()
{
return "SYN";
}
}
| chinayin/udpx | java_src/u14/udpx/frames/SYNFrame.java | Java | apache-2.0 | 2,057 | [
30522,
1013,
1008,
1008,
3722,
10539,
20904,
2361,
1006,
21766,
18927,
1007,
1008,
9385,
1006,
1039,
1007,
2268,
1010,
7918,
12604,
28118,
1006,
29542,
25389,
2891,
1030,
1045,
14227,
2278,
1012,
2149,
1007,
1008,
2035,
2916,
9235,
1012,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
// HLO instructions are in DAG form and represent the computations that the user
// has built up via the XLA service interface. They are ultimately lowered
// in a platform-aware way by traversing the HLO DAG and emitting a lowered
// form; e.g. see DfsHloVisitor.
#ifndef TENSORFLOW_COMPILER_XLA_SERVICE_HLO_INSTRUCTION_H_
#define TENSORFLOW_COMPILER_XLA_SERVICE_HLO_INSTRUCTION_H_
#include <functional>
#include <iosfwd>
#include <list>
#include <memory>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#include "absl/container/flat_hash_map.h"
#include "absl/container/flat_hash_set.h"
#include "absl/container/inlined_vector.h"
#include "absl/hash/hash.h"
#include "absl/memory/memory.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "absl/types/span.h"
#include "tensorflow/compiler/xla/comparison_util.h"
#include "tensorflow/compiler/xla/iterator_util.h"
#include "tensorflow/compiler/xla/literal.h"
#include "tensorflow/compiler/xla/map_util.h"
#include "tensorflow/compiler/xla/service/dfs_hlo_visitor.h"
#include "tensorflow/compiler/xla/service/hlo.pb.h"
#include "tensorflow/compiler/xla/service/hlo_clone_context.h"
#include "tensorflow/compiler/xla/service/hlo_domain_metadata.h"
#include "tensorflow/compiler/xla/service/hlo_opcode.h"
#include "tensorflow/compiler/xla/service/hlo_sharding.h"
#include "tensorflow/compiler/xla/service/name_uniquer.h"
#include "tensorflow/compiler/xla/shape_tree.h"
#include "tensorflow/compiler/xla/types.h"
#include "tensorflow/compiler/xla/xla_data.pb.h"
#include "tensorflow/core/lib/core/status.h"
#include "tensorflow/core/lib/gtl/iterator_range.h"
#include "tensorflow/core/platform/logging.h"
#include "tensorflow/core/platform/protobuf.h"
namespace xla {
class HloComputation;
class HloModule;
std::string PrintName(const std::string& name, bool print_ids);
// A bunch of switches that control how the hlo text should be printed.
class HloPrintOptions {
public:
enum class PrintSubcomputationMode {
kOff, // Do not print anything about subcomputations.
kNameOnly, // Only print the name of subcomputations.
kFullBodies, // Print the full bodies of subcomputations.
kNonSequentialBodies, // Print the full bodies of subcomputations that are
// not in a sequential context.
};
// Constructs the default print options: don't print large constants, don't
// compact operands, no indentation.
HloPrintOptions()
: print_large_constants_(false),
print_only_essential_constants_(false),
print_subcomputation_mode_(PrintSubcomputationMode::kNameOnly),
print_metadata_(true),
print_backend_config_(true),
print_infeed_outfeed_config_(true),
compact_operands_(false),
include_layout_in_shapes_(true),
print_result_shape_(true),
print_operand_shape_(true),
print_operand_names_(true),
print_operand_index_annotation_interval_(5),
print_program_shape_(true),
print_percent_(true),
print_control_dependencies_(true),
canonicalize_instruction_names_(false),
indent_amount_(0),
is_in_nested_computation_(false),
print_ids_(true),
canonicalize_computations_(false),
print_extra_attributes_(true) {}
static HloPrintOptions ShortParsable() {
return HloPrintOptions()
.set_print_large_constants(true)
.set_print_subcomputation_mode(PrintSubcomputationMode::kNameOnly)
.set_print_metadata(false)
.set_print_backend_config(false)
.set_print_operand_shape(false)
.set_print_operand_index_annotation_interval(0)
.set_print_program_shape(false)
.set_print_percent(false)
.set_print_control_dependencies(false);
}
// Options to produce the canonical string representing an isomorphic
// computation graph.
static HloPrintOptions Canonical() {
return HloPrintOptions()
.set_print_subcomputation_mode(PrintSubcomputationMode::kFullBodies)
.set_print_metadata(false)
.set_print_backend_config(false)
.set_compact_operands(false)
.set_print_operand_names(false)
.set_print_operand_shape(true)
.set_print_operand_index_annotation_interval(0)
.set_print_program_shape(false)
.set_print_percent(false)
.set_print_control_dependencies(false)
.set_canonicalize_instruction_names(true);
}
// Options to produce a fingerprint of an HLO.
static HloPrintOptions Fingerprint() {
return HloPrintOptions()
.set_print_subcomputation_mode(PrintSubcomputationMode::kFullBodies)
.set_print_metadata(false)
.set_print_backend_config(false)
.set_print_infeed_outfeed_config(false)
.set_print_only_essential_constants(true)
.set_compact_operands(true)
.set_print_operand_names(false)
.set_print_operand_shape(true)
.set_print_operand_index_annotation_interval(0)
.set_print_program_shape(false)
.set_print_percent(false)
.set_print_control_dependencies(false)
.set_canonicalize_instruction_names(true)
.set_print_ids(false)
.set_canonicalize_computations(true);
}
// If true, large constants will be printed out.
HloPrintOptions& set_print_large_constants(bool value) {
print_large_constants_ = value;
return *this;
}
// If true, only integer, all-zero, are all-one constants will be printed out.
HloPrintOptions& set_print_only_essential_constants(bool value) {
print_only_essential_constants_ = value;
return *this;
}
HloPrintOptions& set_print_subcomputation_mode(
PrintSubcomputationMode value) {
print_subcomputation_mode_ = value;
return *this;
}
// If true, metadata will be printed.
HloPrintOptions& set_print_metadata(bool value) {
print_metadata_ = value;
return *this;
}
// If true, backend_config will be printed.
HloPrintOptions& set_print_backend_config(bool value) {
print_backend_config_ = value;
return *this;
}
// If true, infeed_config and outfeed_config will be printed.
HloPrintOptions& set_print_infeed_outfeed_config(bool value) {
print_infeed_outfeed_config_ = value;
return *this;
}
// If true, result shapes will be printed.
HloPrintOptions& set_print_result_shape(bool value) {
print_result_shape_ = value;
return *this;
}
// If true, operands' shapes will be printed.
HloPrintOptions& set_print_operand_shape(bool value) {
print_operand_shape_ = value;
return *this;
}
// If true, operands' shapes will be printed.
HloPrintOptions& set_print_operand_index_annotation_interval(int64_t value) {
print_operand_index_annotation_interval_ = value;
return *this;
}
// If true, the operand names will be printed.
HloPrintOptions& set_print_operand_names(bool value) {
print_operand_names_ = value;
return *this;
}
// If true, all printed names include unique identifiers.
HloPrintOptions& set_print_ids(bool value) {
print_ids_ = value;
return *this;
}
// If true, the HLO includes its attributes.
HloPrintOptions& set_print_extra_attributes(bool value) {
print_extra_attributes_ = value;
return *this;
}
// If true, program shape of hlo computations will be printed.
HloPrintOptions& set_print_program_shape(bool value) {
print_program_shape_ = value;
return *this;
}
// If true, names will be printed with prefix '%'.
HloPrintOptions& set_print_percent(bool value) {
print_percent_ = value;
return *this;
}
// If true, control dependencies will be printed.
HloPrintOptions& set_print_control_dependencies(bool value) {
print_control_dependencies_ = value;
return *this;
}
// If true, only a part of operands will be printed out (note that in this
// case the text will not be parsable).
HloPrintOptions& set_compact_operands(bool value) {
compact_operands_ = value;
return *this;
}
// If true, include the layout in any shapes that are printed (instruction
// and operands).
HloPrintOptions& set_include_layout_in_shapes(bool value) {
include_layout_in_shapes_ = value;
return *this;
}
// If true, canonicalizes instructions' name. Instead of using "%foo.1" as
// the name of an instruction, we use "%tmp_1", "%tmp_2" etc.
HloPrintOptions& set_canonicalize_instruction_names(bool value) {
canonicalize_instruction_names_ = value;
return *this;
}
// If true, canonicalizes computations, sorting by computations' names.
HloPrintOptions& set_canonicalize_computations(bool value) {
canonicalize_computations_ = value;
return *this;
}
// The indent of the hlo text block.
HloPrintOptions& set_indent_amount(int value) {
indent_amount_ = value;
return *this;
}
// If true, indicates the instruction being printed is inside a nested
// computation.
HloPrintOptions& set_is_in_nested_computation(bool value) {
is_in_nested_computation_ = value;
return *this;
}
// Instructions are selected for printing by a predicate function
// (`set_print_instructions`). We also print their surrounding instructions
// for ease of reading. We print `leading_and_trailing_instructions_number`
// instructions before and after the qualified ones inside a computation.
HloPrintOptions& set_leading_and_trailing_instructions_number(int value) {
leading_and_trailing_instructions_number_ = value;
return *this;
}
// A callback which takes an HloInstruction*, its string representation,
// the indentation level of the resulting block, and a
// bool variable indicating whether the instruction is root or not. The return
// value is a string which is used for this instruction during printing.
using FormatInstructionFunc = std::function<std::string(
const HloInstruction*, const std::string&, int, bool)>;
HloPrintOptions& set_format_instruction(FormatInstructionFunc callback) {
format_instruction_ = callback;
return *this;
}
using HloInstructionPredicate = std::function<bool(const HloInstruction*)>;
// A callback which takes an HloInstruction* and returns whether it should be
// printed or not.
HloPrintOptions& set_print_instruction(HloInstructionPredicate callback) {
print_instruction_ = callback;
return *this;
}
using HloComputationPredicate = std::function<bool(const HloComputation*)>;
// A callback which takes an HloComputation* and returns whether it should be
// printed or not.
HloPrintOptions& set_print_computation(HloComputationPredicate callback) {
print_computation_ = callback;
return *this;
}
bool print_large_constants() const { return print_large_constants_; }
bool print_only_essential_constants() const {
return print_only_essential_constants_;
}
PrintSubcomputationMode print_subcomputation_mode() const {
return print_subcomputation_mode_;
}
bool print_metadata() const { return print_metadata_; }
bool print_backend_config() const { return print_backend_config_; }
bool print_infeed_outfeed_config() const {
return print_infeed_outfeed_config_;
}
bool compact_operands() const { return compact_operands_; }
bool include_layout_in_shapes() const { return include_layout_in_shapes_; }
bool print_result_shape() const { return print_result_shape_; }
bool print_operand_shape() const { return print_operand_shape_; }
bool print_operand_names() const { return print_operand_names_; }
int64_t print_operand_index_annotation_interval() const {
return print_operand_index_annotation_interval_;
}
bool print_ids() const { return print_ids_; }
bool print_program_shape() const { return print_program_shape_; }
bool print_percent() const { return print_percent_; }
bool print_control_dependencies() const {
return print_control_dependencies_;
}
bool print_extra_attributes() const { return print_extra_attributes_; }
bool canonicalize_instruction_names() const {
return canonicalize_instruction_names_;
}
bool canonicalize_computations() const { return canonicalize_computations_; }
int indent_amount() const { return indent_amount_; }
int is_in_nested_computation() const { return is_in_nested_computation_; }
int leading_and_trailing_instructions_number() const {
return leading_and_trailing_instructions_number_;
}
std::string format_instruction(const HloInstruction* instr,
const std::string& instr_name, int indent,
bool is_root) const {
return format_instruction_(instr, instr_name, indent, is_root);
}
bool print_instruction(const HloInstruction* instr) const {
return print_instruction_(instr);
}
bool print_computation(const HloComputation* comp) const {
return print_computation_(comp);
}
private:
bool print_large_constants_;
bool print_only_essential_constants_;
PrintSubcomputationMode print_subcomputation_mode_;
bool print_metadata_;
bool print_backend_config_;
bool print_infeed_outfeed_config_;
bool compact_operands_;
bool include_layout_in_shapes_;
bool print_result_shape_;
bool print_operand_shape_;
bool print_operand_names_;
// The interval between the /*index=*/ annotated operands. 0 means never print
// the annotation, 1 means print annotation for every operand.
int64_t print_operand_index_annotation_interval_;
bool print_program_shape_;
bool print_percent_;
bool print_control_dependencies_;
bool canonicalize_instruction_names_;
int indent_amount_;
bool is_in_nested_computation_;
bool print_ids_;
bool canonicalize_computations_;
bool print_extra_attributes_;
int leading_and_trailing_instructions_number_ = 3;
FormatInstructionFunc format_instruction_ = [](const HloInstruction* instr,
const std::string& instr_name,
int indent, bool is_root) {
return absl::StrCat(std::string(2 * indent, ' '), is_root ? "ROOT " : "",
instr_name);
};
HloInstructionPredicate print_instruction_ = [](const HloInstruction* instr) {
return true;
};
HloComputationPredicate print_computation_ = [](const HloComputation* comp) {
return true;
};
};
// For canonical string output, we need to have a canonical way to rename
// each instruction and its operands. Each operand is renamed as "tmp_<xxx>",
// where <xxx> is an index starting from 0.
class CanonicalNameMap {
public:
CanonicalNameMap() : index(0) {}
std::string LookupOrInsert(const std::string& old_name) {
auto iter = canonical_name_map.find(old_name);
if (iter != canonical_name_map.end()) {
return iter->second;
}
std::string new_name = absl::StrCat("tmp_", index++);
canonical_name_map[old_name] = new_name;
return new_name;
}
void Clear() {
canonical_name_map.clear();
index = 0;
}
private:
int64_t index;
absl::flat_hash_map<std::string, std::string> canonical_name_map;
};
// HLO instructions are the atomic unit of the high-level compiler's IR.
//
// HloInstructions live inside of an HloComputation, which is analogous to a
// function in other programming languages. Nodes have no total order within
// their computation. Instead, they have a partial ordering determined by their
// data and control dependencies.
//
// HLO does not have basic blocks or explicit "branch" instructions. Instead,
// certain HloInstructions -- namely, kWhile, kConditional, and kCall -- encode
// control flow. For example, the kConditional HLO executes one of two possible
// computations, depending on the runtime value of a predicate.
//
// HLO is pure (mostly). It has no concept of mutable state. Instead, data
// values are produced by one HLO and flow into consumers across dependency
// edges.
class HloInstruction {
public:
// A fusion node computes the same value a call to its fusion computation
// would compute. However, the choice of fusion kind dictates codegen
// strategy for the backend.
//
// To generate code for a kFusion HloInstruction, most backends do something
// like the following:
//
// 1) Identify the "primary" HloInstruction of the fused computation.
// 2) Emit code that does the work of the primary node, creating its inputs
// and transforming its outputs as specified by the fused computation.
//
// In step (2), the code emitted is usually similar to the code that would be
// emitted for an *unfused* version of the primary node, except that
//
// - when the primary node reads an element of one of its operands, instead
// of loading the value from memory, it *computes* the value based on the
// contents of the fused computation.
// - when the primary node outputs a value, instead of storing it to memory,
// it forwards the value to its users, which then perform additional
// computations before the value is finally stored to memory at the root of
// the fusion node.
//
// An HloInstruction's FusionKind helps us find the kFusion instruction's
// primary node, and can also affect how we generate code in step (2).
//
// - kInput: The primary node is the root of the fused instruction.
//
// - kOutput: The primary node is not the root of the fused instruction.
// This fusion kind requires that one operand buffer of the fusion
// instruction be able to alias the output buffer. This constraint is
// usually enough to let backends find the primary node unambiguously.
//
// - kLoop: The primary node is the root of the fused computation, but,
// unlike in input fusion, we prescribe a specific implementation for
// codegen. Rather than generating code that looks like the code we'd emit
// for an unfused version of the primary/root node, we emit code that
// generates one element of the root at a time.
//
// - kCustom: Custom category for backend-specific fusions that don't fit
// into the above patterns.
//
// Not all backends support all fusion kinds, and given a particular fused
// computation, it's not in general safe to change its fusion kind. Creation
// of fusion nodes is always backend-specific.
//
// For elementwise ops (e.g. kAdd), most backends would emit a
// one-element-at-a-time implementation for the unfused version, so loop
// fusion and input fusion are probably equivalent if the root node is
// elementwise. They're not necessarily equivalent e.g. for kReduce, where an
// implementation might emit something more sophisticated for an unfused or
// input-fusion reduce, but will emit the naive code that reduces one element
// at a time for loop fusion with a reduce as the root.
//
// Another way to think of loop fusion is that it's equivalent to input
// fusion, but where the root node is an implicit identity node, whose
// unfused implementation is "read one element, write one element".
//
// TODO(b/79869434): This categorization scheme is not great. For one thing,
// input and loop fusion are basically the same thing: There is no reason for
// the HLO to encode backend-specific decisions about how e.g. a reduce that's
// the root of a fusion should be lowered. In addition, this scheme as
// written doesn't work for multi-output fusion, where the primary node is
// never actually the root (which is a kTuple instruction that gathers the
// multiple outputs of the fusion).
enum class FusionKind {
kLoop,
kInput,
kOutput,
kCustom,
};
virtual ~HloInstruction() { DetachFromOperandsAndUsers(); }
// Detaches an instruction from its operands and users. That is, remove the
// instruction from each operand's user set and user's operand set.
void DetachFromOperandsAndUsers();
// Creates an instruction from the given proto. Arguments:
//
// proto: the proto to convert from.
// instruction_map: a map from instruction id to HloInstruction*. This map
// must contain all operands of the newly constructed instruction.
// computation_map: a map from computation id to HloComputation*. This map
// must contain all computations which the newly constructed instruction
// calls.
static StatusOr<std::unique_ptr<HloInstruction>> CreateFromProto(
const HloInstructionProto& proto,
const absl::flat_hash_map<int64_t, HloInstruction*>& instruction_map,
const absl::flat_hash_map<int64_t, HloComputation*>& computation_map = {},
bool prohibit_empty_literal = true);
// Creates a parameter-retrieving instruction.
static std::unique_ptr<HloInstruction> CreateParameter(
int64_t parameter_number, const Shape& shape, const std::string& name);
// Creates a literal constant instruction.
static std::unique_ptr<HloInstruction> CreateConstant(Literal literal);
// Creates an Iota instruction.
static std::unique_ptr<HloInstruction> CreateIota(const Shape& shape,
int64_t iota_dimension);
// Creates a get tuple element instruction.
static std::unique_ptr<HloInstruction> CreateGetTupleElement(
const Shape& shape, HloInstruction* operand, int64_t index);
// Creates a get tuple element instruction.
static std::unique_ptr<HloInstruction> CreateGetTupleElement(
HloInstruction* operand, int64_t index);
// Creates a trace instruction that logs the input operand in the computation.
static std::unique_ptr<HloInstruction> CreateTrace(const std::string& tag,
HloInstruction* operand);
// Creates a random number generation instruction that fills a shape with
// random numbers from a given distribution.
//
// The parameters to the instruction are interpreted as follows:
//
// - If `distribution` is RNG_UNIFORM, generates a number in range
// [param0, param1).
//
// - If `distribution` is RNG_NORMAL, generates a normally-distributed value
// with mean `param0` and standard deviation `param1`.
static std::unique_ptr<HloInstruction> CreateRng(
const Shape& shape, RandomDistribution distribution,
absl::Span<HloInstruction* const> parameters);
// Creates a stateless random bit generator instruction that fills a shape
// with random bits.
static std::unique_ptr<HloInstruction> CreateRngBitGenerator(
const Shape& shape, HloInstruction* state, RandomAlgorithm algorithm);
// Creates an instruction to update the random number generator state to
// reflect the new state after `delta` units of 32 random bits are generated
// and returns the old state.
static std::unique_ptr<HloInstruction> CreateRngGetAndUpdateState(
const Shape& shape, int64_t delta);
// Creates a unary instruction (one operand).
// Precondition: opcode must be a legitimate unary operation.
static std::unique_ptr<HloInstruction> CreateUnary(const Shape& shape,
HloOpcode opcode,
HloInstruction* operand);
// Creates a binary instruction (two operands).
// Precondition: opcode must be a legitimate binary operation.
static std::unique_ptr<HloInstruction> CreateBinary(const Shape& shape,
HloOpcode opcode,
HloInstruction* lhs,
HloInstruction* rhs);
// Creates a ternary instruction (three operands).
// Precondition: opcode must be a legitimate ternary operation.
static std::unique_ptr<HloInstruction> CreateTernary(const Shape& shape,
HloOpcode opcode,
HloInstruction* lhs,
HloInstruction* rhs,
HloInstruction* ehs);
// Creates a variadic instruction (variable number of operands).
// Precondition: opcode must be a legitimate variadic operation.
static std::unique_ptr<HloInstruction> CreateVariadic(
const Shape& shape, HloOpcode opcode,
absl::Span<HloInstruction* const> operands);
// Creates a map instruction, where the computation (given by the handle) is
// applied element-wise to every element in operands (across the operands,
// at a given index)
static std::unique_ptr<HloInstruction> CreateMap(
const Shape& shape, absl::Span<HloInstruction* const> operands,
HloComputation* map_computation);
// Creates a convolution op, where rhs is the convolutional filter
// and window describes how the filter is applied to lhs.
static std::unique_ptr<HloInstruction> CreateConvolve(
const Shape& shape, HloInstruction* lhs, HloInstruction* rhs,
int64_t feature_group_count, int64_t batch_group_count,
const Window& window,
const ConvolutionDimensionNumbers& dimension_numbers,
const PrecisionConfig& precision_config);
// Creates an FFT op, of the type indicated by fft_type.
static std::unique_ptr<HloInstruction> CreateFft(
const Shape& shape, HloInstruction* operand, FftType fft_type,
absl::Span<const int64_t> fft_length);
// Creates a copy-start op, indicating whether this is a cross-program
// prefetch or not.
static std::unique_ptr<HloInstruction> CreateCopyStart(
const Shape& shape, HloInstruction* operand,
bool is_cross_program_prefetch = false);
// Creates a compare op, performing the comparison specified in direction.
static std::unique_ptr<HloInstruction> CreateCompare(
const Shape& shape, HloInstruction* lhs, HloInstruction* rhs,
Comparison::Direction direction,
absl::optional<Comparison::Type> type = absl::nullopt);
static std::unique_ptr<HloInstruction> CreateTriangularSolve(
const Shape& shape, HloInstruction* a, HloInstruction* b,
const TriangularSolveOptions& options);
static std::unique_ptr<HloInstruction> CreateCholesky(
const Shape& shape, HloInstruction* a, const CholeskyOptions& options);
// Creates a dot op with operands 'lhs' and 'rhs' with contracting and batch
// dimensions specified in 'dimension_numbers'.
static std::unique_ptr<HloInstruction> CreateDot(
const Shape& shape, HloInstruction* lhs, HloInstruction* rhs,
const DotDimensionNumbers& dimension_numbers,
const PrecisionConfig& precision_config);
// Creates a reduce-precision op, where operand is the data to reduce in
// precision, and exponent_bits and mantissa_bits describe the precision to
// reduce it to.
static std::unique_ptr<HloInstruction> CreateReducePrecision(
const Shape& shape, HloInstruction* operand, const int exponent_bits,
const int mantissa_bits);
// Creates an all-gather op, which concats the operands of all participants
// along all_gather_dimension. The replica_groups, channel_id, and
// use_global_device_ids arguments are identical to those in all-reduce,
// except that the order of the group members determines the concatenation
// order of inputs from different participants.
static std::unique_ptr<HloInstruction> CreateAllGather(
const Shape& shape, absl::Span<HloInstruction* const> operands,
int64_t all_gather_dimension,
absl::Span<const ReplicaGroup> replica_groups, bool constrain_layout,
const absl::optional<int64_t>& channel_id, bool use_global_device_ids);
// Creates an all-gather-start op, which concats the operands of all
// participants
// along all_gather_dimension. The replica_groups, channel_id, and
// use_global_device_ids arguments are identical to those in all-reduce,
// except that the order of the group members determines the concatenation
// order of inputs from different participants. Needs to be used in
// conjunction of a AllGatherDone op that synchronizes and returns the result.
static std::unique_ptr<HloInstruction> CreateAllGatherStart(
const Shape& shape, absl::Span<HloInstruction* const> operands,
int64_t all_gather_dimension,
absl::Span<const ReplicaGroup> replica_groups, bool constrain_layout,
const absl::optional<int64_t>& channel_id, bool use_global_device_ids);
// Creates a cross replica reduction op.
//
// `reduction_computation`: the reduction function.
//
// `replica_groups`: each ReplicaGroup contains a list of replica id. If
// empty, all replicas belong to one group in the order of 0 - (n-1).
// Allreduce will be applied within subgroups.
// For example, we have 4 replicas, then replica_groups={{0,2},{1,3}} means,
// replica 0 and 2 are in subgroup 0, replica 1 and 3 are in subgroup 1.
//
// `channel_id`: for Allreduce nodes from different modules, if
// they have the same channel_id, they will be 'Allreduce'd. If
// empty, Allreduce will not be applied cross modules.
static std::unique_ptr<HloInstruction> CreateAllReduce(
const Shape& shape, absl::Span<HloInstruction* const> operands,
HloComputation* reduce_computation,
absl::Span<const ReplicaGroup> replica_groups, bool constrain_layout,
const absl::optional<int64_t>& channel_id, bool use_global_device_ids);
// Creates a reduce-scatter operation which reduces its inputs across the
// given replica groups and then scatters the reduced data across the N
// participants.
static std::unique_ptr<HloInstruction> CreateReduceScatter(
const Shape& shape, absl::Span<HloInstruction* const> operands,
HloComputation* reduce_computation,
absl::Span<const ReplicaGroup> replica_groups, bool constrain_layout,
const absl::optional<int64_t>& channel_id, bool use_global_device_ids,
int64_t scatter_dimension);
// Creates an asynchronous cross replica reduction op.
//
// `reduction_computation`: the reduction function.
//
// `replica_groups`: each ReplicaGroup contains a list of replica id. If
// empty, all replicas belong to one group in the order of 0 - (n-1).
// Allreduce will be applied within subgroups.
// For example, we have 4 replicas, then replica_groups={{0,2},{1,3}} means,
// replica 0 and 2 are in subgroup 0, replica 1 and 3 are in subgroup 1.
//
// `channel_id`: for Allreduce nodes from different modules, if
// they have the same channel_id, they will be 'Allreduce'd. If
// empty, Allreduce will not be applied cross modules.
static std::unique_ptr<HloInstruction> CreateAllReduceStart(
const Shape& shape, absl::Span<HloInstruction* const> operands,
HloComputation* reduce_computation,
absl::Span<const ReplicaGroup> replica_groups, bool constrain_layout,
const absl::optional<int64_t>& channel_id, bool use_global_device_ids);
// An all-to-all op takes N array operands of the same shape and scatters them
// to N replicas. Each replica gathers the results into a tuple.
//
// For example, suppose we have 3 replicas, with replica i passing inputs
// [a_i, b_i, c_i] to its all-to-all op. Then the resulting tuples are
//
// replica 0: (a_0, a_1, a_2)
// replica 1: (b_0, b_1, b_2)
// replica 2: (c_0, c_1, c_2).
//
// If replica_groups is set, the op is sharded and the replicas are permuted.
// To explain by way of example, suppose we have replica_groups={{1,2},{3,0}}.
// Then each replica passes two operands, say [a_i, b_i], and the result is
//
// replica 0: (b_3, b_0)
// replica 1: (a_1, a_2)
// replica 2: (b_1, b_2)
// replica 3: (a_3, a_0).
//
// All replica groups must have the same number of elements, and the number of
// operands must be equal to the size of one replica group. Each replica must
// appear in exactly one group.
//
// Note that this instruction is different than the all-to-all op in
// xla_builder.h. The version in XlaBuilder takes one input and slices it,
// and then concatenates the results into a single array. This instruction
// takes multiple inputs and returns a tuple; it doesn't slice or concatenate.
// It is used to implement the higher-level instruction in XlaBuilder.
static std::unique_ptr<HloInstruction> CreateAllToAll(
const Shape& shape, absl::Span<HloInstruction* const> operands,
absl::Span<const ReplicaGroup> replica_groups, bool constrain_layout,
const absl::optional<int64_t>& channel_id,
const absl::optional<int64_t>& split_dimension = absl::nullopt);
// Creates a communication instruction that permutes data cross replicas.
// Data is sent/received according to the (source_replica_id,
// target_replica_id) pairs in `source_target_pairs`. If a replica id is not a
// target_replica_id in any pair, the output on that replica is a tensor
// consists of 0(s) in `shape`.
static std::unique_ptr<HloInstruction> CreateCollectivePermute(
const Shape& shape, HloInstruction* operand,
const std::vector<std::pair<int64_t, int64_t>>& source_target_pairs,
const absl::optional<int64_t>& channel_id);
static std::unique_ptr<HloInstruction> CreateCollectivePermute(
const Shape& shape, HloInstruction* input, HloInstruction* output,
HloInstruction* input_start_indices, HloInstruction* output_start_indices,
absl::Span<const std::pair<int64_t, int64_t>> source_target_pairs,
absl::Span<const std::vector<int64_t>> slice_sizes,
const absl::optional<int64_t>& channel_id);
// Creates a communication instruction that initiates the start of
// CollectivePermute.
static std::unique_ptr<HloInstruction> CreateCollectivePermuteStart(
const Shape& shape, HloInstruction* operand,
const std::vector<std::pair<int64_t, int64_t>>& source_target_pairs,
const absl::optional<int64_t>& channel_id);
static std::unique_ptr<HloInstruction> CreateCollectivePermuteStart(
const Shape& shape, HloInstruction* input, HloInstruction* output,
HloInstruction* input_start_indices, HloInstruction* output_start_indices,
absl::Span<const std::pair<int64_t, int64_t>> source_target_pairs,
absl::Span<const std::vector<int64_t>> slice_sizes,
const absl::optional<int64_t>& channel_id);
// Creates an instruction that returns a U32 replica ID.
static std::unique_ptr<HloInstruction> CreateReplicaId(
const Shape& shape = ShapeUtil::MakeShape(U32, {}));
// Creates an instruction that returns a U32 partition ID.
static std::unique_ptr<HloInstruction> CreatePartitionId(
const Shape& shape = ShapeUtil::MakeShape(U32, {}));
// Creates a conversion instruction, where operand is the data to convert and
// shape is the target shape for the conversion.
static std::unique_ptr<HloInstruction> CreateConvert(const Shape& shape,
HloInstruction* operand);
// Creates a bitcast instruction, where operand is the data to
// convert and shape is the target shape for the conversion.
static std::unique_ptr<HloInstruction> CreateBitcast(const Shape& shape,
HloInstruction* operand);
// Creates a bitcast conversion instruction, where operand is the data to
// convert and shape is the target shape for the conversion.
static std::unique_ptr<HloInstruction> CreateBitcastConvert(
const Shape& shape, HloInstruction* operand);
// Creates an infeed instruction, which reads data of the given shape from the
// Infeed interface of the device. infeed_shape is the shape of the data
// received from the infeed *not* the shape of the infeed instruction which
// is a tuple containing the infeed_shape and the TOKEN.
static std::unique_ptr<HloInstruction> CreateInfeed(
const Shape& infeed_shape, HloInstruction* token_operand,
const std::string& config);
// Creates an outfeed instruction, which outputs data. outfeed_shape is the
// shape of the data being outfed *not* the shape of the outfeed instruction
// which is a TOKEN.
static std::unique_ptr<HloInstruction> CreateOutfeed(
const Shape& outfeed_shape, HloInstruction* operand,
HloInstruction* token_operand, absl::string_view outfeed_config);
// Creates an asynchronous send instruction with the given channel id, which
// initiates sending the operand data to a unique receive instruction in
// another computation that has the same channel id. If is_host_transfer is
// true, then this Send operation transfers data to the host.
static std::unique_ptr<HloInstruction> CreateSend(
HloInstruction* operand, HloInstruction* token, int64_t channel_id,
bool is_host_transfer = false);
// Blocks until data transfer for the Send instruction (operand) is complete.
// The operand must be kSend.
static std::unique_ptr<HloInstruction> CreateSendDone(
HloInstruction* operand, bool is_host_transfer = false);
// Creates an asynchronous receive instruction with the given channel id,
// which allocates resources to receive data of the given shape from a unique
// send instruction in another computation that has the same channel id. If
// is_host_transfer is true, then this Send operation transfers data from the
// host.
static std::unique_ptr<HloInstruction> CreateRecv(
const Shape& shape, HloInstruction* token, int64_t channel_id,
bool is_host_transfer = false);
// Blocks until data transfer for the Recv instruction (operand) is complete
// and returns the receive buffer. The operand must be kRecv.
static std::unique_ptr<HloInstruction> CreateRecvDone(
HloInstruction* operand, bool is_host_transfer = false);
// Creates a slice instruction, where the operand is sliced by the given
// start/limit indices.
static std::unique_ptr<HloInstruction> CreateSlice(
const Shape& shape, HloInstruction* operand,
absl::Span<const int64_t> start_indices,
absl::Span<const int64_t> limit_indices,
absl::Span<const int64_t> strides);
// Creates a slice instruction, where the first operand is sliced by
// start indices specified in the second operand, and by size specified in
// 'slice_sizes'.
static std::unique_ptr<HloInstruction> CreateDynamicSlice(
const Shape& shape, HloInstruction* operand,
absl::Span<HloInstruction* const> start_indices,
absl::Span<const int64_t> slice_sizes);
// Creates a dynamic update slice instruction, which updates a slice
// of 'operand' with 'update' and 'start_indices'.
static std::unique_ptr<HloInstruction> CreateDynamicUpdateSlice(
const Shape& shape, HloInstruction* operand, HloInstruction* update,
absl::Span<HloInstruction* const> start_indices);
// Creates a concatenate instruction, where the operands are concatenated on
// the provided dimension.
static std::unique_ptr<HloInstruction> CreateConcatenate(
const Shape& shape, absl::Span<HloInstruction* const> operands,
int64_t dimension);
// Creates a reduce instruction, where the computation (given by the handle)
// is applied successively to every element in operand. For example, let f be
// the function to apply, which takes 2 arguments, an accumulator and the
// current value. Let init be an initial value (which is normally chosen to be
// the identity element for f, e.g. 0 if f is addition).
// Then the reduce HLO will compute:
// f(f(init, value0), value1), ...)
static std::unique_ptr<HloInstruction> CreateReduce(
const Shape& shape, HloInstruction* operand, HloInstruction* init_value,
absl::Span<const int64_t> dimensions_to_reduce,
HloComputation* reduce_computation);
// A more general, multiple-argument version of the above.
// The function to apply, f, now takes N arguments:
// [accumulator0, accumulator1, ..., accumulatorN, value0, value1, ...,
// init_valueN], and returns an N-tuple. The performed computation is (for
// commutative and associative f operators) equivalent to:
//
// f_1 = f(init0, ... initN, input0.value0, ..., inputN.value0)
// f_2 = f(f_1.tuple_element(0), ..., f_1.tuple_element(N), input0.value1,
// ..., inputN.value1)
// ...
static std::unique_ptr<HloInstruction> CreateReduce(
const Shape& shape, absl::Span<HloInstruction* const> operands,
absl::Span<HloInstruction* const> init_values,
absl::Span<const int64_t> dimensions_to_reduce,
HloComputation* reduce_computation);
// Helper version where the operands are given by a single instruction which
// either is a tuple of size `init_values`, or a single input, in which case
// size of `init_values` is one.
static std::unique_ptr<HloInstruction> CreateReduce(
const Shape& shape, HloInstruction* tuple_of_instructions,
absl::Span<HloInstruction* const> init_values,
absl::Span<const int64_t> dimensions_to_reduce,
HloComputation* reduce_computation);
// Creates a reduce-window instruction, where the computation (given
// by the handle) is applied window-wise at each valid window
// position in the operand.
static std::unique_ptr<HloInstruction> CreateReduceWindow(
const Shape& shape, HloInstruction* operand, HloInstruction* init_value,
const Window& window, HloComputation* reduce_computation);
// A more general, multiple-argument version of the above.
// The reduce_computation being applied,now takes N arguments:
// [accumulator0, accumulator1, ..., accumulatorN, value0, value1, ...,
// valueN], and returns an N-tuple. The operands and init_values now each
// contain a span of N input arrays and n initial values.
static std::unique_ptr<HloInstruction> CreateReduceWindow(
const Shape& shape, absl::Span<HloInstruction* const> operands,
absl::Span<HloInstruction* const> init_values, const Window& window,
HloComputation* reduce_computation);
// Creates a batch-norm-training instruction.
static std::unique_ptr<HloInstruction> CreateBatchNormTraining(
const Shape& shape, HloInstruction* operand, HloInstruction* scale,
HloInstruction* offset, float epsilon, int64_t feature_index);
// Creates a batch-norm-inference instruction.
static std::unique_ptr<HloInstruction> CreateBatchNormInference(
const Shape& shape, HloInstruction* operand, HloInstruction* scale,
HloInstruction* offset, HloInstruction* mean, HloInstruction* variance,
float epsilon, int64_t feature_index);
// Creates a batch-norm-grad instruction.
static std::unique_ptr<HloInstruction> CreateBatchNormGrad(
const Shape& shape, HloInstruction* operand, HloInstruction* scale,
HloInstruction* mean, HloInstruction* variance,
HloInstruction* grad_output, float epsilon, int64_t feature_index);
// Creates a scatter computation that scatters the `source` array to the
// selected indices of each window.
static std::unique_ptr<HloInstruction> CreateSelectAndScatter(
const Shape& shape, HloInstruction* operand, HloComputation* select,
const Window& window, HloInstruction* source, HloInstruction* init_value,
HloComputation* scatter);
// Creates a broadcast instruction.
static std::unique_ptr<HloInstruction> CreateBroadcast(
const Shape& shape, HloInstruction* operand,
absl::Span<const int64_t> broadcast_dimensions);
// Creates a sequence of instructions that performs an explicit broadcast of
// the operand to the target shape.
//
// Interior HLOs are passed to "adder", but the "root" HLO of the sequence is
// returned as a unique_ptr for API consistency with other factory methods in
// this interface.
//
// TODO(b/72173833) Ideally HloComputations would always be present, and so
// the adder being passed by the caller would not be necessary.
static std::unique_ptr<HloInstruction> CreateBroadcastSequence(
const Shape& output_shape, HloInstruction* operand,
const std::function<HloInstruction*(std::unique_ptr<HloInstruction>)>&
adder);
// Creates a pad instruction, where the operand is padded on the edges and
// between the elements with the given padding value.
static std::unique_ptr<HloInstruction> CreatePad(
const Shape& shape, HloInstruction* operand,
HloInstruction* padding_value, const PaddingConfig& padding_config);
// Creates a reshape instruction, where the operand is flattened row-major
// order and then reshaped to the given result shape.
static std::unique_ptr<HloInstruction> CreateReshape(
const Shape& shape, HloInstruction* operand,
int64_t inferred_dimension = -1);
// Creates a dynamic reshape instruction. Similar to reshape but dynamic
// dimensions sizes are provided as additional variadic arguments.
//
// Precondition: dim_sizes.size() == shape.rank()
static std::unique_ptr<HloInstruction> CreateDynamicReshape(
const Shape& shape, HloInstruction* data_operand,
absl::Span<HloInstruction* const> dim_sizes);
// Creates a transpose instruction which permutes the operand dimensions.
static std::unique_ptr<HloInstruction> CreateTranspose(
const Shape& shape, HloInstruction* operand,
absl::Span<const int64_t> dimensions);
// Creates a n-ary sort op with a 'compare' computation which is used for
// comparisons in the sorting algorithm. 'compare' gets 2 * n parameters,
// where parameters 2 * i and 2 * i + 1 are the values of the i-th operand at
// specific index positions which should be compared, and should return a
// PRED. 'is_stable' specifies whether stable sorting is required.
static std::unique_ptr<HloInstruction> CreateSort(
const Shape& shape, int64_t dimension,
absl::Span<HloInstruction* const> operands, HloComputation* compare,
bool is_stable);
// Creates a while instruction, given a condition computation, a body
// computation, and the initial value for the input of the computations. For
// example, shape: S32, condition: i -> i < 1000, body: i -> i * 2, init: 1
// corresponds to the C code below.
// int32_t i = 1; int32_t result = while(i < 1000) { i = i * 2 }
static std::unique_ptr<HloInstruction> CreateWhile(const Shape& shape,
HloComputation* condition,
HloComputation* body,
HloInstruction* init);
static std::unique_ptr<HloInstruction> CreateConditional(
const Shape& shape, HloInstruction* pred,
HloInstruction* true_computation_arg, HloComputation* true_computation,
HloInstruction* false_computation_arg, HloComputation* false_computation);
static std::unique_ptr<HloInstruction> CreateConditional(
const Shape& shape, HloInstruction* branch_index,
absl::Span<HloComputation* const> branch_computations,
absl::Span<HloInstruction* const> branch_computation_args);
static std::unique_ptr<HloInstruction> CreateGather(
const Shape& shape, HloInstruction* operand,
HloInstruction* start_indices,
const GatherDimensionNumbers& gather_dim_numbers,
absl::Span<const int64_t> slice_sizes, bool indices_are_sorted);
static std::unique_ptr<HloInstruction> CreateScatter(
const Shape& shape, HloInstruction* operand,
HloInstruction* scatter_indices, HloInstruction* updates,
HloComputation* update_computation,
const ScatterDimensionNumbers& scatter_dim_numbers,
bool indices_are_sorted, bool unique_indices);
// Creates a kDomain instruction which delimits an HLO domain which have
// the provided user and operand side metadata.
static std::unique_ptr<HloInstruction> CreateDomain(
const Shape& shape, HloInstruction* operand,
std::unique_ptr<DomainMetadata> operand_side_metadata,
std::unique_ptr<DomainMetadata> user_side_metadata);
// Creates a fusion instruction. A fusion instruction contains one or more
// fused instructions forming an expression with a single root
// "fused_root". Additional instructions can be added to the fusion
// instruction with the method FuseInstruction.
static std::unique_ptr<HloInstruction> CreateFusion(
const Shape& shape, FusionKind fusion_kind, HloInstruction* fused_root);
static std::unique_ptr<HloInstruction> CreateFusion(
const Shape& shape, FusionKind fusion_kind,
absl::Span<HloInstruction* const> operands,
HloComputation* fusion_computation);
// Creates a call instruction that applies the given computation on the given
// operands. "shape" is the resultant shape.
static std::unique_ptr<HloInstruction> CreateCall(
const Shape& shape, absl::Span<HloInstruction* const> operands,
HloComputation* computation);
// Creates a custom call instruction that applies the given custom call target
// to the given operands. "opaque" can be an arbitrary string with a
// backend-specific interpretation. "shape" is the resultant shape.
static std::unique_ptr<HloInstruction> CreateCustomCall(
const Shape& shape, absl::Span<HloInstruction* const> operands,
absl::string_view custom_call_target, std::string opaque = "",
CustomCallApiVersion api_version = API_VERSION_ORIGINAL);
// Overload with a to_apply computation.
static std::unique_ptr<HloInstruction> CreateCustomCall(
const Shape& shape, absl::Span<HloInstruction* const> operands,
HloComputation* to_apply, absl::string_view custom_call_target,
std::string opaque = "",
CustomCallApiVersion api_version = API_VERSION_ORIGINAL);
// Overload with multiple computations. The called computations can have
// different function signatures.
static std::unique_ptr<HloInstruction> CreateCustomCall(
const Shape& shape, absl::Span<HloInstruction* const> operands,
absl::Span<HloComputation* const> called_computations,
absl::string_view custom_call_target, std::string opaque = "",
CustomCallApiVersion api_version = API_VERSION_ORIGINAL);
// Overload which constrains the layouts of the operand and result. 'shape'
// and 'operand_shapes_with_layout' must have layouts.
// 'operand_shapes_with_layout' must have a compatible element for each
// operand.
static std::unique_ptr<HloInstruction> CreateCustomCall(
const Shape& shape, absl::Span<HloInstruction* const> operands,
absl::string_view custom_call_target,
absl::Span<const Shape> operand_shapes_with_layout,
std::string opaque = "",
CustomCallApiVersion api_version = API_VERSION_ORIGINAL);
// Creates a tuple instruction with the given elements. This is a convenience
// wrapper around CreateVariadic.
static std::unique_ptr<HloInstruction> CreateTuple(
absl::Span<HloInstruction* const> elements);
// Creates a reverse instruction, which reverses the order of the elements
// in the specified dimensions.
static std::unique_ptr<HloInstruction> CreateReverse(
const Shape& shape, HloInstruction* operand,
absl::Span<const int64_t> dimensions);
// Creates a Afterall instruction used for joining or creating new values of
// token type which thread through side-effecting operations. Operands must
// all be tokens, and there must be at least one operand.
static std::unique_ptr<HloInstruction> CreateAfterAll(
absl::Span<HloInstruction* const> operands);
// Creates an AfterAll instruction which creates a token type out of thin air
// (no operands). This is a separate method from CreateAfterAll to facility
// the removal of operand-less AfterAll instructions.
// TODO(b/110532604): Remove this capability of creating a token from nothing
// when we plumb a primordial token from the entry computation.
static std::unique_ptr<HloInstruction> CreateToken();
static std::unique_ptr<HloInstruction> CreateGetDimensionSize(
const Shape& shape, HloInstruction* operand, int64_t dimension);
static std::unique_ptr<HloInstruction> CreateSetDimensionSize(
const Shape& shape, HloInstruction* operand, HloInstruction* val,
int64_t dimension);
static std::unique_ptr<HloInstruction> CreateAddDependency(
HloInstruction* data_operand, HloInstruction* token_operand);
// Returns the opcode for this instruction.
HloOpcode opcode() const { return opcode_; }
HloOpcode* mutable_opcode() { return &opcode_; }
// Returns true if this instruction has a side effect, irrespective of whether
// any called computations may contain an instruction with side effects.
bool HasSideEffectNoRecurse() const;
// Returns true if this instruction has a side effect. An instruction has a
// side effect if it uses certain opcodes or calls a computation with a side
// effect.
bool HasSideEffect() const;
// Returns the result shape of this instruction.
const Shape& shape() const;
// Returns the (mutable) result shape of this instruction.
Shape* mutable_shape() { return &shape_; }
// Returns the ith operand to this instruction.
const HloInstruction* operand(int64_t i) const;
// Returns the ith operand to this instruction.
HloInstruction* mutable_operand(int64_t i);
// Returns the number of operands to this instruction.
int64_t operand_count() const { return operands_.size(); }
// Returns the vector of operands of this instruction.
using InstructionVector = absl::InlinedVector<HloInstruction*, 2>;
const InstructionVector& operands() const { return operands_; }
InstructionVector mutable_operands() { return operands_; }
// Returns the vector of unique operands, in the same order they are found
// within the operand vector.
InstructionVector unique_operands() const;
// Returns the index of 'target' in the operands sequence.
// Precondition: target must be an operand (or a fatal error will occur).
int64_t operand_index(const HloInstruction* target) const;
// Returns the number of users of this instruction.
int64_t user_count() const { return users_.size(); }
// Returns the users of this instruction.
const std::vector<HloInstruction*>& users() const { return users_; }
// Returns the index of the user in the users() vector.
//
// Precondition: `user` is a user of the instruction.
int64_t UserId(HloInstruction* user);
// Returns true if this instruction is a user of 'instruction'.
bool IsUserOf(const HloInstruction* instruction) const {
return ContainsKey(instruction->user_map_, this);
}
// Adds a control dependency from this instruction to the given
// instruction. This instruction becomes a control predecessor of
// 'instruction', and 'instruction' becomes a control successor of this
// instruction. Returns an error status if either of the given instructions
// does not belong to the same computation.
//
// This is used to enforce an additional ordering requirement that is not
// captured by normal data dependencies, such as ordering among Send or Recv
// operations to avoid deadlock.
Status AddControlDependencyTo(HloInstruction* instruction);
// Removes a previously added control dependency from this instruction to
// 'instruction'.
Status RemoveControlDependencyTo(HloInstruction* instruction);
// Drops all control predecessors and successors from this HLO instruction.
Status DropAllControlDeps();
// Copies the control predecessors and successors on this HLO instruction to
// `inst`. Does not do a deep copy so this makes sense only if `inst` and
// this HLO are in the same module.
//
// Depending on the use cases we see in practice, in the future we may
// consider folding the logic here into Clone, CloneWithNewOperands and
// ReplaceAllUsesWith by treating control dependencies like data dependencies.
Status CopyAllControlDepsFrom(const HloInstruction* inst);
// Returns the set of control predecessors (successors) of this
// instruction. Control predecessors (successors) must execute before (after)
// the current instruction.
const std::vector<HloInstruction*>& control_predecessors() const {
return control_predecessors_;
}
const std::vector<HloInstruction*>& control_successors() const {
return control_successors_;
}
// Returns true if "other" performs the same computation as this instruction.
bool Identical(
const HloInstruction& other,
const std::function<bool(const HloInstruction*, const HloInstruction*)>&
eq_operands = std::equal_to<const HloInstruction*>(),
const std::function<bool(const HloComputation*, const HloComputation*)>&
eq_computations = std::equal_to<const HloComputation*>(),
bool layout_sensitive = true) const {
return IdenticalInternal(other, eq_operands, eq_computations,
layout_sensitive,
/*ignore_channel_id_values=*/false);
}
// Same as Identical() but ignores channel ID value mismatches, as long as
// both have channel IDs or neither has a channel ID.
bool IdenticalIgnoringChannelIdValues(
const HloInstruction& other,
const std::function<bool(const HloInstruction*, const HloInstruction*)>&
eq_operands = std::equal_to<const HloInstruction*>(),
const std::function<bool(const HloComputation*, const HloComputation*)>&
eq_computations = std::equal_to<const HloComputation*>(),
bool layout_sensitive = true) const {
return IdenticalInternal(other, eq_operands, eq_computations,
layout_sensitive,
/*ignore_channel_id_values=*/true);
}
// Generates a hash value of an HLO instruction. Hash considers
// information on opcode, shape, operands, and typically a root instruction.
// This function returns the same hash value for equivalent HLO instructions,
// with respect to HloInstruction::Identical() method.
// TODO(majnemer): Make the comment here more crisp & accurate.
template <typename H>
friend H AbslHashValue(H h, const HloInstruction& hlo) {
h = H::combine(std::move(h), hlo.opcode(), hlo.shape());
if (!hlo.IsCrossModuleAllReduce()) {
for (size_t i = 0; i < hlo.operands().size(); ++i) {
h = H::combine(std::move(h), hlo.operand(i)->shape());
}
h = H::combine(std::move(h), hlo.operand_count());
}
if (hlo.opcode() == HloOpcode::kFusion) {
h = H::combine(std::move(h), *hlo.fused_expression_root(),
hlo.fusion_kind(), hlo.fused_instruction_count(),
hlo.fused_parameters().size());
}
return h;
}
// Returns whether the instruction has a constant operand.
bool HasConstantOperand() const;
// Replaces the use of this instruction in "user" with "new_producer". Note
// that there might be multiple uses of this instruction in "user"; all will
// be replaced.
//
// If user is a fusion instruction, this function will remove any duplicated
// operands of it which could be created due to this replacement.
Status ReplaceUseWith(HloInstruction* user, HloInstruction* new_producer);
// Same as ReplaceUseWith(), but new_producer can have a different shape.
Status ReplaceUseWithDifferentShape(HloInstruction* user,
HloInstruction* new_producer);
// Replaces the specified operand with new_operand. The old and new operands
// must have compatible shapes ignoring floating-point precision.
//
// This function does NOT remove duplicated operands even if this instruction
// is a fusion, so that the existing operand numbers do not change.
Status ReplaceOperandWith(int64_t operand_num, HloInstruction* new_operand);
// Same as ReplaceOperandWith(), but new_operand can have a different shape.
Status ReplaceOperandWithDifferentShape(int64_t operand_num,
HloInstruction* new_operand);
// Replaces all uses of this instruction with the new producer. If
// new_producer is a user of this instruction then new_producer remains a use
// of this instruction to avoid introducing cycles into the graph.
//
// If this instruction is the root of its computation, sets the computation's
// root to new_producer.
//
// The new producer must have a compatible shape ignoring floating-point
// precision.
//
// If a user is a fusion instruction, this function will remove any duplicated
// operands of it which could be created due to this replacement.
Status ReplaceAllUsesWith(HloInstruction* new_producer);
// Same as ReplaceAllUsesWith, but new_producer can have a different shape.
Status ReplaceAllUsesWithDifferentShape(HloInstruction* new_producer);
// Same as ReplaceAllUsesWith, but only replace given set of users.
Status ReplaceUsesWith(absl::Span<HloInstruction* const> users,
HloInstruction* new_producer);
Status ReplaceAllUsesWithDifferentShape(
absl::Span<HloInstruction* const> users, HloInstruction* new_producer);
// Performs a postorder DFS visit using this node as the root. If
// call_finish_visit is true, then DfsHloVisitor::FinishVisit is called when
// complete. If ignore_control_predecessors is true, instructions only
// reachable via control dependencies will not be visited, and the postorder
// will not take control dependencies into account. It is as if the control
// dependencies didn't exist in the graph at all.
template <typename HloInstructionPtr>
Status Accept(DfsHloVisitorBase<HloInstructionPtr>* visitor,
bool call_finish_visit = true,
bool ignore_control_predecessors = false);
Status Accept(ConstDfsHloVisitor* visitor, bool call_finish_visit = true,
bool ignore_control_predecessors = false) const {
return const_cast<HloInstruction*>(this)->Accept(
visitor, call_finish_visit, ignore_control_predecessors);
}
// Same as Accept() above, but the order of operand and control predecessor
// visitation is determined by the given operand order; if compare(A, B) ==
// true, A is visited before B.
using CompareFunction =
std::function<bool(const HloInstruction*, const HloInstruction*)>;
Status AcceptWithOperandOrder(DfsHloVisitor* visitor,
const CompareFunction& operand_order,
bool call_finish_visit = true);
// Visit this instruction and only this instruction with the given visitor.
template <typename HloInstructionPtr>
Status Visit(DfsHloVisitorBase<HloInstructionPtr>* visitor);
// Returns the first non-GetTupleElement ancestor instruction of 'hlo'.
// If the first non-GTE ancestor is tuple-shaped, populates 'index' with the
// (possibly nested) tuple indices used on the path from ancestor to 'hlo'.
std::pair<const HloInstruction*, ShapeIndex> LatestNonGteAncestorAndIndex()
const;
std::pair<HloInstruction*, ShapeIndex> LatestNonGteAncestorAndIndex() {
auto rv =
const_cast<const HloInstruction*>(this)->LatestNonGteAncestorAndIndex();
return {const_cast<HloInstruction*>(rv.first), rv.second};
}
// Same as LatestNonGteAncestorAndIndex, but just returns the HloInstruction.
const HloInstruction* LatestNonGteAncestor() const;
HloInstruction* LatestNonGteAncestor() {
return const_cast<HloInstruction*>(
const_cast<const HloInstruction*>(this)->LatestNonGteAncestor());
}
// Returns true whether this instruction is effectively a bitcast. Currently,
// this means it either is a bitcast, or it is a transpose that is effectively
// a bitcast.
bool IsEffectiveBitcast() const;
// Gets/sets the to_apply HloComputation for Call, Map, Reduce, etc.
// The setter should only be called by HloModule or HloComputation methods.
//
// Precondition: The instruction has a valid to_apply_ field.
HloComputation* to_apply() const;
void set_to_apply(HloComputation* to_apply);
// Gets/sets the while_condition or while_body HloComputation for While. The
// setters should only be called by HloModule or HloComputation methods.
//
// Precondition: The instruction is a While instruction.
HloComputation* while_condition() const;
HloComputation* while_body() const;
void set_while_condition(HloComputation* while_condition);
void set_while_body(HloComputation* while_body);
HloInstruction* while_init() const;
// Gets/sets the true and false HloComputation for Conditional.
//
// Precondition: The instruction is a predicated Conditional instruction.
HloComputation* true_computation() const;
HloComputation* false_computation() const;
// Gets the branch HloComputations for Conditional.
//
// Precondition: The instruction is a Conditional instruction.
const std::vector<HloComputation*>& branch_computations() const;
int branch_count() const;
HloComputation* branch_computation(int b) const;
// Sets a branch HloComputation for Conditional.
// The setter should only be called by HloModule or HloComputation methods.
//
// Precondition: The instruction is a Conditional instruction.
void set_branch_computation(int b, HloComputation* computation);
// Returns a string for the signature of this instruction if considered as a
// function, e.g. the signature of an F32 add is (F32, F32) -> F32.
std::string SignatureString() const;
// Returns a debugging string that represents this instruction.
//
// (We express the default options using an overload rather than a default
// param because gdb ignores default params, but does resolve overloads.)
//
// TODO(b/73348663): Make ToString() adaptive to the size of the string by
// default, backing off on providing full information for very large strings,
// or provide a different name for a ToString-like function that does that.
std::string ToString() const { return ToString(HloPrintOptions()); }
std::string ToString(const HloPrintOptions& options) const;
// Components of the ToString() representation:
// Returns a string representation of the operand list.
std::string OperandsToString(const HloPrintOptions& options) const;
// Returns string representation of op-specific attributes.
std::vector<std::string> ExtraAttributesToString(
const HloPrintOptions& options) const;
// As ToString, but returns a shorter string.
std::string ToShortString() const;
// Prints an instruction to a string.
//
// The canonical string representation needs to name operands and instruction
// names in a consistent way. This is implemented through the
// canonical_name_map.
std::string ToStringWithCanonicalNameMap(
const HloPrintOptions& options,
CanonicalNameMap* canonical_name_map) const;
// Returns a serialized representation of this instruction.
virtual HloInstructionProto ToProto() const;
// Returns a category for the HLO. This could be something like "convolution"
// or "elementwise".
virtual std::string ToCategory() const;
// Returns a logging instruction, if the output of this instruction is logged.
//
// Postcondition: retval == nullptr || retval->opcode() == HloOpcode::kTrace
HloInstruction* tracing() const;
void set_tracing(HloInstruction* trace_instruction);
// Returns true if this instruction is fused, ie contained within a fusion
// instruction.
bool IsFused() const;
bool IsLoopFusion() const;
bool IsInputFusion() const;
bool IsOutputFusion() const;
bool IsCustomFusion() const;
// Returns true if this instruction can be legally fused into a fusion
// instruction.
bool IsFusible() const;
bool IsCustomCall(absl::string_view target) const;
// Returns the sharding applied to this operator.
// REQUIRES: has_sharding() is true.
const HloSharding& sharding() const {
CHECK(has_sharding());
return *sharding_;
}
std::shared_ptr<const HloSharding> sharding_ptr() const { return sharding_; }
// Returns the sharding applied to this operator, or default_ if none exists.
const HloSharding& sharding_or_default(const HloSharding& default_) const {
return sharding_ ? *sharding_ : default_;
}
// Returns the sharding unique device, if any.
absl::optional<int64_t> sharding_unique_device() const {
if (sharding_ == nullptr) {
return absl::optional<int64_t>();
}
return sharding_->UniqueDevice();
}
// Sets the sharding of this operator. Should only be called by HloModule or
// HloComputation methods.
void set_sharding(const HloSharding& sharding) {
sharding_ = std::make_shared<const HloSharding>(sharding);
}
void set_sharding(std::shared_ptr<const HloSharding> sharding) {
sharding_ = std::move(sharding);
}
void set_single_sharding(const HloSharding& sharding);
// Sets a sharding that assigns the current instruction to device.
void set_device_sharding(int64_t device) {
set_single_sharding(HloSharding::AssignDevice(device));
}
// Remove any sharding from this operator.
void clear_sharding() { sharding_ = nullptr; }
// Return true if this operator has a sharding assigned.
bool has_sharding() const { return sharding_ != nullptr; }
// Checks whether the instruction has compatible sharding with the other
// instruction.
bool has_compatible_sharding(const HloInstruction* other) const {
if (!has_sharding()) {
return !other->has_sharding();
}
return other->has_sharding() ? sharding() == other->sharding() : false;
}
// When creating a new instruction which either replaces, or shifts up (kCopy
// insertion case), another instruction, we need to make sure the certain
// properties of the new instruction are copied into the derived one. As of
// today, the metadata and sharding will be propagated to the derived
// instruction.
void SetupDerivedInstruction(HloInstruction* derived_instruction) const;
// Clones the HLO instruction. The clone will have the same opcode, shape, and
// operands. After creation the clone has no uses. "this" (the instruction
// cloned from) is not changed. Suffix is the string to append to the name of
// the instruction to form the name of the cloned instruction.
// Ignores the control predecessors and successors of this HLO instruction.
std::unique_ptr<HloInstruction> Clone(
const std::string& suffix = "clone",
HloCloneContext* context = nullptr) const;
// Clones the HLO instruction as above but with new shape.
std::unique_ptr<HloInstruction> CloneWithNewShape(
const Shape& shape, const std::string& suffix = "clone",
HloCloneContext* context = nullptr) const;
// Clones the HLO instruction as above but with new shape and operands.
std::unique_ptr<HloInstruction> CloneWithNewOperands(
const Shape& shape, absl::Span<HloInstruction* const> new_operands,
HloCloneContext* context = nullptr) const;
// Returns the computations this instruction directly calls (if any).
const std::vector<HloComputation*>& called_computations() const {
return called_computations_;
}
// Replaces all called computations based on a map function. This is needed
// when we clone hlo_computations and want to let the instructions to point
// to the newly cloned nodes.
void ReplaceCalledComputations(
std::function<HloComputation*(HloComputation*)> map_function) {
for (int64_t i = 0; i < called_computations_.size(); ++i) {
called_computations_[i] = map_function(called_computations_[i]);
}
}
// Clears out the called computations.
//
// This is, in particular, necessary when inlining function bodies into their
// caller. If there were side-effecting operations in the called computations,
// the call itself is considered side-effecting and thus cannot be removed. By
// clearing out the computations, we reflect the fact that all side-effecting
// properties have been reflected in the caller, and make the call HLO
// removable.
virtual void ClearCalledComputations() { called_computations_.clear(); }
// Returns true if this instruction performs an elementwise operation on
// `operand_idx`-th operand. An instruction is elementwise on an operand iff,
// to compute the output at index {i_0,i_1,...,i_n}, the only element required
// from the operand (if any) is the element at {i_0,i_1,...,i_n}.
//
// Note on performance: when this instruction is kFusion, this method, in the
// worst case, scans all fused instructions. We could speed this up by
// caching.
bool IsElementwiseOnOperand(int64_t operand_idx) const;
// Returns true if this instruction is elementwise on all its operands.
bool IsElementwise() const;
static bool IsOpElementwise(HloOpcode opcode);
// Returns true if this is a cross module all-reduce instruction.
bool IsCrossModuleAllReduce() const;
// Returns true if this is a cross-replica all-reduce instruction.
bool IsCrossReplicaAllReduce() const;
// Returns true if this instruction is binary and elementwise.
bool IsElementwiseBinary() const;
// Returns whether this instruction may reuse elements of its `i`th operand.
bool ReusesOperandElements(int64_t i) const;
// Returns the indices that the given operand appear in the operand list of
// this instruction. Note that an instruction can use the same operand
// multiple times.
absl::InlinedVector<int64_t, 4> OperandIndices(
const HloInstruction* operand) const;
// Convenience helper for ShapeUtil::InsertedOrDeleted1SizedDimensions. If
// this reshape merely inserts or deletes 1-sized dimensions, return the input
// indices of the deleted dimensions and the output indices of the inserted
// dimensions.
//
// Precondition: this op must be a reshape.
std::tuple<bool, std::vector<int64_t>, std::vector<int64_t>>
ReshapeMerelyInsertsOrDeletes1SizedDimensions() const;
// Gets the string identifier for this instruction.
const std::string& name() const { return name_; }
// Sets the string identifier for this instruction. Name will be sanitized to
// match the regexp "[a-zA-Z_][a-zA-Z0-9_.-]*".
//
// See also HloModule::SetAndUniquifyInstrName(), which does this plus
// UniqufyName().
void SetAndSanitizeName(absl::string_view name) {
name_ = NameUniquer::GetSanitizedName(name);
}
// Use the given NameUniquer to select a unique name for the instruction based
// on the instruction's existing name.
//
// See also HloModule::SetAndUniquifyInstrName(), which does this plus
// SetAndSanitizeName().
void UniquifyName(NameUniquer* name_uniquer);
// Clear the unique ID of the instruction so that it can be re-assigned, such
// as for the purpose of compacting the instruction unique IDs.
void ClearUniqueIdInternal() { unique_id_ = -1; }
// Set the unique id for this instruction to "id"
void SetUniqueId(int id) {
CHECK_EQ(unique_id_, -1); // Should not be assigned already
CHECK_GE(id, 0);
unique_id_ = id;
}
// Return the unique ID assigned to this node via SetUniqueId (or -1
// if no id has been assigned yet).
int unique_id() const { return unique_id_; }
// Returns the backend-specific configuration for how a backend should compile
// this HLO. The meaning of the field is backend specific. Not for use before
// or during general HLO optimization, since HLO optimizations do not preserve
// this field and they cannot interpret it due to its meaning being backend
// specific. Except for CustomCall, where this field is preserved and no
// general HLO optimization needs to interpret it.
//
// ConfigProto should be a protobuf Message type.
template <typename ConfigProto>
StatusOr<ConfigProto> backend_config() const {
ConfigProto proto;
TF_RETURN_IF_ERROR(GetBackendConfigInternal(&proto));
return std::move(proto);
}
Status set_backend_config(const tensorflow::protobuf::Message& proto);
void set_frontend_attributes(FrontendAttributes frontend_attributes) {
frontend_attributes_ = std::move(frontend_attributes);
}
void add_frontend_attributes(FrontendAttributes frontend_attributes) {
frontend_attributes_.mutable_map()->insert(
frontend_attributes.map().begin(), frontend_attributes.map().end());
}
const FrontendAttributes& frontend_attributes() const {
return frontend_attributes_;
}
// Getter/setter for raw JSON-encoded backend config. Prefer the
// functions above that deal in proto Messages where possible.
const std::string& raw_backend_config_string() const {
return backend_config_;
}
void set_raw_backend_config_string(std::string config_str) {
backend_config_ = std::move(config_str);
}
bool is_default_config() const { return is_default_config_; }
void set_default_config() { is_default_config_ = true; }
// Returns a string representation of a proto in the format used by
// raw_backend_config_string.
//
// This is morally equivalent to:
//
// HloInstruction instr;
// TF_RETURN_IF_ERROR(instr.set_backend_config(proto));
// return instr.raw_backend_config_string();
//
static StatusOr<std::string> BackendConfigToRawString(
const tensorflow::protobuf::Message& proto);
// Returns the information used to tell the implementation information about
// what sort of precision is requested. The meaning of the field is backend
// specific. At the moment, it is only supported for kConvolution and kDot.
// Transformations on one kDot or kConvolution to another will preserve this
// information. Transformations to other HLOs will not preserve this
// information but it is presumed that the alternate lowering is strictly
// superior.
// Precondition: opcode must be kConvolution or kDot.
const PrecisionConfig& precision_config() const;
PrecisionConfig* mutable_precision_config();
// Sets the debug metadata for this instruction, excluding creation_pass_id,
// which should never be copied anywhere.
void set_metadata(const OpMetadata& metadata) {
int64_t creation_pass_id = metadata_.creation_pass_id();
metadata_ = metadata;
metadata_.set_creation_pass_id(creation_pass_id);
}
void set_size_of_generated_code_in_bytes(int64_t code_size_in_bytes) {
metadata_.set_size_of_generated_code_in_bytes(code_size_in_bytes);
}
void set_size_of_memory_working_set_in_bytes(
int64_t working_set_size_in_bytes) {
metadata_.set_size_of_memory_working_set_in_bytes(
working_set_size_in_bytes);
}
void set_creation_pass_id(int64_t pass_id) {
metadata_.set_creation_pass_id(pass_id);
}
void set_metadata_op_name(const std::string& name) {
metadata_.set_op_name(name);
}
void set_logical_creation_pass_id(int64_t pass_id) {
metadata_.set_logical_creation_pass_id(pass_id);
}
const OpMetadata& metadata() const { return metadata_; }
// Set/get the computation containing this instruction. set_parent should only
// be called by HloComputation methods which add/remove instructions to
// computations.
void set_parent(HloComputation* computation) { parent_ = computation; }
const HloComputation* parent() const { return parent_; }
HloComputation* parent() { return parent_; }
// Returns the module for this instruction.
HloModule* GetModule() const;
// Get/Set the number of partitions per outer dimension (in order, starting
// with outer-most dimension first). Currently used by the parallel cpu
// backend to partition HLOs into parallel tasks.
//
// TODO(b/62783254) Replace these methods with a more general way to
// annotate HLOs with backend-specific information.
const std::vector<int64_t>& outer_dimension_partitions() const {
return outer_dimension_partitions_;
}
void set_outer_dimension_partitions(
const std::vector<int64_t>& outer_dimension_partitions);
// Old methods kept for smooth subclassing transition BEGIN.
// TODO(b/80131774): Remove this code.
// Delegates to HloBatchNormInstruction::feature_index.
int64_t feature_index() const;
// Delegates to HloBatchNormInstruction::epsilon.
float epsilon() const;
// Delegates to HloFftInstruction::fft_type.
FftType fft_type() const;
// Delegates to HloFftInstruction::fft_length.
const std::vector<int64_t>& fft_length() const;
// Delegates to HloChannelInstruction::channel_id.
absl::optional<int64_t> channel_id() const;
void set_channel_id(const absl::optional<int64_t>& channel_id);
// Returns the dimension sizes or numbers associated with this instruction.
virtual const std::vector<int64_t>& dimensions() const {
LOG(FATAL) << "Unimplemented method.";
}
virtual int64_t dimensions(int64_t index) const {
LOG(FATAL) << "Unimplemented method.";
}
virtual std::vector<int64_t>* mutable_dimensions() {
LOG(FATAL) << "Unimplemented method.";
}
// Delegates to HloConcatenateInstruction::concatenate_dimension.
int64_t concatenate_dimension() const;
// Delegates to HloGetDimensionSizeInstruction::dimension.
int64_t dimension() const;
// Delegates to HloReshapeInstruction::inferred_dimension.
int64_t inferred_dimension() const;
// Returns whether this instruction does a rank-2 transposition.
bool IsRank2Transpose() const;
// Delegates to HloSliceInstruction::slice_start.
int64_t slice_starts(int64_t dimension) const;
const std::vector<int64_t>& slice_starts() const;
std::vector<int64_t>* mutable_slice_starts();
// Delegates to HloSliceInstruction::slice_limits.
int64_t slice_limits(int64_t dimension) const;
const std::vector<int64_t>& slice_limits() const;
std::vector<int64_t>* mutable_slice_limits();
// Delegates to HloSliceInstruction::slice_strides.
int64_t slice_strides(int64_t dimension) const;
const std::vector<int64_t>& slice_strides() const;
std::vector<int64_t>* mutable_slice_strides();
// Returns the literal associated with this instruction.
const Literal& literal() const;
// Returns whether the instruction is a constant.
bool IsConstant() const;
// Delegate to HloConstantInstruction::RelayoutConstant.
void RelayoutConstant(const Layout& new_layout,
const ShapeIndex& shape_index = {});
// Delegates to HloTraceInstruction::TracingTag.
std::string TracingTag() const;
// Delegates to HloFusionInstruction::AddFusionOperand.
HloInstruction* AddFusionOperand(HloInstruction* new_operand);
// Delegates to HloFusionInstruction::MergeFusionInstruction.
void MergeFusionInstruction(HloInstruction* instruction_to_merge);
// Delegates to HloFusionInstruction::MergeFusionInstructionIntoMultiOutput.
void MergeFusionInstructionIntoMultiOutput(
HloInstruction* instruction_to_merge);
// Delegates to HloFusionInstruction::FuseInstruction.
HloInstruction* FuseInstruction(HloInstruction* instruction_to_fuse);
// Delegates to HloFusionInstruction::FuseInstructionIntoMultiOutput.
HloInstruction* FuseInstructionIntoMultiOutput(
HloInstruction* instruction_to_fuse);
// Delegates to HloFusionInstruction::fused_instruction.
HloComputation* fused_instructions_computation() const;
// Delegates to HloFusionInstruction::fused_expression_root.
HloInstruction* fused_expression_root() const;
// Delegates to HloFusionInstruction::fused_instructions.
const tensorflow::gtl::iterator_range<UnwrappingIterator<
std::list<std::unique_ptr<HloInstruction>>::const_iterator>>
fused_instructions() const;
const tensorflow::gtl::iterator_range<
UnwrappingIterator<std::list<std::unique_ptr<HloInstruction>>::iterator>>
fused_instructions();
// Delegates to HloFusionInstruction::fused_instruction_count.
int64_t fused_instruction_count() const;
// Delegates to HloFusionInstruction::fused_parameter.
HloInstruction* fused_parameter(int64_t parameter_number) const;
// Delegates to HloFusionInstruction::fused_parameters.
const std::vector<HloInstruction*>& fused_parameters() const;
// Returns true if this instruction is a fusion instruction that generates
// multiple outputs.
const bool IsMultiOutputFusion() const;
// Delegates to HloFusionInstruction::fusion_kind.
FusionKind fusion_kind() const;
// Delegates to HloFusionInstruction::set_fusion_kind.
void set_fusion_kind(FusionKind kind);
// Delegates to HloRngInstruction::random_distribution.
RandomDistribution random_distribution() const;
// Delegates to HloParameterInstruction::parameter_number.
int64_t parameter_number() const;
// Delegates to
// HloParameterInstruction::set_parameter_replicated_at_leaf_buffers.
void set_parameter_replicated_at_leaf_buffers(
absl::Span<const bool> parameter_replicated_at_leaf_buffers);
void set_parameter_replicated_at_leaf_buffers(
const std::vector<bool>& parameter_replicated_at_leaf_buffers);
// Delegates to HloParameterInstruction::parameter_replicated_at_leaf_buffers.
const absl::optional<std::vector<bool>>&
parameter_replicated_at_leaf_buffers() const;
// Delegates to HloGetTupleElementInstruction::tuple_index.
int64_t tuple_index() const;
// Delegates to HloGetTupleElementInstruction::set_tuple_index.
void set_tuple_index(int64_t new_tuple_index);
// Delegates to HloReducePrecisionInstruction::exponent_bits.
int32_t exponent_bits() const;
// Delegates to HloReducePrecisionInstruction::mantissa_bits.
int32_t mantissa_bits() const;
// Delegates to HloInfeedInstruction::infeed_config.
std::string infeed_config() const;
// Delegates to HloInfeedInstruction::set_infeed_config.
void set_infeed_config(const std::string& config);
// Returns the config for the Outfeed instruction.
const std::string& outfeed_config() const;
// Delegates to HloOutfeedInstruction::set_outfeed_config.
void set_outfeed_config(const std::string& config);
// Returns the shape for the Outfeed instruction.
const Shape& outfeed_shape() const;
// Returns the mutable shape for the Outfeed instruction.
Shape* mutable_outfeed_shape();
// Delegates to HloCollectiveInstruction::replica_groups.
const std::vector<ReplicaGroup>& replica_groups() const;
// Delegates to HloCollectivePermuteInstruction::source_target_pairs.
const std::vector<std::pair<int64_t, int64_t>>& source_target_pairs() const;
// Returns data on the window in a windowed operation such as
// convolution.
virtual const Window& window() const {
LOG(FATAL) << "Unimplemented method.";
}
// Sets the window data in a windowed operation such as convolution.
virtual void set_window(const Window& window) {
LOG(FATAL) << "Unimplemented method.";
}
// Returns the unique_indices field.
virtual bool unique_indices() const { LOG(FATAL) << "Unimplemented method."; }
// Returns data on the dimension numbers used for a convolution operation,
// which may be a kConvolution instruction or a kCustomCall that implements a
// convolution.
const ConvolutionDimensionNumbers& convolution_dimension_numbers() const;
// Sets the convolution dimension numbers on this instruction. In general you
// shouldn't need to call this; instead, specify the convolution dimension
// numbers when you create the instruction.
void set_convolution_dimension_numbers(
const ConvolutionDimensionNumbers& dnums);
// The number of feature groups. Must be a divisor of the input feature
// dimension and output feature dimension.
int64_t feature_group_count() const;
void set_feature_group_count(int64_t feature_group_count);
// The number of batch groups. Must be a divisor of the input batch dimension
int64_t batch_group_count() const;
void set_batch_group_count(int64_t batch_group_count);
// Delegates to HloSelectAndScatterInstruction::select.
HloComputation* select() const;
// Delegates to HloSelectAndScatterInstruction::scatter.
HloComputation* scatter() const;
// Delegates to HloSelectAndScatterInstruction::set_select.
void set_select(HloComputation* computation);
// Delegates to HloSelectAndScatterInstruction::set_scatter.
void set_scatter(HloComputation* computation);
// Delegates to HloCustomCallInstruction::custom_call_target.
const std::string& custom_call_target() const;
void set_custom_call_target(absl::string_view target);
// Delegates to HloPadInstruction::padding_config.
const PaddingConfig& padding_config() const;
PaddingConfig* mutable_padding_config();
// Delegates to HloConvolutionInstruction::padding_type.
PaddingType padding_type() const;
// Delegates to HloDynamicSliceInstruction::slice_sizes.
int64_t slice_sizes(int64_t dimension) const;
// Delegates to HloDynamicSliceInstruction::dynamic_slice_sizes.
const std::vector<int64_t>& dynamic_slice_sizes() const;
// Delegates to HloCollectivePermuteInstruction::dynamic_slice_sizes.
const std::vector<std::vector<int64_t>>& dynamic_slice_sizes_list() const;
// Delegates to HloGatherInstruction::gather_dimension_numbers.
const GatherDimensionNumbers& gather_dimension_numbers() const;
// Delegates to HloGatherInstruction::gather_slice_sizes.
absl::Span<const int64_t> gather_slice_sizes() const;
// Delegates to HloScatterInstruction::scatter_dimension_numbers().
const ScatterDimensionNumbers& scatter_dimension_numbers() const;
// Delegates to HloDotInstruction::dot_dimension_numbers().
const DotDimensionNumbers& dot_dimension_numbers() const;
// Delegates to HloDomainInstruction::operand_side_metadata().
const DomainMetadata& operand_side_metadata() const;
// Delegates to HloDomainInstruction::user_side_metadata().
const DomainMetadata& user_side_metadata() const;
// Delegates to HloCopyStartInstruction::is_cross_program_prefetch().
bool is_cross_program_prefetch() const;
// Delegates to HloCompareInstruction::direction().
ComparisonDirection comparison_direction() const;
// Delegates to HloTriangularSolveInstruction::triangular_solve_options().
const TriangularSolveOptions& triangular_solve_options() const;
// Delegates to HloCholeskyInstruction::cholesky_options().
const CholeskyOptions& cholesky_options() const;
// Appends operand to the list of operands and adds this instruction as a user
// of the operand.
void AppendOperand(HloInstruction* operand);
// Old methods kept for smooth subclassing transition END.
protected:
// Internal constructor for a given opcode/shape, other fields must be filled
// by factory methods.
HloInstruction(HloOpcode opcode, const Shape& shape);
void RemoveAllOperands() { operands_.clear(); }
void RemoveOperandAt(int index) {
operands_.erase(operands_.begin() + index);
}
// Removes a list of operands with the given indices in ascending order.
void RemoveOperandsAtAscendingIndices(
absl::Span<const int> ascending_indices);
void AppendComputation(HloComputation* computation) {
called_computations_.push_back(computation);
}
void DetachFrom(HloInstruction* usee) { usee->RemoveUser(this); }
void set_called_computation(int index, HloComputation* computation) {
called_computations_[index] = computation;
}
// Indices of computations in called_computations_ for instructions which call
// multiple computations.
enum {
// kWhile computations.
kBodyComputationIndex = 0,
kConditionComputationIndex = 1,
// kSelectAndScatter computations.
kSelectComputationIndex = 0,
kScatterComputationIndex = 1,
// kConditional computations.
kTrueComputationIndex = 0,
kFalseComputationIndex = 1,
};
private:
friend class HloComputation;
bool IdenticalInternal(
const HloInstruction& other,
const std::function<bool(const HloInstruction*, const HloInstruction*)>&
eq_operands,
const std::function<bool(const HloComputation*, const HloComputation*)>&
eq_computations,
bool layout_sensitive, bool ignore_channel_id_values) const;
// Implementation for non-common logic of CloneWithNewOperands.
virtual std::unique_ptr<HloInstruction> CloneWithNewOperandsImpl(
const Shape& shape, absl::Span<HloInstruction* const> new_operands,
HloCloneContext* context) const {
// TODO(b/80131774): This should be pure virtual.
LOG(FATAL) << "Unimplemented method.";
}
// Implementation for non-common logic of ExtraAttributesToString.
virtual std::vector<std::string> ExtraAttributesToStringImpl(
const HloPrintOptions& options) const {
return {};
}
// Implementation for IsElementwise if operand_idx is nullopt and for
// IsElementwiseOnOperand if otherwise.
//
// NOTE: For all instructions other than kFusion, being elementwise on one of
// the operands is equivalent to being elementwise on all the operands.
virtual bool IsElementwiseImpl(
const absl::optional<int64_t>& operand_idx) const;
// Prints an operand to a string. Accessed by friend class HloInstruction.
virtual std::string OperandsToStringWithCanonicalNameMap(
const HloPrintOptions& options,
CanonicalNameMap* canonical_name_map) const;
// See comments on Identical().
virtual bool IdenticalSlowPath(
const HloInstruction& other,
const std::function<bool(const HloComputation*, const HloComputation*)>&
eq_computations) const;
// Creates an n-ary elementwise operation.
static std::unique_ptr<HloInstruction> CreateNary(
const Shape& shape, HloOpcode opcode,
absl::Span<HloInstruction* const> operands);
// Adds a user for this instruction.
void AddUser(HloInstruction* user);
// Removes a user for this instruction.
void RemoveUser(HloInstruction* user);
// Helper for implementing backend_config(). Parses backend_config_ into the
// given proto.
Status GetBackendConfigInternal(tensorflow::protobuf::Message* proto) const;
// Mark this instruction as dead. Accessed by friend class HloInstruction.
void MarkAsDead() { marked_as_dead_ = true; }
// Has this instruction been marked as dead? Accessed by friend class
// HloInstruction.
bool IsMarkedAsDead() const { return marked_as_dead_; }
int unique_id_; // Unique to this HloInstruction within a HloModule
// Opcode for this instruction.
HloOpcode opcode_;
// Instruction operands.
InstructionVector operands_;
// The set of control predecessors of this instruction.
// Note that the order of the instructions in the vector influences the order
// computed in HloComputation::ComputeInstructionPostOrder, which may
// influence the result of the compilation by changing the scheduling. We are
// not sure if it matters.
std::vector<HloInstruction*> control_predecessors_;
// The users of this instruction. Users are HLOs where this instruction is an
// operand. The vector users_ and the map user_map_ contain identical members.
// The map enables fast membership testing and the vector enables fast, stable
// iteration. The value in the map contains the index of the instruction in
// the vector what enables fast removal.
std::vector<HloInstruction*> users_;
absl::flat_hash_map<const HloInstruction*, int64_t> user_map_;
// The set of control successors of this instruction.
std::vector<HloInstruction*> control_successors_;
// The computation in which this instruction is contained.
HloComputation* parent_ = nullptr;
// Result shape of this instruction.
Shape shape_;
// The sharding, if one exists.
// Uses std::shared_ptr to allow reuse of the same sharding object between
// HloInstructions and other components as HloSharding can be very large for
// many element tuples.
std::shared_ptr<const HloSharding> sharding_;
// Computations called by this instruction.
std::vector<HloComputation*> called_computations_;
// A trace instruction that consumes this instruction.
//
// Invariant: if trace_instruction_ != nullptr, trace_instruction has this as
// an operand.
HloInstruction* trace_instruction_ = nullptr;
// The backend-specific configuration for how a backend should compile this
// HLO. See the documentation on backend_config().
std::string backend_config_;
// Attributes passed from the frontend to give hints to the backend about
// how to compile this HLO.
// HLO -> HLO transforms are expected to preserve these attributes on a
// "best effort" basis only.
// For example:
// x = const(10, frontend_attributes={x}
// y = const(10, frontend_attributes={y}
// z = add(x,y), frontend_attributes={y}
// Could be simplified to:
// z' = const(20), frontend_attributes={?}
FrontendAttributes frontend_attributes_;
// This field is assigned to true when backend_config_ is assigned to
// a default configuration.
bool is_default_config_ = false;
// True if this instruction has already been detached from its user and
// operands.
bool cleaned_up_ = false;
// String identifier for instruction.
std::string name_;
// Metadata for debugging.
OpMetadata metadata_;
// The number of partitions per outer dimension (listed in order from
// outer-most dimension first).
std::vector<int64_t> outer_dimension_partitions_;
// Intrusive flag used by HloComputation, whether this instruction has
// been marked as dead.
bool marked_as_dead_;
HloInstruction(const HloInstruction&) = delete;
HloInstruction& operator=(const HloInstruction&) = delete;
};
// Explicit instantiations in hlo_instruction.cc.
extern template Status HloInstruction::Accept(DfsHloVisitor*, bool, bool);
extern template Status HloInstruction::Accept(ConstDfsHloVisitor*, bool, bool);
extern template Status HloInstruction::Visit(DfsHloVisitor* visitor);
extern template Status HloInstruction::Visit(ConstDfsHloVisitor* visitor);
std::string ToString(HloInstruction::FusionKind kind);
StatusOr<HloInstruction::FusionKind> StringToFusionKind(
const std::string& kind_name);
// Custom (de)stringification functions for protos that live inside
// HloInstruction.
std::string PaddingConfigToString(const PaddingConfig& padding);
std::string FrontendAttributesToString(
const FrontendAttributes& frontend_attributes);
std::string RandomAlgorithmToString(const RandomAlgorithm& algorithm);
std::string RandomDistributionToString(const RandomDistribution& distribution);
std::string PrecisionToString(const PrecisionConfig::Precision& precision);
std::string DotDimensionNumbersToString(const DotDimensionNumbers& dnums);
std::string ConvolutionDimensionNumbersToString(
const ConvolutionDimensionNumbers& dnums);
std::string ReplicaGroupsToString(
absl::Span<const ReplicaGroup> replica_groups);
StatusOr<RandomAlgorithm> StringToRandomAlgorithm(const std::string& name);
StatusOr<RandomDistribution> StringToRandomDistribution(
const std::string& name);
StatusOr<PrecisionConfig::Precision> StringToPrecision(const std::string& name);
StatusOr<CustomCallSchedule> StringToCustomCallSchedule(absl::string_view name);
StatusOr<CustomCallApiVersion> StringToCustomCallApiVersion(
absl::string_view name);
std::ostream& operator<<(std::ostream& os, HloInstruction::FusionKind kind);
// Map classes that guarantee a deterministic iteration order when the key is
// an HloInstruction* or a const HloInstruction*.
// To make the iteration order over the map deterministic, the comparator
// should not be using the pointer values, but rather an intrinsic property of
// the hlo. Exception: null pointer values compare less than non-null.
struct HloPtrComparator {
bool operator()(const HloInstruction* const& lhs,
const HloInstruction* const& rhs) const;
};
template <typename ValueT>
using HloInstructionMap = std::map<HloInstruction*, ValueT, HloPtrComparator>;
template <typename ValueT>
using ConstHloInstructionMap =
std::map<const HloInstruction*, ValueT, HloPtrComparator>;
using HloInstructionSet = std::set<HloInstruction*, HloPtrComparator>;
using ConstHloInstructionSet =
std::set<const HloInstruction*, HloPtrComparator>;
} // namespace xla
#endif // TENSORFLOW_COMPILER_XLA_SERVICE_HLO_INSTRUCTION_H_
| Intel-Corporation/tensorflow | tensorflow/compiler/xla/service/hlo_instruction.h | C | apache-2.0 | 100,834 | [
30522,
1013,
1008,
9385,
2418,
1996,
23435,
12314,
6048,
1012,
2035,
2916,
9235,
1012,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("UnitTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UnitTests")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c5d231db-9fb7-42cc-843f-72f9ca4ef087")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| sdanna/TeamcityTestSite | src/UnitTests/Properties/AssemblyInfo.cs | C# | mit | 1,394 | [
30522,
2478,
2291,
1012,
9185,
1025,
2478,
2291,
1012,
2448,
7292,
1012,
21624,
8043,
7903,
2229,
1025,
2478,
2291,
1012,
2448,
7292,
1012,
6970,
11923,
2121,
7903,
2229,
1025,
1013,
1013,
2236,
2592,
2055,
2019,
3320,
30524,
1024,
3320,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import React, { Component } from "react";
import PropTypes from "prop-types";
import classnames from "classnames";
import { Components, registerComponent } from "@reactioncommerce/reaction-components";
class CardHeader extends Component {
static defaultProps = {
actAsExpander: false,
expandable: false
};
static propTypes = {
actAsExpander: PropTypes.bool,
children: PropTypes.node,
expandOnSwitchOn: PropTypes.bool,
expanded: PropTypes.bool,
i18nKeyTitle: PropTypes.string,
icon: PropTypes.string,
imageView: PropTypes.node,
onClick: PropTypes.func,
onSwitchChange: PropTypes.func,
showSwitch: PropTypes.bool,
switchName: PropTypes.string,
switchOn: PropTypes.bool,
title: PropTypes.string
};
handleClick = (event) => {
event.preventDefault();
if (typeof this.props.onClick === "function") {
this.props.onClick(event);
}
}
handleSwitchChange = (event, isChecked, name) => {
if (this.props.expandOnSwitchOn && this.props.actAsExpander && this.props.expanded === false && isChecked === true) {
this.handleClick(event);
}
if (typeof this.props.onSwitchChange === "function") {
this.props.onSwitchChange(event, isChecked, name);
}
}
renderTitle() {
if (this.props.title) {
return (
<Components.CardTitle
i18nKeyTitle={this.props.i18nKeyTitle}
title={this.props.title}
/>
);
}
return null;
}
renderImage() {
if (this.props.icon) {
return (
<div className="image">
<Components.Icon icon={this.props.icon} />
</div>
);
}
if (this.props.imageView) {
return (
<div className="image">
{this.props.imageView}
</div>
);
}
return null;
}
renderDisclsoureArrow() {
const expanderClassName = classnames({
rui: true,
expander: true,
open: this.props.expanded
});
return (
<div className={expanderClassName}>
<Components.IconButton
icon="fa fa-angle-down"
bezelStyle="outline"
style={{ borderColor: "#dddddd" }}
onClick={this.handleClick}
/>
</div>
);
}
renderChildren() {
if (this.props.showSwitch) {
return (
<Components.Switch
checked={this.props.switchOn}
name={this.props.switchName}
onChange={this.handleSwitchChange}
/>
);
}
return this.props.children;
}
render() {
const baseClassName = classnames({
"rui": true,
"panel-heading": true,
"card-header": true,
"expandable": this.props.actAsExpander
});
if (this.props.actAsExpander) {
return (
<div className={baseClassName}>
<div className="content-view" onClick={this.handleClick}>
{this.renderImage()}
{this.renderTitle()}
</div>
<div className="action-view">
{this.renderChildren()}
</div>
{this.renderDisclsoureArrow()}
</div>
);
}
return (
<div className={baseClassName}>
<div className="content-view">
{this.renderTitle()}
</div>
<div className="action-view">
{this.props.children}
</div>
</div>
);
}
}
registerComponent("CardHeader", CardHeader);
export default CardHeader;
| xxbooking/reaction | imports/plugins/core/ui/client/components/cards/cardHeader.js | JavaScript | gpl-3.0 | 3,437 | [
30522,
12324,
10509,
1010,
1063,
6922,
1065,
2013,
1000,
10509,
1000,
1025,
12324,
17678,
13874,
2015,
2013,
1000,
17678,
1011,
4127,
1000,
1025,
12324,
2465,
18442,
2015,
2013,
1000,
2465,
18442,
2015,
1000,
1025,
12324,
1063,
6177,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>a30_entityAspect.js</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/3.5.1/build/cssgrids/cssgrids-min.css">
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
<link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
<link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
<script src="http://yui.yahooapis.com/combo?3.5.1/build/yui/yui-min.js"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-34729465-1']);
_gaq.push(['_setDomainName', 'breezejs.com']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body class="yui3-skin-sam">
<script type="text/javascript">
var uvOptions = {};
(function() {
var uv = document.createElement('script'); uv.type = 'text/javascript'; uv.async = true;
uv.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'widget.uservoice.com/GHug452CgVREu58xjoDg.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(uv, s);
})();
</script>
<div id="wrap">
<div id="doc">
<div class="header">
<div class="logo">
<a href="http://www.breezejs.com/home"><img src="http://breeze.github.io/images/logos/breeze_large.png" /></a>
</div>
<div class="primary-nav">
<ul>
<li>
<a href="http://breeze.github.io/doc-js/download.html" target="_blank">Download</a></li>
<li>
<a href="http://learn.breezejs.com/" target="_blank">Tutorials</a></li>
<li>
<a href="http://breeze.github.io/doc-js">Docs</a></li>
<li>
<a href="http://breeze.github.io/doc-samples/">Samples</a></li>
<li>
<a href="http://www.getbreezenow.com/support" target="_blank">Support</a></li>
<li>
<a href="http://www.getbreezenow.com/blog" target="_blank">Blog</a></li>
</ul>
</div>
</div>
<div id="bd" class="yui3-g">
<div class="yui3-u-1-4">
<div id="docs-sidebar" class="sidebar apidocs">
<div id="api-list">
<h2 class="off-left">APIs</h2>
<div id="api-tabview" class="tabview">
<ul class="tabs">
<li><a href="#api-classes">Classes</a></li>
<li><a href="#api-modules">Modules</a></li>
</ul>
<div id="api-tabview-filter">
<input type="search" id="api-filter" placeholder="Type to filter APIs">
</div>
<div id="api-tabview-panel">
<ul id="api-classes" class="apis classes">
<li><a href="../classes/AutoGeneratedKeyType.html">AutoGeneratedKeyType</a></li>
<li><a href="../classes/ComplexAspect.html">ComplexAspect</a></li>
<li><a href="../classes/ComplexType.html">ComplexType</a></li>
<li><a href="../classes/config.html">config</a></li>
<li><a href="../classes/DataProperty.html">DataProperty</a></li>
<li><a href="../classes/DataService.html">DataService</a></li>
<li><a href="../classes/DataType.html">DataType</a></li>
<li><a href="../classes/EntityAction.html">EntityAction</a></li>
<li><a href="../classes/EntityAspect.html">EntityAspect</a></li>
<li><a href="../classes/EntityKey.html">EntityKey</a></li>
<li><a href="../classes/EntityManager.html">EntityManager</a></li>
<li><a href="../classes/EntityQuery.html">EntityQuery</a></li>
<li><a href="../classes/EntityState.html">EntityState</a></li>
<li><a href="../classes/EntityType.html">EntityType</a></li>
<li><a href="../classes/Enum.html">Enum</a></li>
<li><a href="../classes/EnumSymbol.html">EnumSymbol</a></li>
<li><a href="../classes/Event.html">Event</a></li>
<li><a href="../classes/FetchStrategy.html">FetchStrategy</a></li>
<li><a href="../classes/FilterQueryOp.html">FilterQueryOp</a></li>
<li><a href="../classes/HttpResponse.html">HttpResponse</a></li>
<li><a href="../classes/JsonResultsAdapter.html">JsonResultsAdapter</a></li>
<li><a href="../classes/LocalQueryComparisonOptions.html">LocalQueryComparisonOptions</a></li>
<li><a href="../classes/MergeStrategy.html">MergeStrategy</a></li>
<li><a href="../classes/MetadataStore.html">MetadataStore</a></li>
<li><a href="../classes/NamingConvention.html">NamingConvention</a></li>
<li><a href="../classes/NavigationProperty.html">NavigationProperty</a></li>
<li><a href="../classes/Predicate.html">Predicate</a></li>
<li><a href="../classes/Promise.html">Promise</a></li>
<li><a href="../classes/QueryOptions.html">QueryOptions</a></li>
<li><a href="../classes/SaveOptions.html">SaveOptions</a></li>
<li><a href="../classes/ValidationError.html">ValidationError</a></li>
<li><a href="../classes/ValidationOptions.html">ValidationOptions</a></li>
<li><a href="../classes/Validator.html">Validator</a></li>
<li><a href="../classes/~ajax_interface.html">~ajax_interface</a></li>
<li><a href="../classes/~complexArray.html">~complexArray</a></li>
<li><a href="../classes/~keyGenerator_interface.html">~keyGenerator_interface</a></li>
<li><a href="../classes/~primitiveArray.html">~primitiveArray</a></li>
<li><a href="../classes/~relationArray.html">~relationArray</a></li>
</ul>
<ul id="api-modules" class="apis modules">
<li><a href="../modules/breeze.html">breeze</a></li>
<li><a href="../modules/core.html">core</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="yui3-u-3-4">
<div id="api-options">
Show:
<label for="api-show-inherited">
<input type="checkbox" id="api-show-inherited" checked>
Inherited
</label>
<label for="api-show-protected">
<input type="checkbox" id="api-show-protected">
Protected
</label>
<label for="api-show-private">
<input type="checkbox" id="api-show-private">
Private
</label>
<label for="api-show-deprecated">
<input type="checkbox" id="api-show-deprecated">
Deprecated
</label>
</div>
<div class="apidocs">
<div id="docs-main">
<div class="content">
<h1 class="file-heading">File: a30_entityAspect.js</h1>
<div class="file">
<pre class="code prettyprint linenums">
/**
@module breeze
**/
var EntityAspect = (function () {
/**
An EntityAspect instance is associated with every attached entity and is accessed via the entity's 'entityAspect' property.
The EntityAspect itself provides properties to determine and modify the EntityState of the entity and has methods
that provide a variety of services including validation and change tracking.
An EntityAspect will almost never need to be constructed directly. You will usually get an EntityAspect by accessing
an entities 'entityAspect' property. This property will be automatically attached when an entity is created via either
a query, import or EntityManager.createEntity call.
@example
// assume order is an order entity attached to an EntityManager.
var aspect = order.entityAspect;
var currentState = aspect.entityState;
@class EntityAspect
**/
var ctor = function (entity) {
if (entity === null) {
var nullInstance = EntityAspect._nullInstance;
if (nullInstance) return nullInstance;
EntityAspect._nullInstance = this;
} else if (entity === undefined) {
throw new Error("The EntityAspect ctor requires an entity as its only argument.");
} else if (entity.entityAspect) {
return entity.entityAspect;
}
// if called without new
if (!(this instanceof EntityAspect)) {
return new EntityAspect(entity);
}
this.entity = entity;
// TODO: keep public or not?
this.entityGroup = null;
this.entityManager = null;
this.entityState = EntityState.Detached;
this.isBeingSaved = false;
this.originalValues = {};
this.hasValidationErrors = false;
this._validationErrors = {};
// Uncomment when we implement entityAspect.isNavigationPropertyLoaded method
// this._loadedNavPropMap = {};
this.validationErrorsChanged = new Event("validationErrorsChanged", this);
this.propertyChanged = new Event("propertyChanged", this);
// in case this is the NULL entityAspect. - used with ComplexAspects that have no parent.
// lists that control many-to-many links between entities
this.resetLinks();
if (entity != null) {
entity.entityAspect = this;
// entityType should already be on the entity from 'watch'
var entityType = entity.entityType || entity._$entityType;
if (!entityType) {
var typeName = entity.prototype._$typeName;
if (!typeName) {
throw new Error("This entity is not registered as a valid EntityType");
} else {
throw new Error("Metadata for this entityType has not yet been resolved: " + typeName);
}
}
var entityCtor = entityType.getEntityCtor();
__modelLibraryDef.getDefaultInstance().startTracking(entity, entityCtor.prototype);
}
};
var proto = ctor.prototype;
proto.resetLinks = function () {
this.inseredLinks = [];
this.removedLinks = [];
};
proto.insertLink = function (childEntity, np) {
var removedLink = __arrayFirst(this.removedLinks, function (link) {
return link.entity === childEntity && (link.np == np || link.np == np.inverse);
});
if (removedLink !== null) {
var removedIndexOf = this.removedLinks.indexOf(removedLink);
this.removedLinks.splice(removedIndexOf, 1);
return;
}
var inseredLink = __arrayFirst(this.inseredLinks, function (link) {
return link.entity === childEntity && (link.np == np || link.np == np.inverse);
});
if (inseredLink == null) {
this.inseredLinks.push({ entity: childEntity, np: np });
if (this.entityManager !== null
&& !this.entityState.isAdded() && !this.entityState.isDeleted())
this.setModified();
}
};
proto.removeLink = function (childEntity, np) {
var inseredLink = __arrayFirst(this.inseredLinks, function (link) {
return link.entity === childEntity && (link.np == np || link.np == np.inverse);
});
if (inseredLink !== null) {
var inseredIndexOf = this.inseredLinks.indexOf(inseredLink);
this.inseredLinks.splice(inseredIndexOf, 1);
return;
}
var removedLink = __arrayFirst(this.removedLinks, function (link) {
return link.entity === childEntity && (link.np == np || link.np == np.inverse);
});
if (removedLink == null) {
this.removedLinks.push({ entity: childEntity, np: np });
if (!this.entityState.isAdded() && !this.entityState.isDeleted())
this.setModified();
}
};
Event.bubbleEvent(proto, function () {
return this.entityManager;
});
/**
The Entity that this aspect is associated with.
__readOnly__
@property entity {Entity}
**/
/**
The {{#crossLink "EntityManager"}}{{/crossLink}} that contains this entity.
__readOnly__
@property entityManager {EntityManager}
**/
/**
The {{#crossLink "EntityState"}}{{/crossLink}} of this entity.
__readOnly__
@property entityState {EntityState}
**/
/**
Extra metadata about this entity such as the entity's etag.
You may extend this object with your own metadata information.
Breeze (de)serializes this object when importing/exporting the entity.
@property extraMetadata {Object}
**/
/**
Whether this entity is in the process of being saved.
__readOnly__
@property isBeingSaved {Boolean}
**/
/**
Whether this entity has any validation errors.
__readOnly__
@property hasValidationErrors {Boolean}
**/
/**
The 'original values' of this entity where they are different from the 'current values'.
This is a map where the key is a property name and the value is the 'original value' of the property.
__readOnly__
@property originalValues {Object}
**/
/**
An {{#crossLink "Event"}}{{/crossLink}} that fires whenever a value of one of this entity's properties change.
@example
// assume order is an order entity attached to an EntityManager.
order.entityAspect.propertyChanged.subscribe(
function (propertyChangedArgs) {
// this code will be executed anytime a property value changes on the 'order' entity.
var entity = propertyChangedArgs.entity; // Note: entity === order
var propertyNameChanged = propertyChangedArgs.propertyName;
var oldValue = propertyChangedArgs.oldValue;
var newValue = propertyChangedArgs.newValue;
});
@event propertyChanged
@param entity {Entity} The entity whose property has changed.
@param property {DataProperty} The DataProperty that changed.
@param propertyName {String} The name of the property that changed. This value will be 'null' for operations that replace the entire entity. This includes
queries, imports and saves that require a merge. The remaining parameters will not exist in this case either. This will actually be a "property path"
for any properties of a complex type.
@param oldValue {Object} The old value of this property before the change.
@param newValue {Object} The new value of this property after the change.
@param parent {Object} The immediate parent object for the changed property. This will be different from the 'entity' for any complex type or nested complex type properties.
@readOnly
**/
/**
An {{#crossLink "Event"}}{{/crossLink}} that fires whenever any of the validation errors on this entity change.
Note that this might be the removal of an error when some data on the entity is fixed.
@example
// assume order is an order entity attached to an EntityManager.
order.entityAspect.validationErrorsChanged.subscribe(
function (validationChangeArgs) {
// this code will be executed anytime a property value changes on the 'order' entity.
var entity == validationChangeArgs.entity; // Note: entity === order
var errorsAdded = validationChangeArgs.added;
var errorsCleared = validationChangeArgs.removed;
});
@event validationErrorsChanged
@param entity {Entity} The entity on which the validation errors are being added or removed.
@param added {Array of ValidationError} An array containing any newly added {{#crossLink "ValidationError"}}{{/crossLink}}s
@param removed {Array of ValidationError} An array containing any newly removed {{#crossLink "ValidationError"}}{{/crossLink}}s. This is those
errors that have been 'fixed'
@readOnly
**/
/**
Returns the {{#crossLink "EntityKey"}}{{/crossLink}} for this Entity.
@example
// assume order is an order entity attached to an EntityManager.
var entityKey = order.entityAspect.getKey();
@method getKey
@param [forceRefresh=false] {Boolean} Forces the recalculation of the key. This should normally be unnecessary.
@return {EntityKey} The {{#crossLink "EntityKey"}}{{/crossLink}} associated with this Entity.
**/
proto.getKey = function (forceRefresh) {
forceRefresh = assertParam(forceRefresh, "forceRefresh").isBoolean().isOptional().check(false);
if (forceRefresh || !this._entityKey) {
var entityType = this.entity.entityType;
var keyProps = entityType.keyProperties;
var values = keyProps.map(function (p) {
return this.entity.getProperty(p.name);
}, this);
this._entityKey = new EntityKey(entityType, values);
}
return this._entityKey;
};
/**
Returns the entity to an {{#crossLink "EntityState"}}{{/crossLink}} of 'Unchanged' by committing all changes made since the entity was last queried
had 'acceptChanges' called on it.
@example
// assume order is an order entity attached to an EntityManager.
order.entityAspect.acceptChanges();
// The 'order' entity will now be in an 'Unchanged' state with any changes committed.
@method acceptChanges
**/
proto.acceptChanges = function () {
this._checkOperation("acceptChanges");
var em = this.entityManager;
if (this.entityState.isDeleted()) {
em.detachEntity(this.entity);
} else {
this.setUnchanged();
}
em.entityChanged.publish({ entityAction: EntityAction.AcceptChanges, entity: this.entity });
};
/**
Returns the entity to an EntityState of 'Unchanged' by rejecting all changes made to it since the entity was last queried
had 'rejectChanges' called on it.
@example
// assume order is an order entity attached to an EntityManager.
order.entityAspect.rejectChanges();
// The 'order' entity will now be in an 'Unchanged' state with any changes rejected.
@method rejectChanges
**/
proto.rejectChanges = function () {
this._checkOperation("rejectChanges");
var entity = this.entity;
var entityManager = this.entityManager;
if (entityManager) {
// we do not want PropertyChange or EntityChange events to occur here
__using(entityManager, "isRejectingChanges", true, function () {
rejectChangesCore(entity);
});
if (this.entityState.isAdded()) {
// next line is needed because the following line will cause this.entityManager -> null;
entityManager.detachEntity(entity);
// need to tell em that an entity that needed to be saved no longer does.
entityManager._notifyStateChange(entity, false);
} else {
if (this.entityState.isDeleted()) {
this.entityManager._linkRelatedEntities(entity);
}
this.setUnchanged();
// propertyChanged propertyName is null because more than one property may have changed.
this.propertyChanged.publish({ entity: entity, propertyName: null });
this.entityManager.entityChanged.publish({ entityAction: EntityAction.RejectChanges, entity: entity });
}
}
};
function rejectChangesCore(target) {
var aspect = target.entityAspect || target.complexAspect;
var stype = target.entityType || target.complexType;
var originalValues = aspect.originalValues;
for (var propName in originalValues) {
target.setProperty(propName, originalValues[propName]);
}
stype.complexProperties.forEach(function (cp) {
var cos = target.getProperty(cp.name);
if (cp.isScalar) {
rejectChangesCore(cos);
} else {
cos._rejectChanges();
cos.forEach(rejectChangesCore);
}
});
}
proto.getPropertyPath = function (propName) {
return propName;
}
/**
Sets the entity to an EntityState of 'Added'. This is NOT the equivalent of calling {{#crossLink "EntityManager/addEntity"}}{{/crossLink}}
because no key generation will occur for autogenerated keys as a result of this operation. As a result this operation can be problematic
unless you are certain that the entity being marked 'Added' does not already exist in the database and does not have an autogenerated key.
The same operation can be performed by calling {{#crossLink "EntityAspect/setEntityState"}}{{/crossLink}}.
@example
// assume order is an order entity attached to an EntityManager.
order.entityAspect.setAdded();
// The 'order' entity will now be in an 'Added' state.
@method setAdded
**/
proto.setAdded = function () {
return this.setEntityState(EntityState.Added);
}
/**
Sets the entity to an EntityState of 'Unchanged'. This is also the equivalent of calling {{#crossLink "EntityAspect/acceptChanges"}}{{/crossLink}}.
The same operation can be performed by calling {{#crossLink "EntityAspect/setEntityState"}}{{/crossLink}}.
@example
// assume order is an order entity attached to an EntityManager.
order.entityAspect.setUnchanged();
// The 'order' entity will now be in an 'Unchanged' state with any changes committed.
@method setUnchanged
**/
proto.setUnchanged = function () {
this.resetLinks();
return this.setEntityState(EntityState.Unchanged);
};
/**
Sets the entity to an EntityState of 'Modified'. This can also be achieved by changing the value of any property on an 'Unchanged' entity.
The same operation can be performed by calling {{#crossLink "EntityAspect/setEntityState"}}{{/crossLink}}.
@example
// assume order is an order entity attached to an EntityManager.
order.entityAspect.setModified();
// The 'order' entity will now be in a 'Modified' state.
@method setModified
**/
proto.setModified = function () {
return this.setEntityState(EntityState.Modified);
};
/**
Sets the entity to an EntityState of 'Deleted'. This both marks the entity as being scheduled for deletion during the next 'Save' call
but also removes the entity from all of its related entities.
The same operation can be performed by calling {{#crossLink "EntityAspect/setEntityState"}}{{/crossLink}}.
@example
// assume order is an order entity attached to an EntityManager.
order.entityAspect.setDeleted();
// The 'order' entity will now be in a 'Deleted' state and it will no longer have any 'related' entities.
@method setDeleted
**/
proto.setDeleted = function () {
return this.setEntityState(EntityState.Deleted);
};
/**
Sets the entity to an EntityState of 'Detached'. This removes the entity from all of its related entities, but does NOT change the EntityState of any existing entities.
The same operation can be performed by calling {{#crossLink "EntityAspect/setEntityState"}}{{/crossLink}}.
@example
// assume order is an order entity attached to an EntityManager.
order.entityAspect.setDetached();
// The 'order' entity will now be in a 'Detached' state and it will no longer have any 'related' entities.
@method setDetached
**/
proto.setDetached = function () {
return this.setEntityState(EntityState.Detached);
}
/**
Sets the entity to the specified EntityState. See also 'setUnchanged', 'setModified', 'setDetached', etc.
@example
// assume order is an order entity attached to an EntityManager.
order.entityAspect.setEntityState(EntityState.Unchanged);
// The 'order' entity will now be in a 'Unchanged' state.
@method setEntityState
**/
proto.setEntityState = function (entityState) {
if (this.entityState === entityState) return false;
this._checkOperation("setEntityState");
if (this.entityState.isDetached()) {
throw new Error("You cannot set the 'entityState' of an entity when it is detached - except by first attaching it to an EntityManager");
}
var entity = this.entity;
var em = this.entityManager;
var needsSave = true;
if (entityState === EntityState.Unchanged) {
clearOriginalValues(entity);
delete this.hasTempKey;
needsSave = false;
} else if (entityState === EntityState.Added) {
clearOriginalValues(entity);
// TODO: more to do here... like regenerating key ???
} else if (entityState === EntityState.Deleted) {
if (this.entityState.isAdded()) {
// turn it into a detach and exit early
this.setEntityState(EntityState.Detached);
return true;
} else {
// TODO: think about cascade deletes
// entityState needs to be set it early in this one case to insure that fk's are not cleared.
this.entityState = EntityState.Deleted;
removeFromRelations(entity, EntityState.Deleted);
}
} else if (entityState === EntityState.Modified) {
// nothing extra needed
} else if (entityState === EntityState.Detached) {
var group = this.entityGroup;
// no group === already detached.
if (!group) return false;
group.detachEntity(entity);
// needs to occur early here - so this IS deliberately redundent with the same code later in this method.
this.entityState = entityState;
removeFromRelations(entity, EntityState.Detached);
this._detach();
em.entityChanged.publish({ entityAction: EntityAction.Detach, entity: entity });
needsSave = false;
}
this.entityState = entityState;
em._notifyStateChange(entity, needsSave);
return true;
}
function clearOriginalValues(target) {
var aspect = target.entityAspect || target.complexAspect;
aspect.originalValues = {};
var stype = target.entityType || target.complexType;
stype.complexProperties.forEach(function (cp) {
var cos = target.getProperty(cp.name);
if (cp.isScalar) {
clearOriginalValues(cos);
} else {
cos._acceptChanges();
cos.forEach(clearOriginalValues);
}
});
}
/**
Performs a query for the value of a specified {{#crossLink "NavigationProperty"}}{{/crossLink}}.
@example
emp.entityAspect.loadNavigationProperty("Orders").then(function (data) {
var orders = data.results;
}).fail(function (exception) {
// handle exception here;
});
@method loadNavigationProperty
@async
@param navigationProperty {NavigationProperty|String} The NavigationProperty or the name of the NavigationProperty to 'load'.
@param [callback] {Function} Function to call on success.
@param [errorCallback] {Function} Function to call on failure.
@return {Promise}
- properties of success promise
- results {Array of Entity}
- query {EntityQuery} The original query
- httpResponse {httpResponse} The HttpResponse returned from the server.
**/
proto.loadNavigationProperty = function (navigationProperty, callback, errorCallback) {
var entity = this.entity;
var navProperty = entity.entityType._checkNavProperty(navigationProperty);
var query = EntityQuery.fromEntityNavigation(entity, navProperty);
// return entity.entityAspect.entityManager.executeQuery(query, callback, errorCallback);
var promise = entity.entityAspect.entityManager.executeQuery(query);
var that = this;
return promise.then(function (data) {
that._markAsLoaded(navProperty.name);
if (callback) callback(data);
return Q.resolve(data);
}, function (error) {
if (errorCallback) errorCallback(error);
return Q.reject(error);
});
};
/**
Marks this navigationProperty on this entity as already having been loaded.
@example
emp.entityAspect.markNavigationPropertyAsLoaded("Orders");
@method markAsLoaded
@async
@param navigationProperty {NavigationProperty|String} The NavigationProperty or name of NavigationProperty to 'load'.
**/
proto.markNavigationPropertyAsLoaded = function (navigationProperty) {
var navProperty = this.entity.entityType._checkNavProperty(navigationProperty);
this._markAsLoaded(navProperty.name);
}
/**
Determines whether a navigationProperty on this entity has already been loaded.
@example
A navigation property is considered loaded when any of the following three conditions applies:
1) It was fetched from the backend server.
a) This can be the result of an expand query or a call to the EntityAspect.loadNavigationProperty method.
b) Note that even if the fetch returns nothing the property is still marked as loaded in this case.
2) The property is scalar and has been set to a nonnull value.
3) The EntityAspect.markNavigationPropertyAsLoaded was called.
@example
var wasLoaded = emp.entityAspect.isNavigationPropertyLoaded("Orders");
@method isNavigationPropertyLoaded
@param navigationProperty {NavigationProperty|String} The NavigationProperty or name of NavigationProperty to 'load'.
**/
proto.isNavigationPropertyLoaded = function (navigationProperty) {
var navProperty = this.entity.entityType._checkNavProperty(navigationProperty);
if (navProperty.isScalar && this.entity.getProperty(navProperty.name) != null) {
return true;
}
return this._loadedNps && this._loadedNps.indexOf(navProperty.name) >= 0;
}
proto._markAsLoaded = function (navPropName) {
this._loadedNps = this._loadedNps || [];
__arrayAddItemUnique(this._loadedNps, navPropName);
}
/**
Performs validation on the entity, any errors encountered during the validation are available via the
{{#crossLink "EntityAspect.getValidationErrors"}}{{/crossLink}} method. Validating an entity means executing
all of the validators on both the entity itself as well as those on each of its properties.
@example
// assume order is an order entity attached to an EntityManager.
var isOk = order.entityAspect.validateEntity();
// isOk will be 'true' if there are no errors on the entity.
if (!isOk) {
var errors = order.entityAspect.getValidationErrors();
}
@method validateEntity
@return {Boolean} Whether the entity passed validation.
**/
proto.validateEntity = function () {
var ok = true;
this._processValidationOpAndPublish(function (that) {
ok = validateTarget(that.entity);
});
return ok;
};
// coIndex is only used where target is a complex object that is part of an array of complex objects
// in which case ctIndex is the index of the target within the array.
function validateTarget(target, coIndex) {
var ok = true;
var stype = target.entityType || target.complexType;
var aspect = target.entityAspect || target.complexAspect;
var entityAspect = target.entityAspect || target.complexAspect.getEntityAspect();
var context = { entity: entityAspect.entity };
if (coIndex !== undefined) {
context.index = coIndex;
}
stype.getProperties().forEach(function (p) {
var value = target.getProperty(p.name);
var validators = p.getAllValidators();
if (validators.length > 0) {
context.property = p;
context.propertyName = aspect.getPropertyPath(p.name);
ok = entityAspect._validateProperty(value, context) && ok;
}
if (p.isComplexProperty) {
if (p.isScalar) {
ok = validateTarget(value) && ok;
} else {
ok = value.reduce(function (pv, cv, ix) {
return validateTarget(cv, ix) && pv;
}, ok);
}
}
});
// then target level
stype.getAllValidators().forEach(function (validator) {
ok = validate(entityAspect, validator, target) && ok;
});
return ok;
}
/**
Performs validation on a specific property of this entity, any errors encountered during the validation are available via the
{{#crossLink "EntityAspect.getValidationErrors"}}{{/crossLink}} method. Validating a property means executing
all of the validators on the specified property. This call is also made automatically anytime a property
of an entity is changed.
@example
// assume order is an order entity attached to an EntityManager.
var isOk = order.entityAspect.validateProperty("Order");
or
@example
var orderDateProperty = order.entityType.getProperty("OrderDate");
var isOk = order.entityAspect.validateProperty(OrderDateProperty);
@method validateProperty
@param property {DataProperty|NavigationProperty|String} The {{#crossLink "DataProperty"}}{{/crossLink}} or
{{#crossLink "NavigationProperty"}}{{/crossLink}} to validate or a string with the name of the property or a property path with
the path to a property of a complex object.
@param [context] {Object} A context object used to pass additional information to each {{#crossLink "Validator"}}{{/crossLink}}
@return {Boolean} Whether the entity passed validation.
**/
proto.validateProperty = function (property, context) {
var value = this.getPropertyValue(property); // performs validations
if (value && value.complexAspect) {
return validateTarget(value);
}
context = context || {};
context.entity = this.entity;
if (typeof (property) === 'string') {
context.property = this.entity.entityType.getProperty(property, true);
context.propertyName = property;
} else {
context.property = property;
context.propertyName = property.name;
}
return this._validateProperty(value, context);
};
/**
Returns the validation errors associated with either the entire entity or any specified property.
@example
This method can return all of the errors for an Entity
@example
// assume order is an order entity attached to an EntityManager.
var valErrors = order.entityAspect.getValidationErrors();
as well as those for just a specific property.
@example
// assume order is an order entity attached to an EntityManager.
var orderDateErrors = order.entityAspect.getValidationErrors("OrderDate");
which can also be expressed as
@example
// assume order is an order entity attached to an EntityManager.
var orderDateProperty = order.entityType.getProperty("OrderDate");
var orderDateErrors = order.entityAspect.getValidationErrors(orderDateProperty);
@method getValidationErrors
@param [property] {DataProperty|NavigationProperty} The property for which validation errors should be retrieved.
If omitted, all of the validation errors for this entity will be returned.
@return {Array of ValidationError}
**/
proto.getValidationErrors = function (property) {
assertParam(property, "property").isOptional().isEntityProperty().or().isString().check();
var result = __getOwnPropertyValues(this._validationErrors);
if (property) {
var propertyName = typeof (property) === 'string' ? property : property.name;
result = result.filter(function (ve) {
return ve.property && (ve.property.name === propertyName || (propertyName.indexOf(".") != -1 && ve.propertyName == propertyName));
});
}
return result;
};
/**
Adds a validation error.
@method addValidationError
@param validationError {ValidationError}
**/
proto.addValidationError = function (validationError) {
assertParam(validationError, "validationError").isInstanceOf(ValidationError).check();
this._processValidationOpAndPublish(function (that) {
that._addValidationError(validationError);
});
};
/**
Removes a validation error.
@method removeValidationError
@param validationErrorOrKey {ValidationError|String} Either a ValidationError or a ValidationError 'key' value
**/
proto.removeValidationError = function (validationErrorOrKey) {
assertParam(validationErrorOrKey, "validationErrorOrKey").isString().or().isInstanceOf(ValidationError).or().isInstanceOf(Validator).check();
var key = (typeof (validationErrorOrKey) === "string") ? validationErrorOrKey : validationErrorOrKey.key;
this._processValidationOpAndPublish(function (that) {
that._removeValidationError(key);
});
};
/**
Removes all of the validation errors for a specified entity
@method clearValidationErrors
**/
proto.clearValidationErrors = function () {
this._processValidationOpAndPublish(function (that) {
__objectForEach(that._validationErrors, function (key, valError) {
if (valError) {
delete that._validationErrors[key];
that._pendingValidationResult.removed.push(valError);
}
});
that.hasValidationErrors = !__isEmpty(that._validationErrors);
});
};
// returns null for np's that do not have a parentKey
proto.getParentKey = function (navigationProperty) {
// NavigationProperty doesn't yet exist
// assertParam(navigationProperty, "navigationProperty").isInstanceOf(NavigationProperty).check();
var fkNames = navigationProperty.foreignKeyNames;
if (fkNames.length === 0) return null;
var that = this;
var fkValues = fkNames.map(function (fkn) {
return that.entity.getProperty(fkn);
});
return new EntityKey(navigationProperty.entityType, fkValues);
};
proto.getPropertyValue = function (property) {
assertParam(property, "property").isString().or().isEntityProperty().check();
var value;
if (typeof (property) === 'string') {
var propNames = property.trim().split(".");
var propName = propNames.shift();
value = this.entity;
value = value.getProperty(propName);
while (propNames.length > 0) {
propName = propNames.shift();
value = value.getProperty(propName);
}
} else {
if (!(property.parentType instanceof EntityType)) {
throw new Error("The validateProperty method does not accept a 'property' parameter whose parentType is a ComplexType; " +
"Pass a 'property path' string as the 'property' parameter instead ");
}
value = this.entity.getProperty(property.name);
}
return value;
};
// internal methods
proto._checkOperation = function(operationName) {
if (this.isBeingSaved) {
throw new Error("Cannot perform a '" + operationName + "' on an entity that is in the process of being saved");
}
// allows chaining
return this;
}
proto._detach = function () {
this.entityGroup = null;
this.entityManager = null;
this.entityState = EntityState.Detached;
this.originalValues = {};
this._validationErrors = {};
this.hasValidationErrors = false;
this.validationErrorsChanged.clear();
this.propertyChanged.clear();
};
// called from defaultInterceptor.
proto._validateProperty = function (value, context) {
var ok = true;
this._processValidationOpAndPublish(function (that) {
context.property.getAllValidators().forEach(function (validator) {
ok = validate(that, validator, value, context) && ok;
});
});
return ok;
};
proto._processValidationOpAndPublish = function (validationFn) {
if (this._pendingValidationResult) {
// only top level processValidations call publishes
validationFn(this);
} else {
try {
this._pendingValidationResult = { entity: this.entity, added: [], removed: [] };
validationFn(this);
if (this._pendingValidationResult.added.length > 0 || this._pendingValidationResult.removed.length > 0) {
this.validationErrorsChanged.publish(this._pendingValidationResult);
// this might be a detached entity hence the guard below.
this.entityManager && this.entityManager.validationErrorsChanged.publish(this._pendingValidationResult);
}
} finally {
this._pendingValidationResult = undefined;
}
}
};
proto._addValidationError = function (validationError) {
this._validationErrors[validationError.key] = validationError;
this.hasValidationErrors = true;
this._pendingValidationResult.added.push(validationError);
};
proto._removeValidationError = function (key) {
var valError = this._validationErrors[key];
if (valError) {
delete this._validationErrors[key];
this.hasValidationErrors = !__isEmpty(this._validationErrors);
this._pendingValidationResult.removed.push(valError);
}
};
function removeFromRelations(entity, entityState) {
// remove this entity from any collections.
// mark the entity deleted or detached
var isDeleted = entityState.isDeleted();
if (isDeleted) {
removeFromRelationsCore(entity);
} else {
__using(entity.entityAspect.entityManager, "isLoading", true, function () {
removeFromRelationsCore(entity);
});
}
}
function removeFromRelationsCore(entity) {
entity.entityType.navigationProperties.forEach(function (np) {
var inverseNp = np.inverse;
var npValue = entity.getProperty(np.name);
if (np.isScalar) {
if (npValue) {
if (inverseNp) {
if (inverseNp.isScalar) {
// Verify if child entity of a deleted entity has a required navigation property
// then set child as detached to pass responsibility to server..
var property = inverseNp.relatedDataProperties ?
inverseNp.relatedDataProperties[0] : null;
if (property && !property.isNullable) {
npValue.entityAspect.setDetached();
} else {
npValue.setProperty(inverseNp.name, null);
}
} else {
var collection = npValue.getProperty(inverseNp.name);
if (collection.length) {
__arrayRemoveItem(collection, entity);
}
}
}
entity.setProperty(np.name, null);
}
} else {
if (inverseNp) {
// npValue is a live list so we need to copy it first.
npValue.slice(0).forEach(function (v) {
if (inverseNp.isScalar) {
// Verify if child entity of a deleted entity has a required navigation property
// then set child as detached to pass responsibility to server..
var property = inverseNp.relatedDataProperties ?
inverseNp.relatedDataProperties[0] : null;
if (property && !property.isNullable) {
v.entityAspect.setDetached();
} else {
v.setProperty(inverseNp.name, null);
}
} else {
// TODO: many to many - not yet handled.
}
});
}
// now clear it.
npValue.length = 0;
}
});
};
// note entityAspect only - ( no complex aspect allowed on the call).
function validate(entityAspect, validator, value, context) {
var ve = validator.validate(value, context);
if (ve) {
entityAspect._addValidationError(ve);
return false;
} else {
var key = ValidationError.getKey(validator, context ? context.propertyName : null);
entityAspect._removeValidationError(key);
return true;
}
}
return ctor;
})();
var ComplexAspect = (function () {
/**
An ComplexAspect instance is associated with every complex object instance and is accessed via the complex object's 'complexAspect' property.
The ComplexAspect itself provides properties to determine the parent object, parent property and original values for the complex object.
A ComplexAspect will almost never need to be constructed directly. You will usually get an ComplexAspect by accessing
an entities 'complexAspect' property. This property will be automatically attached when an complex object is created as part of an
entity via either a query, import or EntityManager.createEntity call.
@example
// assume address is a complex property on the 'Customer' type
var aspect = aCustomer.address.complexAspect;
// aCustomer === aspect.parent;
@class ComplexAspect
**/
var ctor = function ComplexAspect(complexObject, parent, parentProperty) {
if (!complexObject) {
throw new Error("The ComplexAspect ctor requires an entity as its only argument.");
}
if (complexObject.complexAspect) {
return complexObject.complexAspect;
}
// if called without new
if (!(this instanceof ComplexAspect)) {
return new ComplexAspect(complexObject, parent, parentProperty);
}
// entityType should already be on the entity from 'watch'
this.complexObject = complexObject;
complexObject.complexAspect = this;
// TODO: keep public or not?
this.originalValues = {};
// if a standalone complexObject
if (parent != null) {
this.parent = parent;
this.parentProperty = parentProperty;
}
var complexType = complexObject.complexType;
if (!complexType) {
var typeName = complexObject.prototype._$typeName;
if (!typeName) {
throw new Error("This entity is not registered as a valid ComplexType");
} else {
throw new Error("Metadata for this complexType has not yet been resolved: " + typeName);
}
}
var complexCtor = complexType.getCtor();
__modelLibraryDef.getDefaultInstance().startTracking(complexObject, complexCtor.prototype);
};
var proto = ctor.prototype;
/**
The complex object that this aspect is associated with.
__readOnly__
@property complexObject {Entity}
**/
/**
The parent object that to which this aspect belongs; this will either be an entity or another complex object.
__readOnly__
@property parent {Entity|ComplexObject}
**/
/**
The {{#crossLink "DataProperty"}}{{/crossLink}} on the 'parent' that contains this complex object.
__readOnly__
@property parentProperty {DataProperty}
**/
/**
The 'original values' of this complex object where they are different from the 'current values'.
This is a map where the key is a property name and the value is the 'original value' of the property.
__readOnly__
@property originalValues {Object}
**/
/**
Returns the EntityAspect for the top level entity tht contains this complex object.
@method getEntityAspect
@return {String}
**/
proto.getEntityAspect = function () {
var parent = this.parent;
if (!parent) return new EntityAspect(null);
var entityAspect = parent.entityAspect;
while (parent && !entityAspect) {
parent = parent.complexAspect && parent.complexAspect.parent;
entityAspect = parent && parent.entityAspect;
}
return entityAspect || new EntityAspect(null);
}
/**
Executes the specified query against this EntityManager's local cache.
@method getPropertyPath
@param propName {String} The property name of a property on this complex aspect for which we want the full path.
@return {String} The 'property path' from the top level entity that contains this complex object to this object.
**/
proto.getPropertyPath = function (propName) {
var parent = this.parent;
if (!parent) return null;
var aspect = parent.complexAspect || parent.entityAspect;
return aspect.getPropertyPath(this.parentProperty.name + "." + propName);
}
return ctor;
})();
breeze.EntityAspect = EntityAspect;
breeze.ComplexAspect = ComplexAspect;
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="primary-nav-foot">
<ul>
<li>
<a href="http://breeze.github.io/doc-js/download.html" target="_blank">Download</a></li>
<li>
<a href="http://learn.breezejs.com/" target="_blank">Tutorials</a></li>
<li>
<a href="http://breeze.github.io/doc-js/">Docs</a></li>
<li>
<a href="http://breeze.github.io/doc-samples/">Samples</a></li>
<li>
<a href="http://stackoverflow.com/questions/tagged/breeze?sort=newest" target="_blank">Questions</a></li>
<li>
<a href="http://www.getbreezenow.com/support" target="_blank">Support</a></li>
</ul>
</div>
</div>
</div>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../assets/../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>
| Iarly/breeze.js | docs/api-docs/files/a30_entityAspect.js.html | HTML | mit | 53,213 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
2516,
1028,
1037,
14142,
1035,
9178,
3022,
505... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!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_31) on Fri Oct 05 17:19:52 PDT 2012 -->
<TITLE>
Uses of Class org.apache.hadoop.io.SequenceFile.CompressionType (Hadoop 0.20.2-cdh3u5 API)
</TITLE>
<META NAME="date" CONTENT="2012-10-05">
<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 org.apache.hadoop.io.SequenceFile.CompressionType (Hadoop 0.20.2-cdh3u5 API)";
}
}
</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> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/apache/hadoop/io//class-useSequenceFile.CompressionType.html" target="_top"><B>FRAMES</B></A>
<A HREF="SequenceFile.CompressionType.html" target="_top"><B>NO FRAMES</B></A>
<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>org.apache.hadoop.io.SequenceFile.CompressionType</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="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.apache.hadoop.io"><B>org.apache.hadoop.io</B></A></TD>
<TD>Generic i/o code for use when reading and writing data to the network,
to databases, and to files. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.apache.hadoop.mapred"><B>org.apache.hadoop.mapred</B></A></TD>
<TD>A software framework for easily writing applications which process vast
amounts of data (multi-terabyte data-sets) parallelly on large clusters
(thousands of nodes) built of commodity hardware in a reliable, fault-tolerant
manner. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.apache.hadoop.mapreduce.lib.output"><B>org.apache.hadoop.mapreduce.lib.output</B></A></TD>
<TD> </TD>
</TR>
</TABLE>
<P>
<A NAME="org.apache.hadoop.io"><!-- --></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="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> in <A HREF="../../../../../org/apache/hadoop/io/package-summary.html">org.apache.hadoop.io</A></FONT></TH>
</TR>
</TABLE>
<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="../../../../../org/apache/hadoop/io/package-summary.html">org.apache.hadoop.io</A> that return <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A></CODE></FONT></TD>
<TD><CODE><B>SequenceFile.</B><B><A HREF="../../../../../org/apache/hadoop/io/SequenceFile.html#getCompressionType(org.apache.hadoop.conf.Configuration)">getCompressionType</A></B>(<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> job)</CODE>
<BR>
<B>Deprecated.</B> <I>Use
<A HREF="../../../../../org/apache/hadoop/mapred/SequenceFileOutputFormat.html#getOutputCompressionType(org.apache.hadoop.mapred.JobConf)"><CODE>SequenceFileOutputFormat.getOutputCompressionType(org.apache.hadoop.mapred.JobConf)</CODE></A>
to get <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io"><CODE>SequenceFile.CompressionType</CODE></A> for job-outputs.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A></CODE></FONT></TD>
<TD><CODE><B>SequenceFile.CompressionType.</B><B><A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html#valueOf(java.lang.String)">valueOf</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> name)</CODE>
<BR>
Returns the enum constant of this type with the specified name.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A>[]</CODE></FONT></TD>
<TD><CODE><B>SequenceFile.CompressionType.</B><B><A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html#values()">values</A></B>()</CODE>
<BR>
Returns an array containing the constants of this enum type, in
the order they are declared.</TD>
</TR>
</TABLE>
<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="../../../../../org/apache/hadoop/io/package-summary.html">org.apache.hadoop.io</A> with parameters of type <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.Writer.html" title="class in org.apache.hadoop.io">SequenceFile.Writer</A></CODE></FONT></TD>
<TD><CODE><B>SequenceFile.</B><B><A HREF="../../../../../org/apache/hadoop/io/SequenceFile.html#createWriter(org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.FSDataOutputStream, java.lang.Class, java.lang.Class, org.apache.hadoop.io.SequenceFile.CompressionType, org.apache.hadoop.io.compress.CompressionCodec)">createWriter</A></B>(<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/FSDataOutputStream.html" title="class in org.apache.hadoop.fs">FSDataOutputStream</A> out,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> keyClass,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> valClass,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compressionType,
<A HREF="../../../../../org/apache/hadoop/io/compress/CompressionCodec.html" title="interface in org.apache.hadoop.io.compress">CompressionCodec</A> codec)</CODE>
<BR>
Construct the preferred type of 'raw' SequenceFile Writer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.Writer.html" title="class in org.apache.hadoop.io">SequenceFile.Writer</A></CODE></FONT></TD>
<TD><CODE><B>SequenceFile.</B><B><A HREF="../../../../../org/apache/hadoop/io/SequenceFile.html#createWriter(org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.FSDataOutputStream, java.lang.Class, java.lang.Class, org.apache.hadoop.io.SequenceFile.CompressionType, org.apache.hadoop.io.compress.CompressionCodec, org.apache.hadoop.io.SequenceFile.Metadata)">createWriter</A></B>(<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/FSDataOutputStream.html" title="class in org.apache.hadoop.fs">FSDataOutputStream</A> out,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> keyClass,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> valClass,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compressionType,
<A HREF="../../../../../org/apache/hadoop/io/compress/CompressionCodec.html" title="interface in org.apache.hadoop.io.compress">CompressionCodec</A> codec,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.Metadata.html" title="class in org.apache.hadoop.io">SequenceFile.Metadata</A> metadata)</CODE>
<BR>
Construct the preferred type of 'raw' SequenceFile Writer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.Writer.html" title="class in org.apache.hadoop.io">SequenceFile.Writer</A></CODE></FONT></TD>
<TD><CODE><B>SequenceFile.</B><B><A HREF="../../../../../org/apache/hadoop/io/SequenceFile.html#createWriter(org.apache.hadoop.fs.FileSystem, org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.Path, java.lang.Class, java.lang.Class, int, short, long, boolean, org.apache.hadoop.io.SequenceFile.CompressionType, org.apache.hadoop.io.compress.CompressionCodec, org.apache.hadoop.io.SequenceFile.Metadata)">createWriter</A></B>(<A HREF="../../../../../org/apache/hadoop/fs/FileSystem.html" title="class in org.apache.hadoop.fs">FileSystem</A> fs,
<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/Path.html" title="class in org.apache.hadoop.fs">Path</A> name,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> keyClass,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> valClass,
int bufferSize,
short replication,
long blockSize,
boolean createParent,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compressionType,
<A HREF="../../../../../org/apache/hadoop/io/compress/CompressionCodec.html" title="interface in org.apache.hadoop.io.compress">CompressionCodec</A> codec,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.Metadata.html" title="class in org.apache.hadoop.io">SequenceFile.Metadata</A> metadata)</CODE>
<BR>
Construct the preferred type of SequenceFile Writer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.Writer.html" title="class in org.apache.hadoop.io">SequenceFile.Writer</A></CODE></FONT></TD>
<TD><CODE><B>SequenceFile.</B><B><A HREF="../../../../../org/apache/hadoop/io/SequenceFile.html#createWriter(org.apache.hadoop.fs.FileSystem, org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.Path, java.lang.Class, java.lang.Class, int, short, long, org.apache.hadoop.io.SequenceFile.CompressionType, org.apache.hadoop.io.compress.CompressionCodec, org.apache.hadoop.util.Progressable, org.apache.hadoop.io.SequenceFile.Metadata)">createWriter</A></B>(<A HREF="../../../../../org/apache/hadoop/fs/FileSystem.html" title="class in org.apache.hadoop.fs">FileSystem</A> fs,
<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/Path.html" title="class in org.apache.hadoop.fs">Path</A> name,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> keyClass,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> valClass,
int bufferSize,
short replication,
long blockSize,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compressionType,
<A HREF="../../../../../org/apache/hadoop/io/compress/CompressionCodec.html" title="interface in org.apache.hadoop.io.compress">CompressionCodec</A> codec,
<A HREF="../../../../../org/apache/hadoop/util/Progressable.html" title="interface in org.apache.hadoop.util">Progressable</A> progress,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.Metadata.html" title="class in org.apache.hadoop.io">SequenceFile.Metadata</A> metadata)</CODE>
<BR>
Construct the preferred type of SequenceFile Writer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.Writer.html" title="class in org.apache.hadoop.io">SequenceFile.Writer</A></CODE></FONT></TD>
<TD><CODE><B>SequenceFile.</B><B><A HREF="../../../../../org/apache/hadoop/io/SequenceFile.html#createWriter(org.apache.hadoop.fs.FileSystem, org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.Path, java.lang.Class, java.lang.Class, org.apache.hadoop.io.SequenceFile.CompressionType)">createWriter</A></B>(<A HREF="../../../../../org/apache/hadoop/fs/FileSystem.html" title="class in org.apache.hadoop.fs">FileSystem</A> fs,
<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/Path.html" title="class in org.apache.hadoop.fs">Path</A> name,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> keyClass,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> valClass,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compressionType)</CODE>
<BR>
Construct the preferred type of SequenceFile Writer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.Writer.html" title="class in org.apache.hadoop.io">SequenceFile.Writer</A></CODE></FONT></TD>
<TD><CODE><B>SequenceFile.</B><B><A HREF="../../../../../org/apache/hadoop/io/SequenceFile.html#createWriter(org.apache.hadoop.fs.FileSystem, org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.Path, java.lang.Class, java.lang.Class, org.apache.hadoop.io.SequenceFile.CompressionType, org.apache.hadoop.io.compress.CompressionCodec)">createWriter</A></B>(<A HREF="../../../../../org/apache/hadoop/fs/FileSystem.html" title="class in org.apache.hadoop.fs">FileSystem</A> fs,
<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/Path.html" title="class in org.apache.hadoop.fs">Path</A> name,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> keyClass,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> valClass,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compressionType,
<A HREF="../../../../../org/apache/hadoop/io/compress/CompressionCodec.html" title="interface in org.apache.hadoop.io.compress">CompressionCodec</A> codec)</CODE>
<BR>
Construct the preferred type of SequenceFile Writer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.Writer.html" title="class in org.apache.hadoop.io">SequenceFile.Writer</A></CODE></FONT></TD>
<TD><CODE><B>SequenceFile.</B><B><A HREF="../../../../../org/apache/hadoop/io/SequenceFile.html#createWriter(org.apache.hadoop.fs.FileSystem, org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.Path, java.lang.Class, java.lang.Class, org.apache.hadoop.io.SequenceFile.CompressionType, org.apache.hadoop.io.compress.CompressionCodec, org.apache.hadoop.util.Progressable)">createWriter</A></B>(<A HREF="../../../../../org/apache/hadoop/fs/FileSystem.html" title="class in org.apache.hadoop.fs">FileSystem</A> fs,
<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/Path.html" title="class in org.apache.hadoop.fs">Path</A> name,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> keyClass,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> valClass,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compressionType,
<A HREF="../../../../../org/apache/hadoop/io/compress/CompressionCodec.html" title="interface in org.apache.hadoop.io.compress">CompressionCodec</A> codec,
<A HREF="../../../../../org/apache/hadoop/util/Progressable.html" title="interface in org.apache.hadoop.util">Progressable</A> progress)</CODE>
<BR>
Construct the preferred type of SequenceFile Writer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.Writer.html" title="class in org.apache.hadoop.io">SequenceFile.Writer</A></CODE></FONT></TD>
<TD><CODE><B>SequenceFile.</B><B><A HREF="../../../../../org/apache/hadoop/io/SequenceFile.html#createWriter(org.apache.hadoop.fs.FileSystem, org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.Path, java.lang.Class, java.lang.Class, org.apache.hadoop.io.SequenceFile.CompressionType, org.apache.hadoop.io.compress.CompressionCodec, org.apache.hadoop.util.Progressable, org.apache.hadoop.io.SequenceFile.Metadata)">createWriter</A></B>(<A HREF="../../../../../org/apache/hadoop/fs/FileSystem.html" title="class in org.apache.hadoop.fs">FileSystem</A> fs,
<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/Path.html" title="class in org.apache.hadoop.fs">Path</A> name,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> keyClass,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> valClass,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compressionType,
<A HREF="../../../../../org/apache/hadoop/io/compress/CompressionCodec.html" title="interface in org.apache.hadoop.io.compress">CompressionCodec</A> codec,
<A HREF="../../../../../org/apache/hadoop/util/Progressable.html" title="interface in org.apache.hadoop.util">Progressable</A> progress,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.Metadata.html" title="class in org.apache.hadoop.io">SequenceFile.Metadata</A> metadata)</CODE>
<BR>
Construct the preferred type of SequenceFile Writer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.Writer.html" title="class in org.apache.hadoop.io">SequenceFile.Writer</A></CODE></FONT></TD>
<TD><CODE><B>SequenceFile.</B><B><A HREF="../../../../../org/apache/hadoop/io/SequenceFile.html#createWriter(org.apache.hadoop.fs.FileSystem, org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.Path, java.lang.Class, java.lang.Class, org.apache.hadoop.io.SequenceFile.CompressionType, org.apache.hadoop.util.Progressable)">createWriter</A></B>(<A HREF="../../../../../org/apache/hadoop/fs/FileSystem.html" title="class in org.apache.hadoop.fs">FileSystem</A> fs,
<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/Path.html" title="class in org.apache.hadoop.fs">Path</A> name,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> keyClass,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> valClass,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compressionType,
<A HREF="../../../../../org/apache/hadoop/util/Progressable.html" title="interface in org.apache.hadoop.util">Progressable</A> progress)</CODE>
<BR>
Construct the preferred type of SequenceFile Writer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static void</CODE></FONT></TD>
<TD><CODE><B>SequenceFile.</B><B><A HREF="../../../../../org/apache/hadoop/io/SequenceFile.html#setCompressionType(org.apache.hadoop.conf.Configuration, org.apache.hadoop.io.SequenceFile.CompressionType)">setCompressionType</A></B>(<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> job,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> val)</CODE>
<BR>
<B>Deprecated.</B> <I>Use the one of the many SequenceFile.createWriter methods to specify
the <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io"><CODE>SequenceFile.CompressionType</CODE></A> while creating the <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.html" title="class in org.apache.hadoop.io"><CODE>SequenceFile</CODE></A> or
<A HREF="../../../../../org/apache/hadoop/mapred/SequenceFileOutputFormat.html#setOutputCompressionType(org.apache.hadoop.mapred.JobConf, org.apache.hadoop.io.SequenceFile.CompressionType)"><CODE>SequenceFileOutputFormat.setOutputCompressionType(org.apache.hadoop.mapred.JobConf, org.apache.hadoop.io.SequenceFile.CompressionType)</CODE></A>
to specify the <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io"><CODE>SequenceFile.CompressionType</CODE></A> for job-outputs.
or</I></TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Constructors in <A HREF="../../../../../org/apache/hadoop/io/package-summary.html">org.apache.hadoop.io</A> with parameters of type <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/apache/hadoop/io/ArrayFile.Writer.html#ArrayFile.Writer(org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.FileSystem, java.lang.String, java.lang.Class, org.apache.hadoop.io.SequenceFile.CompressionType, org.apache.hadoop.util.Progressable)">ArrayFile.Writer</A></B>(<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/FileSystem.html" title="class in org.apache.hadoop.fs">FileSystem</A> fs,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> file,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends <A HREF="../../../../../org/apache/hadoop/io/Writable.html" title="interface in org.apache.hadoop.io">Writable</A>> valClass,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compress,
<A HREF="../../../../../org/apache/hadoop/util/Progressable.html" title="interface in org.apache.hadoop.util">Progressable</A> progress)</CODE>
<BR>
Create the named file for values of the named class.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/apache/hadoop/io/BloomMapFile.Writer.html#BloomMapFile.Writer(org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.FileSystem, java.lang.String, java.lang.Class, java.lang.Class, org.apache.hadoop.io.SequenceFile.CompressionType, org.apache.hadoop.io.compress.CompressionCodec, org.apache.hadoop.util.Progressable)">BloomMapFile.Writer</A></B>(<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/FileSystem.html" title="class in org.apache.hadoop.fs">FileSystem</A> fs,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> dirName,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends <A HREF="../../../../../org/apache/hadoop/io/WritableComparable.html" title="interface in org.apache.hadoop.io">WritableComparable</A>> keyClass,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends <A HREF="../../../../../org/apache/hadoop/io/Writable.html" title="interface in org.apache.hadoop.io">Writable</A>> valClass,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compress,
<A HREF="../../../../../org/apache/hadoop/io/compress/CompressionCodec.html" title="interface in org.apache.hadoop.io.compress">CompressionCodec</A> codec,
<A HREF="../../../../../org/apache/hadoop/util/Progressable.html" title="interface in org.apache.hadoop.util">Progressable</A> progress)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/apache/hadoop/io/BloomMapFile.Writer.html#BloomMapFile.Writer(org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.FileSystem, java.lang.String, java.lang.Class, java.lang.Class, org.apache.hadoop.io.SequenceFile.CompressionType)">BloomMapFile.Writer</A></B>(<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/FileSystem.html" title="class in org.apache.hadoop.fs">FileSystem</A> fs,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> dirName,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends <A HREF="../../../../../org/apache/hadoop/io/WritableComparable.html" title="interface in org.apache.hadoop.io">WritableComparable</A>> keyClass,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> valClass,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compress)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/apache/hadoop/io/BloomMapFile.Writer.html#BloomMapFile.Writer(org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.FileSystem, java.lang.String, java.lang.Class, java.lang.Class, org.apache.hadoop.io.SequenceFile.CompressionType, org.apache.hadoop.util.Progressable)">BloomMapFile.Writer</A></B>(<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/FileSystem.html" title="class in org.apache.hadoop.fs">FileSystem</A> fs,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> dirName,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends <A HREF="../../../../../org/apache/hadoop/io/WritableComparable.html" title="interface in org.apache.hadoop.io">WritableComparable</A>> keyClass,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> valClass,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compress,
<A HREF="../../../../../org/apache/hadoop/util/Progressable.html" title="interface in org.apache.hadoop.util">Progressable</A> progress)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/apache/hadoop/io/BloomMapFile.Writer.html#BloomMapFile.Writer(org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.FileSystem, java.lang.String, org.apache.hadoop.io.WritableComparator, java.lang.Class, org.apache.hadoop.io.SequenceFile.CompressionType)">BloomMapFile.Writer</A></B>(<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/FileSystem.html" title="class in org.apache.hadoop.fs">FileSystem</A> fs,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> dirName,
<A HREF="../../../../../org/apache/hadoop/io/WritableComparator.html" title="class in org.apache.hadoop.io">WritableComparator</A> comparator,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> valClass,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compress)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/apache/hadoop/io/BloomMapFile.Writer.html#BloomMapFile.Writer(org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.FileSystem, java.lang.String, org.apache.hadoop.io.WritableComparator, java.lang.Class, org.apache.hadoop.io.SequenceFile.CompressionType, org.apache.hadoop.io.compress.CompressionCodec, org.apache.hadoop.util.Progressable)">BloomMapFile.Writer</A></B>(<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/FileSystem.html" title="class in org.apache.hadoop.fs">FileSystem</A> fs,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> dirName,
<A HREF="../../../../../org/apache/hadoop/io/WritableComparator.html" title="class in org.apache.hadoop.io">WritableComparator</A> comparator,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> valClass,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compress,
<A HREF="../../../../../org/apache/hadoop/io/compress/CompressionCodec.html" title="interface in org.apache.hadoop.io.compress">CompressionCodec</A> codec,
<A HREF="../../../../../org/apache/hadoop/util/Progressable.html" title="interface in org.apache.hadoop.util">Progressable</A> progress)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/apache/hadoop/io/BloomMapFile.Writer.html#BloomMapFile.Writer(org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.FileSystem, java.lang.String, org.apache.hadoop.io.WritableComparator, java.lang.Class, org.apache.hadoop.io.SequenceFile.CompressionType, org.apache.hadoop.util.Progressable)">BloomMapFile.Writer</A></B>(<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/FileSystem.html" title="class in org.apache.hadoop.fs">FileSystem</A> fs,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> dirName,
<A HREF="../../../../../org/apache/hadoop/io/WritableComparator.html" title="class in org.apache.hadoop.io">WritableComparator</A> comparator,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> valClass,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compress,
<A HREF="../../../../../org/apache/hadoop/util/Progressable.html" title="interface in org.apache.hadoop.util">Progressable</A> progress)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/apache/hadoop/io/MapFile.Writer.html#MapFile.Writer(org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.FileSystem, java.lang.String, java.lang.Class, java.lang.Class, org.apache.hadoop.io.SequenceFile.CompressionType)">MapFile.Writer</A></B>(<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/FileSystem.html" title="class in org.apache.hadoop.fs">FileSystem</A> fs,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> dirName,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends <A HREF="../../../../../org/apache/hadoop/io/WritableComparable.html" title="interface in org.apache.hadoop.io">WritableComparable</A>> keyClass,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> valClass,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compress)</CODE>
<BR>
Create the named map for keys of the named class.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/apache/hadoop/io/MapFile.Writer.html#MapFile.Writer(org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.FileSystem, java.lang.String, java.lang.Class, java.lang.Class, org.apache.hadoop.io.SequenceFile.CompressionType, org.apache.hadoop.io.compress.CompressionCodec, org.apache.hadoop.util.Progressable)">MapFile.Writer</A></B>(<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/FileSystem.html" title="class in org.apache.hadoop.fs">FileSystem</A> fs,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> dirName,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends <A HREF="../../../../../org/apache/hadoop/io/WritableComparable.html" title="interface in org.apache.hadoop.io">WritableComparable</A>> keyClass,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> valClass,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compress,
<A HREF="../../../../../org/apache/hadoop/io/compress/CompressionCodec.html" title="interface in org.apache.hadoop.io.compress">CompressionCodec</A> codec,
<A HREF="../../../../../org/apache/hadoop/util/Progressable.html" title="interface in org.apache.hadoop.util">Progressable</A> progress)</CODE>
<BR>
Create the named map for keys of the named class.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/apache/hadoop/io/MapFile.Writer.html#MapFile.Writer(org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.FileSystem, java.lang.String, java.lang.Class, java.lang.Class, org.apache.hadoop.io.SequenceFile.CompressionType, org.apache.hadoop.util.Progressable)">MapFile.Writer</A></B>(<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/FileSystem.html" title="class in org.apache.hadoop.fs">FileSystem</A> fs,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> dirName,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends <A HREF="../../../../../org/apache/hadoop/io/WritableComparable.html" title="interface in org.apache.hadoop.io">WritableComparable</A>> keyClass,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> valClass,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compress,
<A HREF="../../../../../org/apache/hadoop/util/Progressable.html" title="interface in org.apache.hadoop.util">Progressable</A> progress)</CODE>
<BR>
Create the named map for keys of the named class.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/apache/hadoop/io/MapFile.Writer.html#MapFile.Writer(org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.FileSystem, java.lang.String, org.apache.hadoop.io.WritableComparator, java.lang.Class, org.apache.hadoop.io.SequenceFile.CompressionType)">MapFile.Writer</A></B>(<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/FileSystem.html" title="class in org.apache.hadoop.fs">FileSystem</A> fs,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> dirName,
<A HREF="../../../../../org/apache/hadoop/io/WritableComparator.html" title="class in org.apache.hadoop.io">WritableComparator</A> comparator,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> valClass,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compress)</CODE>
<BR>
Create the named map using the named key comparator.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/apache/hadoop/io/MapFile.Writer.html#MapFile.Writer(org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.FileSystem, java.lang.String, org.apache.hadoop.io.WritableComparator, java.lang.Class, org.apache.hadoop.io.SequenceFile.CompressionType, org.apache.hadoop.io.compress.CompressionCodec, org.apache.hadoop.util.Progressable)">MapFile.Writer</A></B>(<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/FileSystem.html" title="class in org.apache.hadoop.fs">FileSystem</A> fs,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> dirName,
<A HREF="../../../../../org/apache/hadoop/io/WritableComparator.html" title="class in org.apache.hadoop.io">WritableComparator</A> comparator,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> valClass,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compress,
<A HREF="../../../../../org/apache/hadoop/io/compress/CompressionCodec.html" title="interface in org.apache.hadoop.io.compress">CompressionCodec</A> codec,
<A HREF="../../../../../org/apache/hadoop/util/Progressable.html" title="interface in org.apache.hadoop.util">Progressable</A> progress)</CODE>
<BR>
Create the named map using the named key comparator.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/apache/hadoop/io/MapFile.Writer.html#MapFile.Writer(org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.FileSystem, java.lang.String, org.apache.hadoop.io.WritableComparator, java.lang.Class, org.apache.hadoop.io.SequenceFile.CompressionType, org.apache.hadoop.util.Progressable)">MapFile.Writer</A></B>(<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/FileSystem.html" title="class in org.apache.hadoop.fs">FileSystem</A> fs,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> dirName,
<A HREF="../../../../../org/apache/hadoop/io/WritableComparator.html" title="class in org.apache.hadoop.io">WritableComparator</A> comparator,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> valClass,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compress,
<A HREF="../../../../../org/apache/hadoop/util/Progressable.html" title="interface in org.apache.hadoop.util">Progressable</A> progress)</CODE>
<BR>
Create the named map using the named key comparator.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/apache/hadoop/io/SetFile.Writer.html#SetFile.Writer(org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.FileSystem, java.lang.String, java.lang.Class, org.apache.hadoop.io.SequenceFile.CompressionType)">SetFile.Writer</A></B>(<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/FileSystem.html" title="class in org.apache.hadoop.fs">FileSystem</A> fs,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> dirName,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A><? extends <A HREF="../../../../../org/apache/hadoop/io/WritableComparable.html" title="interface in org.apache.hadoop.io">WritableComparable</A>> keyClass,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compress)</CODE>
<BR>
Create a set naming the element class and compression type.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/apache/hadoop/io/SetFile.Writer.html#SetFile.Writer(org.apache.hadoop.conf.Configuration, org.apache.hadoop.fs.FileSystem, java.lang.String, org.apache.hadoop.io.WritableComparator, org.apache.hadoop.io.SequenceFile.CompressionType)">SetFile.Writer</A></B>(<A HREF="../../../../../org/apache/hadoop/conf/Configuration.html" title="class in org.apache.hadoop.conf">Configuration</A> conf,
<A HREF="../../../../../org/apache/hadoop/fs/FileSystem.html" title="class in org.apache.hadoop.fs">FileSystem</A> fs,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> dirName,
<A HREF="../../../../../org/apache/hadoop/io/WritableComparator.html" title="class in org.apache.hadoop.io">WritableComparator</A> comparator,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> compress)</CODE>
<BR>
Create a set naming the element comparator and compression type.</TD>
</TR>
</TABLE>
<P>
<A NAME="org.apache.hadoop.mapred"><!-- --></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="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> in <A HREF="../../../../../org/apache/hadoop/mapred/package-summary.html">org.apache.hadoop.mapred</A></FONT></TH>
</TR>
</TABLE>
<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="../../../../../org/apache/hadoop/mapred/package-summary.html">org.apache.hadoop.mapred</A> that return <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A></CODE></FONT></TD>
<TD><CODE><B>SequenceFileOutputFormat.</B><B><A HREF="../../../../../org/apache/hadoop/mapred/SequenceFileOutputFormat.html#getOutputCompressionType(org.apache.hadoop.mapred.JobConf)">getOutputCompressionType</A></B>(<A HREF="../../../../../org/apache/hadoop/mapred/JobConf.html" title="class in org.apache.hadoop.mapred">JobConf</A> conf)</CODE>
<BR>
Get the <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io"><CODE>SequenceFile.CompressionType</CODE></A> for the output <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.html" title="class in org.apache.hadoop.io"><CODE>SequenceFile</CODE></A>.</TD>
</TR>
</TABLE>
<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="../../../../../org/apache/hadoop/mapred/package-summary.html">org.apache.hadoop.mapred</A> with parameters of type <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static void</CODE></FONT></TD>
<TD><CODE><B>SequenceFileOutputFormat.</B><B><A HREF="../../../../../org/apache/hadoop/mapred/SequenceFileOutputFormat.html#setOutputCompressionType(org.apache.hadoop.mapred.JobConf, org.apache.hadoop.io.SequenceFile.CompressionType)">setOutputCompressionType</A></B>(<A HREF="../../../../../org/apache/hadoop/mapred/JobConf.html" title="class in org.apache.hadoop.mapred">JobConf</A> conf,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> style)</CODE>
<BR>
Set the <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io"><CODE>SequenceFile.CompressionType</CODE></A> for the output <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.html" title="class in org.apache.hadoop.io"><CODE>SequenceFile</CODE></A>.</TD>
</TR>
</TABLE>
<P>
<A NAME="org.apache.hadoop.mapreduce.lib.output"><!-- --></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="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> in <A HREF="../../../../../org/apache/hadoop/mapreduce/lib/output/package-summary.html">org.apache.hadoop.mapreduce.lib.output</A></FONT></TH>
</TR>
</TABLE>
<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="../../../../../org/apache/hadoop/mapreduce/lib/output/package-summary.html">org.apache.hadoop.mapreduce.lib.output</A> that return <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A></CODE></FONT></TD>
<TD><CODE><B>SequenceFileOutputFormat.</B><B><A HREF="../../../../../org/apache/hadoop/mapreduce/lib/output/SequenceFileOutputFormat.html#getOutputCompressionType(org.apache.hadoop.mapreduce.JobContext)">getOutputCompressionType</A></B>(<A HREF="../../../../../org/apache/hadoop/mapreduce/JobContext.html" title="class in org.apache.hadoop.mapreduce">JobContext</A> job)</CODE>
<BR>
Get the <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io"><CODE>SequenceFile.CompressionType</CODE></A> for the output <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.html" title="class in org.apache.hadoop.io"><CODE>SequenceFile</CODE></A>.</TD>
</TR>
</TABLE>
<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="../../../../../org/apache/hadoop/mapreduce/lib/output/package-summary.html">org.apache.hadoop.mapreduce.lib.output</A> with parameters of type <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static void</CODE></FONT></TD>
<TD><CODE><B>SequenceFileOutputFormat.</B><B><A HREF="../../../../../org/apache/hadoop/mapreduce/lib/output/SequenceFileOutputFormat.html#setOutputCompressionType(org.apache.hadoop.mapreduce.Job, org.apache.hadoop.io.SequenceFile.CompressionType)">setOutputCompressionType</A></B>(<A HREF="../../../../../org/apache/hadoop/mapreduce/Job.html" title="class in org.apache.hadoop.mapreduce">Job</A> job,
<A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io">SequenceFile.CompressionType</A> style)</CODE>
<BR>
Set the <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io"><CODE>SequenceFile.CompressionType</CODE></A> for the output <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.html" title="class in org.apache.hadoop.io"><CODE>SequenceFile</CODE></A>.</TD>
</TR>
</TABLE>
<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> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../org/apache/hadoop/io/SequenceFile.CompressionType.html" title="enum in org.apache.hadoop.io"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/apache/hadoop/io//class-useSequenceFile.CompressionType.html" target="_top"><B>FRAMES</B></A>
<A HREF="SequenceFile.CompressionType.html" target="_top"><B>NO FRAMES</B></A>
<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>
Copyright © 2009 The Apache Software Foundation
</BODY>
</HTML>
| YuMatsuzawa/HadoopEclipseProject | hadoop-0.20.2-cdh3u5/docs/api/org/apache/hadoop/io/class-use/SequenceFile.CompressionType.html | HTML | apache-2.0 | 63,767 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// Reliant.h
// Reliant
//
// Created by Michael Seghers on 18/09/14.
//
//
#ifndef Reliant_Header____FILEEXTENSION___
#define Reliant_Header____FILEEXTENSION___
#import "OCSObjectContext.h"
#import "OCSConfiguratorFromClass.h"
#import "NSObject+OCSReliantContextBinding.h"
#import "NSObject+OCSReliantInjection.h"
#endif
| appfoundry/Reliant | Reliant/Classes/Reliant.h | C | mit | 331 | [
30522,
1013,
1013,
1013,
1013,
2128,
15204,
2102,
1012,
1044,
1013,
1013,
2128,
15204,
2102,
1013,
1013,
1013,
1013,
2580,
2011,
2745,
7367,
5603,
2545,
2006,
2324,
1013,
5641,
1013,
2403,
1012,
1013,
1013,
1013,
1013,
1001,
2065,
13629,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package lib
import (
"log"
"strings"
)
type (
Question struct {
RelatesTo struct {
Answers []string `json:"answers"`
Save bool `json:"save"`
SaveTag string `json:"saveTag"`
} `json:"relatesTo"`
Context []string `json:"context"`
QuestionText string `json:"question"`
PossibleAnswers []string `json:"answers"`
}
Questions []*Question
)
func (this Questions) First() *Question {
if len(this) > 0 {
return this[0]
}
return nil
}
func (this Questions) next(prevAnswer string) (*Question, bool) {
for i := range this {
for a := range this[i].RelatesTo.Answers {
if strings.EqualFold(this[i].RelatesTo.Answers[a], prevAnswer) {
return this[i], this[i].RelatesTo.Save
}
}
}
return nil, false
}
func (this Questions) nextFrom(prevAnswers ...string) (*Question, bool) {
for i := range prevAnswers {
if nxt, sv := this.next(prevAnswers[i]); nxt != nil {
log.Println("got it from sticker ...")
return nxt, sv
}
}
return nil, false
}
func (this *Question) makeKeyboard() Keyboard {
keyboard := Keyboard{}
for i := range this.PossibleAnswers {
keyboard = append(keyboard, []string{this.PossibleAnswers[i]})
}
return keyboard
}
| jh-bate/fantail-bot | lib/Question.go | GO | mit | 1,207 | [
30522,
7427,
5622,
2497,
12324,
1006,
1000,
8833,
1000,
1000,
7817,
1000,
1007,
2828,
1006,
3160,
2358,
6820,
6593,
1063,
14623,
3406,
2358,
6820,
6593,
1063,
6998,
1031,
1033,
5164,
1036,
1046,
3385,
1024,
1000,
6998,
1000,
1036,
3828,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#### Integrations
##### Google Cloud SCC
- Updated the Docker image to: *demisto/google-api-py3:1.0.0.27143*.
- Fixed an issue where the ***test-module*** command would fail when using a custom certificate.
| demisto/content | Packs/GoogleCloudSCC/ReleaseNotes/2_0_6.md | Markdown | mit | 208 | [
30522,
1001,
1001,
1001,
1001,
8346,
2015,
1001,
1001,
1001,
1001,
1001,
8224,
6112,
8040,
2278,
1011,
7172,
1996,
8946,
2121,
3746,
2000,
1024,
1008,
27668,
16033,
1013,
8224,
1011,
17928,
1011,
1052,
2100,
2509,
1024,
1015,
1012,
1014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CSC301 Presentation</title>
<meta name="description" content="HTML Presentation">
<meta name="author" content="Rakshit Shukla">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="css/reveal.min.css">
<link rel="stylesheet" href="css/theme/moon.css" id="theme">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- Custom -->
<link rel="stylesheet" href="css/custom-style.css">
<!-- If the query includes 'print-pdf', include the PDF print sheet -->
<script>
if( window.location.search.match( /print-pdf/gi ) ) {
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'css/print/pdf.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
}
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h3>Team 12 presents</h3>
<br>
<h1 class="smaller-main-font">Timbur</h1>
<br>
<img src="https://raw.githubusercontent.com/cadz7/Proj-Evening-Team12-repo/master/Phase1/Photo2.jpg?token=ACm02GaD9vtuoPvuRL_wp1AYtbkxNAFvks5UhiY9wA%3D%3D" width="500"/>
<small><i>Made by Martin, Rakshit, Timur, Marco, Huda, Harris and Tales </i></small>
</section>
<section>
<section>
<h2>Product</h2>
</section>
<section>
<h2>We chose the Calender application</h2>
<h3 class="fragment"> Using our application, students can:</h3><br>
<p class="fragment">Browse, add and delete courses</p>
<p class="fragment">Subscribe/un-subscribe and receive notifications about picked courses.</p>
</section>
<section>
<img src="https://slack-files.com/files-tmb/T02MYBK90-F033MP71L-0428bd/image_1_360.png" width="700">
</section>
<section>
<img src="https://slack-files.com/files-tmb/T02MYBK90-F033MP86E-69a67f/image_2_360.png" width="700">
</section>
<section>
<img src="https://slack-files.com/files-tmb/T02MYBK90-F033MP99C-c996ee/image_3_360.png" width="700">
</section>
<section>
<img src="https://files.slack.com/files-pri/T02MYBK90-F033LEV4D/image_4.jpg" width="1500">
</section>
<section>
<h2>Here's the demo</h2>
</section>
</section>
<section>
<section>
<h2> Process</h2>
</section>
<section>
<h2>Forking Model</h2>
<p>Every team member had their own fork of the repo and worked individually on it.</p>
<p>We submitted a Pull Request to Master on completing a task.</p>
<p>This avoids conflicts and keeps the main repo clean.</p>
</section>
<section>
<h2>Communication/Meetings</h2>
<p>We met every week after class.</p>
<p>Communicated through Slack.</p>
<p>All the member's emails were linked to Github to get notifications on commits/PRs</p>
</section>
<section>
<h2>Scrum vs Kanban</h2>
<p>Scrum: Assigning priorities and difficulties to tasks, weekly meetings.</p>
<p>Kanban: Kept the tasks moving through the Kanban Board(Trello) </p>
<p>We preferred the Kanban Model because we kept the tasks moving at all times.</p>
</section>
<section>
<img src="https://raw.githubusercontent.com/csc301-fall2014/Proj-Evening-Team12-repo/master/Phase4/Trello%20Screenshot.jpg?token=AHX0VmywoAAWAUfhGxrUyeGBPg0FWkBSks5UhieVwA%3D%3D" width="1500">
</section>
</section>
<section>
<section>
<h2>Architecture</h2>
</section>
<section>
<img src="https://raw.githubusercontent.com/csc301-fall2014/Proj-Evening-Team12-repo/master/Phase4/diagramm.jpg?token=AHX0Vhib67hp40l7FO222vQxVXCcO59Qks5UhigtwA%3D%3D" width="1500">
</section>
<section>
<h2>Technologies</h2>
<p>AngularJS + Bootstrap and Flask + SQLite + SVN (Jokes on you!)</p>
<p>Bower/Grunt for automating tasks.</p>
<p>Karma, Jasmine for testing the Front-End code</p>
</section>
<section>
<h2>Model</h2>
<p>We used the MVC model.</p>
<p>Decided to make a Web App instead of a Console App.</p>
<p>The backend serves JSON through REST API and does not generate pages.</p>
</section>
</section>
<section>
<h1>THE END</h1>
<h4>By Team 12 </h4><br> <br>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.min.js"></script>
<script>
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/zoom/linear/fade/none
// Parallax scrolling
// parallaxBackgroundImage: 'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg',
// parallaxBackgroundSize: '2100px 900px',
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
</script>
</body>
</html>
| cadz7/CSC301-Presentation | index.html | HTML | mit | 6,182 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
2516,
1028,
20116,
2278,
14142,
2487,
8312,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { address: 'mailcatcher', port: 1025 }
end
| kirbrown/od-ot | config/environments/development.rb | Ruby | mit | 1,726 | [
30522,
15168,
1012,
4646,
1012,
9530,
8873,
27390,
2063,
2079,
1001,
10906,
9675,
2182,
2097,
2202,
23359,
2058,
2216,
1999,
9530,
8873,
2290,
1013,
4646,
1012,
21144,
1012,
1001,
1999,
1996,
2458,
4044,
2115,
4646,
1005,
1055,
3642,
2003,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
end
helper_method :current_user
def authorize
redirect_to '/login' unless current_user
end
end
| sf-red-pandas-2016/mipt | mipt/app/controllers/application_controller.rb | Ruby | mit | 298 | [
30522,
2465,
4646,
8663,
13181,
10820,
1026,
2895,
8663,
13181,
10820,
1024,
1024,
2918,
4047,
1035,
2013,
1035,
15681,
2854,
2007,
1024,
1024,
6453,
13366,
2783,
1035,
5310,
1030,
2783,
1035,
5310,
1064,
1064,
1027,
5310,
1012,
2424,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var _ref =
/*#__PURE__*/
<foo />;
function render() {
return _ref;
}
var _ref2 =
/*#__PURE__*/
<div className="foo"><input type="checkbox" checked={true} /></div>;
function render() {
return _ref2;
}
| samwgoldman/babel | packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/html-element/output.js | JavaScript | mit | 207 | [
30522,
13075,
1035,
25416,
1027,
1013,
1008,
1001,
1035,
1035,
5760,
1035,
1035,
1008,
1013,
1026,
29379,
1013,
1028,
1025,
3853,
17552,
1006,
1007,
1063,
2709,
1035,
25416,
1025,
1065,
13075,
1035,
25416,
2475,
1027,
1013,
1008,
1001,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#ifndef OSSL_TEST_SHIM_TEST_CONFIG_H
#define OSSL_TEST_SHIM_TEST_CONFIG_H
#include <string>
#include <vector>
struct TestConfig {
int port = 0;
bool is_server = false;
bool is_dtls = false;
int resume_count = 0;
bool fallback_scsv = false;
std::string key_file;
std::string cert_file;
std::string expected_server_name;
std::string expected_certificate_types;
bool require_any_client_certificate = false;
std::string advertise_npn;
std::string expected_next_proto;
std::string select_next_proto;
bool async = false;
bool write_different_record_sizes = false;
bool partial_write = false;
bool no_tls13 = false;
bool no_tls12 = false;
bool no_tls11 = false;
bool no_tls1 = false;
bool no_ssl3 = false;
bool shim_writes_first = false;
std::string host_name;
std::string advertise_alpn;
std::string expected_alpn;
std::string expected_advertised_alpn;
std::string select_alpn;
bool decline_alpn = false;
bool expect_session_miss = false;
bool expect_extended_master_secret = false;
std::string psk;
std::string psk_identity;
std::string srtp_profiles;
int min_version = 0;
int max_version = 0;
int mtu = 0;
bool implicit_handshake = false;
std::string cipher;
bool handshake_never_done = false;
int export_keying_material = 0;
std::string export_label;
std::string export_context;
bool use_export_context = false;
bool expect_ticket_renewal = false;
bool expect_no_session = false;
bool use_ticket_callback = false;
bool renew_ticket = false;
bool enable_client_custom_extension = false;
bool enable_server_custom_extension = false;
bool custom_extension_skip = false;
bool custom_extension_fail_add = false;
bool check_close_notify = false;
bool shim_shuts_down = false;
bool verify_fail = false;
bool verify_peer = false;
bool expect_verify_result = false;
int expect_total_renegotiations = 0;
bool renegotiate_freely = false;
bool p384_only = false;
bool enable_all_curves = false;
bool use_sparse_dh_prime = false;
bool use_old_client_cert_callback = false;
bool use_null_client_ca_list = false;
bool peek_then_read = false;
int max_cert_list = 0;
};
bool ParseConfig(int argc, char **argv, TestConfig *out_config);
#endif // OSSL_TEST_SHIM_TEST_CONFIG_H
| pmq20/ruby-compiler | vendor/openssl/test/ossl_shim/test_config.h | C | mit | 2,625 | [
30522,
1013,
1008,
1008,
9385,
2786,
1011,
2355,
1996,
7480,
14540,
2622,
6048,
1012,
2035,
2916,
9235,
1012,
1008,
1008,
7000,
2104,
1996,
7480,
14540,
6105,
1006,
1996,
1000,
6105,
1000,
1007,
1012,
2017,
2089,
2025,
2224,
1008,
2023,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
reg_t v = MMU.load_int32(RS1);
MMU.store_uint32(RS1, RS2 ^ v);
WRITE_RD(v);
| dededong/goblin-core | riscv/riscv-sim/riscv/insns/amoxor_w.h | C | bsd-3-clause | 76 | [
30522,
19723,
1035,
1056,
1058,
1027,
3461,
2226,
1012,
7170,
1035,
20014,
16703,
1006,
12667,
2487,
1007,
1025,
3461,
2226,
1012,
3573,
1035,
21318,
3372,
16703,
1006,
12667,
2487,
1010,
12667,
2475,
1034,
1058,
1007,
1025,
4339,
1035,
164... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cmd_net/netfilter/nf_conntrack_proto_gre.ko := /opt/buildroot-gcc342/bin/mipsel-linux-uclibc-ld -m elf32ltsmip -r -o net/netfilter/nf_conntrack_proto_gre.ko net/netfilter/nf_conntrack_proto_gre.o net/netfilter/nf_conntrack_proto_gre.mod.o
| smx-smx/dsl-n55u-bender | release/src-ra/linux/linux-2.6.21.x/net/netfilter/.nf_conntrack_proto_gre.ko.cmd | Batchfile | gpl-2.0 | 240 | [
30522,
4642,
2094,
1035,
5658,
1013,
5658,
8873,
21928,
1013,
1050,
2546,
1035,
9530,
3372,
22648,
2243,
1035,
15053,
1035,
24665,
2063,
1012,
12849,
1024,
1027,
1013,
23569,
1013,
3857,
3217,
4140,
1011,
1043,
9468,
22022,
2475,
1013,
8026... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
from __future__ import unicode_literals
import re
from .mtv import MTVServicesInfoExtractor
from ..utils import (
compat_str,
compat_urllib_parse,
ExtractorError,
float_or_none,
unified_strdate,
)
class ComedyCentralIE(MTVServicesInfoExtractor):
_VALID_URL = r'''(?x)https?://(?:www\.)?cc\.com/
(video-clips|episodes|cc-studios|video-collections|full-episodes)
/(?P<title>.*)'''
_FEED_URL = 'http://comedycentral.com/feeds/mrss/'
_TEST = {
'url': 'http://www.cc.com/video-clips/kllhuv/stand-up-greg-fitzsimmons--uncensored---too-good-of-a-mother',
'md5': 'c4f48e9eda1b16dd10add0744344b6d8',
'info_dict': {
'id': 'cef0cbb3-e776-4bc9-b62e-8016deccb354',
'ext': 'mp4',
'title': 'CC:Stand-Up|Greg Fitzsimmons: Life on Stage|Uncensored - Too Good of a Mother',
'description': 'After a certain point, breastfeeding becomes c**kblocking.',
},
}
class ComedyCentralShowsIE(MTVServicesInfoExtractor):
IE_DESC = 'The Daily Show / The Colbert Report'
# urls can be abbreviations like :thedailyshow or :colbert
# urls for episodes like:
# or urls for clips like: http://www.thedailyshow.com/watch/mon-december-10-2012/any-given-gun-day
# or: http://www.colbertnation.com/the-colbert-report-videos/421667/november-29-2012/moon-shattering-news
# or: http://www.colbertnation.com/the-colbert-report-collections/422008/festival-of-lights/79524
_VALID_URL = r'''(?x)^(:(?P<shortname>tds|thedailyshow|cr|colbert|colbertnation|colbertreport)
|https?://(:www\.)?
(?P<showname>thedailyshow|thecolbertreport)\.(?:cc\.)?com/
((?:full-)?episodes/(?:[0-9a-z]{6}/)?(?P<episode>.*)|
(?P<clip>
(?:(?:guests/[^/]+|videos|video-playlists|special-editions|news-team/[^/]+)/[^/]+/(?P<videotitle>[^/?#]+))
|(the-colbert-report-(videos|collections)/(?P<clipID>[0-9]+)/[^/]*/(?P<cntitle>.*?))
|(watch/(?P<date>[^/]*)/(?P<tdstitle>.*))
)|
(?P<interview>
extended-interviews/(?P<interID>[0-9a-z]+)/(?:playlist_tds_extended_)?(?P<interview_title>.*?)(/.*?)?)))
(?:[?#].*|$)'''
_TESTS = [{
'url': 'http://thedailyshow.cc.com/watch/thu-december-13-2012/kristen-stewart',
'md5': '4e2f5cb088a83cd8cdb7756132f9739d',
'info_dict': {
'id': 'ab9ab3e7-5a98-4dbe-8b21-551dc0523d55',
'ext': 'mp4',
'upload_date': '20121213',
'description': 'Kristen Stewart learns to let loose in "On the Road."',
'uploader': 'thedailyshow',
'title': 'thedailyshow kristen-stewart part 1',
}
}, {
'url': 'http://thedailyshow.cc.com/extended-interviews/xm3fnq/andrew-napolitano-extended-interview',
'only_matching': True,
}, {
'url': 'http://thecolbertreport.cc.com/videos/29w6fx/-realhumanpraise-for-fox-news',
'only_matching': True,
}, {
'url': 'http://thecolbertreport.cc.com/videos/gh6urb/neil-degrasse-tyson-pt--1?xrs=eml_col_031114',
'only_matching': True,
}, {
'url': 'http://thedailyshow.cc.com/guests/michael-lewis/3efna8/exclusive---michael-lewis-extended-interview-pt--3',
'only_matching': True,
}, {
'url': 'http://thedailyshow.cc.com/episodes/sy7yv0/april-8--2014---denis-leary',
'only_matching': True,
}, {
'url': 'http://thecolbertreport.cc.com/episodes/8ase07/april-8--2014---jane-goodall',
'only_matching': True,
}, {
'url': 'http://thedailyshow.cc.com/video-playlists/npde3s/the-daily-show-19088-highlights',
'only_matching': True,
}, {
'url': 'http://thedailyshow.cc.com/special-editions/2l8fdb/special-edition---a-look-back-at-food',
'only_matching': True,
}, {
'url': 'http://thedailyshow.cc.com/news-team/michael-che/7wnfel/we-need-to-talk-about-israel',
'only_matching': True,
}]
_available_formats = ['3500', '2200', '1700', '1200', '750', '400']
_video_extensions = {
'3500': 'mp4',
'2200': 'mp4',
'1700': 'mp4',
'1200': 'mp4',
'750': 'mp4',
'400': 'mp4',
}
_video_dimensions = {
'3500': (1280, 720),
'2200': (960, 540),
'1700': (768, 432),
'1200': (640, 360),
'750': (512, 288),
'400': (384, 216),
}
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
if mobj.group('shortname'):
if mobj.group('shortname') in ('tds', 'thedailyshow'):
url = 'http://thedailyshow.cc.com/full-episodes/'
else:
url = 'http://thecolbertreport.cc.com/full-episodes/'
mobj = re.match(self._VALID_URL, url, re.VERBOSE)
assert mobj is not None
if mobj.group('clip'):
if mobj.group('videotitle'):
epTitle = mobj.group('videotitle')
elif mobj.group('showname') == 'thedailyshow':
epTitle = mobj.group('tdstitle')
else:
epTitle = mobj.group('cntitle')
dlNewest = False
elif mobj.group('interview'):
epTitle = mobj.group('interview_title')
dlNewest = False
else:
dlNewest = not mobj.group('episode')
if dlNewest:
epTitle = mobj.group('showname')
else:
epTitle = mobj.group('episode')
show_name = mobj.group('showname')
webpage, htmlHandle = self._download_webpage_handle(url, epTitle)
if dlNewest:
url = htmlHandle.geturl()
mobj = re.match(self._VALID_URL, url, re.VERBOSE)
if mobj is None:
raise ExtractorError('Invalid redirected URL: ' + url)
if mobj.group('episode') == '':
raise ExtractorError('Redirected URL is still not specific: ' + url)
epTitle = (mobj.group('episode') or mobj.group('videotitle')).rpartition('/')[-1]
mMovieParams = re.findall('(?:<param name="movie" value="|var url = ")(http://media.mtvnservices.com/([^"]*(?:episode|video).*?:.*?))"', webpage)
if len(mMovieParams) == 0:
# The Colbert Report embeds the information in a without
# a URL prefix; so extract the alternate reference
# and then add the URL prefix manually.
altMovieParams = re.findall('data-mgid="([^"]*(?:episode|video|playlist).*?:.*?)"', webpage)
if len(altMovieParams) == 0:
raise ExtractorError('unable to find Flash URL in webpage ' + url)
else:
mMovieParams = [("http://media.mtvnservices.com/" + altMovieParams[0], altMovieParams[0])]
uri = mMovieParams[0][1]
# Correct cc.com in uri
uri = re.sub(r'(episode:[^.]+)(\.cc)?\.com', r'\1.cc.com', uri)
index_url = 'http://%s.cc.com/feeds/mrss?%s' % (show_name, compat_urllib_parse.urlencode({'uri': uri}))
idoc = self._download_xml(
index_url, epTitle,
'Downloading show index', 'Unable to download episode index')
title = idoc.find('./channel/title').text
description = idoc.find('./channel/description').text
entries = []
item_els = idoc.findall('.//item')
for part_num, itemEl in enumerate(item_els):
upload_date = unified_strdate(itemEl.findall('./pubDate')[0].text)
thumbnail = itemEl.find('.//{http://search.yahoo.com/mrss/}thumbnail').attrib.get('url')
content = itemEl.find('.//{http://search.yahoo.com/mrss/}content')
duration = float_or_none(content.attrib.get('duration'))
mediagen_url = content.attrib['url']
guid = itemEl.find('./guid').text.rpartition(':')[-1]
cdoc = self._download_xml(
mediagen_url, epTitle,
'Downloading configuration for segment %d / %d' % (part_num + 1, len(item_els)))
turls = []
for rendition in cdoc.findall('.//rendition'):
finfo = (rendition.attrib['bitrate'], rendition.findall('./src')[0].text)
turls.append(finfo)
formats = []
for format, rtmp_video_url in turls:
w, h = self._video_dimensions.get(format, (None, None))
formats.append({
'format_id': 'vhttp-%s' % format,
'url': self._transform_rtmp_url(rtmp_video_url),
'ext': self._video_extensions.get(format, 'mp4'),
'height': h,
'width': w,
})
formats.append({
'format_id': 'rtmp-%s' % format,
'url': rtmp_video_url.replace('viacomccstrm', 'viacommtvstrm'),
'ext': self._video_extensions.get(format, 'mp4'),
'height': h,
'width': w,
})
self._sort_formats(formats)
virtual_id = show_name + ' ' + epTitle + ' part ' + compat_str(part_num + 1)
entries.append({
'id': guid,
'title': virtual_id,
'formats': formats,
'uploader': show_name,
'upload_date': upload_date,
'duration': duration,
'thumbnail': thumbnail,
'description': description,
})
return {
'_type': 'playlist',
'entries': entries,
'title': show_name + ' ' + title,
'description': description,
}
| svagionitis/youtube-dl | youtube_dl/extractor/comedycentral.py | Python | unlicense | 9,941 | [
30522,
2013,
1035,
1035,
2925,
1035,
1035,
12324,
27260,
1035,
18204,
2015,
12324,
2128,
2013,
1012,
8692,
12324,
8692,
8043,
7903,
2229,
2378,
14876,
10288,
6494,
16761,
2013,
1012,
1012,
21183,
12146,
12324,
1006,
4012,
4502,
2102,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Automatically generated file. Please do not edit.
* @author Highcharts Config Generator by Karasiq
* @see [[http://api.highcharts.com/highmaps]]
*/
package com.highmaps.config
import scalajs.js, js.`|`
import com.highcharts.CleanJsObject
import com.highcharts.HighchartsUtils._
/**
* @note JavaScript name: <code>series<vwap>-states-select-marker-states-hover-animation</code>
*/
@js.annotation.ScalaJSDefined
class SeriesVwapStatesSelectMarkerStatesHoverAnimation extends com.highcharts.HighchartsGenericObject {
val duration: js.UndefOr[Double] = js.undefined
}
object SeriesVwapStatesSelectMarkerStatesHoverAnimation {
/**
*/
def apply(duration: js.UndefOr[Double] = js.undefined): SeriesVwapStatesSelectMarkerStatesHoverAnimation = {
val durationOuter: js.UndefOr[Double] = duration
com.highcharts.HighchartsGenericObject.toCleanObject(new SeriesVwapStatesSelectMarkerStatesHoverAnimation {
override val duration: js.UndefOr[Double] = durationOuter
})
}
}
| Karasiq/scalajs-highcharts | src/main/scala/com/highmaps/config/SeriesVwapStatesSelectMarkerStatesHoverAnimation.scala | Scala | mit | 1,018 | [
30522,
1013,
1008,
1008,
1008,
8073,
7013,
5371,
1012,
3531,
2079,
2025,
10086,
1012,
1008,
1030,
3166,
2152,
7507,
21217,
9530,
8873,
2290,
13103,
2011,
13173,
5332,
4160,
1008,
1030,
2156,
1031,
1031,
8299,
1024,
1013,
1013,
17928,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* wCMF - wemove Content Management Framework
* Copyright (C) 2005-2020 wemove digital solutions GmbH
*
* Licensed under the terms of the MIT License.
*
* See the LICENSE file distributed with this work for
* additional information.
*/
namespace wcmf\lib\core;
/**
* A session that requires clients to send a token for authentication.
*
* @author ingo herwig <ingo@wemove.com>
*/
interface TokenBasedSession extends Session {
/**
* Get the name of the auth token header.
* @return String
*/
public function getHeaderName();
/**
* Get the name of the auth token cookie.
* @return String
*/
public function getCookieName();
} | iherwig/wcmf | src/wcmf/lib/core/TokenBasedSession.php | PHP | mit | 673 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
15868,
2213,
2546,
1011,
2057,
5302,
3726,
4180,
2968,
7705,
1008,
9385,
1006,
1039,
1007,
2384,
1011,
12609,
2057,
5302,
3726,
3617,
7300,
18289,
1008,
1008,
7000,
2104,
1996,
3408,
1997,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#ifndef TELEPORT_NOTARYRPC_H
#define TELEPORT_NOTARYRPC_H
#include <jsonrpccpp/client.h>
#include <jsonrpccpp/client/connectors/httpclient.h>
#include <test/teleport_tests/node/Data.h>
#include <test/teleport_tests/node/config/TeleportConfig.h>
#include "define.h"
#include "string_functions.h"
class NotaryRPC
{
public:
int64_t port;
std::string host;
std::string currency_code;
jsonrpc::HttpClient *http_client{NULL};
jsonrpc::Client *client{NULL};
TeleportConfig &config;
NotaryRPC(std::string currency_code, TeleportConfig &config):
currency_code(currency_code), config(config)
{
port = string_to_int(Info("notaryrpcport"));
host = Info("notaryrpchost");
if (host == "")
host = "127.0.0.1";
http_client = new jsonrpc::HttpClient("http://" + host + ":" + ToString(port));
client = new jsonrpc::Client(*http_client);
}
std::string Info(std::string key)
{
return config[currency_code + "-" + key];
}
Json::Value ExecuteCommand(std::string command)
{
std::string method;
std::vector<std::string> params;
if (!GetMethodAndParamsFromCommand(method, params, command))
return Json::Value();
// Json::Value converted_params = ConvertParameterTypes(method, params);
Json::Value json_params;
for (auto param : params)
json_params.append(param);
auto reply = client->CallMethod(method, json_params);
return reply;
}
};
#endif //TELEPORT_NOTARYRPC_H
| peer-node/flex | test/teleport_tests/currency/NotaryRPC.h | C | agpl-3.0 | 1,572 | [
30522,
1001,
2065,
13629,
2546,
10093,
13699,
11589,
1035,
2025,
5649,
14536,
2278,
1035,
1044,
1001,
9375,
10093,
13699,
11589,
1035,
2025,
5649,
14536,
2278,
1035,
1044,
1001,
2421,
1026,
1046,
3385,
14536,
9468,
9397,
1013,
7396,
1012,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
"""Basic thermodynamic calculations for pickaxe."""
from typing import Union
import pint
from equilibrator_api import (
Q_,
ComponentContribution,
Reaction,
default_physiological_ionic_strength,
default_physiological_p_h,
default_physiological_p_mg,
default_physiological_temperature,
)
from equilibrator_api.phased_reaction import PhasedReaction
from equilibrator_assets.compounds import Compound
from equilibrator_assets.local_compound_cache import LocalCompoundCache
from equilibrator_cache.compound_cache import CompoundCache
from pymongo import MongoClient
from sqlalchemy import create_engine
from minedatabase.pickaxe import Pickaxe
class Thermodynamics:
"""Class to calculate thermodynamics of Pickaxe runs.
Thermodynamics allows for the calculation of:
1) Standard ∆G' of formation
2) Standard ∆G'o of reaction
3) Physiological ∆G'm of reaction
4) Adjusted ∆G' of reaction
eQuilibrator objects can also be obtained from r_ids and c_ids.
Parameters
----------
mongo_uri: str
URI of the mongo database.
client: MongoClient
Connection to Mongo.
CC: ComponentContribution
eQuilibrator Component Contribution object to calculate ∆G with.
lc: LocalCompoundCache
The local compound cache to generate eQuilibrator compounds from.
"""
def __init__(
self,
):
# Mongo params
self.mongo_uri = None
self.client = None
self._core = None
# eQ params
self.CC = ComponentContribution()
self.lc = None
self._water = None
def load_mongo(self, mongo_uri: Union[str, None] = None):
if mongo_uri:
self.mongo_uri = mongo_uri
self.client = MongoClient(mongo_uri)
else:
self.mongo_uri = "localhost:27017"
self.client = MongoClient()
self._core = self.client["core"]
def _all_dbs_loaded(self):
if self.client and self._core and self.lc:
return True
else:
print("Load connection to Mongo and eQuilibrator local cache.")
return False
def _eq_loaded(self):
if self.lc:
return True
else:
print("Load eQulibrator local cache.")
return False
def _reset_CC(self):
"""reset CC back to defaults"""
self.CC.p_h = default_physiological_p_h
self.CC.p_mg = default_physiological_p_mg
self.CC.temperature = default_physiological_temperature
self.CC.ionic_strength = default_physiological_ionic_strength
def load_thermo_from_postgres(
self, postgres_uri: str = "postgresql:///eq_compounds"
) -> None:
"""Load a LocalCompoundCache from a postgres uri for equilibrator.
Parameters
----------
postgres_uri : str, optional
uri of the postgres DB to use, by default "postgresql:///eq_compounds"
"""
self.lc = LocalCompoundCache()
self.lc.ccache = CompoundCache(create_engine(postgres_uri))
self._water = self.lc.get_compounds("O")
def load_thermo_from_sqlite(
self, sqlite_filename: str = "compounds.sqlite"
) -> None:
"""Load a LocalCompoundCache from a sqlite file for equilibrator.
compounds.sqlite can be generated through LocalCompoundCache's method
generate_local_cache_from_default_zenodo
Parameters
----------
sqlite_filename: str
filename of the sqlite file to load.
"""
self.lc = LocalCompoundCache()
self.lc.load_cache(sqlite_filename)
self._water = self.lc.get_compounds("O")
def get_eQ_compound_from_cid(
self, c_id: str, pickaxe: Pickaxe = None, db_name: str = None
) -> Union[Compound, None]:
"""Get an equilibrator compound for a given c_id from the core.
Attempts to retrieve a compound from the core or a specified db_name.
Parameters
----------
c_id : str
compound ID for MongoDB lookup of a compound.
pickaxe : Pickaxe
pickaxe object to look for the compound in, by default None.
db_name : str
Database to look for compound in before core database, by default None.
Returns
-------
equilibrator_assets.compounds.Compound
eQuilibrator Compound
"""
# Find locally in pickaxe
compound_smiles = None
if pickaxe:
if c_id in pickaxe.compounds:
compound_smiles = pickaxe.compounds[c_id]["SMILES"]
else:
return None
# Find in mongo db
elif self._all_dbs_loaded():
if db_name:
compound = self.client[db_name].compounds.find_one(
{"_id": c_id}, {"SMILES": 1}
)
if compound:
compound_smiles = compound["SMILES"]
# No cpd smiles from database name
if not compound_smiles:
compound = self._core.compounds.find_one({"_id": c_id}, {"SMILES": 1})
if compound:
compound_smiles = compound["SMILES"]
# No compound_smiles at all
if not compound_smiles or "*" in compound_smiles:
return None
else:
eQ_compound = self.lc.get_compounds(
compound_smiles, bypass_chemaxon=True, save_empty_compounds=True
)
return eQ_compound
def standard_dg_formation_from_cid(
self, c_id: str, pickaxe: Pickaxe = None, db_name: str = None
) -> Union[float, None]:
"""Get standard ∆Gfo for a compound.
Parameters
----------
c_id : str
Compound ID to get the ∆Gf for.
pickaxe : Pickaxe
pickaxe object to look for the compound in, by default None.
db_name : str
Database to look for compound in before core database, by default None.
Returns
-------
Union[float, None]
∆Gf'o for a compound, or None if unavailable.
"""
eQ_cpd = self.get_eQ_compound_from_cid(c_id, pickaxe, db_name)
if not eQ_cpd:
return None
dgf = self.CC.standard_dg_formation(eQ_cpd)
dgf = dgf[0]
return dgf
def get_eQ_reaction_from_rid(
self, r_id: str, pickaxe: Pickaxe = None, db_name: str = None
) -> Union[PhasedReaction, None]:
"""Get an eQuilibrator reaction object from an r_id.
Parameters
----------
r_id : str
Reaction id to get object for.
pickaxe : Pickaxe
pickaxe object to look for the compound in, by default None.
db_name : str
Database to look for reaction in.
Returns
-------
PhasedReaction
eQuilibrator reactiono to calculate ∆Gr with.
"""
if pickaxe:
if r_id in pickaxe.reactions:
reaction_info = pickaxe.reactions[r_id]
else:
return None
elif db_name:
mine = self.client[db_name]
reaction_info = mine.reactions.find_one({"_id": r_id})
if not reaction_info:
return None
else:
return None
reactants = reaction_info["Reactants"]
products = reaction_info["Products"]
lhs = " + ".join(f"{r[0]} {r[1]}" for r in reactants)
rhs = " + ".join(f"{p[0]} {p[1]}" for p in products)
reaction_string = " => ".join([lhs, rhs])
compounds = set([r[1] for r in reactants])
compounds.update(tuple(p[1] for p in products))
eQ_compound_dict = {
c_id: self.get_eQ_compound_from_cid(c_id, pickaxe, db_name)
for c_id in compounds
}
if not all(eQ_compound_dict.values()):
return None
if "X73bc8ef21db580aefe4dbc0af17d4013961d9d17" not in compounds:
eQ_compound_dict["water"] = self._water
eq_reaction = Reaction.parse_formula(eQ_compound_dict.get, reaction_string)
return eq_reaction
def physiological_dg_prime_from_rid(
self, r_id: str, pickaxe: Pickaxe = None, db_name: str = None
) -> Union[pint.Measurement, None]:
"""Calculate the ∆Gm' of a reaction.
Parameters
----------
r_id : str
ID of the reaction to calculate.
pickaxe : Pickaxe
pickaxe object to look for the compound in, by default None.
db_name : str
MINE the reaction is found in.
Returns
-------
pint.Measurement
The calculated ∆G'm.
"""
eQ_reaction = self.get_eQ_reaction_from_rid(r_id, pickaxe, db_name)
if not eQ_reaction:
return None
dGm_prime = self.CC.physiological_dg_prime(eQ_reaction)
return dGm_prime
def standard_dg_prime_from_rid(
self, r_id: str, pickaxe: Pickaxe = None, db_name: str = None
) -> Union[pint.Measurement, None]:
"""Calculate the ∆G'o of a reaction.
Parameters
----------
r_id : str
ID of the reaction to calculate.
pickaxe : Pickaxe
pickaxe object to look for the compound in, by default None.
db_name : str
MINE the reaction is found in.
Returns
-------
pint.Measurement
The calculated ∆G'o.
"""
eQ_reaction = self.get_eQ_reaction_from_rid(r_id, pickaxe, db_name)
if not eQ_reaction:
return None
dG0_prime = self.CC.standard_dg_prime(eQ_reaction)
return dG0_prime
def dg_prime_from_rid(
self,
r_id: str,
pickaxe: Pickaxe = None,
db_name: str = None,
p_h: Q_ = default_physiological_p_h,
p_mg: Q_ = default_physiological_p_mg,
ionic_strength: Q_ = default_physiological_ionic_strength,
) -> Union[pint.Measurement, None]:
"""Calculate the ∆G' of a reaction.
Parameters
----------
r_id : str
ID of the reaction to calculate.
pickaxe : Pickaxe
pickaxe object to look for the compound in, by default None.
db_name : str
MINE the reaction is found in.
p_h : Q_
pH of system.
p_mg: Q_
pMg of the system.
ionic_strength: Q_
ionic strength of the system.
Returns
-------
pint.Measurement
The calculated ∆G'.
"""
eQ_reaction = self.get_eQ_reaction_from_rid(r_id, pickaxe, db_name)
if not eQ_reaction:
return None
self.CC.p_h = p_h
self.CC.p_mg = p_mg
self.CC.ionic_strength = ionic_strength
dG_prime = self.CC.dg_prime(eQ_reaction)
self._reset_CC()
return dG_prime
| JamesJeffryes/MINE-Database | minedatabase/thermodynamics.py | Python | mit | 11,041 | [
30522,
1000,
1000,
1000,
3937,
1996,
10867,
7716,
18279,
7712,
16268,
2005,
4060,
8528,
2063,
1012,
1000,
1000,
1000,
2013,
22868,
12324,
2586,
12324,
9231,
2102,
2013,
1041,
26147,
12322,
16259,
1035,
17928,
12324,
1006,
1053,
1035,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package org.fastnate.generator.converter;
import java.time.Duration;
import org.fastnate.generator.context.GeneratorContext;
import org.fastnate.generator.statements.ColumnExpression;
import org.fastnate.generator.statements.PrimitiveColumnExpression;
/**
* Converts a {@link Duration} to an SQL expression.
*
* @author Tobias Liefke
*/
public class DurationConverter implements ValueConverter<Duration> {
@Override
public ColumnExpression getExpression(final Duration value, final GeneratorContext context) {
return PrimitiveColumnExpression.create(value.toNanos(), context.getDialect());
}
@Override
public ColumnExpression getExpression(final String defaultValue, final GeneratorContext context) {
return getExpression(Duration.parse(defaultValue), context);
}
}
| liefke/org.fastnate | fastnate-generator/src/main/java/org/fastnate/generator/converter/DurationConverter.java | Java | apache-2.0 | 786 | [
30522,
7427,
8917,
1012,
3435,
12556,
1012,
13103,
1012,
10463,
2121,
1025,
12324,
9262,
1012,
2051,
1012,
9367,
1025,
12324,
8917,
1012,
3435,
12556,
1012,
13103,
1012,
6123,
1012,
13103,
8663,
18209,
1025,
12324,
8917,
1012,
3435,
12556,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#pragma once
#include "base/worker_thread.hpp"
#include "ugc/storage.hpp"
#include "ugc/types.hpp"
#include <functional>
class Index;
struct FeatureID;
namespace ugc
{
class Api
{
public:
using UGCCallback = std::function<void(UGC const &)>;
using UGCUpdateCallback = std::function<void(UGCUpdate const &)>;
explicit Api(Index const & index, std::string const & filename);
void GetUGC(FeatureID const & id, UGCCallback callback);
void GetUGCUpdate(FeatureID const & id, UGCUpdateCallback callback);
void SetUGCUpdate(FeatureID const & id, UGCUpdate const & ugc);
static UGC MakeTestUGC1(Time now = Clock::now());
static UGC MakeTestUGC2(Time now = Clock::now());
private:
void GetUGCImpl(FeatureID const & id, UGCCallback callback);
void GetUGCUpdateImpl(FeatureID const & id, UGCUpdateCallback callback);
void SetUGCUpdateImpl(FeatureID const & id, UGCUpdate const & ugc);
Index const & m_index;
base::WorkerThread m_thread;
Storage m_storage;
};
} // namespace ugc
| dobriy-eeh/omim | ugc/api.hpp | C++ | apache-2.0 | 1,008 | [
30522,
1001,
10975,
8490,
2863,
2320,
1001,
2421,
1000,
2918,
1013,
7309,
1035,
11689,
1012,
6522,
2361,
1000,
1001,
2421,
1000,
1057,
18195,
1013,
5527,
1012,
6522,
2361,
1000,
1001,
2421,
1000,
1057,
18195,
1013,
4127,
1012,
6522,
2361,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
class RoxFrontRouterModel extends RoxModelBase
{
function getPossibleUrlLanguage($urlheadercode = false)
{
// Uncomment briefly this line in case you have problem with it, save, log in BeWelcome, and add again the comment in this line
// return false ;
return false;
} // end of getPossibleUrlLanguage
function getLanguage($langcode = false)
{
if (!$langcode) {
return false;
} else {
if (is_numeric($langcode)) {
return $this->singleLookup("
SELECT
languages.id AS id,
languages.ShortCode AS ShortCode
FROM
languages,
words
WHERE
languages.id = '" . $this->dao->escape($langcode) . "' AND
languages.id = words.Idlanguage AND
words.code = 'welcometosignup'");
} else {
return $this->singleLookup("
SELECT
languages.id AS id,
languages.ShortCode AS ShortCode
FROM
languages,
words
WHERE
languages.ShortCode = '" . $this->dao->escape($langcode) . "' AND
languages.id = words.Idlanguage AND
words.code = 'welcometosignup'");
}
}
}
}
| gl0bi/rox | roxlauncher/roxfrontroutermodel.php | PHP | gpl-2.0 | 1,582 | [
30522,
1026,
1029,
25718,
30524,
19036,
19696,
3351,
1006,
1002,
24471,
2140,
4974,
2121,
16044,
1027,
6270,
1007,
1063,
1013,
1013,
4895,
9006,
3672,
4780,
2023,
2240,
1999,
2553,
2017,
2031,
3291,
2007,
2009,
1010,
3828,
1010,
8833,
1999,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* eslint-disable max-len */
declare global {
namespace Kloudless.filePicker {
function picker(options: ChooserOptions | SaverOptions): Picker;
function dropzone(options: DropzoneOptions): Dropzone;
function getGlobalOptions(): BuildOptions;
function setGlobalOptions(buildOptions: Partial<BuildOptions>);
/**
* See https://github.com/kloudless/file-picker#methods
*/
interface Picker extends Events {
choose(): void;
choosify(element: HTMLElement): void;
save(files: File[]): void;
savify(element: HTMLElement, files: File[]): void;
close(): void;
destroy(): void;
update(options: UpdateOptions): void;
logout(deleteAccount?: boolean): void;
}
/**
* See https://github.com/kloudless/file-picker#methods-1
*/
interface Dropzone extends DropzoneEvents {
close(): void;
destroy(): void;
update(options: DropzoneUpdateOptions): void;
}
type PersistMode = 'none' | 'local' | 'session';
type ServiceGroup = 'file_store' | 'object_store' | 'construction' | 'all';
/**
* Please refer to https://developers.kloudless.com/docs/latest/storage
* for the full list of suppoerted services.
*/
type ServiceName = string;
type ServiceCategory = 'all' | 'folders' | 'files' | 'text' | 'documents'
| 'images' | 'videos' | 'audio';
type FileExtension = string;
type NotUpdatableOptions = 'app_id' | 'custom_css' | 'types' | 'services'
| 'persist' | 'create_folder' | 'account_key' | 'elementId' | 'element';
type UpdateOptions = Partial<Omit<(ChooserOptions & SaverOptions), NotUpdatableOptions>>;
type DropzoneUpdateOptions = Partial<Omit<DropzoneOptions, NotUpdatableOptions>>;
interface File {
name: string;
url: string;
}
interface LinkOptions {
password?: string;
expiration?: string;
direct?: boolean;
}
/**
* See https://github.com/kloudless/file-picker#chooser-and-saver
*/
interface BaseOptions {
app_id: string;
retrieve_token?: boolean;
computer?: boolean;
persist?: PersistMode;
services?: (ServiceName | ServiceGroup)[];
account_management?: boolean;
display_backdrop?: boolean;
element?: string | HTMLElement;
// TODO: deprecate in v2
custom_css?: string;
/**
* Please refer to https://github.com/kloudless/file-picker#chooser-and-saver
* for the usage of `locale` option.
*/
locale?: string;
/**
* Please refer to https://github.com/kloudless/file-picker#chooser-and-saver
* for the usage of `translations` option.
*/
translations?: string | object;
dateTimeFormat?: string;
create_folder?: boolean;
/**
* @deprecated Please use the `retrieve_token` option instead.
*/
account_key?: boolean;
/**
* @deprecated Please use the `retrieve_token` option instead.
*/
keys?: string[];
tokens?: string[];
enable_logout?: boolean;
delete_accounts_on_logout?: boolean;
oauth?(service: ServiceName): OAuthQueryParams;
root_folder_id?: { [key: number]: string };
}
/**
* See https://github.com/kloudless/file-picker#chooser-and-saver
*/
interface ChooserOptions extends BaseOptions {
multiselect?: boolean;
link?: boolean;
link_options?: LinkOptions;
copy_to_upload_location?: 'async' | 'sync';
upload_location_account?: string;
upload_location_folder?: string;
uploads_pause_on_error?: boolean;
types?: (FileExtension | ServiceCategory)[];
}
/**
* See https://github.com/kloudless/file-picker#chooser-and-saver
*/
interface SaverOptions extends BaseOptions {
files: File[];
}
interface DropzoneDeprecatedOptions {
/**
* @deprecated Please use the `element` option instead.
*/
elementId: string;
}
interface DropzoneNewOptions {
element: string | HTMLElement;
}
type DropzoneOptions = ChooserOptions & {
copy_to_upload_location: 'async' | 'sync';
computer?: true;
} & (DropzoneDeprecatedOptions | DropzoneNewOptions);
interface BuildOptions {
pickerUrl?: string;
}
/**
* See https://developers.kloudless.com/docs/v1/authentication#oauth-2.0.
*/
interface OAuthQueryParams {
scope?: string;
oob_loading_delay?: number;
custom_properties?: object;
raw?: object;
/**
* @deprecated Please use the `form_data` option instead.
*/
extra_data?: object;
form_data?: object;
}
type SuccessEvent = Array<FileMetadata | FolderMetadata | Task>;
type ErrorEvent = Array<FileMetadata | FolderMetadata | Task | SaverError>;
type SelectedEvent = FileMetadata[] | FolderMetadata[];
type SaverStartFileUploadEvent = SaverFile;
type StartFileUploadEvent = ChooserStartFileUploadEvent | SaverStartFileUploadEvent;
type FinishFileUploadEvent = ChooserFinishFileUploadEvent | SaverFinishFileUploadEvent;
/**
* See https://github.com/kloudless/file-picker#events
*/
interface Events {
on(event: 'success', callback: (event: SuccessEvent) => void): void;
on(event: 'cancel', callback: () => void): void;
on(event: 'error', callback: (event: ErrorEvent) => void): void;
on(event: 'open', callback: () => void): void;
on(event: 'close', callback: () => void): void;
on(event: 'selected', callback: (event: SelectedEvent) => void): void;
on(event: 'addAccount', callback: (account: Account) => void): void;
on(event: 'deleteAccount', callback: (accountId: number) => void): void;
on(event: 'startFileUpload', callback: (event: StartFileUploadEvent) => void): void;
on(event: 'finishFileUpload', callback: (event: FinishFileUploadEvent) => void): void;
on(event: 'logout', callback: () => void): void;
}
/**
* See https://github.com/kloudless/file-picker#events
*/
type DropzoneEvents = Events & {
on(event: 'drop', callback: () => void): void;
}
interface BaseMetadata {
id: string;
name: string;
size: number | null;
created: string | null;
modified: string | null;
type: string;
account: number;
parent: ParentMetadata;
ancestors: ParentMetadata[] | null;
path: string | null;
/**
* @deprecated
*/
raw_id: string;
owner?: UserMetadata;
creator?: UserMetadata;
last_modifier?: UserMetadata;
api: 'storage';
ids?: IdsMetadata;
id_type?: keyof IdsMetadata;
bearer_token?: {
key: string;
};
error?: Error;
/**
* In case Kloudless API introduces new properties but hasn't updated here.
* Please notify us by creating GitHub issues: https://github.com/kloudless/file-picker/issues.
*/
[x: string]: any; // eslint-disable-line @typescript-eslint/no-explicit-any
}
/**
* See https://developers.kloudless.com/docs/latest/storage#files
*/
interface FileMetadata extends BaseMetadata {
type: 'file';
mime_type: string;
downloadable: boolean;
link?: string;
}
/**
* See https://developers.kloudless.com/docs/latest/storage#folders
*/
interface FolderMetadata extends BaseMetadata {
type: 'folder';
can_create_folders: boolean;
can_upload_files: boolean;
}
interface UserMetadata {
id: string;
}
interface ParentMetadata {
id: string;
name: string;
id_type?: keyof IdsMetadata;
}
interface IdsMetadata {
default?: string;
shared?: string;
path?: string;
version?: string;
}
interface Error {
status_code: number;
message: string;
error_code: string;
id: string;
}
interface Account {
id: string;
name: string;
service: ServiceName;
bearer_token?: {
key: string;
};
}
interface ChooserStartFileUploadEvent {
id: string;
name: string;
size: number;
mime_type: string;
}
interface SaverFile {
url: string;
name: string;
}
interface SaverError extends SaverFile {
error: Error;
}
interface ChooserFinishFileUploadEvent extends ChooserStartFileUploadEvent {
metadata: FileMetadata;
}
interface SaverFinishFileUploadEvent extends SaverFile {
metadata: FileMetadata;
}
/**
* See https://developers.kloudless.com/docs/latest/core#asynchronous-requests-and-the-task-api
*/
interface Task {
id: string;
state: 'PENDING' | 'RECEIVED' | 'STARTED';
account?: number;
bearer_token?: {
key: string;
};
}
}
}
export default Kloudless.filePicker;
export type PersistMode = Kloudless.filePicker.PersistMode;
export type ServiceGroup = Kloudless.filePicker.ServiceGroup;
export type ServiceName = Kloudless.filePicker.ServiceName;
export type ServiceCategory = Kloudless.filePicker.ServiceCategory;
export type FileExtension = Kloudless.filePicker.FileExtension;
export type UpdateOptions = Kloudless.filePicker.UpdateOptions;
export type DropzoneUpdateOptions = Kloudless.filePicker.DropzoneUpdateOptions;
export type SuccessEvent = Kloudless.filePicker.SuccessEvent;
export type ErrorEvent = Kloudless.filePicker.ErrorEvent;
export type SelectedEvent = Kloudless.filePicker.SelectedEvent;
export type StartFileUploadEvent = Kloudless.filePicker.StartFileUploadEvent;
export type FinishFileUploadEvent = Kloudless.filePicker.FinishFileUploadEvent;
export type ChooserStartFileUploadEvent = Kloudless.filePicker.ChooserStartFileUploadEvent;
export type SaverStartFileUploadEvent = Kloudless.filePicker.SaverStartFileUploadEvent;
export type ChooserFinishFileUploadEvent = Kloudless.filePicker.ChooserFinishFileUploadEvent;
export type SaverFinishFileUploadEvent = Kloudless.filePicker.SaverFinishFileUploadEvent;
export type Picker = Kloudless.filePicker.Picker;
export type Dropzone = Kloudless.filePicker.Dropzone;
export type File = Kloudless.filePicker.File;
export type LinkOptions = Kloudless.filePicker.LinkOptions;
export type BaseOptions = Kloudless.filePicker.BaseOptions;
export type ChooserOptions = Kloudless.filePicker.ChooserOptions;
export type SaverOptions = Kloudless.filePicker.SaverOptions;
export type DropzoneOptions = Kloudless.filePicker.DropzoneOptions;
export type BuildOptions = Kloudless.filePicker.BuildOptions;
export type OAuthQueryParams = Kloudless.filePicker.OAuthQueryParams;
export type Events = Kloudless.filePicker.Events;
export type BaseMetadata = Kloudless.filePicker.BaseMetadata;
export type FileMetadata = Kloudless.filePicker.FileMetadata;
export type FolderMetadata = Kloudless.filePicker.FolderMetadata;
export type UserMetadata = Kloudless.filePicker.UserMetadata;
export type ParentMetadata = Kloudless.filePicker.ParentMetadata;
export type IdsMetadata = Kloudless.filePicker.IdsMetadata;
export type Error = Kloudless.filePicker.Error;
export type SaverError = Kloudless.filePicker.SaverError;
export type Account = Kloudless.filePicker.Account;
export type Task = Kloudless.filePicker.Task;
| Kloudless/file-explorer | src/loader/js/interface.d.ts | TypeScript | mit | 11,363 | [
30522,
1013,
1008,
9686,
4115,
2102,
1011,
4487,
19150,
4098,
1011,
18798,
1008,
1013,
13520,
3795,
1063,
3415,
15327,
1047,
23743,
27822,
2015,
1012,
5371,
24330,
5484,
1063,
3853,
4060,
2121,
1006,
7047,
1024,
5454,
18981,
9285,
1064,
382... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.docs.appendix.configurationmetadata.annotationprocessor.automaticmetadatageneration;
import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "my.server")
public class MyServerProperties {
/**
* Name of the server.
*/
private String name;
/**
* IP address to listen to.
*/
private String ip = "127.0.0.1";
/**
* Port to listener to.
*/
private int port = 9797;
// @fold:on // getters/setters ...
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getIp() {
return this.ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public int getPort() {
return this.port;
}
public void setPort(int port) {
this.port = port;
}
// fold:off
}
| spring-projects/spring-boot | spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/appendix/configurationmetadata/annotationprocessor/automaticmetadatageneration/MyServerProperties.java | Java | apache-2.0 | 1,460 | [
30522,
1013,
1008,
1008,
9385,
2262,
1011,
25682,
1996,
2434,
3166,
2030,
6048,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* $Id: elsa_ser.c,v 1.1.1.1 2011/08/19 02:08:59 ronald Exp $
*
* stuff for the serial modem on ELSA cards
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#include <linux/serial.h>
#include <linux/serial_reg.h>
#include <linux/slab.h>
#define MAX_MODEM_BUF 256
#define WAKEUP_CHARS (MAX_MODEM_BUF/2)
#define RS_ISR_PASS_LIMIT 256
#define BASE_BAUD ( 1843200 / 16 )
//#define SERIAL_DEBUG_OPEN 1
//#define SERIAL_DEBUG_INTR 1
//#define SERIAL_DEBUG_FLOW 1
#undef SERIAL_DEBUG_OPEN
#undef SERIAL_DEBUG_INTR
#undef SERIAL_DEBUG_FLOW
#undef SERIAL_DEBUG_REG
//#define SERIAL_DEBUG_REG 1
#ifdef SERIAL_DEBUG_REG
static u_char deb[32];
const char *ModemIn[] = {"RBR","IER","IIR","LCR","MCR","LSR","MSR","SCR"};
const char *ModemOut[] = {"THR","IER","FCR","LCR","MCR","LSR","MSR","SCR"};
#endif
static char *MInit_1 = "AT&F&C1E0&D2\r\0";
static char *MInit_2 = "ATL2M1S64=13\r\0";
static char *MInit_3 = "AT+FCLASS=0\r\0";
static char *MInit_4 = "ATV1S2=128X1\r\0";
static char *MInit_5 = "AT\\V8\\N3\r\0";
static char *MInit_6 = "ATL0M0&G0%E1\r\0";
static char *MInit_7 = "AT%L1%M0%C3\r\0";
static char *MInit_speed28800 = "AT%G0%B28800\r\0";
static char *MInit_dialout = "ATs7=60 x1 d\r\0";
static char *MInit_dialin = "ATs7=60 x1 a\r\0";
static inline unsigned int serial_in(struct IsdnCardState *cs, int offset)
{
#ifdef SERIAL_DEBUG_REG
u_int val = inb(cs->hw.elsa.base + 8 + offset);
debugl1(cs,"in %s %02x",ModemIn[offset], val);
return(val);
#else
return inb(cs->hw.elsa.base + 8 + offset);
#endif
}
static inline unsigned int serial_inp(struct IsdnCardState *cs, int offset)
{
#ifdef SERIAL_DEBUG_REG
#ifdef ELSA_SERIAL_NOPAUSE_IO
u_int val = inb(cs->hw.elsa.base + 8 + offset);
debugl1(cs,"inp %s %02x",ModemIn[offset], val);
#else
u_int val = inb_p(cs->hw.elsa.base + 8 + offset);
debugl1(cs,"inP %s %02x",ModemIn[offset], val);
#endif
return(val);
#else
#ifdef ELSA_SERIAL_NOPAUSE_IO
return inb(cs->hw.elsa.base + 8 + offset);
#else
return inb_p(cs->hw.elsa.base + 8 + offset);
#endif
#endif
}
static inline void serial_out(struct IsdnCardState *cs, int offset, int value)
{
#ifdef SERIAL_DEBUG_REG
debugl1(cs,"out %s %02x",ModemOut[offset], value);
#endif
outb(value, cs->hw.elsa.base + 8 + offset);
}
static inline void serial_outp(struct IsdnCardState *cs, int offset,
int value)
{
#ifdef SERIAL_DEBUG_REG
#ifdef ELSA_SERIAL_NOPAUSE_IO
debugl1(cs,"outp %s %02x",ModemOut[offset], value);
#else
debugl1(cs,"outP %s %02x",ModemOut[offset], value);
#endif
#endif
#ifdef ELSA_SERIAL_NOPAUSE_IO
outb(value, cs->hw.elsa.base + 8 + offset);
#else
outb_p(value, cs->hw.elsa.base + 8 + offset);
#endif
}
/*
* This routine is called to set the UART divisor registers to match
* the specified baud rate for a serial port.
*/
static void change_speed(struct IsdnCardState *cs, int baud)
{
int quot = 0, baud_base;
unsigned cval, fcr = 0;
int bits;
/* byte size and parity */
cval = 0x03; bits = 10;
/* Determine divisor based on baud rate */
baud_base = BASE_BAUD;
quot = baud_base / baud;
/* If the quotient is ever zero, default to 9600 bps */
if (!quot)
quot = baud_base / 9600;
/* Set up FIFO's */
if ((baud_base / quot) < 2400)
fcr = UART_FCR_ENABLE_FIFO | UART_FCR_TRIGGER_1;
else
fcr = UART_FCR_ENABLE_FIFO | UART_FCR_TRIGGER_8;
serial_outp(cs, UART_FCR, fcr);
/* CTS flow control flag and modem status interrupts */
cs->hw.elsa.IER &= ~UART_IER_MSI;
cs->hw.elsa.IER |= UART_IER_MSI;
serial_outp(cs, UART_IER, cs->hw.elsa.IER);
debugl1(cs,"modem quot=0x%x", quot);
serial_outp(cs, UART_LCR, cval | UART_LCR_DLAB);/* set DLAB */
serial_outp(cs, UART_DLL, quot & 0xff); /* LS of divisor */
serial_outp(cs, UART_DLM, quot >> 8); /* MS of divisor */
serial_outp(cs, UART_LCR, cval); /* reset DLAB */
serial_inp(cs, UART_RX);
}
static int mstartup(struct IsdnCardState *cs)
{
int retval=0;
/*
* Clear the FIFO buffers and disable them
* (they will be reenabled in change_speed())
*/
serial_outp(cs, UART_FCR, (UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT));
/*
* At this point there's no way the LSR could still be 0xFF;
* if it is, then bail out, because there's likely no UART
* here.
*/
if (serial_inp(cs, UART_LSR) == 0xff) {
retval = -ENODEV;
goto errout;
}
/*
* Clear the interrupt registers.
*/
(void) serial_inp(cs, UART_RX);
(void) serial_inp(cs, UART_IIR);
(void) serial_inp(cs, UART_MSR);
/*
* Now, initialize the UART
*/
serial_outp(cs, UART_LCR, UART_LCR_WLEN8); /* reset DLAB */
cs->hw.elsa.MCR = 0;
cs->hw.elsa.MCR = UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2;
serial_outp(cs, UART_MCR, cs->hw.elsa.MCR);
/*
* Finally, enable interrupts
*/
cs->hw.elsa.IER = UART_IER_MSI | UART_IER_RLSI | UART_IER_RDI;
serial_outp(cs, UART_IER, cs->hw.elsa.IER); /* enable interrupts */
/*
* And clear the interrupt registers again for luck.
*/
(void)serial_inp(cs, UART_LSR);
(void)serial_inp(cs, UART_RX);
(void)serial_inp(cs, UART_IIR);
(void)serial_inp(cs, UART_MSR);
cs->hw.elsa.transcnt = cs->hw.elsa.transp = 0;
cs->hw.elsa.rcvcnt = cs->hw.elsa.rcvp =0;
/*
* and set the speed of the serial port
*/
change_speed(cs, BASE_BAUD);
cs->hw.elsa.MFlag = 1;
errout:
return retval;
}
/*
* This routine will shutdown a serial port; interrupts are disabled, and
* DTR is dropped if the hangup on close termio flag is on.
*/
static void mshutdown(struct IsdnCardState *cs)
{
#ifdef SERIAL_DEBUG_OPEN
printk(KERN_DEBUG"Shutting down serial ....");
#endif
/*
* clear delta_msr_wait queue to avoid mem leaks: we may free the irq
* here so the queue might never be waken up
*/
cs->hw.elsa.IER = 0;
serial_outp(cs, UART_IER, 0x00); /* disable all intrs */
cs->hw.elsa.MCR &= ~UART_MCR_OUT2;
/* disable break condition */
serial_outp(cs, UART_LCR, serial_inp(cs, UART_LCR) & ~UART_LCR_SBC);
cs->hw.elsa.MCR &= ~(UART_MCR_DTR|UART_MCR_RTS);
serial_outp(cs, UART_MCR, cs->hw.elsa.MCR);
/* disable FIFO's */
serial_outp(cs, UART_FCR, (UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT));
serial_inp(cs, UART_RX); /* read data port to reset things */
#ifdef SERIAL_DEBUG_OPEN
printk(" done\n");
#endif
}
static inline int
write_modem(struct BCState *bcs) {
int ret=0;
struct IsdnCardState *cs = bcs->cs;
int count, len, fp;
if (!bcs->tx_skb)
return 0;
if (bcs->tx_skb->len <= 0)
return 0;
len = bcs->tx_skb->len;
if (len > MAX_MODEM_BUF - cs->hw.elsa.transcnt)
len = MAX_MODEM_BUF - cs->hw.elsa.transcnt;
fp = cs->hw.elsa.transcnt + cs->hw.elsa.transp;
fp &= (MAX_MODEM_BUF -1);
count = len;
if (count > MAX_MODEM_BUF - fp) {
count = MAX_MODEM_BUF - fp;
skb_copy_from_linear_data(bcs->tx_skb,
cs->hw.elsa.transbuf + fp, count);
skb_pull(bcs->tx_skb, count);
cs->hw.elsa.transcnt += count;
ret = count;
count = len - count;
fp = 0;
}
skb_copy_from_linear_data(bcs->tx_skb,
cs->hw.elsa.transbuf + fp, count);
skb_pull(bcs->tx_skb, count);
cs->hw.elsa.transcnt += count;
ret += count;
if (cs->hw.elsa.transcnt &&
!(cs->hw.elsa.IER & UART_IER_THRI)) {
cs->hw.elsa.IER |= UART_IER_THRI;
serial_outp(cs, UART_IER, cs->hw.elsa.IER);
}
return(ret);
}
static inline void
modem_fill(struct BCState *bcs) {
if (bcs->tx_skb) {
if (bcs->tx_skb->len) {
write_modem(bcs);
return;
} else {
if (test_bit(FLG_LLI_L1WAKEUP,&bcs->st->lli.flag) &&
(PACKET_NOACK != bcs->tx_skb->pkt_type)) {
u_long flags;
spin_lock_irqsave(&bcs->aclock, flags);
bcs->ackcnt += bcs->hw.hscx.count;
spin_unlock_irqrestore(&bcs->aclock, flags);
schedule_event(bcs, B_ACKPENDING);
}
dev_kfree_skb_any(bcs->tx_skb);
bcs->tx_skb = NULL;
}
}
if ((bcs->tx_skb = skb_dequeue(&bcs->squeue))) {
bcs->hw.hscx.count = 0;
test_and_set_bit(BC_FLG_BUSY, &bcs->Flag);
write_modem(bcs);
} else {
test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag);
schedule_event(bcs, B_XMTBUFREADY);
}
}
static inline void receive_chars(struct IsdnCardState *cs,
int *status)
{
unsigned char ch;
struct sk_buff *skb;
do {
ch = serial_in(cs, UART_RX);
if (cs->hw.elsa.rcvcnt >= MAX_MODEM_BUF)
break;
cs->hw.elsa.rcvbuf[cs->hw.elsa.rcvcnt++] = ch;
#ifdef SERIAL_DEBUG_INTR
printk("DR%02x:%02x...", ch, *status);
#endif
if (*status & (UART_LSR_BI | UART_LSR_PE |
UART_LSR_FE | UART_LSR_OE)) {
#ifdef SERIAL_DEBUG_INTR
printk("handling exept....");
#endif
}
*status = serial_inp(cs, UART_LSR);
} while (*status & UART_LSR_DR);
if (cs->hw.elsa.MFlag == 2) {
if (!(skb = dev_alloc_skb(cs->hw.elsa.rcvcnt)))
printk(KERN_WARNING "ElsaSER: receive out of memory\n");
else {
memcpy(skb_put(skb, cs->hw.elsa.rcvcnt), cs->hw.elsa.rcvbuf,
cs->hw.elsa.rcvcnt);
skb_queue_tail(& cs->hw.elsa.bcs->rqueue, skb);
}
schedule_event(cs->hw.elsa.bcs, B_RCVBUFREADY);
} else {
char tmp[128];
char *t = tmp;
t += sprintf(t, "modem read cnt %d", cs->hw.elsa.rcvcnt);
QuickHex(t, cs->hw.elsa.rcvbuf, cs->hw.elsa.rcvcnt);
debugl1(cs, tmp);
}
cs->hw.elsa.rcvcnt = 0;
}
static inline void transmit_chars(struct IsdnCardState *cs, int *intr_done)
{
int count;
debugl1(cs, "transmit_chars: p(%x) cnt(%x)", cs->hw.elsa.transp,
cs->hw.elsa.transcnt);
if (cs->hw.elsa.transcnt <= 0) {
cs->hw.elsa.IER &= ~UART_IER_THRI;
serial_out(cs, UART_IER, cs->hw.elsa.IER);
return;
}
count = 16;
do {
serial_outp(cs, UART_TX, cs->hw.elsa.transbuf[cs->hw.elsa.transp++]);
if (cs->hw.elsa.transp >= MAX_MODEM_BUF)
cs->hw.elsa.transp=0;
if (--cs->hw.elsa.transcnt <= 0)
break;
} while (--count > 0);
if ((cs->hw.elsa.transcnt < WAKEUP_CHARS) && (cs->hw.elsa.MFlag==2))
modem_fill(cs->hw.elsa.bcs);
#ifdef SERIAL_DEBUG_INTR
printk("THRE...");
#endif
if (intr_done)
*intr_done = 0;
if (cs->hw.elsa.transcnt <= 0) {
cs->hw.elsa.IER &= ~UART_IER_THRI;
serial_outp(cs, UART_IER, cs->hw.elsa.IER);
}
}
static void rs_interrupt_elsa(struct IsdnCardState *cs)
{
int status, iir, msr;
int pass_counter = 0;
#ifdef SERIAL_DEBUG_INTR
printk(KERN_DEBUG "rs_interrupt_single(%d)...", cs->irq);
#endif
do {
status = serial_inp(cs, UART_LSR);
debugl1(cs,"rs LSR %02x", status);
#ifdef SERIAL_DEBUG_INTR
printk("status = %x...", status);
#endif
if (status & UART_LSR_DR)
receive_chars(cs, &status);
if (status & UART_LSR_THRE)
transmit_chars(cs, NULL);
if (pass_counter++ > RS_ISR_PASS_LIMIT) {
printk("rs_single loop break.\n");
break;
}
iir = serial_inp(cs, UART_IIR);
debugl1(cs,"rs IIR %02x", iir);
if ((iir & 0xf) == 0) {
msr = serial_inp(cs, UART_MSR);
debugl1(cs,"rs MSR %02x", msr);
}
} while (!(iir & UART_IIR_NO_INT));
#ifdef SERIAL_DEBUG_INTR
printk("end.\n");
#endif
}
extern int open_hscxstate(struct IsdnCardState *cs, struct BCState *bcs);
extern void modehscx(struct BCState *bcs, int mode, int bc);
extern void hscx_l2l1(struct PStack *st, int pr, void *arg);
static void
close_elsastate(struct BCState *bcs)
{
modehscx(bcs, 0, bcs->channel);
if (test_and_clear_bit(BC_FLG_INIT, &bcs->Flag)) {
if (bcs->hw.hscx.rcvbuf) {
if (bcs->mode != L1_MODE_MODEM)
kfree(bcs->hw.hscx.rcvbuf);
bcs->hw.hscx.rcvbuf = NULL;
}
skb_queue_purge(&bcs->rqueue);
skb_queue_purge(&bcs->squeue);
if (bcs->tx_skb) {
dev_kfree_skb_any(bcs->tx_skb);
bcs->tx_skb = NULL;
test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag);
}
}
}
static void
modem_write_cmd(struct IsdnCardState *cs, u_char *buf, int len) {
int count, fp;
u_char *msg = buf;
if (!len)
return;
if (len > (MAX_MODEM_BUF - cs->hw.elsa.transcnt)) {
return;
}
fp = cs->hw.elsa.transcnt + cs->hw.elsa.transp;
fp &= (MAX_MODEM_BUF -1);
count = len;
if (count > MAX_MODEM_BUF - fp) {
count = MAX_MODEM_BUF - fp;
memcpy(cs->hw.elsa.transbuf + fp, msg, count);
cs->hw.elsa.transcnt += count;
msg += count;
count = len - count;
fp = 0;
}
memcpy(cs->hw.elsa.transbuf + fp, msg, count);
cs->hw.elsa.transcnt += count;
if (cs->hw.elsa.transcnt &&
!(cs->hw.elsa.IER & UART_IER_THRI)) {
cs->hw.elsa.IER |= UART_IER_THRI;
serial_outp(cs, UART_IER, cs->hw.elsa.IER);
}
}
static void
modem_set_init(struct IsdnCardState *cs) {
int timeout;
#define RCV_DELAY 20
modem_write_cmd(cs, MInit_1, strlen(MInit_1));
timeout = 1000;
while(timeout-- && cs->hw.elsa.transcnt)
udelay(1000);
debugl1(cs, "msi tout=%d", timeout);
mdelay(RCV_DELAY);
modem_write_cmd(cs, MInit_2, strlen(MInit_2));
timeout = 1000;
while(timeout-- && cs->hw.elsa.transcnt)
udelay(1000);
debugl1(cs, "msi tout=%d", timeout);
mdelay(RCV_DELAY);
modem_write_cmd(cs, MInit_3, strlen(MInit_3));
timeout = 1000;
while(timeout-- && cs->hw.elsa.transcnt)
udelay(1000);
debugl1(cs, "msi tout=%d", timeout);
mdelay(RCV_DELAY);
modem_write_cmd(cs, MInit_4, strlen(MInit_4));
timeout = 1000;
while(timeout-- && cs->hw.elsa.transcnt)
udelay(1000);
debugl1(cs, "msi tout=%d", timeout);
mdelay(RCV_DELAY);
modem_write_cmd(cs, MInit_5, strlen(MInit_5));
timeout = 1000;
while(timeout-- && cs->hw.elsa.transcnt)
udelay(1000);
debugl1(cs, "msi tout=%d", timeout);
mdelay(RCV_DELAY);
modem_write_cmd(cs, MInit_6, strlen(MInit_6));
timeout = 1000;
while(timeout-- && cs->hw.elsa.transcnt)
udelay(1000);
debugl1(cs, "msi tout=%d", timeout);
mdelay(RCV_DELAY);
modem_write_cmd(cs, MInit_7, strlen(MInit_7));
timeout = 1000;
while(timeout-- && cs->hw.elsa.transcnt)
udelay(1000);
debugl1(cs, "msi tout=%d", timeout);
mdelay(RCV_DELAY);
}
static void
modem_set_dial(struct IsdnCardState *cs, int outgoing) {
int timeout;
#define RCV_DELAY 20
modem_write_cmd(cs, MInit_speed28800, strlen(MInit_speed28800));
timeout = 1000;
while(timeout-- && cs->hw.elsa.transcnt)
udelay(1000);
debugl1(cs, "msi tout=%d", timeout);
mdelay(RCV_DELAY);
if (outgoing)
modem_write_cmd(cs, MInit_dialout, strlen(MInit_dialout));
else
modem_write_cmd(cs, MInit_dialin, strlen(MInit_dialin));
timeout = 1000;
while(timeout-- && cs->hw.elsa.transcnt)
udelay(1000);
debugl1(cs, "msi tout=%d", timeout);
mdelay(RCV_DELAY);
}
static void
modem_l2l1(struct PStack *st, int pr, void *arg)
{
struct BCState *bcs = st->l1.bcs;
struct sk_buff *skb = arg;
u_long flags;
if (pr == (PH_DATA | REQUEST)) {
spin_lock_irqsave(&bcs->cs->lock, flags);
if (bcs->tx_skb) {
skb_queue_tail(&bcs->squeue, skb);
} else {
bcs->tx_skb = skb;
test_and_set_bit(BC_FLG_BUSY, &bcs->Flag);
bcs->hw.hscx.count = 0;
write_modem(bcs);
}
spin_unlock_irqrestore(&bcs->cs->lock, flags);
} else if (pr == (PH_ACTIVATE | REQUEST)) {
test_and_set_bit(BC_FLG_ACTIV, &bcs->Flag);
st->l1.l1l2(st, PH_ACTIVATE | CONFIRM, NULL);
set_arcofi(bcs->cs, st->l1.bc);
mstartup(bcs->cs);
modem_set_dial(bcs->cs, test_bit(FLG_ORIG, &st->l2.flag));
bcs->cs->hw.elsa.MFlag=2;
} else if (pr == (PH_DEACTIVATE | REQUEST)) {
test_and_clear_bit(BC_FLG_ACTIV, &bcs->Flag);
bcs->cs->dc.isac.arcofi_bc = st->l1.bc;
arcofi_fsm(bcs->cs, ARCOFI_START, &ARCOFI_XOP_0);
interruptible_sleep_on(&bcs->cs->dc.isac.arcofi_wait);
bcs->cs->hw.elsa.MFlag=1;
} else {
printk(KERN_WARNING"ElsaSer: unknown pr %x\n", pr);
}
}
static int
setstack_elsa(struct PStack *st, struct BCState *bcs)
{
bcs->channel = st->l1.bc;
switch (st->l1.mode) {
case L1_MODE_HDLC:
case L1_MODE_TRANS:
if (open_hscxstate(st->l1.hardware, bcs))
return (-1);
st->l2.l2l1 = hscx_l2l1;
break;
case L1_MODE_MODEM:
bcs->mode = L1_MODE_MODEM;
if (!test_and_set_bit(BC_FLG_INIT, &bcs->Flag)) {
bcs->hw.hscx.rcvbuf = bcs->cs->hw.elsa.rcvbuf;
skb_queue_head_init(&bcs->rqueue);
skb_queue_head_init(&bcs->squeue);
}
bcs->tx_skb = NULL;
test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag);
bcs->event = 0;
bcs->hw.hscx.rcvidx = 0;
bcs->tx_cnt = 0;
bcs->cs->hw.elsa.bcs = bcs;
st->l2.l2l1 = modem_l2l1;
break;
}
st->l1.bcs = bcs;
setstack_manager(st);
bcs->st = st;
setstack_l1_B(st);
return (0);
}
static void
init_modem(struct IsdnCardState *cs) {
cs->bcs[0].BC_SetStack = setstack_elsa;
cs->bcs[1].BC_SetStack = setstack_elsa;
cs->bcs[0].BC_Close = close_elsastate;
cs->bcs[1].BC_Close = close_elsastate;
if (!(cs->hw.elsa.rcvbuf = kmalloc(MAX_MODEM_BUF,
GFP_ATOMIC))) {
printk(KERN_WARNING
"Elsa: No modem mem hw.elsa.rcvbuf\n");
return;
}
if (!(cs->hw.elsa.transbuf = kmalloc(MAX_MODEM_BUF,
GFP_ATOMIC))) {
printk(KERN_WARNING
"Elsa: No modem mem hw.elsa.transbuf\n");
kfree(cs->hw.elsa.rcvbuf);
cs->hw.elsa.rcvbuf = NULL;
return;
}
if (mstartup(cs)) {
printk(KERN_WARNING "Elsa: problem startup modem\n");
}
modem_set_init(cs);
}
static void
release_modem(struct IsdnCardState *cs) {
cs->hw.elsa.MFlag = 0;
if (cs->hw.elsa.transbuf) {
if (cs->hw.elsa.rcvbuf) {
mshutdown(cs);
kfree(cs->hw.elsa.rcvbuf);
cs->hw.elsa.rcvbuf = NULL;
}
kfree(cs->hw.elsa.transbuf);
cs->hw.elsa.transbuf = NULL;
}
}
| embeddedarm/linux-2.6.35-ts4800 | drivers/isdn/hisax/elsa_ser.c | C | gpl-2.0 | 17,033 | [
30522,
1013,
1008,
1002,
8909,
1024,
23452,
1035,
14262,
1012,
1039,
1010,
1058,
1015,
1012,
1015,
1012,
1015,
1012,
1015,
2249,
1013,
5511,
1013,
2539,
6185,
1024,
5511,
1024,
5354,
8923,
4654,
2361,
1002,
1008,
1008,
4933,
2005,
1996,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#
# Author:: Sander Botman <sbotman@schubergphilis.com>
# Cookbook:: nagios
# Recipe:: _load_databag_config
#
# Copyright:: 2014, Sander Botman
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Loading all databag information
nagios_bags = NagiosDataBags.new
hostgroups = nagios_bags.get(node['nagios']['hostgroups_databag'])
hostgroups.each do |group|
next if group['search_query'].nil?
if node['nagios']['multi_environment_monitoring']
query_environments = node['nagios']['monitored_environments'].map do |environment|
"chef_environment:#{environment}"
end.join(' OR ')
result = search(:node, "(#{group['search_query']}) AND (#{query_environments})")
else
result = search(:node, "#{group['search_query']} AND chef_environment:#{node.chef_environment}")
end
result.each do |n|
n.automatic_attrs['roles'] = [group['hostgroup_name']]
Nagios.instance.push(n)
end
end
services = nagios_bags.get(node['nagios']['services_databag'])
services.each do |item|
next unless item['activate_check_in_environment'].nil? || item['activate_check_in_environment'].include?(node.chef_environment)
name = item['service_description'] || item['id']
check_command = name.downcase.start_with?('check_') ? name.downcase : 'check_' + name.downcase
command_name = item['check_command'].nil? ? check_command : item['check_command']
service_name = name.downcase.start_with?('check_') ? name.gsub('check_', '') : name.downcase
item['check_command'] = command_name
nagios_command command_name do
options item
end
nagios_service service_name do
options item
end
end
contactgroups = nagios_bags.get(node['nagios']['contactgroups_databag'])
contactgroups.each do |item|
name = item['contactgroup_name'] || item['id']
nagios_contactgroup name do
options item
end
end
eventhandlers = nagios_bags.get(node['nagios']['eventhandlers_databag'])
eventhandlers.each do |item|
name = item['command_name'] || item['id']
nagios_command name do
options item
end
end
contacts = nagios_bags.get(node['nagios']['contacts_databag'])
contacts.each do |item|
name = item['contact_name'] || item['id']
nagios_contact name do
options item
end
end
hostescalations = nagios_bags.get(node['nagios']['hostescalations_databag'])
hostescalations.each do |item|
name = item['host_description'] || item['id']
nagios_hostescalation name do
options item
end
end
hosttemplates = nagios_bags.get(node['nagios']['hosttemplates_databag'])
hosttemplates.each do |item|
name = item['host_name'] || item['id']
item['name'] = name if item['name'].nil?
nagios_host name do
options item
end
end
servicedependencies = nagios_bags.get(node['nagios']['servicedependencies_databag'])
servicedependencies.each do |item|
name = item['service_description'] || item['id']
nagios_servicedependency name do
options item
end
end
serviceescalations = nagios_bags.get(node['nagios']['serviceescalations_databag'])
serviceescalations.each do |item|
name = item['service_description'] || item['id']
nagios_serviceescalation name do
options item
end
end
servicegroups = nagios_bags.get(node['nagios']['servicegroups_databag'])
servicegroups.each do |item|
name = item['servicegroup_name'] || item['id']
nagios_servicegroup name do
options item
end
end
templates = nagios_bags.get(node['nagios']['templates_databag'])
templates.each do |item|
name = item['name'] || item['id']
item['name'] = name
nagios_service name do
options item
end
end
timeperiods = nagios_bags.get(node['nagios']['timeperiods_databag'])
timeperiods.each do |item|
name = item['timeperiod_name'] || item['id']
nagios_timeperiod name do
options item
end
end
unmanaged_hosts = nagios_bags.get(node['nagios']['unmanagedhosts_databag'])
unmanaged_hosts.each do |item|
if node['nagios']['multi_environment_monitoring'].nil?
next if item['environment'].nil? || item['environment'] != node.chef_environment
else
envs = node['nagios']['monitored_environments']
next if item['environment'].nil? || !envs.include?(item['environment'])
end
name = item['host_name'] || item['id']
nagios_host name do
options item
end
end
| schubergphilis/nagios | recipes/_load_databag_config.rb | Ruby | apache-2.0 | 4,709 | [
30522,
1001,
1001,
3166,
1024,
1024,
5472,
2121,
28516,
2386,
1026,
24829,
4140,
2386,
1030,
8040,
6979,
4059,
21850,
6856,
1012,
4012,
1028,
1001,
5660,
8654,
1024,
1024,
6583,
11411,
2015,
1001,
17974,
1024,
1024,
1035,
7170,
1035,
2951,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (C) 2000-2001 The Exult Team
*
* 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-1307, USA.
*/
#ifndef ASTAR_H
#define ASTAR_H
#include "PathFinder.h"
#include <vector>
class Astar: public virtual PathFinder
{
std::vector<Tile_coord> path; // Coords. to goal.
int pathlen; // Length of path.
int dir; // 1 or -1.
int stop; // Index to stop at.
int next_index; // Index of next tile to return.
public:
Astar() : PathFinder(),path(), pathlen(0), dir(0),stop(0),next_index(0)
{ }
// Find a path from sx,sy,sz to dx,dy,dz
// Return 0 if no path can be traced.
// Return !0 if path found
virtual int NewPath(Tile_coord s, Tile_coord d,
Pathfinder_client *client);
// Retrieve the coordinates of the next step on the path
virtual int GetNextStep(Tile_coord& n, bool& done);
// Set to retrieve in opposite order.
virtual int set_backwards();
virtual int following_smart_path() // Astar?
{ return 1; }
virtual int get_num_steps(); // # of steps left to take.
virtual ~Astar();
};
#endif
| twinaphex/sdcell | appport/exult/pathfinder/Astar.h | C | lgpl-2.1 | 1,708 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2456,
1011,
2541,
1996,
4654,
11314,
2136,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,
1008,
2009,
2104,
1996,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
'use strict';
module.exports = function(grunt) {
// Please see the Grunt documentation for more information regarding task
// creation: http://gruntjs.com/creating-tasks
function random(min, max) {
min = min || 0;
max = max || 1;
var result;
if(min === 0 && max === 1) {
result = Math.random();
} else {
result = Math.floor((Math.random() * max) + min);
}
return result;
}
grunt.registerMultiTask('random', 'Your task description goes here.', function() {
// Merge task-specific and/or target-specific options with these defaults.
var options = this.options({min:0,max:1});
grunt.log.writeln('Random: ' + random(options.min, options.max));
});
}; | doowb/lessbuilder | tasks/random.js | JavaScript | mit | 744 | [
30522,
1005,
2224,
9384,
1005,
1025,
11336,
1012,
14338,
1027,
3853,
1006,
20696,
1007,
1063,
1013,
1013,
3531,
2156,
1996,
20696,
12653,
2005,
2062,
2592,
4953,
4708,
1013,
1013,
4325,
1024,
8299,
1024,
1013,
1013,
20696,
22578,
1012,
4012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
$(window).load(function(){FusionCharts.ready(function () {
var cnstrctnPlan = new FusionCharts({
type: 'gantt',
renderAt: 'chart-container',
width: '750',
height: '500',
dataFormat: 'json',
dataSource: {
"chart": {
"caption": "Construction management of a new store in Denver",
"subcaption": "Planned vs Actual",
"dateformat": "dd/mm/yyyy",
"outputdateformat": "ddds mns yy",
"ganttwidthpercent": "60",
"ganttPaneDuration": "40",
"ganttPaneDurationUnit": "d",
"plottooltext": "$processName{br} $label starting date $start{br}$label ending date $end",
"legendBorderAlpha": "0",
"legendShadow": "0",
"usePlotGradientColor": "0",
"showCanvasBorder": "0",
"flatScrollBars": "1",
"gridbordercolor": "#333333",
"gridborderalpha": "20",
"slackFillColor": "#e44a00",
"taskBarFillMix": "light+0"
},
"categories": [
{
"bgcolor": "#999999",
"category": [
{
"start": "1/4/2014",
"end": "30/6/2014",
"label": "Months",
"align": "middle",
"fontcolor": "#ffffff",
"fontsize": "12"
}
]
},
{
"bgcolor": "#999999",
"align": "middle",
"fontcolor": "#ffffff",
"fontsize": "12",
"category": [
{
"start": "1/4/2014",
"end": "30/4/2014",
"label": "April"
},
{
"start": "1/5/2014",
"end": "31/5/2014",
"label": "May"
},
{
"start": "1/6/2014",
"end": "30/6/2014",
"label": "June"
}
]
},
{
"bgcolor": "#ffffff",
"fontcolor": "#333333",
"fontsize": "11",
"align": "center",
"category": [
{
"start": "1/4/2014",
"end": "5/4/2014",
"label": "Week 1"
},
{
"start": "6/4/2014",
"end": "12/4/2014",
"label": "Week 2"
},
{
"start": "13/4/2014",
"end": "19/4/2014",
"label": "Week 3"
},
{
"start": "20/4/2014",
"end": "26/4/2014",
"label": "Week 4"
},
{
"start": "27/4/2014",
"end": "3/5/2014",
"label": "Week 5"
},
{
"start": "4/5/2014",
"end": "10/5/2014",
"label": "Week 6"
},
{
"start": "11/5/2014",
"end": "17/5/2014",
"label": "Week 7"
},
{
"start": "18/5/2014",
"end": "24/5/2014",
"label": "Week 8"
},
{
"start": "25/5/2014",
"end": "31/5/2014",
"label": "Week 9"
},
{
"start": "1/6/2014",
"end": "7/6/2014",
"label": "Week 10"
},
{
"start": "8/6/2014",
"end": "14/6/2014",
"label": "Week 11"
},
{
"start": "15/6/2014",
"end": "21/6/2014",
"label": "Week 12"
},
{
"start": "22/6/2014",
"end": "28/6/2014",
"label": "Week 13"
}
]
}
],
"processes": {
"headertext": "Task",
"fontcolor": "#000000",
"fontsize": "11",
"isanimated": "1",
"bgcolor": "#6baa01",
"headervalign": "bottom",
"headeralign": "left",
"headerbgcolor": "#999999",
"headerfontcolor": "#ffffff",
"headerfontsize": "12",
"align": "left",
"isbold": "1",
"bgalpha": "25",
"process": [
{
"label": "Clear site",
"id": "1"
},
{
"label": "Excavate Foundation",
"id": "2",
"hoverBandColor": "#e44a00",
"hoverBandAlpha": "40"
},
{
"label": "Concrete Foundation",
"id": "3",
"hoverBandColor": "#e44a00",
"hoverBandAlpha": "40"
},
{
"label": "Footing to DPC",
"id": "4",
"hoverBandColor": "#e44a00",
"hoverBandAlpha": "40"
},
{
"label": "Drainage Services",
"id": "5",
"hoverBandColor": "#e44a00",
"hoverBandAlpha": "40"
},
{
"label": "Backfill",
"id": "6",
"hoverBandColor": "#e44a00",
"hoverBandAlpha": "40"
},
{
"label": "Ground Floor",
"id": "7"
},
{
"label": "Walls on First Floor",
"id": "8"
},
{
"label": "First Floor Carcass",
"id": "9",
"hoverBandColor": "#e44a00",
"hoverBandAlpha": "40"
},
{
"label": "First Floor Deck",
"id": "10",
"hoverBandColor": "#e44a00",
"hoverBandAlpha": "40"
},
{
"label": "Roof Structure",
"id": "11"
},
{
"label": "Roof Covering",
"id": "12"
},
{
"label": "Rainwater Gear",
"id": "13"
},
{
"label": "Windows",
"id": "14"
},
{
"label": "External Doors",
"id": "15"
},
{
"label": "Connect Electricity",
"id": "16"
},
{
"label": "Connect Water Supply",
"id": "17",
"hoverBandColor": "#e44a00",
"hoverBandAlpha": "40"
},
{
"label": "Install Air Conditioning",
"id": "18",
"hoverBandColor": "#e44a00",
"hoverBandAlpha": "40"
},
{
"label": "Interior Decoration",
"id": "19",
"hoverBandColor": "#e44a00",
"hoverBandAlpha": "40"
},
{
"label": "Fencing And signs",
"id": "20"
},
{
"label": "Exterior Decoration",
"id": "21",
"hoverBandColor": "#e44a00",
"hoverBandAlpha": "40"
},
{
"label": "Setup racks",
"id": "22"
}
]
},
"datatable": {
"showprocessname": "1",
"namealign": "left",
"fontcolor": "#000000",
"fontsize": "10",
"valign": "right",
"align": "center",
"headervalign": "bottom",
"headeralign": "center",
"headerbgcolor": "#999999",
"headerfontcolor": "#ffffff",
"headerfontsize": "12",
"datacolumn": [
{
"bgcolor": "#eeeeee",
"headertext": "Actual{br}Start{br}Date",
"text": [
{
"label": "9/4/2014"
},
{
"label": "13/4/2014"
},
{
"label": "26/4/2014",
"bgcolor": "#e44a00",
"bgAlpha": "40",
},
{
"label": "4/5/2014",
"bgcolor": "#e44a00",
"bgAlpha": "40"
},
{
"label": "6/5/2014"
},
{
"label": "5/5/2014",
"bgcolor": "#e44a00",
"bgAlpha": "40"
},
{
"label": "11/5/2014"
},
{
"label": "16/5/2014"
},
{
"label": "16/5/2014"
},
{
"label": "21/5/2014",
"bgcolor": "#e44a00",
"bgAlpha": "40"
},
{
"label": "25/5/2014"
},
{
"label": "28/5/2014"
},
{
"label": "4/6/2014"
},
{
"label": "4/6/2014"
},
{
"label": "4/6/2014"
},
{
"label": "2/6/2014"
},
{
"label": "5/6/2014"
},
{
"label": "18/6/2014",
"bgcolor": "#e44a00",
"bgAlpha": "40"
},
{
"label": "16/6/2014",
"bgcolor": "#e44a00",
"bgAlpha": "40"
},
{
"label": "23/6/2014"
},
{
"label": "18/6/2014"
},
{
"label": "25/6/2014"
}
]
},
{
"bgcolor": "#eeeeee",
"headertext": "Actual{br}End{br}Date",
"text": [
{
"label": "12/4/2014"
},
{
"label": "25/4/2014",
"bgcolor": "#e44a00",
"bgAlpha": "40"
},
{
"label": "4/5/2014",
"bgcolor": "#e44a00",
"bgAlpha": "40"
},
{
"label": "10/5/2014"
},
{
"label": "10/5/2014"
},
{
"label": "11/5/2014",
"bgcolor": "#e44a00",
"bgAlpha": "40"
},
{
"label": "14/5/2014"
},
{
"label": "19/5/2014"
},
{
"label": "21/5/2014",
"bgcolor": "#e44a00",
"bgAlpha": "40"
},
{
"label": "24/5/2014",
"bgcolor": "#e44a00",
"bgAlpha": "40"
},
{
"label": "27/5/2014"
},
{
"label": "1/6/2014"
},
{
"label": "6/6/2014"
},
{
"label": "4/6/2014"
},
{
"label": "4/6/2014"
},
{
"label": "7/6/2014"
},
{
"label": "17/6/2014",
"bgcolor": "#e44a00",
"bgAlpha": "40"
},
{
"label": "20/6/2014",
"bgcolor": "#e44a00",
"bgAlpha": "40"
},
{
"label": "23/6/2014"
},
{
"label": "23/6/2014"
},
{
"label": "23/6/2014",
"bgcolor": "#e44a00",
"bgAlpha": "40"
},
{
"label": "28/6/2014"
}
]
}
]
},
"tasks": {
"task": [
{
"label": "Planned",
"processid": "1",
"start": "9/4/2014",
"end": "12/4/2014",
"id": "1-1",
"color": "#008ee4",
"height": "32%",
"toppadding": "12%"
},
{
"label": "Actual",
"processid": "1",
"start": "9/4/2014",
"end": "12/4/2014",
"id": "1",
"color": "#6baa01",
"toppadding": "56%",
"height": "32%"
},
{
"label": "Planned",
"processid": "2",
"start": "13/4/2014",
"end": "23/4/2014",
"id": "2-1",
"color": "#008ee4",
"height": "32%",
"toppadding": "12%"
},
{
"label": "Actual",
"processid": "2",
"start": "13/4/2014",
"end": "25/4/2014",
"id": "2",
"color": "#6baa01",
"toppadding": "56%",
"height": "32%"
},
{
"label": "Delay",
"processid": "2",
"start": "23/4/2014",
"end": "25/4/2014",
"id": "2-2",
"color": "#e44a00",
"toppadding": "56%",
"height": "32%",
"tooltext": "Delayed by 2 days."
},
{
"label": "Planned",
"processid": "3",
"start": "23/4/2014",
"end": "30/4/2014",
"id": "3-1",
"color": "#008ee4",
"height": "32%",
"toppadding": "12%"
},
{
"label": "Actual",
"processid": "3",
"start": "26/4/2014",
"end": "4/5/2014",
"id": "3",
"color": "#6baa01",
"toppadding": "56%",
"height": "32%"
},
{
"label": "Delay",
"processid": "3",
"start": "3/5/2014",
"end": "4/5/2014",
"id": "3-2",
"color": "#e44a00",
"toppadding": "56%",
"height": "32%",
"tooltext": "Delayed by 1 days."
},
{
"label": "Planned",
"processid": "4",
"start": "3/5/2014",
"end": "10/5/2014",
"id": "4-1",
"color": "#008ee4",
"height": "32%",
"toppadding": "12%"
},
{
"label": "Actual",
"processid": "4",
"start": "4/5/2014",
"end": "10/5/2014",
"id": "4",
"color": "#6baa01",
"toppadding": "56%",
"height": "32%"
},
{
"label": "Planned",
"processid": "5",
"start": "6/5/2014",
"end": "11/5/2014",
"id": "5-1",
"color": "#008ee4",
"height": "32%",
"toppadding": "12%"
},
{
"label": "Actual",
"processid": "5",
"start": "6/5/2014",
"end": "10/5/2014",
"id": "5",
"color": "#6baa01",
"toppadding": "56%",
"height": "32%"
},
{
"label": "Planned",
"processid": "6",
"start": "4/5/2014",
"end": "7/5/2014",
"id": "6-1",
"color": "#008ee4",
"height": "32%",
"toppadding": "12%"
},
{
"label": "Actual",
"processid": "6",
"start": "5/5/2014",
"end": "11/5/2014",
"id": "6",
"color": "#6baa01",
"toppadding": "56%",
"height": "32%"
},
{
"label": "Delay",
"processid": "6",
"start": "7/5/2014",
"end": "11/5/2014",
"id": "6-2",
"color": "#e44a00",
"toppadding": "56%",
"height": "32%",
"tooltext": "Delayed by 4 days."
},
{
"label": "Planned",
"processid": "7",
"start": "11/5/2014",
"end": "14/5/2014",
"id": "7-1",
"color": "#008ee4",
"height": "32%",
"toppadding": "12%"
},
{
"label": "Actual",
"processid": "7",
"start": "11/5/2014",
"end": "14/5/2014",
"id": "7",
"color": "#6baa01",
"toppadding": "56%",
"height": "32%"
},
{
"label": "Planned",
"processid": "8",
"start": "16/5/2014",
"end": "19/5/2014",
"id": "8-1",
"color": "#008ee4",
"height": "32%",
"toppadding": "12%"
},
{
"label": "Actual",
"processid": "8",
"start": "16/5/2014",
"end": "19/5/2014",
"id": "8",
"color": "#6baa01",
"toppadding": "56%",
"height": "32%"
},
{
"label": "Planned",
"processid": "9",
"start": "16/5/2014",
"end": "18/5/2014",
"id": "9-1",
"color": "#008ee4",
"height": "32%",
"toppadding": "12%"
},
{
"label": "Actual",
"processid": "9",
"start": "16/5/2014",
"end": "21/5/2014",
"id": "9",
"color": "#6baa01",
"toppadding": "56%",
"height": "32%"
},
{
"label": "Delay",
"processid": "9",
"start": "18/5/2014",
"end": "21/5/2014",
"id": "9-2",
"color": "#e44a00",
"toppadding": "56%",
"height": "32%",
"tooltext": "Delayed by 3 days."
},
{
"label": "Planned",
"processid": "10",
"start": "20/5/2014",
"end": "23/5/2014",
"id": "10-1",
"color": "#008ee4",
"height": "32%",
"toppadding": "12%"
},
{
"label": "Actual",
"processid": "10",
"start": "21/5/2014",
"end": "24/5/2014",
"id": "10",
"color": "#6baa01",
"toppadding": "56%",
"height": "32%"
},
{
"label": "Delay",
"processid": "10",
"start": "23/5/2014",
"end": "24/5/2014",
"id": "10-2",
"color": "#e44a00",
"toppadding": "56%",
"height": "32%",
"tooltext": "Delayed by 1 days."
},
{
"label": "Planned",
"processid": "11",
"start": "25/5/2014",
"end": "27/5/2014",
"id": "11-1",
"color": "#008ee4",
"height": "32%",
"toppadding": "12%"
},
{
"label": "Actual",
"processid": "11",
"start": "25/5/2014",
"end": "27/5/2014",
"id": "11",
"color": "#6baa01",
"toppadding": "56%",
"height": "32%"
},
{
"label": "Planned",
"processid": "12",
"start": "28/5/2014",
"end": "1/6/2014",
"id": "12-1",
"color": "#008ee4",
"height": "32%",
"toppadding": "12%"
},
{
"label": "Actual",
"processid": "12",
"start": "28/5/2014",
"end": "1/6/2014",
"id": "12",
"color": "#6baa01",
"toppadding": "56%",
"height": "32%"
},
{
"label": "Planned",
"processid": "13",
"start": "4/6/2014",
"end": "6/6/2014",
"id": "13-1",
"color": "#008ee4",
"height": "32%",
"toppadding": "12%"
},
{
"label": "Actual",
"processid": "13",
"start": "4/6/2014",
"end": "6/6/2014",
"id": "13",
"color": "#6baa01",
"toppadding": "56%",
"height": "32%"
},
{
"label": "Planned",
"processid": "14",
"start": "4/6/2014",
"end": "4/6/2014",
"id": "14-1",
"color": "#008ee4",
"height": "32%",
"toppadding": "12%"
},
{
"label": "Actual",
"processid": "14",
"start": "4/6/2014",
"end": "4/6/2014",
"id": "14",
"color": "#6baa01",
"toppadding": "56%",
"height": "32%"
},
{
"label": "Planned",
"processid": "15",
"start": "4/6/2014",
"end": "4/6/2014",
"id": "15-1",
"color": "#008ee4",
"height": "32%",
"toppadding": "12%"
},
{
"label": "Actual",
"processid": "15",
"start": "4/6/2014",
"end": "4/6/2014",
"id": "15",
"color": "#6baa01",
"toppadding": "56%",
"height": "32%"
},
{
"label": "Planned",
"processid": "16",
"start": "2/6/2014",
"end": "7/6/2014",
"id": "16-1",
"color": "#008ee4",
"height": "32%",
"toppadding": "12%"
},
{
"label": "Actual",
"processid": "16",
"start": "2/6/2014",
"end": "7/6/2014",
"id": "16",
"color": "#6baa01",
"toppadding": "56%",
"height": "32%"
},
{
"label": "Planned",
"processid": "17",
"start": "5/6/2014",
"end": "10/6/2014",
"id": "17-1",
"color": "#008ee4",
"height": "32%",
"toppadding": "12%"
},
{
"label": "Actual",
"processid": "17",
"start": "5/6/2014",
"end": "17/6/2014",
"id": "17",
"color": "#6baa01",
"toppadding": "56%",
"height": "32%"
},
{
"label": "Delay",
"processid": "17",
"start": "10/6/2014",
"end": "17/6/2014",
"id": "17-2",
"color": "#e44a00",
"toppadding": "56%",
"height": "32%",
"tooltext": "Delayed by 7 days."
},
{
"label": "Planned",
"processid": "18",
"start": "10/6/2014",
"end": "12/6/2014",
"id": "18-1",
"color": "#008ee4",
"height": "32%",
"toppadding": "12%"
},
{
"label": "Delay",
"processid": "18",
"start": "18/6/2014",
"end": "20/6/2014",
"id": "18",
"color": "#e44a00",
"toppadding": "56%",
"height": "32%",
"tooltext": "Delayed by 8 days."
},
{
"label": "Planned",
"processid": "19",
"start": "15/6/2014",
"end": "23/6/2014",
"id": "19-1",
"color": "#008ee4",
"height": "32%",
"toppadding": "12%"
},
{
"label": "Actual",
"processid": "19",
"start": "16/6/2014",
"end": "23/6/2014",
"id": "19",
"color": "#6baa01",
"toppadding": "56%",
"height": "32%"
},
{
"label": "Planned",
"processid": "20",
"start": "23/6/2014",
"end": "23/6/2014",
"id": "20-1",
"color": "#008ee4",
"height": "32%",
"toppadding": "12%"
},
{
"label": "Actual",
"processid": "20",
"start": "23/6/2014",
"end": "23/6/2014",
"id": "20",
"color": "#6baa01",
"toppadding": "56%",
"height": "32%"
},
{
"label": "Planned",
"processid": "21",
"start": "18/6/2014",
"end": "21/6/2014",
"id": "21-1",
"color": "#008ee4",
"height": "32%",
"toppadding": "12%"
},
{
"label": "Actual",
"processid": "21",
"start": "18/6/2014",
"end": "23/6/2014",
"id": "21",
"color": "#6baa01",
"toppadding": "56%",
"height": "32%"
},
{
"label": "Delay",
"processid": "21",
"start": "21/6/2014",
"end": "23/6/2014",
"id": "21-2",
"color": "#e44a00",
"toppadding": "56%",
"height": "32%",
"tooltext": "Delayed by 2 days."
},
{
"label": "Planned",
"processid": "22",
"start": "24/6/2014",
"end": "28/6/2014",
"id": "22-1",
"color": "#008ee4",
"height": "32%",
"toppadding": "12%"
},
{
"label": "Actual",
"processid": "22",
"start": "25/6/2014",
"end": "28/6/2014",
"id": "22",
"color": "#6baa01",
"toppadding": "56%",
"height": "32%"
}
]
},
"connectors": [
{
"connector": [
{
"fromtaskid": "1",
"totaskid": "2",
"color": "#008ee4",
"thickness": "2",
"fromtaskconnectstart_": "1"
},
{
"fromtaskid": "2-2",
"totaskid": "3",
"color": "#008ee4",
"thickness": "2"
},
{
"fromtaskid": "3-2",
"totaskid": "4",
"color": "#008ee4",
"thickness": "2"
},
{
"fromtaskid": "3-2",
"totaskid": "6",
"color": "#008ee4",
"thickness": "2"
},
{
"fromtaskid": "7",
"totaskid": "8",
"color": "#008ee4",
"thickness": "2"
},
{
"fromtaskid": "7",
"totaskid": "9",
"color": "#008ee4",
"thickness": "2"
},
{
"fromtaskid": "12",
"totaskid": "16",
"color": "#008ee4",
"thickness": "2"
},
{
"fromtaskid": "12",
"totaskid": "17",
"color": "#008ee4",
"thickness": "2"
},
{
"fromtaskid": "17-2",
"totaskid": "18",
"color": "#008ee4",
"thickness": "2"
},
{
"fromtaskid": "19",
"totaskid": "22",
"color": "#008ee4",
"thickness": "2"
}
]
}
],
"milestones": {
"milestone": [
{
"date": "2/6/2014",
"taskid": "12",
"color": "#f8bd19",
"shape": "star",
"tooltext": "Completion of Phase 1"
}
/*{
"date": "21/8/2008",
"taskid": "10",
"color": "#f8bd19",
"shape": "star",
"tooltext": "New estimated moving date"
}*/
]
},
"legend": {
"item": [
{
"label": "Planned",
"color": "#008ee4"
},
{
"label": "Actual",
"color": "#6baa01"
},
{
"label": "Slack (Delay)",
"color": "#e44a00"
}
]
}
}
})
.render();
});}); | sguha-work/fiddletest | fiddles/Chart/Gantt-Chart/A-sample-Gantt-chart-_45/demo.js | JavaScript | gpl-2.0 | 42,182 | [
30522,
1002,
1006,
3332,
1007,
1012,
7170,
1006,
3853,
1006,
1007,
1063,
10077,
7507,
21217,
1012,
3201,
1006,
3853,
1006,
1007,
1063,
13075,
27166,
3367,
11890,
2102,
16275,
5802,
1027,
2047,
10077,
7507,
21217,
1006,
1063,
2828,
1024,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// generated from ldml/main/*.xml, xpath: ldml/numbers
({
'decimal':",",
'group':".",
'list':";",
'percentSign':"%",
'nativeZeroDigit':"0",
'patternDigit':"#",
'plusSign':"+",
'minusSign':"-",
'exponential':"E",
'perMille':"‰",
'infinity':"∞",
'nan':"NaN",
'decimalFormat':"#,##0.###",
'scientificFormat':"#E0",
'percentFormat':"% #,##0",
'currencyFormat':"#,##0.00 ¤"
})
| ozoneplatform/owf-framework | web-app/js-lib/dojo-release-1.5.0-src/dojo/cldr/nls/tr/number.js | JavaScript | apache-2.0 | 395 | [
30522,
1013,
1013,
7013,
2013,
25510,
19968,
1013,
2364,
1013,
1008,
1012,
20950,
1010,
26726,
8988,
1024,
25510,
19968,
1013,
3616,
1006,
1063,
1005,
26066,
1005,
1024,
1000,
1010,
1000,
1010,
1005,
2177,
1005,
1024,
1000,
1012,
1000,
1010... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.ityang.leetcode;
public class Subject8 {
public static void main(String[] args) {
System.out.println(myAtoi("1"));
}
public static int myAtoi(String str) {
double result = 0;
int POrN = 1;
int count = 0;
char[] charArr = str.toCharArray();
for(char c:charArr){
count ++;
if( c >='0' && c <='9' ){
result *= 10;
result += ( c - '0');
}else if( c == '-' && count == 1){
POrN = -1;
}else if( c == '+' && count == 1){
POrN = 1;
}else if( c == ' ' && count == 1){
count --;
}else{
break;
}
}
if( result > Integer.MAX_VALUE ){
if(POrN == 1)
return Integer.MAX_VALUE;
else
return Integer.MIN_VALUE;
}else{
return (int)(result * POrN);
}
}
}
| itYangJie/leetcode | src/com/ityang/leetcode/Subject8.java | Java | apache-2.0 | 987 | [
30522,
7427,
4012,
1012,
2009,
12198,
1012,
3389,
13535,
10244,
1025,
2270,
2465,
3395,
2620,
1063,
2270,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
1063,
2291,
1012,
2041,
1012,
6140,
19666,
1006,
2026,
10610,
2072,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#ifndef __LWP_MUTEX_H__
#define __LWP_MUTEX_H__
#include <gctypes.h>
#include <lwp_threadq.h>
#define LWP_MUTEX_LOCKED 0
#define LWP_MUTEX_UNLOCKED 1
#define LWP_MUTEX_NEST_ACQUIRE 0
#define LWP_MUTEX_NEST_ERROR 1
#define LWP_MUTEX_NEST_BLOCK 2
#define LWP_MUTEX_FIFO 0
#define LWP_MUTEX_PRIORITY 1
#define LWP_MUTEX_INHERITPRIO 2
#define LWP_MUTEX_PRIORITYCEIL 3
#define LWP_MUTEX_SUCCESSFUL 0
#define LWP_MUTEX_UNSATISFIED_NOWAIT 1
#define LWP_MUTEX_NEST_NOTALLOWED 2
#define LWP_MUTEX_NOTOWNER 3
#define LWP_MUTEX_DELETED 4
#define LWP_MUTEX_TIMEOUT 5
#define LWP_MUTEX_CEILINGVIOL 6
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _lwpmutexattr {
u32 mode;
u32 nest_behavior;
u8 prioceil,onlyownerrelease;
} lwp_mutex_attr;
typedef struct _lwpmutex {
lwp_thrqueue wait_queue;
lwp_mutex_attr atrrs;
u32 lock,nest_cnt,blocked_cnt;
lwp_cntrl *holder;
} lwp_mutex;
void __lwp_mutex_initialize(lwp_mutex *mutex,lwp_mutex_attr *attrs,u32 init_lock);
u32 __lwp_mutex_surrender(lwp_mutex *mutex);
void __lwp_mutex_seize_irq_blocking(lwp_mutex *mutex,u64 timeout);
void __lwp_mutex_flush(lwp_mutex *mutex,u32 status);
static __inline__ u32 __lwp_mutex_seize_irq_trylock(lwp_mutex *mutex,u32 *isr_level);
#define __lwp_mutex_seize(_mutex_t,_id,_wait,_timeout,_level) \
do { \
if(__lwp_mutex_seize_irq_trylock(_mutex_t,&_level)) { \
if(!_wait) { \
_CPU_ISR_Restore(_level); \
_thr_executing->wait.ret_code = LWP_MUTEX_UNSATISFIED_NOWAIT; \
} else { \
__lwp_threadqueue_csenter(&(_mutex_t)->wait_queue); \
_thr_executing->wait.queue = &(_mutex_t)->wait_queue; \
_thr_executing->wait.id = _id; \
__lwp_thread_dispatchdisable(); \
_CPU_ISR_Restore(_level); \
__lwp_mutex_seize_irq_blocking(_mutex_t,(u64)_timeout); \
} \
} \
} while(0)
#ifdef LIBOGC_INTERNAL
#include <libogc/lwp_mutex.inl>
#endif
#ifdef __cplusplus
}
#endif
#endif
| Monroe88/RetroArch | wii/libogc/include/ogc/lwp_mutex.h | C | gpl-3.0 | 1,935 | [
30522,
1001,
2065,
13629,
2546,
1035,
1035,
1048,
2860,
2361,
1035,
20101,
2595,
1035,
1044,
1035,
1035,
1001,
9375,
1035,
1035,
1048,
2860,
2361,
1035,
20101,
2595,
1035,
1044,
1035,
1035,
1001,
2421,
1026,
1043,
6593,
18863,
2015,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\TestModuleMSC\Model;
use Magento\TestModuleMSC\Api\Data\CustomAttributeDataObjectInterfaceFactory;
use Magento\TestModuleMSC\Api\Data\ItemInterfaceFactory;
class AllSoapAndRest implements \Magento\TestModuleMSC\Api\AllSoapAndRestInterface
{
/**
* @var ItemInterfaceFactory
*/
protected $itemDataFactory;
/**
* @var CustomAttributeDataObjectInterfaceFactory
*/
protected $customAttributeDataObjectDataFactory;
/**
* @param ItemInterfaceFactory $itemDataFactory
* @param CustomAttributeDataObjectInterfaceFactory $customAttributeNestedDataObjectFactory
*/
public function __construct(
ItemInterfaceFactory $itemDataFactory,
CustomAttributeDataObjectInterfaceFactory $customAttributeNestedDataObjectFactory
) {
$this->itemDataFactory = $itemDataFactory;
$this->customAttributeDataObjectDataFactory = $customAttributeNestedDataObjectFactory;
}
/**
* {@inheritdoc}
*/
public function item($itemId)
{
return $this->itemDataFactory->create()->setItemId($itemId)->setName('testProduct1');
}
/**
* {@inheritdoc}
*/
public function items()
{
$result1 = $this->itemDataFactory->create()->setItemId(1)->setName('testProduct1');
$result2 = $this->itemDataFactory->create()->setItemId(2)->setName('testProduct2');
return [$result1, $result2];
}
/**
* {@inheritdoc}
*/
public function create($name)
{
return $this->itemDataFactory->create()->setItemId(rand())->setName($name);
}
/**
* {@inheritdoc}
*/
public function update(\Magento\TestModuleMSC\Api\Data\ItemInterface $entityItem)
{
return $this->itemDataFactory->create()->setItemId($entityItem->getItemId())
->setName('Updated' . $entityItem->getName());
}
public function testOptionalParam($name = null)
{
if ($name === null) {
return $this->itemDataFactory->create()->setItemId(3)->setName('No Name');
} else {
return $this->itemDataFactory->create()->setItemId(3)->setName($name);
}
}
/**
* {@inheritdoc}
*/
public function itemAnyType(\Magento\TestModuleMSC\Api\Data\ItemInterface $entityItem)
{
return $entityItem;
}
/**
* {@inheritdoc}
*/
public function getPreconfiguredItem()
{
$customAttributeDataObject = $this->customAttributeDataObjectDataFactory->create()
->setName('nameValue')
->setCustomAttribute('custom_attribute_int', 1);
$item = $this->itemDataFactory->create()
->setItemId(1)
->setName('testProductAnyType')
->setCustomAttribute('custom_attribute_data_object', $customAttributeDataObject)
->setCustomAttribute('custom_attribute_string', 'someStringValue');
return $item;
}
}
| j-froehlich/magento2_wk | vendor/magento/magento2-base/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/AllSoapAndRest.php | PHP | mit | 3,062 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
9385,
1075,
2286,
1011,
2418,
17454,
13663,
1010,
4297,
1012,
2035,
2916,
9235,
1012,
1008,
2156,
24731,
1012,
30524,
7661,
19321,
3089,
8569,
3064,
6790,
16429,
20614,
18447,
2121,
12172,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#ifndef MSP3400_DRIVER_H
#define MSP3400_DRIVER_H
#include <media/msp3400.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ctrls.h>
#define MSP_CARRIER(freq) ((int)((float)(freq / 18.432) * (1 << 24)))
#define MSP_MODE_AM_DETECT 0
#define MSP_MODE_FM_RADIO 2
#define MSP_MODE_FM_TERRA 3
#define MSP_MODE_FM_SAT 4
#define MSP_MODE_FM_NICAM1 5
#define MSP_MODE_FM_NICAM2 6
#define MSP_MODE_AM_NICAM 7
#define MSP_MODE_BTSC 8
#define MSP_MODE_EXTERN 9
#define SCART_IN1 0
#define SCART_IN2 1
#define SCART_IN3 2
#define SCART_IN4 3
#define SCART_IN1_DA 4
#define SCART_IN2_DA 5
#define SCART_MONO 6
#define SCART_MUTE 7
#define SCART_DSP_IN 0
#define SCART1_OUT 1
#define SCART2_OUT 2
#define OPMODE_AUTO -1
#define OPMODE_MANUAL 0
#define OPMODE_AUTODETECT 1
#define OPMODE_AUTOSELECT 2
extern int msp_debug;
extern bool msp_once;
extern bool msp_amsound;
extern int msp_standard;
extern bool msp_dolby;
extern int msp_stereo_thresh;
struct msp_state {
struct v4l2_subdev sd;
struct v4l2_ctrl_handler hdl;
int rev1, rev2;
int ident;
u8 has_nicam;
u8 has_radio;
u8 has_headphones;
u8 has_ntsc_jp_d_k3;
u8 has_scart2;
u8 has_scart3;
u8 has_scart4;
u8 has_scart2_out;
u8 has_scart2_out_volume;
u8 has_i2s_conf;
u8 has_subwoofer;
u8 has_sound_processing;
u8 has_virtual_dolby_surround;
u8 has_dolby_pro_logic;
u8 force_btsc;
int radio;
int opmode;
int std;
int mode;
v4l2_std_id v4l2_std, detected_std;
int nicam_on;
int acb;
int in_scart;
int i2s_mode;
int main, second;
int input;
u32 route_in;
u32 route_out;
int audmode;
int rxsubchans;
struct {
struct v4l2_ctrl *volume;
struct v4l2_ctrl *muted;
};
int scan_in_progress;
struct task_struct *kthread;
wait_queue_head_t wq;
unsigned int restart:1;
unsigned int watch_stereo:1;
};
static inline struct msp_state *to_state(struct v4l2_subdev *sd)
{
return container_of(sd, struct msp_state, sd);
}
static inline struct msp_state *ctrl_to_state(struct v4l2_ctrl *ctrl)
{
return container_of(ctrl->handler, struct msp_state, hdl);
}
int msp_write_dem(struct i2c_client *client, int addr, int val);
int msp_write_dsp(struct i2c_client *client, int addr, int val);
int msp_read_dem(struct i2c_client *client, int addr);
int msp_read_dsp(struct i2c_client *client, int addr);
int msp_reset(struct i2c_client *client);
void msp_set_scart(struct i2c_client *client, int in, int out);
void msp_update_volume(struct msp_state *state);
int msp_sleep(struct msp_state *state, int timeout);
const char *msp_standard_std_name(int std);
void msp_set_audmode(struct i2c_client *client);
int msp_detect_stereo(struct i2c_client *client);
int msp3400c_thread(void *data);
int msp3410d_thread(void *data);
int msp34xxg_thread(void *data);
void msp3400c_set_mode(struct i2c_client *client, int mode);
void msp3400c_set_carrier(struct i2c_client *client, int cdo1, int cdo2);
#endif
| Evervolv/android_kernel_htc_msm8974 | drivers/media/video/msp3400-driver.h | C | gpl-2.0 | 2,993 | [
30522,
1001,
2065,
13629,
2546,
5796,
2361,
22022,
8889,
1035,
4062,
1035,
1044,
1001,
9375,
5796,
2361,
22022,
8889,
1035,
4062,
1035,
1044,
1001,
2421,
1026,
2865,
1013,
5796,
2361,
22022,
8889,
1012,
1044,
1028,
1001,
2421,
1026,
2865,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2021 ThoughtWorks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Stream from "mithril/stream";
import {Origin, OriginJSON} from "models/origin";
export interface EnvironmentAgentJSON {
uuid: string;
hostname: string;
origin: OriginJSON;
}
export class AgentWithOrigin {
uuid: Stream<string>;
hostname: Stream<string>;
readonly origin: Stream<Origin>;
constructor(uuid: string, hostname: string, origin: Origin) {
this.uuid = Stream(uuid);
this.hostname = Stream(hostname);
this.origin = Stream(origin);
}
static fromJSON(data: EnvironmentAgentJSON) {
return new AgentWithOrigin(data.uuid, data.hostname, Origin.fromJSON(data.origin));
}
clone() {
return new AgentWithOrigin(this.uuid(), this.hostname(), this.origin().clone());
}
}
export class Agents extends Array<AgentWithOrigin> {
constructor(...agents: AgentWithOrigin[]) {
super(...agents);
Object.setPrototypeOf(this, Object.create(Agents.prototype));
}
static fromJSON(agents: EnvironmentAgentJSON[]) {
if (agents) {
return new Agents(...agents.map(AgentWithOrigin.fromJSON));
} else {
return new Agents();
}
}
}
| GaneshSPatil/gocd | server/src/main/webapp/WEB-INF/rails/webpack/models/new-environments/environment_agents.ts | TypeScript | apache-2.0 | 1,713 | [
30522,
1013,
1008,
1008,
9385,
25682,
2245,
9316,
1010,
4297,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
30524,
1012,
1008,
2017,
2089,
6855,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Imports System.Collections.Generic
Public Enum DutyType
Undefined
Lekarska
Pielęgniarska
Other
End Enum
Public Class Duty
' Formating:
' f_ - form value
' d_ data base value
' other
'Public id_ As UInteger
Public d_id_ As Integer
Public f_id_ As Integer
Public f_date_ As Date
Public f_personel_id_ As Integer ' forgein key of <-> HospitalStaff.f_id_
Public f_has_duty_ As Boolean ' Optional value
Private table_name_ As String = "DUTY"
Private timeFormat_ As String = "yyyy-MM-dd"
Function IsInitialized() As Boolean
Return d_id_ > -1
End Function
Function Get_d_Id() As String
Return d_id_.ToString
End Function
Function Get_f_Id() As String
Return f_id_.ToString
End Function
Function Get_f_Date() As String
Return f_date_.ToString(timeFormat_)
End Function
Function Get_f_Personel_Id() As String
Return f_personel_id_.ToString
End Function
Function Get_Has_Duty() As String
Return f_has_duty_.ToString
End Function
Function Get_TableName() As String
Return table_name_
End Function
Private cQuote As String = Chr(34)
Function ValidateAndUpdate(
ByVal f_id As String,
ByVal f_date As String,
ByVal f_personel_id As String,
Optional ByVal f_has_duty As String = ""
) As Boolean
Dim f_id_local As Integer = -1
Dim f_date_local As Date
Dim f_personel_id_local As Integer = -1
Dim f_has_duty_local As Boolean = False
Dim validation_passed = True
Try
If f_id = String.Empty Then
f_id_local = -1
d_id_ = -1 ' IF Ward id was not set then the data shall be treated not initialized
Else
f_id_local = CInt(f_id)
End If
If f_date = String.Empty Then
f_date_local = Date.MinValue
Else
If Not Date.TryParse(f_date, f_date_local) Then
f_date_local = Date.MinValue
End If
End If
If f_personel_id = String.Empty Then
f_personel_id_local = -1
Else
f_personel_id_local = CInt(f_personel_id)
End If
If (f_has_duty = "1" Or f_has_duty = "True" Or f_has_duty = "true") Then
f_has_duty_local = True
End If
Catch ex As Exception
validation_passed = False
MsgBox("Hospital staff validation failed - wrong data " & ex.Message, MsgBoxStyle.Information)
'Toolbox.Log("Ward validation failed - wrong data " & ex.Message, MsgBoxStyle.Information)
End Try
If validation_passed Then
Update(f_id_local, f_date_local, f_personel_id_local, f_has_duty_local)
End If
Return validation_passed
End Function
Sub Update(
ByVal f_id As Integer,
ByVal f_date As Date,
ByVal f_personel_id As Integer,
ByVal f_has_duty As Boolean
)
f_id_ = f_id
f_date_ = f_date
f_personel_id_ = f_personel_id
f_has_duty_ = f_has_duty
End Sub
Sub Clear() ' Reset class fields
f_id_ = -1
f_date_ = Date.MinValue
f_personel_id_ = -1
f_has_duty_ = False
End Sub
' This Parse method and FormQuerry_Select must keep the same columns order
Function Parse(ByVal s As String) As Boolean
Dim d_id_local As String
Dim f_id_local As String
Dim f_date_local As String
Dim f_personel_id_local As String
Dim f_has_duty_local As String = "0"
Dim parts As String() = Toolbox.SplitString(s)
d_id_local = parts(0)
f_id_local = parts(1)
f_date_local = parts(2)
f_personel_id_local = parts(3)
f_has_duty_local = parts(4)
If Not f_has_duty_local = "1" Then ' Only "1" in database is accepted as "true" value.
f_has_duty_local = "0"
End If
ValidateAndUpdate(f_id_local, f_date_local, f_personel_id_local, f_has_duty_local)
d_id_ = CInt(d_id_local)
End Function
' This FormQuerry_Select method and Parse must keep the same columns order
Function FormQuerry_Select() As String
' THE DUTY QUERRY ORDER: | 0 | 1 | 2 | 3 | 4 |
' THE DUTY QUERRY ORDER: | ID | ID_DUTY | DATE | STAFF_ID | HAS_DUTY |
' THE DUTY QUERRY ORDER: | INTEGER PRIMARY KEY AUTOINCREMENT | INTEGER NOT NULL | DATE NOT NULL | INTEGER NOT NULL | BOOLEAN |
Dim querry As String = String.Empty
Dim date_condition As String = String.Empty
Dim personel_condition As String = String.Empty
querry = "SELECT ID, ID_DUTY, DATE, STAFF_ID, HAS_DUTY FROM DUTY"
If f_date_ > Date.MinValue Then
date_condition = " DATE = " + cQuote + f_date_.ToString(timeFormat_) + cQuote
End If
If f_personel_id_ > -1 Then
personel_condition = " STAFF_ID = " + f_personel_id_.ToString()
End If
' Search filtering over Duty Date and/or Personel ID. Use these fields for filtering only when defined.
If f_date_ > Date.MinValue Or f_personel_id_ > -1 Then
querry += " WHERE "
If f_date_ > Date.MinValue And f_personel_id_ > -1 Then
querry += date_condition + " AND " + personel_condition
End If
If f_date_ > Date.MinValue And f_personel_id_ = -1 Then
querry += date_condition
End If
If f_date_ = Date.MinValue And f_personel_id_ > -1 Then
querry += personel_condition
End If
End If
querry += ";"
Return querry
End Function
' This FormQuerry_Select method and Parse must keep the same columns order
' Defined in email 2017-07-06:
' data_przyjecia, data_wypisu, id_pacjenta, id_oddzialu
Function FormQuerry_SelectSpecialForExport() As String
' THE DUTY QUERRY ORDER: | 0 | 2 | 2 |
' THE DUTY QUERRY ORDER: | ID | STAFF_ID | DATE |
' THE DUTY QUERRY ORDER: | INTEGER PRIMARY KEY AUTOINCREMENT | INTEGER NOT NULL | DATE NOT NULL |
Dim querry As String = String.Empty
querry = "SELECT ID, STAFF_ID, STRFTIME('%Y-%m-%d',DATE) FROM DUTY"
querry += ";"
Return querry
End Function
' This FormQuerry_Select method and Parse must keep the same columns order
' Defined in email 2017-09-19:
' (id_personelu, data) + and data base id.
Function FormQuerry_SelectSpecialForExport_Header() As String
Dim header As String = String.Empty
header = "id_wpisu;id_personelu;data_dyżuru;"
Return header
End Function
Public Function FormQuerry_Insert() As String
Dim querry As String = String.Empty
Dim has_duty_sql_string = "0"
If f_has_duty_ = True Then
has_duty_sql_string = "1"
End If
querry = "INSERT INTO DUTY (ID_DUTY, DATE, STAFF_ID, HAS_DUTY) VALUES (" +
f_id_.ToString & "," &
cQuote & f_date_.ToString(timeFormat_) & cQuote & "," &
f_personel_id_.ToString & "," &
has_duty_sql_string &
");"
Return querry
End Function
Function FormQuerry_Update() As String ' Same as Update
Dim querry As String = String.Empty
' Utworzenie querry
' TODO: Complete that
' "Type=" & quote & DutyType.ToString() & quote & ", " &
Dim has_duty_sql_string = "0"
If f_has_duty_ = True Then
has_duty_sql_string = "1"
End If
querry = "UPDATE DUTY SET " &
" ID_DUTY = " & f_id_.ToString() & ", " &
" DATE = " & cQuote & f_date_.ToString(timeFormat_) & cQuote & ", " &
" STAFF_ID = " & f_personel_id_.ToString() & ", " &
" HAS_DUTY = " & has_duty_sql_string & " " &
" WHERE ID = " & +d_id_.ToString &
";"
Return querry
End Function
Function FormQuerry_Delete() As String
Dim querry As String = String.Empty
querry = "DELETE FROM DUTY " &
" WHERE ID = " & +d_id_.ToString & ";"
Return querry
End Function
Private Shared Function FormQuerry_DropTableIfExists() As String
Dim querry As String = String.Empty
querry = "DROP TABLE IF EXISTS DUTY; "
Return querry
End Function
Private Shared Function FormQuerry_CreateTableIfNotExists() As String
Dim querry As String = String.Empty
querry = "CREATE TABLE IF NOT EXISTS DUTY (
ID INTEGER PRIMARY KEY AUTOINCREMENT,
ID_DUTY INTEGER NOT NULL,
DATE DATE NOT NULL,
STAFF_ID INTEGER NOT NULL,
HAS_DUTY BOOLEAN
);"
Return querry
End Function
Public Shared Function FormQuerry_DropAndCreateTable() As String
Dim querry As String = String.Empty
querry = FormQuerry_DropTableIfExists()
querry += FormQuerry_CreateTableIfNotExists()
Return querry
End Function
End Class
| sirsz/Elpis | Elpis/Source/Model/Duty.vb | Visual Basic | unlicense | 9,492 | [
30522,
17589,
2291,
1012,
6407,
1012,
12391,
2270,
4372,
2819,
4611,
13874,
6151,
28344,
3393,
6673,
8337,
11345,
23115,
6200,
27472,
2050,
2060,
2203,
4372,
2819,
2270,
2465,
4611,
1005,
4289,
2075,
1024,
1005,
1042,
1035,
1011,
2433,
3643... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.sysml.runtime.matrix;
import java.io.Serializable;
import java.util.HashMap;
import org.apache.sysml.lops.MMTSJ.MMTSJType;
import org.apache.sysml.runtime.DMLRuntimeException;
import org.apache.sysml.runtime.instructions.mr.AggregateBinaryInstruction;
import org.apache.sysml.runtime.instructions.mr.AggregateInstruction;
import org.apache.sysml.runtime.instructions.mr.AggregateUnaryInstruction;
import org.apache.sysml.runtime.instructions.mr.AppendInstruction;
import org.apache.sysml.runtime.instructions.mr.BinaryInstruction;
import org.apache.sysml.runtime.instructions.mr.BinaryMInstruction;
import org.apache.sysml.runtime.instructions.mr.BinaryMRInstructionBase;
import org.apache.sysml.runtime.instructions.mr.CM_N_COVInstruction;
import org.apache.sysml.runtime.instructions.mr.CombineBinaryInstruction;
import org.apache.sysml.runtime.instructions.mr.CombineTernaryInstruction;
import org.apache.sysml.runtime.instructions.mr.CombineUnaryInstruction;
import org.apache.sysml.runtime.instructions.mr.CumulativeAggregateInstruction;
import org.apache.sysml.runtime.instructions.mr.DataGenMRInstruction;
import org.apache.sysml.runtime.instructions.mr.GroupedAggregateInstruction;
import org.apache.sysml.runtime.instructions.mr.GroupedAggregateMInstruction;
import org.apache.sysml.runtime.instructions.mr.MMTSJMRInstruction;
import org.apache.sysml.runtime.instructions.mr.MRInstruction;
import org.apache.sysml.runtime.instructions.mr.MapMultChainInstruction;
import org.apache.sysml.runtime.instructions.mr.MatrixReshapeMRInstruction;
import org.apache.sysml.runtime.instructions.mr.PMMJMRInstruction;
import org.apache.sysml.runtime.instructions.mr.ParameterizedBuiltinMRInstruction;
import org.apache.sysml.runtime.instructions.mr.QuaternaryInstruction;
import org.apache.sysml.runtime.instructions.mr.RandInstruction;
import org.apache.sysml.runtime.instructions.mr.RangeBasedReIndexInstruction;
import org.apache.sysml.runtime.instructions.mr.ReblockInstruction;
import org.apache.sysml.runtime.instructions.mr.RemoveEmptyMRInstruction;
import org.apache.sysml.runtime.instructions.mr.ReorgInstruction;
import org.apache.sysml.runtime.instructions.mr.ReplicateInstruction;
import org.apache.sysml.runtime.instructions.mr.ScalarInstruction;
import org.apache.sysml.runtime.instructions.mr.SeqInstruction;
import org.apache.sysml.runtime.instructions.mr.TernaryInstruction;
import org.apache.sysml.runtime.instructions.mr.UaggOuterChainInstruction;
import org.apache.sysml.runtime.instructions.mr.UnaryInstruction;
import org.apache.sysml.runtime.instructions.mr.UnaryMRInstructionBase;
import org.apache.sysml.runtime.instructions.mr.ZeroOutInstruction;
import org.apache.sysml.runtime.matrix.operators.AggregateBinaryOperator;
import org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator;
import org.apache.sysml.runtime.matrix.operators.ReorgOperator;
public class MatrixCharacteristics implements Serializable
{
private static final long serialVersionUID = 8300479822915546000L;
private long numRows = -1;
private long numColumns = -1;
private int numRowsPerBlock = 1;
private int numColumnsPerBlock = 1;
private long nonZero = -1;
public MatrixCharacteristics() {
}
public MatrixCharacteristics(long nr, long nc, int bnr, int bnc)
{
set(nr, nc, bnr, bnc);
}
public MatrixCharacteristics(long nr, long nc, int bnr, int bnc, long nnz)
{
set(nr, nc, bnr, bnc, nnz);
}
public MatrixCharacteristics(MatrixCharacteristics that)
{
set(that.numRows, that.numColumns, that.numRowsPerBlock, that.numColumnsPerBlock, that.nonZero);
}
public void set(long nr, long nc, int bnr, int bnc) {
numRows = nr;
numColumns = nc;
numRowsPerBlock = bnr;
numColumnsPerBlock = bnc;
}
public void set(long nr, long nc, int bnr, int bnc, long nnz) {
numRows = nr;
numColumns = nc;
numRowsPerBlock = bnr;
numColumnsPerBlock = bnc;
nonZero = nnz;
}
public void set(MatrixCharacteristics that) {
numRows = that.numRows;
numColumns = that.numColumns;
numRowsPerBlock = that.numRowsPerBlock;
numColumnsPerBlock = that.numColumnsPerBlock;
nonZero = that.nonZero;
}
public long getRows(){
return numRows;
}
public long getCols(){
return numColumns;
}
public int getRowsPerBlock() {
return numRowsPerBlock;
}
public void setRowsPerBlock( int brlen){
numRowsPerBlock = brlen;
}
public int getColsPerBlock() {
return numColumnsPerBlock;
}
public void setColsPerBlock( int bclen){
numColumnsPerBlock = bclen;
}
public long getNumBlocks() {
return getNumRowBlocks() * getNumColBlocks();
}
public long getNumRowBlocks() {
return (long) Math.ceil((double)getRows() / getRowsPerBlock());
}
public long getNumColBlocks() {
return (long) Math.ceil((double)getCols() / getColsPerBlock());
}
public String toString()
{
return "["+numRows+" x "+numColumns+", nnz="+nonZero
+", blocks ("+numRowsPerBlock+" x "+numColumnsPerBlock+")]";
}
public void setDimension(long nr, long nc) {
numRows = nr;
numColumns = nc;
}
public void setBlockSize(int blen) {
setBlockSize(blen, blen);
}
public void setBlockSize(int bnr, int bnc) {
numRowsPerBlock = bnr;
numColumnsPerBlock = bnc;
}
public void setNonZeros(long nnz) {
nonZero = nnz;
}
public long getNonZeros() {
return nonZero;
}
public boolean dimsKnown() {
return ( numRows > 0 && numColumns > 0 );
}
public boolean dimsKnown(boolean includeNnz) {
return ( numRows > 0 && numColumns > 0 && (!includeNnz || nonZero>=0));
}
public boolean rowsKnown() {
return ( numRows > 0 );
}
public boolean colsKnown() {
return ( numColumns > 0 );
}
public boolean nnzKnown() {
return ( nonZero >= 0 );
}
public boolean mightHaveEmptyBlocks()
{
long singleBlk = Math.min(numRows, numRowsPerBlock)
* Math.min(numColumns, numColumnsPerBlock);
return !nnzKnown() || (nonZero < numRows*numColumns - singleBlk);
}
public static void reorg(MatrixCharacteristics dim, ReorgOperator op,
MatrixCharacteristics dimOut) throws DMLRuntimeException
{
op.fn.computeDimension(dim, dimOut);
}
public static void aggregateUnary(MatrixCharacteristics dim, AggregateUnaryOperator op,
MatrixCharacteristics dimOut) throws DMLRuntimeException
{
op.indexFn.computeDimension(dim, dimOut);
}
public static void aggregateBinary(MatrixCharacteristics dim1, MatrixCharacteristics dim2,
AggregateBinaryOperator op, MatrixCharacteristics dimOut)
{
//set dimension
dimOut.set(dim1.numRows, dim2.numColumns, dim1.numRowsPerBlock, dim2.numColumnsPerBlock);
}
public static void computeDimension(HashMap<Byte, MatrixCharacteristics> dims, MRInstruction ins)
throws DMLRuntimeException
{
MatrixCharacteristics dimOut=dims.get(ins.output);
if(dimOut==null)
{
dimOut=new MatrixCharacteristics();
dims.put(ins.output, dimOut);
}
if(ins instanceof ReorgInstruction)
{
ReorgInstruction realIns=(ReorgInstruction)ins;
reorg(dims.get(realIns.input), (ReorgOperator)realIns.getOperator(), dimOut);
}
else if(ins instanceof AppendInstruction )
{
AppendInstruction realIns = (AppendInstruction)ins;
MatrixCharacteristics in_dim1 = dims.get(realIns.input1);
MatrixCharacteristics in_dim2 = dims.get(realIns.input2);
if( realIns.isCBind() )
dimOut.set(in_dim1.numRows, in_dim1.numColumns+in_dim2.numColumns, in_dim1.numRowsPerBlock, in_dim2.numColumnsPerBlock);
else
dimOut.set(in_dim1.numRows+in_dim2.numRows, in_dim1.numColumns, in_dim1.numRowsPerBlock, in_dim2.numColumnsPerBlock);
}
else if(ins instanceof CumulativeAggregateInstruction)
{
AggregateUnaryInstruction realIns=(AggregateUnaryInstruction)ins;
MatrixCharacteristics in = dims.get(realIns.input);
dimOut.set((long)Math.ceil( (double)in.getRows()/in.getRowsPerBlock()), in.getCols(), in.getRowsPerBlock(), in.getColsPerBlock());
}
else if(ins instanceof AggregateUnaryInstruction)
{
AggregateUnaryInstruction realIns=(AggregateUnaryInstruction)ins;
aggregateUnary(dims.get(realIns.input),
(AggregateUnaryOperator)realIns.getOperator(), dimOut);
}
else if(ins instanceof AggregateBinaryInstruction)
{
AggregateBinaryInstruction realIns=(AggregateBinaryInstruction)ins;
aggregateBinary(dims.get(realIns.input1), dims.get(realIns.input2),
(AggregateBinaryOperator)realIns.getOperator(), dimOut);
}
else if(ins instanceof MapMultChainInstruction)
{
//output size independent of chain type
MapMultChainInstruction realIns=(MapMultChainInstruction)ins;
MatrixCharacteristics mc1 = dims.get(realIns.getInput1());
MatrixCharacteristics mc2 = dims.get(realIns.getInput2());
dimOut.set(mc1.numColumns, mc2.numColumns, mc1.numRowsPerBlock, mc1.numColumnsPerBlock);
}
else if(ins instanceof QuaternaryInstruction)
{
QuaternaryInstruction realIns=(QuaternaryInstruction)ins;
MatrixCharacteristics mc1 = dims.get(realIns.getInput1());
MatrixCharacteristics mc2 = dims.get(realIns.getInput2());
MatrixCharacteristics mc3 = dims.get(realIns.getInput3());
realIns.computeMatrixCharacteristics(mc1, mc2, mc3, dimOut);
}
else if(ins instanceof ReblockInstruction)
{
ReblockInstruction realIns=(ReblockInstruction)ins;
MatrixCharacteristics in_dim=dims.get(realIns.input);
dimOut.set(in_dim.numRows, in_dim.numColumns, realIns.brlen, realIns.bclen, in_dim.nonZero);
}
else if( ins instanceof MatrixReshapeMRInstruction )
{
MatrixReshapeMRInstruction mrinst = (MatrixReshapeMRInstruction) ins;
MatrixCharacteristics in_dim=dims.get(mrinst.input);
dimOut.set(mrinst.getNumRows(),mrinst.getNumColunms(),in_dim.getRowsPerBlock(), in_dim.getColsPerBlock(), in_dim.getNonZeros());
}
else if(ins instanceof RandInstruction
|| ins instanceof SeqInstruction)
{
DataGenMRInstruction dataIns=(DataGenMRInstruction)ins;
dimOut.set(dims.get(dataIns.getInput()));
}
else if( ins instanceof ReplicateInstruction )
{
ReplicateInstruction realIns=(ReplicateInstruction)ins;
realIns.computeOutputDimension(dims.get(realIns.input), dimOut);
}
else if( ins instanceof ParameterizedBuiltinMRInstruction ) //before unary
{
ParameterizedBuiltinMRInstruction realIns = (ParameterizedBuiltinMRInstruction)ins;
realIns.computeOutputCharacteristics(dims.get(realIns.input), dimOut);
}
else if(ins instanceof ScalarInstruction
|| ins instanceof AggregateInstruction
||(ins instanceof UnaryInstruction && !(ins instanceof MMTSJMRInstruction))
|| ins instanceof ZeroOutInstruction)
{
UnaryMRInstructionBase realIns=(UnaryMRInstructionBase)ins;
dimOut.set(dims.get(realIns.input));
}
else if (ins instanceof MMTSJMRInstruction)
{
MMTSJMRInstruction mmtsj = (MMTSJMRInstruction)ins;
MMTSJType tstype = mmtsj.getMMTSJType();
MatrixCharacteristics mc = dims.get(mmtsj.input);
dimOut.set( tstype.isLeft() ? mc.numColumns : mc.numRows,
tstype.isLeft() ? mc.numColumns : mc.numRows,
mc.numRowsPerBlock, mc.numColumnsPerBlock );
}
else if( ins instanceof PMMJMRInstruction )
{
PMMJMRInstruction pmmins = (PMMJMRInstruction) ins;
MatrixCharacteristics mc = dims.get(pmmins.input2);
dimOut.set( pmmins.getNumRows(),
mc.numColumns,
mc.numRowsPerBlock, mc.numColumnsPerBlock );
}
else if( ins instanceof RemoveEmptyMRInstruction )
{
RemoveEmptyMRInstruction realIns=(RemoveEmptyMRInstruction)ins;
MatrixCharacteristics mc = dims.get(realIns.input1);
if( realIns.isRemoveRows() )
dimOut.set(realIns.getOutputLen(), mc.getCols(), mc.numRowsPerBlock, mc.numColumnsPerBlock);
else
dimOut.set(mc.getRows(), realIns.getOutputLen(), mc.numRowsPerBlock, mc.numColumnsPerBlock);
}
else if(ins instanceof UaggOuterChainInstruction) //needs to be checked before binary
{
UaggOuterChainInstruction realIns=(UaggOuterChainInstruction)ins;
MatrixCharacteristics mc1 = dims.get(realIns.input1);
MatrixCharacteristics mc2 = dims.get(realIns.input2);
realIns.computeOutputCharacteristics(mc1, mc2, dimOut);
}
else if( ins instanceof GroupedAggregateMInstruction )
{
GroupedAggregateMInstruction realIns = (GroupedAggregateMInstruction) ins;
MatrixCharacteristics mc1 = dims.get(realIns.input1);
realIns.computeOutputCharacteristics(mc1, dimOut);
}
else if(ins instanceof BinaryInstruction || ins instanceof BinaryMInstruction || ins instanceof CombineBinaryInstruction )
{
BinaryMRInstructionBase realIns=(BinaryMRInstructionBase)ins;
MatrixCharacteristics mc1 = dims.get(realIns.input1);
MatrixCharacteristics mc2 = dims.get(realIns.input2);
if( mc1.getRows()>1 && mc1.getCols()==1
&& mc2.getRows()==1 && mc2.getCols()>1 ) //outer
{
dimOut.set(mc1.getRows(), mc2.getCols(), mc1.getRowsPerBlock(), mc2.getColsPerBlock());
}
else { //default case
dimOut.set(mc1);
}
}
else if (ins instanceof CombineTernaryInstruction ) {
TernaryInstruction realIns=(TernaryInstruction)ins;
dimOut.set(dims.get(realIns.input1));
}
else if (ins instanceof CombineUnaryInstruction ) {
dimOut.set( dims.get(((CombineUnaryInstruction) ins).input));
}
else if(ins instanceof CM_N_COVInstruction || ins instanceof GroupedAggregateInstruction )
{
dimOut.set(1, 1, 1, 1);
}
else if(ins instanceof RangeBasedReIndexInstruction)
{
RangeBasedReIndexInstruction realIns = (RangeBasedReIndexInstruction)ins;
MatrixCharacteristics dimIn = dims.get(realIns.input);
realIns.computeOutputCharacteristics(dimIn, dimOut);
}
else if (ins instanceof TernaryInstruction) {
TernaryInstruction realIns = (TernaryInstruction)ins;
MatrixCharacteristics in_dim=dims.get(realIns.input1);
dimOut.set(realIns.getOutputDim1(), realIns.getOutputDim2(), in_dim.numRowsPerBlock, in_dim.numColumnsPerBlock);
}
else {
/*
* if ins is none of the above cases then we assume that dim_out dimensions are unknown
*/
dimOut.numRows = -1;
dimOut.numColumns = -1;
dimOut.numRowsPerBlock=1;
dimOut.numColumnsPerBlock=1;
}
}
@Override
public boolean equals (Object anObject)
{
if (anObject instanceof MatrixCharacteristics)
{
MatrixCharacteristics mc = (MatrixCharacteristics) anObject;
return ((numRows == mc.numRows) &&
(numColumns == mc.numColumns) &&
(numRowsPerBlock == mc.numRowsPerBlock) &&
(numColumnsPerBlock == mc.numColumnsPerBlock) &&
(nonZero == mc.nonZero)) ;
}
else
return false;
}
@Override
public int hashCode()
{
return super.hashCode();
}
}
| akchinSTC/systemml | src/main/java/org/apache/sysml/runtime/matrix/MatrixCharacteristics.java | Java | apache-2.0 | 15,412 | [
30522,
1013,
1008,
1008,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
1008,
2030,
2062,
12130,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
1008,
5500,
2007,
2023,
2147,
2005,
3176,
2592,
1008,
4953,
9385,
6095,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Loranthus falcifrons Mart. ex Schult.f. SPECIES
#### Status
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Magnoliopsida/Santalales/Loranthaceae/Loranthus/Loranthus falcifrons/README.md | Markdown | apache-2.0 | 189 | [
30522,
1001,
8840,
17884,
9825,
6904,
15472,
10128,
28212,
20481,
1012,
4654,
8040,
21886,
2102,
1012,
1042,
1012,
2427,
1001,
1001,
1001,
1001,
3570,
3970,
1001,
1001,
1001,
1001,
2429,
2000,
2248,
3269,
3415,
5950,
1001,
1001,
1001,
1001,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.