max_stars_count
int64 301
224k
| text
stringlengths 6
1.05M
| token_count
int64 3
727k
|
---|---|---|
21,795 | <reponame>jinjunzhu/Hystrix
/**
* Copyright 2012 Netflix, 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.
*/
package com.netflix.hystrix.examples.demo;
/**
* POJO
*/
public class PaymentInformation {
private final UserAccount user;
private final String creditCardNumber;
private final int expirationMonth;
private final int expirationYear;
public PaymentInformation(UserAccount user, String creditCardNumber, int expirationMonth, int expirationYear) {
this.user = user;
this.creditCardNumber = creditCardNumber;
this.expirationMonth = expirationMonth;
this.expirationYear = expirationYear;
}
public String getCreditCardNumber() {
return creditCardNumber;
}
public int getExpirationMonth() {
return expirationMonth;
}
public int getExpirationYear() {
return expirationYear;
}
}
| 428 |
892 | <filename>advisories/github-reviewed/2021/06/GHSA-5gjg-jgh4-gppm/GHSA-5gjg-jgh4-gppm.json<gh_stars>100-1000
{
"schema_version": "1.2.0",
"id": "GHSA-5gjg-jgh4-gppm",
"modified": "2021-10-05T16:37:09Z",
"published": "2021-06-23T17:26:30Z",
"aliases": [
],
"summary": "Websocket requests did not call AuthenticateMethod",
"details": "### Impact\n\nDepending on implementation, a denial-of-service or privilege escalation vulnerability may occur in software that uses the `github.com/ecnepsnai/web` package with Web Sockets that have an AuthenticateMethod.\n\nThe `AuthenticateMethod` is not called, and `UserData` will be nil in request methods. Attempts to read the `UserData` may result in a panic.\n\nThis issue only affects web sockets where an `AuthenticateMethod` is supplied to the handle options. Users who do not use web sockets, or users who do not require authentication are not at risk.\n\n#### Example\n\nIn the example below, one would expect that the `AuthenticateMethod` function would be called for each request to `/example`\n\n```go\nhandleOptions := web.HandleOptions{\n\tAuthenticateMethod: func(request *http.Request) interface{} {\n\t\t// Assume there is logic here to check for an active sessions, look at cookies or headers, etc...\n\t\tvar session Session{} // Example\n\n\t\treturn session\n\t},\n}\n\nserver.Socket(\"/example\", handle, handleOptions)\n```\n\nHowever, the method is not called, and therefor the `UserData` parameter of the request object in the handle will be nil, when it would have been expected to be the `session` object we returned.\n\n### Patches\n\nRelease v1.5.2 fixes this vulnerability. The authenticate method is now called for websocket requests.\n\nAll users of the web package should update to v1.5.2 or later.\n\n### Workarounds\n\nYou may work around this issue by making the authenticate method a named function, then calling that function at the start of the handle method for the websocket. Reject connections when the return value of the method is nil.",
"severity": [
],
"affected": [
{
"package": {
"ecosystem": "Go",
"name": "github.com/ecnepsnai/web"
},
"ranges": [
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "1.4.0"
},
{
"fixed": "1.5.2"
}
]
}
]
}
],
"references": [
{
"type": "WEB",
"url": "https://github.com/ecnepsnai/web/security/advisories/GHSA-5gjg-jgh4-gppm"
},
{
"type": "PACKAGE",
"url": "https://github.com/ecnepsnai/web"
}
],
"database_specific": {
"cwe_ids": [
"CWE-304"
],
"severity": "MODERATE",
"github_reviewed": true
}
} | 1,075 |
628 | <gh_stars>100-1000
def _generate_dummy_export_header_impl(ctx):
ctx.actions.expand_template(
template = ctx.file._template,
output = ctx.outputs.header_file,
substitutions = {
"{BASE_NAME}": ctx.attr.basename,
},
)
generate_dummy_export_header = rule(
attrs = {
"basename": attr.string(mandatory = True),
"header": attr.string(mandatory = True),
"_template": attr.label(
allow_single_file = True,
default = Label("@com_github_jupp0r_prometheus_cpp//bazel:dummy_export.h.tpl"),
),
},
implementation = _generate_dummy_export_header_impl,
outputs = {"header_file": "%{header}"},
)
| 326 |
1,144 | <reponame>dram/metasfresh<filename>backend/de.metas.adempiere.adempiere/base/src/main/java-gen/org/compiere/model/X_M_Product_Category.java
/** Generated Model - DO NOT CHANGE */
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.util.Properties;
/** Generated Model for M_Product_Category
* @author Adempiere (generated)
*/
@SuppressWarnings("javadoc")
public class X_M_Product_Category extends org.compiere.model.PO implements I_M_Product_Category, org.compiere.model.I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 1990843336L;
/** Standard Constructor */
public X_M_Product_Category (Properties ctx, int M_Product_Category_ID, String trxName)
{
super (ctx, M_Product_Category_ID, trxName);
/** if (M_Product_Category_ID == 0)
{
setIsDefault (false);
setIsPackagingMaterial (false); // N
setIsSelfService (true); // Y
setMMPolicy (null); // F
setM_Product_Category_ID (0);
setName (null);
setPlannedMargin (BigDecimal.ZERO);
setValue (null);
} */
}
/** Load Constructor */
public X_M_Product_Category (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** Load Meta Data */
@Override
protected org.compiere.model.POInfo initPO (Properties ctx)
{
org.compiere.model.POInfo poi = org.compiere.model.POInfo.getPOInfo (ctx, Table_Name, get_TrxName());
return poi;
}
@Override
public org.compiere.model.I_A_Asset_Group getA_Asset_Group() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_A_Asset_Group_ID, org.compiere.model.I_A_Asset_Group.class);
}
@Override
public void setA_Asset_Group(org.compiere.model.I_A_Asset_Group A_Asset_Group)
{
set_ValueFromPO(COLUMNNAME_A_Asset_Group_ID, org.compiere.model.I_A_Asset_Group.class, A_Asset_Group);
}
/** Set Asset-Gruppe.
@param A_Asset_Group_ID
Group of Assets
*/
@Override
public void setA_Asset_Group_ID (int A_Asset_Group_ID)
{
if (A_Asset_Group_ID < 1)
set_Value (COLUMNNAME_A_Asset_Group_ID, null);
else
set_Value (COLUMNNAME_A_Asset_Group_ID, Integer.valueOf(A_Asset_Group_ID));
}
/** Get Asset-Gruppe.
@return Group of Assets
*/
@Override
public int getA_Asset_Group_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_A_Asset_Group_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public org.compiere.model.I_AD_PrintColor getAD_PrintColor() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_AD_PrintColor_ID, org.compiere.model.I_AD_PrintColor.class);
}
@Override
public void setAD_PrintColor(org.compiere.model.I_AD_PrintColor AD_PrintColor)
{
set_ValueFromPO(COLUMNNAME_AD_PrintColor_ID, org.compiere.model.I_AD_PrintColor.class, AD_PrintColor);
}
/** Set Druck - Farbe.
@param AD_PrintColor_ID
Color used for printing and display
*/
@Override
public void setAD_PrintColor_ID (int AD_PrintColor_ID)
{
if (AD_PrintColor_ID < 1)
set_Value (COLUMNNAME_AD_PrintColor_ID, null);
else
set_Value (COLUMNNAME_AD_PrintColor_ID, Integer.valueOf(AD_PrintColor_ID));
}
/** Get <NAME>.
@return Color used for printing and display
*/
@Override
public int getAD_PrintColor_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_PrintColor_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public org.compiere.model.I_AD_Sequence getAD_Sequence_ProductValue() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_AD_Sequence_ProductValue_ID, org.compiere.model.I_AD_Sequence.class);
}
@Override
public void setAD_Sequence_ProductValue(org.compiere.model.I_AD_Sequence AD_Sequence_ProductValue)
{
set_ValueFromPO(COLUMNNAME_AD_Sequence_ProductValue_ID, org.compiere.model.I_AD_Sequence.class, AD_Sequence_ProductValue);
}
/** Set Produkt-Nummerfolge.
@param AD_Sequence_ProductValue_ID
Nummerfolge für Produkt-Suchschlüssel
*/
@Override
public void setAD_Sequence_ProductValue_ID (int AD_Sequence_ProductValue_ID)
{
if (AD_Sequence_ProductValue_ID < 1)
set_Value (COLUMNNAME_AD_Sequence_ProductValue_ID, null);
else
set_Value (COLUMNNAME_AD_Sequence_ProductValue_ID, Integer.valueOf(AD_Sequence_ProductValue_ID));
}
/** Get Produkt-Nummerfolge.
@return Nummerfolge für Produkt-Suchschlüssel
*/
@Override
public int getAD_Sequence_ProductValue_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Sequence_ProductValue_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public de.metas.order.model.I_C_CompensationGroup_Schema getC_CompensationGroup_Schema() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_C_CompensationGroup_Schema_ID, de.metas.order.model.I_C_CompensationGroup_Schema.class);
}
@Override
public void setC_CompensationGroup_Schema(de.metas.order.model.I_C_CompensationGroup_Schema C_CompensationGroup_Schema)
{
set_ValueFromPO(COLUMNNAME_C_CompensationGroup_Schema_ID, de.metas.order.model.I_C_CompensationGroup_Schema.class, C_CompensationGroup_Schema);
}
/** Set Compensation Group Schema.
@param C_CompensationGroup_Schema_ID Compensation Group Schema */
@Override
public void setC_CompensationGroup_Schema_ID (int C_CompensationGroup_Schema_ID)
{
if (C_CompensationGroup_Schema_ID < 1)
set_Value (COLUMNNAME_C_CompensationGroup_Schema_ID, null);
else
set_Value (COLUMNNAME_C_CompensationGroup_Schema_ID, Integer.valueOf(C_CompensationGroup_Schema_ID));
}
/** Get Compensation Group Schema.
@return Compensation Group Schema */
@Override
public int getC_CompensationGroup_Schema_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_CompensationGroup_Schema_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public org.compiere.model.I_C_DocType getC_DocType() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_C_DocType_ID, org.compiere.model.I_C_DocType.class);
}
@Override
public void setC_DocType(org.compiere.model.I_C_DocType C_DocType)
{
set_ValueFromPO(COLUMNNAME_C_DocType_ID, org.compiere.model.I_C_DocType.class, C_DocType);
}
/** Set Belegart.
@param C_DocType_ID
Belegart oder Verarbeitungsvorgaben
*/
@Override
public void setC_DocType_ID (int C_DocType_ID)
{
if (C_DocType_ID < 0)
set_Value (COLUMNNAME_C_DocType_ID, null);
else
set_Value (COLUMNNAME_C_DocType_ID, Integer.valueOf(C_DocType_ID));
}
/** Get Belegart.
@return Belegart oder Verarbeitungsvorgaben
*/
@Override
public int getC_DocType_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_DocType_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Beschreibung.
@param Description Beschreibung */
@Override
public void setDescription (java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Beschreibung.
@return Beschreibung */
@Override
public java.lang.String getDescription ()
{
return (java.lang.String)get_Value(COLUMNNAME_Description);
}
/** Set Min. Garantie-Tage.
@param GuaranteeDaysMin
Mindestanzahl Garantie-Tage
*/
@Override
public void setGuaranteeDaysMin (int GuaranteeDaysMin)
{
set_Value (COLUMNNAME_GuaranteeDaysMin, Integer.valueOf(GuaranteeDaysMin));
}
/** Get Min. Garantie-Tage.
@return Mindestanzahl Garantie-Tage
*/
@Override
public int getGuaranteeDaysMin ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_GuaranteeDaysMin);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Standard.
@param IsDefault
Default value
*/
@Override
public void setIsDefault (boolean IsDefault)
{
set_Value (COLUMNNAME_IsDefault, Boolean.valueOf(IsDefault));
}
/** Get Standard.
@return Default value
*/
@Override
public boolean isDefault ()
{
Object oo = get_Value(COLUMNNAME_IsDefault);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Verpackungsmaterial.
@param IsPackagingMaterial Verpackungsmaterial */
@Override
public void setIsPackagingMaterial (boolean IsPackagingMaterial)
{
set_Value (COLUMNNAME_IsPackagingMaterial, Boolean.valueOf(IsPackagingMaterial));
}
/** Get Verpackungsmaterial.
@return Verpackungsmaterial */
@Override
public boolean isPackagingMaterial ()
{
Object oo = get_Value(COLUMNNAME_IsPackagingMaterial);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Selbstbedienung.
@param IsSelfService
This is a Self-Service entry or this entry can be changed via Self-Service
*/
@Override
public void setIsSelfService (boolean IsSelfService)
{
set_Value (COLUMNNAME_IsSelfService, Boolean.valueOf(IsSelfService));
}
/** Get Selbstbedienung.
@return This is a Self-Service entry or this entry can be changed via Self-Service
*/
@Override
public boolean isSelfService ()
{
Object oo = get_Value(COLUMNNAME_IsSelfService);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Summary Level.
@param IsSummary
This is a summary entity
*/
@Override
public void setIsSummary (boolean IsSummary)
{
set_Value (COLUMNNAME_IsSummary, Boolean.valueOf(IsSummary));
}
/** Get Summary Level.
@return This is a summary entity
*/
@Override
public boolean isSummary ()
{
Object oo = get_Value(COLUMNNAME_IsSummary);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
@Override
public org.compiere.model.I_M_AttributeSet getM_AttributeSet() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_M_AttributeSet_ID, org.compiere.model.I_M_AttributeSet.class);
}
@Override
public void setM_AttributeSet(org.compiere.model.I_M_AttributeSet M_AttributeSet)
{
set_ValueFromPO(COLUMNNAME_M_AttributeSet_ID, org.compiere.model.I_M_AttributeSet.class, M_AttributeSet);
}
/** Set Merkmals-Satz.
@param M_AttributeSet_ID
Merkmals-Satz zum Produkt
*/
@Override
public void setM_AttributeSet_ID (int M_AttributeSet_ID)
{
if (M_AttributeSet_ID < 0)
set_Value (COLUMNNAME_M_AttributeSet_ID, null);
else
set_Value (COLUMNNAME_M_AttributeSet_ID, Integer.valueOf(M_AttributeSet_ID));
}
/** Get Merkmals-Satz.
@return Merkmals-Satz zum Produkt
*/
@Override
public int getM_AttributeSet_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_AttributeSet_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/**
* MMPolicy AD_Reference_ID=335
* Reference name: _MMPolicy
*/
public static final int MMPOLICY_AD_Reference_ID=335;
/** LiFo = L */
public static final String MMPOLICY_LiFo = "L";
/** FiFo = F */
public static final String MMPOLICY_FiFo = "F";
/** Set Materialfluß.
@param MMPolicy
Material Movement Policy
*/
@Override
public void setMMPolicy (java.lang.String MMPolicy)
{
set_Value (COLUMNNAME_MMPolicy, MMPolicy);
}
/** Get Materialfluß.
@return Material Movement Policy
*/
@Override
public java.lang.String getMMPolicy ()
{
return (java.lang.String)get_Value(COLUMNNAME_MMPolicy);
}
/** Set Produkt Kategorie.
@param M_Product_Category_ID
Kategorie eines Produktes
*/
@Override
public void setM_Product_Category_ID (int M_Product_Category_ID)
{
if (M_Product_Category_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Product_Category_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Product_Category_ID, Integer.valueOf(M_Product_Category_ID));
}
/** Get Produkt Kategorie.
@return Kategorie eines Produktes
*/
@Override
public int getM_Product_Category_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_Category_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public org.compiere.model.I_M_Product_Category getM_Product_Category_Parent() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_M_Product_Category_Parent_ID, org.compiere.model.I_M_Product_Category.class);
}
@Override
public void setM_Product_Category_Parent(org.compiere.model.I_M_Product_Category M_Product_Category_Parent)
{
set_ValueFromPO(COLUMNNAME_M_Product_Category_Parent_ID, org.compiere.model.I_M_Product_Category.class, M_Product_Category_Parent);
}
/** Set Parent Product Category.
@param M_Product_Category_Parent_ID Parent Product Category */
@Override
public void setM_Product_Category_Parent_ID (int M_Product_Category_Parent_ID)
{
if (M_Product_Category_Parent_ID < 1)
set_Value (COLUMNNAME_M_Product_Category_Parent_ID, null);
else
set_Value (COLUMNNAME_M_Product_Category_Parent_ID, Integer.valueOf(M_Product_Category_Parent_ID));
}
/** Get Parent Product Category.
@return Parent Product Category */
@Override
public int getM_Product_Category_Parent_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_Category_Parent_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/**
* MRP_Exclude AD_Reference_ID=319
* Reference name: _YesNo
*/
public static final int MRP_EXCLUDE_AD_Reference_ID=319;
/** Yes = Y */
public static final String MRP_EXCLUDE_Yes = "Y";
/** No = N */
public static final String MRP_EXCLUDE_No = "N";
/** Set MRP ausschliessen.
@param MRP_Exclude MRP ausschliessen */
@Override
public void setMRP_Exclude (java.lang.String MRP_Exclude)
{
set_Value (COLUMNNAME_MRP_Exclude, MRP_Exclude);
}
/** Get MRP ausschliessen.
@return MRP ausschliessen */
@Override
public java.lang.String getMRP_Exclude ()
{
return (java.lang.String)get_Value(COLUMNNAME_MRP_Exclude);
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
@Override
public void setName (java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
@Override
public java.lang.String getName ()
{
return (java.lang.String)get_Value(COLUMNNAME_Name);
}
/** Set DB1 %.
@param PlannedMargin
Project's planned margin as a percentage
*/
@Override
public void setPlannedMargin (java.math.BigDecimal PlannedMargin)
{
set_Value (COLUMNNAME_PlannedMargin, PlannedMargin);
}
/** Get DB1 %.
@return Project's planned margin as a percentage
*/
@Override
public java.math.BigDecimal getPlannedMargin ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PlannedMargin);
if (bd == null)
return BigDecimal.ZERO;
return bd;
}
/** Set Suchschlüssel.
@param Value
Search key for the record in the format required - must be unique
*/
@Override
public void setValue (java.lang.String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
/** Get Suchschlüssel.
@return Search key for the record in the format required - must be unique
*/
@Override
public java.lang.String getValue ()
{
return (java.lang.String)get_Value(COLUMNNAME_Value);
}
} | 5,937 |
1,601 | # -------------------------------------------------------------------------
#
# Part of the CodeChecker project, under the Apache License v2.0 with
# LLVM Exceptions. See LICENSE for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# -------------------------------------------------------------------------
"""
This module tests the correctness of the OutputParser and PListConverter, which
used in sequence transform LeakSanitizer output to a plist file.
"""
import os
import plistlib
import shutil
import tempfile
import unittest
from codechecker_report_converter.output_parser import Event, Message
from codechecker_report_converter.sanitizers.leak.output_parser import \
LSANParser
from codechecker_report_converter.sanitizers.leak.analyzer_result import \
LSANAnalyzerResult
OLD_PWD = None
def setup_module():
"""Setup the test tidy reprs for the test classes in the module."""
global OLD_PWD
OLD_PWD = os.getcwd()
os.chdir(os.path.join(os.path.dirname(__file__),
'lsan_output_test_files'))
def teardown_module():
"""Restore environment after tests have ran."""
global OLD_PWD
os.chdir(OLD_PWD)
class LSANPListConverterTestCase(unittest.TestCase):
""" Test the output of the LSANAnalyzerResult. """
def setUp(self):
""" Setup the test. """
self.analyzer_result = LSANAnalyzerResult()
self.cc_result_dir = tempfile.mkdtemp()
def tearDown(self):
""" Clean temporary directory. """
shutil.rmtree(self.cc_result_dir)
def test_san(self):
""" Test for the lsan.plist file. """
self.analyzer_result.transform('lsan.out', self.cc_result_dir)
with open('lsan.plist', mode='rb') as pfile:
exp = plistlib.load(pfile)
plist_file = os.path.join(self.cc_result_dir, 'lsan.c_lsan.plist')
with open(plist_file, mode='rb') as pfile:
res = plistlib.load(pfile)
# Use relative path for this test.
res['files'][0] = 'files/lsan.c'
self.assertTrue(res['metadata']['generated_by']['version'])
res['metadata']['generated_by']['version'] = "x.y.z"
self.assertEqual(res, exp)
class LSANOutputParserTestCase(unittest.TestCase):
"""
Tests the output of the OutputParser, which converts an Leak Sanitizer
output file to zero or more Message object.
"""
def setUp(self):
""" Setup the OutputParser. """
self.parser = LSANParser()
self.lsan_repr = [
Message(
os.path.abspath('files/lsan.c'),
4, 7,
"detected memory leaks",
"LeakSanitizer",
[Event(
os.path.abspath('files/lsan.c'),
4, 7,
" #1 0x4da26a in main files/lsan.c:4:7"
)],
[Event(
os.path.abspath('files/lsan.c'),
4, 7,
"Direct leak of 7 byte(s) in 1 object(s) allocated from:\n"
" #0 0x4af01b in __interceptor_malloc /projects/"
"compiler-rt/lib/asan/asan_malloc_linux.cc:52:3\n"
" #1 0x4da26a in main files/lsan.c:4:7\n"
" #2 0x7f076fd9cec4 in __libc_start_main "
"libc-start.c:287\n"
"SUMMARY: AddressSanitizer: 7 byte(s) "
"leaked in 1 allocation(s)\n"
)]),
]
def test_lsan(self):
""" Test the generated Messages of lsan.out. """
messages = self.parser.parse_messages_from_file('lsan.out')
self.assertEqual(len(messages), len(self.lsan_repr))
for message in messages:
self.assertIn(message, self.lsan_repr)
| 1,791 |
1,210 | from .parseable_str import parse_b58_double_sha256, parse_bech32, parse_colon_prefix, parseable_str
from pycoin.contrib import segwit_addr
from pycoin.encoding.bytes32 import from_bytes_32
from pycoin.intbytes import int2byte
from pycoin.encoding.hexbytes import b2h, h2b
from .Contract import Contract
def hparse(api, pub_prv, key_type, s):
"""
Generalize parsing bip32-type b58-encoded strings.
"""
data = api.parse_b58_hashed(s)
attr_name = "_%s_%s_prefix" % (key_type, pub_prv)
prefix = getattr(api, attr_name, None)
if data is None or prefix is None or not data.startswith(prefix):
return None
parse_method_name = "%s_deserialize" % key_type
parse_method = getattr(api._network.keys, parse_method_name, lambda *args: None)
return parse_method(data)
class ParseAPI(object):
def __init__(
self, network, bip32_prv_prefix=None, bip32_pub_prefix=None, bip49_prv_prefix=None,
bip49_pub_prefix=None, bip84_prv_prefix=None, bip84_pub_prefix=None, address_prefix=None,
pay_to_script_prefix=None, bech32_hrp=None, wif_prefix=None, sec_prefix=None):
self._network = network
self._bip32_prv_prefix = bip32_prv_prefix
self._bip32_pub_prefix = bip32_pub_prefix
self._bip49_prv_prefix = bip49_prv_prefix
self._bip49_pub_prefix = bip49_pub_prefix
self._bip84_prv_prefix = bip84_prv_prefix
self._bip84_pub_prefix = bip84_pub_prefix
self._address_prefix = address_prefix
self._pay_to_script_prefix = pay_to_script_prefix
self._bech32_hrp = bech32_hrp
self._wif_prefix = wif_prefix
self._sec_prefix = sec_prefix
def parse_b58_hashed(self, s):
"""
Override me to change how the b58 hashing check is done.
"""
return parse_b58_double_sha256(s)
# hierarchical key
def bip32_seed(self, s):
"""
Parse a bip32 private key from a seed.
Return a :class:`BIP32 <pycoin.key.BIP32Node.BIP32Node>` or None.
"""
pair = parse_colon_prefix(s)
if pair is None or pair[0] not in "HP":
return None
if pair[0] == "H":
try:
master_secret = h2b(pair[1])
except ValueError:
return None
else:
master_secret = pair[1].encode("utf8")
return self._network.keys.bip32_seed(master_secret)
# hierarchical key
def hd_seed(self, s):
"""
Parse a bip32 private key from a seed.
Return a :class:`BIP32 <pycoin.key.BIP32Node.BIP32Node>` or None.
"""
pair = parse_colon_prefix(s)
if pair is None or pair[0] not in "HP":
return None
if pair[0] == "H":
try:
master_secret = h2b(pair[1])
except ValueError:
return None
else:
master_secret = pair[1].encode("utf8")
return self._network.keys.hd_seed(master_secret)
def bip32_prv(self, s):
"""
Parse a bip32 private key from a text string ("xprv" type).
Return a :class:`BIP32 <pycoin.key.BIP32Node.BIP32Node>` or None.
"""
return hparse(self, "prv", "bip32", s)
def bip32_pub(self, s):
"""
Parse a bip32 public key from a text string ("xpub" type).
Return a :class:`BIP32 <pycoin.key.BIP32Node.BIP32Node>` or None.
"""
return hparse(self, "pub", "bip32", s)
def bip32(self, s):
"""
Parse a bip32 public key from a text string, either a seed, a prv or a pub.
Return a :class:`BIP32 <pycoin.key.BIP32Node.BIP32Node>` or None.
"""
s = parseable_str(s)
return self.bip32_prv(s) or self.bip32_pub(s)
def bip49_prv(self, s):
"""
Parse a bip84 private key from a text string ("yprv" type).
Return a :class:`BIP49 <pycoin.key.BIP49Node.BIP49Node>` or None.
"""
return hparse(self, "prv", "bip49", s)
def bip49_pub(self, s):
"""
Parse a bip84 public key from a text string ("ypub" type).
Return a :class:`BIP49 <pycoin.key.BIP49Node.BIP49Node>` or None.
"""
return hparse(self, "pub", "bip49", s)
def bip49(self, s):
"""
Parse a bip49 public key from a text string, either a seed, a prv or a pub.
Return a :class:`BIP49 <pycoin.key.BIP49Node.BIP49Node>` or None.
"""
s = parseable_str(s)
return self.bip49_prv(s) or self.bip49_pub(s)
def bip84_prv(self, s):
"""
Parse a bip84 private key from a text string ("zprv" type).
Return a :class:`BIP84 <pycoin.key.BIP84Node.BIP84Node>` or None.
"""
return hparse(self, "prv", "bip84", s)
def bip84_pub(self, s):
"""
Parse a bip84 public key from a text string ("zpub" type).
Return a :class:`BIP84 <pycoin.key.BIP84Node.BIP84Node>` or None.
"""
return hparse(self, "pub", "bip84", s)
def bip84(self, s):
"""
Parse a bip84 public key from a text string, either a seed, a prv or a pub.
Return a :class:`BIP84 <pycoin.key.BIP84Node.BIP84Node>` or None.
"""
s = parseable_str(s)
return self.bip84_prv(s) or self.bip84_pub(s)
def _electrum_to_blob(self, s):
pair = parse_colon_prefix(s)
if pair is None or pair[0] != "E":
return None
try:
return h2b(pair[1])
except ValueError:
return None
def electrum_seed(self, s):
"""
Parse an electrum key from a text string in seed form ("E:xxx" where xxx
is a 32-character hex string).
Return a :class:`ElectrumWallet <pycoin.key.electrum.ElectrumWallet>` or None.
"""
blob = self._electrum_to_blob(s)
if blob and len(blob) == 16:
blob = b2h(blob)
return self._network.keys.electrum_seed(seed=blob)
def electrum_prv(self, s):
"""
Parse an electrum private key from a text string in seed form ("E:xxx" where xxx
is a 64-character hex string).
Return a :class:`ElectrumWallet <pycoin.key.electrum.ElectrumWallet>` or None.
"""
blob = self._electrum_to_blob(s)
if blob and len(blob) == 32:
mpk = from_bytes_32(blob)
return self._network.keys.electrum_private(master_private_key=mpk)
def electrum_pub(self, s):
"""
Parse an electrum public key from a text string in seed form ("E:xxx" where xxx
is a 128-character hex string).
Return a :class:`ElectrumWallet <pycoin.key.electrum.ElectrumWallet>` or None.
"""
blob = self._electrum_to_blob(s)
if blob and len(blob) == 64:
return self._network.keys.electrum_public(master_public_key=blob)
# address
def p2pkh(self, s):
"""
Parse a pay-to-public-key-hash address.
Return a :class:`Contract <pycoin.networks.Contract.Contract>` or None.
"""
data = self.parse_b58_hashed(s)
if data is None or not data.startswith(self._address_prefix):
return None
size = len(self._address_prefix)
script = self._network.contract.for_p2pkh(data[size:])
script_info = self._network.contract.info_for_script(script)
return Contract(script_info, self._network)
def p2sh(self, s):
"""
Parse a pay-to-script-hash address.
Return a :class:`Contract <pycoin.networks.Contract.Contract>` or None.
"""
data = self.parse_b58_hashed(s)
if (None in (data, self._pay_to_script_prefix) or
not data.startswith(self._pay_to_script_prefix)):
return None
size = len(self._pay_to_script_prefix)
script = self._network.contract.for_p2sh(data[size:])
script_info = self._network.contract.info_for_script(script)
return Contract(script_info, self._network)
def _segwit(self, s, blob_len, segwit_attr):
script_f = getattr(self._network.contract, segwit_attr, None)
if script_f is None:
return None
pair = parse_bech32(s)
if pair is None or pair[0] != self._bech32_hrp or pair[1] is None:
return None
data = pair[1]
version_byte = int2byte(data[0])
decoded = segwit_addr.convertbits(data[1:], 5, 8, False)
decoded_data = b''.join(int2byte(d) for d in decoded)
if version_byte != b'\0' or len(decoded_data) != blob_len:
return None
script = script_f(decoded_data)
script_info = self._network.contract.info_for_script(script)
return Contract(script_info, self._network)
def p2pkh_segwit(self, s):
"""
Parse a pay-to-pubkey-hash segwit address.
Return a :class:`Contract <pycoin.networks.Contract.Contract>` or None.
"""
return self._segwit(s, 20, "for_p2pkh_wit")
def p2sh_segwit(self, s):
"""
Parse a pay-to-script-hash segwit address.
Return a :class:`Contract <pycoin.networks.Contract.Contract>` or None.
"""
return self._segwit(s, 32, "for_p2sh_wit")
# payable (+ all address types)
def script(self, s):
"""
Parse a script by compiling it.
Return a :class:`Contract <pycoin.networks.Contract.Contract>` or None.
"""
try:
script = self._network.script.compile(s)
script_info = self._network.contract.info_for_script(script)
return Contract(script_info, self._network)
except Exception:
return None
def as_number(self, s):
try:
return int(s)
except ValueError:
pass
try:
return int(s, 16)
except ValueError:
pass
# private key
def wif(self, s):
"""
Parse a WIF.
Return a :class:`Key <pycoin.key.Key>` or None.
"""
data = self.parse_b58_hashed(s)
if data is None or not data.startswith(self._wif_prefix):
return None
data = data[len(self._wif_prefix):]
is_compressed = (len(data) > 32)
if is_compressed:
data = data[:-1]
se = from_bytes_32(data)
return self._network.keys.private(se, is_compressed=is_compressed)
def secret_exponent(self, s):
"""
Parse an integer secret exponent.
Return a :class:`Key <pycoin.key.Key>` or None.
"""
v = self.as_number(s)
if v:
try:
return self._network.keys.private(v)
except ValueError:
pass
# public key
def public_pair(self, s):
"""
Parse a public pair X/Y or X,Y where X is a coordinate and Y is a coordinate or
the string "even" or "odd".
Return a :class:`Key <pycoin.key.Key>` or None.
"""
point = None
Key = self._network.keys.private
# BRAIN DAMAGE
generator = Key(1)._generator
for c in ",/":
if c in s:
s0, s1 = s.split(c, 1)
v0 = self.as_number(s0)
if v0:
if s1 in ("even", "odd"):
is_y_odd = (s1 == "odd")
point = generator.points_for_x(v0)[is_y_odd]
v1 = self.as_number(s1)
if v1:
if generator.contains_point(v0, v1):
point = generator.Point(v0, v1)
if point:
return self._network.keys.public(point)
def sec(self, s):
"""
Parse a public pair as a text SEC.
Return a :class:`Key <pycoin.key.Key>` or None.
"""
pair = parse_colon_prefix(s)
if pair is not None and pair[0] == self._wif_prefix:
s = pair[1]
try:
sec = h2b(s)
return self._network.keys.public(sec)
except Exception:
pass
def address(self, s):
"""
Parse an address, any of p2pkh, p2sh, p2pkh_segwit, or p2sh_segwit.
Return a :class:`Contract <pycoin.networks.Contract.Contract>`, or None.
"""
s = parseable_str(s)
return self.p2pkh(s) or self.p2sh(s) or self.p2pkh_segwit(s) or self.p2sh_segwit(s)
def payable(self, s):
"""
Parse text as either an address or a script to be compiled.
Return a :class:`Contract <pycoin.networks.Contract.Contract>`, or None.
"""
s = parseable_str(s)
return self.address(s) or self.script(s)
# semantic items
def hierarchical_key(self, s):
"""
Parse text as some kind of hierarchical key.
Return a subclass of :class:`Key <pycoin.key.Key>`, or None.
"""
s = parseable_str(s)
for f in [self.bip32_seed, self.bip32, self.bip49, self.bip84,
self.electrum_seed, self.electrum_prv, self.electrum_pub]:
v = f(s)
if v:
return v
def private_key(self, s):
"""
Parse text as some kind of private key.
Return a subclass of :class:`Key <pycoin.key.Key>`, or None.
"""
s = parseable_str(s)
for f in [self.wif, self.secret_exponent]:
v = f(s)
if v:
return v
def secret(self, s):
"""
Parse text either a private key or a private hierarchical key.
Return a subclass of :class:`Key <pycoin.key.Key>`, or None.
"""
s = parseable_str(s)
for f in [self.private_key, self.hierarchical_key]:
v = f(s)
if v:
return v
def public_key(self, s):
"""
Parse text as either a public pair or an sec.
Return a subclass of :class:`Key <pycoin.key.Key>`, or None.
"""
s = parseable_str(s)
for f in [self.public_pair, self.sec]:
v = f(s)
if v:
return v
def input(self, s):
"""
NOT YET SUPPORTED
"""
# BRAIN DAMAGE: TODO
return None
def tx(self, s):
"""
NOT YET SUPPORTED
"""
# BRAIN DAMAGE: TODO
return None
def spendable(self, s):
"""
NOT YET SUPPORTED
"""
# BRAIN DAMAGE: TODO
return None
def script_preimage(self, s):
"""
NOT YET SUPPORTED
"""
# BRAIN DAMAGE: TODO
return None
def __call__(self, s):
s = parseable_str(s)
return (self.payable(s) or
self.input(s) or
self.secret(s) or
self.tx(s))
| 7,319 |
1,412 | <gh_stars>1000+
#pragma once
#include <utility>
struct ContainerBase {
virtual void perform() = 0;
virtual ~ContainerBase() = default;
};
template <class Lambda> struct Container : ContainerBase {
Lambda m_lambda;
Container(Lambda&& lambda) : m_lambda(std::move(lambda)) {}
virtual void perform() { m_lambda(); }
};
class function { // equivalent to std::function<void(void)>
ContainerBase *m_ctr;
public:
template<class Lambda> function(Lambda lambda)
: m_ctr(new Container<Lambda>(std::move(lambda))) {}
void operator()() { m_ctr->perform(); }
~function() { delete m_ctr; }
};
| 202 |
1,127 | // Copyright (C) 2018-2022 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "reshape_kernel_selector.h"
#include "reshape_kernel_ref.h"
namespace kernel_selector {
reshape_kernel_selector::reshape_kernel_selector() { Attach<ReshapeKernelRef>(); }
KernelsData reshape_kernel_selector::GetBestKernels(const Params& params, const optional_params& options) const {
return GetNaiveBestKernel(params, options, KernelType::RESHAPE);
}
} // namespace kernel_selector | 166 |
389 | package editor;
import java.awt.*;
/**
*/
public class LabDarkScheme extends Scheme
{
public static final String NAME = "Dark";
@Override
public boolean isDark()
{
return true;
}
@Override
public String splash()
{
return "images/splash3.png";
}
private static final Color ORANGE = new Color( 251, 166, 0 );
private static final Color WHITISH = new Color( 200, 200, 200 );
private static final Color BLACKISH = new Color( 39, 39, 39 );
private static final Color CONTROL_LIGHT = WHITISH; //UIManager.getColor( "controlLtHighlight" );
/* colors */
private static final Color TOOLTIP_TEXT = WHITISH; // UIManager.getColor( "infoText" );
private static final Color WINDOW = BLACKISH;
private static final Color WINDOW_TEXT = WHITISH;
private static final Color WINDOW_BORDER = new Color( 49, 106, 197 ); //new Color( 100, 100, 100 );
private static final Color TEXT_HIGHLIGHT = new Color( 0, 70, 132 );
private static final Color TEXT_HIGHLIGHT_TEXT = WHITISH;
private static final Color TEXT_TEXT = Color.black;
private static final Color XP_BORDER_COLOR = new Color( 49, 106, 197 );
private static final Color XP_HIGHLIGHT_TOGGLE_COLOR = new Color( 225, 230, 232 );
private static final Color XP_HIGHLIGHT_SELECTED_COLOR = new Color( 0, 50, 94 );
private static final Color ACTIVE_CAPTION = new Color( 0, 70, 132 );
private static final Color XP_HIGHLIGHT_COLOR = ACTIVE_CAPTION;//new Color( 190, 205, 224 );
private static final Color ACTIVE_CAPTION_TEXT = WHITISH;
private static final Color USAGE_READ_HIGHLIGHT_COLOR = new Color( 0, 74, 102 );
private static final Color USAGE_READ_HIGHLIGHT_SHADOW_COLOR = new Color( 0, 140, 200 );
private static final Color USAGE_WRITE_HIGHLIGHT_COLOR = new Color( 99, 0, 84 );
private static final Color USAGE_WRITE_HIGHLIGHT_SHADOW_COLOR = new Color( 200, 0, 160 );
private static final Color SCOPE_HIGHLIGHT_COLOR = new Color( 0, 40, 110 );
private static final Color CONTROL = new Color( 89, 89, 89 );
private static final Color CONTROL_HIGHLIGHT = new Color( 160, 160, 160 );
private static final Color CONTROL_LIGHT_SHADOW = new Color( 80, 80, 80 );
private static final Color CONTROL_SHADOW = new Color( 65, 65, 65 );
private static final Color CONTROL_DARKSHADOW = new Color( 49, 49, 49 );
private static final Color CONTROL_DISABLED_TEXT = new Color( 140, 140, 140 );
private static final Color CONTROL_TEXT = new Color( 200, 200, 200 );
private static final Color BORDER = new Color( 122, 122, 122 );
private static final Color TREE_HANDLE_BORDER = new Color( 128, 128, 128 );
private static final Color SCROLLBAR_BORDER = CONTROL_DARKSHADOW;
private static final Color SEPARATOR_1 = new Color( 0, 0, 0, 0 ); // transparent
private static final Color SEPARATOR_2 = BORDER;
private static final Color MENU = new Color( 77, 77, 77 );
private static final Color MENU_TEXT = WINDOW_TEXT;
private static final Color MENU_BORDER = SEPARATOR_2;
public static final Color TOOLTIP_BACKGROUND = MENU; // UIManager.getColor( "info" );
private static final Color COLOR_BREAKPOINT = new Color( 255, 0, 0, 50 );
private static final Color COLOR_EXECPOINT = new Color( 0, 255, 0, 50 );
private static final Color COLOR_FRAMEPOINT = new Color( 128, 128, 128, 50 );
private static final Color COLOR_ERROR = new Color( 226, 83, 70 );
private static final Color COLOR_ERROR_SHADOW = new Color( 193, 44, 36 );
private static final Color COLOR_WARNING = new Color( 255, 240, 0 );
private static final Color COLOR_WARNING_SHADOW = new Color( 234, 190, 0 );
// Code editor
private static final Color CODE_WINDOW = WINDOW;
private static final Color CODE_WINDOW_TEXT = new Color( 192, 210, 192 );
private static final Color CODE_COMMENT = new Color( 128, 128, 0 );
private static final Color CODE_MULTILINE_COMMENT = CODE_COMMENT;
private static final Color CODE_STRING_LITERAL = new Color( 192, 192, 0 );
private static final Color CODE_NUMBER_LITERAL = new Color( 120, 120, 192 );
private static final Color CODE_KEYWORDS = new Color( 120, 192, 120 );
private static final Color CODE_ERROR = new Color( 192, 80, 0 );
private static final Color CODE_WARNING = Color.gray;
private static final Color CODE_DEPRECATED = CODE_WINDOW_TEXT;
private static final Color CODE_OPERATOR = CODE_WINDOW_TEXT;
private static final Color CODE_TYPE_LITERAL = new Color( 120, 192, 192 );
private static final Color CODE_TYPE_LITERAL_NESTED = CODE_TYPE_LITERAL;
@Override
public Color getCodeWindow()
{
return CODE_WINDOW;
}
@Override
public Color getCodeWindowText()
{
return CODE_WINDOW_TEXT;
}
@Override
public Color getCodeComment()
{
return CODE_COMMENT;
}
@Override
public Color getCodeMultilineComment()
{
return CODE_MULTILINE_COMMENT;
}
@Override
public Color getCodeStringLiteral()
{
return CODE_STRING_LITERAL;
}
@Override
public Color getCodeNumberLiteral()
{
return CODE_NUMBER_LITERAL;
}
@Override
public Color getCodeKeyword()
{
return CODE_KEYWORDS;
}
@Override
public Color getCodeError()
{
return CODE_ERROR;
}
@Override
public Color getCodeWarning()
{
return CODE_WARNING;
}
@Override
public Color getCodeDeprecated()
{
return CODE_DEPRECATED;
}
@Override
public Color getCodeOperator()
{
return CODE_OPERATOR;
}
@Override
public Color getCodeTypeLiteral()
{
return CODE_TYPE_LITERAL;
}
@Override
public Color getCodeTypeLiteralNested()
{
return CODE_TYPE_LITERAL_NESTED;
}
@Override
public Color getActiveCaption()
{
return ACTIVE_CAPTION;
}
@Override
public Color getXpHighlightColor()
{
return XP_HIGHLIGHT_COLOR;
}
@Override
public Color getActiveCaptionText()
{
return ACTIVE_CAPTION_TEXT;
}
@Override
public Color getSeparator1()
{
return SEPARATOR_1;
}
@Override
public Color getSeparator2()
{
return SEPARATOR_2;
}
@Override
public Color getControl()
{
return CONTROL;
}
@Override
public Color getControlLight()
{
return CONTROL_LIGHT;
}
@Override
public Color getControlDarkshadow()
{
return CONTROL_DARKSHADOW;
}
@Override
public Color getControlHighlight()
{
return CONTROL_HIGHLIGHT;
}
@Override
public Color getControlLigthShadow()
{
return CONTROL_LIGHT_SHADOW;
}
@Override
public Color getControlShadow()
{
return CONTROL_SHADOW;
}
@Override
public Color getControlText()
{
return CONTROL_TEXT;
}
@Override
public Color getControlDisabledText()
{
return CONTROL_DISABLED_TEXT;
}
@Override
public Color getTooltipBackground()
{
return TOOLTIP_BACKGROUND;
}
@Override
public Color getTooltipText()
{
return TOOLTIP_TEXT;
}
@Override
public Color getTreeHandleBorderColor()
{
return TREE_HANDLE_BORDER;
}
@Override
public Color getWindow()
{
return WINDOW;
}
@Override
public Color getWindowText()
{
return WINDOW_TEXT;
}
@Override
public Color getWindowBorder()
{
return WINDOW_BORDER;
}
@Override
public Color getTextHighlight()
{
return TEXT_HIGHLIGHT;
}
@Override
public Color getTextHighlightText()
{
return TEXT_HIGHLIGHT_TEXT;
}
@Override
public Color getTextText()
{
return TEXT_TEXT;
}
@Override
public Color getXpBorderColor()
{
return XP_BORDER_COLOR;
}
@Override
public Color getXpHighlightToggleColor()
{
return XP_HIGHLIGHT_TOGGLE_COLOR;
}
@Override
public Color getXpHighlightSelectedColor()
{
return XP_HIGHLIGHT_SELECTED_COLOR;
}
@Override
public Color getBreakpointColor()
{
return COLOR_BREAKPOINT;
}
@Override
public Color getExecBreakpoint()
{
return COLOR_EXECPOINT;
}
@Override
public Color getFrameBreakpoint()
{
return COLOR_FRAMEPOINT;
}
@Override
public Color getColorError()
{
return COLOR_ERROR;
}
@Override
public Color getColorErrorShadow()
{
return COLOR_ERROR_SHADOW;
}
@Override
public Color getColorWarning()
{
return COLOR_WARNING;
}
@Override
public Color getColorWarningShadow()
{
return COLOR_WARNING_SHADOW;
}
@Override
public Color getMenu()
{
return MENU;
}
@Override
public Color getMenuText()
{
return MENU_TEXT;
}
@Override
public Color getMenuBorder()
{
return MENU_BORDER;
}
@Override
public Color getScrollbarBorderColor()
{
return SCROLLBAR_BORDER;
}
@Override
public Color getButtonBorderColor()
{
return getControlText();
}
@Override
public Color usageReadHighlightColor()
{
return USAGE_READ_HIGHLIGHT_COLOR;
}
@Override
public Color usageReadHighlightShadowColor()
{
return USAGE_READ_HIGHLIGHT_SHADOW_COLOR;
}
@Override
public Color usageWriteHighlightColor()
{
return USAGE_WRITE_HIGHLIGHT_COLOR;
}
@Override
public Color usageWriteHighlightShadowColor()
{
return USAGE_WRITE_HIGHLIGHT_SHADOW_COLOR;
}
@Override
public Color scopeHighlightColor()
{
return SCOPE_HIGHLIGHT_COLOR;
}
@Override
public Color getFieldBorderColor()
{
return BORDER;
}
@Override
public Color debugVarRedText()
{
return new Color( 255, 76, 76 );
}
@Override
public Color debugVarGreenText()
{
return new Color( 76, 255, 76 );
}
@Override
public Color debugVarBlueText()
{
return new Color( 76, 164, 255 );
}
@Override
public Color getLineNumberColor()
{
return SCROLLBAR_BORDER;
}
}
| 3,333 |
375 | <reponame>spirentitestdevter/RED
/*
* Copyright 2019 Nokia Solutions and Networks
* Licensed under the Apache License, Version 2.0,
* see license.txt file for details.
*/
package org.rf.ide.core.execution.server.response;
import static com.google.common.collect.Lists.newArrayList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.junit.jupiter.api.Test;
import org.rf.ide.core.execution.server.response.EvaluateExpression.ExpressionType;
import org.rf.ide.core.execution.server.response.ServerResponse.ResponseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
public class EvaluateExpressionTest {
@Test
public void properMessageIsConstructed_forKeywordConditionMessage() {
assertThat(EvaluateExpression.robot(1, "kw", newArrayList()).toMessage())
.isEqualTo("{\"evaluate_expression\":{\"id\":1,\"type\":\"robot\",\"expr\":[\"kw\"]}}");
assertThat(EvaluateExpression.robot(1, "kw", newArrayList("1", "2")).toMessage())
.isEqualTo("{\"evaluate_expression\":{\"id\":1,\"type\":\"robot\",\"expr\":[\"kw\",\"1\",\"2\"]}}");
assertThat(EvaluateExpression.variable(1, "${var}").toMessage())
.isEqualTo("{\"evaluate_expression\":{\"id\":1,\"type\":\"variable\",\"expr\":[\"${var}\"]}}");
assertThat(EvaluateExpression.python(1, "exit()").toMessage())
.isEqualTo("{\"evaluate_expression\":{\"id\":1,\"type\":\"python\",\"expr\":[\"exit()\"]}}");
}
@Test
public void mapperJsonProcessingExceptionIsWrappedAsResponseException() throws Exception {
final ObjectMapper mapper = mock(ObjectMapper.class);
when(mapper.writeValueAsString(any(Object.class))).thenThrow(JsonProcessingException.class);
final EvaluateExpression response = new EvaluateExpression(mapper, 1, ExpressionType.ROBOT,
newArrayList("a", "b"));
assertThatExceptionOfType(ResponseException.class).isThrownBy(response::toMessage);
}
}
| 893 |
379 | <reponame>annelhote/fonduer
"""Fonduer's feature model module."""
from fonduer.features.models.feature import Feature, FeatureKey
__all__ = ["Feature", "FeatureKey"]
| 52 |
6,180 | <reponame>prkhrsrvstv1/cupy
# nvprof --print-gpu-trace python examples/stream/curand.py
import cupy
rand = cupy.random.RandomState()
stream = cupy.cuda.stream.Stream()
with stream:
y = rand.lognormal(size=(1, 3))
stream = cupy.cuda.stream.Stream()
stream.use()
y = rand.lognormal(size=(1, 3))
| 123 |
348 | {"nom":"Presles","circ":"9ème circonscription","dpt":"Isère","inscrits":89,"abs":35,"votants":54,"blancs":14,"nuls":3,"exp":37,"res":[{"nuance":"LR","nom":"<NAME>","voix":20},{"nuance":"MDM","nom":"<NAME>","voix":17}]} | 88 |
3,055 | <gh_stars>1000+
/*
Fontname: -Misc-Fixed-Medium-R-Normal--15-140-75-75-C-90-ISO10646-1
Copyright: Public domain font. Share and enjoy.
Glyphs: 95/4777
BBX Build Mode: 0
*/
const uint8_t u8g2_font_9x15_tr[1250] U8G2_FONT_SECTION("u8g2_font_9x15_tr") =
"_\0\3\2\4\4\4\5\5\11\17\0\375\12\375\13\377\1\224\3<\4\305 \5\0\310\63!\10\261\14"
"\63\16\221\0\42\10\64{\63\42S\0#\16\206\31s\242\226a\211Z\206%j\1$\24\267\371\362\302"
"A\211\42)L\322\65\11#\251\62\210\31\0%\21\247\11sB%JJ\255q\32\265\224\22\61\1&"
"\22\247\11s\304(\213\262(T\65)\251E\225H\13'\6\61|\63\6(\14\303\373\262\222(\211z"
"\213\262\0)\14\303\373\62\262(\213z\211\222\10*\15w\71\363J\225\266-i\252e\0+\13w\31"
"\363\342\332\60dq\15,\11R\334\62\206$Q\0-\7\27I\63\16\1.\7\42\14\63\206\0/\14"
"\247\11\263\323\70-\247\345\64\6\60\15\247\11\263\266J\352k\222e\23\0\61\15\247\11\363R\61\311\242"
"\270\267a\10\62\14\247\11s\6%U\373y\30\2\63\17\247\11\63\16qZ\335\201\70V\223A\1\64"
"\21\247\11sS\61\311\242Z\22&\303\220\306\25\0\65\17\247\11\63\16reH\304\270\254&\203\2\66"
"\20\247\11\263\206(\215+C\42\252\326dP\0\67\16\247\11\63\16q\32\247q\32\247q\10\70\21\247"
"\11\263\266J\232d\331VI\325$\313&\0\71\17\247\11s\6%uT\206$\256FC\4:\10r"
"\14\63\206x\10;\12\242\334\62\206xH\22\5<\11\245\12\63\263\216i\7=\11G)\63\16\71\341"
"\20>\12\245\12\63\322\216YG\0\77\16\247\11s\6%U\343\264\71\207\63\0@\22\247\11s\6%"
"\65\15J\246D\223\42\347\300\240\0A\15\247\11\363\322$\253\244\326\341j\15B\22\247\11\63\6)L"
"R\61\31\244\60I\215\311 \1C\15\247\11s\6%\225\373\232\14\12\0D\15\247\11\63\6)LR"
"\77&\203\4E\15\247\11\63\16ry\220\342\346a\10F\14\247\11\63\16ry\220\342\316\0G\17\247"
"\11s\6%\225\333\206\324\232\14\12\0H\12\247\11\63R\327\341\352\65I\12\245\12\63\6)\354\247A"
"J\24\250\11\363\6\65\7r \7r \7r \12\263!\3K\21\247\11\63R\61\311\242\332\230\204"
"QV\12\223\64L\12\247\11\63\342\376<\14\1M\20\247\11\63Ru[*JE\212\244H\265\6N"
"\17\247\11\63RuT\62)\322\22q\265\6O\14\247\11s\6%\365\327dP\0P\15\247\11\63."
"\251u\30\222\270\63\0Q\17\307\351r\6%\365K&U\6\65\7\4R\20\247\11\63.\251u\30\222"
"(+\205I\252\6S\21\247\11s\6%\265\3;\240\3\252\232\14\12\0T\12\247\11\63\16Y\334\337"
"\0U\13\247\11\63R\377\232\14\12\0V\21\247\11\63Rk\222EY\224U\302$L\322\14W\20\247"
"\11\63RO\221\24I\221\24)\335\22\0X\20\247\11\63R\65\311*i\234&Y%U\3Y\15\247"
"\11\63R\65\311*i\334\33\0Z\14\247\11\63\16q\332\347x\30\2[\12\304\373\62\6\255\177\33\2"
"\134\21\247\11\63r \316\201\34\210s \7\342\34\10]\12\304\372\62\206\254\177\33\4^\12Gi\363"
"\322$\253\244\1_\7\30\370\62\16\2`\7\63\213\63\262\2a\17w\11s\6\35\210\223aHEe"
"H\2b\17\247\11\63\342\226!\21U\353\250\14\11\0c\14w\11s\6%\225[\223A\1d\15\247"
"\11\263[\206D\134\35\225!\11e\16w\11s\6%U\207s\16\14\12\0f\16\247\11\363\266R\26"
"\305\341 \306\215\0g\24\247\331r\206DL\302$\214\206(\7\6%U\223A\1h\14\247\11\63\342"
"\226!\21U\257\1i\12\245\12stt\354i\20j\15\326\331\62u\312\332U\64&C\2k\17\247"
"\11\63\342VMI\64\65\321\62%\15l\11\245\12\63\306\376\64\10m\20w\11\63\26%\212\244H\212"
"\244H\212\324\0n\13w\11\63\222!\21U\257\1o\14w\11s\6%\365\232\14\12\0p\17\247\331"
"\62\222!\21U\353\250\14I\134\6q\15\247\331r\206D\134\35\225!\211\33r\14w\11\63\242IK"
"\302$n\5s\17w\11s\6%\325\201A\7\324dP\0t\14\227\11\263\342p\330\342n\331\2u"
"\20w\11\63\302$L\302$L\302$\214\206$v\16w\11\63R\65\311\242\254\22&i\6w\16w"
"\11\63RS$ER\244tK\0x\15w\11\63\322$\253\244\225\254\222\6y\15\246\331\62B\337\224"
"%\25\223!\1z\12w\11\63\16i\257\303\20{\15\305\373\262\226\260\32ij\26V\7|\6\301\374"
"\62>}\16\305\371\62\326\260\226jR\32V&\0~\12\67ys\64)\322\24\0\0\0\0\4\377\377"
"\0";
| 2,306 |
852 | #include "EventFilter/CastorRawToDigi/interface/CastorUnpacker.h"
#include "EventFilter/HcalRawToDigi/interface/HcalDCCHeader.h"
#include "EventFilter/HcalRawToDigi/interface/HcalHTRData.h"
#include "EventFilter/HcalRawToDigi/interface/HcalTTPUnpacker.h"
#include "DataFormats/HcalDetId/interface/HcalOtherDetId.h"
#include "DataFormats/HcalDigi/interface/HcalQIESample.h"
#include "DataFormats/HcalDigi/interface/CastorDataFrame.h"
#include "DataFormats/HcalDigi/interface/HcalTriggerPrimitiveSample.h"
#include <iostream>
#include "FWCore/MessageLogger/interface/MessageLogger.h"
namespace CastorUnpacker_impl {
template <class DigiClass>
const HcalQIESample* unpack(const HcalQIESample* startPoint,
const HcalQIESample* limit,
DigiClass& digi,
int presamples,
const CastorElectronicsId& eid,
int startSample,
int endSample,
int expectedTime,
const HcalHTRData& hhd) {
// set parameters
digi.setPresamples(presamples);
int fiber = startPoint->fiber();
int fiberchan = startPoint->fiberChan();
uint32_t zsmask = hhd.zsBunchMask() >> startSample;
digi.setZSInfo(hhd.isUnsuppressed(), hhd.wasMarkAndPassZS(fiber, fiberchan), zsmask);
// digi.setReadoutIds(eid);
// setReadoutIds is missing in CastorDataFrame class digi.setReadoutIds(eid);
if (expectedTime >= 0 && !hhd.isUnsuppressed()) {
// std::cout << hhd.getFibOrbMsgBCN(fiber) << " " << expectedTime << " fiber="<<fiber<< std::endl;
digi.setFiberIdleOffset(hhd.getFibOrbMsgBCN(fiber) - expectedTime);
}
// what is my sample number?
int myFiberChan = startPoint->fiberAndChan();
int ncurr = 0, ntaken = 0;
const HcalQIESample* qie_work = startPoint;
while (qie_work != limit && qie_work->fiberAndChan() == myFiberChan) {
if (ncurr >= startSample && ncurr <= endSample) {
digi.setSample(ntaken, *qie_work);
++ntaken;
}
ncurr++;
qie_work++;
}
digi.setSize(ntaken);
return qie_work;
}
} // namespace CastorUnpacker_impl
namespace {
inline bool isTPGSOI(const HcalTriggerPrimitiveSample& s) { return (s.raw() & 0x200) != 0; }
} // namespace
CastorUnpacker::CastorUnpacker(int sourceIdOffset, int beg, int end)
: sourceIdOffset_(sourceIdOffset), expectedOrbitMessageTime_(-1) {
if (beg >= 0 && beg <= CastorDataFrame::MAXSAMPLES - 1) {
startSample_ = beg;
} else {
startSample_ = 0;
}
if (end >= 0 && end <= CastorDataFrame::MAXSAMPLES - 1 && end >= beg) {
endSample_ = end;
} else {
endSample_ = CastorDataFrame::MAXSAMPLES - 1;
}
}
static int slb(const HcalTriggerPrimitiveSample& theSample) { return ((theSample.raw() >> 13) & 0x7); }
static int slbChan(const HcalTriggerPrimitiveSample& theSample) { return (theSample.raw() >> 11) & 0x3; }
static int slbAndChan(const HcalTriggerPrimitiveSample& theSample) { return (theSample.raw() >> 11) & 0x1F; }
void CastorUnpacker::unpack(const FEDRawData& raw,
const CastorElectronicsMap& emap,
CastorRawCollections& colls,
HcalUnpackerReport& report,
bool silent) {
if (raw.size() < 16) {
if (!silent)
edm::LogWarning("Invalid Data") << "Empty/invalid DCC data, size = " << raw.size();
return;
}
// get the DCC header
const HcalDCCHeader* dccHeader = (const HcalDCCHeader*)(raw.data());
int dccid = dccHeader->getSourceId() - sourceIdOffset_;
// check the summary status
// walk through the HTR data...
HcalHTRData htr;
const unsigned short *daq_first, *daq_last, *tp_first, *tp_last;
const HcalQIESample *qie_begin, *qie_end, *qie_work;
const HcalTriggerPrimitiveSample *tp_begin, *tp_end, *tp_work;
for (int spigot = 0; spigot < HcalDCCHeader::SPIGOT_COUNT; spigot++) {
if (!dccHeader->getSpigotPresent(spigot))
continue;
int retval = dccHeader->getSpigotData(spigot, htr, raw.size());
if (retval != 0) {
if (retval == -1) {
if (!silent)
edm::LogWarning("Invalid Data") << "Invalid HTR data (data beyond payload size) observed on spigot " << spigot
<< " of DCC with source id " << dccHeader->getSourceId();
report.countSpigotFormatError();
}
continue;
}
// check
if (dccHeader->getSpigotCRCError(spigot)) {
if (!silent)
edm::LogWarning("Invalid Data") << "CRC Error on HTR data observed on spigot " << spigot
<< " of DCC with source id " << dccHeader->getSourceId();
report.countSpigotFormatError();
continue;
}
if (!htr.check()) {
if (!silent)
edm::LogWarning("Invalid Data") << "Invalid HTR data observed on spigot " << spigot << " of DCC with source id "
<< dccHeader->getSourceId();
report.countSpigotFormatError();
continue;
}
if (htr.isHistogramEvent()) {
if (!silent)
edm::LogWarning("Invalid Data") << "Histogram data passed to non-histogram unpacker on spigot " << spigot
<< " of DCC with source id " << dccHeader->getSourceId();
continue;
}
if ((htr.getFirmwareFlavor() & 0xE0) == 0x80) { // some kind of TTP data
if (colls.ttp != nullptr) {
HcalTTPUnpacker ttpUnpack;
colls.ttp->push_back(HcalTTPDigi());
ttpUnpack.unpack(htr, colls.ttp->back());
} else {
LogDebug("CastorUnpackerHcalTechTrigProcessor")
<< "Skipping data on spigot " << spigot << " of DCC with source id " << dccHeader->getSourceId()
<< " which is from the TechTrigProcessor (use separate unpacker!)";
}
continue;
}
if (htr.getFirmwareFlavor() >= 0x80) {
if (!silent)
edm::LogWarning("CastorUnpacker")
<< "Skipping data on spigot " << spigot << " of DCC with source id " << dccHeader->getSourceId()
<< " which is of unknown flavor " << htr.getFirmwareFlavor();
continue;
}
// calculate "real" number of presamples
int nps = htr.getNPS() - startSample_;
// get pointers
htr.dataPointers(&daq_first, &daq_last, &tp_first, &tp_last);
unsigned int smid = htr.getSubmodule();
int htr_tb = smid & 0x1;
int htr_slot = (smid >> 1) & 0x1F;
int htr_cr = (smid >> 6) & 0x1F;
tp_begin = (const HcalTriggerPrimitiveSample*)tp_first;
tp_end = (const HcalTriggerPrimitiveSample*)(tp_last + 1); // one beyond last..
/// work through the samples
int currFiberChan = 0x3F; // invalid fiber+channel...
int ncurr = 0;
bool valid = false;
//////////////////////////////////////////////
bool tpgSOIbitInUse = htr.getFormatVersion() >= 3; // version 3 and later
// bool isHOtpg=htr.getFormatVersion()>=3 && htr.getFirmwareFlavor()==0; // HO is flavor zero
int npre = 0;
/*
Unpack the trigger primitives
*/
// lookup the right channel
bool dotp = true;
CastorElectronicsId eid(0, 1, spigot, dccid);
eid.setHTR(htr_cr, htr_slot, htr_tb);
DetId did = emap.lookup(eid);
if (did.null())
dotp = false;
HcalCastorDetId id1(did);
HcalCastorDetId id((id1.zside() == 0), id1.sector(), 1);
if (id1.module() > 12)
dotp = false;
if (dotp) {
// std::cout << " tp_first="<< tp_first << " tp_last="<< tp_last<< " tb="<<htr_tb<<" slot="<<htr_slot<<" crate="<<htr_cr<<" dccid="<< dccid<< std::endl;
// regular TPs (not HO)
for (tp_work = tp_begin; tp_work != tp_end; tp_work++) {
// std::cout << "raw=0x"<<std::hex<< tp_work->raw()<<std::dec <<std::endl;
if (tp_work->raw() == 0xFFFF)
continue; // filler word
if (slbAndChan(*tp_work) != currFiberChan) { // start new set
npre = 0;
currFiberChan = slbAndChan(*tp_work);
// std::cout<< " NEW SET "<<std::endl;
//HcalElectronicsId eid(tp_work->slbChan(),tp_work->slb(),spigot,dccid,htr_cr,htr_slot,htr_tb);
//DetId did=emap.lookupTrigger(eid);
//if (did.null()) {
//report.countUnmappedTPDigi(eid);
//if (unknownIdsTrig_.find(eid)==unknownIdsTrig_.end()) {
//if (!silent) edm::LogWarning("HCAL") << "HcalUnpacker: No trigger primitive match found for electronics id :" << eid;
//unknownIdsTrig_.insert(eid);
//}
//valid=false;
//continue;
//} else if (did==HcalTrigTowerDetId::Undefined ||
//(did.det()==DetId::Hcal && did.subdetId()==0)) {
//// known to be unmapped
//valid=false;
//continue;
//}
colls.tpCont->push_back(CastorTriggerPrimitiveDigi(id));
// set the various bits
if (!tpgSOIbitInUse)
colls.tpCont->back().setPresamples(nps);
colls.tpCont->back().setZSInfo(htr.isUnsuppressed(),
htr.wasMarkAndPassZSTP(slb(*tp_work), slbChan(*tp_work)));
// no hits recorded for current
ncurr = 0;
valid = true;
}
// add the word (if within settings or recent firmware [recent firmware ignores startSample/endSample])
if (valid && ((tpgSOIbitInUse && ncurr < 10) || (ncurr >= startSample_ && ncurr <= endSample_))) {
colls.tpCont->back().setSample(colls.tpCont->back().size(), *tp_work);
colls.tpCont->back().setSize(colls.tpCont->back().size() + 1);
}
// set presamples,if SOI
if (valid && tpgSOIbitInUse && isTPGSOI(*tp_work)) {
colls.tpCont->back().setPresamples(ncurr);
}
ncurr++;
npre++;
}
}
//////////////////////////////////////////////
qie_begin = (const HcalQIESample*)daq_first;
qie_end = (const HcalQIESample*)(daq_last + 1); // one beyond last..
/// work through the samples
for (qie_work = qie_begin; qie_work != qie_end;) {
if (qie_work->raw() == 0xFFFF) {
qie_work++;
continue; // filler word
}
// lookup the right channel
CastorElectronicsId eid(qie_work->fiberChan(), qie_work->fiber(), spigot, dccid);
eid.setHTR(htr_cr, htr_slot, htr_tb);
DetId did = emap.lookup(eid);
if (!did.null()) {
colls.castorCont->push_back(CastorDataFrame(HcalCastorDetId(did)));
qie_work = CastorUnpacker_impl::unpack<CastorDataFrame>(qie_work,
qie_end,
colls.castorCont->back(),
nps,
eid,
startSample_,
endSample_,
expectedOrbitMessageTime_,
htr);
} else {
report.countUnmappedDigi();
if (unknownIds_.find(eid) == unknownIds_.end()) {
if (!silent)
edm::LogWarning("CASTOR") << "CastorUnpacker: No match found for electronics id :" << eid;
unknownIds_.insert(eid);
}
for (int fiberC = qie_work->fiberAndChan(); qie_work != qie_end && qie_work->fiberAndChan() == fiberC;
qie_work++)
;
}
}
}
}
| 5,764 |
678 | /**
* This header is generated by class-dump-z 0.2b.
*
* Source: /System/Library/PrivateFrameworks/IMCore.framework/IMCore
*/
@interface IMAddressBook : NSObject {
}
+ (id)_threadedABAddressBookLock; // 0x4e051
+ (void *)_threadedABAddressBookRef; // 0x4de31
+ (void *)abAddressBookRef; // 0x4dde9
+ (void *)_abAddressBookRef; // 0x4dcb9
+ (id *)abAddressBook; // 0x4dcb5
@end
| 158 |
671 | <filename>examples/pygi_mpl_numpy/gnome_preamble.py
os.environ['PATH'] += os.pathsep + os.path.join(pkgdir, 'gnome')
| 52 |
6,270 | [
{
"type": "feature",
"category": "EC2",
"description": "Introduces support to initiate Internet Key Exchange (IKE) negotiations for VPN connections from AWS. A user can now send the initial IKE message to their Customer Gateway (CGW) from VPN endpoints."
},
{
"type": "feature",
"category": "GameLift",
"description": "GameLift FleetIQ as a standalone feature is now generally available. FleetIQ makes low-cost Spot instances viable for game hosting. Use GameLift FleetIQ with your EC2 Auto Scaling groups."
},
{
"type": "feature",
"category": "MediaConvert",
"description": "AWS Elemental MediaConvert SDK has added support for WebM DASH outputs as well as H.264 4:2:2 10-bit output in MOV and MP4."
}
] | 279 |
647 | package com.flowci.tree.yml;
import com.flowci.domain.LocalTask;
import com.flowci.domain.StringVars;
import lombok.Getter;
import lombok.Setter;
import java.util.LinkedHashMap;
import java.util.Map;
@Getter
@Setter
public class NotifyYml {
private String plugin;
private Map<String, String> envs = new LinkedHashMap<>();
public LocalTask toObj() {
LocalTask n = new LocalTask();
n.setPlugin(plugin);
n.setEnvs(new StringVars(envs));
return n;
}
}
| 205 |
2,996 | // Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.engine.logic.location;
import com.google.common.collect.Sets;
import org.terasology.engine.entitySystem.entity.EntityRef;
import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnAddedComponent;
import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnChangedComponent;
import org.terasology.engine.entitySystem.event.ReceiveEvent;
import org.terasology.engine.entitySystem.systems.BaseComponentSystem;
import org.terasology.engine.entitySystem.systems.RegisterMode;
import org.terasology.engine.entitySystem.systems.RegisterSystem;
import org.terasology.engine.entitySystem.systems.UpdateSubscriberSystem;
import java.util.Set;
@RegisterSystem(RegisterMode.AUTHORITY)
public class LocationChangedSystem extends BaseComponentSystem implements UpdateSubscriberSystem {
private Set<EntityRef> process = Sets.newHashSet();
@ReceiveEvent(components = LocationComponent.class)
public void locationChanged(OnAddedComponent event, EntityRef entity, LocationComponent lc) {
lc.clearDirtyFlag();
}
@ReceiveEvent(components = LocationComponent.class)
public void locationChanged(OnChangedComponent event, EntityRef entity, LocationComponent lc) {
if (lc.isDirty() && (!lc.position.equals(lc.lastPosition) || !lc.rotation.equals(lc.lastRotation))) {
process.add(entity);
} else {
lc.clearDirtyFlag();
}
}
@Override
public void update(float delta) {
for (EntityRef entity : process) {
LocationComponent lc = entity.getComponent(LocationComponent.class);
if (lc != null) {
entity.send(new LocationChangedEvent(lc.lastPosition, lc.lastRotation, lc.position, lc.rotation));
lc.clearDirtyFlag();
}
}
process.clear();
}
}
| 681 |
737 | <gh_stars>100-1000
/*
* Copyright (C) 2012-2016. TomTom International BV (http://tomtom.com).
*
* 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.
*/
#include "Analysis.h"
static void StrongConnect(std::vector<Component*> &stack, size_t& index, Component* c) {
c->index = c->lowlink = index++;
stack.push_back(c);
c->onStack = true;
for (auto& c2 : c->pubDeps) {
if (c2->index == 0) {
StrongConnect(stack, index, c2);
c->lowlink = std::min(c->lowlink, c2->lowlink);
} else if (c2->onStack) {
c->lowlink = std::min(c->lowlink, c2->index);
}
}
for (auto& c2 : c->privDeps) {
if (c2->index == 0) {
StrongConnect(stack, index, c2);
c->lowlink = std::min(c->lowlink, c2->lowlink);
} else if (c2->onStack) {
c->lowlink = std::min(c->lowlink, c2->index);
}
}
if (c->lowlink == c->index) {
auto pos = std::find(stack.begin(), stack.end(), c);
for (; pos != stack.end(); ++pos) {
(*pos)->lowlink = c->lowlink;
}
do {
Component* comp = stack.back();
stack.pop_back();
for (auto& c2 : comp->pubDeps) {
if (c2->lowlink == comp->lowlink)
comp->circulars.insert(c2);
}
for (auto& c2 : comp->privDeps) {
if (c2->lowlink == comp->lowlink)
comp->circulars.insert(c2);
}
comp->onStack = false;
} while (c->onStack);
}
}
void FindCircularDependencies(std::unordered_map<std::string, Component *> &components) {
std::vector<Component*> stack;
size_t index = 1;
for (auto &c : components) {
if (c.second->index == 0) {
StrongConnect(stack, index, c.second);
}
}
}
void KillComponent(std::unordered_map<std::string, Component *> &components, const std::string& str) {
Component* target = components[str];
if (target) {
for (auto& c : components) {
c.second->pubDeps.erase(target);
c.second->privDeps.erase(target);
c.second->circulars.clear();
}
delete target;
}
components.erase(str);
}
void MapFilesToComponents(std::unordered_map<std::string, Component *> &components, std::unordered_map<std::string, File>& files) {
for (auto &fp : files) {
std::string nameCopy = fp.first;
size_t slashPos = nameCopy.find_last_of('/');
while (slashPos != nameCopy.npos) {
nameCopy.resize(slashPos);
auto it = components.find(nameCopy);
if (it != components.end()) {
fp.second.component = it->second;
it->second->files.insert(&fp.second);
break;
}
slashPos = nameCopy.find_last_of('/');
}
}
}
void MapIncludesToDependencies(std::unordered_map<std::string, std::string> &includeLookup,
std::map<std::string, std::vector<std::string>> &ambiguous,
std::unordered_map<std::string, Component *> &components,
std::unordered_map<std::string, File>& files) {
for (auto &fp : files) {
for (auto &p : fp.second.rawIncludes) {
// If this is a non-pointy bracket include, see if there's a local match first.
// If so, it always takes precedence, never needs an include path added, and never is ambiguous (at least, for the compiler).
std::string fullFilePath = (filesystem::path(fp.first).parent_path() / p.first).generic_string();
if (!p.second && files.count(fullFilePath)) {
// This file exists as a local include.
File* dep = &files.find(fullFilePath)->second;
dep->hasInclude = true;
fp.second.dependencies.insert(dep);
} else {
// We need to use an include path to find this. So let's see where we end up.
std::string lowercaseInclude;
std::transform(p.first.begin(), p.first.end(), std::back_inserter(lowercaseInclude), ::tolower);
const std::string &fullPath = includeLookup[lowercaseInclude];
if (fullPath == "INVALID") {
// We end up in more than one place. That's an ambiguous include then.
ambiguous[lowercaseInclude].push_back(fp.first);
} else if (fullPath.find("GENERATED:") == 0) {
// We end up in a virtual file - it's not actually there yet, but it'll be generated.
if (fp.second.component) {
fp.second.component->buildAfters.insert(fullPath.substr(10));
Component *c = components["./" + fullPath.substr(10)];
if (c) {
fp.second.component->privDeps.insert(c);
}
}
} else if (files.count(fullPath)) {
File *dep = &files.find(fullPath)->second;
fp.second.dependencies.insert(dep);
std::string inclpath = fullPath.substr(0, fullPath.size() - p.first.size() - 1);
if (inclpath.size() == dep->component->root.generic_string().size()) {
inclpath = ".";
} else if (inclpath.size() > dep->component->root.generic_string().size() + 1) {
inclpath = inclpath.substr(dep->component->root.generic_string().size() + 1);
} else {
inclpath = "";
}
if (!inclpath.empty()) {
dep->includePaths.insert(inclpath);
}
if (fp.second.component != dep->component) {
fp.second.component->privDeps.insert(dep->component);
dep->component->privLinks.insert(fp.second.component);
dep->hasExternalInclude = true;
}
dep->hasInclude = true;
}
// else we don't know about it. Probably a system include of some sort.
}
}
}
}
void PropagateExternalIncludes(std::unordered_map<std::string, File>& files) {
bool foundChange;
do {
foundChange = false;
for (auto &fp : files) {
if (fp.second.hasExternalInclude && fp.second.component) {
for (auto &dep : fp.second.dependencies) {
if (!dep->hasExternalInclude && dep->component == fp.second.component) {
dep->hasExternalInclude = true;
foundChange = true;
}
}
}
}
} while (foundChange);
}
| 3,446 |
623 | // Copyright (C) 2020 The Android Open Source Project
//
// 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.google.gerrit.acceptance;
import static com.google.common.truth.Truth.assertThat;
import com.google.common.util.concurrent.AtomicLongMap;
import com.google.gerrit.entities.Account;
import com.google.gerrit.extensions.common.AccountInfo;
import com.google.gerrit.extensions.events.AccountIndexedListener;
/** Checks if an account is indexed the correct number of times. */
public class AccountIndexedCounter implements AccountIndexedListener {
private final AtomicLongMap<Integer> countsByAccount = AtomicLongMap.create();
@Override
public void onAccountIndexed(int id) {
countsByAccount.incrementAndGet(id);
}
public void clear() {
countsByAccount.clear();
}
public void assertReindexOf(TestAccount testAccount) {
assertReindexOf(testAccount, 1);
}
public void assertReindexOf(AccountInfo accountInfo) {
assertReindexOf(Account.id(accountInfo._accountId), 1);
}
public void assertReindexOf(TestAccount testAccount, long expectedCount) {
assertThat(countsByAccount.asMap()).containsExactly(testAccount.id().get(), expectedCount);
clear();
}
public void assertReindexOf(Account.Id accountId, long expectedCount) {
assertThat(countsByAccount.asMap()).containsEntry(accountId.get(), expectedCount);
countsByAccount.remove(accountId.get());
}
public void assertNoReindex() {
assertThat(countsByAccount.asMap()).isEmpty();
}
}
| 582 |
431 | <gh_stars>100-1000
""" Unit tests for input/output functions """
import numpy as np
import json
import mir_eval
import warnings
import nose.tools
import tempfile
def test_load_delimited():
# Test for ValueError when a non-string or file handle is passed
nose.tools.assert_raises(
IOError, mir_eval.io.load_delimited, None, [int])
# Test for a value error when the wrong number of columns is passed
with tempfile.TemporaryFile('r+') as f:
f.write('10 20')
f.seek(0)
nose.tools.assert_raises(
ValueError, mir_eval.io.load_delimited, f, [int, int, int])
# Test for a value error on conversion failure
with tempfile.TemporaryFile('r+') as f:
f.write('10 a 30')
f.seek(0)
nose.tools.assert_raises(
ValueError, mir_eval.io.load_delimited, f, [int, int, int])
def test_load_delimited_commented():
with tempfile.TemporaryFile('r+') as f:
f.write('; some comment\n10 20\n30 50')
f.seek(0)
col1, col2 = mir_eval.io.load_delimited(f, [int, int], comment=';')
assert np.allclose(col1, [10, 30])
assert np.allclose(col2, [20, 50])
# Rewind and try with the default comment character
f.seek(0)
nose.tools.assert_raises(
ValueError, mir_eval.io.load_delimited, f, [int, int])
# Rewind and try with no comment support
f.seek(0)
nose.tools.assert_raises(
ValueError, mir_eval.io.load_delimited, f, [int, int],
comment=None)
def test_load_delimited_nocomment():
with tempfile.TemporaryFile('r+') as f:
f.write('10 20\n30 50')
f.seek(0)
col1, col2 = mir_eval.io.load_delimited(f, [int, int])
assert np.allclose(col1, [10, 30])
assert np.allclose(col2, [20, 50])
# Rewind and try with a different comment char
f.seek(0)
col1, col2 = mir_eval.io.load_delimited(f, [int, int], comment=';')
assert np.allclose(col1, [10, 30])
assert np.allclose(col2, [20, 50])
# Rewind and try with no different comment string
f.seek(0)
col1, col2 = mir_eval.io.load_delimited(f, [int, int], comment=None)
assert np.allclose(col1, [10, 30])
assert np.allclose(col2, [20, 50])
def test_load_events():
# Test for a warning when invalid events are supplied
with tempfile.TemporaryFile('r+') as f:
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always')
# Non-increasing is invalid
f.write('10\n9')
f.seek(0)
events = mir_eval.io.load_events(f)
assert len(w) == 1
assert issubclass(w[-1].category, UserWarning)
assert (str(w[-1].message) ==
'Events should be in increasing order.')
# Make sure events were read in correctly
assert np.all(events == [10, 9])
def test_load_labeled_events():
# Test for a value error when invalid labeled events are supplied
with tempfile.TemporaryFile('r+') as f:
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always')
# Non-increasing is invalid
f.write('10 a\n9 b')
f.seek(0)
events, labels = mir_eval.io.load_labeled_events(f)
assert len(w) == 1
assert issubclass(w[-1].category, UserWarning)
assert (str(w[-1].message) ==
'Events should be in increasing order.')
# Make sure events were read in correctly
assert np.all(events == [10, 9])
# Make sure labels were read in correctly
assert labels == ['a', 'b']
def test_load_intervals():
# Test for a value error when invalid labeled events are supplied
with tempfile.TemporaryFile('r+') as f:
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always')
# Non-increasing is invalid
f.write('10 9\n9 10')
f.seek(0)
intervals = mir_eval.io.load_intervals(f)
assert len(w) == 1
assert issubclass(w[-1].category, UserWarning)
assert (str(w[-1].message) ==
'All interval durations must be strictly positive')
# Make sure intervals were read in correctly
assert np.all(intervals == [[10, 9], [9, 10]])
def test_load_labeled_intervals():
# Test for a value error when invalid labeled events are supplied
with tempfile.TemporaryFile('r+') as f:
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always')
# Non-increasing is invalid
f.write('10 9 a\n9 10 b')
f.seek(0)
intervals, labels = mir_eval.io.load_labeled_intervals(f)
assert len(w) == 1
assert issubclass(w[-1].category, UserWarning)
assert (str(w[-1].message) ==
'All interval durations must be strictly positive')
# Make sure intervals were read in correctly
assert np.all(intervals == [[10, 9], [9, 10]])
assert labels == ['a', 'b']
def test_load_valued_intervals():
# Test for a value error when invalid valued events are supplied
with tempfile.TemporaryFile('r+') as f:
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always')
# Non-increasing is invalid
f.write('10 9 5\n9 10 6')
f.seek(0)
intervals, values = mir_eval.io.load_valued_intervals(f)
assert len(w) == 1
assert issubclass(w[-1].category, UserWarning)
assert (str(w[-1].message) ==
'All interval durations must be strictly positive')
# Make sure intervals were read in correctly
assert np.all(intervals == [[10, 9], [9, 10]])
assert np.all(values == [5, 6])
def test_load_ragged_time_series():
# Test for ValueError when a non-string or file handle is passed
nose.tools.assert_raises(
IOError, mir_eval.io.load_ragged_time_series, None, float,
header=False)
# Test for a value error on conversion failure
with tempfile.TemporaryFile('r+') as f:
f.write('10 a 30')
f.seek(0)
nose.tools.assert_raises(
ValueError, mir_eval.io.load_ragged_time_series, f, float,
header=False)
# Test for a value error on invalid time stamp
with tempfile.TemporaryFile('r+') as f:
f.write('a 10 30')
f.seek(0)
nose.tools.assert_raises(
ValueError, mir_eval.io.load_ragged_time_series, f, int,
header=False)
# Test for a value error on invalid time stamp with header
with tempfile.TemporaryFile('r+') as f:
f.write('x y z\na 10 30')
f.seek(0)
nose.tools.assert_raises(
ValueError, mir_eval.io.load_ragged_time_series, f, int,
header=True)
with tempfile.TemporaryFile('r+') as f:
f.write('#comment\n0 1 2\n3 4\n# comment\n5 6 7')
f.seek(0)
times, values = mir_eval.io.load_ragged_time_series(f, int,
header=False,
comment='#')
assert np.allclose(times, [0, 3, 5])
assert np.allclose(values[0], [1, 2])
assert np.allclose(values[1], [4])
assert np.allclose(values[2], [6, 7])
# Rewind with a wrong comment string
f.seek(0)
nose.tools.assert_raises(
ValueError, mir_eval.io.load_ragged_time_series, f, int,
header=False, comment='%')
# Rewind with no comment string
f.seek(0)
nose.tools.assert_raises(
ValueError, mir_eval.io.load_ragged_time_series, f, int,
header=False, comment=None)
def test_load_tempo():
# Test the tempo loader
tempi, weight = mir_eval.io.load_tempo('data/tempo/ref01.lab')
assert np.allclose(tempi, [60, 120])
assert weight == 0.5
@nose.tools.raises(ValueError)
def test_load_tempo_multiline():
tempi, weight = mir_eval.io.load_tempo('data/tempo/bad00.lab')
@nose.tools.raises(ValueError)
def test_load_tempo_badweight():
tempi, weight = mir_eval.io.load_tempo('data/tempo/bad01.lab')
def test_load_bad_tempi():
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always')
tempi, weight = mir_eval.io.load_tempo('data/tempo/bad02.lab')
assert len(w) == 1
assert issubclass(w[-1].category, UserWarning)
assert ('non-negative numbers' in str(w[-1].message))
| 4,081 |
13,648 | <filename>ports/stm32/boards/NUCLEO_WB55/rfcore_debug.py<gh_stars>1000+
# This file is part of the MicroPython project, http://micropython.org/
#
# The MIT License (MIT)
#
# Copyright (c) 2020 <NAME>
# Copyright (c) 2020 <NAME>
#
# 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.
# This script provides some helpers to allow Python code to access the IPCC
# mechanism in the WB55, and works with the memory layout configured in
# ports/stm32/rfcore.c -- i.e. it expects that rfcore_init() has been run.
# e.g.
# ../../tools/pyboard.py --device /dev/ttyACM0 boards/NUCLEO_WB55/rfcore.py
# to print out SRAM2A, register state and FUS/WS info.
#
# The `stm` module provides some helper functions to access rfcore functionality.
# See rfcore_firmware.py for more information.
from machine import mem8, mem16, mem32
import stm
SRAM2A_BASE = const(0x2003_0000)
# for vendor OGF
OGF_VENDOR = const(0x3F)
OCF_FUS_GET_STATE = const(0x52)
OCF_FUS_FW_UPGRADE = const(0x54)
OCF_FUS_FW_DELETE = const(0x55)
OCF_FUS_START_WS = const(0x5A)
OCF_BLE_INIT = const(0x66)
TABLE_DEVICE_INFO = const(0)
TABLE_BLE = const(1)
TABLE_SYS = const(3)
TABLE_MEM_MANAGER = const(4)
CHANNEL_BLE = const(1)
CHANNEL_SYS = const(2)
CHANNEL_TRACES = const(4)
CHANNEL_ACL = const(6)
INDICATOR_HCI_COMMAND = const(0x01)
INDICATOR_HCI_EVENT = const(0x04)
INDICATOR_FUS_COMMAND = const(0x10)
INDICATOR_FUS_RESPONSE = const(0x11)
INDICATOR_FUS_EVENT = const(0x12)
MAGIC_FUS_ACTIVE = const(0xA94656B9)
def get_ipccdba():
return mem32[stm.FLASH + stm.FLASH_IPCCBR] & 0x3FFF
def get_ipcc_table(table):
return mem32[SRAM2A_BASE + get_ipccdba() + table * 4]
def get_ipcc_table_word(table, offset):
return mem32[get_ipcc_table(table) + offset * 4] & 0xFFFFFFFF
def get_ipcc_table_byte(table, offset):
return mem8[get_ipcc_table(table) + offset] & 0xFF
def sram2a_dump(num_words=64, width=8):
print("SRAM2A @%08x" % SRAM2A_BASE)
for i in range((num_words + width - 1) // width):
print(" %04x " % (i * 4 * width), end="")
for j in range(width):
print(" %08x" % (mem32[SRAM2A_BASE + (i * width + j) * 4] & 0xFFFFFFFF), end="")
print()
SYS_CMD_BUF = 0 # next*,prev*,type8,...; 272 bytes
SYS_SYS_QUEUE = 0 # next*,prev*
MM_BLE_SPARE_EVT_BUF = 0 # next*,prev*; 272 bytes
MM_SYS_SPARE_EVT_BUF = 0 # next*,prev*; 272 bytes
MM_BLE_POOL = 0 # ?
MM_BLE_POOL_SIZE = 0 # ?
MM_FREE_BUF_QUEUE = 0 # next*,prev*
MM_EV_POOL = 0 # ?
MM_EV_POOL_SIZE = 0 # ?
BLE_CMD_BUF = 0
BLE_CS_BUF = 0
BLE_EVT_QUEUE = 0
BLE_HCI_ACL_DATA_BUF = 0
def ipcc_init():
global SYS_CMD_BUF, SYS_SYS_QUEUE
SYS_CMD_BUF = get_ipcc_table_word(TABLE_SYS, 0)
SYS_SYS_QUEUE = get_ipcc_table_word(TABLE_SYS, 1)
global MM_BLE_SPARE_EVT_BUF, MM_SYS_SPARE_EVT_BUF, MM_BLE_POOL, MM_BLE_POOL_SIZE, MM_FREE_BUF_QUEUE, MM_EV_POOL, MM_EV_POOL_SIZE
MM_BLE_SPARE_EVT_BUF = get_ipcc_table_word(TABLE_MEM_MANAGER, 0)
MM_SYS_SPARE_EVT_BUF = get_ipcc_table_word(TABLE_MEM_MANAGER, 1)
MM_BLE_POOL = get_ipcc_table_word(TABLE_MEM_MANAGER, 2)
MM_BLE_POOL_SIZE = get_ipcc_table_word(TABLE_MEM_MANAGER, 3)
MM_FREE_BUF_QUEUE = get_ipcc_table_word(TABLE_MEM_MANAGER, 4)
MM_EV_POOL = get_ipcc_table_word(TABLE_MEM_MANAGER, 5)
MM_EV_POOL_SIZE = get_ipcc_table_word(TABLE_MEM_MANAGER, 6)
global BLE_CMD_BUF, BLE_CS_BUF, BLE_EVT_QUEUE, BLE_HCI_ACL_DATA_BUF
BLE_CMD_BUF = get_ipcc_table_word(TABLE_BLE, 0)
BLE_CS_BUF = get_ipcc_table_word(TABLE_BLE, 1)
BLE_EVT_QUEUE = get_ipcc_table_word(TABLE_BLE, 2)
BLE_HCI_ACL_DATA_BUF = get_ipcc_table_word(TABLE_BLE, 3)
# Disable interrupts, the code here uses polling
mem32[stm.IPCC + stm.IPCC_C1CR] = 0
print("IPCC initialised")
print("SYS: 0x%08x 0x%08x" % (SYS_CMD_BUF, SYS_SYS_QUEUE))
print("BLE: 0x%08x 0x%08x 0x%08x" % (BLE_CMD_BUF, BLE_CS_BUF, BLE_EVT_QUEUE))
def fus_active():
return get_ipcc_table_word(TABLE_DEVICE_INFO, 0) == MAGIC_FUS_ACTIVE
def info():
sfr = mem32[stm.FLASH + stm.FLASH_SFR]
srrvr = mem32[stm.FLASH + stm.FLASH_SRRVR]
print("IPCCDBA : 0x%08x" % (get_ipccdba() & 0x3FFF))
print("DDS : %r" % bool(sfr & (1 << 12)))
print("FSD : %r" % bool(sfr & (1 << 8)))
print("SFSA : 0x%08x" % (sfr & 0xFF))
print("C2OPT : %r" % bool(srrvr & (1 << 31)))
print("NBRSD : %r" % bool(srrvr & (1 << 30)))
print("SNBRSA : 0x%08x" % ((srrvr >> 25) & 0x1F))
print("BRSD : %r" % bool(srrvr & (1 << 23)))
print("SBRSA : 0x%08x" % ((srrvr >> 18) & 0x1F))
print("SBRV : 0x%08x" % (srrvr & 0x3FFFF))
def dev_info():
def dump_version(offset):
x = get_ipcc_table_word(TABLE_DEVICE_INFO, offset)
print(
"0x%08x (%u.%u.%u.%u.%u)"
% (x, x >> 24, x >> 16 & 0xFF, x >> 8 & 0xFF, x >> 4 & 0xF, x & 0xF)
)
def dump_memory_size(offset):
x = get_ipcc_table_word(TABLE_DEVICE_INFO, offset)
print(
"0x%08x (SRAM2b=%uk SRAM2a=%uk flash=%uk)"
% (x, x >> 24, x >> 16 & 0xFF, (x & 0xFF) * 4)
)
print("Device information table @%08x:" % get_ipcc_table(TABLE_DEVICE_INFO))
if fus_active():
# layout when running FUS
print("FUS is active")
print("state : 0x%08x" % get_ipcc_table_word(TABLE_DEVICE_INFO, 0))
print("last FUS active state : 0x%02x" % get_ipcc_table_byte(TABLE_DEVICE_INFO, 5))
print("last wireless stack state: 0x%02x" % get_ipcc_table_byte(TABLE_DEVICE_INFO, 6))
print("cur wireless stack type : 0x%02x" % get_ipcc_table_byte(TABLE_DEVICE_INFO, 7))
print("safe boot version : ", end="")
dump_version(2)
print("FUS version : ", end="")
dump_version(3)
print("FUS memory size : ", end="")
dump_memory_size(4)
print("wireless stack version : ", end="")
dump_version(5)
print("wireless stack mem size : ", end="")
dump_memory_size(6)
print("wireless FW-BLE info : 0x%08x" % get_ipcc_table_word(TABLE_DEVICE_INFO, 7))
print("wireless FW-thread info : 0x%08x" % get_ipcc_table_word(TABLE_DEVICE_INFO, 8))
print(
"UID64 : 0x%08x 0x%08x"
% (
get_ipcc_table_word(TABLE_DEVICE_INFO, 9),
get_ipcc_table_word(TABLE_DEVICE_INFO, 10),
)
)
print("device ID : 0x%04x" % get_ipcc_table_word(TABLE_DEVICE_INFO, 11))
else:
# layout when running WS
print("WS is active")
print("safe boot version : ", end="")
dump_version(0)
print("FUS version : ", end="")
dump_version(1)
print("FUS memory size : ", end="")
dump_memory_size(2)
print("FUS info : 0x%08x" % get_ipcc_table_word(TABLE_DEVICE_INFO, 3))
print("wireless stack version : ", end="")
dump_version(4)
print("wireless stack mem size : ", end="")
dump_memory_size(5)
print("wireless stack info : 0x%08x" % get_ipcc_table_word(TABLE_DEVICE_INFO, 7))
print("wireless reserved : 0x%08x" % get_ipcc_table_word(TABLE_DEVICE_INFO, 7))
def ipcc_state():
print("IPCC:")
print(" C1CR: 0x%08x" % (mem32[stm.IPCC + stm.IPCC_C1CR] & 0xFFFFFFFF), end="")
print(" C2CR: 0x%08x" % (mem32[stm.IPCC + stm.IPCC_C2CR] & 0xFFFFFFFF))
print(" C1MR: 0x%08x" % (mem32[stm.IPCC + stm.IPCC_C1MR] & 0xFFFFFFFF), end="")
print(" C2MR: 0x%08x" % (mem32[stm.IPCC + stm.IPCC_C2MR] & 0xFFFFFFFF))
# these always read 0
# print(' C1SCR: 0x%08x' % (mem32[stm.IPCC + stm.IPCC_C1SCR] & 0xffffffff), end='')
# print(' C2SCR: 0x%08x' % (mem32[stm.IPCC + stm.IPCC_C2SCR] & 0xffffffff))
print(" C1TOC2SR: 0x%08x" % (mem32[stm.IPCC + stm.IPCC_C1TOC2SR] & 0xFFFFFFFF), end="")
print(" C2TOC1SR: 0x%08x" % (mem32[stm.IPCC + stm.IPCC_C2TOC1SR] & 0xFFFFFFFF))
sram2a_dump(264)
ipcc_init()
info()
dev_info()
ipcc_state()
| 4,386 |
892 | <reponame>westonsteimel/advisory-database-github
{
"schema_version": "1.2.0",
"id": "GHSA-42q8-j57q-84vc",
"modified": "2022-05-01T23:34:27Z",
"published": "2022-05-01T23:34:27Z",
"aliases": [
"CVE-2008-0908"
],
"details": "SQL injection vulnerability in browse.asp in Schoolwires Academic Portal allows remote attackers to execute arbitrary SQL commands via the c parameter. NOTE: the provenance of this information is unknown; the details are obtained solely from third party information.",
"severity": [
],
"affected": [
],
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2008-0908"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/40687"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/29034"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/27903"
}
],
"database_specific": {
"cwe_ids": [
"CWE-89"
],
"severity": "HIGH",
"github_reviewed": false
}
} | 467 |
605 | // Purpose:
// Test that multiple \DexDeclareAddress references that point to different
// addresses can be used within a single \DexExpectWatchValue.
//
// REQUIRES: system-linux
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: multiple_address.cpp
int main() {
int *x = new int(5);
int *y = new int(4);
int *z = x;
*z = 0; // DexLabel('start_line')
z = y;
*z = 0;
delete x; // DexLabel('end_line')
delete y;
}
// DexDeclareAddress('x', 'x', on_line=ref('start_line'))
// DexDeclareAddress('y', 'y', on_line=ref('start_line'))
// DexExpectWatchValue('z', address('x'), address('y'), from_line=ref('start_line'), to_line=ref('end_line'))
// DexExpectWatchValue('*z', 5, 0, 4, 0, from_line=ref('start_line'), to_line=ref('end_line'))
| 316 |
810 | <filename>document/Android/app/src/main/java/com/example/nanchen/aiyaschoolpush/config/Consts.java
package com.example.nanchen.aiyaschoolpush.config;
/**
* @author nanchen
* @fileName AiYaSchoolPush
* @packageName com.example.nanchen.aiyaschoolpush.config
* @date 2016/11/09 11:34
*
* 系统常量定义类,此类仅放常量定义,不放任何逻辑代码
*
*/
public final class Consts {
/**
* 内网API接口主机名
*/
// public final static String API_SERVICE_HOST = "http://10.1.1.119:80/AiYaSchoolPush";
/**
* 外网API接口主机名
*/
public final static String API_SERVICE_HOST = "http://azhinj.ticp.io:10277/AiYaSchoolPush";
/**
* 用户是教师
*/
public final static int USER_TYPE_TEACHER = 2;
/**
* 用户是学生或家长
*/
public final static int USER_TYPE_STUDENT = 1;
}
| 425 |
1,564 | package org.modelmapper.functional.conditional;
import static org.testng.Assert.*;
import org.modelmapper.AbstractTest;
import org.modelmapper.Conditions;
import org.modelmapper.PropertyMap;
import org.testng.annotations.Test;
/**
* @author <NAME>
*/
@Test(groups = "functional")
public class ConditionalMapping1 extends AbstractTest {
static class Source {
public String getName() {
return null;
}
}
static class Dest {
String name = "abc";
}
public void shouldSkipConditionalTypeMapping() {
modelMapper.createTypeMap(Source.class, Dest.class).setCondition(Conditions.isNull());
Dest dest = modelMapper.map(new Source(), Dest.class);
assertEquals(dest.name, "abc");
}
public void shouldSkipConditionalPropertyMappingViaPropertyMap() {
modelMapper.addMappings(new PropertyMap<Source, Dest>() {
@Override
protected void configure() {
when(Conditions.isNull()).skip(source.getName(), destination.name);
}
});
Dest dest = modelMapper.map(new Source(), Dest.class);
assertEquals(dest.name, "abc");
}
}
| 374 |
892 | {
"schema_version": "1.2.0",
"id": "GHSA-wc26-f4h3-2vxx",
"modified": "2022-04-26T00:00:58Z",
"published": "2022-04-16T00:00:47Z",
"aliases": [
"CVE-2022-21159"
],
"details": "A denial of service vulnerability exists in the parseNormalModeParameters functionality of MZ Automation GmbH libiec61850 1.5.0. A specially-crafted series of network requests can lead to denial of service. An attacker can send a sequence of malformed iec61850 messages to trigger this vulnerability.",
"severity": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
}
],
"affected": [
],
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-21159"
},
{
"type": "WEB",
"url": "https://github.com/mz-automation/libiec61850/commit/cfa94cbf10302bedc779703f874ee2e8387a0721"
},
{
"type": "WEB",
"url": "https://talosintelligence.com/vulnerability_reports/TALOS-2022-1467"
},
{
"type": "WEB",
"url": "https://www.talosintelligence.com/vulnerability_reports/TALOS-2022-1467"
}
],
"database_specific": {
"cwe_ids": [
"CWE-835"
],
"severity": "HIGH",
"github_reviewed": false
}
} | 590 |
476 | <filename>arms/src/main/java/me/xiaobailong24/mvvmarms/base/ConfigArms.java
package me.xiaobailong24.mvvmarms.base;
import android.content.Context;
import me.xiaobailong24.mvvmarms.di.module.ArmsConfigModule;
/**
* @author xiaobailong24
* @date 2017/6/16
* 框架配置接口
*/
public interface ConfigArms {
/**
* 使用{@link ArmsConfigModule.Builder}给框架配置一些配置参数
*
* @param context: Context
* @param builder: ArmsConfigModule.Builder
*/
void applyOptions(Context context, ArmsConfigModule.Builder builder);
}
| 243 |
839 | <reponame>pdibenedetto/spring-cloud-function<filename>spring-cloud-function-context/src/main/java/org/springframework/cloud/function/utils/PrimitiveTypesFromStringMessageConverter.java
/*
* Copyright 2020-2020 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.cloud.function.utils;
import java.nio.charset.StandardCharsets;
import org.springframework.core.convert.ConversionService;
import org.springframework.lang.Nullable;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHeaders;
import org.springframework.messaging.converter.AbstractMessageConverter;
import org.springframework.util.MimeType;
/**
*
* @author <NAME>
* @since 3.1
*/
public class PrimitiveTypesFromStringMessageConverter extends AbstractMessageConverter {
private final ConversionService conversionService;
public PrimitiveTypesFromStringMessageConverter(ConversionService conversionService) {
super(new MimeType("text", "plain"));
this.conversionService = conversionService;
}
@Override
protected boolean supports(Class<?> clazz) {
return (Integer.class == clazz || Long.class == clazz);
}
@Override
protected Object convertFromInternal(Message<?> message, Class<?> targetClass, @Nullable Object conversionHint) {
return conversionService.convert(message.getPayload(), targetClass);
}
@Override
@Nullable
protected Object convertToInternal(Object payload, @Nullable MessageHeaders headers, @Nullable Object conversionHint) {
return payload.toString().getBytes(StandardCharsets.UTF_8);
}
}
| 592 |
494 | <reponame>jerryzhenleicai/Streams
#ifndef SCHEINERMAN_STREAM_PROVIDERS_SET_OPERATION_H
#define SCHEINERMAN_STREAM_PROVIDERS_SET_OPERATION_H
#include "StreamProvider.h"
namespace stream {
namespace provider {
template<typename T, typename Compare>
class SetOperation : public StreamProvider<T> {
public:
SetOperation(StreamProviderPtr<T> source1,
StreamProviderPtr<T> source2,
Compare&& comparator)
: comparator_(comparator),
source1_(std::move(source1)),
source2_(std::move(source2)) {}
std::shared_ptr<T> get() override {
return result_;
}
bool advance_impl() override {
if(depletion_ == DepleteState::Both) {
return false;
}
return perform_update();
}
PrintInfo print(std::ostream& os, int indent) const override {
this->print_indent(os, indent);
os << get_operation_name() << ":\n";
return source1_->print(os, indent + 1) +
source2_->print(os, indent + 1);
}
protected:
enum class ToAdvance {
First,
Second,
Both
};
enum class DepleteState {
Neither,
First,
Second,
Both
};
enum class UpdateState {
NotFinished,
UpdateFinished,
StreamFinished
};
std::shared_ptr<T> get_current1() {
return current1_;
}
std::shared_ptr<T> get_current2() {
return current2_;
}
void set_result(std::shared_ptr<T> result) {
result_ = result;
}
void set_advance(ToAdvance advance) {
advance_ = advance;
}
void set_deplete(DepleteState depletion) {
depletion_ = depletion;
}
bool current1_smaller() {
return comparator_(*current1_, *current2_);
}
bool current2_smaller() {
return comparator_(*current2_, *current1_);
}
virtual void on_first_source_advance() {}
virtual void on_second_source_advance() {}
virtual void before_update() {}
virtual UpdateState if_neither_depleted() = 0;
virtual UpdateState if_first_depleted() {
set_result(current2_);
return UpdateState::UpdateFinished;
}
virtual UpdateState if_second_depleted() {
set_result(current1_);
return UpdateState::UpdateFinished;
}
virtual UpdateState if_both_depleted() {
return UpdateState::StreamFinished;
}
virtual std::string get_operation_name() const = 0;
private:
ToAdvance advance_ = ToAdvance::Both;
DepleteState depletion_ = DepleteState::Neither;
Compare comparator_;
StreamProviderPtr<T> source1_;
StreamProviderPtr<T> source2_;
std::shared_ptr<T> current1_;
std::shared_ptr<T> current2_;
std::shared_ptr<T> result_;
bool allow_duplicates_;
void advance_stream(StreamProviderPtr<T>& source,
std::shared_ptr<T>& current,
DepleteState deplete_state,
ToAdvance advance_result) {
if(source->advance()) {
current = source->get();
} else {
current.reset();
if(depletion_ == DepleteState::Neither) {
depletion_ = deplete_state;
advance_ = advance_result;
} else {
depletion_ = DepleteState::Both;
}
}
}
void advance_first() {
advance_stream(source1_, current1_, DepleteState::First,
ToAdvance::Second);
on_first_source_advance();
}
void advance_second() {
advance_stream(source2_, current2_, DepleteState::Second,
ToAdvance::First);
on_second_source_advance();
}
void perform_advance() {
switch(advance_) {
case ToAdvance::First:
advance_first();
break;
case ToAdvance::Second:
advance_second();
break;
case ToAdvance::Both:
advance_first();
advance_second();
break;
}
}
bool perform_update() {
before_update();
while(true) {
perform_advance();
UpdateState state;
if(depletion_ == DepleteState::Neither) {
state = if_neither_depleted();
} else if(depletion_ == DepleteState::First) {
state = if_first_depleted();
} else if(depletion_ == DepleteState::Second) {
state = if_second_depleted();
} else { // depletion_ == DepleteState::Both
state = if_both_depleted();
}
if(state == UpdateState::UpdateFinished) {
return true;
} else if(state == UpdateState::StreamFinished) {
return false;
} else if(state == UpdateState::NotFinished) {
continue;
}
}
}
};
} /* namespace provider */
} /* namespace stream */
#endif
| 2,369 |
3,212 | /*
* 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.nifi.registry.web.api;
import org.apache.nifi.registry.NiFiRegistryTestApiApplication;
import org.apache.nifi.registry.authorization.AccessPolicy;
import org.apache.nifi.registry.authorization.User;
import org.apache.nifi.registry.authorization.UserGroup;
import org.apache.nifi.registry.bucket.Bucket;
import org.apache.nifi.registry.client.BucketClient;
import org.apache.nifi.registry.client.NiFiRegistryClient;
import org.apache.nifi.registry.client.NiFiRegistryClientConfig;
import org.apache.nifi.registry.client.PoliciesClient;
import org.apache.nifi.registry.client.TenantsClient;
import org.apache.nifi.registry.client.impl.JerseyNiFiRegistryClient;
import org.apache.nifi.registry.revision.entity.RevisionInfo;
import org.apache.nifi.registry.security.authorization.RequestAction;
import org.apache.nifi.registry.security.authorization.resource.ResourceFactory;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.jdbc.Sql;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@RunWith(SpringRunner.class)
@SpringBootTest(
classes = NiFiRegistryTestApiApplication.class,
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
properties = "spring.profiles.include=ITSecureDatabase")
@Import(SecureITClientConfiguration.class)
@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:db/clearDB.sql"})
public class SecureDatabaseIT extends IntegrationTestBase {
private static final Logger LOGGER = LoggerFactory.getLogger(SecureDatabaseIT.class);
private static final String INITIAL_ADMIN_IDENTITY = "CN=user1, OU=nifi";
private static final String OTHER_USER_IDENTITY = "CN=user2, OU=nifi";
private NiFiRegistryClient client;
@Before
public void setup() {
final String baseUrl = createBaseURL();
LOGGER.info("Using base url = " + baseUrl);
final NiFiRegistryClientConfig clientConfig = createClientConfig(baseUrl);
Assert.assertNotNull(clientConfig);
final NiFiRegistryClient client = new JerseyNiFiRegistryClient.Builder()
.config(clientConfig)
.build();
Assert.assertNotNull(client);
this.client = client;
}
@After
public void teardown() {
try {
client.close();
} catch (Exception e) {
}
}
@Test
public void testTenantsClientUsers() throws Exception {
final TenantsClient tenantsClient = client.getTenantsClient();
// get all users
final List<User> users = tenantsClient.getUsers();
assertEquals(2, users.size());
final User initialAdminUser = users.stream()
.filter(u -> u.getIdentity().equals(INITIAL_ADMIN_IDENTITY))
.findFirst()
.orElse(null);
assertNotNull(initialAdminUser);
// get user by id
final User retrievedInitialAdminUser = tenantsClient.getUser(initialAdminUser.getIdentifier());
assertNotNull(retrievedInitialAdminUser);
assertEquals(initialAdminUser.getIdentity(), retrievedInitialAdminUser.getIdentity());
// add user
final User userToAdd = new User();
userToAdd.setIdentity("some-<PASSWORD>");
userToAdd.setRevision(new RevisionInfo(null, 0L));
final User createdUser = tenantsClient.createUser(userToAdd);
assertNotNull(createdUser);
assertEquals(3, tenantsClient.getUsers().size());
// update user
createdUser.setIdentity(createdUser.getIdentity() + "-updated");
final User updatedUser = tenantsClient.updateUser(createdUser);
assertNotNull(updatedUser);
assertEquals(createdUser.getIdentity(), updatedUser.getIdentity());
// delete user
final User deletedUser = tenantsClient.deleteUser(updatedUser.getIdentifier(), updatedUser.getRevision());
assertNotNull(deletedUser);
assertEquals(updatedUser.getIdentifier(), deletedUser.getIdentifier());
}
@Test
public void testTenantsClientGroups() throws Exception {
final TenantsClient tenantsClient = client.getTenantsClient();
// get all groups
final List<UserGroup> groups = tenantsClient.getUserGroups();
assertEquals(0, groups.size());
// create group
final UserGroup userGroup = new UserGroup();
userGroup.setIdentity("some-new group");
userGroup.setRevision(new RevisionInfo(null, 0L));
final UserGroup createdGroup = tenantsClient.createUserGroup(userGroup);
assertNotNull(createdGroup);
assertEquals(userGroup.getIdentity(), createdGroup.getIdentity());
// get group by id
final UserGroup retrievedGroup = tenantsClient.getUserGroup(createdGroup.getIdentifier());
assertNotNull(retrievedGroup);
assertEquals(createdGroup.getIdentifier(), retrievedGroup.getIdentifier());
// update group
retrievedGroup.setIdentity(retrievedGroup.getIdentity() + "-updated");
final UserGroup updatedGroup = tenantsClient.updateUserGroup(retrievedGroup);
assertEquals(retrievedGroup.getIdentity(), updatedGroup.getIdentity());
// delete group
final UserGroup deletedGroup = tenantsClient.deleteUserGroup(updatedGroup.getIdentifier(), updatedGroup.getRevision());
assertNotNull(deletedGroup);
assertEquals(retrievedGroup.getIdentifier(), deletedGroup.getIdentifier());
}
@Test
public void testPoliciesClient() throws Exception {
// Create a bucket...
final Bucket bucket = new Bucket();
bucket.setName("Bucket 1 " + System.currentTimeMillis());
bucket.setDescription("This is bucket 1");
bucket.setRevision(new RevisionInfo(null, 0L));
final BucketClient bucketClient = client.getBucketClient();
final Bucket createdBucket = bucketClient.create(bucket);
assertNotNull(createdBucket);
assertNotNull(createdBucket.getIdentifier());
assertNotNull(createdBucket.getRevision());
// Get initial users...
final TenantsClient tenantsClient = client.getTenantsClient();
final List<User> users = tenantsClient.getUsers();
assertEquals(2, users.size());
final User initialAdminUser = users.stream()
.filter(u -> u.getIdentity().equals(INITIAL_ADMIN_IDENTITY))
.findFirst()
.orElse(null);
assertNotNull(initialAdminUser);
final User otherUser = users.stream()
.filter(u -> u.getIdentity().equals(OTHER_USER_IDENTITY))
.findFirst()
.orElse(null);
assertNotNull(otherUser);
// Create a policy on the bucket...
final PoliciesClient policiesClient = client.getPoliciesClient();
final AccessPolicy readBucketAccessPolicy = new AccessPolicy();
readBucketAccessPolicy.setResource(ResourceFactory.getBucketResource(
createdBucket.getIdentifier(), createdBucket.getName())
.getIdentifier());
readBucketAccessPolicy.setAction(RequestAction.READ.toString());
readBucketAccessPolicy.setUsers(Collections.singleton(initialAdminUser));
readBucketAccessPolicy.setRevision(new RevisionInfo(null, 0L));
final AccessPolicy createdAccessPolicy = policiesClient.createAccessPolicy(readBucketAccessPolicy);
assertNotNull(createdAccessPolicy);
assertEquals(readBucketAccessPolicy.getAction(), createdAccessPolicy.getAction());
assertEquals(readBucketAccessPolicy.getResource(), createdAccessPolicy.getResource());
assertEquals(1, createdAccessPolicy.getUsers().size());
assertEquals(INITIAL_ADMIN_IDENTITY, createdAccessPolicy.getUsers().iterator().next().getIdentity());
assertEquals(1, createdAccessPolicy.getRevision().getVersion().longValue());
// Retrieve the policy by action + resource
final AccessPolicy retrievedAccessPolicy = policiesClient.getAccessPolicy(
createdAccessPolicy.getAction(), createdAccessPolicy.getResource());
assertNotNull(retrievedAccessPolicy);
assertEquals(createdAccessPolicy.getAction(), retrievedAccessPolicy.getAction());
assertEquals(createdAccessPolicy.getResource(), retrievedAccessPolicy.getResource());
assertEquals(1, retrievedAccessPolicy.getUsers().size());
assertEquals(INITIAL_ADMIN_IDENTITY, retrievedAccessPolicy.getUsers().iterator().next().getIdentity());
assertEquals(1, retrievedAccessPolicy.getRevision().getVersion().longValue());
// Update the policy
retrievedAccessPolicy.setUsers(new HashSet<>(Arrays.asList(initialAdminUser, otherUser)));
final AccessPolicy updatedAccessPolicy = policiesClient.updateAccessPolicy(retrievedAccessPolicy);
assertNotNull(updatedAccessPolicy);
assertEquals(retrievedAccessPolicy.getAction(), updatedAccessPolicy.getAction());
assertEquals(retrievedAccessPolicy.getResource(), updatedAccessPolicy.getResource());
assertEquals(2, updatedAccessPolicy.getUsers().size());
assertEquals(2, updatedAccessPolicy.getRevision().getVersion().longValue());
}
}
| 3,677 |
971 | <filename>src/execution/compiler/expression/unary_translator.cpp
#include "execution/compiler/expression/unary_translator.h"
#include "common/error/exception.h"
#include "execution/compiler/compilation_context.h"
#include "execution/compiler/work_context.h"
#include "parser/expression/operator_expression.h"
namespace noisepage::execution::compiler {
UnaryTranslator::UnaryTranslator(const parser::OperatorExpression &expr, CompilationContext *compilation_context)
: ExpressionTranslator(expr, compilation_context) {
compilation_context->Prepare(*expr.GetChild(0));
}
ast::Expr *UnaryTranslator::DeriveValue(WorkContext *ctx, const ColumnValueProvider *provider) const {
auto *codegen = GetCodeGen();
auto input = ctx->DeriveValue(*GetExpression().GetChild(0), provider);
parsing::Token::Type type;
switch (GetExpression().GetExpressionType()) {
case parser::ExpressionType::OPERATOR_UNARY_MINUS:
type = parsing::Token::Type::MINUS;
break;
case parser::ExpressionType::OPERATOR_NOT:
type = parsing::Token::Type::BANG;
break;
default:
UNREACHABLE("Unsupported expression");
}
return codegen->UnaryOp(type, input);
}
} // namespace noisepage::execution::compiler
| 412 |
988 | <filename>deps/GraphBLAS/GraphBLAS/@GrB/private/util/gb_mxarray_to_list.c<gh_stars>100-1000
//------------------------------------------------------------------------------
// gb_mxarray_to_list: convert a built-in array to a list of integers
//------------------------------------------------------------------------------
// SuiteSparse:GraphBLAS, <NAME>, (c) 2017-2021, All Rights Reserved.
// SPDX-License-Identifier: GPL-3.0-or-later
//------------------------------------------------------------------------------
// The built-in list may be double, int64, or uint64. If double or 1-based
// int64, a new integer list is created, and the 1-based input list is
// converted to the 0-based integer list.
// mxGetData is used instead of the MATLAB-recommended mxGetDoubles, etc,
// because mxGetData works best for Octave, and it works fine for MATLAB
// since GraphBLAS requires R2018a with the interleaved complex data type.
#include "gb_interface.h"
int64_t *gb_mxarray_to_list // return List of integers
(
const mxArray *mxList, // list to extract
base_enum_t base, // input is zero-based or one-based
bool *allocated, // true if output list was allocated
int64_t *len, // length of list
int64_t *List_max // max entry in the list, if computed
)
{
//--------------------------------------------------------------------------
// check inputs
//--------------------------------------------------------------------------
CHECK_ERROR (!mxIsNumeric (mxList), "index list must be numeric") ;
CHECK_ERROR (mxIsSparse (mxList), "index list cannot be sparse") ;
CHECK_ERROR (mxIsComplex (mxList), "index list cannot be complex") ;
//--------------------------------------------------------------------------
// get the length and class of the built-in list
//--------------------------------------------------------------------------
(*len) = mxGetNumberOfElements (mxList) ;
mxClassID class = mxGetClassID (mxList) ;
//--------------------------------------------------------------------------
// extract the contents and convert to int64_t
//--------------------------------------------------------------------------
(*List_max) = -1 ;
bool zerobased = (base == BASE_0_INT64) ;
if (*len == 0)
{
(*allocated) = true ;
int64_t *List = (int64_t *) mxMalloc (1 * sizeof (int64_t)) ;
List [0] = 0 ;
return (List) ;
}
else if (class == mxINT64_CLASS && zerobased)
{
// input list is int64; just return a shallow pointer
(*allocated) = false ;
return ((int64_t *) mxGetData (mxList)) ;
}
else if (class == mxUINT64_CLASS && zerobased)
{
// input list is uint64; just return a shallow pointer
(*allocated) = false ;
return ((int64_t *) mxGetData (mxList)) ;
}
else if (class == mxINT64_CLASS || class == mxUINT64_CLASS ||
class == mxDOUBLE_CLASS)
{
// input list 1-based: decrement to convert to 0-based
(*allocated) = true ;
int64_t *List = mxMalloc ((*len) * sizeof (int64_t)) ;
if (class == mxDOUBLE_CLASS)
{
// input list is 1-based double
double *List_double = (double *) mxGetData (mxList) ;
CHECK_ERROR (List_double == NULL, "index list must be integer") ;
bool ok = GB_helper3 (List, List_double, (*len), List_max) ;
CHECK_ERROR (!ok, "index must be integer") ;
}
else if (class == mxINT64_CLASS)
{
// input list is 1-based int64
int64_t *List_int64 = (int64_t *) mxGetData (mxList) ;
GB_helper3i (List, List_int64, (*len), List_max) ;
}
else // if (class == mxUINT64_CLASS)
{
// input list is 1-based uint64
int64_t *List_int64 = (int64_t *) mxGetData (mxList) ;
GB_helper3i (List, List_int64, (*len), List_max) ;
}
return (List) ;
}
else
{
ERROR ("integer array must be double, int64, or uint64") ;
return (NULL) ;
}
}
| 1,577 |
416 | <gh_stars>100-1000
package org.simpleflatmapper.reflect.test.asm;
import org.junit.Test;
import org.simpleflatmapper.reflect.asm.AsmInstantiatorDefinitionFactory;
import org.simpleflatmapper.reflect.instantiator.ExecutableInstantiatorDefinition;
import org.simpleflatmapper.reflect.InstantiatorDefinition;
import org.simpleflatmapper.tuple.Tuple2;
import org.simpleflatmapper.tuple.Tuples;
import org.simpleflatmapper.test.beans.DbFinalObject;
import org.simpleflatmapper.test.beans.DbObject;
import org.simpleflatmapper.test.beans.DbObject.Type;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import static org.junit.Assert.assertEquals;
public class AsmInstantiatorDefinitionFactoryTest {
@Test
public void testExtractConstructorsDbObject() throws IOException, NoSuchMethodException, SecurityException {
List<InstantiatorDefinition> dbObjectConstructors = AsmInstantiatorDefinitionFactory.extractDefinitions(DbObject.class);
assertEquals(3, dbObjectConstructors.size());
assertEquals(0, dbObjectConstructors.get(0).getParameters().length);
assertEquals(DbObject.class.getConstructor(), ((ExecutableInstantiatorDefinition)dbObjectConstructors.get(0)).getExecutable());
}
@Test
public void testExtractConstructorsFinalDbObject() throws IOException, NoSuchMethodException, SecurityException {
List<InstantiatorDefinition> finalDbObjectConstructors = AsmInstantiatorDefinitionFactory.extractDefinitions(DbFinalObject.class);
assertEquals(2, finalDbObjectConstructors.size());
assertEquals(6, finalDbObjectConstructors.get(0).getParameters().length);
assertEquals(long.class, finalDbObjectConstructors.get(0).getParameters()[0].getType());
assertEquals(String.class, finalDbObjectConstructors.get(0).getParameters()[1].getType());
assertEquals(String.class, finalDbObjectConstructors.get(0).getParameters()[2].getType());
assertEquals(Date.class, finalDbObjectConstructors.get(0).getParameters()[3].getType());
assertEquals(Type.class, finalDbObjectConstructors.get(0).getParameters()[4].getType());
assertEquals(Type.class, finalDbObjectConstructors.get(0).getParameters()[5].getType());
assertEquals("id", finalDbObjectConstructors.get(0).getParameters()[0].getName());
assertEquals("name", finalDbObjectConstructors.get(0).getParameters()[1].getName());
assertEquals("email", finalDbObjectConstructors.get(0).getParameters()[2].getName());
assertEquals("creationTime", finalDbObjectConstructors.get(0).getParameters()[3].getName());
assertEquals("typeOrdinal", finalDbObjectConstructors.get(0).getParameters()[4].getName());
assertEquals("typeName", finalDbObjectConstructors.get(0).getParameters()[5].getName());
assertEquals(DbFinalObject.class.getConstructor(long.class, String.class, String.class, Date.class, Type.class, Type.class),
((ExecutableInstantiatorDefinition)finalDbObjectConstructors.get(0)).getExecutable());
}
@Test
public void testExtractConstructorsTuple2() throws IOException, NoSuchMethodException, SecurityException {
List<InstantiatorDefinition> finalDbObjectConstructors = AsmInstantiatorDefinitionFactory.extractDefinitions(Tuples.typeDef(String.class, DbObject.class));
assertEquals(1, finalDbObjectConstructors.size());
assertEquals(2, finalDbObjectConstructors.get(0).getParameters().length);
assertEquals(Object.class, finalDbObjectConstructors.get(0).getParameters()[0].getType());
assertEquals(Object.class, finalDbObjectConstructors.get(0).getParameters()[1].getType());
assertEquals(String.class, finalDbObjectConstructors.get(0).getParameters()[0].getGenericType());
assertEquals(DbObject.class, finalDbObjectConstructors.get(0).getParameters()[1].getGenericType());
assertEquals("element0", finalDbObjectConstructors.get(0).getParameters()[0].getName());
assertEquals("element1", finalDbObjectConstructors.get(0).getParameters()[1].getName());
assertEquals(Tuple2.class.getConstructor(Object.class, Object.class),
((ExecutableInstantiatorDefinition)finalDbObjectConstructors.get(0)).getExecutable());
}
}
| 1,264 |
634 | /****************************************************************
* 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.james.backends.cassandra.init.configuration;
import java.util.Objects;
import com.google.common.base.Preconditions;
public class KeyspaceConfiguration {
public interface Builder {
@FunctionalInterface
interface RequireKeyspace {
RequireReplicationFactor keyspace(String name);
}
@FunctionalInterface
interface RequireReplicationFactor {
RequireDurableWrites replicationFactor(int replicationFactor);
}
@FunctionalInterface
interface RequireDurableWrites {
KeyspaceConfiguration durableWrites(boolean durableWrites);
default KeyspaceConfiguration disableDurableWrites() {
return durableWrites(false);
}
}
}
private static final String DEFAULT_KEYSPACE = "apache_james";
private static final int DEFAULT_REPLICATION_FACTOR = 1;
private static final boolean DEFAULT_SSL = false;
public static Builder.RequireKeyspace builder() {
return name -> replicationFactor -> durableWrites -> new KeyspaceConfiguration(name, replicationFactor, durableWrites);
}
private final String keyspace;
private final int replicationFactor;
private final boolean durableWrites;
public KeyspaceConfiguration(String keyspace, int replicationFactor, boolean durableWrites) {
Preconditions.checkArgument(replicationFactor > 0, "'' needs to be strictly positive");
this.keyspace = keyspace;
this.replicationFactor = replicationFactor;
this.durableWrites = durableWrites;
}
public boolean isDurableWrites() {
return durableWrites;
}
public String getKeyspace() {
return keyspace;
}
public int getReplicationFactor() {
return replicationFactor;
}
@Override
public final boolean equals(Object o) {
if (o instanceof KeyspaceConfiguration) {
KeyspaceConfiguration that = (KeyspaceConfiguration) o;
return Objects.equals(this.keyspace, that.keyspace)
&& Objects.equals(this.replicationFactor, that.replicationFactor)
&& Objects.equals(this.durableWrites, that.durableWrites);
}
return false;
}
@Override
public final int hashCode() {
return Objects.hash(keyspace, replicationFactor, durableWrites);
}
}
| 1,316 |
445 | from instascrape.scrapers import * | 10 |
892 | <filename>advisories/github-reviewed/2021/08/GHSA-vj88-5667-w56p/GHSA-vj88-5667-w56p.json
{
"schema_version": "1.2.0",
"id": "GHSA-vj88-5667-w56p",
"modified": "2021-08-24T17:44:58Z",
"published": "2021-08-25T21:00:11Z",
"withdrawn": "2021-08-24T17:44:58Z",
"aliases": [
],
"summary": "Singleton lacks bounds on Send and Sync.",
"details": "`Singleton<T>` is meant to be a static object that can be initialized lazily. In\norder to satisfy the requirement that `static` items must implement `Sync`,\n`Singleton` implemented both `Sync` and `Send` unconditionally.\n\nThis allows for a bug where non-`Sync` types such as `Cell` can be used in\nsingletons and cause data races in concurrent programs.\n\nThe flaw was corrected in commit `b0d2bd20e` by adding trait bounds, requiring\nthe contaiend type to implement `Sync`.\n",
"severity": [
],
"affected": [
{
"package": {
"ecosystem": "crates.io",
"name": "ruspiro-singleton"
},
"ranges": [
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "0"
},
{
"fixed": "0.4.1"
}
]
}
]
}
],
"references": [
{
"type": "WEB",
"url": "https://github.com/RusPiRo/ruspiro-singleton/issues/10"
},
{
"type": "WEB",
"url": "https://rustsec.org/advisories/RUSTSEC-2020-0115.html"
},
{
"type": "PACKAGE",
"url": "https://github.com/RusPiRo/ruspiro-singleton"
}
],
"database_specific": {
"cwe_ids": [
"CWE-362"
],
"severity": "MODERATE",
"github_reviewed": true
}
} | 804 |
615 | # 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.
from oslo_config import cfg
import passlib.utils
from keystone.conf import utils
default_domain_id = cfg.StrOpt(
'default_domain_id',
default='default',
help=utils.fmt("""
This references the domain to use for all Identity API v2 requests (which are
not aware of domains). A domain with this ID can optionally be created for you
by `keystone-manage bootstrap`. The domain referenced by this ID cannot be
deleted on the v3 API, to prevent accidentally breaking the v2 API. There is
nothing special about this domain, other than the fact that it must exist to
order to maintain support for your v2 clients. There is typically no reason to
change this value.
"""))
domain_specific_drivers_enabled = cfg.BoolOpt(
'domain_specific_drivers_enabled',
default=False,
help=utils.fmt("""
A subset (or all) of domains can have their own identity driver, each with
their own partial configuration options, stored in either the resource backend
or in a file in a domain configuration directory (depending on the setting of
`[identity] domain_configurations_from_database`). Only values specific to the
domain need to be specified in this manner. This feature is disabled by
default, but may be enabled by default in a future release; set to true to
enable.
"""))
domain_configurations_from_database = cfg.BoolOpt(
'domain_configurations_from_database',
default=False,
help=utils.fmt("""
By default, domain-specific configuration data is read from files in the
directory identified by `[identity] domain_config_dir`. Enabling this
configuration option allows you to instead manage domain-specific
configurations through the API, which are then persisted in the backend
(typically, a SQL database), rather than using configuration files on disk.
"""))
domain_config_dir = cfg.StrOpt(
'domain_config_dir',
default='/etc/keystone/domains',
help=utils.fmt("""
Absolute path where keystone should locate domain-specific `[identity]`
configuration files. This option has no effect unless `[identity]
domain_specific_drivers_enabled` is set to true. There is typically no reason
to change this value.
"""))
driver = cfg.StrOpt(
'driver',
default='sql',
help=utils.fmt("""
Entry point for the identity backend driver in the `keystone.identity`
namespace. Keystone provides a `sql` and `ldap` driver. This option is also
used as the default driver selection (along with the other configuration
variables in this section) in the event that `[identity]
domain_specific_drivers_enabled` is enabled, but no applicable domain-specific
configuration is defined for the domain in question. Unless your deployment
primarily relies on `ldap` AND is not using domain-specific configuration, you
should typically leave this set to `sql`.
"""))
caching = cfg.BoolOpt(
'caching',
default=True,
help=utils.fmt("""
Toggle for identity caching. This has no effect unless global caching is
enabled. There is typically no reason to disable this.
"""))
cache_time = cfg.IntOpt(
'cache_time',
default=600,
help=utils.fmt("""
Time to cache identity data (in seconds). This has no effect unless global and
identity caching are enabled.
"""))
max_password_length = cfg.IntOpt(
'max_password_length',
default=4096,
max=passlib.utils.MAX_PASSWORD_SIZE,
help=utils.fmt("""
Maximum allowed length for user passwords. Decrease this value to improve
performance. Changing this value does not effect existing passwords.
"""))
list_limit = cfg.IntOpt(
'list_limit',
help=utils.fmt("""
Maximum number of entities that will be returned in an identity collection.
"""))
password_hash_algorithm = cfg.StrOpt(
'password_hash_algorithm',
choices=['bcrypt', 'scrypt', 'pbkdf2_sha512'],
default='bcrypt',
help=utils.fmt("""
The password hashing algorithm to use for passwords stored within keystone.
"""))
password_hash_rounds = cfg.IntOpt(
'password_hash_rounds',
help=utils.fmt("""
This option represents a trade off between security and performance. Higher
values lead to slower performance, but higher security. Changing this option
will only affect newly created passwords as existing password hashes already
have a fixed number of rounds applied, so it is safe to tune this option in a
running cluster.
The default for bcrypt is 12, must be between 4 and 31, inclusive.
The default for scrypt is 16, must be within `range(1,32)`.
The default for pbkdf_sha512 is 60000, must be within `range(1,1<<32)`
WARNING: If using scrypt, increasing this value increases BOTH time AND
memory requirements to hash a password.
"""))
salt_bytesize = cfg.IntOpt(
'salt_bytesize',
min=0,
max=96,
help=utils.fmt("""
Number of bytes to use in scrypt and pbkfd2_sha512 hashing salt.
Default for scrypt is 16 bytes.
Default for pbkfd2_sha512 is 16 bytes.
Limited to a maximum of 96 bytes due to the size of the column used to store
password hashes.
"""))
scrypt_block_size = cfg.IntOpt(
'scrypt_block_size',
help=utils.fmt("""
Optional block size to pass to scrypt hash function (the `r` parameter).
Useful for tuning scrypt to optimal performance for your CPU architecture.
This option is only used when the `password_hash_algorithm` option is set
to `scrypt`. Defaults to 8.
"""))
scrypt_paralellism = cfg.IntOpt(
'scrypt_parallelism',
help=utils.fmt("""
Optional parallelism to pass to scrypt hash function (the `p` parameter).
This option is only used when the `password_hash_algorithm` option is set
to `scrypt`. Defaults to 1.
"""))
GROUP_NAME = __name__.split('.')[-1]
ALL_OPTS = [
default_domain_id,
domain_specific_drivers_enabled,
domain_configurations_from_database,
domain_config_dir,
driver,
caching,
cache_time,
max_password_length,
list_limit,
password_hash_algorithm,
password_hash_rounds,
scrypt_block_size,
scrypt_paralellism,
salt_bytesize,
]
def register_opts(conf):
conf.register_opts(ALL_OPTS, group=GROUP_NAME)
def list_opts():
return {GROUP_NAME: ALL_OPTS}
| 2,003 |
683 | <reponame>aschugunov/opentelemetry-java-instrumentation
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.javaagent.benchmark.servlet.app;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloWorldController {
@GetMapping("/")
public String root() {
return "Hello world!";
}
}
| 149 |
1,858 | package com.dtstack.flink.sql.sink.kafka.serialization;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.avro.LogicalTypes;
import org.apache.avro.Schema;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.types.Row;
import org.junit.Before;
import org.junit.Test;
import org.powermock.api.mockito.PowerMockito;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Map;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class AvroTuple2SerializationSchemaTest {
private AvroTuple2SerializationSchema avroTuple2SerializationSchema;
@Before
public void init(){
String schemaString = "{\"type\":\"record\",\"name\":\"MyResult\",\"fields\":[{\"name\":\"channel\",\"type\":\"string\"}]}";
avroTuple2SerializationSchema = new AvroTuple2SerializationSchema(schemaString,"upsert");
}
@Test
public void serialize(){
Row row = new Row(1);
row.setField(0, "1");
avroTuple2SerializationSchema.serialize(new Tuple2<>(true, row));
avroTuple2SerializationSchema.equals(avroTuple2SerializationSchema);
avroTuple2SerializationSchema.equals(null);
}
@Test
public void convertFlinkType() throws Exception {
Schema schema = PowerMockito.mock(Schema.class);
when(schema.getType()).thenReturn(Schema.Type.RECORD);
Method method = AvroTuple2SerializationSchema.class.getDeclaredMethod("convertFlinkType", Schema.class, Object.class);
method.setAccessible(true);
method.invoke(avroTuple2SerializationSchema,schema, null);
Row row = new Row(1);
row.setField(0, "1");
when(schema.getFields()).thenReturn(Lists.newArrayList());
method.invoke(avroTuple2SerializationSchema,schema, row);
when(schema.getType()).thenReturn(Schema.Type.ENUM);
method.invoke(avroTuple2SerializationSchema,schema, "test");
Schema schema1 = mock(Schema.class);
when(schema1.getType()).thenReturn(Schema.Type.ARRAY);
when(schema1.getElementType()).thenReturn(schema);
method.invoke(avroTuple2SerializationSchema,schema, new int[]{1});
Schema schema2 = mock(Schema.class);
when(schema2.getType()).thenReturn(Schema.Type.ARRAY);
when(schema2.getValueType()).thenReturn(schema);
Map meta = Maps.newHashMap();
meta.put("key", "value");
method.invoke(avroTuple2SerializationSchema,schema, meta);
when(schema.getType()).thenReturn(Schema.Type.UNION);
when(schema.getTypes()).thenReturn(Lists.newArrayList());
method.invoke(avroTuple2SerializationSchema,schema, "1".getBytes());
when(schema.getType()).thenReturn(Schema.Type.FIXED);
method.invoke(avroTuple2SerializationSchema,schema, "1".getBytes());
when(schema.getType()).thenReturn(Schema.Type.STRING);
method.invoke(avroTuple2SerializationSchema,schema, new BigDecimal("1"));
when(schema.getType()).thenReturn(Schema.Type.BYTES);
method.invoke(avroTuple2SerializationSchema,schema, "1".getBytes());
when(schema.getType()).thenReturn(Schema.Type.INT);
method.invoke(avroTuple2SerializationSchema,schema, 1);
when(schema.getType()).thenReturn(Schema.Type.LONG);
method.invoke(avroTuple2SerializationSchema,schema, 1);
when(schema.getType()).thenReturn(Schema.Type.BOOLEAN);
method.invoke(avroTuple2SerializationSchema,schema, true);
}
@Test
public void convertFromDecimal() throws Exception {
Schema schema = PowerMockito.mock(Schema.class);
LogicalTypes.Decimal decimalType = mock(LogicalTypes.Decimal.class);
when(schema.getLogicalType()).thenReturn(decimalType);
when(decimalType.getScale()).thenReturn(1);
Method method = AvroTuple2SerializationSchema.class.getDeclaredMethod("convertFromDecimal", Schema.class, BigDecimal.class);
method.setAccessible(true);
method.invoke(avroTuple2SerializationSchema,schema, new BigDecimal("1"));
}
@Test
public void convertFromDate() throws Exception {
Schema schema = PowerMockito.mock(Schema.class);
LogicalTypes.Date date = LogicalTypes.date();
when(schema.getLogicalType()).thenReturn(date);
Method method = AvroTuple2SerializationSchema.class.getDeclaredMethod("convertFromDate", Schema.class, Date.class);
method.setAccessible(true);
method.invoke(avroTuple2SerializationSchema,schema, new Date(System.currentTimeMillis()));
}
@Test
public void convertFromTime() throws Exception {
Schema schema = PowerMockito.mock(Schema.class);
when(schema.getLogicalType()).thenReturn( LogicalTypes.timeMillis());
LogicalTypes.TimeMillis date = LogicalTypes.timeMillis();
Method method = AvroTuple2SerializationSchema.class.getDeclaredMethod("convertFromTime", Schema.class, Time.class);
method.setAccessible(true);
method.invoke(avroTuple2SerializationSchema, schema, new Time(System.currentTimeMillis()));
}
@Test
public void convertFromTimestamp() throws Exception {
Schema schema = PowerMockito.mock(Schema.class);
LogicalTypes.TimestampMillis date = LogicalTypes.timestampMillis();
when(schema.getLogicalType()).thenReturn(date);
Method method = AvroTuple2SerializationSchema.class.getDeclaredMethod("convertFromTimestamp", Schema.class, Timestamp.class);
method.setAccessible(true);
method.invoke(avroTuple2SerializationSchema,schema, new Timestamp(System.currentTimeMillis()));
}
}
| 2,303 |
348 | <filename>docs/data/t2/017/17320.json
{"nom":"Saint-Coutant-le-Grand","dpt":"Charente-Maritime","inscrits":304,"abs":57,"votants":247,"blancs":26,"nuls":4,"exp":217,"res":[{"panneau":"2","voix":109},{"panneau":"1","voix":108}]} | 94 |
331 | //
// MLChatImageCell.h
// Monal
//
// Created by <NAME> on 12/24/17.
// Copyright © 2017 Monal.im. All rights reserved.
//
#import "MLBaseCell.h"
@class MLMessage;
@interface MLChatImageCell : MLBaseCell
@property (nonatomic, weak) IBOutlet UIImageView *thumbnailImage;
@property (nonatomic, weak) IBOutlet UIActivityIndicatorView *spinner;
@property (nonatomic, weak) IBOutlet NSLayoutConstraint *imageHeight;
@property (nonatomic, assign) BOOL loading;
@property (nonatomic) MLMessage* msg;
-(void) loadImage;
@end
| 184 |
681 | package com.cleveroad.pulltorefresh.firework;
import android.graphics.Canvas;
interface FireworksDrawer {
void draw(Canvas canvas, int width, int height);
void reset();
}
| 61 |
2,151 | <filename>src/third_party/swiftshader/third_party/PowerVR_SDK/Tools/PVRTools.h
/*!****************************************************************************
@file PVRTools.h
@copyright Copyright (c) Imagination Technologies Limited.
@brief Header file to include a particular API tools header
******************************************************************************/
#ifndef PVRTOOLS_H
#define PVRTOOLS_H
/*****************************************************************************/
/*! @mainpage PVRTools
******************************************************************************
\tableofcontents
@section overview Overview
*****************************
PVRTools is a collection of source code to help developers with some common
tasks which are frequently used in 3D programming.
PVRTools supplies code for mathematical operations, matrix handling,
loading 3D models and to optimise geometry.
Sections which are specific to certain APIs contain code for displaying text and loading textures.
@section fileformats File formats
*****************************
The following file formats are used in PVRTools:
@subsection PFX_format PFX format
*****************************
PFX (PowerVR Effects) files are used to store graphics effects. As a minimum, a correctly formatted PFX consists of:
\li One EFFECT block
\li One VERTEXSHADER block
\li One FRAGMENTSHADER block
It is also possible for PFXs to contain the following:
\li One TARGET block
\li Zero or more TEXTURE blocks
By default PFXs are stored in .pfx files. It is possible for multiple PFXs to exist within a single .pfx file,
each described by a separate effect block; in this instance multiple PFXs may share blocks.
Finally, it is possible for a PFX to reference a TARGET block as an input as if it were a TEXTURE block,
enabling the simple creation of complex post-processing effects. For this to function correctly the TARGET
block render should be completed prior to being read as an input. If the TARGET block render has not been
completed prior to being read as an input, the behaviour will vary based on the render target implementation of the platform.
For more information see the <em>PFX File Format Specification</em>.
@subsection POD_format POD format
*****************************
POD files store data for representing 3D scenes; including geometry information, animations, matrices, materials, skinning data, lights, cameras, and in some instances custom meta-data.
These files are output by the PVRGeoPOD tool, and are designed for deployment through optimistions such as triangle/vertex sorting and data stripping.
The format is designed to be easily read, for information on the required algorithm and the overall structure of the format see the <em>POD File Format Specification</em>.
@subsection PVR_format PVR format
*****************************
PVR files are used as a container to store texture data. PVR files can be exported from PVRTexTool and a number of third party applications.
For more information see the <em>PVR File Format Specification</em>.
@section files Header files
*****************************
Here is a list of common header files present in PVRTools:
\li PVRTArray.h: A dynamic, resizable template class.
\li PVRTBackground.h: Create a textured background.
\li PVRTBoneBatch.h: Group vertices per bones to allow skinning when the maximum number of bones is limited.
\li PVRTDecompress.h: Descompress PVRTC texture format.
\li PVRTError.h: Error codes and tools output debug.
\li PVRTFixedPoint.h: Fast fixed point mathematical functions.
\li PVRTGlobal.h: Global defines and typedefs.
\li PVRTHash.h: A simple hash class which uses TEA to hash a string or given data into a 32-bit unsigned int.
\li PVRTMap.h: A dynamic, expanding templated map class.
\li PVRTMatrix.h: Vector and Matrix functions.
\li PVRTMemoryFileSystem.h: Memory file system for resource files.
\li PVRTMisc.h: Skybox, line plane intersection code, etc...
\li PVRTModelPOD.h: Load geometry and animation from a POD file.
\li PVRTPFXParser.h: Code to parse our PFX file format. Note, not used in fixed function APIs, such as @ref API_OGLES "OpenGL ES 1.x".
\li PVRTPrint3D.h: Display text/logos on the screen.
\li PVRTQuaternion.h: Quaternion functions.
\li PVRTResourceFile.h: The tools code for loading files included using FileWrap.
\li PVRTShadowVol.h: Tools code for creating shadow volumes.
\li PVRTSkipGraph.h: A "tree-like" structure for storing data which, unlike a tree, can reference any other node.
\li PVRTString.h: A string class.
\li PVRTTexture.h: Load textures from resources, BMP or PVR files.
\li PVRTTrans.h: Transformation and projection functions.
\li PVRTTriStrip.h: Geometry optimization using strips.
\li PVRTVector.h: Vector and Matrix functions that are gradually replacing PVRTMatrix.
\li PVRTVertex.h: Vertex order optimisation for 3D acceleration.
@section APIs APIs
*****************************
For information specific to each 3D API, see the list of supported APIs on the <a href="modules.html">Modules</a> page.
*/
#if defined(BUILD_OGLES3)
#include "OGLES3Tools.h"
#elif defined(BUILD_OGLES2)
#include "OGLES2Tools.h"
#elif defined(BUILD_OGLES)
#include "OGLESTools.h"
#elif defined(BUILD_OGL)
#include "OGLTools.h"
#elif defined(BUILD_DX11)
#include "DX11Tools.h"
#endif
#endif /* PVRTOOLS_H*/
/*****************************************************************************
End of file (Tools.h)
*****************************************************************************/
| 1,507 |
1,341 | <reponame>JxbSir/GKPageScrollView
//
// GKListRefreshViewController.h
// GKPageScrollViewDemo
//
// Created by gaokun on 2018/12/11.
// Copyright © 2018 QuintGao. All rights reserved.
//
#import "GKBasePageViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface GKListRefreshViewController : GKBasePageViewController
@end
NS_ASSUME_NONNULL_END
| 133 |
6,224 | <reponame>psychogenic/zephyr
/*
* Copyright 2021 The Chromium OS Authors
* Copyright 2021 Grinn
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <drivers/sensor.h>
#include <drivers/gpio.h>
#include <logging/log.h>
#include "ina230.h"
LOG_MODULE_DECLARE(INA230, CONFIG_SENSOR_LOG_LEVEL);
static void ina230_gpio_callback(const struct device *port,
struct gpio_callback *cb, uint32_t pin)
{
struct sensor_trigger ina230_trigger;
struct ina230_data *ina230 = CONTAINER_OF(cb, struct ina230_data, gpio_cb);
const struct device *dev = (const struct device *)ina230->dev;
ARG_UNUSED(port);
ARG_UNUSED(pin);
ARG_UNUSED(cb);
if (ina230->handler_alert) {
ina230_trigger.type = SENSOR_TRIG_DATA_READY;
ina230->handler_alert(dev, &ina230_trigger);
}
}
int ina230_trigger_set(const struct device *dev,
const struct sensor_trigger *trig,
sensor_trigger_handler_t handler)
{
struct ina230_data *ina230 = dev->data;
ARG_UNUSED(trig);
ina230->handler_alert = handler;
return 0;
}
int ina230_trigger_mode_init(const struct device *dev)
{
struct ina230_data *ina230 = dev->data;
const struct ina230_config *config = dev->config;
int ret;
/* setup alert gpio interrupt */
if (!device_is_ready(config->gpio_alert.port)) {
LOG_ERR("Alert GPIO device not ready");
return -ENODEV;
}
ina230->dev = dev;
ret = gpio_pin_configure_dt(&config->gpio_alert, GPIO_INPUT);
if (ret < 0) {
LOG_ERR("Could not configure gpio");
return ret;
}
gpio_init_callback(&ina230->gpio_cb,
ina230_gpio_callback,
BIT(config->gpio_alert.pin));
ret = gpio_add_callback(config->gpio_alert.port, &ina230->gpio_cb);
if (ret < 0) {
LOG_ERR("Could not set gpio callback");
return ret;
}
return gpio_pin_interrupt_configure_dt(&config->gpio_alert,
GPIO_INT_EDGE_BOTH);
}
| 748 |
1,738 | <reponame>jeikabu/lumberyard
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#ifndef CRYINCLUDE_CRYCOMMON_IENTITYCLASS_H
#define CRYINCLUDE_CRYCOMMON_IENTITYCLASS_H
#pragma once
#include "SmartPointersHelpers.h"
#include "IComponent.h"
struct IEntity;
struct SEntitySpawnParams;
struct IEntityScript;
struct IScriptTable;
class XmlNodeRef;
struct SEditorClassInfo
{
SEditorClassInfo()
: sIcon("")
, sHelper("")
, sCategory("")
{
}
const char* sIcon;
const char* sHelper;
const char* sCategory;
};
enum EEntityClassFlags
{
ECLF_INVISIBLE = BIT(0), // If set this class will not be visible in editor,and entity of this class cannot be placed manually in editor.
ECLF_DEFAULT = BIT(1), // If this is default entity class.
ECLF_BBOX_SELECTION = BIT(2), // If set entity of this class can be selected by bounding box in the editor 3D view.
ECLF_DO_NOT_SPAWN_AS_STATIC = BIT(3), // If set the entity of this class stored as part of the level won't be assigned a static id on creation
ECLF_MODIFY_EXISTING = BIT(4) // If set modify an existing class with the same name.
};
struct IEntityClassRegistryListener;
// Description:
// Custom interface that can be used to enumerate/set an entity class' property.
// Used for comunication with the editor, mostly.
// See Also:
// IEntityClassRegistry::SEntityClassDesc
struct IEntityPropertyHandler
{
virtual ~IEntityPropertyHandler(){}
//////////////////////////////////////////////////////////////////////////
// Property info for entity class.
//////////////////////////////////////////////////////////////////////////
virtual void GetMemoryUsage(ICrySizer* pSizer) const { /*REPLACE LATER*/}
enum EPropertyType
{
Bool,
Int,
Float,
Vector,
String,
Entity,
FolderBegin,
FolderEnd
};
enum EPropertyFlags
{
ePropertyFlag_UIEnum = BIT(0),
ePropertyFlag_Unsorted = BIT(1),
};
struct SPropertyInfo
{
const char* name; // Name of the property.
EPropertyType type; // Type of the property value.
const char* editType; // Type of edit control to use.
const char* description; // Description of the property.
uint32 flags; // Property flags.
struct SLimits // Limits
{
float min;
float max;
} limits;
};
// Description:
// Refresh the class' properties.
virtual void RefreshProperties() = 0;
// Description:
// Load properties into the entity.
virtual void LoadEntityXMLProperties(IEntity* entity, const XmlNodeRef& xml) = 0;
// Description:
// Load archetype properties.
virtual void LoadArchetypeXMLProperties(const char* archetypeName, const XmlNodeRef& xml) = 0;
// Description:
// Init entity with archetype properties.
virtual void InitArchetypeEntity(IEntity* entity, const char* archetypeName, const SEntitySpawnParams& spawnParams) = 0;
// Description:
// Returns number of properties for this entity.
// See Also:
// GetPropertyInfo
// Returns:
// Return Number of properties.
virtual int GetPropertyCount() const = 0;
// Description:
// Retrieve information about properties of the entity.
// See Also:
// SPropertyInfo, GetPropertyCount
// Arguments:
// nIndex - Index of the property to retrieve, must be in 0 to GetPropertyCount()-1 range.
// Returns:
// Specified event description in SPropertyInfo structure.
virtual bool GetPropertyInfo(int index, SPropertyInfo& info) const = 0;
// Description:
// Set a property in a entity of this class.
// Arguments:
// index - Index of the property to set, must be in 0 to GetPropertyCount()-1 range.
virtual void SetProperty(IEntity* entity, int index, const char* value) = 0;
// Description:
// Get a property in a entity of this class.
// Arguments:
// index - Index of the property to get, must be in 0 to GetPropertyCount()-1 range.
virtual const char* GetProperty(IEntity* entity, int index) const = 0;
// Description:
// Get a property in a entity of this class.
// Arguments:
// index - Index of the property to get, must be in 0 to GetPropertyCount()-1 range.
virtual const char* GetDefaultProperty(int index) const = 0;
// Description:
// Get script flags of this class.
virtual uint32 GetScriptFlags() const = 0;
// Description:
// Inform the implementation that properties have changed. Called at the end of a change block.
virtual void PropertiesChanged(IEntity* entity) = 0;
};
// Description:
// Custom interface that can be used to reload an entity's script.
// Used by the editor, only.
// See Also:
// IEntityClassRegistry::SEntityClassDesc
struct IEntityScriptFileHandler
{
virtual ~IEntityScriptFileHandler(){}
// Description:
// Reloads the specified entity class' script.
virtual void ReloadScriptFile() = 0;
// Description:
// Returns the class' script file name, if any.
virtual const char* GetScriptFile() const = 0;
virtual void GetMemoryUsage(ICrySizer* pSizer) const { /*REPLACE LATER*/}
};
struct IEntityEventHandler
{
virtual ~IEntityEventHandler(){}
virtual void GetMemoryUsage(ICrySizer* pSizer) const { /*REPLACE LATER*/}
//////////////////////////////////////////////////////////////////////////
// Events info for this entity class.
//////////////////////////////////////////////////////////////////////////
enum EventValueType
{
Bool,
Int,
Float,
Vector,
Entity,
String,
};
enum EventType
{
Input,
Output,
};
struct SEventInfo
{
const char* name; // Name of event.
EventType type; // Input or Output event.
EventValueType valueType; // Type of event value.
const char* description; // Description of the event.
};
// Description:
// Refresh the class' event info.
virtual void RefreshEvents() = 0;
// Description:
// Load event info into the entity.
virtual void LoadEntityXMLEvents(IEntity* entity, const XmlNodeRef& xml) = 0;
// Description:
// Returns number of events for this entity.
// See Also:
// GetEventInfo
// Returns:
// Return Number of events.
virtual int GetEventCount() const = 0;
// Description:
// Retrieve information about events of the entity.
// See Also:
// SEventInfo, GetEventCount
// Arguments:
// nIndex - Index of the event to retrieve, must be in 0 to GetEventCount()-1 range.
// Returns:
// Specified event description in SEventInfo structure.
virtual bool GetEventInfo(int index, SEventInfo& info) const = 0;
// Description:
// Send the specified event to the entity.
// Arguments:
// entity - The entity to send the event to.
// eventName - Name of the event to send.
virtual void SendEvent(IEntity* entity, const char* eventName) = 0;
};
namespace Serialization
{
class IArchive;
}
struct IEntityAttribute;
DECLARE_SMART_POINTERS(IEntityAttribute)
//////////////////////////////////////////////////////////////////////////
// Description:
// Derive from this interface to expose custom entity properties in
// the editor using the serialization framework.
//////////////////////////////////////////////////////////////////////////
struct IEntityAttribute
{
virtual ~IEntityAttribute() {}
virtual const char* GetName() const = 0;
virtual const char* GetLabel() const = 0;
virtual void Serialize(Serialization::IArchive& archive) = 0;
virtual IEntityAttributePtr Clone() const = 0;
};
typedef DynArray<IEntityAttributePtr> TEntityAttributeArray;
//////////////////////////////////////////////////////////////////////////
// Description:
// Entity class defines what is this entity, what script it uses,
// what user component will be spawned with the entity,etc...
// IEntityClass unique identify type of the entity, Multiple entities
// share the same entity class.
// Two entities can be compared if they are of the same type by
// just comparing their IEntityClass pointers.
//////////////////////////////////////////////////////////////////////////
struct IEntityClass
{
//////////////////////////////////////////////////////////////////////////
// ComponentUserCreateFunc is a function pointer type,
// by calling this function EntitySystem can create user defined ComponentUser class for an entity in SpawnEntity.
// Ex:
// IComponentPtr CreateComponentUser( IEntity *pEntity,SEntitySpawnParams ¶ms )
// {
// return new CComponentUser( pEntity,params );
// }
typedef IComponentPtr (* ComponentUserCreateFunc)(IEntity* pEntity, SEntitySpawnParams& params, void* pUserData);
//////////////////////////////////////////////////////////////////////////
// Events info for this entity class.
//////////////////////////////////////////////////////////////////////////
enum EventValueType
{
EVT_INT,
EVT_FLOAT,
EVT_BOOL,
EVT_VECTOR,
EVT_ENTITY,
EVT_STRING
};
struct SEventInfo
{
const char* name; // Name of event.
EventValueType type; // Type of event value.
bool bOutput; // Input or Output event.
};
// <interfuscator:shuffle>
virtual ~IEntityClass(){}
// Description:
// Destroy IEntityClass object, do not call directly, only EntityRegisty can destroy entity classes.
virtual void Release() = 0;
// Description:
// Returns the name of the entity class, Class name must be unique among all the entity classes.
// If this entity also uses a script, this is the name of the Lua table representing the entity behavior.
virtual const char* GetName() const = 0;
// Description:
// Returns entity class flags.
// See Also:
// EEntityClassFlags
virtual uint32 GetFlags() const = 0;
// Description:
// Set entity class flags.
// See Also:
// EEntityClassFlags
virtual void SetFlags(uint32 nFlags) = 0;
// Description:
// Returns the Lua script file name.
// Returns:
// Lua Script filename, return empty string if entity does not use script.
virtual const char* GetScriptFile() const = 0;
// Description:
// Returns the IEntityScript interface assigned for this entity class.
// Returns:
// IEntityScript interface if this entity have script, or NULL if no script defined for this entity class.
virtual IEntityScript* GetIEntityScript() const = 0;
// Description:
// Returns the IScriptTable interface assigned for this entity class.
// Returns:
// IScriptTable interface if this entity have script, or NULL if no script defined for this entity class.
virtual IScriptTable* GetScriptTable() const = 0;
virtual IEntityPropertyHandler* GetPropertyHandler() const = 0;
virtual IEntityEventHandler* GetEventHandler() const = 0;
virtual IEntityScriptFileHandler* GetScriptFileHandler() const = 0;
virtual const SEditorClassInfo& GetEditorClassInfo() const = 0;
virtual void SetEditorClassInfo(const SEditorClassInfo& editorClassInfo) = 0;
// Description:
// Loads the script.
// It is safe to call LoadScript multiple times, only first time the script will be loaded, if bForceReload is not specified.
virtual bool LoadScript(bool bForceReload) = 0;
// Description:
// Returns pointer to the user defined function to create ComponentUser.
// Returns:
// Return ComponentUserCreateFunc function pointer.
virtual IEntityClass::ComponentUserCreateFunc GetComponentUserCreateFunc() const = 0;
// Description:
// Returns pointer to the user defined data to be passed when creating ComponentUser.
// Returns:
// Return pointer to custom user component data.
virtual void* GetComponentUserData() const = 0;
// Description:
// Returns number of input and output events defiend in the entity script.
// See Also:
// GetEventInfo
// Returns:
// Return Number of events.
virtual int GetEventCount() = 0;
// Description:
// Retrieve information about input/output event of the entity.
// See Also:
// SEventInfo, GetEventCount
// Arguments:
// nIndex - Index of the event to retrieve, must be in 0 to GetEventCount()-1 range.
// Returns:
// Specified event description in SEventInfo structure.
virtual IEntityClass::SEventInfo GetEventInfo(int nIndex) = 0;
// Description:
// Find event by name.
// See Also:
// SEventInfo, GetEventInfo
// Arguments:
// sEvent - Name of the event.
// event - Output parameter for event.
// Returns:
// True if event found and event parameter is initialized.
virtual bool FindEventInfo(const char* sEvent, SEventInfo& event) = 0;
// Description:
// Get attributes associated with this entity class.
// See Also:
// IEntityAttribute
// Returns:
// Array of entity attributes.
virtual TEntityAttributeArray& GetClassAttributes() = 0;
virtual const TEntityAttributeArray& GetClassAttributes() const = 0;
// Description:
// Get attributes associated with entities of this class.
// See Also:
// IEntityAttribute
// Returns:
// Array of entity attributes.
virtual TEntityAttributeArray& GetEntityAttributes() = 0;
virtual const TEntityAttributeArray& GetEntityAttributes() const = 0;
virtual void GetMemoryUsage(ICrySizer* pSizer) const = 0;
// </interfuscator:shuffle>
};
//////////////////////////////////////////////////////////////////////////
// Description:
// This interface is the repository of the the various entity classes, it allows
// creation and modification of entities types.
// There`s only one IEntityClassRegistry interface can exist per EntitySystem.
// Every entity class that can be spawned must be registered in this interface.
// See Also:
// IEntitySystem::GetClassRegistry
//////////////////////////////////////////////////////////////////////////
struct IEntityClassRegistry
{
struct SEntityClassDesc
{
SEntityClassDesc()
: flags(0)
, sName("")
, sScriptFile("")
, pScriptTable(NULL)
, editorClassInfo()
, pComponentUserCreateFunc(NULL)
, pComponentUserData(NULL)
, pPropertyHandler(NULL)
, pEventHandler(NULL)
, pScriptFileHandler(NULL)
{
};
int flags;
const char* sName;
const char* sScriptFile;
IScriptTable* pScriptTable;
SEditorClassInfo editorClassInfo;
IEntityClass::ComponentUserCreateFunc pComponentUserCreateFunc;
void* pComponentUserData;
IEntityPropertyHandler* pPropertyHandler;
IEntityEventHandler* pEventHandler;
IEntityScriptFileHandler* pScriptFileHandler;
TEntityAttributeArray classAttributes;
TEntityAttributeArray entityAttributes;
};
virtual ~IEntityClassRegistry(){}
// Description:
// Register a new entity class.
// Returns:
// true if successfully registered.
virtual bool RegisterEntityClass(IEntityClass* pClass) = 0;
// Description:
// Unregister an entity class.
// Returns:
// true if successfully unregistered.
virtual bool UnregisterEntityClass(IEntityClass* pClass) = 0;
// Description:
// Retrieves pointer to the IEntityClass interface by entity class name.
// Returns:
// Pointer to the IEntityClass interface, or NULL if class not found.
virtual IEntityClass* FindClass(const char* sClassName) const = 0;
// Description:
// Retrieves pointer to the IEntityClass interface for a default entity class.
// Returns:
// Pointer to the IEntityClass interface, It can never return NULL.
virtual IEntityClass* GetDefaultClass() const = 0;
// Description:
// Load all entity class description xml files with extension ".ent" from specified directory.
// Arguments:
// sPath - Path where to search for .ent files.
virtual void LoadClasses(const char* sPath, bool bOnlyNewClasses = false) = 0;
// Description:
// Register standard entity class, if class id not specified (is zero), generate a new class id.
// Returns:
// Pointer to the new created and registered IEntityClass interface, or NULL if failed.
virtual IEntityClass* RegisterStdClass(const SEntityClassDesc& entityClassDesc) = 0;
// Description:
// Register a listener.
virtual void RegisterListener(IEntityClassRegistryListener* pListener) = 0;
// Description:
// Unregister a listener.
virtual void UnregisterListener(IEntityClassRegistryListener* pListener) = 0;
//////////////////////////////////////////////////////////////////////////
// Registry iterator.
//////////////////////////////////////////////////////////////////////////
// Description:
// Move the entity class iterator to the begin of the registry.
// To iterate over all entity classes, ex:
// ...
// IEntityClass *pClass = NULL;
// for (pEntityRegistry->IteratorMoveFirst(); pClass = pEntityRegistry->IteratorNext();;)
// {
// pClass
// ...
// }
virtual void IteratorMoveFirst() = 0;
// Description:
// Get the next entity class in the registry.
// Returns:
// Return a pointer to the next IEntityClass interface, or NULL if is the end
virtual IEntityClass* IteratorNext() = 0;
// Description:
// Return the number of entity classes in the registry.
// Returns:
// Return a pointer to the next IEntityClass interface, or NULL if is the end
virtual int GetClassCount() const = 0;
// </interfuscator:shuffle>
};
enum EEntityClassRegistryEvent
{
ECRE_CLASS_REGISTERED = 0, // Sent when new entity class is registered.
ECRE_CLASS_MODIFIED, // Sent when new entity class is modified (see ECLF_MODIFY_EXISTING).
ECRE_CLASS_UNREGISTERED // Sent when new entity class is unregistered.
};
//////////////////////////////////////////////////////////////////////////
// Description:
// Use this interface to monitor changes within the entity class registry.
//////////////////////////////////////////////////////////////////////////
struct IEntityClassRegistryListener
{
friend class CEntityClassRegistry;
public:
inline IEntityClassRegistryListener()
: m_pRegistry(NULL)
{}
virtual ~IEntityClassRegistryListener()
{
if (m_pRegistry)
{
m_pRegistry->UnregisterListener(this);
}
}
virtual void OnEntityClassRegistryEvent(EEntityClassRegistryEvent event, const IEntityClass* pEntityClass) = 0;
private:
IEntityClassRegistry* m_pRegistry;
};
#endif // CRYINCLUDE_CRYCOMMON_IENTITYCLASS_H
| 6,759 |
4,036 | # there should be no difference whether you import 2 things on 1 line, or use 2
# lines
from typing import Optional
from unknown import foo, bar
var: Optional['foo'] = None
| 45 |
837 | /*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2014, University of Toronto
* 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 University of Toronto 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 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*********************************************************************/
/* Authors: <NAME> */
#ifndef OMPL_BASE_SAMPLERS_INFORMED_ORDERED_INFORMED_SAMPLER_
#define OMPL_BASE_SAMPLERS_INFORMED_ORDERED_INFORMED_SAMPLER_
// We inherit from InformedStateSampler
#include "ompl/base/samplers/InformedStateSampler.h"
// For a priority queue
#include <queue>
// For std::function
#include <functional>
namespace ompl
{
namespace base
{
/** \brief An informed sampler wrapper that generates \e m samples and then returns them in order of the
heuristic.
*/
class OrderedInfSampler : public InformedSampler
{
public:
/** \brief Construct an ordering wrapper around the provided informed sampler. */
OrderedInfSampler(const InformedSamplerPtr &infSamplerPtr, unsigned int batchSize);
~OrderedInfSampler() override = default;
/** \brief Sample uniformly in the subset of the state space whose heuristic solution estimates are less
* than the provided cost, i.e. in the interval [0, maxCost). Returns false if such a state was not found in
* the specified number of iterations. */
bool sampleUniform(State *statePtr, const Cost &maxCost) override;
/** \brief Sample uniformly in the subset of the state space whose heuristic solution estimates are between
* the provided costs, [minCost, maxCost). Returns false if such a state was not found in the specified
* number of iterations. */
bool sampleUniform(State *statePtr, const Cost &minCost, const Cost &maxCost) override;
/** \brief Whether the wrapped sampler can provide a measure of the informed subset */
bool hasInformedMeasure() const override;
/** \brief The measure of the subset of the state space defined by the current solution cost that is being
* searched. Passes through to the wrapper sampler. */
double getInformedMeasure(const Cost ¤tCost) const override;
private:
// Variables
/** \brief The informed sampler to use. */
InformedSamplerPtr infSampler_;
/** \brief The batch size to use. */
unsigned int batchSize_;
/** \brief The container of ordered samples. */
std::priority_queue<State *, std::vector<State *>, std::function<bool(const State *, const State *)>>
orderedSamples_;
// Functions
/** \brief The ordering function for the priority queue */
bool queueComparator(const State *a, const State *b);
/** \brief Construct a batch of samples to return with costs in the interval [0, maxCost) */
void createBatch(const Cost &maxCost);
/** \brief Construct a batch of samples to return with costs in the interval [minCost, maxCost) */
void createBatch(const Cost &minCost, const Cost &maxCost);
/** \brief Clear a batch of prepared samples */
void clearBatch();
};
}
}
#endif // OMPL_BASE_SAMPLERS_INFORMED_REJECTION_INFORMED_SAMPLER_
| 1,672 |
451 | // File Automatically generated by eLiSe
#include "StdAfx.h"
#include "cEqAppui_GL__PProjInc_M2CFour19x2.h"
cEqAppui_GL__PProjInc_M2CFour19x2::cEqAppui_GL__PProjInc_M2CFour19x2():
cElCompiledFonc(2)
{
AddIntRef (cIncIntervale("Intr",0,20));
AddIntRef (cIncIntervale("Orient",20,26));
AddIntRef (cIncIntervale("Tmp_PTer",26,29));
Close(false);
}
void cEqAppui_GL__PProjInc_M2CFour19x2::ComputeVal()
{
double tmp0_ = mCompCoord[20];
double tmp1_ = mCompCoord[21];
double tmp2_ = cos(tmp1_);
double tmp3_ = cos(tmp0_);
double tmp4_ = tmp3_*tmp2_;
double tmp5_ = sin(tmp0_);
double tmp6_ = tmp5_*tmp2_;
double tmp7_ = sin(tmp1_);
double tmp8_ = mCompCoord[26];
double tmp9_ = mCompCoord[27];
double tmp10_ = mCompCoord[28];
double tmp11_ = mCompCoord[22];
double tmp12_ = sin(tmp11_);
double tmp13_ = -(tmp12_);
double tmp14_ = -(tmp7_);
double tmp15_ = cos(tmp11_);
double tmp16_ = mLocProjI_x*tmp8_;
double tmp17_ = mLocProjP0_x+tmp16_;
double tmp18_ = mLocProjJ_x*tmp9_;
double tmp19_ = tmp17_+tmp18_;
double tmp20_ = mLocProjK_x*tmp10_;
double tmp21_ = tmp19_+tmp20_;
double tmp22_ = mCompCoord[23];
double tmp23_ = (tmp21_)-tmp22_;
double tmp24_ = -(tmp5_);
double tmp25_ = tmp24_*tmp13_;
double tmp26_ = tmp3_*tmp14_;
double tmp27_ = tmp26_*tmp15_;
double tmp28_ = tmp25_+tmp27_;
double tmp29_ = tmp3_*tmp13_;
double tmp30_ = tmp5_*tmp14_;
double tmp31_ = tmp30_*tmp15_;
double tmp32_ = tmp29_+tmp31_;
double tmp33_ = tmp2_*tmp15_;
double tmp34_ = mLocProjI_y*tmp8_;
double tmp35_ = mLocProjP0_y+tmp34_;
double tmp36_ = mLocProjJ_y*tmp9_;
double tmp37_ = tmp35_+tmp36_;
double tmp38_ = mLocProjK_y*tmp10_;
double tmp39_ = tmp37_+tmp38_;
double tmp40_ = mCompCoord[24];
double tmp41_ = (tmp39_)-tmp40_;
double tmp42_ = mLocProjI_z*tmp8_;
double tmp43_ = mLocProjP0_z+tmp42_;
double tmp44_ = mLocProjJ_z*tmp9_;
double tmp45_ = tmp43_+tmp44_;
double tmp46_ = mLocProjK_z*tmp10_;
double tmp47_ = tmp45_+tmp46_;
double tmp48_ = mCompCoord[25];
double tmp49_ = (tmp47_)-tmp48_;
double tmp50_ = tmp24_*tmp15_;
double tmp51_ = tmp26_*tmp12_;
double tmp52_ = tmp50_+tmp51_;
double tmp53_ = tmp3_*tmp15_;
double tmp54_ = tmp30_*tmp12_;
double tmp55_ = tmp53_+tmp54_;
double tmp56_ = tmp2_*tmp12_;
double tmp57_ = mCompCoord[0];
double tmp58_ = (tmp28_)*mLocGL_0_0;
double tmp59_ = (tmp32_)*mLocGL_1_0;
double tmp60_ = tmp58_+tmp59_;
double tmp61_ = tmp33_*mLocGL_2_0;
double tmp62_ = tmp60_+tmp61_;
double tmp63_ = (tmp62_)*(tmp23_);
double tmp64_ = (tmp28_)*mLocGL_0_1;
double tmp65_ = (tmp32_)*mLocGL_1_1;
double tmp66_ = tmp64_+tmp65_;
double tmp67_ = tmp33_*mLocGL_2_1;
double tmp68_ = tmp66_+tmp67_;
double tmp69_ = (tmp68_)*(tmp41_);
double tmp70_ = tmp63_+tmp69_;
double tmp71_ = (tmp28_)*mLocGL_0_2;
double tmp72_ = (tmp32_)*mLocGL_1_2;
double tmp73_ = tmp71_+tmp72_;
double tmp74_ = tmp33_*mLocGL_2_2;
double tmp75_ = tmp73_+tmp74_;
double tmp76_ = (tmp75_)*(tmp49_);
double tmp77_ = tmp70_+tmp76_;
double tmp78_ = tmp57_/(tmp77_);
double tmp79_ = tmp4_*mLocGL_0_0;
double tmp80_ = tmp6_*mLocGL_1_0;
double tmp81_ = tmp79_+tmp80_;
double tmp82_ = tmp7_*mLocGL_2_0;
double tmp83_ = tmp81_+tmp82_;
double tmp84_ = (tmp83_)*(tmp23_);
double tmp85_ = tmp4_*mLocGL_0_1;
double tmp86_ = tmp6_*mLocGL_1_1;
double tmp87_ = tmp85_+tmp86_;
double tmp88_ = tmp7_*mLocGL_2_1;
double tmp89_ = tmp87_+tmp88_;
double tmp90_ = (tmp89_)*(tmp41_);
double tmp91_ = tmp84_+tmp90_;
double tmp92_ = tmp4_*mLocGL_0_2;
double tmp93_ = tmp6_*mLocGL_1_2;
double tmp94_ = tmp92_+tmp93_;
double tmp95_ = tmp7_*mLocGL_2_2;
double tmp96_ = tmp94_+tmp95_;
double tmp97_ = (tmp96_)*(tmp49_);
double tmp98_ = tmp91_+tmp97_;
double tmp99_ = (tmp98_)*(tmp78_);
double tmp100_ = mCompCoord[1];
double tmp101_ = tmp99_+tmp100_;
double tmp102_ = (tmp101_)-mLocFour19x2_State_1_0;
double tmp103_ = (tmp102_)/mLocFour19x2_State_0_0;
double tmp104_ = (tmp52_)*mLocGL_0_0;
double tmp105_ = (tmp55_)*mLocGL_1_0;
double tmp106_ = tmp104_+tmp105_;
double tmp107_ = tmp56_*mLocGL_2_0;
double tmp108_ = tmp106_+tmp107_;
double tmp109_ = (tmp108_)*(tmp23_);
double tmp110_ = (tmp52_)*mLocGL_0_1;
double tmp111_ = (tmp55_)*mLocGL_1_1;
double tmp112_ = tmp110_+tmp111_;
double tmp113_ = tmp56_*mLocGL_2_1;
double tmp114_ = tmp112_+tmp113_;
double tmp115_ = (tmp114_)*(tmp41_);
double tmp116_ = tmp109_+tmp115_;
double tmp117_ = (tmp52_)*mLocGL_0_2;
double tmp118_ = (tmp55_)*mLocGL_1_2;
double tmp119_ = tmp117_+tmp118_;
double tmp120_ = tmp56_*mLocGL_2_2;
double tmp121_ = tmp119_+tmp120_;
double tmp122_ = (tmp121_)*(tmp49_);
double tmp123_ = tmp116_+tmp122_;
double tmp124_ = (tmp123_)*(tmp78_);
double tmp125_ = mCompCoord[2];
double tmp126_ = tmp124_+tmp125_;
double tmp127_ = (tmp126_)-mLocFour19x2_State_2_0;
double tmp128_ = (tmp127_)/mLocFour19x2_State_0_0;
double tmp129_ = mCompCoord[9];
double tmp130_ = tmp103_-tmp129_;
double tmp131_ = mCompCoord[10];
double tmp132_ = tmp128_-tmp131_;
double tmp133_ = (tmp130_)*(tmp130_);
double tmp134_ = (tmp132_)*(tmp132_);
double tmp135_ = tmp133_+tmp134_;
double tmp136_ = (tmp135_)*(tmp135_);
double tmp137_ = tmp136_*(tmp135_);
double tmp138_ = tmp137_*(tmp135_);
double tmp139_ = tmp138_*(tmp135_);
double tmp140_ = tmp139_*(tmp135_);
double tmp141_ = tmp140_*(tmp135_);
double tmp142_ = tmp141_*(tmp135_);
double tmp143_ = mCompCoord[3];
double tmp144_ = mCompCoord[4];
double tmp145_ = mCompCoord[5];
double tmp146_ = (tmp103_)*(tmp128_);
double tmp147_ = mCompCoord[6];
double tmp148_ = (tmp128_)*(tmp128_);
double tmp149_ = (tmp103_)*(tmp103_);
double tmp150_ = mCompCoord[11];
double tmp151_ = tmp150_*(tmp135_);
double tmp152_ = mCompCoord[12];
double tmp153_ = tmp152_*tmp136_;
double tmp154_ = tmp151_+tmp153_;
double tmp155_ = mCompCoord[13];
double tmp156_ = tmp155_*tmp137_;
double tmp157_ = tmp154_+tmp156_;
double tmp158_ = mCompCoord[14];
double tmp159_ = tmp158_*tmp138_;
double tmp160_ = tmp157_+tmp159_;
double tmp161_ = mCompCoord[15];
double tmp162_ = tmp161_*tmp139_;
double tmp163_ = tmp160_+tmp162_;
double tmp164_ = mCompCoord[16];
double tmp165_ = tmp164_*tmp140_;
double tmp166_ = tmp163_+tmp165_;
double tmp167_ = mCompCoord[17];
double tmp168_ = tmp167_*tmp141_;
double tmp169_ = tmp166_+tmp168_;
double tmp170_ = mCompCoord[18];
double tmp171_ = tmp170_*tmp142_;
double tmp172_ = tmp169_+tmp171_;
double tmp173_ = mCompCoord[19];
double tmp174_ = tmp142_*(tmp135_);
double tmp175_ = tmp173_*tmp174_;
double tmp176_ = tmp172_+tmp175_;
mVal[0] = ((mLocFour19x2_State_1_0+(((1+tmp143_)*(tmp103_)+tmp144_*(tmp128_))-tmp145_*2*tmp149_+tmp147_*tmp146_+mCompCoord[7]*tmp148_+(tmp130_)*(tmp176_))*mLocFour19x2_State_0_0)-mLocXIm)*mLocScNorm;
mVal[1] = ((mLocFour19x2_State_2_0+(((1-tmp143_)*(tmp128_)+tmp144_*(tmp103_)+tmp145_*tmp146_)-tmp147_*2*tmp148_+mCompCoord[8]*tmp149_+(tmp132_)*(tmp176_))*mLocFour19x2_State_0_0)-mLocYIm)*mLocScNorm;
}
void cEqAppui_GL__PProjInc_M2CFour19x2::ComputeValDeriv()
{
double tmp0_ = mCompCoord[20];
double tmp1_ = mCompCoord[21];
double tmp2_ = cos(tmp1_);
double tmp3_ = cos(tmp0_);
double tmp4_ = tmp3_*tmp2_;
double tmp5_ = sin(tmp0_);
double tmp6_ = tmp5_*tmp2_;
double tmp7_ = sin(tmp1_);
double tmp8_ = mCompCoord[26];
double tmp9_ = mCompCoord[27];
double tmp10_ = mCompCoord[28];
double tmp11_ = mCompCoord[22];
double tmp12_ = sin(tmp11_);
double tmp13_ = -(tmp12_);
double tmp14_ = -(tmp7_);
double tmp15_ = cos(tmp11_);
double tmp16_ = mLocProjI_x*tmp8_;
double tmp17_ = mLocProjP0_x+tmp16_;
double tmp18_ = mLocProjJ_x*tmp9_;
double tmp19_ = tmp17_+tmp18_;
double tmp20_ = mLocProjK_x*tmp10_;
double tmp21_ = tmp19_+tmp20_;
double tmp22_ = mCompCoord[23];
double tmp23_ = (tmp21_)-tmp22_;
double tmp24_ = -(tmp5_);
double tmp25_ = tmp24_*tmp13_;
double tmp26_ = tmp3_*tmp14_;
double tmp27_ = tmp26_*tmp15_;
double tmp28_ = tmp25_+tmp27_;
double tmp29_ = tmp3_*tmp13_;
double tmp30_ = tmp5_*tmp14_;
double tmp31_ = tmp30_*tmp15_;
double tmp32_ = tmp29_+tmp31_;
double tmp33_ = tmp2_*tmp15_;
double tmp34_ = mLocProjI_y*tmp8_;
double tmp35_ = mLocProjP0_y+tmp34_;
double tmp36_ = mLocProjJ_y*tmp9_;
double tmp37_ = tmp35_+tmp36_;
double tmp38_ = mLocProjK_y*tmp10_;
double tmp39_ = tmp37_+tmp38_;
double tmp40_ = mCompCoord[24];
double tmp41_ = (tmp39_)-tmp40_;
double tmp42_ = mLocProjI_z*tmp8_;
double tmp43_ = mLocProjP0_z+tmp42_;
double tmp44_ = mLocProjJ_z*tmp9_;
double tmp45_ = tmp43_+tmp44_;
double tmp46_ = mLocProjK_z*tmp10_;
double tmp47_ = tmp45_+tmp46_;
double tmp48_ = mCompCoord[25];
double tmp49_ = (tmp47_)-tmp48_;
double tmp50_ = tmp24_*tmp15_;
double tmp51_ = tmp26_*tmp12_;
double tmp52_ = tmp50_+tmp51_;
double tmp53_ = tmp3_*tmp15_;
double tmp54_ = tmp30_*tmp12_;
double tmp55_ = tmp53_+tmp54_;
double tmp56_ = tmp2_*tmp12_;
double tmp57_ = mCompCoord[0];
double tmp58_ = (tmp28_)*mLocGL_0_0;
double tmp59_ = (tmp32_)*mLocGL_1_0;
double tmp60_ = tmp58_+tmp59_;
double tmp61_ = tmp33_*mLocGL_2_0;
double tmp62_ = tmp60_+tmp61_;
double tmp63_ = (tmp62_)*(tmp23_);
double tmp64_ = (tmp28_)*mLocGL_0_1;
double tmp65_ = (tmp32_)*mLocGL_1_1;
double tmp66_ = tmp64_+tmp65_;
double tmp67_ = tmp33_*mLocGL_2_1;
double tmp68_ = tmp66_+tmp67_;
double tmp69_ = (tmp68_)*(tmp41_);
double tmp70_ = tmp63_+tmp69_;
double tmp71_ = (tmp28_)*mLocGL_0_2;
double tmp72_ = (tmp32_)*mLocGL_1_2;
double tmp73_ = tmp71_+tmp72_;
double tmp74_ = tmp33_*mLocGL_2_2;
double tmp75_ = tmp73_+tmp74_;
double tmp76_ = (tmp75_)*(tmp49_);
double tmp77_ = tmp70_+tmp76_;
double tmp78_ = tmp57_/(tmp77_);
double tmp79_ = tmp4_*mLocGL_0_0;
double tmp80_ = tmp6_*mLocGL_1_0;
double tmp81_ = tmp79_+tmp80_;
double tmp82_ = tmp7_*mLocGL_2_0;
double tmp83_ = tmp81_+tmp82_;
double tmp84_ = (tmp83_)*(tmp23_);
double tmp85_ = tmp4_*mLocGL_0_1;
double tmp86_ = tmp6_*mLocGL_1_1;
double tmp87_ = tmp85_+tmp86_;
double tmp88_ = tmp7_*mLocGL_2_1;
double tmp89_ = tmp87_+tmp88_;
double tmp90_ = (tmp89_)*(tmp41_);
double tmp91_ = tmp84_+tmp90_;
double tmp92_ = tmp4_*mLocGL_0_2;
double tmp93_ = tmp6_*mLocGL_1_2;
double tmp94_ = tmp92_+tmp93_;
double tmp95_ = tmp7_*mLocGL_2_2;
double tmp96_ = tmp94_+tmp95_;
double tmp97_ = (tmp96_)*(tmp49_);
double tmp98_ = tmp91_+tmp97_;
double tmp99_ = (tmp98_)*(tmp78_);
double tmp100_ = mCompCoord[1];
double tmp101_ = tmp99_+tmp100_;
double tmp102_ = (tmp101_)-mLocFour19x2_State_1_0;
double tmp103_ = (tmp102_)/mLocFour19x2_State_0_0;
double tmp104_ = (tmp52_)*mLocGL_0_0;
double tmp105_ = (tmp55_)*mLocGL_1_0;
double tmp106_ = tmp104_+tmp105_;
double tmp107_ = tmp56_*mLocGL_2_0;
double tmp108_ = tmp106_+tmp107_;
double tmp109_ = (tmp108_)*(tmp23_);
double tmp110_ = (tmp52_)*mLocGL_0_1;
double tmp111_ = (tmp55_)*mLocGL_1_1;
double tmp112_ = tmp110_+tmp111_;
double tmp113_ = tmp56_*mLocGL_2_1;
double tmp114_ = tmp112_+tmp113_;
double tmp115_ = (tmp114_)*(tmp41_);
double tmp116_ = tmp109_+tmp115_;
double tmp117_ = (tmp52_)*mLocGL_0_2;
double tmp118_ = (tmp55_)*mLocGL_1_2;
double tmp119_ = tmp117_+tmp118_;
double tmp120_ = tmp56_*mLocGL_2_2;
double tmp121_ = tmp119_+tmp120_;
double tmp122_ = (tmp121_)*(tmp49_);
double tmp123_ = tmp116_+tmp122_;
double tmp124_ = (tmp123_)*(tmp78_);
double tmp125_ = mCompCoord[2];
double tmp126_ = tmp124_+tmp125_;
double tmp127_ = (tmp126_)-mLocFour19x2_State_2_0;
double tmp128_ = (tmp127_)/mLocFour19x2_State_0_0;
double tmp129_ = mCompCoord[9];
double tmp130_ = tmp103_-tmp129_;
double tmp131_ = mCompCoord[10];
double tmp132_ = tmp128_-tmp131_;
double tmp133_ = (tmp130_)*(tmp130_);
double tmp134_ = (tmp132_)*(tmp132_);
double tmp135_ = tmp133_+tmp134_;
double tmp136_ = (tmp135_)*(tmp135_);
double tmp137_ = tmp136_*(tmp135_);
double tmp138_ = tmp137_*(tmp135_);
double tmp139_ = tmp138_*(tmp135_);
double tmp140_ = tmp139_*(tmp135_);
double tmp141_ = tmp140_*(tmp135_);
double tmp142_ = tmp141_*(tmp135_);
double tmp143_ = mCompCoord[3];
double tmp144_ = 1+tmp143_;
double tmp145_ = ElSquare(tmp77_);
double tmp146_ = (tmp77_)/tmp145_;
double tmp147_ = ElSquare(mLocFour19x2_State_0_0);
double tmp148_ = mCompCoord[4];
double tmp149_ = (tmp146_)*(tmp98_);
double tmp150_ = tmp149_*mLocFour19x2_State_0_0;
double tmp151_ = (tmp150_)/tmp147_;
double tmp152_ = (tmp151_)*(tmp103_);
double tmp153_ = mCompCoord[5];
double tmp154_ = tmp153_*2;
double tmp155_ = (tmp146_)*(tmp123_);
double tmp156_ = tmp155_*mLocFour19x2_State_0_0;
double tmp157_ = (tmp156_)/tmp147_;
double tmp158_ = mCompCoord[6];
double tmp159_ = (tmp157_)*(tmp128_);
double tmp160_ = mCompCoord[7];
double tmp161_ = mCompCoord[11];
double tmp162_ = tmp161_*(tmp135_);
double tmp163_ = mCompCoord[12];
double tmp164_ = tmp163_*tmp136_;
double tmp165_ = tmp162_+tmp164_;
double tmp166_ = mCompCoord[13];
double tmp167_ = tmp166_*tmp137_;
double tmp168_ = tmp165_+tmp167_;
double tmp169_ = mCompCoord[14];
double tmp170_ = tmp169_*tmp138_;
double tmp171_ = tmp168_+tmp170_;
double tmp172_ = mCompCoord[15];
double tmp173_ = tmp172_*tmp139_;
double tmp174_ = tmp171_+tmp173_;
double tmp175_ = mCompCoord[16];
double tmp176_ = tmp175_*tmp140_;
double tmp177_ = tmp174_+tmp176_;
double tmp178_ = mCompCoord[17];
double tmp179_ = tmp178_*tmp141_;
double tmp180_ = tmp177_+tmp179_;
double tmp181_ = mCompCoord[18];
double tmp182_ = tmp181_*tmp142_;
double tmp183_ = tmp180_+tmp182_;
double tmp184_ = mCompCoord[19];
double tmp185_ = tmp142_*(tmp135_);
double tmp186_ = tmp184_*tmp185_;
double tmp187_ = tmp183_+tmp186_;
double tmp188_ = (tmp151_)*(tmp130_);
double tmp189_ = (tmp157_)*(tmp132_);
double tmp190_ = tmp188_+tmp188_;
double tmp191_ = tmp189_+tmp189_;
double tmp192_ = tmp190_+tmp191_;
double tmp193_ = (tmp192_)*(tmp135_);
double tmp194_ = tmp193_+tmp193_;
double tmp195_ = (tmp194_)*(tmp135_);
double tmp196_ = (tmp192_)*tmp136_;
double tmp197_ = tmp195_+tmp196_;
double tmp198_ = (tmp197_)*(tmp135_);
double tmp199_ = (tmp192_)*tmp137_;
double tmp200_ = tmp198_+tmp199_;
double tmp201_ = (tmp200_)*(tmp135_);
double tmp202_ = (tmp192_)*tmp138_;
double tmp203_ = tmp201_+tmp202_;
double tmp204_ = (tmp203_)*(tmp135_);
double tmp205_ = (tmp192_)*tmp139_;
double tmp206_ = tmp204_+tmp205_;
double tmp207_ = (tmp206_)*(tmp135_);
double tmp208_ = (tmp192_)*tmp140_;
double tmp209_ = tmp207_+tmp208_;
double tmp210_ = (tmp209_)*(tmp135_);
double tmp211_ = (tmp192_)*tmp141_;
double tmp212_ = tmp210_+tmp211_;
double tmp213_ = mLocFour19x2_State_0_0/tmp147_;
double tmp214_ = (tmp213_)*(tmp103_);
double tmp215_ = (tmp213_)*(tmp130_);
double tmp216_ = tmp215_+tmp215_;
double tmp217_ = (tmp216_)*(tmp135_);
double tmp218_ = tmp217_+tmp217_;
double tmp219_ = (tmp218_)*(tmp135_);
double tmp220_ = (tmp216_)*tmp136_;
double tmp221_ = tmp219_+tmp220_;
double tmp222_ = (tmp221_)*(tmp135_);
double tmp223_ = (tmp216_)*tmp137_;
double tmp224_ = tmp222_+tmp223_;
double tmp225_ = (tmp224_)*(tmp135_);
double tmp226_ = (tmp216_)*tmp138_;
double tmp227_ = tmp225_+tmp226_;
double tmp228_ = (tmp227_)*(tmp135_);
double tmp229_ = (tmp216_)*tmp139_;
double tmp230_ = tmp228_+tmp229_;
double tmp231_ = (tmp230_)*(tmp135_);
double tmp232_ = (tmp216_)*tmp140_;
double tmp233_ = tmp231_+tmp232_;
double tmp234_ = (tmp233_)*(tmp135_);
double tmp235_ = (tmp216_)*tmp141_;
double tmp236_ = tmp234_+tmp235_;
double tmp237_ = (tmp213_)*(tmp128_);
double tmp238_ = (tmp213_)*(tmp132_);
double tmp239_ = tmp238_+tmp238_;
double tmp240_ = (tmp239_)*(tmp135_);
double tmp241_ = tmp240_+tmp240_;
double tmp242_ = (tmp241_)*(tmp135_);
double tmp243_ = (tmp239_)*tmp136_;
double tmp244_ = tmp242_+tmp243_;
double tmp245_ = (tmp244_)*(tmp135_);
double tmp246_ = (tmp239_)*tmp137_;
double tmp247_ = tmp245_+tmp246_;
double tmp248_ = (tmp247_)*(tmp135_);
double tmp249_ = (tmp239_)*tmp138_;
double tmp250_ = tmp248_+tmp249_;
double tmp251_ = (tmp250_)*(tmp135_);
double tmp252_ = (tmp239_)*tmp139_;
double tmp253_ = tmp251_+tmp252_;
double tmp254_ = (tmp253_)*(tmp135_);
double tmp255_ = (tmp239_)*tmp140_;
double tmp256_ = tmp254_+tmp255_;
double tmp257_ = (tmp256_)*(tmp135_);
double tmp258_ = (tmp239_)*tmp141_;
double tmp259_ = tmp257_+tmp258_;
double tmp260_ = (tmp103_)*(tmp103_);
double tmp261_ = (tmp103_)*(tmp128_);
double tmp262_ = (tmp128_)*(tmp128_);
double tmp263_ = -(1);
double tmp264_ = tmp263_*(tmp130_);
double tmp265_ = tmp264_+tmp264_;
double tmp266_ = (tmp265_)*(tmp135_);
double tmp267_ = tmp266_+tmp266_;
double tmp268_ = (tmp267_)*(tmp135_);
double tmp269_ = (tmp265_)*tmp136_;
double tmp270_ = tmp268_+tmp269_;
double tmp271_ = (tmp270_)*(tmp135_);
double tmp272_ = (tmp265_)*tmp137_;
double tmp273_ = tmp271_+tmp272_;
double tmp274_ = (tmp273_)*(tmp135_);
double tmp275_ = (tmp265_)*tmp138_;
double tmp276_ = tmp274_+tmp275_;
double tmp277_ = (tmp276_)*(tmp135_);
double tmp278_ = (tmp265_)*tmp139_;
double tmp279_ = tmp277_+tmp278_;
double tmp280_ = (tmp279_)*(tmp135_);
double tmp281_ = (tmp265_)*tmp140_;
double tmp282_ = tmp280_+tmp281_;
double tmp283_ = (tmp282_)*(tmp135_);
double tmp284_ = (tmp265_)*tmp141_;
double tmp285_ = tmp283_+tmp284_;
double tmp286_ = tmp263_*(tmp132_);
double tmp287_ = tmp286_+tmp286_;
double tmp288_ = (tmp287_)*(tmp135_);
double tmp289_ = tmp288_+tmp288_;
double tmp290_ = (tmp289_)*(tmp135_);
double tmp291_ = (tmp287_)*tmp136_;
double tmp292_ = tmp290_+tmp291_;
double tmp293_ = (tmp292_)*(tmp135_);
double tmp294_ = (tmp287_)*tmp137_;
double tmp295_ = tmp293_+tmp294_;
double tmp296_ = (tmp295_)*(tmp135_);
double tmp297_ = (tmp287_)*tmp138_;
double tmp298_ = tmp296_+tmp297_;
double tmp299_ = (tmp298_)*(tmp135_);
double tmp300_ = (tmp287_)*tmp139_;
double tmp301_ = tmp299_+tmp300_;
double tmp302_ = (tmp301_)*(tmp135_);
double tmp303_ = (tmp287_)*tmp140_;
double tmp304_ = tmp302_+tmp303_;
double tmp305_ = (tmp304_)*(tmp135_);
double tmp306_ = (tmp287_)*tmp141_;
double tmp307_ = tmp305_+tmp306_;
double tmp308_ = tmp263_*tmp5_;
double tmp309_ = tmp308_*tmp2_;
double tmp310_ = -(tmp3_);
double tmp311_ = tmp310_*tmp13_;
double tmp312_ = tmp308_*tmp14_;
double tmp313_ = tmp312_*tmp15_;
double tmp314_ = tmp311_+tmp313_;
double tmp315_ = tmp308_*tmp13_;
double tmp316_ = tmp315_+tmp27_;
double tmp317_ = tmp310_*tmp15_;
double tmp318_ = tmp312_*tmp12_;
double tmp319_ = tmp317_+tmp318_;
double tmp320_ = tmp308_*tmp15_;
double tmp321_ = tmp320_+tmp51_;
double tmp322_ = (tmp314_)*mLocGL_0_0;
double tmp323_ = (tmp316_)*mLocGL_1_0;
double tmp324_ = tmp322_+tmp323_;
double tmp325_ = (tmp324_)*(tmp23_);
double tmp326_ = (tmp314_)*mLocGL_0_1;
double tmp327_ = (tmp316_)*mLocGL_1_1;
double tmp328_ = tmp326_+tmp327_;
double tmp329_ = (tmp328_)*(tmp41_);
double tmp330_ = tmp325_+tmp329_;
double tmp331_ = (tmp314_)*mLocGL_0_2;
double tmp332_ = (tmp316_)*mLocGL_1_2;
double tmp333_ = tmp331_+tmp332_;
double tmp334_ = (tmp333_)*(tmp49_);
double tmp335_ = tmp330_+tmp334_;
double tmp336_ = tmp57_*(tmp335_);
double tmp337_ = -(tmp336_);
double tmp338_ = tmp337_/tmp145_;
double tmp339_ = tmp309_*mLocGL_0_0;
double tmp340_ = tmp4_*mLocGL_1_0;
double tmp341_ = tmp339_+tmp340_;
double tmp342_ = (tmp341_)*(tmp23_);
double tmp343_ = tmp309_*mLocGL_0_1;
double tmp344_ = tmp4_*mLocGL_1_1;
double tmp345_ = tmp343_+tmp344_;
double tmp346_ = (tmp345_)*(tmp41_);
double tmp347_ = tmp342_+tmp346_;
double tmp348_ = tmp309_*mLocGL_0_2;
double tmp349_ = tmp4_*mLocGL_1_2;
double tmp350_ = tmp348_+tmp349_;
double tmp351_ = (tmp350_)*(tmp49_);
double tmp352_ = tmp347_+tmp351_;
double tmp353_ = (tmp352_)*(tmp78_);
double tmp354_ = (tmp338_)*(tmp98_);
double tmp355_ = tmp353_+tmp354_;
double tmp356_ = (tmp355_)*mLocFour19x2_State_0_0;
double tmp357_ = (tmp356_)/tmp147_;
double tmp358_ = (tmp357_)*(tmp103_);
double tmp359_ = (tmp319_)*mLocGL_0_0;
double tmp360_ = (tmp321_)*mLocGL_1_0;
double tmp361_ = tmp359_+tmp360_;
double tmp362_ = (tmp361_)*(tmp23_);
double tmp363_ = (tmp319_)*mLocGL_0_1;
double tmp364_ = (tmp321_)*mLocGL_1_1;
double tmp365_ = tmp363_+tmp364_;
double tmp366_ = (tmp365_)*(tmp41_);
double tmp367_ = tmp362_+tmp366_;
double tmp368_ = (tmp319_)*mLocGL_0_2;
double tmp369_ = (tmp321_)*mLocGL_1_2;
double tmp370_ = tmp368_+tmp369_;
double tmp371_ = (tmp370_)*(tmp49_);
double tmp372_ = tmp367_+tmp371_;
double tmp373_ = (tmp372_)*(tmp78_);
double tmp374_ = (tmp338_)*(tmp123_);
double tmp375_ = tmp373_+tmp374_;
double tmp376_ = (tmp375_)*mLocFour19x2_State_0_0;
double tmp377_ = (tmp376_)/tmp147_;
double tmp378_ = (tmp377_)*(tmp128_);
double tmp379_ = (tmp357_)*(tmp130_);
double tmp380_ = (tmp377_)*(tmp132_);
double tmp381_ = tmp379_+tmp379_;
double tmp382_ = tmp380_+tmp380_;
double tmp383_ = tmp381_+tmp382_;
double tmp384_ = (tmp383_)*(tmp135_);
double tmp385_ = tmp384_+tmp384_;
double tmp386_ = (tmp385_)*(tmp135_);
double tmp387_ = (tmp383_)*tmp136_;
double tmp388_ = tmp386_+tmp387_;
double tmp389_ = (tmp388_)*(tmp135_);
double tmp390_ = (tmp383_)*tmp137_;
double tmp391_ = tmp389_+tmp390_;
double tmp392_ = (tmp391_)*(tmp135_);
double tmp393_ = (tmp383_)*tmp138_;
double tmp394_ = tmp392_+tmp393_;
double tmp395_ = (tmp394_)*(tmp135_);
double tmp396_ = (tmp383_)*tmp139_;
double tmp397_ = tmp395_+tmp396_;
double tmp398_ = (tmp397_)*(tmp135_);
double tmp399_ = (tmp383_)*tmp140_;
double tmp400_ = tmp398_+tmp399_;
double tmp401_ = (tmp400_)*(tmp135_);
double tmp402_ = (tmp383_)*tmp141_;
double tmp403_ = tmp401_+tmp402_;
double tmp404_ = tmp263_*tmp7_;
double tmp405_ = tmp404_*tmp3_;
double tmp406_ = tmp404_*tmp5_;
double tmp407_ = -(tmp2_);
double tmp408_ = tmp407_*tmp3_;
double tmp409_ = tmp408_*tmp15_;
double tmp410_ = tmp407_*tmp5_;
double tmp411_ = tmp410_*tmp15_;
double tmp412_ = tmp404_*tmp15_;
double tmp413_ = tmp408_*tmp12_;
double tmp414_ = tmp410_*tmp12_;
double tmp415_ = tmp404_*tmp12_;
double tmp416_ = tmp409_*mLocGL_0_0;
double tmp417_ = tmp411_*mLocGL_1_0;
double tmp418_ = tmp416_+tmp417_;
double tmp419_ = tmp412_*mLocGL_2_0;
double tmp420_ = tmp418_+tmp419_;
double tmp421_ = (tmp420_)*(tmp23_);
double tmp422_ = tmp409_*mLocGL_0_1;
double tmp423_ = tmp411_*mLocGL_1_1;
double tmp424_ = tmp422_+tmp423_;
double tmp425_ = tmp412_*mLocGL_2_1;
double tmp426_ = tmp424_+tmp425_;
double tmp427_ = (tmp426_)*(tmp41_);
double tmp428_ = tmp421_+tmp427_;
double tmp429_ = tmp409_*mLocGL_0_2;
double tmp430_ = tmp411_*mLocGL_1_2;
double tmp431_ = tmp429_+tmp430_;
double tmp432_ = tmp412_*mLocGL_2_2;
double tmp433_ = tmp431_+tmp432_;
double tmp434_ = (tmp433_)*(tmp49_);
double tmp435_ = tmp428_+tmp434_;
double tmp436_ = tmp57_*(tmp435_);
double tmp437_ = -(tmp436_);
double tmp438_ = tmp437_/tmp145_;
double tmp439_ = tmp405_*mLocGL_0_0;
double tmp440_ = tmp406_*mLocGL_1_0;
double tmp441_ = tmp439_+tmp440_;
double tmp442_ = tmp2_*mLocGL_2_0;
double tmp443_ = tmp441_+tmp442_;
double tmp444_ = (tmp443_)*(tmp23_);
double tmp445_ = tmp405_*mLocGL_0_1;
double tmp446_ = tmp406_*mLocGL_1_1;
double tmp447_ = tmp445_+tmp446_;
double tmp448_ = tmp2_*mLocGL_2_1;
double tmp449_ = tmp447_+tmp448_;
double tmp450_ = (tmp449_)*(tmp41_);
double tmp451_ = tmp444_+tmp450_;
double tmp452_ = tmp405_*mLocGL_0_2;
double tmp453_ = tmp406_*mLocGL_1_2;
double tmp454_ = tmp452_+tmp453_;
double tmp455_ = tmp2_*mLocGL_2_2;
double tmp456_ = tmp454_+tmp455_;
double tmp457_ = (tmp456_)*(tmp49_);
double tmp458_ = tmp451_+tmp457_;
double tmp459_ = (tmp458_)*(tmp78_);
double tmp460_ = (tmp438_)*(tmp98_);
double tmp461_ = tmp459_+tmp460_;
double tmp462_ = (tmp461_)*mLocFour19x2_State_0_0;
double tmp463_ = (tmp462_)/tmp147_;
double tmp464_ = (tmp463_)*(tmp103_);
double tmp465_ = tmp413_*mLocGL_0_0;
double tmp466_ = tmp414_*mLocGL_1_0;
double tmp467_ = tmp465_+tmp466_;
double tmp468_ = tmp415_*mLocGL_2_0;
double tmp469_ = tmp467_+tmp468_;
double tmp470_ = (tmp469_)*(tmp23_);
double tmp471_ = tmp413_*mLocGL_0_1;
double tmp472_ = tmp414_*mLocGL_1_1;
double tmp473_ = tmp471_+tmp472_;
double tmp474_ = tmp415_*mLocGL_2_1;
double tmp475_ = tmp473_+tmp474_;
double tmp476_ = (tmp475_)*(tmp41_);
double tmp477_ = tmp470_+tmp476_;
double tmp478_ = tmp413_*mLocGL_0_2;
double tmp479_ = tmp414_*mLocGL_1_2;
double tmp480_ = tmp478_+tmp479_;
double tmp481_ = tmp415_*mLocGL_2_2;
double tmp482_ = tmp480_+tmp481_;
double tmp483_ = (tmp482_)*(tmp49_);
double tmp484_ = tmp477_+tmp483_;
double tmp485_ = (tmp484_)*(tmp78_);
double tmp486_ = (tmp438_)*(tmp123_);
double tmp487_ = tmp485_+tmp486_;
double tmp488_ = (tmp487_)*mLocFour19x2_State_0_0;
double tmp489_ = (tmp488_)/tmp147_;
double tmp490_ = (tmp489_)*(tmp128_);
double tmp491_ = (tmp463_)*(tmp130_);
double tmp492_ = (tmp489_)*(tmp132_);
double tmp493_ = tmp491_+tmp491_;
double tmp494_ = tmp492_+tmp492_;
double tmp495_ = tmp493_+tmp494_;
double tmp496_ = (tmp495_)*(tmp135_);
double tmp497_ = tmp496_+tmp496_;
double tmp498_ = (tmp497_)*(tmp135_);
double tmp499_ = (tmp495_)*tmp136_;
double tmp500_ = tmp498_+tmp499_;
double tmp501_ = (tmp500_)*(tmp135_);
double tmp502_ = (tmp495_)*tmp137_;
double tmp503_ = tmp501_+tmp502_;
double tmp504_ = (tmp503_)*(tmp135_);
double tmp505_ = (tmp495_)*tmp138_;
double tmp506_ = tmp504_+tmp505_;
double tmp507_ = (tmp506_)*(tmp135_);
double tmp508_ = (tmp495_)*tmp139_;
double tmp509_ = tmp507_+tmp508_;
double tmp510_ = (tmp509_)*(tmp135_);
double tmp511_ = (tmp495_)*tmp140_;
double tmp512_ = tmp510_+tmp511_;
double tmp513_ = (tmp512_)*(tmp135_);
double tmp514_ = (tmp495_)*tmp141_;
double tmp515_ = tmp513_+tmp514_;
double tmp516_ = -(tmp15_);
double tmp517_ = tmp263_*tmp12_;
double tmp518_ = tmp516_*tmp24_;
double tmp519_ = tmp517_*tmp26_;
double tmp520_ = tmp518_+tmp519_;
double tmp521_ = tmp516_*tmp3_;
double tmp522_ = tmp517_*tmp30_;
double tmp523_ = tmp521_+tmp522_;
double tmp524_ = tmp517_*tmp2_;
double tmp525_ = tmp517_*tmp24_;
double tmp526_ = tmp15_*tmp26_;
double tmp527_ = tmp525_+tmp526_;
double tmp528_ = tmp517_*tmp3_;
double tmp529_ = tmp15_*tmp30_;
double tmp530_ = tmp528_+tmp529_;
double tmp531_ = tmp15_*tmp2_;
double tmp532_ = (tmp520_)*mLocGL_0_0;
double tmp533_ = (tmp523_)*mLocGL_1_0;
double tmp534_ = tmp532_+tmp533_;
double tmp535_ = tmp524_*mLocGL_2_0;
double tmp536_ = tmp534_+tmp535_;
double tmp537_ = (tmp536_)*(tmp23_);
double tmp538_ = (tmp520_)*mLocGL_0_1;
double tmp539_ = (tmp523_)*mLocGL_1_1;
double tmp540_ = tmp538_+tmp539_;
double tmp541_ = tmp524_*mLocGL_2_1;
double tmp542_ = tmp540_+tmp541_;
double tmp543_ = (tmp542_)*(tmp41_);
double tmp544_ = tmp537_+tmp543_;
double tmp545_ = (tmp520_)*mLocGL_0_2;
double tmp546_ = (tmp523_)*mLocGL_1_2;
double tmp547_ = tmp545_+tmp546_;
double tmp548_ = tmp524_*mLocGL_2_2;
double tmp549_ = tmp547_+tmp548_;
double tmp550_ = (tmp549_)*(tmp49_);
double tmp551_ = tmp544_+tmp550_;
double tmp552_ = tmp57_*(tmp551_);
double tmp553_ = -(tmp552_);
double tmp554_ = tmp553_/tmp145_;
double tmp555_ = (tmp554_)*(tmp98_);
double tmp556_ = tmp555_*mLocFour19x2_State_0_0;
double tmp557_ = (tmp556_)/tmp147_;
double tmp558_ = (tmp557_)*(tmp103_);
double tmp559_ = (tmp527_)*mLocGL_0_0;
double tmp560_ = (tmp530_)*mLocGL_1_0;
double tmp561_ = tmp559_+tmp560_;
double tmp562_ = tmp531_*mLocGL_2_0;
double tmp563_ = tmp561_+tmp562_;
double tmp564_ = (tmp563_)*(tmp23_);
double tmp565_ = (tmp527_)*mLocGL_0_1;
double tmp566_ = (tmp530_)*mLocGL_1_1;
double tmp567_ = tmp565_+tmp566_;
double tmp568_ = tmp531_*mLocGL_2_1;
double tmp569_ = tmp567_+tmp568_;
double tmp570_ = (tmp569_)*(tmp41_);
double tmp571_ = tmp564_+tmp570_;
double tmp572_ = (tmp527_)*mLocGL_0_2;
double tmp573_ = (tmp530_)*mLocGL_1_2;
double tmp574_ = tmp572_+tmp573_;
double tmp575_ = tmp531_*mLocGL_2_2;
double tmp576_ = tmp574_+tmp575_;
double tmp577_ = (tmp576_)*(tmp49_);
double tmp578_ = tmp571_+tmp577_;
double tmp579_ = (tmp578_)*(tmp78_);
double tmp580_ = (tmp554_)*(tmp123_);
double tmp581_ = tmp579_+tmp580_;
double tmp582_ = (tmp581_)*mLocFour19x2_State_0_0;
double tmp583_ = (tmp582_)/tmp147_;
double tmp584_ = (tmp583_)*(tmp128_);
double tmp585_ = (tmp557_)*(tmp130_);
double tmp586_ = (tmp583_)*(tmp132_);
double tmp587_ = tmp585_+tmp585_;
double tmp588_ = tmp586_+tmp586_;
double tmp589_ = tmp587_+tmp588_;
double tmp590_ = (tmp589_)*(tmp135_);
double tmp591_ = tmp590_+tmp590_;
double tmp592_ = (tmp591_)*(tmp135_);
double tmp593_ = (tmp589_)*tmp136_;
double tmp594_ = tmp592_+tmp593_;
double tmp595_ = (tmp594_)*(tmp135_);
double tmp596_ = (tmp589_)*tmp137_;
double tmp597_ = tmp595_+tmp596_;
double tmp598_ = (tmp597_)*(tmp135_);
double tmp599_ = (tmp589_)*tmp138_;
double tmp600_ = tmp598_+tmp599_;
double tmp601_ = (tmp600_)*(tmp135_);
double tmp602_ = (tmp589_)*tmp139_;
double tmp603_ = tmp601_+tmp602_;
double tmp604_ = (tmp603_)*(tmp135_);
double tmp605_ = (tmp589_)*tmp140_;
double tmp606_ = tmp604_+tmp605_;
double tmp607_ = (tmp606_)*(tmp135_);
double tmp608_ = (tmp589_)*tmp141_;
double tmp609_ = tmp607_+tmp608_;
double tmp610_ = tmp263_*(tmp62_);
double tmp611_ = tmp57_*tmp610_;
double tmp612_ = -(tmp611_);
double tmp613_ = tmp612_/tmp145_;
double tmp614_ = tmp263_*(tmp83_);
double tmp615_ = tmp614_*(tmp78_);
double tmp616_ = (tmp613_)*(tmp98_);
double tmp617_ = tmp615_+tmp616_;
double tmp618_ = (tmp617_)*mLocFour19x2_State_0_0;
double tmp619_ = (tmp618_)/tmp147_;
double tmp620_ = (tmp619_)*(tmp103_);
double tmp621_ = tmp263_*(tmp108_);
double tmp622_ = tmp621_*(tmp78_);
double tmp623_ = (tmp613_)*(tmp123_);
double tmp624_ = tmp622_+tmp623_;
double tmp625_ = (tmp624_)*mLocFour19x2_State_0_0;
double tmp626_ = (tmp625_)/tmp147_;
double tmp627_ = (tmp626_)*(tmp128_);
double tmp628_ = (tmp619_)*(tmp130_);
double tmp629_ = (tmp626_)*(tmp132_);
double tmp630_ = tmp628_+tmp628_;
double tmp631_ = tmp629_+tmp629_;
double tmp632_ = tmp630_+tmp631_;
double tmp633_ = (tmp632_)*(tmp135_);
double tmp634_ = tmp633_+tmp633_;
double tmp635_ = (tmp634_)*(tmp135_);
double tmp636_ = (tmp632_)*tmp136_;
double tmp637_ = tmp635_+tmp636_;
double tmp638_ = (tmp637_)*(tmp135_);
double tmp639_ = (tmp632_)*tmp137_;
double tmp640_ = tmp638_+tmp639_;
double tmp641_ = (tmp640_)*(tmp135_);
double tmp642_ = (tmp632_)*tmp138_;
double tmp643_ = tmp641_+tmp642_;
double tmp644_ = (tmp643_)*(tmp135_);
double tmp645_ = (tmp632_)*tmp139_;
double tmp646_ = tmp644_+tmp645_;
double tmp647_ = (tmp646_)*(tmp135_);
double tmp648_ = (tmp632_)*tmp140_;
double tmp649_ = tmp647_+tmp648_;
double tmp650_ = (tmp649_)*(tmp135_);
double tmp651_ = (tmp632_)*tmp141_;
double tmp652_ = tmp650_+tmp651_;
double tmp653_ = tmp263_*(tmp68_);
double tmp654_ = tmp57_*tmp653_;
double tmp655_ = -(tmp654_);
double tmp656_ = tmp655_/tmp145_;
double tmp657_ = tmp263_*(tmp89_);
double tmp658_ = tmp657_*(tmp78_);
double tmp659_ = (tmp656_)*(tmp98_);
double tmp660_ = tmp658_+tmp659_;
double tmp661_ = (tmp660_)*mLocFour19x2_State_0_0;
double tmp662_ = (tmp661_)/tmp147_;
double tmp663_ = (tmp662_)*(tmp103_);
double tmp664_ = tmp263_*(tmp114_);
double tmp665_ = tmp664_*(tmp78_);
double tmp666_ = (tmp656_)*(tmp123_);
double tmp667_ = tmp665_+tmp666_;
double tmp668_ = (tmp667_)*mLocFour19x2_State_0_0;
double tmp669_ = (tmp668_)/tmp147_;
double tmp670_ = (tmp669_)*(tmp128_);
double tmp671_ = (tmp662_)*(tmp130_);
double tmp672_ = (tmp669_)*(tmp132_);
double tmp673_ = tmp671_+tmp671_;
double tmp674_ = tmp672_+tmp672_;
double tmp675_ = tmp673_+tmp674_;
double tmp676_ = (tmp675_)*(tmp135_);
double tmp677_ = tmp676_+tmp676_;
double tmp678_ = (tmp677_)*(tmp135_);
double tmp679_ = (tmp675_)*tmp136_;
double tmp680_ = tmp678_+tmp679_;
double tmp681_ = (tmp680_)*(tmp135_);
double tmp682_ = (tmp675_)*tmp137_;
double tmp683_ = tmp681_+tmp682_;
double tmp684_ = (tmp683_)*(tmp135_);
double tmp685_ = (tmp675_)*tmp138_;
double tmp686_ = tmp684_+tmp685_;
double tmp687_ = (tmp686_)*(tmp135_);
double tmp688_ = (tmp675_)*tmp139_;
double tmp689_ = tmp687_+tmp688_;
double tmp690_ = (tmp689_)*(tmp135_);
double tmp691_ = (tmp675_)*tmp140_;
double tmp692_ = tmp690_+tmp691_;
double tmp693_ = (tmp692_)*(tmp135_);
double tmp694_ = (tmp675_)*tmp141_;
double tmp695_ = tmp693_+tmp694_;
double tmp696_ = tmp263_*(tmp75_);
double tmp697_ = tmp57_*tmp696_;
double tmp698_ = -(tmp697_);
double tmp699_ = tmp698_/tmp145_;
double tmp700_ = tmp263_*(tmp96_);
double tmp701_ = tmp700_*(tmp78_);
double tmp702_ = (tmp699_)*(tmp98_);
double tmp703_ = tmp701_+tmp702_;
double tmp704_ = (tmp703_)*mLocFour19x2_State_0_0;
double tmp705_ = (tmp704_)/tmp147_;
double tmp706_ = (tmp705_)*(tmp103_);
double tmp707_ = tmp263_*(tmp121_);
double tmp708_ = tmp707_*(tmp78_);
double tmp709_ = (tmp699_)*(tmp123_);
double tmp710_ = tmp708_+tmp709_;
double tmp711_ = (tmp710_)*mLocFour19x2_State_0_0;
double tmp712_ = (tmp711_)/tmp147_;
double tmp713_ = (tmp712_)*(tmp128_);
double tmp714_ = (tmp705_)*(tmp130_);
double tmp715_ = (tmp712_)*(tmp132_);
double tmp716_ = tmp714_+tmp714_;
double tmp717_ = tmp715_+tmp715_;
double tmp718_ = tmp716_+tmp717_;
double tmp719_ = (tmp718_)*(tmp135_);
double tmp720_ = tmp719_+tmp719_;
double tmp721_ = (tmp720_)*(tmp135_);
double tmp722_ = (tmp718_)*tmp136_;
double tmp723_ = tmp721_+tmp722_;
double tmp724_ = (tmp723_)*(tmp135_);
double tmp725_ = (tmp718_)*tmp137_;
double tmp726_ = tmp724_+tmp725_;
double tmp727_ = (tmp726_)*(tmp135_);
double tmp728_ = (tmp718_)*tmp138_;
double tmp729_ = tmp727_+tmp728_;
double tmp730_ = (tmp729_)*(tmp135_);
double tmp731_ = (tmp718_)*tmp139_;
double tmp732_ = tmp730_+tmp731_;
double tmp733_ = (tmp732_)*(tmp135_);
double tmp734_ = (tmp718_)*tmp140_;
double tmp735_ = tmp733_+tmp734_;
double tmp736_ = (tmp735_)*(tmp135_);
double tmp737_ = (tmp718_)*tmp141_;
double tmp738_ = tmp736_+tmp737_;
double tmp739_ = mLocProjI_x*(tmp62_);
double tmp740_ = mLocProjI_y*(tmp68_);
double tmp741_ = tmp739_+tmp740_;
double tmp742_ = mLocProjI_z*(tmp75_);
double tmp743_ = tmp741_+tmp742_;
double tmp744_ = tmp57_*(tmp743_);
double tmp745_ = -(tmp744_);
double tmp746_ = tmp745_/tmp145_;
double tmp747_ = mLocProjI_x*(tmp83_);
double tmp748_ = mLocProjI_y*(tmp89_);
double tmp749_ = tmp747_+tmp748_;
double tmp750_ = mLocProjI_z*(tmp96_);
double tmp751_ = tmp749_+tmp750_;
double tmp752_ = (tmp751_)*(tmp78_);
double tmp753_ = (tmp746_)*(tmp98_);
double tmp754_ = tmp752_+tmp753_;
double tmp755_ = (tmp754_)*mLocFour19x2_State_0_0;
double tmp756_ = (tmp755_)/tmp147_;
double tmp757_ = (tmp756_)*(tmp103_);
double tmp758_ = mLocProjI_x*(tmp108_);
double tmp759_ = mLocProjI_y*(tmp114_);
double tmp760_ = tmp758_+tmp759_;
double tmp761_ = mLocProjI_z*(tmp121_);
double tmp762_ = tmp760_+tmp761_;
double tmp763_ = (tmp762_)*(tmp78_);
double tmp764_ = (tmp746_)*(tmp123_);
double tmp765_ = tmp763_+tmp764_;
double tmp766_ = (tmp765_)*mLocFour19x2_State_0_0;
double tmp767_ = (tmp766_)/tmp147_;
double tmp768_ = (tmp767_)*(tmp128_);
double tmp769_ = (tmp756_)*(tmp130_);
double tmp770_ = (tmp767_)*(tmp132_);
double tmp771_ = tmp769_+tmp769_;
double tmp772_ = tmp770_+tmp770_;
double tmp773_ = tmp771_+tmp772_;
double tmp774_ = (tmp773_)*(tmp135_);
double tmp775_ = tmp774_+tmp774_;
double tmp776_ = (tmp775_)*(tmp135_);
double tmp777_ = (tmp773_)*tmp136_;
double tmp778_ = tmp776_+tmp777_;
double tmp779_ = (tmp778_)*(tmp135_);
double tmp780_ = (tmp773_)*tmp137_;
double tmp781_ = tmp779_+tmp780_;
double tmp782_ = (tmp781_)*(tmp135_);
double tmp783_ = (tmp773_)*tmp138_;
double tmp784_ = tmp782_+tmp783_;
double tmp785_ = (tmp784_)*(tmp135_);
double tmp786_ = (tmp773_)*tmp139_;
double tmp787_ = tmp785_+tmp786_;
double tmp788_ = (tmp787_)*(tmp135_);
double tmp789_ = (tmp773_)*tmp140_;
double tmp790_ = tmp788_+tmp789_;
double tmp791_ = (tmp790_)*(tmp135_);
double tmp792_ = (tmp773_)*tmp141_;
double tmp793_ = tmp791_+tmp792_;
double tmp794_ = mLocProjJ_x*(tmp62_);
double tmp795_ = mLocProjJ_y*(tmp68_);
double tmp796_ = tmp794_+tmp795_;
double tmp797_ = mLocProjJ_z*(tmp75_);
double tmp798_ = tmp796_+tmp797_;
double tmp799_ = tmp57_*(tmp798_);
double tmp800_ = -(tmp799_);
double tmp801_ = tmp800_/tmp145_;
double tmp802_ = mLocProjJ_x*(tmp83_);
double tmp803_ = mLocProjJ_y*(tmp89_);
double tmp804_ = tmp802_+tmp803_;
double tmp805_ = mLocProjJ_z*(tmp96_);
double tmp806_ = tmp804_+tmp805_;
double tmp807_ = (tmp806_)*(tmp78_);
double tmp808_ = (tmp801_)*(tmp98_);
double tmp809_ = tmp807_+tmp808_;
double tmp810_ = (tmp809_)*mLocFour19x2_State_0_0;
double tmp811_ = (tmp810_)/tmp147_;
double tmp812_ = (tmp811_)*(tmp103_);
double tmp813_ = mLocProjJ_x*(tmp108_);
double tmp814_ = mLocProjJ_y*(tmp114_);
double tmp815_ = tmp813_+tmp814_;
double tmp816_ = mLocProjJ_z*(tmp121_);
double tmp817_ = tmp815_+tmp816_;
double tmp818_ = (tmp817_)*(tmp78_);
double tmp819_ = (tmp801_)*(tmp123_);
double tmp820_ = tmp818_+tmp819_;
double tmp821_ = (tmp820_)*mLocFour19x2_State_0_0;
double tmp822_ = (tmp821_)/tmp147_;
double tmp823_ = (tmp822_)*(tmp128_);
double tmp824_ = (tmp811_)*(tmp130_);
double tmp825_ = (tmp822_)*(tmp132_);
double tmp826_ = tmp824_+tmp824_;
double tmp827_ = tmp825_+tmp825_;
double tmp828_ = tmp826_+tmp827_;
double tmp829_ = (tmp828_)*(tmp135_);
double tmp830_ = tmp829_+tmp829_;
double tmp831_ = (tmp830_)*(tmp135_);
double tmp832_ = (tmp828_)*tmp136_;
double tmp833_ = tmp831_+tmp832_;
double tmp834_ = (tmp833_)*(tmp135_);
double tmp835_ = (tmp828_)*tmp137_;
double tmp836_ = tmp834_+tmp835_;
double tmp837_ = (tmp836_)*(tmp135_);
double tmp838_ = (tmp828_)*tmp138_;
double tmp839_ = tmp837_+tmp838_;
double tmp840_ = (tmp839_)*(tmp135_);
double tmp841_ = (tmp828_)*tmp139_;
double tmp842_ = tmp840_+tmp841_;
double tmp843_ = (tmp842_)*(tmp135_);
double tmp844_ = (tmp828_)*tmp140_;
double tmp845_ = tmp843_+tmp844_;
double tmp846_ = (tmp845_)*(tmp135_);
double tmp847_ = (tmp828_)*tmp141_;
double tmp848_ = tmp846_+tmp847_;
double tmp849_ = mLocProjK_x*(tmp62_);
double tmp850_ = mLocProjK_y*(tmp68_);
double tmp851_ = tmp849_+tmp850_;
double tmp852_ = mLocProjK_z*(tmp75_);
double tmp853_ = tmp851_+tmp852_;
double tmp854_ = tmp57_*(tmp853_);
double tmp855_ = -(tmp854_);
double tmp856_ = tmp855_/tmp145_;
double tmp857_ = mLocProjK_x*(tmp83_);
double tmp858_ = mLocProjK_y*(tmp89_);
double tmp859_ = tmp857_+tmp858_;
double tmp860_ = mLocProjK_z*(tmp96_);
double tmp861_ = tmp859_+tmp860_;
double tmp862_ = (tmp861_)*(tmp78_);
double tmp863_ = (tmp856_)*(tmp98_);
double tmp864_ = tmp862_+tmp863_;
double tmp865_ = (tmp864_)*mLocFour19x2_State_0_0;
double tmp866_ = (tmp865_)/tmp147_;
double tmp867_ = (tmp866_)*(tmp103_);
double tmp868_ = mLocProjK_x*(tmp108_);
double tmp869_ = mLocProjK_y*(tmp114_);
double tmp870_ = tmp868_+tmp869_;
double tmp871_ = mLocProjK_z*(tmp121_);
double tmp872_ = tmp870_+tmp871_;
double tmp873_ = (tmp872_)*(tmp78_);
double tmp874_ = (tmp856_)*(tmp123_);
double tmp875_ = tmp873_+tmp874_;
double tmp876_ = (tmp875_)*mLocFour19x2_State_0_0;
double tmp877_ = (tmp876_)/tmp147_;
double tmp878_ = (tmp877_)*(tmp128_);
double tmp879_ = (tmp866_)*(tmp130_);
double tmp880_ = (tmp877_)*(tmp132_);
double tmp881_ = tmp879_+tmp879_;
double tmp882_ = tmp880_+tmp880_;
double tmp883_ = tmp881_+tmp882_;
double tmp884_ = (tmp883_)*(tmp135_);
double tmp885_ = tmp884_+tmp884_;
double tmp886_ = (tmp885_)*(tmp135_);
double tmp887_ = (tmp883_)*tmp136_;
double tmp888_ = tmp886_+tmp887_;
double tmp889_ = (tmp888_)*(tmp135_);
double tmp890_ = (tmp883_)*tmp137_;
double tmp891_ = tmp889_+tmp890_;
double tmp892_ = (tmp891_)*(tmp135_);
double tmp893_ = (tmp883_)*tmp138_;
double tmp894_ = tmp892_+tmp893_;
double tmp895_ = (tmp894_)*(tmp135_);
double tmp896_ = (tmp883_)*tmp139_;
double tmp897_ = tmp895_+tmp896_;
double tmp898_ = (tmp897_)*(tmp135_);
double tmp899_ = (tmp883_)*tmp140_;
double tmp900_ = tmp898_+tmp899_;
double tmp901_ = (tmp900_)*(tmp135_);
double tmp902_ = (tmp883_)*tmp141_;
double tmp903_ = tmp901_+tmp902_;
double tmp904_ = 1-tmp143_;
double tmp905_ = (tmp151_)*(tmp128_);
double tmp906_ = (tmp157_)*(tmp103_);
double tmp907_ = tmp905_+tmp906_;
double tmp908_ = tmp159_+tmp159_;
double tmp909_ = tmp158_*2;
double tmp910_ = tmp152_+tmp152_;
double tmp911_ = mCompCoord[8];
double tmp912_ = (tmp192_)*tmp161_;
double tmp913_ = (tmp194_)*tmp163_;
double tmp914_ = tmp912_+tmp913_;
double tmp915_ = (tmp197_)*tmp166_;
double tmp916_ = tmp914_+tmp915_;
double tmp917_ = (tmp200_)*tmp169_;
double tmp918_ = tmp916_+tmp917_;
double tmp919_ = (tmp203_)*tmp172_;
double tmp920_ = tmp918_+tmp919_;
double tmp921_ = (tmp206_)*tmp175_;
double tmp922_ = tmp920_+tmp921_;
double tmp923_ = (tmp209_)*tmp178_;
double tmp924_ = tmp922_+tmp923_;
double tmp925_ = (tmp212_)*tmp181_;
double tmp926_ = tmp924_+tmp925_;
double tmp927_ = (tmp212_)*(tmp135_);
double tmp928_ = (tmp192_)*tmp142_;
double tmp929_ = tmp927_+tmp928_;
double tmp930_ = (tmp929_)*tmp184_;
double tmp931_ = tmp926_+tmp930_;
double tmp932_ = (tmp213_)*tmp148_;
double tmp933_ = tmp214_+tmp214_;
double tmp934_ = (tmp216_)*tmp161_;
double tmp935_ = (tmp218_)*tmp163_;
double tmp936_ = tmp934_+tmp935_;
double tmp937_ = (tmp221_)*tmp166_;
double tmp938_ = tmp936_+tmp937_;
double tmp939_ = (tmp224_)*tmp169_;
double tmp940_ = tmp938_+tmp939_;
double tmp941_ = (tmp227_)*tmp172_;
double tmp942_ = tmp940_+tmp941_;
double tmp943_ = (tmp230_)*tmp175_;
double tmp944_ = tmp942_+tmp943_;
double tmp945_ = (tmp233_)*tmp178_;
double tmp946_ = tmp944_+tmp945_;
double tmp947_ = (tmp236_)*tmp181_;
double tmp948_ = tmp946_+tmp947_;
double tmp949_ = (tmp236_)*(tmp135_);
double tmp950_ = (tmp216_)*tmp142_;
double tmp951_ = tmp949_+tmp950_;
double tmp952_ = (tmp951_)*tmp184_;
double tmp953_ = tmp948_+tmp952_;
double tmp954_ = tmp237_+tmp237_;
double tmp955_ = (tmp213_)*(tmp187_);
double tmp956_ = (tmp239_)*tmp161_;
double tmp957_ = (tmp241_)*tmp163_;
double tmp958_ = tmp956_+tmp957_;
double tmp959_ = (tmp244_)*tmp166_;
double tmp960_ = tmp958_+tmp959_;
double tmp961_ = (tmp247_)*tmp169_;
double tmp962_ = tmp960_+tmp961_;
double tmp963_ = (tmp250_)*tmp172_;
double tmp964_ = tmp962_+tmp963_;
double tmp965_ = (tmp253_)*tmp175_;
double tmp966_ = tmp964_+tmp965_;
double tmp967_ = (tmp256_)*tmp178_;
double tmp968_ = tmp966_+tmp967_;
double tmp969_ = (tmp259_)*tmp181_;
double tmp970_ = tmp968_+tmp969_;
double tmp971_ = (tmp259_)*(tmp135_);
double tmp972_ = (tmp239_)*tmp142_;
double tmp973_ = tmp971_+tmp972_;
double tmp974_ = (tmp973_)*tmp184_;
double tmp975_ = tmp970_+tmp974_;
double tmp976_ = (tmp103_)*mLocFour19x2_State_0_0;
double tmp977_ = tmp976_*mLocScNorm;
double tmp978_ = tmp261_*mLocFour19x2_State_0_0;
double tmp979_ = tmp978_*mLocScNorm;
double tmp980_ = (tmp265_)*tmp161_;
double tmp981_ = (tmp267_)*tmp163_;
double tmp982_ = tmp980_+tmp981_;
double tmp983_ = (tmp270_)*tmp166_;
double tmp984_ = tmp982_+tmp983_;
double tmp985_ = (tmp273_)*tmp169_;
double tmp986_ = tmp984_+tmp985_;
double tmp987_ = (tmp276_)*tmp172_;
double tmp988_ = tmp986_+tmp987_;
double tmp989_ = (tmp279_)*tmp175_;
double tmp990_ = tmp988_+tmp989_;
double tmp991_ = (tmp282_)*tmp178_;
double tmp992_ = tmp990_+tmp991_;
double tmp993_ = (tmp285_)*tmp181_;
double tmp994_ = tmp992_+tmp993_;
double tmp995_ = (tmp285_)*(tmp135_);
double tmp996_ = (tmp265_)*tmp142_;
double tmp997_ = tmp995_+tmp996_;
double tmp998_ = (tmp997_)*tmp184_;
double tmp999_ = tmp994_+tmp998_;
double tmp1000_ = tmp263_*(tmp187_);
double tmp1001_ = (tmp287_)*tmp161_;
double tmp1002_ = (tmp289_)*tmp163_;
double tmp1003_ = tmp1001_+tmp1002_;
double tmp1004_ = (tmp292_)*tmp166_;
double tmp1005_ = tmp1003_+tmp1004_;
double tmp1006_ = (tmp295_)*tmp169_;
double tmp1007_ = tmp1005_+tmp1006_;
double tmp1008_ = (tmp298_)*tmp172_;
double tmp1009_ = tmp1007_+tmp1008_;
double tmp1010_ = (tmp301_)*tmp175_;
double tmp1011_ = tmp1009_+tmp1010_;
double tmp1012_ = (tmp304_)*tmp178_;
double tmp1013_ = tmp1011_+tmp1012_;
double tmp1014_ = (tmp307_)*tmp181_;
double tmp1015_ = tmp1013_+tmp1014_;
double tmp1016_ = (tmp307_)*(tmp135_);
double tmp1017_ = (tmp287_)*tmp142_;
double tmp1018_ = tmp1016_+tmp1017_;
double tmp1019_ = (tmp1018_)*tmp184_;
double tmp1020_ = tmp1015_+tmp1019_;
double tmp1021_ = (tmp357_)*(tmp128_);
double tmp1022_ = (tmp377_)*(tmp103_);
double tmp1023_ = tmp1021_+tmp1022_;
double tmp1024_ = tmp378_+tmp378_;
double tmp1025_ = tmp358_+tmp358_;
double tmp1026_ = (tmp383_)*tmp161_;
double tmp1027_ = (tmp385_)*tmp163_;
double tmp1028_ = tmp1026_+tmp1027_;
double tmp1029_ = (tmp388_)*tmp166_;
double tmp1030_ = tmp1028_+tmp1029_;
double tmp1031_ = (tmp391_)*tmp169_;
double tmp1032_ = tmp1030_+tmp1031_;
double tmp1033_ = (tmp394_)*tmp172_;
double tmp1034_ = tmp1032_+tmp1033_;
double tmp1035_ = (tmp397_)*tmp175_;
double tmp1036_ = tmp1034_+tmp1035_;
double tmp1037_ = (tmp400_)*tmp178_;
double tmp1038_ = tmp1036_+tmp1037_;
double tmp1039_ = (tmp403_)*tmp181_;
double tmp1040_ = tmp1038_+tmp1039_;
double tmp1041_ = (tmp403_)*(tmp135_);
double tmp1042_ = (tmp383_)*tmp142_;
double tmp1043_ = tmp1041_+tmp1042_;
double tmp1044_ = (tmp1043_)*tmp184_;
double tmp1045_ = tmp1040_+tmp1044_;
double tmp1046_ = (tmp463_)*(tmp128_);
double tmp1047_ = (tmp489_)*(tmp103_);
double tmp1048_ = tmp1046_+tmp1047_;
double tmp1049_ = tmp490_+tmp490_;
double tmp1050_ = tmp464_+tmp464_;
double tmp1051_ = (tmp495_)*tmp161_;
double tmp1052_ = (tmp497_)*tmp163_;
double tmp1053_ = tmp1051_+tmp1052_;
double tmp1054_ = (tmp500_)*tmp166_;
double tmp1055_ = tmp1053_+tmp1054_;
double tmp1056_ = (tmp503_)*tmp169_;
double tmp1057_ = tmp1055_+tmp1056_;
double tmp1058_ = (tmp506_)*tmp172_;
double tmp1059_ = tmp1057_+tmp1058_;
double tmp1060_ = (tmp509_)*tmp175_;
double tmp1061_ = tmp1059_+tmp1060_;
double tmp1062_ = (tmp512_)*tmp178_;
double tmp1063_ = tmp1061_+tmp1062_;
double tmp1064_ = (tmp515_)*tmp181_;
double tmp1065_ = tmp1063_+tmp1064_;
double tmp1066_ = (tmp515_)*(tmp135_);
double tmp1067_ = (tmp495_)*tmp142_;
double tmp1068_ = tmp1066_+tmp1067_;
double tmp1069_ = (tmp1068_)*tmp184_;
double tmp1070_ = tmp1065_+tmp1069_;
double tmp1071_ = (tmp557_)*(tmp128_);
double tmp1072_ = (tmp583_)*(tmp103_);
double tmp1073_ = tmp1071_+tmp1072_;
double tmp1074_ = tmp584_+tmp584_;
double tmp1075_ = tmp558_+tmp558_;
double tmp1076_ = (tmp589_)*tmp161_;
double tmp1077_ = (tmp591_)*tmp163_;
double tmp1078_ = tmp1076_+tmp1077_;
double tmp1079_ = (tmp594_)*tmp166_;
double tmp1080_ = tmp1078_+tmp1079_;
double tmp1081_ = (tmp597_)*tmp169_;
double tmp1082_ = tmp1080_+tmp1081_;
double tmp1083_ = (tmp600_)*tmp172_;
double tmp1084_ = tmp1082_+tmp1083_;
double tmp1085_ = (tmp603_)*tmp175_;
double tmp1086_ = tmp1084_+tmp1085_;
double tmp1087_ = (tmp606_)*tmp178_;
double tmp1088_ = tmp1086_+tmp1087_;
double tmp1089_ = (tmp609_)*tmp181_;
double tmp1090_ = tmp1088_+tmp1089_;
double tmp1091_ = (tmp609_)*(tmp135_);
double tmp1092_ = (tmp589_)*tmp142_;
double tmp1093_ = tmp1091_+tmp1092_;
double tmp1094_ = (tmp1093_)*tmp184_;
double tmp1095_ = tmp1090_+tmp1094_;
double tmp1096_ = (tmp619_)*(tmp128_);
double tmp1097_ = (tmp626_)*(tmp103_);
double tmp1098_ = tmp1096_+tmp1097_;
double tmp1099_ = tmp627_+tmp627_;
double tmp1100_ = tmp620_+tmp620_;
double tmp1101_ = (tmp632_)*tmp161_;
double tmp1102_ = (tmp634_)*tmp163_;
double tmp1103_ = tmp1101_+tmp1102_;
double tmp1104_ = (tmp637_)*tmp166_;
double tmp1105_ = tmp1103_+tmp1104_;
double tmp1106_ = (tmp640_)*tmp169_;
double tmp1107_ = tmp1105_+tmp1106_;
double tmp1108_ = (tmp643_)*tmp172_;
double tmp1109_ = tmp1107_+tmp1108_;
double tmp1110_ = (tmp646_)*tmp175_;
double tmp1111_ = tmp1109_+tmp1110_;
double tmp1112_ = (tmp649_)*tmp178_;
double tmp1113_ = tmp1111_+tmp1112_;
double tmp1114_ = (tmp652_)*tmp181_;
double tmp1115_ = tmp1113_+tmp1114_;
double tmp1116_ = (tmp652_)*(tmp135_);
double tmp1117_ = (tmp632_)*tmp142_;
double tmp1118_ = tmp1116_+tmp1117_;
double tmp1119_ = (tmp1118_)*tmp184_;
double tmp1120_ = tmp1115_+tmp1119_;
double tmp1121_ = (tmp662_)*(tmp128_);
double tmp1122_ = (tmp669_)*(tmp103_);
double tmp1123_ = tmp1121_+tmp1122_;
double tmp1124_ = tmp670_+tmp670_;
double tmp1125_ = tmp663_+tmp663_;
double tmp1126_ = (tmp675_)*tmp161_;
double tmp1127_ = (tmp677_)*tmp163_;
double tmp1128_ = tmp1126_+tmp1127_;
double tmp1129_ = (tmp680_)*tmp166_;
double tmp1130_ = tmp1128_+tmp1129_;
double tmp1131_ = (tmp683_)*tmp169_;
double tmp1132_ = tmp1130_+tmp1131_;
double tmp1133_ = (tmp686_)*tmp172_;
double tmp1134_ = tmp1132_+tmp1133_;
double tmp1135_ = (tmp689_)*tmp175_;
double tmp1136_ = tmp1134_+tmp1135_;
double tmp1137_ = (tmp692_)*tmp178_;
double tmp1138_ = tmp1136_+tmp1137_;
double tmp1139_ = (tmp695_)*tmp181_;
double tmp1140_ = tmp1138_+tmp1139_;
double tmp1141_ = (tmp695_)*(tmp135_);
double tmp1142_ = (tmp675_)*tmp142_;
double tmp1143_ = tmp1141_+tmp1142_;
double tmp1144_ = (tmp1143_)*tmp184_;
double tmp1145_ = tmp1140_+tmp1144_;
double tmp1146_ = (tmp705_)*(tmp128_);
double tmp1147_ = (tmp712_)*(tmp103_);
double tmp1148_ = tmp1146_+tmp1147_;
double tmp1149_ = tmp713_+tmp713_;
double tmp1150_ = tmp706_+tmp706_;
double tmp1151_ = (tmp718_)*tmp161_;
double tmp1152_ = (tmp720_)*tmp163_;
double tmp1153_ = tmp1151_+tmp1152_;
double tmp1154_ = (tmp723_)*tmp166_;
double tmp1155_ = tmp1153_+tmp1154_;
double tmp1156_ = (tmp726_)*tmp169_;
double tmp1157_ = tmp1155_+tmp1156_;
double tmp1158_ = (tmp729_)*tmp172_;
double tmp1159_ = tmp1157_+tmp1158_;
double tmp1160_ = (tmp732_)*tmp175_;
double tmp1161_ = tmp1159_+tmp1160_;
double tmp1162_ = (tmp735_)*tmp178_;
double tmp1163_ = tmp1161_+tmp1162_;
double tmp1164_ = (tmp738_)*tmp181_;
double tmp1165_ = tmp1163_+tmp1164_;
double tmp1166_ = (tmp738_)*(tmp135_);
double tmp1167_ = (tmp718_)*tmp142_;
double tmp1168_ = tmp1166_+tmp1167_;
double tmp1169_ = (tmp1168_)*tmp184_;
double tmp1170_ = tmp1165_+tmp1169_;
double tmp1171_ = (tmp756_)*(tmp128_);
double tmp1172_ = (tmp767_)*(tmp103_);
double tmp1173_ = tmp1171_+tmp1172_;
double tmp1174_ = tmp768_+tmp768_;
double tmp1175_ = tmp757_+tmp757_;
double tmp1176_ = (tmp773_)*tmp161_;
double tmp1177_ = (tmp775_)*tmp163_;
double tmp1178_ = tmp1176_+tmp1177_;
double tmp1179_ = (tmp778_)*tmp166_;
double tmp1180_ = tmp1178_+tmp1179_;
double tmp1181_ = (tmp781_)*tmp169_;
double tmp1182_ = tmp1180_+tmp1181_;
double tmp1183_ = (tmp784_)*tmp172_;
double tmp1184_ = tmp1182_+tmp1183_;
double tmp1185_ = (tmp787_)*tmp175_;
double tmp1186_ = tmp1184_+tmp1185_;
double tmp1187_ = (tmp790_)*tmp178_;
double tmp1188_ = tmp1186_+tmp1187_;
double tmp1189_ = (tmp793_)*tmp181_;
double tmp1190_ = tmp1188_+tmp1189_;
double tmp1191_ = (tmp793_)*(tmp135_);
double tmp1192_ = (tmp773_)*tmp142_;
double tmp1193_ = tmp1191_+tmp1192_;
double tmp1194_ = (tmp1193_)*tmp184_;
double tmp1195_ = tmp1190_+tmp1194_;
double tmp1196_ = (tmp811_)*(tmp128_);
double tmp1197_ = (tmp822_)*(tmp103_);
double tmp1198_ = tmp1196_+tmp1197_;
double tmp1199_ = tmp823_+tmp823_;
double tmp1200_ = tmp812_+tmp812_;
double tmp1201_ = (tmp828_)*tmp161_;
double tmp1202_ = (tmp830_)*tmp163_;
double tmp1203_ = tmp1201_+tmp1202_;
double tmp1204_ = (tmp833_)*tmp166_;
double tmp1205_ = tmp1203_+tmp1204_;
double tmp1206_ = (tmp836_)*tmp169_;
double tmp1207_ = tmp1205_+tmp1206_;
double tmp1208_ = (tmp839_)*tmp172_;
double tmp1209_ = tmp1207_+tmp1208_;
double tmp1210_ = (tmp842_)*tmp175_;
double tmp1211_ = tmp1209_+tmp1210_;
double tmp1212_ = (tmp845_)*tmp178_;
double tmp1213_ = tmp1211_+tmp1212_;
double tmp1214_ = (tmp848_)*tmp181_;
double tmp1215_ = tmp1213_+tmp1214_;
double tmp1216_ = (tmp848_)*(tmp135_);
double tmp1217_ = (tmp828_)*tmp142_;
double tmp1218_ = tmp1216_+tmp1217_;
double tmp1219_ = (tmp1218_)*tmp184_;
double tmp1220_ = tmp1215_+tmp1219_;
double tmp1221_ = (tmp866_)*(tmp128_);
double tmp1222_ = (tmp877_)*(tmp103_);
double tmp1223_ = tmp1221_+tmp1222_;
double tmp1224_ = tmp878_+tmp878_;
double tmp1225_ = tmp867_+tmp867_;
double tmp1226_ = (tmp883_)*tmp161_;
double tmp1227_ = (tmp885_)*tmp163_;
double tmp1228_ = tmp1226_+tmp1227_;
double tmp1229_ = (tmp888_)*tmp166_;
double tmp1230_ = tmp1228_+tmp1229_;
double tmp1231_ = (tmp891_)*tmp169_;
double tmp1232_ = tmp1230_+tmp1231_;
double tmp1233_ = (tmp894_)*tmp172_;
double tmp1234_ = tmp1232_+tmp1233_;
double tmp1235_ = (tmp897_)*tmp175_;
double tmp1236_ = tmp1234_+tmp1235_;
double tmp1237_ = (tmp900_)*tmp178_;
double tmp1238_ = tmp1236_+tmp1237_;
double tmp1239_ = (tmp903_)*tmp181_;
double tmp1240_ = tmp1238_+tmp1239_;
double tmp1241_ = (tmp903_)*(tmp135_);
double tmp1242_ = (tmp883_)*tmp142_;
double tmp1243_ = tmp1241_+tmp1242_;
double tmp1244_ = (tmp1243_)*tmp184_;
double tmp1245_ = tmp1240_+tmp1244_;
mVal[0] = ((mLocFour19x2_State_1_0+(((tmp144_)*(tmp103_)+tmp148_*(tmp128_))-tmp154_*tmp260_+tmp158_*tmp261_+tmp160_*tmp262_+(tmp130_)*(tmp187_))*mLocFour19x2_State_0_0)-mLocXIm)*mLocScNorm;
mCompDer[0][0] = (((tmp151_)*(tmp144_)+(tmp157_)*tmp148_)-(tmp910_)*tmp154_+(tmp907_)*tmp158_+(tmp908_)*tmp160_+(tmp151_)*(tmp187_)+(tmp931_)*(tmp130_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][1] = ((tmp213_)*(tmp144_)-(tmp933_)*tmp154_+tmp237_*tmp158_+tmp955_+(tmp953_)*(tmp130_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][2] = (tmp932_+tmp214_*tmp158_+(tmp954_)*tmp160_+(tmp975_)*(tmp130_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][3] = tmp977_;
mCompDer[0][4] = (tmp128_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][5] = -(2*tmp260_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][6] = tmp979_;
mCompDer[0][7] = tmp262_*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][8] = 0;
mCompDer[0][9] = (tmp1000_+(tmp999_)*(tmp130_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][10] = (tmp1020_)*(tmp130_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][11] = (tmp135_)*(tmp130_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][12] = tmp136_*(tmp130_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][13] = tmp137_*(tmp130_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][14] = tmp138_*(tmp130_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][15] = tmp139_*(tmp130_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][16] = tmp140_*(tmp130_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][17] = tmp141_*(tmp130_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][18] = tmp142_*(tmp130_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][19] = tmp185_*(tmp130_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][20] = (((tmp357_)*(tmp144_)+(tmp377_)*tmp148_)-(tmp1025_)*tmp154_+(tmp1023_)*tmp158_+(tmp1024_)*tmp160_+(tmp357_)*(tmp187_)+(tmp1045_)*(tmp130_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][21] = (((tmp463_)*(tmp144_)+(tmp489_)*tmp148_)-(tmp1050_)*tmp154_+(tmp1048_)*tmp158_+(tmp1049_)*tmp160_+(tmp463_)*(tmp187_)+(tmp1070_)*(tmp130_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][22] = (((tmp557_)*(tmp144_)+(tmp583_)*tmp148_)-(tmp1075_)*tmp154_+(tmp1073_)*tmp158_+(tmp1074_)*tmp160_+(tmp557_)*(tmp187_)+(tmp1095_)*(tmp130_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][23] = (((tmp619_)*(tmp144_)+(tmp626_)*tmp148_)-(tmp1100_)*tmp154_+(tmp1098_)*tmp158_+(tmp1099_)*tmp160_+(tmp619_)*(tmp187_)+(tmp1120_)*(tmp130_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][24] = (((tmp662_)*(tmp144_)+(tmp669_)*tmp148_)-(tmp1125_)*tmp154_+(tmp1123_)*tmp158_+(tmp1124_)*tmp160_+(tmp662_)*(tmp187_)+(tmp1145_)*(tmp130_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][25] = (((tmp705_)*(tmp144_)+(tmp712_)*tmp148_)-(tmp1150_)*tmp154_+(tmp1148_)*tmp158_+(tmp1149_)*tmp160_+(tmp705_)*(tmp187_)+(tmp1170_)*(tmp130_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][26] = (((tmp756_)*(tmp144_)+(tmp767_)*tmp148_)-(tmp1175_)*tmp154_+(tmp1173_)*tmp158_+(tmp1174_)*tmp160_+(tmp756_)*(tmp187_)+(tmp1195_)*(tmp130_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][27] = (((tmp811_)*(tmp144_)+(tmp822_)*tmp148_)-(tmp1200_)*tmp154_+(tmp1198_)*tmp158_+(tmp1199_)*tmp160_+(tmp811_)*(tmp187_)+(tmp1220_)*(tmp130_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[0][28] = (((tmp866_)*(tmp144_)+(tmp877_)*tmp148_)-(tmp1225_)*tmp154_+(tmp1223_)*tmp158_+(tmp1224_)*tmp160_+(tmp866_)*(tmp187_)+(tmp1245_)*(tmp130_))*mLocFour19x2_State_0_0*mLocScNorm;
mVal[1] = ((mLocFour19x2_State_2_0+(((tmp904_)*(tmp128_)+tmp148_*(tmp103_)+tmp153_*tmp261_)-tmp909_*tmp262_+tmp911_*tmp260_+(tmp132_)*(tmp187_))*mLocFour19x2_State_0_0)-mLocYIm)*mLocScNorm;
mCompDer[1][0] = (((tmp157_)*(tmp904_)+(tmp151_)*tmp148_+(tmp907_)*tmp153_)-(tmp908_)*tmp909_+(tmp910_)*tmp911_+(tmp157_)*(tmp187_)+(tmp931_)*(tmp132_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][1] = (tmp932_+tmp237_*tmp153_+(tmp933_)*tmp911_+(tmp953_)*(tmp132_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][2] = (((tmp213_)*(tmp904_)+tmp214_*tmp153_)-(tmp954_)*tmp909_+tmp955_+(tmp975_)*(tmp132_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][3] = tmp263_*(tmp128_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][4] = tmp977_;
mCompDer[1][5] = tmp979_;
mCompDer[1][6] = -(2*tmp262_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][7] = 0;
mCompDer[1][8] = tmp260_*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][9] = (tmp999_)*(tmp132_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][10] = (tmp1000_+(tmp1020_)*(tmp132_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][11] = (tmp135_)*(tmp132_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][12] = tmp136_*(tmp132_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][13] = tmp137_*(tmp132_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][14] = tmp138_*(tmp132_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][15] = tmp139_*(tmp132_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][16] = tmp140_*(tmp132_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][17] = tmp141_*(tmp132_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][18] = tmp142_*(tmp132_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][19] = tmp185_*(tmp132_)*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][20] = (((tmp377_)*(tmp904_)+(tmp357_)*tmp148_+(tmp1023_)*tmp153_)-(tmp1024_)*tmp909_+(tmp1025_)*tmp911_+(tmp377_)*(tmp187_)+(tmp1045_)*(tmp132_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][21] = (((tmp489_)*(tmp904_)+(tmp463_)*tmp148_+(tmp1048_)*tmp153_)-(tmp1049_)*tmp909_+(tmp1050_)*tmp911_+(tmp489_)*(tmp187_)+(tmp1070_)*(tmp132_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][22] = (((tmp583_)*(tmp904_)+(tmp557_)*tmp148_+(tmp1073_)*tmp153_)-(tmp1074_)*tmp909_+(tmp1075_)*tmp911_+(tmp583_)*(tmp187_)+(tmp1095_)*(tmp132_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][23] = (((tmp626_)*(tmp904_)+(tmp619_)*tmp148_+(tmp1098_)*tmp153_)-(tmp1099_)*tmp909_+(tmp1100_)*tmp911_+(tmp626_)*(tmp187_)+(tmp1120_)*(tmp132_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][24] = (((tmp669_)*(tmp904_)+(tmp662_)*tmp148_+(tmp1123_)*tmp153_)-(tmp1124_)*tmp909_+(tmp1125_)*tmp911_+(tmp669_)*(tmp187_)+(tmp1145_)*(tmp132_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][25] = (((tmp712_)*(tmp904_)+(tmp705_)*tmp148_+(tmp1148_)*tmp153_)-(tmp1149_)*tmp909_+(tmp1150_)*tmp911_+(tmp712_)*(tmp187_)+(tmp1170_)*(tmp132_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][26] = (((tmp767_)*(tmp904_)+(tmp756_)*tmp148_+(tmp1173_)*tmp153_)-(tmp1174_)*tmp909_+(tmp1175_)*tmp911_+(tmp767_)*(tmp187_)+(tmp1195_)*(tmp132_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][27] = (((tmp822_)*(tmp904_)+(tmp811_)*tmp148_+(tmp1198_)*tmp153_)-(tmp1199_)*tmp909_+(tmp1200_)*tmp911_+(tmp822_)*(tmp187_)+(tmp1220_)*(tmp132_))*mLocFour19x2_State_0_0*mLocScNorm;
mCompDer[1][28] = (((tmp877_)*(tmp904_)+(tmp866_)*tmp148_+(tmp1223_)*tmp153_)-(tmp1224_)*tmp909_+(tmp1225_)*tmp911_+(tmp877_)*(tmp187_)+(tmp1245_)*(tmp132_))*mLocFour19x2_State_0_0*mLocScNorm;
}
void cEqAppui_GL__PProjInc_M2CFour19x2::ComputeValDerivHessian()
{
ELISE_ASSERT(false,"Foncteur cEqAppui_GL__PProjInc_M2CFour19x2 Has no Der Sec");
}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetFour19x2_State_0_0(double aVal){ mLocFour19x2_State_0_0 = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetFour19x2_State_1_0(double aVal){ mLocFour19x2_State_1_0 = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetFour19x2_State_2_0(double aVal){ mLocFour19x2_State_2_0 = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetGL_0_0(double aVal){ mLocGL_0_0 = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetGL_0_1(double aVal){ mLocGL_0_1 = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetGL_0_2(double aVal){ mLocGL_0_2 = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetGL_1_0(double aVal){ mLocGL_1_0 = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetGL_1_1(double aVal){ mLocGL_1_1 = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetGL_1_2(double aVal){ mLocGL_1_2 = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetGL_2_0(double aVal){ mLocGL_2_0 = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetGL_2_1(double aVal){ mLocGL_2_1 = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetGL_2_2(double aVal){ mLocGL_2_2 = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetProjI_x(double aVal){ mLocProjI_x = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetProjI_y(double aVal){ mLocProjI_y = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetProjI_z(double aVal){ mLocProjI_z = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetProjJ_x(double aVal){ mLocProjJ_x = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetProjJ_y(double aVal){ mLocProjJ_y = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetProjJ_z(double aVal){ mLocProjJ_z = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetProjK_x(double aVal){ mLocProjK_x = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetProjK_y(double aVal){ mLocProjK_y = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetProjK_z(double aVal){ mLocProjK_z = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetProjP0_x(double aVal){ mLocProjP0_x = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetProjP0_y(double aVal){ mLocProjP0_y = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetProjP0_z(double aVal){ mLocProjP0_z = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetScNorm(double aVal){ mLocScNorm = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetXIm(double aVal){ mLocXIm = aVal;}
void cEqAppui_GL__PProjInc_M2CFour19x2::SetYIm(double aVal){ mLocYIm = aVal;}
double * cEqAppui_GL__PProjInc_M2CFour19x2::AdrVarLocFromString(const std::string & aName)
{
if (aName == "Four19x2_State_0_0") return & mLocFour19x2_State_0_0;
if (aName == "Four19x2_State_1_0") return & mLocFour19x2_State_1_0;
if (aName == "Four19x2_State_2_0") return & mLocFour19x2_State_2_0;
if (aName == "GL_0_0") return & mLocGL_0_0;
if (aName == "GL_0_1") return & mLocGL_0_1;
if (aName == "GL_0_2") return & mLocGL_0_2;
if (aName == "GL_1_0") return & mLocGL_1_0;
if (aName == "GL_1_1") return & mLocGL_1_1;
if (aName == "GL_1_2") return & mLocGL_1_2;
if (aName == "GL_2_0") return & mLocGL_2_0;
if (aName == "GL_2_1") return & mLocGL_2_1;
if (aName == "GL_2_2") return & mLocGL_2_2;
if (aName == "ProjI_x") return & mLocProjI_x;
if (aName == "ProjI_y") return & mLocProjI_y;
if (aName == "ProjI_z") return & mLocProjI_z;
if (aName == "ProjJ_x") return & mLocProjJ_x;
if (aName == "ProjJ_y") return & mLocProjJ_y;
if (aName == "ProjJ_z") return & mLocProjJ_z;
if (aName == "ProjK_x") return & mLocProjK_x;
if (aName == "ProjK_y") return & mLocProjK_y;
if (aName == "ProjK_z") return & mLocProjK_z;
if (aName == "ProjP0_x") return & mLocProjP0_x;
if (aName == "ProjP0_y") return & mLocProjP0_y;
if (aName == "ProjP0_z") return & mLocProjP0_z;
if (aName == "ScNorm") return & mLocScNorm;
if (aName == "XIm") return & mLocXIm;
if (aName == "YIm") return & mLocYIm;
return 0;
}
cElCompiledFonc::cAutoAddEntry cEqAppui_GL__PProjInc_M2CFour19x2::mTheAuto("cEqAppui_GL__PProjInc_M2CFour19x2",cEqAppui_GL__PProjInc_M2CFour19x2::Alloc);
cElCompiledFonc * cEqAppui_GL__PProjInc_M2CFour19x2::Alloc()
{ return new cEqAppui_GL__PProjInc_M2CFour19x2();
}
| 31,630 |
342 | /*
* Copyright 2006,2012,2016 BitMover, 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.
*/
#include "system.h"
#include "wrapmdbm.h"
#define GOOD_PSIZE (16<<10)
typedef struct {
hash hdr;
MDBM *db;
} whash;
/*
* h = hash_new(HASH_MDBM, mdbm)
* Create a new 'hash' wrapper around a mdbm.
* if mdbm==0, then create a new mdbm
*/
hash *
wrapmdbm_new(va_list ap)
{
whash *ret;
ret = new(whash);
ret->db = va_arg(ap, MDBM *);
unless (ret->db) ret->db = mdbm_open(0, 0, 0, GOOD_PSIZE);
return ((hash *)ret);
}
hash *
wrapmdbm_open(char *file, int flags, mode_t mode, va_list ap)
{
whash *ret;
ret = new(whash);
ret->db = mdbm_open(file, flags, mode, GOOD_PSIZE);
return ((hash *)ret);
}
int
wrapmdbm_close(hash *_h)
{
whash *h = (whash *)_h;
mdbm_close(h->db);
return (0);
}
void *
wrapmdbm_fetch(hash *_h, void *key, int klen)
{
whash *h = (whash *)_h;
datum k, v;
k.dptr = key;
k.dsize = klen;
v = mdbm_fetch(h->db, k);
h->hdr.vptr = v.dptr;
h->hdr.vlen = v.dsize;
return (v.dptr);
}
private void *
doinsert(hash *_h, void *key, int klen, void *val, int vlen, int flags)
{
whash *h = (whash *)_h;
datum k, v;
int failed;
k.dptr = key;
k.dsize = klen;
v.dptr = val ? val : new(int);
v.dsize = vlen;
failed = mdbm_store(h->db, k, v, flags);
unless (val) free(v.dptr);
if (failed) {
v.dptr = 0;
} else {
/* XXX this is inefficent. We need a mdbm_storehash() API */
v = mdbm_fetch(h->db, k);
}
return (v.dptr);
}
void *
wrapmdbm_insert(hash *_h, void *key, int klen, void *val, int vlen)
{
return (doinsert(_h, key, klen, val, vlen, MDBM_INSERT));
}
void *
wrapmdbm_store(hash *_h, void *key, int klen, void *val, int vlen)
{
return (doinsert(_h, key, klen, val, vlen, MDBM_REPLACE));
}
int
wrapmdbm_delete(hash *_h, void *key, int klen)
{
whash *h = (whash *)_h;
datum k, v;
k.dptr = key;
k.dsize = klen;
/*
* XXX this is inefficent, we need to change mdbm_delete() to return
* this information.
*/
v = mdbm_fetch(h->db, k);
if (v.dptr) {
return (mdbm_delete(h->db, k));
} else {
errno = ENOENT;
return (-1);
}
}
void *
wrapmdbm_first(hash *_h)
{
whash *h = (whash *)_h;
kvpair kv;
kv = mdbm_first(h->db);
h->hdr.kptr = kv.key.dptr;
h->hdr.klen = kv.key.dsize;
h->hdr.vptr = kv.val.dptr;
h->hdr.vlen = kv.val.dsize;
return (h->hdr.kptr);
}
void *
wrapmdbm_next(hash *_h)
{
whash *h = (whash *)_h;
kvpair kv;
kv = mdbm_next(h->db);
h->hdr.kptr = kv.key.dptr;
h->hdr.klen = kv.key.dsize;
h->hdr.vptr = kv.val.dptr;
h->hdr.vlen = kv.val.dsize;
return (h->hdr.kptr);
}
| 1,426 |
3,562 | <reponame>kaiker19/incubator-doris
// 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.doris.analysis;
import org.apache.doris.cluster.ClusterNamespace;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.ErrorCode;
import org.apache.doris.common.ErrorReport;
import org.apache.doris.common.io.Text;
import org.apache.doris.common.io.Writable;
import org.apache.doris.thrift.TFunctionName;
import com.google.common.base.Strings;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.Objects;
/**
* Class to represent a function name. Function names are specified as
* db.function_name.
*/
public class FunctionName implements Writable {
private static final Logger LOG = LogManager.getLogger(FunctionName.class);
private String db_;
private String fn_;
private FunctionName() {
}
public FunctionName(String db, String fn) {
db_ = db;
fn_ = fn.toLowerCase();
if (db_ != null) {
db_ = db_.toLowerCase();
}
}
public FunctionName(String fn) {
db_ = null;
fn_ = fn.toLowerCase();
}
public FunctionName(TFunctionName thriftName) {
db_ = thriftName.db_name.toLowerCase();
fn_ = thriftName.function_name.toLowerCase();
}
// Same as FunctionName but for builtins and we'll leave the case
// as is since we aren't matching by string.
public static FunctionName createBuiltinName(String fn) {
FunctionName name = new FunctionName(fn);
name.fn_ = fn;
return name;
}
public static FunctionName fromThrift(TFunctionName fnName) {
return new FunctionName(fnName.getDbName(), fnName.getFunctionName());
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof FunctionName)) {
return false;
}
FunctionName o = (FunctionName) obj;
if ((db_ == null || o.db_ == null) && (db_ != o.db_)) {
if (db_ == null && o.db_ != null) {
return false;
}
if (db_ != null && o.db_ == null) {
return false;
}
if (!db_.equalsIgnoreCase(o.db_)) {
return false;
}
}
return fn_.equalsIgnoreCase(o.fn_);
}
public String getDb() {
return db_;
}
public void setDb(String db) {
db_ = db;
}
public String getFunction() {
return fn_;
}
public boolean isFullyQualified() {
return db_ != null;
}
@Override
public String toString() {
if (db_ == null) {
return fn_;
}
return db_ + "." + fn_;
}
// used to analyze db element in function name, add cluster
public String analyzeDb(Analyzer analyzer) throws AnalysisException {
String db = db_;
if (db == null) {
db = analyzer.getDefaultDb();
} else {
if (Strings.isNullOrEmpty(analyzer.getClusterName())) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_CLUSTER_NAME_NULL);
}
db = ClusterNamespace.getFullName(analyzer.getClusterName(), db);
}
return db;
}
public void analyze(Analyzer analyzer) throws AnalysisException {
if (fn_.length() == 0) {
throw new AnalysisException("Function name can not be empty.");
}
for (int i = 0; i < fn_.length(); ++i) {
if (!isValidCharacter(fn_.charAt(i))) {
throw new AnalysisException(
"Function names must be all alphanumeric or underscore. " +
"Invalid name: " + fn_);
}
}
if (Character.isDigit(fn_.charAt(0))) {
throw new AnalysisException("Function cannot start with a digit: " + fn_);
}
if (db_ == null) {
db_ = analyzer.getDefaultDb();
if (Strings.isNullOrEmpty(db_)) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_NO_DB_ERROR);
}
} else {
if (Strings.isNullOrEmpty(analyzer.getClusterName())) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_CLUSTER_NAME_NULL);
}
db_ = ClusterNamespace.getFullName(analyzer.getClusterName(), db_);
}
// If the function name is not fully qualified, it must not be the same as a builtin
// if (!isFullyQualified() && OpcodeRegistry.instance().getFunctionOperator(
// getFunction()) != FunctionOperator.INVALID_OPERATOR) {
// throw new AnalysisException(
// "Function cannot have the same name as a builtin: " + getFunction());
// }
}
private boolean isValidCharacter(char c) {
return Character.isLetterOrDigit(c) || c == '_';
}
public TFunctionName toThrift() {
TFunctionName name = new TFunctionName(fn_);
name.setDbName(db_);
name.setFunctionName(fn_);
return name;
}
@Override
public void write(DataOutput out) throws IOException {
if (db_ != null) {
out.writeBoolean(true);
Text.writeString(out, db_);
} else {
out.writeBoolean(false);
}
Text.writeString(out, fn_);
}
public void readFields(DataInput in) throws IOException {
if (in.readBoolean()) {
db_ = Text.readString(in);
}
fn_ = Text.readString(in);
}
public static FunctionName read(DataInput in) throws IOException{
FunctionName functionName = new FunctionName();
functionName.readFields(in);
return functionName;
}
@Override
public int hashCode() {
return 31 * Objects.hashCode(db_) + Objects.hashCode(fn_);
}
}
| 2,783 |
1,168 | // We index elements of initializer lists.
//- @foo defines/binding FnFoo
int foo() { return 0; }
class B {
public:
//- @B defines/binding BCtor
B(int x) { }
};
class C : public B {
//- BFooCall=@"foo()" ref/call FnFoo
//- BCtorCall=@"B(foo())" ref/call BCtor
//- BFooCall childof CtorC
//- BCtorCall childof CtorC
//- @C defines/binding CtorC
C() : B(foo()),
//- IFooCall=@"foo()" ref/call FnFoo
//- IFooCall childof CtorC
i(foo()),
//- LbFooCall=@"foo()" ref/call FnFoo
//- LbCtorCall=@"b(foo())" ref/call BCtor
//- LbFooCall childof CtorC
//- LbCtorCall childof CtorC
b(foo()) { }
int i;
B b;
};
| 292 |
1,150 | <gh_stars>1000+
package io.confluent.developer.ccloud.demo.kstream.topic;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConfigurationProperties("topics.transaction-request")
public class TransactionRequestTopicConfig extends TopicConfig {
}
| 94 |
1,340 | //
// MTITextureLoader.h
// MetalPetal
//
// Created by <NAME> on 2019/1/10.
//
#import <MetalKit/MetalKit.h>
NS_ASSUME_NONNULL_BEGIN
/// Abstract interface for texture loaders.
@protocol MTITextureLoader <NSObject>
+ (instancetype)newTextureLoaderWithDevice:(id <MTLDevice>)device NS_SWIFT_NAME(makeTextureLoader(device:));
- (nullable id <MTLTexture>)newTextureWithCGImage:(nonnull CGImageRef)cgImage
options:(nullable NSDictionary <MTKTextureLoaderOption, id> *)options
error:(NSError *__nullable *__nullable)error;
- (nullable id <MTLTexture>)newTextureWithContentsOfURL:(nonnull NSURL *)URL
options:(nullable NSDictionary <MTKTextureLoaderOption, id> *)options
error:(NSError *__nullable *__nullable)error;
- (nullable id <MTLTexture>)newTextureWithName:(nonnull NSString *)name
scaleFactor:(CGFloat)scaleFactor
bundle:(nullable NSBundle *)bundle
options:(nullable NSDictionary <MTKTextureLoaderOption, id> *)options
error:(NSError *__nullable *__nullable)error;
- (nullable id <MTLTexture>)newTextureWithMDLTexture:(nonnull MDLTexture *)texture
options:(nullable NSDictionary <MTKTextureLoaderOption, id> *)options
error:(NSError *__nullable *__nullable)error;
@end
@interface MTKTextureLoader (MTITextureLoader) <MTITextureLoader>
@end
/// The default texture loader. A `MTIDefaultTextureLoader` object uses a `MTKTextureLoader` internally to load textures. When an image cannot be loaded with `MTKTextureLoader`, `MTIDefaultTextureLoader` draws the image to a 32bits/pixel BGRA `CVPixelBuffer` and creates a texture from that pixel buffer.
__attribute__((objc_subclassing_restricted))
@interface MTIDefaultTextureLoader : NSObject <MTITextureLoader>
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
@end
NS_ASSUME_NONNULL_END
| 1,008 |
1,107 | <reponame>stefsmeets/pyvista<filename>examples/01-filter/interpolate.py
"""
.. _interpolate_example:
Interpolating
~~~~~~~~~~~~~
Interpolate one mesh's point/cell arrays onto another mesh's nodes using a
Gaussian Kernel.
"""
# sphinx_gallery_thumbnail_number = 4
import pyvista as pv
from pyvista import examples
###############################################################################
# Simple Surface Interpolation
# ++++++++++++++++++++++++++++
# Resample the points' arrays onto a surface
# Download sample data
surface = examples.download_saddle_surface()
points = examples.download_sparse_points()
p = pv.Plotter()
p.add_mesh(points, scalars="val", point_size=30.0, render_points_as_spheres=True)
p.add_mesh(surface)
p.show()
###############################################################################
# Run the interpolation
interpolated = surface.interpolate(points, radius=12.0)
p = pv.Plotter()
p.add_mesh(points, scalars="val", point_size=30.0, render_points_as_spheres=True)
p.add_mesh(interpolated, scalars="val")
p.show()
###############################################################################
# Complex Interpolation
# +++++++++++++++++++++
# In this example, we will in interpolate sparse points in 3D space into a
# volume. These data are from temperature probes in the subsurface and the goal
# is to create an approximate 3D model of the temperature field in the
# subsurface.
#
# This approach is a great for back-of-the-hand estimations but pales in
# comparison to kriging
# Download the sparse data
probes = examples.download_thermal_probes()
###############################################################################
# Create the interpolation grid around the sparse data
grid = pv.UniformGrid()
grid.origin = (329700, 4252600, -2700)
grid.spacing = (250, 250, 50)
grid.dimensions = (60, 75, 100)
###############################################################################
dargs = dict(cmap="coolwarm", clim=[0,300], scalars="temperature (C)")
cpos = [(364280.5723737897, 4285326.164400684, 14093.431895014139),
(337748.7217949739, 4261154.45054595, -637.1092549935128),
(-0.29629216102673206, -0.23840196609932093, 0.9248651025279784)]
p = pv.Plotter()
p.add_mesh(grid.outline(), color='k')
p.add_mesh(probes, render_points_as_spheres=True, **dargs)
p.show(cpos=cpos)
###############################################################################
# Run an interpolation
interp = grid.interpolate(probes, radius=15000, sharpness=10, strategy='mask_points')
###############################################################################
# Visualize the results
vol_opac = [0, 0, .2, 0.2, 0.5, 0.5]
p = pv.Plotter(shape=(1,2), window_size=[1024*3, 768*2])
p.add_volume(interp, opacity=vol_opac, **dargs)
p.add_mesh(probes, render_points_as_spheres=True, point_size=10, **dargs)
p.subplot(0,1)
p.add_mesh(interp.contour(5), opacity=0.5, **dargs)
p.add_mesh(probes, render_points_as_spheres=True, point_size=10, **dargs)
p.link_views()
p.show(cpos=cpos)
| 965 |
1,100 | <filename>Exercise_04/Exercise_04_02/Exercise_04_02.java<gh_stars>1000+
/*
(Geometry: great circle distance) The great circle distance is the distance between
two points on the surface of a sphere. Let (x1, y1) and (x2, y2) be the geographical
latitude and longitude of two points. The great circle distance between the two
points can be computed using the following formula:
d = radius * arccos(sin(x1) * sin(x2) + cos(x1) * cos(x2) * cos(y1 - y2))
Write a program that prompts the user to enter the latitude and longitude of two
points on the earth in degrees and displays its great circle distance. The average
earth radius is 6,371.01 km. Note that you need to convert the degrees into radians
using the Math.toRadians method since the Java trigonometric methods use
radians. The latitude and longitude degrees in the formula are for north and west.
Use negative to indicate south and east degrees.
*/
import java.util.Scanner;
public class Exercise_04_02 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
final double RADIUS = 6371.01; // Constant value
// Prompt the user to enter the latitude and longitude
// of two points on the earth in degrees
System.out.print("Enter point 1 (latitude and longitude) in degrees: ");
String xy1 = input.nextLine();
System.out.print("Enter point 2 (latitude and longitude) in degrees: ");
String xy2 = input.nextLine();
// Extract x and y values from string
int k = xy1.indexOf(',');
double x1 = Double.parseDouble(xy1.substring(0, k - 1));
double y1 = Double.parseDouble(xy1.substring(k + 2));
k = xy2.indexOf(',');
double x2 = Double.parseDouble(xy2.substring(0, k - 1));
double y2 = Double.parseDouble(xy2.substring(k + 2));
// Convert degrees to radians
x1 = Math.toRadians(x1);
y1 = Math.toRadians(y1);
x2 = Math.toRadians(x2);
y2 = Math.toRadians(y2);
// Calculate its great circle distance
double distance =
RADIUS * Math.acos(Math.sin(x1) * Math.sin(x2) +
Math.cos(x1) * Math.cos(x2) * Math.cos(y1 - y2));
// Display result
System.out.println("The distance between the two points is " + distance);
}
} | 725 |
841 | /*
* Copyright 2017 Red Hat, Inc. and/or its affiliates.
*
* 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 org.jbpm.runtime.manager.impl.deploy;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.Map;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.persistence.EntityManagerFactory;
import org.kie.api.KieServices;
import org.kie.api.runtime.manager.RuntimeManager;
import org.kie.api.task.TaskService;
import org.kie.api.executor.ExecutorService;
import org.kie.internal.runtime.Cacheable;
import org.kie.internal.runtime.conf.ObjectModel;
import org.kie.internal.runtime.manager.InternalRuntimeManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class EjbObjectModelResolver extends ReflectionObjectModelResolver {
private static final Logger logger = LoggerFactory.getLogger(EjbObjectModelResolver.class);
public static final String ID = "ejb";
private Map<String, Class<?>> knownContextParamMapping = new HashMap<String, Class<?>>();
public EjbObjectModelResolver() {
knownContextParamMapping.put("entityManagerFactory", EntityManagerFactory.class);
knownContextParamMapping.put("runtimeManager", RuntimeManager.class);
knownContextParamMapping.put("kieSession", KieServices.class);
knownContextParamMapping.put("taskService", TaskService.class);
knownContextParamMapping.put("executorService", ExecutorService.class);
knownContextParamMapping.put("classLoader", ClassLoader.class);
}
@Override
public Object getInstance(ObjectModel model, ClassLoader cl, Map<String, Object> contextParams) {
Class<?> clazz = getClassObject(model.getIdentifier(), cl);
Object instance = null;
InternalRuntimeManager manager = null;
if (contextParams.containsKey("runtimeManager")) {
manager = (InternalRuntimeManager) contextParams.get("runtimeManager");
instance = manager.getCacheManager().get(clazz.getName());
if (instance != null) {
return instance;
}
}
if (model.getParameters() == null || model.getParameters().isEmpty()) {
logger.debug("About to create instance of {} with no arg constructor", model.getIdentifier());
// no parameters then use no arg constructor
try {
instance = clazz.newInstance();
} catch (Exception e) {
throw new IllegalArgumentException("Unable to create instance (no arg constructor) of type "
+ model.getIdentifier() + " due to " + e.getMessage(), e);
}
} else {
logger.debug("About to create instance of {} with {} parameters", model.getIdentifier(), model.getParameters().size());
// process parameter instances
Class<?>[] parameterTypes = new Class<?>[model.getParameters().size()];
Object[] paramInstances = new Object[model.getParameters().size()];
int index = 0;
for (Object param : model.getParameters()) {
if (param instanceof ObjectModel) {
logger.debug("Parameter is of type ObjectModel (id: {}), trying to create instance based on that model",
((ObjectModel) param).getIdentifier());
Class<?> paramclazz = getClassObject(((ObjectModel)param).getIdentifier(), cl);
parameterTypes[index] = paramclazz;
paramInstances[index] = getInstance(((ObjectModel)param), cl, contextParams);
} else {
if (contextParams.containsKey(param)) {
logger.debug("Parametr references context parametr with name {}", param);
Object contextValue = contextParams.get(param);
Class<?> paramClass = contextValue.getClass();
if (knownContextParamMapping.containsKey(param)) {
paramClass = knownContextParamMapping.get(param);
}
parameterTypes[index] = paramClass;
paramInstances[index] = contextValue;
} else {
if (param.toString().startsWith("jndi:")) {
logger.debug("Parameter is jndi lookup type - {}", param);
// remove the jndi: prefix
String lookupName = param.toString().substring(5);
try {
Object jndiObject = InitialContext.doLookup(lookupName);
parameterTypes[index] = Object.class;
paramInstances[index] = jndiObject;
} catch (NamingException e) {
throw new IllegalArgumentException("Unable to look up object from jndi using name " + lookupName, e);
}
} else {
logger.debug("Parameter is simple type (string) - {}", param);
parameterTypes[index] = param.getClass();
paramInstances[index] = param;
}
}
}
index++;
}
try {
logger.debug("Creating instance of class {} with parameter types {} and parameter instances {}",
clazz, parameterTypes, paramInstances);
Constructor<?> constructor = clazz.getConstructor(parameterTypes);
instance = constructor.newInstance(paramInstances);
} catch (Exception e) {
throw new IllegalArgumentException("Unable to create instance (" + parameterTypes + " constructor) of type "
+ model.getIdentifier() + " due to " + e.getMessage(), e);
}
}
logger.debug("Created instance : {}", instance);
if (manager != null && instance instanceof Cacheable) {
manager.getCacheManager().add(instance.getClass().getName(), instance);
}
return instance;
}
@Override
public boolean accept(String resolverId) {
if (ID.equals(resolverId)) {
return true;
}
logger.debug("Resolver id {} is not accepted by {}", resolverId, this.getClass());
return false;
}
}
| 2,024 |
435 | <reponame>allen91wu/data
{
"description": "Segue ai a palestrinha o Rodolfo\n\n",
"language": "por",
"recorded": "2017-09-08",
"speakers": [
"<NAME>"
],
"thumbnail_url": "https://i.ytimg.com/vi/o2djVyvDmPQ/hqdefault.jpg",
"title": "Vamos hackear o futuro com Python e companhia Code Club Crian\u00e7a Feliz",
"videos": [
{
"type": "youtube",
"url": "https://www.youtube.com/watch?v=o2djVyvDmPQ"
}
]
} | 212 |
647 | /*
PURPOSE:
(Flag enumerated typedef definition.)
*/
#ifndef FLAG_H
#define FLAG_H
/*=== Protect against 'TRUE' and 'FALSE' already being '#define'd ===*/
#ifdef TRUE
#undef TRUE
#define TRUE_RESET
#endif
#ifdef FALSE
#undef FALSE
#define FALSE_RESET
#endif
#ifdef True
#undef True
#define True_RESET
#endif
#ifdef False
#undef False
#define False_RESET
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
Off = 0,
On = 1,
No = 0,
Yes = 1,
#ifndef SWIG
False = 0,
True = 1,
#endif
Disconnect = 0,
Connect = 1,
Inactive = 0,
Active = 1,
Stop = 0,
Go = 1,
Low = 0,
High = 1,
Disable = 0,
Enable = 1,
TRUE = 255, /* FORTRAN Logical TRUE */
FALSE = 0, /* FORTRAN Logical FALSE */
Open = 0,
Closed = 1,
/* Stamps flags */
OFF = 0,
ON = 1,
NO = 0,
YES = 1,
INACTIVE = 0,
ACTIVE = 1,
BACKWARD = 0,
FORWARD = 1,
BAD = 0,
GOOD = 1
} Flag;
#ifdef __cplusplus
}
#endif
typedef Flag LOGICAL_TYPE;
#ifdef TRUE_RESET
#undef TRUE_RESET
#define TRUE 1
#endif
#ifdef FALSE_RESET
#undef FALSE_RESET
#define FALSE 0
#endif
#ifdef True_RESET
#undef True_RESET
#define True 1
#endif
#ifdef False_RESET
#undef False_RESET
#define False 0
#endif
#endif
| 974 |
347 | <filename>UE_MotMatch/Plugins/MotionMatching/Source/MotionMatching/Public/MotionKey.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataAsset.h"
#include "MotionStructs.h"
#include "Animation/AnimSequence.h"
#include "MotionKeyUtils.h"
#include "MotionKey.generated.h"
/**
*
*/
class UAnimSequence;
USTRUCT(BlueprintType)
struct MOTIONMATCHING_API FMotionKey
{
GENERATED_BODY()
;
public:
FMotionKey();
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "PoseData")
int32 SrcAnimIndex;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "PoseData")
float StartTime;
/////////////////////////// FIRST EVALUATION DATA
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Tags")
TArray <uint8> TagsIdx;
////------------Here Store store the data of the specific bones whe want to look for in evaluation, tipically the feet.
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "KeyBoneMotionData")
TArray <FJointData> MotionJointData;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "KeyBoneMotionData")
FVector PresentVel;
///////////////////////////
//////////////////////////FUTURE KEY Data
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "FutureMotionData")
FTrajectoryData FutureTrajectory;
////////////////////////SECOND EVALUATION DATA
//// Here evaluate the current Key against candidate keys/////--------Gotta Take this and put it elswhere and make it static at some point
float ComputeMotionKeyCost(const float Responsiveness, const float VelocityStrength, const float PoseStrength, const FTrajectoryData DesiredTrajectory, const TArray <FJointData> PresentJointData, const FVector PresentVel);
#if WITH_EDITOR
//USE THIS WHEN REMOVING KEYS FROM THE EDITOR TO REBAKE THE NEXT KEYS INDEX
UPROPERTY(BlueprintReadOnly, Category = "MotionKeyHandle")
FName SrcAnimationName;
#endif //WITH_EDITOR
//////////////////////////
////////////-------------This is the function used to store the precomputed data from the designated sequence.
void ExtractDataFromAnimation(const UAnimSequence * InSequence, const int AtSrcAnimIndex, const float AtSrcStartTime, TArray <FName> InMotionBoneNames);
FORCEINLINE bool operator==(const FMotionKey Other) const
{
return (SrcAnimIndex == Other.SrcAnimIndex) && (StartTime == Other.StartTime);
}
};
| 768 |
1,982 | package com.guoxiaoxing.android.sdk.design._1_6_abstract_factory_pattern;
// 抽象产品B
public abstract class AbstractProductB {
}
| 54 |
8,731 | <reponame>mengzhisuoliu/libevent<filename>test/regress_openssl.c
/*
* Copyright (c) 2009-2012 <NAME> and <NAME>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
*/
#include "event2/util.h"
#include <openssl/err.h>
#include <openssl/pem.h>
#include "openssl-compat.h"
#include "regress.h"
#include "tinytest.h"
#define TESTCASES_NAME openssl_testcases
static void *ssl_test_setup(const struct testcase_t *testcase);
static int ssl_test_cleanup(const struct testcase_t *testcase, void *ptr);
static const struct testcase_setup_t ssl_setup = {
ssl_test_setup, ssl_test_cleanup};
static X509 *the_cert;
EVP_PKEY *the_key;
#define SSL_IS_CLIENT
#define SSL_IS_SERVER
#define bufferevent_ssl_get_ssl bufferevent_openssl_get_ssl
#define bufferevent_ssl_set_allow_dirty_shutdown \
bufferevent_openssl_set_allow_dirty_shutdown
#define bufferevent_ssl_socket_new bufferevent_openssl_socket_new
#define bufferevent_ssl_filter_new bufferevent_openssl_filter_new
struct rwcount;
static void BIO_setup(SSL *ssl, struct rwcount *rw);
#include "regress_ssl.c"
EVP_PKEY *
ssl_getkey(void)
{
EVP_PKEY *key;
BIO *bio;
/* new read-only BIO backed by KEY. */
bio = BIO_new_mem_buf((char *)KEY, -1);
tt_assert(bio);
key = PEM_read_bio_PrivateKey(bio, NULL, NULL, NULL);
BIO_free(bio);
tt_assert(key);
return key;
end:
return NULL;
}
X509 *
ssl_getcert(EVP_PKEY *key)
{
/* Dummy code to make a quick-and-dirty valid certificate with
OpenSSL. Don't copy this code into your own program! It does a
number of things in a stupid and insecure way. */
X509 *x509 = NULL;
X509_NAME *name = NULL;
int nid;
time_t now = time(NULL);
tt_assert(key);
x509 = X509_new();
tt_assert(x509);
tt_assert(0 != X509_set_version(x509, 2));
tt_assert(0 != ASN1_INTEGER_set(X509_get_serialNumber(x509), (long)now));
name = X509_NAME_new();
tt_assert(name);
nid = OBJ_txt2nid("commonName");
tt_assert(NID_undef != nid);
tt_assert(0 != X509_NAME_add_entry_by_NID(name, nid, MBSTRING_ASC,
(unsigned char *)"example.com", -1, -1, 0));
X509_set_subject_name(x509, name);
X509_set_issuer_name(x509, name);
X509_NAME_free(name);
X509_time_adj(X509_getm_notBefore(x509), 0, &now);
now += 3600;
X509_time_adj(X509_getm_notAfter(x509), 0, &now);
X509_set_pubkey(x509, key);
tt_assert(0 != X509_sign(x509, key, EVP_sha1()));
return x509;
end:
X509_free(x509);
X509_NAME_free(name);
return NULL;
}
static SSL_CTX *the_ssl_ctx = NULL;
SSL_CTX *
get_ssl_ctx(void)
{
if (the_ssl_ctx)
return the_ssl_ctx;
the_ssl_ctx = SSL_CTX_new(SSLv23_method());
if (!the_ssl_ctx)
return NULL;
if (disable_tls_11_and_12) {
#ifdef SSL_OP_NO_TLSv1_2
SSL_CTX_set_options(the_ssl_ctx, SSL_OP_NO_TLSv1_2);
#endif
#ifdef SSL_OP_NO_TLSv1_1
SSL_CTX_set_options(the_ssl_ctx, SSL_OP_NO_TLSv1_1);
#endif
}
return the_ssl_ctx;
}
void
init_ssl(void)
{
#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || \
(defined(LIBRESSL_VERSION_NUMBER) && \
LIBRESSL_VERSION_NUMBER < 0x20700000L)
SSL_library_init();
ERR_load_crypto_strings();
SSL_load_error_strings();
OpenSSL_add_all_algorithms();
if (SSLeay() != OPENSSL_VERSION_NUMBER) {
TT_DECLARE("WARN", ("Version mismatch for openssl: compiled with %lx "
"but running with %lx",
(unsigned long)OPENSSL_VERSION_NUMBER,
(unsigned long)SSLeay()));
}
#endif
}
static void *
ssl_test_setup(const struct testcase_t *testcase)
{
init_ssl();
the_key = ssl_getkey();
EVUTIL_ASSERT(the_key);
the_cert = ssl_getcert(the_key);
EVUTIL_ASSERT(the_cert);
disable_tls_11_and_12 = 0;
return basic_test_setup(testcase);
}
static int
ssl_test_cleanup(const struct testcase_t *testcase, void *ptr)
{
int ret = basic_test_cleanup(testcase, ptr);
if (!ret) {
return ret;
}
test_is_done = 0;
n_connected = 0;
got_close = 0;
got_error = 0;
got_timeout = 0;
renegotiate_at = -1;
stop_when_connected = 0;
pending_connect_events = 0;
exit_base = NULL;
X509_free(the_cert);
EVP_PKEY_free(the_key);
SSL_CTX_free(the_ssl_ctx);
the_ssl_ctx = NULL;
return 1;
}
static int
bio_rwcount_new(BIO *b)
{
BIO_set_init(b, 0);
BIO_set_data(b, NULL);
return 1;
}
static int
bio_rwcount_free(BIO *b)
{
TT_BLATHER(("bio_rwcount_free: %p", b));
if (!b)
return 0;
if (BIO_get_shutdown(b)) {
BIO_set_init(b, 0);
BIO_set_data(b, NULL);
}
return 1;
}
static int
bio_rwcount_read(BIO *b, char *out, int outlen)
{
struct rwcount *rw = BIO_get_data(b);
ev_ssize_t ret = recv(rw->fd, out, outlen, 0);
++rw->read;
if (ret == -1 && EVUTIL_ERR_RW_RETRIABLE(EVUTIL_SOCKET_ERROR())) {
BIO_set_retry_read(b);
}
return ret;
}
static int
bio_rwcount_write(BIO *b, const char *in, int inlen)
{
struct rwcount *rw = BIO_get_data(b);
ev_ssize_t ret = send(rw->fd, in, inlen, 0);
++rw->write;
if (ret == -1 && EVUTIL_ERR_RW_RETRIABLE(EVUTIL_SOCKET_ERROR())) {
BIO_set_retry_write(b);
}
return ret;
}
static long
bio_rwcount_ctrl(BIO *b, int cmd, long num, void *ptr)
{
struct rwcount *rw = BIO_get_data(b);
long ret = 0;
switch (cmd) {
case BIO_C_GET_FD:
ret = rw->fd;
break;
case BIO_CTRL_GET_CLOSE:
ret = BIO_get_shutdown(b);
break;
case BIO_CTRL_SET_CLOSE:
BIO_set_shutdown(b, (int)num);
break;
case BIO_CTRL_PENDING:
ret = 0;
break;
case BIO_CTRL_WPENDING:
ret = 0;
break;
case BIO_CTRL_DUP:
case BIO_CTRL_FLUSH:
ret = 1;
break;
}
return ret;
}
static int
bio_rwcount_puts(BIO *b, const char *s)
{
return bio_rwcount_write(b, s, strlen(s));
}
#define BIO_TYPE_LIBEVENT_RWCOUNT 0xff1
static BIO_METHOD *methods_rwcount;
static BIO_METHOD *
BIO_s_rwcount(void)
{
if (methods_rwcount == NULL) {
methods_rwcount = BIO_meth_new(BIO_TYPE_LIBEVENT_RWCOUNT, "rwcount");
if (methods_rwcount == NULL)
return NULL;
BIO_meth_set_write(methods_rwcount, bio_rwcount_write);
BIO_meth_set_read(methods_rwcount, bio_rwcount_read);
BIO_meth_set_puts(methods_rwcount, bio_rwcount_puts);
BIO_meth_set_ctrl(methods_rwcount, bio_rwcount_ctrl);
BIO_meth_set_create(methods_rwcount, bio_rwcount_new);
BIO_meth_set_destroy(methods_rwcount, bio_rwcount_free);
}
return methods_rwcount;
}
static BIO *
BIO_new_rwcount(int close_flag)
{
BIO *result;
if (!(result = BIO_new(BIO_s_rwcount())))
return NULL;
BIO_set_init(result, 1);
BIO_set_data(result, NULL);
BIO_set_shutdown(result, !!close_flag);
return result;
}
static void
BIO_setup(SSL *ssl, struct rwcount *rw)
{
BIO *bio;
bio = BIO_new_rwcount(0);
tt_assert(bio);
BIO_set_data(bio, rw);
SSL_set_bio(ssl, bio, bio);
end:
return;
}
| 3,358 |
1,617 | <filename>sdk/protocol/boathlfabric/protos/google/protobuf/duration.pb-c.c
/* Generated by the protocol buffer compiler. DO NOT EDIT! */
/* Generated from: google/protobuf/duration.proto */
/* Do not generate deprecated warnings for self */
#ifndef PROTOBUF_C__NO_DEPRECATED
#define PROTOBUF_C__NO_DEPRECATED
#endif
#include "google/protobuf/duration.pb-c.h"
void google__protobuf__duration__init
(Google__Protobuf__Duration *message)
{
static Google__Protobuf__Duration init_value = GOOGLE__PROTOBUF__DURATION__INIT;
*message = init_value;
}
size_t google__protobuf__duration__get_packed_size
(const Google__Protobuf__Duration *message)
{
assert(message->base.descriptor == &google__protobuf__duration__descriptor);
return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
}
size_t google__protobuf__duration__pack
(const Google__Protobuf__Duration *message,
uint8_t *out)
{
assert(message->base.descriptor == &google__protobuf__duration__descriptor);
return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
}
size_t google__protobuf__duration__pack_to_buffer
(const Google__Protobuf__Duration *message,
ProtobufCBuffer *buffer)
{
assert(message->base.descriptor == &google__protobuf__duration__descriptor);
return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
}
Google__Protobuf__Duration *
google__protobuf__duration__unpack
(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data)
{
return (Google__Protobuf__Duration *)
protobuf_c_message_unpack (&google__protobuf__duration__descriptor,
allocator, len, data);
}
void google__protobuf__duration__free_unpacked
(Google__Protobuf__Duration *message,
ProtobufCAllocator *allocator)
{
assert(message->base.descriptor == &google__protobuf__duration__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
static const ProtobufCFieldDescriptor google__protobuf__duration__field_descriptors[2] =
{
{
"seconds",
1,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_INT64,
offsetof(Google__Protobuf__Duration, has_seconds),
offsetof(Google__Protobuf__Duration, seconds),
NULL,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"nanos",
2,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_INT32,
offsetof(Google__Protobuf__Duration, has_nanos),
offsetof(Google__Protobuf__Duration, nanos),
NULL,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
static const unsigned google__protobuf__duration__field_indices_by_name[] = {
1, /* field[1] = nanos */
0, /* field[0] = seconds */
};
static const ProtobufCIntRange google__protobuf__duration__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 0, 2 }
};
const ProtobufCMessageDescriptor google__protobuf__duration__descriptor =
{
PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
"google.protobuf.Duration",
"Duration",
"Google__Protobuf__Duration",
"google.protobuf",
sizeof(Google__Protobuf__Duration),
2,
google__protobuf__duration__field_descriptors,
google__protobuf__duration__field_indices_by_name,
1, google__protobuf__duration__number_ranges,
(ProtobufCMessageInit) google__protobuf__duration__init,
NULL,NULL,NULL /* reserved[123] */
};
| 1,563 |
2,023 | from tkinter import Tk, END, INSERT
from tkinter.ttk import Frame, Style
from tkinter.scrolledtext import ScrolledText
from tkinter.filedialog import asksaveasfilename, askopenfilename
class Scratchpad:
def __init__(self):
self.window = Tk()
self.window.title("Onager Scratchpad")
self.create_frame()
self.create_editing_window()
self.window.bind('<F7>', self.save_file)
self.window.bind('<F5>', self.open_file)
def create_frame(self):
frame_style = Style()
frame_style.theme_use('alt')
frame_style.configure("TFrame",
relief='raised')
self.frame = Frame(self.window, style="frame_style.TFrame")
self.frame.rowconfigure(1)
self.frame.columnconfigure(1)
self.frame.grid(row=0, column=0)
def create_editing_window(self):
self.editing_window = ScrolledText(self.frame)
self.editing_window.configure(fg='gold',
bg='blue',
font='serif 12',
padx='15',
pady='15',
wrap='word',
borderwidth='10',
relief='sunken',
tabs='48',
insertbackground='cyan')
self.editing_window.grid(row=0, column=0)
def save_file(self, event=None):
name = asksaveasfilename()
outfile = open(name, 'w')
contents = self.editing_window.get(0.0, END)
outfile.write(contents)
outfile.close()
def open_file(self, event=None):
name = askopenfilename()
infile = open(name, 'r')
contents = infile.read()
self.editing_window.insert(INSERT, contents)
infile.close()
def main():
onager = Scratchpad()
onager.window.mainloop()
if __name__=='__main__':
main()
| 1,088 |
6,989 | /*
C99 compatibility for SciPy
The Rules:
- Every function definition must have compiler guard so that it is not defined twice.
- This file should only affect compilers that do not support C99 natively.
- All functions should be defined as "static" to limit linker conflicts.
*/
#ifndef SCIPY_C99_COMPAT
#define SCIPY_C99_COMPAT
#include <float.h>
#if defined(_MSC_VER) && _MSC_VER <= 1600
/* MSVC 2008 and MSVC 2010 */
#ifndef isnan
#define isnan(x) _isnan((x))
#endif
#ifndef signbit
static int signbit(double x)
{
return x > 0;
}
#endif
#ifndef copysign
static double copysign(double x, double y)
{
if (x >= 0) {
if (y >= 0) {
return x;
}
else {
return -x;
}
}
else {
if (y >= 0) {
return -x;
}
else {
return x;
}
}
}
#endif
#ifndef fmax
static double fmax(double x, double y)
{
/* z > nan for z != nan is required by C the standard */
int xnan = isnan(x), ynan = isnan(y);
if (xnan || ynan)
{
if (xnan && !ynan)
return y;
if (!xnan && ynan)
return x;
return x;
}
/* +0 > -0 is preferred by C the standard */
if (x == 0 && y == 0)
{
int xs = signbit(x), ys = signbit(y);
if (xs && !ys)
return y;
if (!xs && ys)
return x;
return x;
}
if (x > y) {
return x;
}
else {
return y;
}
}
#endif
#ifndef fmin
static double fmin(double x, double y)
{
/* z > nan for z != nan is required by C the standard */
int xnan = isnan(x), ynan = isnan(y);
if (xnan || ynan)
{
if (xnan && !ynan)
return y;
if (!xnan && ynan)
return x;
return x;
}
/* +0 > -0 is preferred by C the standard */
if (x == 0 && y == 0)
{
int xs = signbit(x), ys = signbit(y);
if (xs && !ys)
return x;
if (!xs && ys)
return y;
return y;
}
if (x > y) {
return y;
}
else {
return x;
}
}
#endif
#endif
#if (__STDC_VERSION__ < 199901L)
/* Hopefully fail in less cases */
/* For compilers which aren't MSVC and haven't defined isnan */
#ifndef isnan
#define isnan(x) ((x) != (x))
#endif
#ifndef isfinite
#ifdef _MSC_VER
/* MSVC 2015 and newer still don't have everything */
#define isfinite(x) _finite((x))
#else
#define isfinite(x) !isnan((x) + (-x))
#endif
#endif
#ifndef isinf
#define isinf(x) (!isfinite(x) && !isnan(x))
#endif
#ifndef fma
#define fma(x, y, z) ((x)*(y) + (z))
#endif
#endif
/*
* portable isnan/isinf; in cmath only available in C++11 and npy_math
* versions don't work well (they get undef'd by cmath, see gh-5689)
* Implementation based on npy_math.h
*/
#ifndef sc_isnan
#define sc_isnan isnan
#endif
#ifndef sc_isinf
#define sc_isinf isinf
#endif
#ifndef sc_isfinite
#define sc_isfinite isfinite
#endif
#ifndef sc_fma
#define sc_fma fma
#endif
#endif
| 3,163 |
416 | <filename>src/main/java/com/tencentcloudapi/aai/v20180522/models/SimultaneousInterpretingRequest.java
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. 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.
*/
package com.tencentcloudapi.aai.v20180522.models;
import com.tencentcloudapi.common.AbstractModel;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
import java.util.HashMap;
public class SimultaneousInterpretingRequest extends AbstractModel{
/**
* 腾讯云项目 ID,可填 0,总长度不超过 1024 字节。
*/
@SerializedName("ProjectId")
@Expose
private Long ProjectId;
/**
* 子服务类型。0:离线语音识别。1:实时流式识别,2,一句话识别。3:同传。
*/
@SerializedName("SubServiceType")
@Expose
private Long SubServiceType;
/**
* 识别引擎类型。8k_zh: 8k 中文会场模型;16k_zh:16k 中文会场模型,8k_en: 8k 英文会场模型;16k_en:16k 英文会场模型。当前仅支持16K。
*/
@SerializedName("RecEngineModelType")
@Expose
private String RecEngineModelType;
/**
* 语音数据,要base64编码。
*/
@SerializedName("Data")
@Expose
private String Data;
/**
* 数据长度。
*/
@SerializedName("DataLen")
@Expose
private Long DataLen;
/**
* 声音id,标识一句话。
*/
@SerializedName("VoiceId")
@Expose
private String VoiceId;
/**
* 是否是一句话的结束。
*/
@SerializedName("IsEnd")
@Expose
private Long IsEnd;
/**
* 声音编码的格式1:pcm,4:speex,6:silk,默认为1。
*/
@SerializedName("VoiceFormat")
@Expose
private Long VoiceFormat;
/**
* 是否需要翻译结果,1表示需要翻译,0是不需要。
*/
@SerializedName("OpenTranslate")
@Expose
private Long OpenTranslate;
/**
* 如果需要翻译,表示源语言类型,可取值:zh,en。
*/
@SerializedName("SourceLanguage")
@Expose
private String SourceLanguage;
/**
* 如果需要翻译,表示目标语言类型,可取值:zh,en。
*/
@SerializedName("TargetLanguage")
@Expose
private String TargetLanguage;
/**
* 表明当前语音分片的索引,从0开始
*/
@SerializedName("Seq")
@Expose
private Long Seq;
/**
* Get 腾讯云项目 ID,可填 0,总长度不超过 1024 字节。
* @return ProjectId 腾讯云项目 ID,可填 0,总长度不超过 1024 字节。
*/
public Long getProjectId() {
return this.ProjectId;
}
/**
* Set 腾讯云项目 ID,可填 0,总长度不超过 1024 字节。
* @param ProjectId 腾讯云项目 ID,可填 0,总长度不超过 1024 字节。
*/
public void setProjectId(Long ProjectId) {
this.ProjectId = ProjectId;
}
/**
* Get 子服务类型。0:离线语音识别。1:实时流式识别,2,一句话识别。3:同传。
* @return SubServiceType 子服务类型。0:离线语音识别。1:实时流式识别,2,一句话识别。3:同传。
*/
public Long getSubServiceType() {
return this.SubServiceType;
}
/**
* Set 子服务类型。0:离线语音识别。1:实时流式识别,2,一句话识别。3:同传。
* @param SubServiceType 子服务类型。0:离线语音识别。1:实时流式识别,2,一句话识别。3:同传。
*/
public void setSubServiceType(Long SubServiceType) {
this.SubServiceType = SubServiceType;
}
/**
* Get 识别引擎类型。8k_zh: 8k 中文会场模型;16k_zh:16k 中文会场模型,8k_en: 8k 英文会场模型;16k_en:16k 英文会场模型。当前仅支持16K。
* @return RecEngineModelType 识别引擎类型。8k_zh: 8k 中文会场模型;16k_zh:16k 中文会场模型,8k_en: 8k 英文会场模型;16k_en:16k 英文会场模型。当前仅支持16K。
*/
public String getRecEngineModelType() {
return this.RecEngineModelType;
}
/**
* Set 识别引擎类型。8k_zh: 8k 中文会场模型;16k_zh:16k 中文会场模型,8k_en: 8k 英文会场模型;16k_en:16k 英文会场模型。当前仅支持16K。
* @param RecEngineModelType 识别引擎类型。8k_zh: 8k 中文会场模型;16k_zh:16k 中文会场模型,8k_en: 8k 英文会场模型;16k_en:16k 英文会场模型。当前仅支持16K。
*/
public void setRecEngineModelType(String RecEngineModelType) {
this.RecEngineModelType = RecEngineModelType;
}
/**
* Get 语音数据,要base64编码。
* @return Data 语音数据,要base64编码。
*/
public String getData() {
return this.Data;
}
/**
* Set 语音数据,要base64编码。
* @param Data 语音数据,要base64编码。
*/
public void setData(String Data) {
this.Data = Data;
}
/**
* Get 数据长度。
* @return DataLen 数据长度。
*/
public Long getDataLen() {
return this.DataLen;
}
/**
* Set 数据长度。
* @param DataLen 数据长度。
*/
public void setDataLen(Long DataLen) {
this.DataLen = DataLen;
}
/**
* Get 声音id,标识一句话。
* @return VoiceId 声音id,标识一句话。
*/
public String getVoiceId() {
return this.VoiceId;
}
/**
* Set 声音id,标识一句话。
* @param VoiceId 声音id,标识一句话。
*/
public void setVoiceId(String VoiceId) {
this.VoiceId = VoiceId;
}
/**
* Get 是否是一句话的结束。
* @return IsEnd 是否是一句话的结束。
*/
public Long getIsEnd() {
return this.IsEnd;
}
/**
* Set 是否是一句话的结束。
* @param IsEnd 是否是一句话的结束。
*/
public void setIsEnd(Long IsEnd) {
this.IsEnd = IsEnd;
}
/**
* Get 声音编码的格式1:pcm,4:speex,6:silk,默认为1。
* @return VoiceFormat 声音编码的格式1:pcm,4:speex,6:silk,默认为1。
*/
public Long getVoiceFormat() {
return this.VoiceFormat;
}
/**
* Set 声音编码的格式1:pcm,4:speex,6:silk,默认为1。
* @param VoiceFormat 声音编码的格式1:pcm,4:speex,6:silk,默认为1。
*/
public void setVoiceFormat(Long VoiceFormat) {
this.VoiceFormat = VoiceFormat;
}
/**
* Get 是否需要翻译结果,1表示需要翻译,0是不需要。
* @return OpenTranslate 是否需要翻译结果,1表示需要翻译,0是不需要。
*/
public Long getOpenTranslate() {
return this.OpenTranslate;
}
/**
* Set 是否需要翻译结果,1表示需要翻译,0是不需要。
* @param OpenTranslate 是否需要翻译结果,1表示需要翻译,0是不需要。
*/
public void setOpenTranslate(Long OpenTranslate) {
this.OpenTranslate = OpenTranslate;
}
/**
* Get 如果需要翻译,表示源语言类型,可取值:zh,en。
* @return SourceLanguage 如果需要翻译,表示源语言类型,可取值:zh,en。
*/
public String getSourceLanguage() {
return this.SourceLanguage;
}
/**
* Set 如果需要翻译,表示源语言类型,可取值:zh,en。
* @param SourceLanguage 如果需要翻译,表示源语言类型,可取值:zh,en。
*/
public void setSourceLanguage(String SourceLanguage) {
this.SourceLanguage = SourceLanguage;
}
/**
* Get 如果需要翻译,表示目标语言类型,可取值:zh,en。
* @return TargetLanguage 如果需要翻译,表示目标语言类型,可取值:zh,en。
*/
public String getTargetLanguage() {
return this.TargetLanguage;
}
/**
* Set 如果需要翻译,表示目标语言类型,可取值:zh,en。
* @param TargetLanguage 如果需要翻译,表示目标语言类型,可取值:zh,en。
*/
public void setTargetLanguage(String TargetLanguage) {
this.TargetLanguage = TargetLanguage;
}
/**
* Get 表明当前语音分片的索引,从0开始
* @return Seq 表明当前语音分片的索引,从0开始
*/
public Long getSeq() {
return this.Seq;
}
/**
* Set 表明当前语音分片的索引,从0开始
* @param Seq 表明当前语音分片的索引,从0开始
*/
public void setSeq(Long Seq) {
this.Seq = Seq;
}
public SimultaneousInterpretingRequest() {
}
/**
* NOTE: Any ambiguous key set via .set("AnyKey", "value") will be a shallow copy,
* and any explicit key, i.e Foo, set via .setFoo("value") will be a deep copy.
*/
public SimultaneousInterpretingRequest(SimultaneousInterpretingRequest source) {
if (source.ProjectId != null) {
this.ProjectId = new Long(source.ProjectId);
}
if (source.SubServiceType != null) {
this.SubServiceType = new Long(source.SubServiceType);
}
if (source.RecEngineModelType != null) {
this.RecEngineModelType = new String(source.RecEngineModelType);
}
if (source.Data != null) {
this.Data = new String(source.Data);
}
if (source.DataLen != null) {
this.DataLen = new Long(source.DataLen);
}
if (source.VoiceId != null) {
this.VoiceId = new String(source.VoiceId);
}
if (source.IsEnd != null) {
this.IsEnd = new Long(source.IsEnd);
}
if (source.VoiceFormat != null) {
this.VoiceFormat = new Long(source.VoiceFormat);
}
if (source.OpenTranslate != null) {
this.OpenTranslate = new Long(source.OpenTranslate);
}
if (source.SourceLanguage != null) {
this.SourceLanguage = new String(source.SourceLanguage);
}
if (source.TargetLanguage != null) {
this.TargetLanguage = new String(source.TargetLanguage);
}
if (source.Seq != null) {
this.Seq = new Long(source.Seq);
}
}
/**
* Internal implementation, normal users should not use it.
*/
public void toMap(HashMap<String, String> map, String prefix) {
this.setParamSimple(map, prefix + "ProjectId", this.ProjectId);
this.setParamSimple(map, prefix + "SubServiceType", this.SubServiceType);
this.setParamSimple(map, prefix + "RecEngineModelType", this.RecEngineModelType);
this.setParamSimple(map, prefix + "Data", this.Data);
this.setParamSimple(map, prefix + "DataLen", this.DataLen);
this.setParamSimple(map, prefix + "VoiceId", this.VoiceId);
this.setParamSimple(map, prefix + "IsEnd", this.IsEnd);
this.setParamSimple(map, prefix + "VoiceFormat", this.VoiceFormat);
this.setParamSimple(map, prefix + "OpenTranslate", this.OpenTranslate);
this.setParamSimple(map, prefix + "SourceLanguage", this.SourceLanguage);
this.setParamSimple(map, prefix + "TargetLanguage", this.TargetLanguage);
this.setParamSimple(map, prefix + "Seq", this.Seq);
}
}
| 6,369 |
316 | <filename>tests/slicing/sources/bitcast6.c
#include <limits.h>
/* test accessing bytes in int */
int main(void) {
int a = 0;
char *byte = (char *) &a;
int result = 0;
for (unsigned i = 0; i < sizeof(int); i++)
result |= (byte[i] = 0x1b) << i * CHAR_BIT;
test_assert(a == result);
return 0;
}
| 143 |
1,638 | <reponame>mehrdad-shokri/rmwc<filename>src/provider/generated-examples.json
["\n `\n import React from 'react';\n import * as ReactDOM from 'react-dom';\n import App from './App'; // your main app component\n import { RMWCProvider } from '@rmwc/provider';\n\n // This example disables ripples globally by default\n ReactDOM.render(\n <RMWCProvider\n // Globally disable ripples\n ripple={false}\n // Global options for icons\n // Takes the same options as the icon component\n icon={{\n basename: 'material-icons'\n }}\n // Global options for typography\n // allows mapping of a defaultTag or specific classes\n // See the Typography docs for more info\n typography={{\n defaultTag: 'div',\n headline1: 'h1'\n }}\n // Global options for tooltips\n // Takes most of the options for tooltips\n // See the Tooltip docs for more info\n tooltip={{\n align: 'right'\n }}\n >\n <App />\n </RMWCProvider>,\n document.getElementById('root'),\n );\n`\n"] | 436 |
438 | import sys
from setuptools import setup, find_packages
install_requires = ['']
classifiers = ["Programming Language :: Python",
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 3"]
setup(name='browsertime',
version="0.1",
url='https://github.com/sitespeedio/browsertime',
packages=find_packages(),
description=("Your browser, your page, your scripts!"),
author="<NAME>",
include_package_data=True,
zip_safe=False,
classifiers=classifiers,
install_requires=install_requires,
entry_points="""
[console_scripts]
visualmetrics.py = browsertime.visualmetrics:main
""")
| 277 |
473 | /*
* QEMU VNC display driver: hextile encoding
*
* Copyright (C) 2006 <NAME> <<EMAIL>>
* Copyright (C) 2006 <NAME>
* Copyright (C) 2009 Red Hat, Inc
*
* 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 "vnc.h"
static void hextile_enc_cord(uint8_t *ptr, int x, int y, int w, int h)
{
ptr[0] = ((x & 0x0F) << 4) | (y & 0x0F);
ptr[1] = (((w - 1) & 0x0F) << 4) | ((h - 1) & 0x0F);
}
#define BPP 32
#include "vnc-enc-hextile-template.h"
#undef BPP
#define GENERIC
#define BPP 32
#include "vnc-enc-hextile-template.h"
#undef BPP
#undef GENERIC
int vnc_hextile_send_framebuffer_update(VncState *vs, int x,
int y, int w, int h)
{
int i, j;
int has_fg, has_bg;
uint8_t *last_fg, *last_bg;
last_fg = (uint8_t *) g_malloc(VNC_SERVER_FB_BYTES);
last_bg = (uint8_t *) g_malloc(VNC_SERVER_FB_BYTES);
has_fg = has_bg = 0;
for (j = y; j < (y + h); j += 16) {
for (i = x; i < (x + w); i += 16) {
vs->hextile.send_tile(vs, i, j,
MIN(16, x + w - i), MIN(16, y + h - j),
last_bg, last_fg, &has_bg, &has_fg);
}
}
g_free(last_fg);
g_free(last_bg);
return 1;
}
void vnc_hextile_set_pixel_conversion(VncState *vs, int generic)
{
if (!generic) {
switch (VNC_SERVER_FB_BITS) {
case 32:
vs->hextile.send_tile = send_hextile_tile_32;
break;
}
} else {
switch (VNC_SERVER_FB_BITS) {
case 32:
vs->hextile.send_tile = send_hextile_tile_generic_32;
break;
}
}
}
| 1,162 |
447 | /*=============================================================================
Copyright (c) 2014-2021 <NAME>. All rights reserved.
Distributed under the MIT License [ https://opensource.org/licenses/MIT ]
=============================================================================*/
#if !defined(CYCFI_Q_MONOSTABLE_HPP_DECEMBER_24_2015)
#define CYCFI_Q_MONOSTABLE_HPP_DECEMBER_24_2015
#include <q/support/base.hpp>
#include <q/support/literals.hpp>
namespace cycfi::q
{
////////////////////////////////////////////////////////////////////////////
// monostable is a one shot pulse generator. A single pulse input
// generates a timed pulse of given duration. `basic_monostable` is the
// template class it is based on. It has a `retriggerable` parameter
// allows retriggering. Typedefs are provided for non retyriggable
// `monostable` an retyriggable `retriggerable_monostable` types.
////////////////////////////////////////////////////////////////////////////
template <bool retriggerable>
struct basic_monostable
{
basic_monostable(duration d, std::uint32_t sps)
: _n_samples(as_float(d) * sps)
{}
bool operator()(bool val)
{
// If we got a 1
if (val)
{
// If retriggerable, always start
if constexpr(retriggerable)
start();
// Else, start only if we are at the end
else if (_ticks == 0)
start();
}
// Count down
if (_ticks)
--_ticks;
return _ticks != 0;
}
bool operator()() const
{
return _ticks != 0;
}
void start()
{
_ticks = _n_samples;
}
void stop()
{
_ticks = 0;
}
std::uint32_t _n_samples;
std::uint32_t _ticks = 0;
};
using monostable = basic_monostable<false>;
using retriggerable_monostable = basic_monostable<true>;
}
#endif
| 803 |
852 | #ifndef HLTCOMPARATOR_H
#define HLTCOMPARATOR_H
// Original Author: <NAME>
#include "FWCore/Framework/interface/EDFilter.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/Common/interface/TriggerResults.h"
class TH1F;
class HltComparator : public edm::EDFilter {
public:
explicit HltComparator(const edm::ParameterSet &);
~HltComparator() override;
private:
edm::EDGetTokenT<edm::TriggerResults> hltOnlineResults_;
edm::EDGetTokenT<edm::TriggerResults> hltOfflineResults_;
std::vector<std::string> onlineActualNames_;
std::vector<std::string> offlineActualNames_;
std::vector<unsigned int> onlineToOfflineBitMappings_;
std::vector<TH1F *> comparisonHists_;
std::map<unsigned int, std::map<std::string, unsigned int>> triggerComparisonErrors_;
bool init_;
bool verbose_;
bool verbose() const { return verbose_; }
std::vector<std::string> skipPathList_;
std::vector<std::string> usePathList_;
unsigned int numTriggers_;
void beginJob() override;
bool filter(edm::Event &, const edm::EventSetup &) override;
void endJob() override;
void initialise(const edm::TriggerResults &, const edm::TriggerResults &, edm::Event &e);
std::string formatResult(const unsigned int);
};
#endif // HLTCOMPARATOR_HH
| 487 |
507 | <reponame>RussellALA/FrEIA<gh_stars>100-1000
import warnings
from FrEIA.framework.sequence_inn import SequenceINN
class ReversibleSequential(SequenceINN):
def __init__(self, *dims: int):
warnings.warn("ReversibleSequential is deprecated in favour of "
"SequenceINN. It will be removed in a future version "
"of FrEIA.",
DeprecationWarning)
super().__init__(*dims)
| 201 |
303 | <filename>lightcrafts/src/com/lightcrafts/app/menu/UndoMenuItem.java
/* Copyright (C) 2005-2011 <NAME> */
package com.lightcrafts.app.menu;
import com.lightcrafts.app.ComboFrame;
import com.lightcrafts.ui.editor.Document;
import javax.swing.*;
class UndoMenuItem extends ActionMenuItem {
UndoMenuItem(ComboFrame frame) {
super(frame, "Undo");
}
Action getDocumentAction() {
Document doc = getDocument();
if (doc != null) {
return doc.getUndoAction();
}
else {
return null;
}
}
}
| 253 |
936 | /*
* Copyright 2019, Yahoo Inc.
* Licensed under the Apache License, Version 2.0
* See LICENSE file in project root for terms.
*/
package com.yahoo.elide.tests;
import static com.yahoo.elide.core.dictionary.EntityDictionary.NO_VERSION;
import static com.yahoo.elide.test.graphql.GraphQLDSL.UNQUOTED_VALUE;
import static com.yahoo.elide.test.graphql.GraphQLDSL.argument;
import static com.yahoo.elide.test.graphql.GraphQLDSL.arguments;
import static com.yahoo.elide.test.graphql.GraphQLDSL.document;
import static com.yahoo.elide.test.graphql.GraphQLDSL.field;
import static com.yahoo.elide.test.graphql.GraphQLDSL.mutation;
import static com.yahoo.elide.test.graphql.GraphQLDSL.query;
import static com.yahoo.elide.test.graphql.GraphQLDSL.selection;
import static com.yahoo.elide.test.graphql.GraphQLDSL.selections;
import static com.yahoo.elide.test.graphql.GraphQLDSL.variableDefinition;
import static com.yahoo.elide.test.graphql.GraphQLDSL.variableDefinitions;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.equalTo;
import com.yahoo.elide.core.exceptions.HttpStatus;
import com.yahoo.elide.initialization.GraphQLIntegrationTest;
import com.yahoo.elide.test.graphql.VariableFieldSerializer;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import example.Currency;
import example.Price;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import lombok.Getter;
import lombok.Setter;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import javax.ws.rs.core.MediaType;
/**
* GraphQL integration tests.
*/
public class GraphQLIT extends GraphQLIntegrationTest {
private static class Book {
@Getter
@Setter
private long id;
@Getter
@Setter
@JsonSerialize(using = VariableFieldSerializer.class, as = String.class)
private String title;
@Getter
@Setter
private Price price;
private Collection<example.Author> authors = new ArrayList<>();
}
private static class Author {
@Getter
@Setter
private Long id;
@Getter
@Setter
@JsonSerialize(using = VariableFieldSerializer.class, as = String.class)
private String name;
}
@BeforeEach
public void createBookAndAuthor() throws IOException {
// before each test, create a new book and a new author
Book book = new Book();
book.setId(1);
book.setTitle("1984");
Price price = new Price();
price.setTotal(BigDecimal.valueOf(10.0));
price.setCurrency(new Currency("USD"));
book.setPrice(price);
Author author = new Author();
author.setId(1L);
author.setName("<NAME>");
String graphQLQuery = document(
mutation(
selection(
field(
"book",
arguments(
argument("op", "UPSERT"),
argument("data", book)
),
selections(
field("id"),
field("title"),
field(
"authors",
arguments(
argument("op", "UPSERT"),
argument("data", author)
),
selections(
field("id"),
field("name")
)
)
)
)
)
)
).toQuery();
String expectedResponse = document(
selection(
field(
"book",
selections(
field("id", "1"),
field("title", "1984"),
field(
"authors",
selections(
field("id", "1"),
field("name", "<NAME>")
)
)
)
)
)
).toResponse();
runQueryWithExpectedResult(graphQLQuery, expectedResponse);
}
@Test
public void createWithVariables() throws IOException {
// create a second book using variable
Book book = new Book();
book.setId(2);
book.setTitle("$bookName");
Author author = new Author();
author.setId(2L);
author.setName("$authorName");
String graphQLRequest = document(
mutation(
"myMutation",
variableDefinitions(
variableDefinition("bookName", "String"),
variableDefinition("authorName", "String")
),
selection(
field(
"book",
arguments(
argument("op", "UPSERT"),
argument("data", book, UNQUOTED_VALUE)
),
selections(
field("id"),
field("title"),
field(
"authors",
arguments(
argument("op", "UPSERT"),
argument("data", author, UNQUOTED_VALUE)
),
selections(
field("id"),
field("name")
)
)
)
)
)
)
).toQuery();
String expected = document(
selection(
field(
"book",
selections(
field("id", "2"),
field("title", "Grapes of Wrath"),
field(
"authors",
selections(
field("id", "2"),
field("name", "<NAME>")
)
)
)
)
)
).toResponse();
Map<String, Object> variables = new HashMap<>();
variables.put("bookName", "Grapes of Wrath");
variables.put("authorName", "<NAME>");
runQueryWithExpectedResult(graphQLRequest, variables, expected);
}
@Test
public void fetchCollection() throws IOException {
// create a second book
createWithVariables();
String graphQLRequest = document(
selection(
field(
"book",
selections(
field("id"),
field("title"),
field(
"authors",
selections(
field("id"),
field("name")
)
)
)
)
)
).toQuery();
String expected = document(
selections(
field(
"book",
selections(
field("id", "1"),
field("title", "1984"),
field(
"authors",
selections(
field("id", "1"),
field("name", "<NAME>")
)
)
),
selections(
field("id", "2"),
field("title", "Grapes of Wrath"),
field(
"authors",
selections(
field("id", "2"),
field("name", "<NAME>")
)
)
)
)
)
).toResponse();
runQueryWithExpectedResult(graphQLRequest, expected);
}
@Test
public void testFilterByComplexAttribute() throws IOException {
String graphQLRequest = document(
selection(
field(
"book",
arguments(
argument("filter", "\"price.total>=5\"")
),
selections(
field("id"),
field("title")
)
)
)
).toQuery();
String expectedResponse = document(
selection(
field(
"book",
selections(
field("id", "1"),
field("title", "1984")
)
)
)
).toResponse();
runQueryWithExpectedResult(graphQLRequest, expectedResponse);
graphQLRequest = document(
selection(
field(
"book",
arguments(
argument("filter", "\"price.total<=5\"")
),
selections(
field("id"),
field("title")
)
)
)
).toQuery();
expectedResponse = "{\"data\": {\"book\": {\"edges\": []}}}";
runQueryWithExpectedResult(graphQLRequest, expectedResponse);
}
@Test
public void testFilterByNestedComplexAttribute() throws IOException {
String graphQLRequest = document(
selection(
field(
"book",
arguments(
argument("filter", "\"price.currency.isoCode==USD\"")
),
selections(
field("id"),
field("title")
)
)
)
).toQuery();
String expectedResponse = document(
selection(
field(
"book",
selections(
field("id", "1"),
field("title", "1984")
)
)
)
).toResponse();
runQueryWithExpectedResult(graphQLRequest, expectedResponse);
graphQLRequest = document(
selection(
field(
"book",
arguments(
argument("filter", "\"price.currency.isoCode==ABC\"")
),
selections(
field("id"),
field("title")
)
)
)
).toQuery();
expectedResponse = "{\"data\": {\"book\": {\"edges\": []}}}";
runQueryWithExpectedResult(graphQLRequest, expectedResponse);
}
@Test
public void testInvalidFetch() throws IOException {
Book book = new Book();
String graphQLRequest = document(
selection(
field(
"book",
arguments(
argument("op", "FETCH"),
argument("data", book)
),
selections(
field("id"),
field("title")
)
)
)
).toQuery();
String expected = "{\"data\":{\"book\":null},\"errors\":[{\"message\":\"Exception while fetching data "
+ "(/book) : FETCH must not include data\","
+ "\"locations\":[{\"line\":1,\"column\":2}],\"path\":[\"book\"],"
+ "\"extensions\":{\"classification\":\"DataFetchingException\"}}]}";
runQueryWithExpectedResult(graphQLRequest, expected);
}
@Test
public void fetchRootSingle() throws IOException {
String graphQLRequest = document(
selection(
field(
"book",
argument(
argument(
"ids",
Arrays.asList("1")
)
),
selections(
field("id"),
field("title")
)
)
)
).toQuery();
String expectedResponse = document(
selection(
field(
"book",
selections(
field("id", "1"),
field("title", "1984")
)
)
)
).toResponse();
runQueryWithExpectedResult(graphQLRequest, expectedResponse);
}
@Test
public void runUpdateAndFetchDifferentTransactionsBatch() throws IOException {
Book book = new Book();
book.setId(2);
book.setTitle("my book created in batch!");
String graphQLRequest1 = document(
mutation(
selection(
field(
"book",
arguments(
argument("op", "UPSERT"),
argument("data", book)
),
selections(
field("id"),
field("title")
)
)
)
)
).toQuery();
String graphQLRequest2 = document(
selection(
field(
"book",
argument(argument("ids", "\"2\"")),
selections(
field("id"),
field("title")
)
)
)
).toQuery();
String expectedResponse = document(
selection(
field(
"book",
selections(
field("id", "2"),
field("title", "my book created in batch!")
)
)
),
selections(
field(
"book",
selections(
field("id", "2"),
field("title", "my book created in batch!")
)
)
)
).toResponse();
compareJsonObject(
runQuery(toJsonArray(toJsonNode(graphQLRequest1), toJsonNode(graphQLRequest2)), NO_VERSION),
expectedResponse
);
}
@Test
public void runMultipleRequestsSameTransactionWithAliases() throws IOException {
// This test demonstrates that multiple roots can be manipulated within a _single_ transaction
String graphQLRequest = document(
selections(
field(
"firstAuthorCollection",
"author",
selections(
field("id"),
field("name")
)
),
field(
"secondAuthorCollection",
"author",
selections(
field("id"),
field("name")
)
)
)
).toQuery();
String expectedResponse = document(
selections(
field(
"firstAuthorCollection",
selections(
field("id", "1"),
field("name", "<NAME>")
)
),
field(
"secondAuthorCollection",
selections(
field("id", "1"),
field("name", "<NAME>")
)
)
)
).toResponse();
runQueryWithExpectedResult(graphQLRequest, expectedResponse);
}
@Tag("skipInMemory") //Elide doesn't support to-many filter joins in memory yet.
@ParameterizedTest
@ValueSource(strings = {
"\"books.title==\\\"1984\\\"\"",
"\"books.id=isnull=false\"",
"\"books.title=in=(\\\"1984\\\")\""})
public void runManyToManyFilter(String filter) throws IOException {
String graphQLRequest = document(
query(
selections(
field(
"author",
arguments(
argument("filter", filter)
),
selections(
field("id"),
field("name"),
field(
"books",
selections(
field("id"),
field("title")
)
)
)
)
)
)
).toQuery();
String expectedResponse = document(
selection(
field(
"author",
selections(
field("id", "1"),
field("name", "<NAME>"),
field(
"books",
selections(
field("id", "1"),
field("title", "1984")
)
)
)
)
)
).toResponse();
runQueryWithExpectedResult(graphQLRequest, expectedResponse);
}
@Test
public void testTypeIntrospection() throws Exception {
String graphQLRequest = "{"
+ "__type(name: \"Book\") {"
+ " name"
+ " fields {"
+ " name"
+ " }"
+ "}"
+ "}";
String query = toJsonQuery(graphQLRequest, new HashMap<>());
given()
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON)
.body(query)
.post("/graphQL")
.then()
.statusCode(HttpStatus.SC_OK)
.body("data.__type.fields.name", containsInAnyOrder("id", "awards", "chapterCount",
"editorName", "genre", "language", "publishDate", "title", "authors", "chapters", "price",
"editor", "publisher"));
}
@Test
public void testVersionedTypeIntrospection() throws Exception {
String graphQLRequest = "{"
+ "__type(name: \"Book\") {"
+ " name"
+ " fields {"
+ " name"
+ " }"
+ "}"
+ "}";
String query = toJsonQuery(graphQLRequest, new HashMap<>());
given()
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON)
.header("ApiVersion", "1.0")
.body(query)
.post("/graphQL")
.then()
.statusCode(HttpStatus.SC_OK)
.body("data.__type.fields.name", containsInAnyOrder("id", "name", "publishDate"));
}
@Test
@Tag("skipInMemory") //Skipping because storage for in-memory store is
//broken out by class instead of a common underlying database table.
public void fetchCollectionVersioned() throws IOException {
String graphQLRequest = document(
selection(
field(
"book",
selections(
field("id"),
field("name")
)
)
)
).toQuery();
String expected = document(
selections(
field(
"book",
selections(
field("id", "1"),
field("name", "1984")
)
)
)
).toResponse();
runQueryWithExpectedResult(graphQLRequest, null, expected, "1.0");
}
@Test
public void testInvalidApiVersion() throws IOException {
String graphQLRequest = document(
selection(
field(
"book",
selections(
field("id"),
field("name")
)
)
)
).toQuery();
String expected = "{\"errors\":[{\"message\":\"Invalid operation: Invalid API Version\"}]}";
String query = toJsonQuery(graphQLRequest, new HashMap<>());
given()
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON)
.header("ApiVersion", "2.0")
.body(query)
.post("/graphQL")
.then()
.body(equalTo(expected))
.statusCode(HttpStatus.SC_BAD_REQUEST);
}
@Test
public void testMissingVersionedModel() throws IOException {
String graphQLRequest = document(
selection(
field(
"parent",
selections(
field("id")
)
)
)
).toQuery();
String expected = "{\"errors\":[{\"message\":\"Bad Request Body'Unknown entity {parent}.'\"}]}";
runQueryWithExpectedResult(graphQLRequest, null, expected, "1.0");
}
private String toJsonArray(JsonNode... nodes) throws IOException {
ArrayNode arrayNode = JsonNodeFactory.instance.arrayNode();
for (JsonNode node : nodes) {
arrayNode.add(node);
}
return mapper.writeValueAsString(arrayNode);
}
}
| 18,792 |
6,992 | <filename>core/src/test/java/org/springframework/security/access/vote/DenyAgainVoter.java
/*
* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
*
* 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.security.access.vote;
import java.util.Collection;
import java.util.Iterator;
import org.springframework.security.access.AccessDecisionVoter;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.core.Authentication;
/**
* Implementation of an {@link AccessDecisionVoter} for unit testing.
* <p>
* If the {@link ConfigAttribute#getAttribute()} has a value of
* <code>DENY_AGAIN_FOR_SURE</code>, the voter will vote to deny access.
* <p>
* All comparisons are case sensitive.
*
* @author <NAME>
*/
public class DenyAgainVoter implements AccessDecisionVoter<Object> {
@Override
public boolean supports(ConfigAttribute attribute) {
return "DENY_AGAIN_FOR_SURE".equals(attribute.getAttribute());
}
@Override
public boolean supports(Class<?> clazz) {
return true;
}
@Override
public int vote(Authentication authentication, Object object, Collection<ConfigAttribute> attributes) {
Iterator<ConfigAttribute> iter = attributes.iterator();
while (iter.hasNext()) {
ConfigAttribute attribute = iter.next();
if (this.supports(attribute)) {
return ACCESS_DENIED;
}
}
return ACCESS_ABSTAIN;
}
}
| 562 |
1,491 | <gh_stars>1000+
{
"testEnvironment": "jsdom",
"moduleFileExtensions": ["js", "jsx"],
"testRegex": "/__tests__/.*\\.test\\.js$",
"setupTestFrameworkScriptFile": "__tests__/jest.jsdom.setup.js"
} | 82 |
1,540 | <gh_stars>1000+
package testhelper;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
import javax.tools.JavaFileObject.Kind;
public class SourceCode {
private final String name;
private final File directory;
private final boolean skipLoading;
private final File location;
public SourceCode(String name, String src, File directory, boolean skipLoading)
throws IOException {
this.name = name;
this.directory = directory;
this.skipLoading = skipLoading;
this.location = new File(directory, name + Kind.SOURCE.extension);
if (this.location.exists()) {
this.location.delete();
}
Files.write(location.toPath(), src.getBytes(), StandardOpenOption.CREATE_NEW);
}
public File getDirectory() {
return directory;
}
public String getName() {
return name;
}
public boolean isSkipLoading() {
return skipLoading;
}
public File getLocation() {
return location;
}
}
| 326 |
852 | <reponame>ckamtsikis/cmssw
#ifndef RecoExamples_JetToDigiDump_h
#define RecoExamples_JetToDigiDump_h
#include <TH1.h>
#include <TProfile.h>
#include <TH2.h>
/* \class JetToDigiDump
*
* \author <NAME>
*
* \version 1
*
*/
#include "FWCore/Framework/interface/EDAnalyzer.h"
class JetToDigiDump : public edm::EDAnalyzer {
public:
JetToDigiDump(const edm::ParameterSet&);
private:
//Framwework stuff
void beginJob() override;
void analyze(const edm::Event&, const edm::EventSetup&) override;
void endJob() override;
// Parameters passed via the config file
std::string DumpLevel; //How deep into calorimeter reco to dump
std::string CaloJetAlg; //Jet Algorithm to dump
int DebugLevel; //0 = no debug prints
bool ShowECal; //if true, ECAL hits are ignored
//Internal parameters
int Dump;
int evtCount;
};
#endif
| 367 |
1,682 | /*
Copyright (c) 2012 LinkedIn Corp.
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.
*/
/* $Id$ */
package com.linkedin.r2.transport.common.bridge.server;
import com.linkedin.common.callback.Callback;
import com.linkedin.r2.message.RequestContext;
import com.linkedin.r2.message.Messages;
import com.linkedin.r2.message.rest.RestException;
import com.linkedin.r2.message.rest.RestRequest;
import com.linkedin.r2.message.rest.RestResponse;
import com.linkedin.r2.message.rest.RestStatus;
import com.linkedin.r2.message.stream.StreamRequest;
import com.linkedin.r2.message.stream.StreamResponse;
import com.linkedin.r2.message.stream.entitystream.DrainReader;
import com.linkedin.r2.transport.common.RestRequestHandler;
import com.linkedin.r2.transport.common.StreamRequestHandler;
import com.linkedin.r2.transport.common.StreamRequestHandlerAdapter;
import com.linkedin.r2.transport.common.bridge.common.TransportCallback;
import com.linkedin.r2.transport.common.bridge.common.TransportResponseImpl;
import com.linkedin.r2.util.URIUtil;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
/**
* A dispatcher that uses the first path segment (as defined in RFC 2396) to dispatch to another
* request handler that manages that context.
*
* @author <NAME>
* @version $Revision$
*/
public class ContextDispatcher implements TransportDispatcher
{
private static final StreamRequestHandler DEFAULT_STREAM_HANDLER = new StreamRequestHandler() {
@Override
public void handleRequest(StreamRequest req, RequestContext requestContext, Callback<StreamResponse> callback)
{
final RestResponse response =
RestStatus.responseForStatus(RestStatus.NOT_FOUND, "No resource for URI: " + req.getURI());
callback.onSuccess(Messages.toStreamResponse(response));
req.getEntityStream().setReader(new DrainReader());
}
};
private static final RestRequestHandler DEFAULT_REST_HANDLER = new RestRequestHandler()
{
@Override
public void handleRequest(RestRequest request, RequestContext requestContext, Callback<RestResponse> callback)
{
callback.onSuccess(RestStatus.responseForStatus(RestStatus.NOT_FOUND, "No resource for URI: " + request.getURI()));
}
};
private final Map<String, StreamRequestHandler> _streamHandlers;
private final Map<String, RestRequestHandler> _restHandlers;
/**
* Construct a new instance with the specified dispatcher maps.
*
* @param restDispatcher a map from path to {@link RestRequestHandler}. REST requests whose first
* path segment matches the map key will be dispatched to the respective
* handler.
*/
public ContextDispatcher(Map<String, RestRequestHandler> restDispatcher)
{
_streamHandlers = new HashMap<>();
for (Map.Entry<String, RestRequestHandler> entry : restDispatcher.entrySet())
{
_streamHandlers.put(entry.getKey(), new StreamRequestHandlerAdapter(entry.getValue()));
}
_restHandlers = new HashMap<>(restDispatcher);
}
@Override
public void handleRestRequest(RestRequest req, Map<String, String> wireAttrs,
RequestContext requestContext, TransportCallback<RestResponse> callback)
{
final RestRequestHandler handler = getHandler(req.getURI(), _restHandlers, DEFAULT_REST_HANDLER);
try
{
handler.handleRequest(req, requestContext, new TransportCallbackAdapter<>(callback));
}
catch (Exception e)
{
callback.onResponse(TransportResponseImpl.<RestResponse>error(RestException.forError(RestStatus.INTERNAL_SERVER_ERROR, e)));
}
}
@Override
public void handleStreamRequest(StreamRequest req, Map<String, String> wireAttrs,
RequestContext requestContext,
TransportCallback<StreamResponse> callback)
{
final StreamRequestHandler handler = getHandler(req.getURI(), _streamHandlers,
DEFAULT_STREAM_HANDLER);
try
{
handler.handleRequest(req, requestContext, new TransportCallbackAdapter<>(callback));
}
catch (Exception e)
{
final Exception ex = RestException.forError(RestStatus.INTERNAL_SERVER_ERROR, e);
callback.onResponse(TransportResponseImpl.<StreamResponse>error(ex));
}
}
private <T> T getHandler(URI uri, Map<String, T> handlers, T defaultHandler)
{
final String path = uri.getPath();
if (path == null)
{
return defaultHandler;
}
final String[] segs = URIUtil.tokenizePath(path);
if (segs.length < 1)
{
return defaultHandler;
}
final T handler = handlers.get(segs[0]);
return handler != null ? handler : defaultHandler;
}
}
| 1,753 |
690 | <filename>artemis-core/artemis/src/test/java/com/artemis/ComponentManagerTest.java
package com.artemis;
import static org.junit.Assert.fail;
import java.lang.reflect.Field;
import org.junit.Before;
public class ComponentManagerTest {
private World world;
@Before
public void init() {
world = new World();
try {
Field field = field("componentTypeCount");
field.setInt(world.getComponentManager().typeFactory, 0xffff);
} catch (NoSuchFieldException e) {
fail(e.getMessage());
} catch (SecurityException e) {
fail(e.getMessage());
} catch (IllegalArgumentException e) {
fail(e.getMessage());
} catch (IllegalAccessException e) {
fail(e.getMessage());
}
}
private static Field field(String f) throws NoSuchFieldException {
Field field = ComponentTypeFactory.class.getDeclaredField(f);
field.setAccessible(true);
return field;
}
private static class Pooled extends PooledComponent {
@Override
public void reset() {}
}
private class Basic extends Component {
@SuppressWarnings("unused")
public String text;
}
}
| 368 |
515 | <filename>Plugins/org.commontk.eventbus/Testing/Cpp/ctkTestRegistry.cpp
/*
* ctkTestRegistry.cpp
* ctkTestSuiteEngine
*
* Created by <NAME> on 17/09/09.
* Copyright 2009 B3C. All rights reserved.
*
* See Licence at: http://tiny.cc/QXJ4D
*
*/
#include "ctkTestRegistry.h"
using namespace ctkQA;
ctkTestRegistry* ctkTestRegistry::instance() {
static ctkTestRegistry registry;
return ®istry;
}
void ctkTestRegistry::registerTest(QObject* test) {
m_TestSuite += test;
}
int ctkTestRegistry::runTests(int argc, char* argv[]) {
int result = 0;
foreach(QObject* test, m_TestSuite) {
result |= QTest::qExec(test, argc, argv);
}
return result;
}
| 276 |
7,482 | <reponame>849679859/rt-thread
/*
* Copyright (c) 2020, Shenzhen Academy of Aerospace Technology
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2020-10-16 Dystopia the first version
*/
#include <rthw.h>
#include <rtthread.h>
#include <finsh.h>
#include "board.h"
#include <interrupt.h>
extern int __bss_end;
static void rt_hw_timer_isr(int vector, void *param)
{
rt_tick_increase();
/* timer interrupt cleared by hardware */
}
int rt_hw_timer_init(void)
{
unsigned int counter = 1000000 / RT_TICK_PER_SECOND;
volatile struct lregs *regs = (struct lregs *)PREGS;
regs->scalercnt = CPU_FREQ / 1000000 - 1;
regs->scalerload = CPU_FREQ / 1000000 - 1;
regs->timercnt2 = counter - 1;
regs->timerload2 = counter - 1;
rt_hw_interrupt_install(TIMER2_TT, rt_hw_timer_isr, RT_NULL, "tick");
rt_hw_interrupt_umask(TIMER2_TT);
/* start timer */
regs->timerctrl2 = 0x7;
return 0;
}
INIT_BOARD_EXPORT(rt_hw_timer_init);
/**
* This function will initialize beaglebone board
*/
void rt_hw_board_init(void)
{
rt_system_heap_init((void *)&__bss_end, (unsigned char *)&__bss_end + 0x01000000);
rt_components_board_init();
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
}
| 561 |
1,144 | <reponame>dram/metasfresh<filename>backend/de.metas.vertical.pharma/src/main/java/de/metas/impexp/bpartner/IFABPartnerImportProcess.java
package de.metas.impexp.bpartner;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Objects;
import java.util.Properties;
import org.adempiere.ad.trx.api.ITrx;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.model.InterfaceWrapperHelper;
import org.adempiere.util.lang.IMutable;
import de.metas.impexp.processing.ImportRecordsSelection;
import de.metas.impexp.processing.SimpleImportProcessTemplate;
import de.metas.vertical.pharma.model.I_C_BPartner;
import de.metas.vertical.pharma.model.I_I_Pharma_BPartner;
import de.metas.vertical.pharma.model.X_I_Pharma_BPartner;
import de.metas.vertical.pharma.model.X_I_Pharma_Product;
import lombok.NonNull;
/*
* #%L
* metasfresh-pharma
* %%
* Copyright (C) 2019 metas GmbH
* %%
* 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, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* #L%
*/
public class IFABPartnerImportProcess extends SimpleImportProcessTemplate<I_I_Pharma_BPartner>
{
private final String DEACTIVATE_OPERATION_CODE = "2";
@Override
public Class<I_I_Pharma_BPartner> getImportModelClass()
{
return I_I_Pharma_BPartner.class;
}
@Override
public String getImportTableName()
{
return I_I_Pharma_BPartner.Table_Name;
}
@Override
protected String getTargetTableName()
{
return org.compiere.model.I_C_BPartner.Table_Name;
}
@Override
protected String getImportOrderBySql()
{
return I_I_Pharma_BPartner.COLUMNNAME_b00gdat;
}
@Override
protected I_I_Pharma_BPartner retrieveImportRecord(final Properties ctx, final ResultSet rs) throws SQLException
{
return new X_I_Pharma_BPartner(ctx, rs, ITrx.TRXNAME_ThreadInherited);
}
@Override
protected void updateAndValidateImportRecords()
{
final ImportRecordsSelection selection = getImportRecordsSelection();
IFABPartnerImportTableSqlUpdater.updateBPartnerImportTable(selection);
}
@Override
protected ImportRecordResult importRecord(@NonNull final IMutable<Object> state,@NonNull final I_I_Pharma_BPartner importRecord, final boolean isInsertOnly)
{
final I_C_BPartner existentBPartner = IFABPartnerImportHelper.fetchManufacturer(importRecord.getb00adrnr());
final String operationCode = importRecord.getb00ssatz();
if (DEACTIVATE_OPERATION_CODE.equals(operationCode) && existentBPartner != null)
{
deactivatePartner(existentBPartner);
return ImportRecordResult.Updated;
}
else if (!DEACTIVATE_OPERATION_CODE.equals(operationCode))
{
//
// Get previous values
IFABPartnerContext context = (IFABPartnerContext)state.getValue();
if (context == null)
{
context = new IFABPartnerContext();
state.setValue(context);
}
final I_I_Pharma_BPartner previousImportRecord = context.getPreviousImportRecord();
final int previousBPartnerId = context.getPreviousC_BPartner_ID();
final String previousBPValue = context.getPreviousBPValue();
context.setPreviousImportRecord(importRecord); // set it early in case this method fails
final ImportRecordResult bpartnerImportResult;
// create a new BPartner or update the existing one
final boolean firstImportRecordOrNewBPartner = previousImportRecord == null || !Objects.equals(importRecord.getb00adrnr(), previousBPValue);
if (firstImportRecordOrNewBPartner)
{
// create a new list because we are passing to a new partner
context.clearPreviousRecordsForSameBP();
bpartnerImportResult = importOrUpdateBPartner(importRecord, isInsertOnly);
}
// Same BPValue like previous line
else
{
if (previousBPartnerId <= 0)
{
bpartnerImportResult = importOrUpdateBPartner(importRecord, isInsertOnly);
}
else if (importRecord.getC_BPartner_ID() <= 0 || importRecord.getC_BPartner_ID() == previousBPartnerId)
{
bpartnerImportResult = doNothingAndUsePreviousPartner(importRecord, previousImportRecord);
}
else
{
throw new AdempiereException("Same BPValue as previous line but not same BPartner linked");
}
}
IFABPartnerLocationImportHelper.importRecord(importRecord, context.getPreviousImportRecordsForSameBP());
context.collectImportRecordForSameBP(importRecord);
return bpartnerImportResult;
}
return ImportRecordResult.Nothing;
}
private void deactivatePartner(@NonNull final I_C_BPartner partner)
{
partner.setIsActive(false);
InterfaceWrapperHelper.save(partner);
}
private ImportRecordResult importOrUpdateBPartner(@NonNull final I_I_Pharma_BPartner importRecord, final boolean isInsertOnly)
{
final boolean bpartnerExists = importRecord.getC_BPartner_ID() > 0;
if (isInsertOnly && bpartnerExists)
{
return ImportRecordResult.Nothing;
}
IFABPartnerImportHelper.importRecord(importRecord);
return bpartnerExists ? ImportRecordResult.Updated : ImportRecordResult.Inserted;
}
private ImportRecordResult doNothingAndUsePreviousPartner(@NonNull final I_I_Pharma_BPartner importRecord, @NonNull final I_I_Pharma_BPartner previousImportRecord)
{
importRecord.setC_BPartner(previousImportRecord.getC_BPartner());
return ImportRecordResult.Nothing;
}
@Override
protected void markImported(@NonNull final I_I_Pharma_BPartner importRecord)
{
importRecord.setI_IsImported(X_I_Pharma_Product.I_ISIMPORTED_Imported);
importRecord.setProcessed(true);
InterfaceWrapperHelper.save(importRecord);
}
}
| 2,076 |
1,120 | import argparse
import json
import os
import shutil
import sys
import numpy as np
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../")))
def add_args(parser):
parser.add_argument('--client_num_per_round', type=int, default=3, metavar='NN',
help='number of workers')
parser.add_argument('--comm_round', type=int, default=10,
help='how many round of communications we should use')
args = parser.parse_args()
return args
def read_data(train_data_dir, test_data_dir):
'''parses data in given train and test data directories
assumes:
- the data in the input directories are .json files with
keys 'users' and 'user_data'
- the set of train set users is the same as the set of test set users
Return:
clients: list of client ids
groups: list of group ids; empty list if none found
train_data: dictionary of train data
test_data: dictionary of test data
'''
clients = []
train_num_samples = []
test_num_samples = []
train_data = {}
test_data = {}
train_files = os.listdir(train_data_dir)
train_files = [f for f in train_files if f.endswith('.json')]
# print(train_files)
for f in train_files:
file_path = os.path.join(train_data_dir, f)
with open(file_path, 'r') as inf:
cdata = json.load(inf)
clients.extend(cdata['users'])
train_num_samples.extend(cdata['num_samples'])
train_data.update(cdata['user_data'])
# print(cdata['user_data'])
test_files = os.listdir(test_data_dir)
test_files = [f for f in test_files if f.endswith('.json')]
for f in test_files:
file_path = os.path.join(test_data_dir, f)
with open(file_path, 'r') as inf:
cdata = json.load(inf)
test_num_samples.extend(cdata['num_samples'])
test_data.update(cdata['user_data'])
# parse python script input parameters
parser = argparse.ArgumentParser()
main_args = add_args(parser)
class Args:
def __init__(self, client_id, client_num_per_round, comm_round):
self.client_num_per_round = client_num_per_round
self.comm_round = comm_round
self.client_id = client_id
self.client_sample_list = []
client_list = []
for client_number in range(main_args.client_num_per_round):
client_list.append(Args(client_number, main_args.client_num_per_round, main_args.comm_round))
return clients, train_num_samples, test_num_samples, train_data, test_data, client_list
def client_sampling(round_idx, client_num_in_total, client_num_per_round):
if client_num_in_total == client_num_per_round:
client_indexes = [client_index for client_index in range(client_num_in_total)]
else:
num_clients = min(client_num_per_round, client_num_in_total)
np.random.seed(round_idx) # make sure for each comparison, we are selecting the same clients each round
client_indexes = np.random.choice(range(client_num_in_total), num_clients, replace=False)
print("client_indexes = %s" % str(client_indexes))
return client_indexes
if __name__ == '__main__':
parser = argparse.ArgumentParser()
main_args = add_args(parser)
train_path = "../../FedML/data/MNIST/train"
test_path = "../../FedML/data/MNIST/test"
new_train = {}
new_test = {}
users, train_num_samples, test_num_samples, train_data, test_data, client_list = read_data(train_path, test_path)
for round_idx in range(client_list[0].comm_round):
sample_list = client_sampling(round_idx, 1000, main_args.client_num_per_round)
for worker in client_list:
worker.client_sample_list.append(sample_list[worker.client_id])
os.mkdir('MNIST_mobile_zip')
for worker in client_list:
filetrain = 'MNIST_mobile/{}/train/train.json'.format(worker.client_id)
os.makedirs(os.path.dirname(filetrain), mode=0o770, exist_ok=True)
filetest = 'MNIST_mobile/{}/test/test.json'.format(worker.client_id)
os.makedirs(os.path.dirname(filetest), mode=0o770, exist_ok=True)
new_train['num_samples'] = [train_num_samples[i] for i in tuple(worker.client_sample_list)]
new_train['users'] = [users[i] for i in tuple(worker.client_sample_list)]
client_sample = new_train['users']
new_train['user_data'] = {x: train_data[x] for x in client_sample}
with open(filetrain, 'w') as fp:
json.dump(new_train, fp)
new_test['num_samples'] = [test_num_samples[i] for i in tuple(worker.client_sample_list)]
new_test['users'] = [users[i] for i in tuple(worker.client_sample_list)]
client_sample = new_test['users']
new_test['user_data'] = {x: test_data[x] for x in client_sample}
with open(filetest, 'w') as ff:
json.dump(new_test, ff)
shutil.make_archive('MNIST_mobile/{}'.format(worker.client_id), 'zip', 'MNIST_mobile', str(worker.client_id))
shutil.move('MNIST_mobile/{}.zip'.format(worker.client_id), 'MNIST_mobile_zip')
| 2,164 |
839 | <reponame>AnEmortalKid/cxf
/**
* 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.cxf.rs.security.jose.jwk;
public enum PublicKeyUse {
SIGN(JsonWebKey.PUBLIC_KEY_USE_SIGN),
ENCRYPT(JsonWebKey.PUBLIC_KEY_USE_ENCRYPT);
private final String use;
PublicKeyUse(String use) {
this.use = use;
}
public static PublicKeyUse getPublicKeyUse(String use) {
if (use == null) {
return null;
}
if (JsonWebKey.PUBLIC_KEY_USE_SIGN.equals(use)) {
return SIGN;
} else if (JsonWebKey.PUBLIC_KEY_USE_ENCRYPT.equals(use)) {
return ENCRYPT;
} else {
return valueOf(use);
}
}
public String toString() {
return use;
}
}
| 543 |
2,151 | // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/storage_monitor/storage_monitor_chromeos.h"
#include <utility>
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "base/strings/string16.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task_runner_util.h"
#include "base/task_scheduler/post_task.h"
#include "base/task_scheduler/task_traits.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "components/storage_monitor/media_storage_util.h"
#include "components/storage_monitor/mtp_manager_client_chromeos.h"
#include "components/storage_monitor/removable_device_constants.h"
#include "content/public/browser/browser_thread.h"
#include "services/device/public/mojom/constants.mojom.h"
#include "services/service_manager/public/cpp/connector.h"
using chromeos::disks::DiskMountManager;
namespace storage_monitor {
namespace {
// Constructs a device id using uuid or manufacturer (vendor and product) id
// details.
std::string MakeDeviceUniqueId(const DiskMountManager::Disk& disk) {
std::string uuid = disk.fs_uuid();
if (!uuid.empty())
return kFSUniqueIdPrefix + uuid;
// If one of the vendor or product information is missing, its value in the
// string is empty.
// Format: VendorModelSerial:VendorInfo:ModelInfo:SerialInfo
// TODO(kmadhusu) Extract serial information for the disks and append it to
// the device unique id.
const std::string& vendor = disk.vendor_id();
const std::string& product = disk.product_id();
if (vendor.empty() && product.empty())
return std::string();
return kVendorModelSerialPrefix + vendor + ":" + product + ":";
}
// Returns whether the requested device is valid. On success |info| will contain
// device information.
bool GetDeviceInfo(const DiskMountManager::MountPointInfo& mount_info,
bool has_dcim,
StorageInfo* info) {
DCHECK(info);
std::string source_path = mount_info.source_path;
const DiskMountManager::Disk* disk =
DiskMountManager::GetInstance()->FindDiskBySourcePath(source_path);
if (!disk || disk->device_type() == chromeos::DEVICE_TYPE_UNKNOWN)
return false;
std::string unique_id = MakeDeviceUniqueId(*disk);
if (unique_id.empty())
return false;
StorageInfo::Type type = has_dcim ?
StorageInfo::REMOVABLE_MASS_STORAGE_WITH_DCIM :
StorageInfo::REMOVABLE_MASS_STORAGE_NO_DCIM;
*info = StorageInfo(
StorageInfo::MakeDeviceId(type, unique_id), mount_info.mount_path,
base::UTF8ToUTF16(disk->device_label()),
base::UTF8ToUTF16(disk->vendor_name()),
base::UTF8ToUTF16(disk->product_name()), disk->total_size_in_bytes());
return true;
}
// Returns whether the requested device is valid. On success |info| will contain
// fixed storage device information.
bool GetFixedStorageInfo(const DiskMountManager::Disk& disk,
StorageInfo* info) {
DCHECK(info);
std::string unique_id = MakeDeviceUniqueId(disk);
if (unique_id.empty())
return false;
*info = StorageInfo(
StorageInfo::MakeDeviceId(StorageInfo::FIXED_MASS_STORAGE, unique_id),
disk.mount_path(), base::UTF8ToUTF16(disk.device_label()),
base::UTF8ToUTF16(disk.vendor_name()),
base::UTF8ToUTF16(disk.product_name()), disk.total_size_in_bytes());
return true;
}
} // namespace
StorageMonitorCros::StorageMonitorCros() : weak_ptr_factory_(this) {}
StorageMonitorCros::~StorageMonitorCros() {
DiskMountManager* manager = DiskMountManager::GetInstance();
if (manager) {
manager->RemoveObserver(this);
}
}
void StorageMonitorCros::Init() {
DCHECK(DiskMountManager::GetInstance());
DiskMountManager::GetInstance()->AddObserver(this);
CheckExistingMountPoints();
// Tests may have already set a MTP manager.
if (!mtp_device_manager_) {
// Set up the connection with mojofied MtpManager.
DCHECK(GetConnector());
GetConnector()->BindInterface(device::mojom::kServiceName,
mojo::MakeRequest(&mtp_device_manager_));
}
// |mtp_manager_client_| needs to be initialized for both tests and
// production code, so keep it out of the if condition.
mtp_manager_client_ = std::make_unique<MtpManagerClientChromeOS>(
receiver(), mtp_device_manager_.get());
}
void StorageMonitorCros::CheckExistingMountPoints() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
for (const auto& it : DiskMountManager::GetInstance()->disks()) {
if (it.second->IsStatefulPartition()) {
AddFixedStorageDisk(*it.second);
break;
}
}
scoped_refptr<base::SequencedTaskRunner> blocking_task_runner =
base::CreateSequencedTaskRunnerWithTraits(
{base::MayBlock(), base::TaskPriority::BACKGROUND});
for (const auto& it : DiskMountManager::GetInstance()->mount_points()) {
base::PostTaskAndReplyWithResult(
blocking_task_runner.get(), FROM_HERE,
base::Bind(&MediaStorageUtil::HasDcim,
base::FilePath(it.second.mount_path)),
base::Bind(&StorageMonitorCros::AddMountedPath,
weak_ptr_factory_.GetWeakPtr(), it.second));
}
// Note: Relies on scheduled tasks on the |blocking_task_runner| being
// sequential. This block needs to follow the for loop, so that the DoNothing
// call on the |blocking_task_runner| happens after the scheduled metadata
// retrievals, meaning that the reply callback will then happen after all the
// AddMountedPath calls.
blocking_task_runner->PostTaskAndReply(
FROM_HERE, base::DoNothing(),
base::Bind(&StorageMonitorCros::MarkInitialized,
weak_ptr_factory_.GetWeakPtr()));
}
void StorageMonitorCros::OnAutoMountableDiskEvent(
DiskMountManager::DiskEvent event,
const DiskMountManager::Disk& disk) {}
void StorageMonitorCros::OnBootDeviceDiskEvent(
DiskMountManager::DiskEvent event,
const DiskMountManager::Disk& disk) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (!disk.IsStatefulPartition())
return;
switch (event) {
case DiskMountManager::DiskEvent::DISK_ADDED: {
AddFixedStorageDisk(disk);
break;
}
case DiskMountManager::DiskEvent::DISK_REMOVED: {
RemoveFixedStorageDisk(disk);
break;
}
case DiskMountManager::DiskEvent::DISK_CHANGED: {
NOTREACHED() << "DiskMountManager::DiskEvent::DISK_CHANGED should not "
"occur for disks on boot device";
break;
}
}
}
void StorageMonitorCros::OnDeviceEvent(DiskMountManager::DeviceEvent event,
const std::string& device_path) {}
void StorageMonitorCros::OnMountEvent(
DiskMountManager::MountEvent event,
chromeos::MountError error_code,
const DiskMountManager::MountPointInfo& mount_info) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
// Ignore mount points that are not devices.
if (mount_info.mount_type != chromeos::MOUNT_TYPE_DEVICE)
return;
// Ignore errors.
if (error_code != chromeos::MOUNT_ERROR_NONE)
return;
if (mount_info.mount_condition != chromeos::disks::MOUNT_CONDITION_NONE)
return;
switch (event) {
case DiskMountManager::MOUNTING: {
if (base::ContainsKey(mount_map_, mount_info.mount_path)) {
NOTREACHED();
return;
}
base::PostTaskWithTraitsAndReplyWithResult(
FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND},
base::Bind(&MediaStorageUtil::HasDcim,
base::FilePath(mount_info.mount_path)),
base::Bind(&StorageMonitorCros::AddMountedPath,
weak_ptr_factory_.GetWeakPtr(), mount_info));
break;
}
case DiskMountManager::UNMOUNTING: {
MountMap::iterator it = mount_map_.find(mount_info.mount_path);
if (it == mount_map_.end())
return;
receiver()->ProcessDetach(it->second.device_id());
mount_map_.erase(it);
break;
}
}
}
void StorageMonitorCros::OnFormatEvent(DiskMountManager::FormatEvent event,
chromeos::FormatError error_code,
const std::string& device_path) {}
void StorageMonitorCros::OnRenameEvent(DiskMountManager::RenameEvent event,
chromeos::RenameError error_code,
const std::string& device_path) {}
void StorageMonitorCros::SetMediaTransferProtocolManagerForTest(
device::mojom::MtpManagerPtr test_manager) {
DCHECK(!mtp_device_manager_);
mtp_device_manager_ = std::move(test_manager);
}
bool StorageMonitorCros::GetStorageInfoForPath(
const base::FilePath& path,
StorageInfo* device_info) const {
DCHECK(device_info);
if (mtp_manager_client_->GetStorageInfoForPath(path, device_info)) {
return true;
}
if (!path.IsAbsolute())
return false;
base::FilePath current = path;
while (!base::ContainsKey(mount_map_, current.value()) &&
current != current.DirName()) {
current = current.DirName();
}
MountMap::const_iterator info_it = mount_map_.find(current.value());
if (info_it == mount_map_.end())
return false;
*device_info = info_it->second;
return true;
}
// Callback executed when the unmount call is run by DiskMountManager.
// Forwards result to |EjectDevice| caller.
void NotifyUnmountResult(
base::Callback<void(StorageMonitor::EjectStatus)> callback,
chromeos::MountError error_code) {
if (error_code == chromeos::MOUNT_ERROR_NONE)
callback.Run(StorageMonitor::EJECT_OK);
else
callback.Run(StorageMonitor::EJECT_FAILURE);
}
void StorageMonitorCros::EjectDevice(
const std::string& device_id,
base::Callback<void(EjectStatus)> callback) {
StorageInfo::Type type;
if (!StorageInfo::CrackDeviceId(device_id, &type, NULL)) {
callback.Run(EJECT_FAILURE);
return;
}
if (type == StorageInfo::MTP_OR_PTP) {
mtp_manager_client_->EjectDevice(device_id, callback);
return;
}
std::string mount_path;
for (MountMap::const_iterator info_it = mount_map_.begin();
info_it != mount_map_.end(); ++info_it) {
if (info_it->second.device_id() == device_id)
mount_path = info_it->first;
}
if (mount_path.empty()) {
callback.Run(EJECT_NO_SUCH_DEVICE);
return;
}
DiskMountManager* manager = DiskMountManager::GetInstance();
if (!manager) {
callback.Run(EJECT_FAILURE);
return;
}
manager->UnmountPath(mount_path, chromeos::UNMOUNT_OPTIONS_NONE,
base::Bind(NotifyUnmountResult, callback));
}
device::mojom::MtpManager*
StorageMonitorCros::media_transfer_protocol_manager() {
return mtp_device_manager_.get();
}
void StorageMonitorCros::AddMountedPath(
const DiskMountManager::MountPointInfo& mount_info,
bool has_dcim) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (base::ContainsKey(mount_map_, mount_info.mount_path)) {
// CheckExistingMountPoints() added the mount point information in the map
// before the device attached handler is called. Therefore, an entry for
// the device already exists in the map.
return;
}
// Get the media device uuid and label if exists.
StorageInfo info;
if (!GetDeviceInfo(mount_info, has_dcim, &info))
return;
if (info.device_id().empty())
return;
mount_map_.insert(std::make_pair(mount_info.mount_path, info));
receiver()->ProcessAttach(info);
}
void StorageMonitorCros::AddFixedStorageDisk(
const DiskMountManager::Disk& disk) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(disk.IsStatefulPartition());
StorageInfo info;
if (!GetFixedStorageInfo(disk, &info))
return;
if (base::ContainsKey(mount_map_, disk.mount_path()))
return;
mount_map_.insert(std::make_pair(disk.mount_path(), info));
receiver()->ProcessAttach(info);
}
void StorageMonitorCros::RemoveFixedStorageDisk(
const DiskMountManager::Disk& disk) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(disk.IsStatefulPartition());
StorageInfo info;
if (!GetFixedStorageInfo(disk, &info))
return;
size_t erased_count = mount_map_.erase(disk.mount_path());
if (!erased_count)
return;
receiver()->ProcessDetach((info.device_id()));
}
StorageMonitor* StorageMonitor::CreateInternal() {
return new StorageMonitorCros();
}
} // namespace storage_monitor
| 4,699 |
471 | <filename>corehq/apps/userreports/tests/test_static_data_sources.py
import os
import uuid
from collections import Counter
from django.test import SimpleTestCase
from django.test.utils import override_settings
from mock import MagicMock, patch
from corehq.apps.userreports.models import (
DataSourceConfiguration,
StaticDataSourceConfiguration,
)
from corehq.apps.userreports.tests.utils import domain_lite
from corehq.util.test_utils import TestFileMixin, timelimit
@patch('corehq.apps.callcenter.data_source.get_call_center_domains', MagicMock(return_value=[domain_lite('cc1')]))
class TestStaticDataSource(SimpleTestCase, TestFileMixin):
file_path = ('data', 'static_data_sources')
root = os.path.dirname(__file__)
def test_wrap(self):
wrapped = StaticDataSourceConfiguration.wrap(self.get_json('sample_static_data_source'))
self.assertEqual(["example", "dimagi"], wrapped.domains)
def test_get_all(self):
path = self.get_path('sample_static_data_source', 'json')
with patch("corehq.apps.userreports.models.static_ucr_data_source_paths", return_value=[path]), \
override_settings(STATIC_DATA_SOURCES=[path]):
all = list(StaticDataSourceConfiguration.all())
self.assertEqual(4 + 3, len(all))
example, dimagi, example1, dimagi1 = all[:4]
self.assertEqual('example', example.domain)
self.assertEqual('example', example1.domain)
self.assertEqual('dimagi', dimagi.domain)
self.assertEqual('dimagi', dimagi1.domain)
for config in all[:4]:
self.assertEqual('all_candidates', config.table_id)
for config in all[4:]:
self.assertEqual('cc1', config.domain)
def test_is_static_positive_json(self):
with override_settings(STATIC_DATA_SOURCES=[self.get_path('sample_static_data_source', 'json')]):
example = list(StaticDataSourceConfiguration.all())[0]
self.assertTrue(example.is_static)
def test_is_static_positive_yaml(self):
with override_settings(STATIC_DATA_SOURCES=[self.get_path('sample_static_data_source', 'yaml')]):
example = list(StaticDataSourceConfiguration.all())[0]
self.assertTrue(example.is_static)
def test_is_static_negative(self):
self.assertFalse(DataSourceConfiguration().is_static)
self.assertFalse(DataSourceConfiguration(_id=uuid.uuid4().hex).is_static)
def test_deactivate_noop(self):
with override_settings(STATIC_DATA_SOURCES=[self.get_path('sample_static_data_source', 'json')]):
example = list(StaticDataSourceConfiguration.all())[0]
# since this is a SimpleTest, this should fail if the call actually hits the DB
example.deactivate()
@timelimit(60)
def test_production_config(self):
for data_source in StaticDataSourceConfiguration.all():
data_source.validate()
def test_for_table_id_conflicts(self):
counts = Counter((ds.table_id, ds.domain) for ds in
StaticDataSourceConfiguration.all())
duplicates = [k for k, v in counts.items() if v > 1]
msg = "The following data source configs have duplicate table_ids on the same domains:\n{}".format(
"\n".join("table_id: {}, domain: {}".format(table_id, domain) for table_id, domain in duplicates)
)
self.assertEqual(0, len(duplicates), msg)
| 1,396 |
599 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://opensource.org/licenses/MIT
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.
"""
from backend.templatesets.legacy_apps.instance.resources import BCSResource, utils
class Pod(BCSResource):
def _strategy_params_to_int(self, roll_update_strategy, resource_name, metadata_name, is_preview, is_validate):
strategy_params = ['maxUnavailable', 'maxSurge']
for p in strategy_params:
roll_update_strategy[p] = utils.handle_number_var(
roll_update_strategy[p], f'{resource_name}[{metadata_name}]{p}', is_preview, is_validate
)
def set_base_spec(self, spec, resource_name, metadata_name, is_preview, is_validate):
# 处理minReadySeconds
min_readys = 'minReadySeconds'
if min_readys in spec:
spec[min_readys] = utils.handle_number_var(
spec[min_readys], f'{resource_name}[{metadata_name}]{min_readys}', is_preview, is_validate
)
def set_strategy(self, strategy, resource_name, metadata_name, is_preview, is_validate):
if strategy.get('type') == 'Recreate':
if 'rollingUpdate' in strategy:
del strategy['rollingUpdate']
return
self._strategy_params_to_int(strategy['rollingUpdate'], resource_name, metadata_name, is_preview, is_validate)
| 742 |
589 | <reponame>ClaudioWaldvogel/inspectIT
package rocks.inspectit.agent.java.sensor.platform;
import rocks.inspectit.agent.java.sensor.ISensor;
import rocks.inspectit.shared.all.communication.SystemSensorData;
import rocks.inspectit.shared.all.instrumentation.config.impl.PlatformSensorTypeConfig;
/**
* This interface is implemented by classes which provide information about the system, like CPU,
* Memory etc.
*
* @author <NAME>
* @author <NAME> (NovaTec Consulting GmbH)
*/
public interface IPlatformSensor extends ISensor {
/**
* Returns the {@link PlatformSensorTypeConfig} for this sensor.
*
* @return Returns the {@link PlatformSensorTypeConfig} for this sensor.
*/
@Override
PlatformSensorTypeConfig getSensorTypeConfig();
/**
* Reset any saved state in the sensor. Used to reset the sensor data collector class.
*/
void reset();
/**
* This method is called whenever the sensor should be updated.
*/
void gather();
/**
* Get the corresponding collector class of type {@link SystemSensorData}.
*
* @return the collector class.
*/
SystemSensorData get();
}
| 320 |
496 | # Generated by Django 3.1 on 2020-11-15 09:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('posts', '0015_auto_20201019_2128'),
]
operations = [
migrations.RemoveField(
model_name='historicalpost',
name='published_at',
),
migrations.AddField(
model_name='post',
name='hotness',
field=models.IntegerField(db_index=True, default=0),
),
migrations.AlterField(
model_name='historicalpost',
name='type',
field=models.CharField(choices=[('post', 'Текст'), ('intro', '#intro'), ('link', 'Ссылка'), ('question', 'Вопрос'), ('pain', 'Боль'), ('idea', 'Идея'), ('project', 'Проект'), ('event', 'Событие'), ('referral', 'Рефералка'), ('battle', 'Батл'), ('weekly_digest', 'Журнал Клуба')], db_index=True, default='post', max_length=32),
),
migrations.AlterField(
model_name='post',
name='type',
field=models.CharField(choices=[('post', 'Текст'), ('intro', '#intro'), ('link', 'Ссылка'), ('question', 'Вопрос'), ('pain', 'Боль'), ('idea', 'Идея'), ('project', 'Проект'), ('event', 'Событие'), ('referral', 'Рефералка'), ('battle', 'Батл'), ('weekly_digest', 'Журнал Клуба')], db_index=True, default='post', max_length=32),
),
]
| 714 |
335 | <filename>F/Financial_noun.json
{
"word": "Financial",
"definitions": [
"The finances or financial situation of an organization or individual.",
"Shares in financial companies."
],
"parts-of-speech": "Noun"
} | 88 |
380 | <filename>geetest_crack/utils/captcha.py
from PIL import Image
def crop_image(img: Image, x, y, width, height):
"""裁剪图片"""
return img.crop((x, int(y), int(x + width), int(y + height)))
def paste_image(new_img: Image, img: Image, x, y, width, height):
"""粘贴图片到new_img中"""
new_img.paste(img, (x, int(y), int(x + width), int(y + height)))
def restore_image(img: Image):
"""还原打乱的验证码图片"""
img_list = [39, 38, 48, 49, 41, 40, 46, 47, 35, 34, 50, 51, 33, 32, 28, 29, 27, 26, 36, 37, 31, 30, 44, 45, 43,
42, 12, 13, 23, 22, 14, 15, 21, 20, 8, 9, 25, 24, 6, 7, 3, 2, 0, 1, 11, 10, 4, 5, 19, 18, 16, 17]
r = 312 # width
n = 160 # height
s = n / 2
u = 10
new_img = Image.new("RGBA", (r, n))
for c in range(52):
f = img_list[c] % 26 * 12 + 1
_ = s if img_list[c] > 25 else 0
crop_img = crop_image(img, f, _, u, s)
paste_image(new_img, crop_img, c % 26 * 10, s if c > 25 else 0, u, s)
return new_img
def compare_pixel(pix1, pix2, x, y):
"""像素对比, (R, G, B, A) ,判断像素差异是否过大"""
diff_max = 50
diff_r = abs(pix1[x, y][0] - pix2[x, y][0])
diff_g = abs(pix1[x, y][1] - pix2[x, y][1])
diff_b = abs(pix1[x, y][2] - pix2[x, y][2])
return diff_r > diff_max and diff_g > diff_max and diff_b > diff_max
def calculate_offset(img1: Image, img2: Image):
"""计算偏移量"""
img1 = restore_image(img1)
img2 = restore_image(img2)
pix1 = img1.load()
pix2 = img2.load()
idx_x = []
for x in range(img1.size[0]):
for y in range(img1.size[1]):
if compare_pixel(pix1, pix2, x, y):
idx_x.append(x)
return sorted(idx_x)[0] - 3
| 919 |
1,511 | <filename>tests/cluecode/data/ics/dbus-dbus/dbus-marshal-basic.c
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-marshal-basic.c Marshalling routines for basic (primitive) types
*
* Copyright (C) 2002 CodeFactory AB
* Copyright (C) 2003, 2004, 2005 Red Hat, Inc.
*
* Licensed under the Academic Free License version 2.1 | 125 |
602 | package io.stargate.it.storage;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.junit.jupiter.api.extension.ExtendWith;
/**
* Annotates a test class or method to check whether the current running persistence backend is
* using DSE.
*
* <p>The test/suite is skipped if the persistence backend is not running DSE.
*
* @see IsDseCondition
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
@ExtendWith(IsDseCondition.class)
public @interface SkipWhenNotDse {}
| 194 |
6,098 | package water.test.dummy;
import water.Iced;
public abstract class DummyAction<T> extends Iced<DummyAction<T>> {
protected abstract String run(DummyModelParameters parms);
protected void cleanUp() {};
}
| 64 |
679 | <reponame>Grosskopf/openoffice
/**************************************************************
*
* 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.
*
*************************************************************/
#ifndef _XMLOFF_TRANSFORMERCONTEXT_HXX
#define _XMLOFF_TRANSFORMERCONTEXT_HXX
#include <com/sun/star/xml/sax/XAttributeList.hpp>
#include <tools/solar.h>
#include <salhelper/simplereferenceobject.hxx>
#include <rtl/ustring.hxx>
#include <tools/rtti.hxx>
#include <xmloff/xmltoken.hxx>
class SvXMLNamespaceMap;
class XMLTransformerBase;
class XMLTransformerContext : public ::salhelper::SimpleReferenceObject
{
friend class XMLTransformerBase;
XMLTransformerBase& m_rTransformer;
::rtl::OUString m_aQName;
SvXMLNamespaceMap *m_pRewindMap;
SvXMLNamespaceMap *GetRewindMap() const { return m_pRewindMap; }
void SetRewindMap( SvXMLNamespaceMap *p ) { m_pRewindMap = p; }
protected:
XMLTransformerBase& GetTransformer() { return m_rTransformer; }
const XMLTransformerBase& GetTransformer() const { return m_rTransformer; }
void SetQName( const ::rtl::OUString& rQName ) { m_aQName = rQName; }
public:
TYPEINFO();
const ::rtl::OUString& GetQName() const { return m_aQName; }
sal_Bool HasQName( sal_uInt16 nPrefix,
::xmloff::token::XMLTokenEnum eToken ) const;
sal_Bool HasNamespace( sal_uInt16 nPrefix ) const;
// A contexts constructor does anything that is required if an element
// starts. Namespace processing has been done already.
// Note that virtual methods cannot be used inside constructors. Use
// StartElement instead if this is required.
XMLTransformerContext( XMLTransformerBase& rTransformer,
const ::rtl::OUString& rQName );
// A contexts destructor does anything that is required if an element
// ends. By default, nothing is done.
// Note that virtual methods cannot be used inside destructors. Use
// EndElement instead if this is required.
virtual ~XMLTransformerContext();
// Create a childs element context. By default, the import's
// CreateContext method is called to create a new default context.
virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
const ::rtl::OUString& rLocalName,
const ::rtl::OUString& rQName,
const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
// StartElement is called after a context has been constructed and
// before a elements context is parsed. It may be used for actions that
// require virtual methods. The default is to do nothing.
virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
// EndElement is called before a context will be destructed, but
// after a elements context has been parsed. It may be used for actions
// that require virtual methods. The default is to do nothing.
virtual void EndElement();
// This method is called for all characters that are contained in the
// current element. The default is to ignore them.
virtual void Characters( const ::rtl::OUString& rChars );
// Is the current context a persistent one (i.e. one that saves is content
// rather than exporting it directly?
virtual sal_Bool IsPersistent() const;
// Export the whole element. By default, nothing is done here
virtual void Export();
// Export the element content. By default, nothing is done here
virtual void ExportContent();
};
#endif // _XMLOFF_TRANSFORMERCONTEXT_HXX
| 1,267 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.