repo_name
stringlengths 6
101
| path
stringlengths 4
300
| text
stringlengths 7
1.31M
|
|---|---|---|
Shashi-rk/azure-sdk-for-java
|
sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/models/VpnSiteLinkProperties.java
|
<filename>sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/models/VpnSiteLinkProperties.java<gh_stars>1000+
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.network.fluent.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.network.models.ProvisioningState;
import com.azure.resourcemanager.network.models.VpnLinkBgpSettings;
import com.azure.resourcemanager.network.models.VpnLinkProviderProperties;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
/** Parameters for VpnSite. */
@Fluent
public final class VpnSiteLinkProperties {
@JsonIgnore private final ClientLogger logger = new ClientLogger(VpnSiteLinkProperties.class);
/*
* The link provider properties.
*/
@JsonProperty(value = "linkProperties")
private VpnLinkProviderProperties linkProperties;
/*
* The ip-address for the vpn-site-link.
*/
@JsonProperty(value = "ipAddress")
private String ipAddress;
/*
* FQDN of vpn-site-link.
*/
@JsonProperty(value = "fqdn")
private String fqdn;
/*
* The set of bgp properties.
*/
@JsonProperty(value = "bgpProperties")
private VpnLinkBgpSettings bgpProperties;
/*
* The provisioning state of the VPN site link resource.
*/
@JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
private ProvisioningState provisioningState;
/**
* Get the linkProperties property: The link provider properties.
*
* @return the linkProperties value.
*/
public VpnLinkProviderProperties linkProperties() {
return this.linkProperties;
}
/**
* Set the linkProperties property: The link provider properties.
*
* @param linkProperties the linkProperties value to set.
* @return the VpnSiteLinkProperties object itself.
*/
public VpnSiteLinkProperties withLinkProperties(VpnLinkProviderProperties linkProperties) {
this.linkProperties = linkProperties;
return this;
}
/**
* Get the ipAddress property: The ip-address for the vpn-site-link.
*
* @return the ipAddress value.
*/
public String ipAddress() {
return this.ipAddress;
}
/**
* Set the ipAddress property: The ip-address for the vpn-site-link.
*
* @param ipAddress the ipAddress value to set.
* @return the VpnSiteLinkProperties object itself.
*/
public VpnSiteLinkProperties withIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
return this;
}
/**
* Get the fqdn property: FQDN of vpn-site-link.
*
* @return the fqdn value.
*/
public String fqdn() {
return this.fqdn;
}
/**
* Set the fqdn property: FQDN of vpn-site-link.
*
* @param fqdn the fqdn value to set.
* @return the VpnSiteLinkProperties object itself.
*/
public VpnSiteLinkProperties withFqdn(String fqdn) {
this.fqdn = fqdn;
return this;
}
/**
* Get the bgpProperties property: The set of bgp properties.
*
* @return the bgpProperties value.
*/
public VpnLinkBgpSettings bgpProperties() {
return this.bgpProperties;
}
/**
* Set the bgpProperties property: The set of bgp properties.
*
* @param bgpProperties the bgpProperties value to set.
* @return the VpnSiteLinkProperties object itself.
*/
public VpnSiteLinkProperties withBgpProperties(VpnLinkBgpSettings bgpProperties) {
this.bgpProperties = bgpProperties;
return this;
}
/**
* Get the provisioningState property: The provisioning state of the VPN site link resource.
*
* @return the provisioningState value.
*/
public ProvisioningState provisioningState() {
return this.provisioningState;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (linkProperties() != null) {
linkProperties().validate();
}
if (bgpProperties() != null) {
bgpProperties().validate();
}
}
}
|
3PillarGlobal/hailstorm-sdk
|
hailstorm-api/app/api/jmeter_plans.rb
|
<filename>hailstorm-api/app/api/jmeter_plans.rb
# frozen_string_literal: true
require 'sinatra'
require 'json'
require 'hailstorm/model/project'
require 'hailstorm/support/configuration'
require 'model/project_configuration'
require 'helpers/jmeter_helper'
include JMeterHelper
get '/projects/:project_id/jmeter_plans' do |project_id|
project_config = ProjectConfiguration.where(project_id: project_id).first
return JSON.dump([]) unless project_config
# @type [Hailstorm::Support::Configuration]
hailstorm_config = deep_decode(project_config.stringified_config)
test_plans_attrs = hailstorm_config.jmeter.all_test_plans_attrs
data_files_attrs = (hailstorm_config.jmeter.data_files || []).map { |e| { test_plan_name: e, jmx_file: false } }
files_attrs = test_plans_attrs + data_files_attrs
data_attrs = files_attrs.map do |partial_attrs|
deep_camelize_keys(to_jmeter_attributes(hailstorm_config, project_id, partial_attrs))
end
JSON.dump(data_attrs)
end
post '/projects/:project_id/jmeter_plans' do |project_id|
found_project = Hailstorm::Model::Project.find(project_id)
request.body.rewind
jmeter_plan = deep_camelize_keys(configure_jmeter(found_project, request))
JSON.dump(jmeter_plan)
end
patch '/projects/:project_id/jmeter_plans/:id' do |project_id, id|
project_config = ProjectConfiguration.where(project_id: project_id).first
return not_found unless project_config
request.body.rewind
# @type [Hash]
data = JSON.parse(request.body.read)
hailstorm_config = deep_decode(project_config.stringified_config)
test_plan_name = hailstorm_config.jmeter.test_plans.find { |e| e.to_java_string.hash_code == id.to_i }
return not_found unless test_plan_name
hailstorm_config
.jmeter
.properties(test_plan: test_plan_name) { |map| update_map(map, data) } unless data['properties'].blank?
handle_disabled(data, hailstorm_config, test_plan_name)
project_config.update!(stringified_config: deep_encode(hailstorm_config))
resp = deep_camelize_keys(build_patch_response(hailstorm_config, test_plan_name, project_id))
JSON.dump(resp)
end
delete '/projects/:project_id/jmeter_plans/:id' do |project_id, id|
project_config = ProjectConfiguration.where(project_id: project_id).first
return not_found unless project_config
hailstorm_config = deep_decode(project_config.stringified_config)
unless hailstorm_config.jmeter.test_plans.blank?
test_plan_name = hailstorm_config.jmeter.test_plans.find { |e| e.to_java_string.hash_code == id.to_i }
if test_plan_name
return 402 if client_stats?(project_id, File.basename(test_plan_name))
hailstorm_config.jmeter.test_plans.reject! { |e| e == test_plan_name }
end
end
unless hailstorm_config.jmeter.data_files.blank?
data_file_name = hailstorm_config.jmeter.data_files.find { |e| e.to_java_string.hash_code == id.to_i }
hailstorm_config.jmeter.data_files.reject! { |e| e == data_file_name } if data_file_name
end
project_config.update!(stringified_config: deep_encode(hailstorm_config))
204
end
|
midnightbr/Faculdade
|
java/JARS/hibernate-release-5.6.0.Final/project/hibernate-core/src/test/java/org/hibernate/test/jpa/ql/MapIssueTest.java
|
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.test.jpa.ql;
import org.hibernate.Session;
import org.hibernate.dialect.PostgreSQL81Dialect;
import org.hibernate.test.jpa.AbstractJPATest;
import org.hibernate.test.jpa.MapContent;
import org.hibernate.test.jpa.MapOwner;
import org.hibernate.test.jpa.Relationship;
import org.hibernate.testing.RequiresDialect;
import org.hibernate.testing.TestForIssue;
import org.junit.Test;
@TestForIssue(jiraKey = "HHH-14279")
public class MapIssueTest extends AbstractJPATest {
@Override
public String[] getMappings() {
return new String[] {};
}
protected Class<?>[] getAnnotatedClasses() {
return new Class[] { MapOwner.class, MapContent.class, Relationship.class};
}
@Test
@RequiresDialect(value = PostgreSQL81Dialect.class, comment = "Requires support for using a correlated column in a join condition which H2 apparently does not support.")
public void testWhereSubqueryMapKeyIsEntityWhereWithKey() {
Session s = openSession();
s.beginTransaction();
s.createQuery( "select r from Relationship r where exists (select 1 from MapOwner as o left join o.contents c with key(c) = r)" ).list();
s.getTransaction().commit();
s.close();
}
@Test
public void testMapKeyIsEntityWhereWithKey() {
Session s = openSession();
s.beginTransaction();
s.createQuery( "select 1 from MapOwner as o left join o.contents c where c.id is not null" ).list();
s.getTransaction().commit();
s.close();
}
}
|
fanmeijian/sparrow
|
sparrow-permission-model/src/main/java/cn/sparrow/permission/model/organization/EmployeeOrganizationRolePK.java
|
<reponame>fanmeijian/sparrow
package cn.sparrow.permission.model.organization;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Embeddable
@Data
@NoArgsConstructor
@AllArgsConstructor
public class EmployeeOrganizationRolePK implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private OrganizationRolePK organizationRoleId;
@Column(name = "employee_id")
private String employeeId;
}
|
heriipurnama/smart-depo
|
src/modules/modul/ModulController.js
|
<reponame>heriipurnama/smart-depo<filename>src/modules/modul/ModulController.js<gh_stars>1-10
"use strict";
const baseResponse = require("../../utils/helper/Response");
const { tblmodules } = require("../../db/models");
const Logger = require("../../utils/helper/logger");
class ModulController {
static async createNew(req, res, next) {
// let { parent, modvar, name, desc, modstatus, modurl, has_view,printpdf } = req.body;
try {
const payload = await tblmodules.create({
// defaults: {
module_parent: req.body.module_parent,
module_var: req.body.module_var,
module_name: req.body.module_name,
module_description: req.body.module_description,
module_status: req.body.module_status,
module_url: req.body.module_url,
module_config: req.body.module_config,
module_icon: req.body.module_icon,
sort_index: req.body.sort_index,
module_content: req.body.module_content,
module_type: req.body.module_type
// }
});
if(!payload){
throw new Error("Create Modul Failed");
} else {
baseResponse({ message:"Modul Created " , data: payload})(res, 200);
Logger(req);
}
} catch (error) {
res.status(400);
next(error);
}
}
static async update(req, res, next) {
let { id } = req.body;
let dataUpdate = {
module_parent: req.body.module_parent,
module_var: req.body.module_var,
module_name: req.body.module_name,
module_description: req.body.module_description,
module_status: req.body.module_status,
module_url: req.body.module_url,
module_config: req.body.module_config,
module_icon: req.body.module_icon,
sort_index: req.body.sort_index,
module_content: req.body.module_content,
module_type: req.body.module_type
};
let selector = {
where: { module_id: id }
};
try {
let dataModul = await tblmodules.update(dataUpdate, selector);
if (!dataModul) {
throw new Error("Update Data Failed");
}
baseResponse({
message: "Update Success",
data: dataModul,
})(res, 200);
Logger(req);
} catch (error) {
res.status(403);
next(error);
}
}
static async listOne(req, res, next) {
let { id } = req.body;
try {
let dataModul = await tblmodules.findOne({
where: {
module_id: id
}
});
if (!dataModul) {
throw new Error(`modul id: ${id} doesn't exists!`);
}
baseResponse({
message: "Get Data Success",
data: dataModul,
})(res, 200);
} catch (error) {
res.status(403);
next(error);
}
}
static async list(req, res, next) {
let { start, rows} = req.body;
try {
let { count, rows: datas } = await tblmodules.findAndCountAll({
offset: start,
limit: rows
});
baseResponse({ message: "List Modul", data: { datas, count } })(res, 200);
} catch (error) {
res.status(403);
next(error);
}
}
static async delete(req, res, next) {
let {id} = req.body;
try {
let payload = await tblmodules.destroy({
where:{module_id: id}
});
baseResponse({ message: "Success Delete Modul", data: payload })(res, 200);
Logger(req);
} catch (error) {
res.status(403);
next(error);
}
}
}
module.exports = ModulController;
|
JaneMandy/CS
|
org/apache/fop/Version.java
|
<reponame>JaneMandy/CS<gh_stars>1-10
package org.apache.fop;
public final class Version {
private Version() {
}
public static String getVersion() {
String version = null;
Package jarinfo = Version.class.getPackage();
if (jarinfo != null) {
version = jarinfo.getImplementationVersion();
}
if (version == null) {
String headURL = "$HeadURL: https://svn.apache.org/repos/asf/xmlgraphics/fop/tags/fop-1_0/src/java/org/apache/fop/Version.java $";
String pathPrefix = "/xmlgraphics/fop/";
int pos = headURL.indexOf("/xmlgraphics/fop/");
if (pos >= 0) {
version = headURL.substring(pos + "/xmlgraphics/fop/".length() - 1, headURL.length() - 2);
pos = version.indexOf("/src/");
version = version.substring(1, pos);
version = " " + version;
} else {
version = "";
}
version = "SVN" + version;
}
return version;
}
}
|
rhan1498/marine-integrations
|
mi/core/time.py
|
#!/usr/bin/env python
"""
@package mi.core.time
@file mi/core/time.py
@author <NAME>
@brief Common time functions for drivers
"""
# Needed because we import the time module below. With out this '.' is search first
# and we import ourselves.
from __future__ import absolute_import
__author__ = '<NAME>'
__license__ = 'Apache 2.0'
from mi.core.log import get_logger ; log = get_logger()
import datetime
import ntplib
import time
import re
from dateutil import parser
DATE_PATTERN = r'^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z?$'
DATE_MATCHER = re.compile(DATE_PATTERN)
def get_timestamp_delayed(format):
'''
Return a formatted date string of the current utc time,
but the string return is delayed until the next second
transition.
Formatting:
http://docs.python.org/library/time.html#time.strftime
@param format: strftime() format string
@return: formatted date string
@raise ValueError if format is None
'''
if(not format):
raise ValueError
result = None
now = datetime.datetime.utcnow()
# If we are too close to a second transition then sleep for a bit.
if(now.microsecond < 100000):
time.sleep(0.2)
now = datetime.datetime.utcnow()
current = datetime.datetime.utcnow()
while(current.microsecond > now.microsecond):
current = datetime.datetime.utcnow()
return time.strftime(format, time.gmtime())
def get_timestamp(format):
'''
Return a formatted date string of the current utc time.
Formatting:
http://docs.python.org/library/time.html#time.strftime
@param format: strftime() format string
@return: formatted date string
@raise ValueError if format is None
'''
if(not format):
raise ValueError
return time.strftime(format, time.gmtime())
def string_to_ntp_date_time(datestr):
"""
Extract an ntp date from a ISO8601 formatted date string.
@param str an ISO8601 formatted string containing date information
@retval an ntp date number (seconds since jan 1 1900)
@throws InstrumentParameterException if datestr cannot be formatted to
a date.
"""
if not isinstance(datestr, str):
raise IOError('Value %s is not a string.' % str(datestr))
if not DATE_MATCHER.match(datestr):
raise ValueError("date string not in ISO8601 format YYYY-MM-DDTHH:MM:SS.SSSSZ")
try:
# This assumes input date string are in UTC (=GMT)
if datestr[-1:] != 'Z':
datestr += 'Z'
# the parsed date time represents a GMT time, but strftime
# does not take timezone into account, so these are seconds from the
# local start of 1970
local_sec = float(parser.parse(datestr).strftime("%s.%f"))
# remove the local time zone to convert to gmt (seconds since gmt jan 1 1970)
gmt_sec = local_sec - time.timezone
# convert to ntp (seconds since gmt jan 1 1900)
timestamp = ntplib.system_to_ntp_time(gmt_sec)
except ValueError as e:
raise ValueError('Value %s could not be formatted to a date. %s' % (str(datestr), e))
log.debug("converting time string '%s', unix_ts: %s ntp: %s", datestr, gmt_sec, timestamp)
return timestamp
def time_to_ntp_date_time(unix_time=None):
"""
return an NTP timestamp. Currently this is a float, but should be a 64bit fixed point block.
TODO: Fix return value
@param unit_time: Unix time as returned from time.time()
"""
if unix_time is None:
unix_time = time.time()
timestamp = ntplib.system_to_ntp_time(unix_time)
return float(timestamp)
|
YujiaYan0709/botbuilder-java
|
libraries/bot-connector/src/main/java/com/microsoft/bot/restclient/credentials/BasicAuthenticationCredentialsInterceptor.java
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.microsoft.bot.restclient.credentials;
import com.google.common.io.BaseEncoding;
import java.nio.charset.StandardCharsets;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
import java.io.IOException;
/**
* Basic Auth credentials interceptor for placing a basic auth credential into request headers.
*/
final class BasicAuthenticationCredentialsInterceptor implements Interceptor {
/**
* The credentials instance to apply to the HTTP client pipeline.
*/
private final BasicAuthenticationCredentials credentials;
/**
* Initialize a BasicAuthenticationCredentialsFilter class with a
* BasicAuthenticationCredentials credential.
*
* @param withCredentials a BasicAuthenticationCredentials instance
*/
BasicAuthenticationCredentialsInterceptor(BasicAuthenticationCredentials withCredentials) {
this.credentials = withCredentials;
}
/**
* Handle OKHttp intercept.
* @param chain okhttp3 Chain
* @return okhttp3 Response
* @throws IOException IOException during http IO.
*/
@Override
public Response intercept(Chain chain) throws IOException {
String auth = credentials.getUserName() + ":" + credentials.getPassword();
auth = BaseEncoding.base64().encode(auth.getBytes(StandardCharsets.UTF_8));
Request newRequest = chain.request().newBuilder()
.header("Authorization", "Basic " + auth)
.build();
return chain.proceed(newRequest);
}
}
|
daodao10/chart
|
cn/SH000993_d.js
|
<filename>cn/SH000993_d.js
var data=[['20050104',996.870],
['20050105',1022.240],
['20050106',1014.440],
['20050107',1021.530],
['20050110',1033.130],
['20050111',1031.890],
['20050112',1025.380],
['20050113',1032.390],
['20050114',1013.250],
['20050117',991.110],
['20050118',1009.560],
['20050119',998.140],
['20050120',990.180],
['20050121',995.190],
['20050124',1018.840],
['20050125',1008.880],
['20050126',986.040],
['20050127',959.300],
['20050128',946.260],
['20050131',910.180],
['20050201',901.250],
['20050202',966.940],
['20050203',941.560],
['20050204',959.450],
['20050216',968.760],
['20050217',984.430],
['20050218',965.100],
['20050221',977.680],
['20050222',1007.830],
['20050223',1018.580],
['20050224',1031.860],
['20050225',1028.940],
['20050228',1025.300],
['20050301',1023.500],
['20050302',1002.640],
['20050303',1010.330],
['20050304',1001.580],
['20050307',1007.650],
['20050308',1033.190],
['20050309',1037.230],
['20050310',1007.210],
['20050311',1014.730],
['20050314',1004.020],
['20050315',984.710],
['20050316',975.100],
['20050317',962.420],
['20050318',935.160],
['20050321',933.290],
['20050322',899.250],
['20050323',898.400],
['20050324',903.020],
['20050325',896.490],
['20050328',887.170],
['20050329',875.810],
['20050330',855.330],
['20050331',863.320],
['20050401',897.440],
['20050404',869.750],
['20050405',855.860],
['20050406',861.660],
['20050407',883.470],
['20050408',906.980],
['20050411',915.430],
['20050412',883.080],
['20050413',906.420],
['20050414',886.580],
['20050415',861.450],
['20050418',847.680],
['20050419',852.370],
['20050420',820.080],
['20050421',790.670],
['20050422',788.320],
['20050425',770.020],
['20050426',788.990],
['20050427',761.990],
['20050428',781.420],
['20050429',762.840],
['20050509',744.490],
['20050510',749.620],
['20050511',757.390],
['20050512',754.050],
['20050513',767.550],
['20050516',756.200],
['20050517',763.620],
['20050518',771.750],
['20050519',767.860],
['20050520',754.840],
['20050523',734.140],
['20050524',756.990],
['20050525',757.840],
['20050526',752.690],
['20050527',745.570],
['20050530',751.050],
['20050531',746.890],
['20050601',728.190],
['20050602',723.700],
['20050603',713.770],
['20050606',725.850],
['20050607',732.930],
['20050608',791.060],
['20050609',808.560],
['20050610',792.410],
['20050613',790.100],
['20050614',778.450],
['20050615',755.680],
['20050616',761.050],
['20050617',750.930],
['20050620',779.910],
['20050621',768.310],
['20050622',772.470],
['20050623',757.670],
['20050624',760.410],
['20050627',784.530],
['20050628',764.840],
['20050629',762.590],
['20050630',740.750],
['20050701',703.150],
['20050704',690.570],
['20050705',682.950],
['20050706',678.370],
['20050707',681.450],
['20050708',653.560],
['20050711',648.310],
['20050712',680.270],
['20050713',679.330],
['20050714',685.000],
['20050715',662.960],
['20050718',651.650],
['20050719',656.830],
['20050720',657.410],
['20050721',661.290],
['20050722',675.510],
['20050725',668.720],
['20050726',688.320],
['20050727',709.490],
['20050728',701.190],
['20050729',701.710],
['20050801',705.070],
['20050802',718.420],
['20050803',725.970],
['20050804',722.670],
['20050805',747.130],
['20050808',761.060],
['20050809',781.380],
['20050810',786.530],
['20050811',788.900],
['20050812',778.330],
['20050815',803.240],
['20050816',799.630],
['20050817',815.840],
['20050818',787.560],
['20050819',799.200],
['20050822',804.330],
['20050823',787.010],
['20050824',797.860],
['20050825',811.040],
['20050826',812.940],
['20050829',797.960],
['20050830',792.680],
['20050831',807.630],
['20050901',824.040],
['20050902',834.010],
['20050905',849.120],
['20050906',820.060],
['20050907',834.220],
['20050908',832.200],
['20050909',823.160],
['20050912',823.620],
['20050913',842.850],
['20050914',857.190],
['20050915',856.080],
['20050916',851.530],
['20050919',863.460],
['20050920',852.980],
['20050921',840.700],
['20050922',817.840],
['20050923',797.400],
['20050926',801.750],
['20050927',786.000],
['20050928',779.720],
['20050929',791.810],
['20050930',786.020],
['20051010',763.530],
['20051011',784.400],
['20051012',787.190],
['20051013',789.900],
['20051014',786.700],
['20051017',790.170],
['20051018',803.200],
['20051019',799.710],
['20051020',792.340],
['20051021',800.820],
['20051024',806.780],
['20051025',788.550],
['20051026',765.850],
['20051027',760.670],
['20051028',746.560],
['20051031',749.170],
['20051101',745.900],
['20051102',760.920],
['20051103',752.870],
['20051104',756.010],
['20051107',763.340],
['20051108',767.650],
['20051109',763.960],
['20051110',742.840],
['20051111',746.880],
['20051114',748.340],
['20051115',736.670],
['20051116',745.420],
['20051117',745.660],
['20051118',765.720],
['20051121',766.850],
['20051122',750.030],
['20051123',755.670],
['20051124',760.000],
['20051125',757.810],
['20051128',756.810],
['20051129',743.930],
['20051130',745.990],
['20051201',743.240],
['20051202',735.580],
['20051205',718.110],
['20051206',721.440],
['20051207',727.360],
['20051208',725.030],
['20051209',739.380],
['20051212',743.080],
['20051213',744.070],
['20051214',754.500],
['20051215',745.750],
['20051216',752.980],
['20051219',751.130],
['20051220',755.250],
['20051221',747.520],
['20051222',750.770],
['20051223',759.540],
['20051226',768.920],
['20051227',769.530],
['20051228',772.190],
['20051229',786.370],
['20051230',782.890],
['20060104',800.180],
['20060105',811.550],
['20060106',824.530],
['20060109',838.030],
['20060110',845.380],
['20060111',841.220],
['20060112',870.900],
['20060113',873.140],
['20060116',857.900],
['20060117',858.450],
['20060118',884.590],
['20060119',889.580],
['20060120',895.840],
['20060123',902.880],
['20060124',906.050],
['20060125',894.250],
['20060206',907.290],
['20060207',901.380],
['20060208',903.970],
['20060209',891.140],
['20060210',906.450],
['20060213',897.300],
['20060214',905.820],
['20060215',905.050],
['20060216',884.790],
['20060217',875.480],
['20060220',864.140],
['20060221',886.070],
['20060222',880.200],
['20060223',876.640],
['20060224',883.020],
['20060227',880.540],
['20060228',886.580],
['20060301',896.730],
['20060302',876.380],
['20060303',873.490],
['20060306',862.140],
['20060307',838.050],
['20060308',838.670],
['20060309',824.040],
['20060310',830.930],
['20060313',835.300],
['20060314',835.890],
['20060315',847.720],
['20060316',846.720],
['20060317',845.170],
['20060320',855.510],
['20060321',860.850],
['20060322',869.110],
['20060323',874.990],
['20060324',861.950],
['20060327',868.840],
['20060328',870.720],
['20060329',874.750],
['20060330',866.000],
['20060331',871.890],
['20060403',882.410],
['20060404',898.070],
['20060405',908.280],
['20060406',920.830],
['20060407',941.430],
['20060410',960.100],
['20060411',956.790],
['20060412',950.790],
['20060413',924.330],
['20060414',941.180],
['20060417',951.880],
['20060418',947.530],
['20060419',950.520],
['20060420',942.930],
['20060421',953.720],
['20060424',951.630],
['20060425',953.730],
['20060426',965.210],
['20060427',970.670],
['20060428',977.430],
['20060508',1007.380],
['20060509',1037.820],
['20060510',1048.580],
['20060511',1029.280],
['20060512',1079.030],
['20060515',1138.840],
['20060516',1132.940],
['20060517',1138.840],
['20060518',1155.600],
['20060519',1178.600],
['20060522',1195.720],
['20060523',1127.470],
['20060524',1098.160],
['20060525',1110.140],
['20060526',1135.470],
['20060529',1165.680],
['20060530',1170.110],
['20060531',1153.170],
['20060601',1199.890],
['20060602',1215.030],
['20060605',1235.140],
['20060606',1226.340],
['20060607',1127.230],
['20060608',1122.170],
['20060609',1091.090],
['20060612',1096.060],
['20060613',1108.070],
['20060614',1095.520],
['20060615',1097.830],
['20060616',1129.630],
['20060619',1145.870],
['20060620',1153.050],
['20060621',1144.090],
['20060622',1138.970],
['20060623',1167.000],
['20060626',1194.540],
['20060627',1190.930],
['20060628',1190.410],
['20060629',1211.220],
['20060630',1206.100],
['20060703',1231.210],
['20060704',1222.030],
['20060705',1228.690],
['20060706',1264.190],
['20060707',1249.960],
['20060710',1250.120],
['20060711',1255.730],
['20060712',1245.950],
['20060713',1148.320],
['20060714',1159.290],
['20060717',1181.470],
['20060718',1201.400],
['20060719',1166.560],
['20060720',1174.300],
['20060721',1182.880],
['20060724',1184.530],
['20060725',1208.070],
['20060726',1219.930],
['20060727',1202.710],
['20060728',1184.920],
['20060731',1133.160],
['20060801',1123.930],
['20060802',1119.090],
['20060803',1115.220],
['20060804',1078.560],
['20060807',1053.600],
['20060808',1088.690],
['20060809',1089.730],
['20060810',1104.740],
['20060811',1109.520],
['20060814',1073.770],
['20060815',1094.310],
['20060816',1112.490],
['20060817',1100.120],
['20060818',1098.400],
['20060821',1107.730],
['20060822',1119.320],
['20060823',1117.940],
['20060824',1125.060],
['20060825',1129.680],
['20060828',1156.250],
['20060829',1166.770],
['20060830',1173.130],
['20060831',1176.220],
['20060901',1142.580],
['20060904',1166.790],
['20060905',1173.710],
['20060906',1183.480],
['20060907',1161.460],
['20060908',1160.440],
['20060911',1166.720],
['20060912',1177.090],
['20060913',1153.470],
['20060914',1160.470],
['20060915',1171.880],
['20060918',1193.140],
['20060919',1189.660],
['20060920',1188.000],
['20060921',1195.150],
['20060922',1182.400],
['20060925',1199.830],
['20060926',1186.650],
['20060927',1200.090],
['20060928',1217.110],
['20060929',1232.640],
['20061009',1251.700],
['20061010',1262.420],
['20061011',1252.220],
['20061012',1236.780],
['20061013',1239.420],
['20061016',1228.620],
['20061017',1220.370],
['20061018',1236.310],
['20061019',1235.360],
['20061020',1224.560],
['20061023',1182.460],
['20061024',1205.170],
['20061025',1206.820],
['20061026',1202.920],
['20061027',1188.170],
['20061030',1191.150],
['20061031',1196.250],
['20061101',1196.160],
['20061102',1192.410],
['20061103',1190.900],
['20061106',1186.750],
['20061107',1177.700],
['20061108',1175.480],
['20061109',1189.070],
['20061110',1152.050],
['20061113',1112.810],
['20061114',1133.310],
['20061115',1150.590],
['20061116',1134.050],
['20061117',1146.480],
['20061120',1138.440],
['20061121',1154.640],
['20061122',1170.540],
['20061123',1170.310],
['20061124',1186.270],
['20061127',1210.580],
['20061128',1217.140],
['20061129',1231.980],
['20061130',1244.900],
['20061201',1246.830],
['20061204',1273.910],
['20061205',1302.810],
['20061206',1303.470],
['20061207',1281.360],
['20061208',1211.110],
['20061211',1250.270],
['20061212',1243.050],
['20061213',1246.170],
['20061214',1270.750],
['20061215',1287.950],
['20061218',1306.270],
['20061219',1346.610],
['20061220',1354.540],
['20061221',1328.650],
['20061222',1317.280],
['20061225',1327.330],
['20061226',1317.130],
['20061227',1336.570],
['20061228',1317.410],
['20061229',1323.130],
['20070104',1321.440],
['20070105',1357.500],
['20070108',1422.130],
['20070109',1444.140],
['20070110',1487.810],
['20070111',1499.060],
['20070112',1441.410],
['20070115',1518.030],
['20070116',1554.030],
['20070117',1547.220],
['20070118',1613.240],
['20070119',1686.500],
['20070122',1794.040],
['20070123',1803.630],
['20070124',1806.630],
['20070125',1724.790],
['20070126',1742.750],
['20070129',1813.730],
['20070130',1794.080],
['20070131',1690.870],
['20070201',1712.060],
['20070202',1677.370],
['20070205',1709.890],
['20070206',1733.960],
['20070207',1789.970],
['20070208',1810.590],
['20070209',1798.440],
['20070212',1841.220],
['20070213',1865.580],
['20070214',1891.240],
['20070215',1946.600],
['20070216',1952.300],
['20070226',2018.220],
['20070227',1827.910],
['20070228',1896.210],
['20070301',1857.840],
['20070302',1885.480],
['20070305',1897.960],
['20070306',1896.880],
['20070307',1946.730],
['20070308',1966.240],
['20070309',1969.740],
['20070312',1998.450],
['20070313',2030.710],
['20070314',2045.870],
['20070315',2067.530],
['20070316',2031.960],
['20070319',2041.110],
['20070320',2068.200],
['20070321',2099.410],
['20070322',2094.580],
['20070323',2099.500],
['20070326',2159.930],
['20070327',2197.560],
['20070328',2164.310],
['20070329',2080.610],
['20070330',2106.050],
['20070402',2141.900],
['20070403',2168.050],
['20070404',2204.470],
['20070405',2225.180],
['20070406',2274.020],
['20070409',2314.010],
['20070410',2310.080],
['20070411',2339.300],
['20070412',2403.360],
['20070413',2380.870],
['20070416',2443.800],
['20070417',2477.740],
['20070418',2547.770],
['20070419',2418.440],
['20070420',2536.860],
['20070423',2654.370],
['20070424',2664.190],
['20070425',2659.100],
['20070426',2682.180],
['20070427',2669.510],
['20070430',2721.060],
['20070508',2834.020],
['20070509',2826.020],
['20070510',2869.480],
['20070511',2857.860],
['20070514',2877.870],
['20070515',2791.960],
['20070516',2871.720],
['20070517',2945.030],
['20070518',2934.380],
['20070521',2993.640],
['20070522',3035.400],
['20070523',3125.460],
['20070524',3062.000],
['20070525',3109.380],
['20070528',3175.790],
['20070529',3246.240],
['20070530',2946.810],
['20070531',2830.300],
['20070601',2648.430],
['20070604',2415.380],
['20070605',2442.600],
['20070606',2448.370],
['20070607',2559.760],
['20070608',2606.390],
['20070611',2648.780],
['20070612',2707.120],
['20070613',2808.700],
['20070614',2759.400],
['20070615',2754.960],
['20070618',2848.410],
['20070619',2942.530],
['20070620',2834.630],
['20070621',2808.990],
['20070622',2641.550],
['20070625',2473.210],
['20070626',2565.760],
['20070627',2598.890],
['20070628',2425.120],
['20070629',2324.400],
['20070702',2375.990],
['20070703',2394.990],
['20070704',2316.250],
['20070705',2175.770],
['20070706',2296.290],
['20070709',2351.840],
['20070710',2276.630],
['20070711',2300.860],
['20070712',2313.490],
['20070713',2305.960],
['20070716',2239.910],
['20070717',2289.350],
['20070718',2288.840],
['20070719',2317.530],
['20070720',2389.080],
['20070723',2506.900],
['20070724',2497.340],
['20070725',2551.440],
['20070726',2594.100],
['20070727',2617.950],
['20070730',2668.660],
['20070731',2711.970],
['20070801',2541.210],
['20070802',2597.470],
['20070803',2623.120],
['20070806',2690.420],
['20070807',2666.900],
['20070808',2618.820],
['20070809',2638.750],
['20070810',2584.400],
['20070813',2625.280],
['20070814',2689.130],
['20070815',2667.140],
['20070816',2700.220],
['20070817',2673.470],
['20070820',2764.550],
['20070821',2781.610],
['20070822',2824.120],
['20070823',2882.240],
['20070824',2870.620],
['20070827',2851.540],
['20070828',2832.200],
['20070829',2814.160],
['20070830',2944.050],
['20070831',2967.770],
['20070903',3033.780],
['20070904',3004.390],
['20070905',3011.140],
['20070906',3017.080],
['20070907',2946.760],
['20070910',3012.990],
['20070911',2791.250],
['20070912',2814.410],
['20070913',2855.760],
['20070914',2897.700],
['20070917',2933.300],
['20070918',2925.050],
['20070919',2894.780],
['20070920',2906.290],
['20070921',2865.900],
['20070924',2874.600],
['20070925',2883.890],
['20070926',2835.410],
['20070927',2861.840],
['20070928',2916.920],
['20071008',2918.850],
['20071009',2958.280],
['20071010',2914.120],
['20071011',2841.170],
['20071012',2741.900],
['20071015',2757.910],
['20071016',2813.480],
['20071017',2805.280],
['20071018',2721.290],
['20071019',2716.620],
['20071022',2656.360],
['20071023',2661.990],
['20071024',2599.340],
['20071025',2410.770],
['20071026',2403.230],
['20071029',2430.930],
['20071030',2472.230],
['20071031',2569.070],
['20071101',2478.290],
['20071102',2475.720],
['20071105',2561.480],
['20071106',2576.320],
['20071107',2554.370],
['20071108',2486.500],
['20071109',2463.860],
['20071112',2490.450],
['20071113',2500.790],
['20071114',2558.100],
['20071115',2519.980],
['20071116',2520.710],
['20071119',2592.460],
['20071120',2623.990],
['20071121',2585.960],
['20071122',2491.190],
['20071123',2527.600],
['20071126',2495.210],
['20071127',2461.770],
['20071128',2460.800],
['20071129',2519.190],
['20071130',2492.690],
['20071203',2539.150],
['20071204',2544.620],
['20071205',2583.420],
['20071206',2609.390],
['20071207',2628.950],
['20071210',2689.730],
['20071211',2751.530],
['20071212',2758.130],
['20071213',2682.360],
['20071214',2763.140],
['20071217',2805.390],
['20071218',2799.790],
['20071219',2854.850],
['20071220',2873.040],
['20071221',2908.740],
['20071224',2938.300],
['20071225',2969.960],
['20071226',3037.830],
['20071227',3060.690],
['20071228',3049.630],
['20080102',3169.350],
['20080103',3224.050],
['20080104',3205.910],
['20080107',3255.440],
['20080108',3159.830],
['20080109',3236.620],
['20080110',3237.990],
['20080111',3226.520],
['20080114',3300.050],
['20080115',3314.350],
['20080116',3290.690],
['20080117',3278.500],
['20080118',3377.970],
['20080121',3284.790],
['20080122',3004.460],
['20080123',3163.010],
['20080124',3270.070],
['20080125',3263.420],
['20080128',3068.890],
['20080129',3137.160],
['20080130',3097.780],
['20080131',2958.540],
['20080201',2803.850],
['20080204',3033.390],
['20080205',3060.350],
['20080213',3042.200],
['20080214',3096.400],
['20080215',3077.370],
['20080218',3169.650],
['20080219',3232.610],
['20080220',3180.830],
['20080221',3234.970],
['20080222',3177.230],
['20080225',3068.570],
['20080226',3066.940],
['20080227',3152.640],
['20080228',3172.000],
['20080229',3218.760],
['20080303',3334.560],
['20080304',3312.280],
['20080305',3359.020],
['20080306',3341.460],
['20080307',3263.280],
['20080310',3164.950],
['20080311',3218.890],
['20080312',3125.800],
['20080313',3039.750],
['20080314',2997.150],
['20080317',2746.680],
['20080318',2553.820],
['20080319',2673.620],
['20080320',2772.020],
['20080321',2793.290],
['20080324',2744.570],
['20080325',2776.400],
['20080326',2767.890],
['20080327',2600.510],
['20080328',2655.560],
['20080331',2532.070],
['20080401',2333.160],
['20080402',2212.560],
['20080403',2261.900],
['20080407',2393.220],
['20080408',2416.940],
['20080409',2269.450],
['20080410',2311.500],
['20080411',2342.700],
['20080414',2156.140],
['20080415',2228.100],
['20080416',2161.200],
['20080417',2088.030],
['20080418',1985.330],
['20080421',1948.440],
['20080422',1923.230],
['20080423',2007.040],
['20080424',2196.490],
['20080425',2232.510],
['20080428',2210.030],
['20080429',2236.710],
['20080430',2321.010],
['20080505',2408.540],
['20080506',2408.480],
['20080507',2296.950],
['20080508',2386.640],
['20080509',2397.020],
['20080512',2428.480],
['20080513',2355.490],
['20080514',2443.520],
['20080515',2436.410],
['20080516',2429.390],
['20080519',2404.910],
['20080520',2253.420],
['20080521',2286.350],
['20080522',2258.820],
['20080523',2313.950],
['20080526',2238.040],
['20080527',2231.530],
['20080528',2291.920],
['20080529',2242.950],
['20080530',2263.230],
['20080602',2268.740],
['20080603',2254.750],
['20080604',2180.700],
['20080605',2161.450],
['20080606',2152.230],
['20080610',1957.710],
['20080611',1931.090],
['20080612',1902.930],
['20080613',1804.860],
['20080616',1782.560],
['20080617',1699.390],
['20080618',1790.020],
['20080619',1638.090],
['20080620',1682.550],
['20080623',1666.930],
['20080624',1727.380],
['20080625',1813.270],
['20080626',1830.380],
['20080627',1707.990],
['20080630',1698.270],
['20080701',1654.180],
['20080702',1685.100],
['20080703',1770.430],
['20080704',1779.640],
['20080707',1862.660],
['20080708',1897.860],
['20080709',1938.490],
['20080710',1888.760],
['20080711',1885.630],
['20080714',1926.590],
['20080715',1875.830],
['20080716',1779.020],
['20080717',1749.650],
['20080718',1818.990],
['20080721',1891.640],
['20080722',1896.670],
['20080723',1888.460],
['20080724',1943.100],
['20080725',1931.340],
['20080728',1956.050],
['20080729',1901.810],
['20080730',1903.390],
['20080731',1827.560],
['20080801',1856.540],
['20080804',1801.580],
['20080805',1767.640],
['20080806',1771.640],
['20080807',1785.370],
['20080808',1657.940],
['20080811',1546.360],
['20080812',1524.970],
['20080813',1522.990],
['20080814',1531.200],
['20080815',1527.110],
['20080818',1418.480],
['20080819',1431.820],
['20080820',1549.040],
['20080821',1504.190],
['20080822',1474.350],
['20080825',1469.610],
['20080826',1393.800],
['20080827',1382.620],
['20080828',1376.630],
['20080829',1424.280],
['20080901',1379.580],
['20080902',1394.730],
['20080903',1386.880],
['20080904',1398.930],
['20080905',1347.840],
['20080908',1278.600],
['20080909',1282.240],
['20080910',1292.940],
['20080911',1262.820],
['20080912',1262.230],
['20080916',1226.070],
['20080917',1195.850],
['20080918',1171.920],
['20080919',1288.800],
['20080922',1345.250],
['20080923',1275.800],
['20080924',1297.270],
['20080925',1326.680],
['20080926',1317.580],
['20081006',1261.550],
['20081007',1257.250],
['20081008',1219.360],
['20081009',1209.920],
['20081010',1130.250],
['20081013',1146.100],
['20081014',1110.640],
['20081015',1094.840],
['20081016',1031.610],
['20081017',1049.130],
['20081020',1082.210],
['20081021',1082.300],
['20081022',1057.640],
['20081023',1061.850],
['20081024',1045.920],
['20081027',970.210],
['20081028',998.720],
['20081029',965.200],
['20081030',973.500],
['20081031',957.440],
['20081103',941.290],
['20081104',924.290],
['20081105',953.250],
['20081106',939.360],
['20081107',956.960],
['20081110',1026.150],
['20081111',1015.740],
['20081112',1033.240],
['20081113',1074.900],
['20081114',1126.140],
['20081117',1188.500],
['20081118',1098.890],
['20081119',1180.830],
['20081120',1186.460],
['20081121',1149.080],
['20081124',1096.420],
['20081125',1098.820],
['20081126',1097.890],
['20081127',1108.710],
['20081128',1093.030],
['20081201',1147.060],
['20081202',1182.500],
['20081203',1231.520],
['20081204',1234.980],
['20081205',1266.730],
['20081208',1328.400],
['20081209',1292.390],
['20081210',1345.510],
['20081211',1292.850],
['20081212',1245.380],
['20081215',1281.240],
['20081216',1279.150],
['20081217',1296.510],
['20081218',1320.240],
['20081219',1338.180],
['20081222',1350.430],
['20081223',1261.160],
['20081224',1227.030],
['20081225',1219.670],
['20081226',1209.220],
['20081229',1210.440],
['20081230',1213.330],
['20081231',1198.010],
['20090105',1237.970],
['20090106',1276.360],
['20090107',1278.590],
['20090108',1241.130],
['20090109',1276.310],
['20090112',1295.450],
['20090113',1256.140],
['20090114',1312.230],
['20090115',1340.530],
['20090116',1349.630],
['20090119',1348.040],
['20090120',1357.000],
['20090121',1352.320],
['20090122',1377.100],
['20090123',1369.210],
['20090202',1412.020],
['20090203',1454.810],
['20090204',1495.870],
['20090205',1464.920],
['20090206',1543.360],
['20090209',1583.120],
['20090210',1625.800],
['20090211',1616.750],
['20090212',1659.080],
['20090213',1718.000],
['20090216',1738.740],
['20090217',1674.390],
['20090218',1600.620],
['20090219',1635.830],
['20090220',1676.480],
['20090223',1732.840],
['20090224',1664.600],
['20090225',1659.720],
['20090226',1550.220],
['20090227',1458.570],
['20090302',1490.140],
['20090303',1490.660],
['20090304',1581.820],
['20090305',1594.590],
['20090306',1572.370],
['20090309',1504.750],
['20090310',1541.700],
['20090311',1533.810],
['20090312',1538.750],
['20090313',1531.720],
['20090316',1547.280],
['20090317',1602.970],
['20090318',1626.600],
['20090319',1664.170],
['20090320',1651.040],
['20090323',1673.770],
['20090324',1688.750],
['20090325',1650.690],
['20090326',1690.350],
['20090327',1730.200],
['20090330',1739.670],
['20090331',1771.300],
['20090401',1803.090],
['20090402',1814.770],
['20090403',1815.320],
['20090407',1836.000],
['20090408',1790.200],
['20090409',1829.850],
['20090410',1909.620],
['20090413',1941.550],
['20090414',1994.100],
['20090415',2064.750],
['20090416',2031.490],
['20090417',1983.140],
['20090420',2038.260],
['20090421',2017.670],
['20090422',1904.720],
['20090423',1926.070],
['20090424',1890.230],
['20090427',1836.960],
['20090428',1856.870],
['20090429',1906.340],
['20090430',1934.750],
['20090504',1999.200],
['20090505',2007.380],
['20090506',2031.210],
['20090507',2026.720],
['20090508',2016.600],
['20090511',1935.800],
['20090512',1984.270],
['20090513',1991.350],
['20090514',2009.070],
['20090515',2022.850],
['20090518',2025.410],
['20090519',2039.740],
['20090520',2025.230],
['20090521',1987.140],
['20090522',1999.180],
['20090525',2016.610],
['20090526',2046.540],
['20090527',2039.400],
['20090601',2056.830],
['20090602',2057.840],
['20090603',2052.490],
['20090604',2034.130],
['20090605',2022.800],
['20090608',2021.180],
['20090609',2038.610],
['20090610',2084.950],
['20090611',2066.740],
['20090612',2017.440],
['20090615',2044.920],
['20090616',2031.140],
['20090617',2049.930],
['20090618',2060.700],
['20090619',2055.210],
['20090622',2042.880],
['20090623',2032.790],
['20090624',2051.680],
['20090625',2052.580],
['20090626',2061.470],
['20090629',2058.890],
['20090630',2035.400],
['20090701',2043.590],
['20090702',2057.180],
['20090703',2059.210],
['20090706',2062.180],
['20090707',2070.250],
['20090708',2088.750],
['20090709',2144.840],
['20090710',2155.290],
['20090713',2188.230],
['20090714',2216.850],
['20090715',2232.390],
['20090716',2227.310],
['20090717',2256.020],
['20090720',2305.600],
['20090721',2242.120],
['20090722',2270.290],
['20090723',2288.460],
['20090724',2254.830],
['20090727',2298.290],
['20090728',2347.470],
['20090729',2211.310],
['20090730',2287.810],
['20090731',2344.770],
['20090803',2380.860],
['20090804',2386.970],
['20090805',2392.970],
['20090806',2351.590],
['20090807',2283.050],
['20090810',2302.510],
['20090811',2314.660],
['20090812',2185.710],
['20090813',2179.430],
['20090814',2067.080],
['20090817',1935.400],
['20090818',1966.120],
['20090819',1858.690],
['20090820',1928.200],
['20090821',1996.670],
['20090824',2037.300],
['20090825',2049.940],
['20090826',2111.130],
['20090827',2123.500],
['20090828',2062.700],
['20090831',1935.560],
['20090901',1917.760],
['20090902',1927.340],
['20090903',2011.420],
['20090904',2047.890],
['20090907',2068.640],
['20090908',2088.770],
['20090909',2099.060],
['20090910',2081.350],
['20090911',2124.510],
['20090914',2198.220],
['20090915',2235.460],
['20090916',2300.270],
['20090917',2408.520],
['20090918',2312.520],
['20090921',2345.220],
['20090922',2269.050],
['20090923',2198.460],
['20090924',2157.510],
['20090925',2127.530],
['20090928',2056.360],
['20090929',2015.070],
['20090930',2029.620],
['20091009',2138.350],
['20091012',2169.500],
['20091013',2188.660],
['20091014',2199.980],
['20091015',2205.370],
['20091016',2210.860],
['20091019',2253.830],
['20091020',2290.830],
['20091021',2264.730],
['20091022',2284.240],
['20091023',2308.290],
['20091026',2308.530],
['20091027',2247.750],
['20091028',2280.360],
['20091029',2231.500],
['20091030',2237.720],
['20091102',2287.700],
['20091103',2345.160],
['20091104',2401.520],
['20091105',2424.430],
['20091106',2416.070],
['20091109',2447.930],
['20091110',2438.470],
['20091111',2460.340],
['20091112',2457.290],
['20091113',2478.010],
['20091116',2529.990],
['20091117',2550.770],
['20091118',2544.230],
['20091119',2605.570],
['20091120',2626.540],
['20091123',2667.760],
['20091124',2517.170],
['20091125',2591.650],
['20091126',2479.360],
['20091127',2417.880],
['20091130',2516.870],
['20091201',2593.130],
['20091202',2624.920],
['20091203',2634.800],
['20091204',2561.930],
['20091207',2626.600],
['20091208',2620.720],
['20091209',2597.880],
['20091210',2609.640],
['20091211',2604.570],
['20091214',2593.320],
['20091215',2621.970],
['20091216',2611.880],
['20091217',2538.020],
['20091218',2456.760],
['20091221',2497.290],
['20091222',2469.860],
['20091223',2550.640],
['20091224',2623.080],
['20091225',2673.690],
['20091228',2719.600],
['20091229',2721.470],
['20091230',2694.670],
['20091231',2719.990],
['20100104',2775.940],
['20100105',2846.550],
['20100106',2842.160],
['20100107',2778.210],
['20100108',2842.280],
['20100111',2924.290],
['20100112',2954.650],
['20100113',2960.000],
['20100114',3057.600],
['20100115',3056.160],
['20100118',3086.910],
['20100119',3069.960],
['20100120',2895.150],
['20100121',2891.350],
['20100122',2808.840],
['20100125',2781.290],
['20100126',2676.010],
['20100127',2669.240],
['20100128',2733.630],
['20100129',2759.560],
['20100201',2672.550],
['20100202',2660.380],
['20100203',2687.610],
['20100204',2718.800],
['20100205',2667.760],
['20100208',2647.220],
['20100209',2644.880],
['20100210',2687.720],
['20100211',2681.060],
['20100212',2720.660],
['20100222',2714.520],
['20100223',2754.070],
['20100224',2814.930],
['20100225',2845.920],
['20100226',2853.050],
['20100301',2884.610],
['20100302',2914.730],
['20100303',2967.550],
['20100304',2832.290],
['20100305',2837.050],
['20100308',2863.620],
['20100309',2857.530],
['20100310',2827.540],
['20100311',2800.590],
['20100312',2753.900],
['20100315',2724.130],
['20100316',2754.150],
['20100317',2863.880],
['20100318',2892.680],
['20100319',2928.290],
['20100322',2976.460],
['20100323',2948.810],
['20100324',2956.870],
['20100325',2921.030],
['20100326',2974.050],
['20100329',2973.550],
['20100330',3001.300],
['20100331',3032.410],
['20100401',3077.630],
['20100402',3085.550],
['20100406',3066.090],
['20100407',3083.220],
['20100408',3101.800],
['20100409',3184.970],
['20100412',3260.080],
['20100413',3182.460],
['20100414',3213.590],
['20100415',3176.130],
['20100416',3189.370],
['20100419',3068.480],
['20100420',3182.460],
['20100421',3295.130],
['20100422',3317.580],
['20100423',3256.360],
['20100426',3279.320],
['20100427',3202.270],
['20100428',3171.020],
['20100429',3055.420],
['20100430',2953.730],
['20100504',2950.920],
['20100505',3051.180],
['20100506',2967.450],
['20100507',2897.530],
['20100510',2802.480],
['20100511',2724.870],
['20100512',2660.570],
['20100513',2735.130],
['20100514',2780.610],
['20100517',2604.650],
['20100518',2632.340],
['20100519',2649.070],
['20100520',2598.020],
['20100521',2656.420],
['20100524',2767.310],
['20100525',2751.350],
['20100526',2760.760],
['20100527',2821.070],
['20100528',2827.760],
['20100531',2729.960],
['20100601',2676.090],
['20100602',2735.230],
['20100603',2730.650],
['20100604',2774.360],
['20100607',2815.870],
['20100608',2840.860],
['20100609',2888.360],
['20100610',2908.660],
['20100611',2864.960],
['20100617',2815.960],
['20100618',2683.660],
['20100621',2761.590],
['20100622',2782.020],
['20100623',2787.100],
['20100624',2794.100],
['20100625',2744.030],
['20100628',2679.790],
['20100629',2533.400],
['20100630',2504.420],
['20100701',2470.180],
['20100702',2438.750],
['20100705',2417.240],
['20100706',2484.940],
['20100707',2521.760],
['20100708',2483.220],
['20100709',2555.860],
['20100712',2588.150],
['20100713',2569.080],
['20100714',2584.910],
['20100715',2510.490],
['20100716',2520.460],
['20100719',2577.390],
['20100720',2652.240],
['20100721',2657.130],
['20100722',2697.550],
['20100723',2698.230],
['20100726',2735.110],
['20100727',2739.070],
['20100728',2795.070],
['20100729',2811.040],
['20100730',2813.510],
['20100802',2860.170],
['20100803',2807.270],
['20100804',2847.560],
['20100805',2848.070],
['20100806',2913.690],
['20100809',2944.530],
['20100810',2823.310],
['20100811',2869.780],
['20100812',2850.390],
['20100813',2889.850],
['20100816',2946.780],
['20100817',2970.610],
['20100818',2978.850],
['20100819',2977.600],
['20100820',2902.700],
['20100823',2935.540],
['20100824',2965.100],
['20100825',2903.360],
['20100826',2936.390],
['20100827',2951.650],
['20100830',3047.640],
['20100831',3078.110],
['20100901',3040.990],
['20100902',3104.720],
['20100903',3159.670],
['20100906',3120.020],
['20100907',3151.640],
['20100908',3186.480],
['20100909',3169.320],
['20100910',3167.070],
['20100913',3253.750],
['20100914',3298.940],
['20100915',3219.460],
['20100916',3145.100],
['20100917',3141.430],
['20100920',3084.340],
['20100921',3059.150],
['20100927',3152.460],
['20100928',3158.170],
['20100929',3106.220],
['20100930',3145.630],
['20101008',3203.690],
['20101011',3169.890],
['20101012',3188.800],
['20101013',3196.330],
['20101014',3083.470],
['20101015',3084.220],
['20101018',3015.720],
['20101019',3160.960],
['20101020',3176.080],
['20101021',3212.390],
['20101022',3296.740],
['20101025',3400.020],
['20101026',3445.150],
['20101027',3416.750],
['20101028',3468.310],
['20101029',3562.450],
['20101101',3690.090],
['20101102',3613.940],
['20101103',3513.600],
['20101104',3672.050],
['20101105',3735.400],
['20101108',3802.690],
['20101109',3835.350],
['20101110',3859.980],
['20101111',3811.120],
['20101112',3583.520],
['20101115',3719.800],
['20101116',3548.020],
['20101117',3408.080],
['20101118',3506.190],
['20101119',3696.920],
['20101122',3799.070],
['20101123',3738.660],
['20101124',3847.550],
['20101125',3833.720],
['20101126',3807.390],
['20101129',3804.910],
['20101130',3706.080],
['20101201',3706.660],
['20101202',3712.920],
['20101203',3689.650],
['20101206',3599.960],
['20101207',3664.510],
['20101208',3670.650],
['20101209',3647.040],
['20101210',3722.460],
['20101213',3816.090],
['20101214',3875.610],
['20101215',3847.860],
['20101216',3848.960],
['20101217',3839.500],
['20101220',3797.410],
['20101221',3824.460],
['20101222',3789.410],
['20101223',3698.000],
['20101224',3616.570],
['20101227',3515.280],
['20101228',3422.320],
['20101229',3521.540],
['20101230',3548.440],
['20101231',3634.390],
['20110104',3676.570],
['20110105',3654.180],
['20110106',3616.220],
['20110107',3595.760],
['20110110',3485.350],
['20110111',3446.680],
['20110112',3461.520],
['20110113',3474.530],
['20110114',3373.270],
['20110117',3216.800],
['20110118',3226.870],
['20110119',3312.210],
['20110120',3161.880],
['20110121',3181.580],
['20110124',3089.380],
['20110125',3039.990],
['20110126',3115.550],
['20110127',3165.470],
['20110128',3194.350],
['20110131',3222.040],
['20110201',3249.180],
['20110209',3231.740],
['20110210',3331.510],
['20110211',3350.910],
['20110214',3415.250],
['20110215',3426.970],
['20110216',3494.800],
['20110217',3531.030],
['20110218',3481.040],
['20110221',3571.090],
['20110222',3475.200],
['20110223',3539.580],
['20110224',3543.200],
['20110225',3555.180],
['20110228',3590.620],
['20110301',3593.310],
['20110302',3559.100],
['20110303',3485.460],
['20110304',3519.530],
['20110307',3564.500],
['20110308',3596.010],
['20110309',3604.590],
['20110310',3586.470],
['20110311',3581.100],
['20110314',3615.580],
['20110315',3557.090],
['20110316',3624.290],
['20110317',3529.640],
['20110318',3547.330],
['20110321',3514.130],
['20110322',3506.490],
['20110323',3541.110],
['20110324',3529.530],
['20110325',3537.250],
['20110328',3490.380],
['20110329',3439.810],
['20110330',3399.740],
['20110331',3368.880],
['20110401',3392.090],
['20110406',3366.880],
['20110407',3371.420],
['20110408',3424.490],
['20110411',3388.020],
['20110412',3401.400],
['20110413',3434.920],
['20110414',3418.580],
['20110415',3396.110],
['20110418',3389.110],
['20110419',3347.180],
['20110420',3384.750],
['20110421',3408.180],
['20110422',3369.070],
['20110425',3277.610],
['20110426',3223.190],
['20110427',3170.680],
['20110428',3076.900],
['20110429',3130.440],
['20110503',3179.610],
['20110504',3113.360],
['20110505',3130.000],
['20110506',3166.550],
['20110509',3191.900],
['20110510',3198.550],
['20110511',3209.750],
['20110512',3145.750],
['20110513',3182.970],
['20110516',3186.920],
['20110517',3166.470],
['20110518',3185.860],
['20110519',3155.110],
['20110520',3142.280],
['20110523',3030.830],
['20110524',3027.750],
['20110525',2977.020],
['20110526',2942.500],
['20110527',2876.800],
['20110530',2811.810],
['20110531',2867.050],
['20110601',2907.860],
['20110602',2870.240],
['20110603',2926.260],
['20110607',2942.600],
['20110608',2949.610],
['20110609',2877.430],
['20110610',2877.660],
['20110613',2881.980],
['20110614',2918.630],
['20110615',2892.320],
['20110616',2843.050],
['20110617',2793.430],
['20110620',2736.580],
['20110621',2765.910],
['20110622',2765.340],
['20110623',2820.500],
['20110624',2901.460],
['20110627',2947.550],
['20110628',2955.240],
['20110629',2919.120],
['20110630',2972.140],
['20110701',2983.120],
['20110704',3057.580],
['20110705',3073.020],
['20110706',3100.690],
['20110707',3116.160],
['20110708',3105.830],
['20110711',3133.100],
['20110712',3090.020],
['20110713',3159.770],
['20110714',3187.410],
['20110715',3201.150],
['20110718',3208.440],
['20110719',3165.210],
['20110720',3171.870],
['20110721',3122.900],
['20110722',3142.260],
['20110725',3013.150],
['20110726',3027.160],
['20110727',3076.500],
['20110728',3064.560],
['20110729',3038.800],
['20110801',3048.850],
['20110802',3020.870],
['20110803',3036.240],
['20110804',3040.860],
['20110805',2982.660],
['20110808',2834.720],
['20110809',2839.900],
['20110810',2890.750],
['20110811',2928.470],
['20110812',2979.440],
['20110815',3025.740],
['20110816',2997.070],
['20110817',2984.150],
['20110818',2938.260],
['20110819',2915.600],
['20110822',2884.300],
['20110823',2943.670],
['20110824',2963.110],
['20110825',3001.000],
['20110826',3014.510],
['20110829',2998.500],
['20110830',2963.090],
['20110831',2933.640],
['20110901',2916.020],
['20110902',2895.000],
['20110905',2818.290],
['20110906',2795.730],
['20110907',2862.310],
['20110908',2838.900],
['20110909',2818.400],
['20110913',2768.860],
['20110914',2798.530],
['20110915',2801.800],
['20110916',2797.490],
['20110919',2728.770],
['20110920',2741.870],
['20110921',2821.330],
['20110922',2745.620],
['20110923',2733.910],
['20110926',2694.410],
['20110927',2697.540],
['20110928',2651.820],
['20110929',2565.410],
['20110930',2562.380],
['20111010',2549.740],
['20111011',2532.560],
['20111012',2618.130],
['20111013',2662.930],
['20111014',2657.450],
['20111017',2677.070],
['20111018',2606.030],
['20111019',2592.920],
['20111020',2519.180],
['20111021',2449.720],
['20111024',2475.400],
['20111025',2558.810],
['20111026',2579.060],
['20111027',2566.020],
['20111028',2621.310],
['20111031',2653.920],
['20111101',2663.630],
['20111102',2767.950],
['20111103',2793.260],
['20111104',2801.660],
['20111107',2782.210],
['20111108',2740.080],
['20111109',2808.650],
['20111110',2775.140],
['20111111',2773.650],
['20111114',2840.030],
['20111115',2867.600],
['20111116',2813.530],
['20111117',2807.220],
['20111118',2701.740],
['20111121',2696.840],
['20111122',2693.650],
['20111123',2678.830],
['20111124',2687.920],
['20111125',2658.360],
['20111128',2649.910],
['20111129',2700.400],
['20111130',2571.190],
['20111201',2610.420],
['20111202',2555.270],
['20111205',2454.130],
['20111206',2465.390],
['20111207',2475.360],
['20111208',2491.120],
['20111209',2459.600],
['20111212',2428.230],
['20111213',2346.640],
['20111214',2298.960],
['20111215',2264.770],
['20111216',2340.770],
['20111219',2366.430],
['20111220',2337.520],
['20111221',2281.080],
['20111222',2262.430],
['20111223',2272.930],
['20111226',2256.080],
['20111227',2183.850],
['20111228',2173.670],
['20111229',2175.250],
['20111230',2219.020],
['20120104',2146.710],
['20120105',2038.340],
['20120106',2059.610],
['20120109',2145.510],
['20120110',2227.790],
['20120111',2247.160],
['20120112',2237.500],
['20120113',2141.290],
['20120116',2058.460],
['20120117',2172.320],
['20120118',2097.380],
['20120119',2112.130],
['20120120',2138.270],
['20120130',2140.020],
['20120131',2142.340],
['20120201',2131.670],
['20120202',2178.940],
['20120203',2235.210],
['20120206',2253.690],
['20120207',2216.200],
['20120208',2279.260],
['20120209',2298.620],
['20120210',2301.270],
['20120213',2358.530],
['20120214',2345.950],
['20120215',2395.140],
['20120216',2389.420],
['20120217',2379.910],
['20120220',2392.140],
['20120221',2438.240],
['20120222',2495.470],
['20120223',2489.170],
['20120224',2501.590],
['20120227',2511.220],
['20120228',2490.800],
['20120229',2443.760],
['20120301',2475.650],
['20120302',2514.550],
['20120305',2524.200],
['20120306',2506.460],
['20120307',2480.760],
['20120308',2522.370],
['20120309',2563.430],
['20120312',2575.220],
['20120313',2608.010],
['20120314',2486.420],
['20120315',2450.650],
['20120316',2503.420],
['20120319',2533.130],
['20120320',2464.230],
['20120321',2462.190],
['20120322',2452.720],
['20120323',2406.060],
['20120326',2398.120],
['20120327',2400.910],
['20120328',2290.570],
['20120329',2244.090],
['20120330',2237.370],
['20120405',2311.670],
['20120406',2336.640],
['20120409',2297.950],
['20120410',2324.240],
['20120411',2328.150],
['20120412',2375.750],
['20120413',2398.800],
['20120416',2398.980],
['20120417',2378.000],
['20120418',2431.070],
['20120419',2424.940],
['20120420',2437.870],
['20120423',2379.570],
['20120424',2354.100],
['20120425',2371.110],
['20120426',2352.150],
['20120427',2344.120],
['20120502',2378.710],
['20120503',2385.910],
['20120504',2425.510],
['20120507',2463.730],
['20120508',2462.960],
['20120509',2419.520],
['20120510',2444.610],
['20120511',2418.610],
['20120514',2396.660],
['20120515',2401.120],
['20120516',2366.930],
['20120517',2401.330],
['20120518',2362.540],
['20120521',2368.100],
['20120522',2394.490],
['20120523',2379.190],
['20120524',2387.110],
['20120525',2345.300],
['20120528',2353.450],
['20120529',2403.660],
['20120530',2407.160],
['20120531',2439.570],
['20120601',2431.630],
['20120604',2358.670],
['20120605',2353.180],
['20120606',2355.800],
['20120607',2337.040],
['20120608',2327.640],
['20120611',2383.400],
['20120612',2365.130],
['20120613',2397.130],
['20120614',2378.340],
['20120615',2374.500],
['20120618',2402.800],
['20120619',2390.680],
['20120620',2404.790],
['20120621',2369.670],
['20120625',2303.270],
['20120626',2296.810],
['20120627',2301.340],
['20120628',2269.530],
['20120629',2312.560],
['20120702',2342.080],
['20120703',2347.000],
['20120704',2332.500],
['20120705',2282.720],
['20120706',2330.330],
['20120709',2278.450],
['20120710',2255.340],
['20120711',2267.510],
['20120712',2302.870],
['20120713',2279.420],
['20120716',2178.670],
['20120717',2197.080],
['20120718',2202.620],
['20120719',2224.090],
['20120720',2211.960],
['20120723',2191.440],
['20120724',2211.560],
['20120725',2204.280],
['20120726',2198.580],
['20120727',2179.340],
['20120730',2124.520],
['20120731',2088.810],
['20120801',2130.650],
['20120802',2137.500],
['20120803',2189.320],
['20120806',2248.950],
['20120807',2267.140],
['20120808',2252.630],
['20120809',2286.060],
['20120810',2287.790],
['20120813',2240.340],
['20120814',2252.530],
['20120815',2240.440],
['20120816',2222.770],
['20120817',2225.290],
['20120820',2238.020],
['20120821',2299.140],
['20120822',2280.370],
['20120823',2305.140],
['20120824',2254.830],
['20120827',2197.940],
['20120828',2222.260],
['20120829',2237.960],
['20120830',2198.850],
['20120831',2203.990],
['20120903',2246.510],
['20120904',2241.490],
['20120905',2270.690],
['20120906',2289.660],
['20120907',2355.130],
['20120910',2371.910],
['20120911',2368.310],
['20120912',2376.250],
['20120913',2337.010],
['20120914',2339.590],
['20120917',2271.720],
['20120918',2273.140],
['20120919',2304.110],
['20120920',2224.260],
['20120921',2189.280],
['20120924',2204.830],
['20120925',2175.260],
['20120926',2119.720],
['20120927',2168.000],
['20120928',2206.140],
['20121008',2198.300],
['20121009',2262.150],
['20121010',2292.730],
['20121011',2255.590],
['20121012',2238.880],
['20121015',2217.020],
['20121016',2220.500],
['20121017',2225.240],
['20121018',2264.150],
['20121019',2266.790],
['20121022',2271.220],
['20121023',2239.600],
['20121024',2230.540],
['20121025',2201.690],
['20121026',2155.380],
['20121029',2147.270],
['20121030',2140.740],
['20121031',2150.600],
['20121101',2181.330],
['20121102',2178.320],
['20121105',2162.370],
['20121106',2151.740],
['20121107',2153.520],
['20121108',2096.680],
['20121109',2086.650],
['20121112',2094.610],
['20121113',2062.960],
['20121114',2069.170],
['20121115',2027.900],
['20121116',2011.190],
['20121119',2014.680],
['20121120',2010.620],
['20121121',2032.540],
['20121122',2005.810],
['20121123',2001.820],
['20121126',1967.260],
['20121127',1897.800],
['20121128',1859.810],
['20121129',1840.370],
['20121130',1865.120],
['20121203',1811.390],
['20121204',1842.300],
['20121205',1919.070],
['20121206',1919.200],
['20121207',1955.410],
['20121210',1989.870],
['20121211',1970.920],
['20121212',1961.020],
['20121213',1935.160],
['20121214',2010.660],
['20121217',2007.930],
['20121218',2003.510],
['20121219',2015.620],
['20121220',2029.070],
['20121221',2035.390],
['20121224',2057.620],
['20121225',2095.050],
['20121226',2132.790],
['20121227',2120.060],
['20121228',2137.940],
['20121231',2152.070],
['20130104',2127.610],
['20130107',2142.690],
['20130108',2185.370],
['20130109',2196.190],
['20130110',2214.010],
['20130111',2186.160],
['20130114',2274.080],
['20130115',2324.410],
['20130116',2328.820],
['20130117',2292.040],
['20130118',2317.600],
['20130121',2316.560],
['20130122',2273.870],
['20130123',2287.180],
['20130124',2225.530],
['20130125',2218.530],
['20130128',2268.430],
['20130129',2293.590],
['20130130',2299.790],
['20130131',2276.320],
['20130201',2281.590],
['20130204',2250.610],
['20130205',2279.320],
['20130206',2308.560],
['20130207',2333.370],
['20130208',2375.660],
['20130218',2399.580],
['20130219',2364.820],
['20130220',2412.490],
['20130221',2371.530],
['20130222',2376.640],
['20130225',2411.580],
['20130226',2393.220],
['20130227',2384.790],
['20130228',2429.560],
['20130301',2474.750],
['20130304',2415.630],
['20130305',2501.290],
['20130306',2580.300],
['20130307',2526.050],
['20130308',2484.230],
['20130311',2487.670],
['20130312',2406.150],
['20130313',2392.380],
['20130314',2416.740],
['20130315',2433.160],
['20130318',2415.130],
['20130319',2408.600],
['20130320',2475.480],
['20130321',2530.060],
['20130322',2533.480],
['20130325',2534.450],
['20130326',2530.570],
['20130327',2539.750],
['20130328',2466.340],
['20130329',2473.550],
['20130401',2487.760],
['20130402',2420.800],
['20130403',2391.040],
['20130408',2436.920],
['20130409',2466.000],
['20130410',2448.940],
['20130411',2434.690],
['20130412',2415.740],
['20130415',2371.600],
['20130416',2405.240],
['20130417',2456.160],
['20130418',2465.150],
['20130419',2513.150],
['20130422',2549.760],
['20130423',2482.240],
['20130424',2567.110],
['20130425',2509.680],
['20130426',2449.860],
['20130502',2490.090],
['20130503',2541.880],
['20130506',2609.610],
['20130507',2601.070],
['20130508',2651.320],
['20130509',2676.830],
['20130510',2666.480],
['20130513',2710.260],
['20130514',2670.300],
['20130515',2756.390],
['20130516',2774.440],
['20130517',2826.790],
['20130520',2901.160],
['20130521',2993.370],
['20130522',2912.170],
['20130523',2915.890],
['20130524',2992.080],
['20130527',3016.090],
['20130528',2941.000],
['20130529',2971.330],
['20130530',2971.520],
['20130531',2942.780],
['20130603',2904.150],
['20130604',2836.860],
['20130605',2864.740],
['20130606',2824.970],
['20130607',2794.110],
['20130613',2762.960],
['20130614',2863.510],
['20130617',2873.760],
['20130618',2882.290],
['20130619',2873.830],
['20130620',2771.630],
['20130621',2760.810],
['20130624',2605.810],
['20130625',2635.700],
['20130626',2764.920],
['20130627',2698.270],
['20130628',2675.650],
['20130701',2769.210],
['20130702',2831.060],
['20130703',2885.010],
['20130704',2870.040],
['20130705',2813.990],
['20130708',2700.400],
['20130709',2727.660],
['20130710',2809.020],
['20130711',2876.980],
['20130712',2879.280],
['20130715',2984.420],
['20130716',3029.570],
['20130717',2990.130],
['20130718',3028.260],
['20130719',2987.370],
['20130722',3081.240],
['20130723',3165.490],
['20130724',3226.810],
['20130725',3096.850],
['20130726',3104.970],
['20130729',3063.250],
['20130730',2991.910],
['20130731',2997.750],
['20130801',3135.930],
['20130802',3161.300],
['20130805',3212.890],
['20130806',3251.030],
['20130807',3174.890],
['20130808',3202.780],
['20130809',3172.150],
['20130812',3170.050],
['20130813',3205.010],
['20130814',3227.880],
['20130815',3204.720],
['20130816',3120.040],
['20130819',3227.400],
['20130820',3252.840],
['20130821',3283.970],
['20130822',3321.730],
['20130823',3330.870],
['20130826',3404.850],
['20130827',3420.610],
['20130828',3354.160],
['20130829',3329.220],
['20130830',3203.110],
['20130902',3260.160],
['20130903',3322.160],
['20130904',3324.280],
['20130905',3361.700],
['20130906',3371.920],
['20130909',3379.020],
['20130910',3370.370],
['20130911',3254.840],
['20130912',3253.780],
['20130913',3299.610],
['20130916',3330.800],
['20130917',3291.130],
['20130918',3302.580],
['20130923',3413.670],
['20130924',3444.160],
['20130925',3424.340],
['20130926',3369.250],
['20130927',3385.050],
['20130930',3457.460],
['20131008',3550.180],
['20131009',3603.960],
['20131010',3570.460],
['20131011',3587.750],
['20131014',3615.030],
['20131015',3583.420],
['20131016',3490.300],
['20131017',3478.670],
['20131018',3544.660],
['20131021',3664.360],
['20131022',3565.150],
['20131023',3451.060],
['20131024',3440.580],
['20131025',3328.410],
['20131028',3346.130],
['20131029',3270.230],
['20131030',3307.700],
['20131031',3233.670],
['20131101',3209.000],
['20131104',3227.460],
['20131105',3301.010],
['20131106',3269.870],
['20131107',3207.840],
['20131108',3154.620],
['20131111',3179.310],
['20131112',3193.050],
['20131113',3168.600],
['20131114',3251.690],
['20131115',3322.440],
['20131118',3400.360],
['20131119',3410.050],
['20131120',3440.220],
['20131121',3422.930],
['20131122',3393.920],
['20131125',3398.940],
['20131126',3437.920],
['20131127',3509.770],
['20131128',3536.060],
['20131129',3584.290],
['20131202',3359.160],
['20131203',3402.450],
['20131204',3425.710],
['20131205',3368.610],
['20131206',3334.400],
['20131209',3378.150],
['20131210',3377.210],
['20131211',3356.240],
['20131212',3404.870],
['20131213',3410.610],
['20131216',3368.410],
['20131217',3343.750],
['20131218',3345.570],
['20131219',3319.790],
['20131220',3274.620],
['20131223',3251.880],
['20131224',3305.850],
['20131225',3385.170],
['20131226',3321.930],
['20131227',3401.360],
['20131230',3413.800],
['20131231',3408.490],
['20140102',3481.470],
['20140103',3511.150],
['20140106',3432.090],
['20140107',3473.800],
['20140108',3541.510],
['20140109',3487.850],
['20140110',3408.180],
['20140113',3390.460],
['20140114',3469.530],
['20140115',3541.740],
['20140116',3502.680],
['20140117',3490.340],
['20140120',3456.110],
['20140121',3524.610],
['20140122',3597.500],
['20140123',3670.990],
['20140124',3740.930],
['20140127',3749.660],
['20140128',3699.780],
['20140129',3788.150],
['20140130',3772.840],
['20140207',3881.560],
['20140210',3976.770],
['20140211',3930.660],
['20140212',3965.250],
['20140213',3869.800],
['20140214',3929.070],
['20140217',4036.310],
['20140218',4030.000],
['20140219',4024.010],
['20140220',3952.180],
['20140221',3964.200],
['20140224',4030.890],
['20140225',3831.090],
['20140226',3840.380],
['20140227',3780.850],
['20140228',3829.140],
['20140303',3908.830],
['20140304',3880.520],
['20140305',3879.700],
['20140306',3858.450],
['20140307',3819.060],
['20140310',3667.000],
['20140311',3655.450],
['20140312',3636.410],
['20140313',3699.820],
['20140314',3698.760],
['20140317',3797.240],
['20140318',3821.250],
['20140319',3791.640],
['20140320',3662.820],
['20140321',3717.960],
['20140324',3691.050],
['20140325',3692.670],
['20140326',3723.290],
['20140327',3613.930],
['20140328',3496.000],
['20140331',3488.950],
['20140401',3564.860],
['20140402',3532.950],
['20140403',3551.180],
['20140404',3614.150],
['20140408',3632.590],
['20140409',3690.850],
['20140410',3720.860],
['20140411',3681.540],
['20140414',3696.820],
['20140415',3687.290],
['20140416',3674.260],
['20140417',3694.490],
['20140418',3711.990],
['20140421',3671.720],
['20140422',3617.540],
['20140423',3593.430],
['20140424',3554.730],
['20140425',3468.060],
['20140428',3359.640],
['20140429',3406.710],
['20140430',3441.840],
['20140505',3494.970],
['20140506',3535.440],
['20140507',3464.950],
['20140508',3448.640],
['20140509',3401.490],
['20140512',3481.650],
['20140513',3479.040],
['20140514',3482.630],
['20140515',3402.490],
['20140516',3378.870],
['20140519',3363.020],
['20140520',3396.470],
['20140521',3445.380],
['20140522',3459.110],
['20140523',3534.200],
['20140526',3572.090],
['20140527',3555.540],
['20140528',3659.450],
['20140529',3615.490],
['20140530',3640.030],
['20140603',3622.240],
['20140604',3602.000],
['20140605',3654.850],
['20140606',3640.600],
['20140609',3584.560],
['20140610',3663.210],
['20140611',3682.990],
['20140612',3685.400],
['20140613',3739.050],
['20140616',3772.990],
['20140617',3746.650],
['20140618',3730.830],
['20140619',3590.980],
['20140620',3633.060],
['20140623',3684.760],
['20140624',3700.100],
['20140625',3670.260],
['20140626',3738.650],
['20140627',3753.610],
['20140630',3807.740],
['20140701',3847.040],
['20140702',3861.340],
['20140703',3868.660],
['20140704',3863.340],
['20140707',3833.930],
['20140708',3874.660],
['20140709',3790.260],
['20140710',3742.190],
['20140711',3753.350],
['20140714',3795.390],
['20140715',3763.510],
['20140716',3698.880],
['20140717',3669.230],
['20140718',3659.520],
['20140721',3676.080],
['20140722',3721.220],
['20140723',3656.330],
['20140724',3608.750],
['20140725',3649.950],
['20140728',3718.610],
['20140729',3774.920],
['20140730',3805.560],
['20140731',3823.960],
['20140801',3760.060],
['20140804',3800.190],
['20140805',3845.220],
['20140806',3873.790],
['20140807',3858.280],
['20140808',3908.740],
['20140811',3965.490],
['20140812',3992.330],
['20140813',3979.810],
['20140814',3964.490],
['20140815',4019.770],
['20140818',4098.770],
['20140819',4125.030],
['20140820',4097.510],
['20140821',4113.800],
['20140822',4159.530],
['20140825',4118.890],
['20140826',4051.120],
['20140827',4090.790],
['20140828',4051.430],
['20140829',4113.640],
['20140901',4205.850],
['20140902',4268.260],
['20140903',4295.950],
['20140904',4336.250],
['20140905',4338.540],
['20140909',4344.110],
['20140910',4349.880],
['20140911',4348.980],
['20140912',4380.280],
['20140915',4414.630],
['20140916',4239.480],
['20140917',4252.710],
['20140918',4281.060],
['20140919',4315.220],
['20140922',4273.880],
['20140923',4340.600],
['20140924',4393.750],
['20140925',4400.090],
['20140926',4398.730],
['20140929',4442.060],
['20140930',4514.500],
['20141008',4564.110],
['20141009',4556.070],
['20141010',4514.830],
['20141013',4482.020],
['20141014',4472.710],
['20141015',4488.300],
['20141016',4415.940],
['20141017',4387.710],
['20141020',4471.150],
['20141021',4437.700],
['20141022',4394.080],
['20141023',4325.950],
['20141024',4340.640],
['20141027',4375.290],
['20141028',4479.620],
['20141029',4531.340],
['20141030',4526.540],
['20141031',4489.810],
['20141103',4531.330],
['20141104',4502.920],
['20141105',4483.740],
['20141106',4529.650],
['20141107',4500.540],
['20141110',4507.560],
['20141111',4349.150],
['20141112',4410.550],
['20141113',4330.880],
['20141114',4330.190],
['20141117',4392.740],
['20141118',4418.190],
['20141119',4481.980],
['20141120',4447.050],
['20141121',4486.870],
['20141124',4546.950],
['20141125',4635.750],
['20141126',4668.610],
['20141127',4679.570],
['20141128',4707.770],
['20141201',4673.000],
['20141202',4728.030],
['20141203',4775.930],
['20141204',4873.190],
['20141205',4776.120],
['20141208',4740.380],
['20141209',4499.890],
['20141210',4645.740],
['20141211',4697.830],
['20141212',4796.700],
['20141215',4921.250],
['20141216',4898.190],
['20141217',4847.890],
['20141218',4854.170],
['20141219',4765.100],
['20141222',4480.400],
['20141223',4403.430],
['20141224',4494.860],
['20141225',4561.600],
['20141226',4565.650],
['20141229',4436.760],
['20141230',4345.150],
['20141231',4388.260],
['20150105',4405.720],
['20150106',4547.290],
['20150107',4530.160],
['20150108',4556.690],
['20150109',4577.070],
['20150112',4634.600],
['20150113',4775.190],
['20150114',4747.560],
['20150115',4753.400],
['20150116',4920.920],
['20150119',4839.490],
['20150120',5084.030],
['20150121',5130.520],
['20150122',5188.430],
['20150123',5065.630],
['20150126',5205.940],
['20150127',5236.350],
['20150128',5186.430],
['20150129',5174.300],
['20150130',5064.400],
['20150202',5122.430],
['20150203',5279.790],
['20150204',5285.680],
['20150205',5342.800],
['20150206',5211.140],
['20150209',5175.570],
['20150210',5305.500],
['20150211',5445.490],
['20150212',5472.340],
['20150213',5551.250],
['20150216',5758.640],
['20150217',5775.620],
['20150225',5696.710],
['20150226',5724.460],
['20150227',5815.020],
['20150302',5968.310],
['20150303',5886.540],
['20150304',5982.830],
['20150305',5986.780],
['20150306',5841.520],
['20150309',5950.650],
['20150310',6064.000],
['20150311',6054.920],
['20150312',6030.950],
['20150313',6170.770],
['20150316',6425.380],
['20150317',6469.300],
['20150318',6607.660],
['20150319',6652.090],
['20150320',6803.620],
['20150323',7079.530],
['20150324',7245.320],
['20150325',7325.440],
['20150326',7037.880],
['20150327',7130.300],
['20150330',7049.270],
['20150331',7178.110],
['20150401',7380.700],
['20150402',7562.950],
['20150403',7663.130],
['20150407',7801.610],
['20150408',7648.900],
['20150409',7630.030],
['20150410',7820.890],
['20150413',7957.470],
['20150414',7901.890],
['20150415',7517.640],
['20150416',7597.080],
['20150417',7589.740],
['20150420',7431.000],
['20150421',7799.390],
['20150422',8005.300],
['20150423',8103.360],
['20150424',8190.850],
['20150427',8217.720],
['20150428',7950.830],
['20150429',8258.640],
['20150430',8393.920],
['20150504',8354.110],
['20150505',8140.480],
['20150506',8261.890],
['20150507',8195.280],
['20150508',8704.340],
['20150511',9234.580],
['20150512',9510.480],
['20150513',9506.380],
['20150514',9402.500],
['20150515',9431.170],
['20150518',9797.160],
['20150519',9982.330],
['20150520',10232.350],
['20150521',10582.030],
['20150522',10550.200],
['20150525',10538.700],
['20150526',11024.520],
['20150527',11084.480],
['20150528',10492.420],
['20150529',10761.630],
['20150601',11342.000],
['20150602',11837.190],
['20150603',11947.000],
['20150604',11819.740],
['20150605',11745.270],
['20150608',11315.780],
['20150609',11313.330],
['20150610',11653.560],
['20150611',11785.410],
['20150612',11870.890],
['20150615',11422.360],
['20150616',10935.880],
['20150617',11283.370],
['20150618',10712.730],
['20150619',10120.790],
['20150623',10210.210],
['20150624',10267.500],
['20150625',9720.250],
['20150626',8886.320],
['20150629',8243.940],
['20150630',8719.840],
['20150701',8262.270],
['20150702',7795.370],
['20150703',7424.990],
['20150706',7121.130],
['20150707',6725.790],
['20150708',6626.930],
['20150709',6795.380],
['20150710',7003.710],
['20150713',7378.820],
['20150714',7648.080],
['20150715',7302.220],
['20150716',7389.500],
['20150717',7800.600],
['20150720',8013.310],
['20150721',8090.930],
['20150722',8219.190],
['20150723',8432.830],
['20150724',8296.420],
['20150727',7676.490],
['20150728',7343.140],
['20150729',7700.210],
['20150730',7420.030],
['20150731',7285.470],
['20150803',6914.470],
['20150804',7337.960],
['20150805',7213.230],
['20150806',7194.890],
['20150807',7493.620],
['20150810',7875.190],
['20150811',7872.750],
['20150812',7693.550],
['20150813',7924.970],
['20150814',7914.330],
['20150817',7950.280],
['20150818',7373.580],
['20150819',7595.040],
['20150820',7431.790],
['20150821',6945.660],
['20150824',6381.830],
['20150825',5883.690],
['20150826',5549.200],
['20150827',5725.200],
['20150828',6094.690],
['20150831',5828.860],
['20150901',5511.230],
['20150902',5354.170],
['20150907',5453.150],
['20150908',5731.260],
['20150909',5958.690],
['20150910',5818.480],
['20150911',5917.660],
['20150914',5467.950],
['20150915',5127.260],
['20150916',5505.440],
['20150917',5501.470],
['20150918',5618.610],
['20150921',5883.850],
['20150922',5887.690],
['20150923',5874.250],
['20150924',5944.330],
['20150925',5651.020],
['20150928',5884.210],
['20150929',5779.860],
['20150930',5770.210],
['20151008',6055.910],
['20151009',6148.090],
['20151012',6431.320],
['20151013',6552.370],
['20151014',6459.820],
['20151015',6734.180],
['20151016',6851.100],
['20151019',6820.380],
['20151020',7045.130],
['20151021',6574.560],
['20151022',6850.230],
['20151023',7016.620],
['20151026',7084.280],
['20151027',7195.790],
['20151028',7003.830],
['20151029',7032.430],
['20151030',7056.260],
['20151102',6901.390],
['20151103',6886.790],
['20151104',7294.550],
['20151105',7273.950],
['20151106',7549.300],
['20151109',7735.080],
['20151110',7769.810],
['20151111',7941.010],
['20151112',7890.620],
['20151113',7680.500],
['20151116',7946.510],
['20151117',7767.170],
['20151118',7595.690],
['20151119',7918.800],
['20151120',8048.560],
['20151123',7915.820],
['20151124',8049.220],
['20151125',8269.030],
['20151126',8134.080],
['20151127',7593.560],
['20151130',7654.760],
['20151201',7574.220],
['20151202',7457.410],
['20151203',7708.420],
['20151204',7665.120],
['20151207',7781.380],
['20151208',7673.210],
['20151209',7649.470],
['20151210',7721.320],
['20151211',7652.930],
['20151214',7753.120],
['20151215',7886.130],
['20151216',7948.590],
['20151217',8159.610],
['20151218',8061.290],
['20151221',8092.190],
['20151222',8185.040],
['20151223',8027.520],
['20151224',8048.870],
['20151225',8071.150],
['20151228',7929.630],
['20151229',8002.310],
['20151230',8152.350],
['20151231',7944.960],
['20160104',7268.260],
['20160105',7036.310],
['20160106',7192.070],
['20160107',6592.780],
['20160108',6566.840],
['20160111',6104.330],
['20160112',6162.120],
['20160113',5921.120],
['20160114',6204.520],
['20160115',6003.400],
['20160118',6175.550],
['20160119',6382.960],
['20160120',6286.410],
['20160121',6028.840],
['20160122',6138.930],
['20160125',6189.120],
['20160126',5716.290],
['20160127',5683.450],
['20160128',5413.410],
['20160129',5649.640],
['20160201',5599.570],
['20160202',5843.040],
['20160203',5874.120],
['20160204',5984.850],
['20160205',5891.180],
['20160215',5917.260],
['20160216',6201.540],
['20160217',6294.650],
['20160218',6260.580],
['20160219',6325.890],
['20160222',6430.660],
['20160223',6363.930],
['20160224',6321.650],
['20160225',5826.250],
['20160226',5784.510],
['20160229',5404.660],
['20160301',5522.020],
['20160302',5765.230],
['20160303',5760.450],
['20160304',5521.700],
['20160307',5655.490],
['20160308',5719.600],
['20160309',5615.820],
['20160310',5515.070],
['20160311',5491.400],
['20160314',5730.300],
['20160315',5671.130],
['20160316',5614.480],
['20160317',5879.610],
['20160318',6126.560],
['20160321',6300.150],
['20160322',6273.310],
['20160323',6385.100],
['20160324',6278.620],
['20160325',6290.230],
['20160328',6226.200],
['20160329',6113.990],
['20160330',6364.730],
['20160331',6362.140],
['20160401',6297.040],
['20160405',6497.050],
['20160406',6522.910],
['20160407',6389.010],
['20160408',6337.860],
['20160411',6457.500],
['20160412',6401.640],
['20160413',6486.820],
['20160414',6569.610],
['20160415',6555.720],
['20160418',6420.140],
['20160419',6455.730],
['20160420',6144.350],
['20160421',6032.060],
['20160422',6102.310],
['20160425',6059.070],
['20160426',6139.070],
['20160427',6108.590],
['20160428',6119.770],
['20160429',6089.700],
['20160503',6298.640],
['20160504',6312.790],
['20160505',6354.400],
['20160506',6097.530],
['20160509',5878.500],
['20160510',5864.120],
['20160511',5787.680],
['20160512',5808.480],
['20160513',5776.430],
['20160516',5895.330],
['20160517',5931.870],
['20160518',5767.380],
['20160519',5826.820],
['20160520',5917.860],
['20160523',6015.180],
['20160524',5952.590],
['20160525',5937.090],
['20160526',5986.230],
['20160527',5993.550],
['20160530',5976.780],
['20160531',6276.060],
['20160601',6331.000],
['20160602',6410.450],
['20160603',6443.530],
['20160606',6461.510],
['20160607',6451.680],
['20160608',6435.340],
['20160613',6043.620],
['20160614',6056.060],
['20160615',6293.420],
['20160616',6271.300],
['20160617',6312.010],
['20160620',6378.900],
['20160621',6272.220],
['20160622',6424.110],
['20160623',6416.510],
['20160624',6362.220],
['20160627',6574.970],
['20160628',6646.380],
['20160629',6620.850],
['20160630',6639.560],
['20160701',6593.020],
['20160704',6706.510],
['20160705',6705.050],
['20160706',6705.420],
['20160707',6671.650],
['20160708',6677.510],
['20160711',6622.780],
['20160712',6695.860],
['20160713',6772.750],
['20160714',6786.130],
['20160715',6731.070],
['20160718',6690.620],
['20160719',6748.160],
['20160720',6751.620],
['20160721',6771.420],
['20160722',6741.530],
['20160725',6748.660],
['20160726',6822.770],
['20160727',6487.420],
['20160728',6403.710],
['20160729',6345.140],
['20160801',6246.380],
['20160802',6292.690],
['20160803',6314.670],
['20160804',6387.870],
['20160805',6337.600],
['20160808',6413.890],
['20160809',6483.400],
['20160810',6447.470],
['20160811',6335.310],
['20160812',6392.170],
['20160815',6580.450],
['20160816',6598.500],
['20160817',6626.330],
['20160818',6608.620],
['20160819',6611.800],
['20160822',6524.080],
['20160823',6533.080],
['20160824',6572.700],
['20160825',6522.610],
['20160826',6544.450],
['20160829',6552.290],
['20160830',6551.490],
['20160831',6539.100],
['20160901',6501.780],
['20160902',6461.440],
['20160905',6486.510],
['20160906',6613.030],
['20160907',6580.150],
['20160908',6586.290],
['20160909',6523.780],
['20160912',6320.960],
['20160913',6376.500],
['20160914',6372.570],
['20160919',6430.280],
['20160920',6416.310],
['20160921',6436.780],
['20160922',6459.940],
['20160923',6431.570],
['20160926',6287.560],
['20160927',6338.660],
['20160928',6327.740],
['20160929',6342.350],
['20160930',6355.940],
['20161010',6530.680],
['20161011',6547.800],
['20161012',6540.570],
['20161013',6549.620],
['20161014',6516.030],
['20161017',6439.150],
['20161018',6535.990],
['20161019',6521.820],
['20161020',6572.720],
['20161021',6535.140],
['20161024',6571.760],
['20161025',6584.850],
['20161026',6541.800],
['20161027',6532.340],
['20161028',6479.300],
['20161031',6470.530],
['20161101',6531.090],
['20161102',6480.100],
['20161103',6510.110],
['20161104',6481.800],
['20161107',6468.830],
['20161108',6523.830],
['20161109',6464.610],
['20161110',6527.310],
['20161111',6523.150],
['20161114',6558.080],
['20161115',6597.240],
['20161116',6609.750],
['20161117',6550.290],
['20161118',6527.170],
['20161121',6530.870],
['20161122',6595.440],
['20161123',6553.920],
['20161124',6490.760],
['20161125',6536.860],
['20161128',6525.540],
['20161129',6496.070],
['20161130',6527.490],
['20161201',6522.130],
['20161202',6405.960],
['20161205',6378.080],
['20161206',6357.380],
['20161207',6408.620],
['20161208',6360.450],
['20161209',6319.780],
['20161212',5966.110],
['20161213',5968.390],
['20161214',5897.600],
['20161215',5944.100],
['20161216',6002.730],
['20161219',5952.790],
['20161220',5958.730],
['20161221',5995.870],
['20161222',5979.170],
['20161223',5926.080],
['20161226',5943.630],
['20161227',5933.820],
['20161228',5915.940],
['20161229',5898.630],
['20161230',5896.500],
['20170103',5945.220],
['20170104',6020.570],
['20170105',6016.860],
['20170106',5944.450],
['20170109',5963.360],
['20170110',5943.070],
['20170111',5879.460],
['20170112',5848.950],
['20170113',5745.090],
['20170116',5516.110],
['20170117',5625.560],
['20170118',5569.960],
['20170119',5564.590],
['20170120',5680.490],
['20170123',5718.800],
['20170124',5672.020],
['20170125',5699.860],
['20170126',5734.560],
['20170203',5704.310],
['20170206',5762.300],
['20170207',5742.940],
['20170208',5793.920],
['20170209',5825.290],
['20170210',5790.440],
['20170213',5821.140],
['20170214',5819.110],
['20170215',5774.210],
['20170216',5801.850],
['20170217',5755.070],
['20170220',5801.390],
['20170221',5871.700],
['20170222',5895.780],
['20170223',5906.160],
['20170224',5941.710],
['20170227',5905.620],
['20170228',5911.740],
['20170301',5920.810],
['20170302',5885.090],
['20170303',5924.390],
['20170306',6015.470],
['20170307',6056.920],
['20170308',6004.180],
['20170309',5979.970],
['20170310',5980.810],
['20170313',6052.300],
['20170314',6025.690],
['20170315',6018.240],
['20170316',6073.870],
['20170317',6023.150],
['20170320',6037.070],
['20170321',6045.210],
['20170322',6016.560],
['20170323',6031.360],
['20170324',6068.560],
['20170327',6031.510],
['20170328',6020.000],
['20170329',5984.280],
['20170330',5844.960],
['20170331',5871.750],
['20170405',5991.270],
['20170406',6000.280],
['20170407',6010.130],
['20170410',5924.670],
['20170411',5959.160],
['20170412',5884.750],
['20170413',5897.480],
['20170414',5832.090],
['20170417',5778.740],
['20170418',5723.170],
['20170419',5688.640],
['20170420',5711.120],
['20170421',5677.920],
['20170424',5577.780],
['20170425',5610.030],
['20170426',5646.790],
['20170427',5692.150],
['20170428',5708.560],
['20170502',5690.210],
['20170503',5686.050],
['20170504',5683.550],
['20170505',5618.610],
['20170508',5538.410],
['20170509',5585.790],
['20170510',5525.530],
['20170511',5486.060],
['20170512',5463.360],
['20170515',5535.120],
['20170516',5668.830],
['20170517',5655.900],
['20170518',5627.930],
['20170519',5608.900],
['20170522',5541.640],
['20170523',5404.810],
['20170524',5444.210],
['20170525',5468.960],
['20170526',5440.500],
['20170531',5427.930],
['20170601',5315.160],
['20170602',5378.610],
['20170605',5431.080],
['20170606',5465.070],
['20170607',5586.360],
['20170608',5596.910],
['20170609',5617.200],
['20170612',5521.830],
['20170613',5588.180],
['20170614',5552.270],
['20170615',5637.620],
['20170616',5627.050],
['20170619',5656.770],
['20170620',5661.860],
['20170621',5696.000],
['20170622',5611.160],
['20170623',5631.010],
['20170626',5716.130],
['20170627',5713.650],
['20170628',5663.590],
['20170629',5729.480],
['20170630',5720.630],
['20170703',5738.480],
['20170704',5734.240],
['20170705',5781.720],
['20170706',5775.010],
['20170707',5774.220],
['20170710',5698.700],
['20170711',5639.270],
['20170712',5629.830],
['20170713',5596.140],
['20170714',5571.460],
['20170717',5296.640],
['20170718',5314.290],
['20170719',5401.640],
['20170720',5427.190],
['20170721',5425.100],
['20170724',5448.510],
['20170725',5428.820],
['20170726',5398.600],
['20170727',5555.660],
['20170728',5538.030],
['20170731',5559.760],
['20170801',5558.920],
['20170802',5505.380],
['20170803',5496.460],
['20170804',5456.150],
['20170807',5488.130],
['20170808',5533.100],
['20170809',5530.910],
['20170810',5512.320],
['20170811',5467.460],
['20170814',5658.420],
['20170815',5709.200],
['20170816',5807.690],
['20170817',5854.000],
['20170818',5810.120],
['20170821',5857.740],
['20170822',5812.160],
['20170823',5786.930],
['20170824',5733.920],
['20170825',5793.410],
['20170828',5879.810],
['20170829',5851.170],
['20170830',5883.670],
['20170831',5905.740],
['20170901',5989.030],
['20170904',6096.280],
['20170905',6094.230],
['20170906',6143.150],
['20170907',6091.930],
['20170908',6078.900],
['20170911',6110.250],
['20170912',6117.000],
['20170913',6097.030],
['20170914',6067.320],
['20170915',6022.960],
['20170918',6088.480],
['20170919',6035.150],
['20170920',6097.390],
['20170921',6052.990],
['20170922',6023.640],
['20170925',5935.420],
['20170926',5936.070],
['20170927',5999.220],
['20170928',6031.160],
['20170929',6075.970],
['20171009',6197.450],
['20171010',6246.600],
['20171011',6189.040],
['20171012',6205.440],
['20171013',6269.180],
['20171016',6151.730],
['20171017',6138.030],
['20171018',6118.610],
['20171019',6041.890],
['20171020',6089.120],
['20171023',6138.180],
['20171024',6115.160],
['20171025',6203.830],
['20171026',6210.250],
['20171027',6171.240],
['20171030',6077.970],
['20171031',6146.460],
['20171101',6136.580],
['20171102',6085.660],
['20171103',6090.600],
['20171106',6209.640],
['20171107',6261.770],
['20171108',6253.320],
['20171109',6349.560],
['20171110',6403.290],
['20171113',6474.610],
['20171114',6386.620],
['20171115',6284.260],
['20171116',6310.810],
['20171117',6090.330],
['20171120',6199.820],
['20171121',6257.490],
['20171122',6238.210],
['20171123',6004.520],
['20171124',5935.320],
['20171127',5804.840],
['20171128',5950.020],
['20171129',5909.080],
['20171130',5844.480],
['20171201',5951.280],
['20171204',5928.540],
['20171205',5781.560],
['20171206',5871.320],
['20171207',5834.220],
['20171208',5929.080],
['20171211',6059.130],
['20171212',5994.100],
['20171213',6035.780],
['20171214',6007.260],
['20171215',5940.940],
['20171218',5863.630],
['20171219',5938.840],
['20171220',5862.320],
['20171221',5939.000],
['20171222',5897.200],
['20171225',5782.710],
['20171226',5805.650],
['20171227',5718.090],
['20171228',5714.360],
['20171229',5780.150],
['20180102',5817.100],
['20180103',5893.700],
['20180104',5896.360],
['20180105',5854.980],
['20180108',5829.550],
['20180109',5848.220],
['20180110',5858.320],
['20180111',5963.450],
['20180112',5887.900],
['20180115',5710.670],
['20180116',5695.400],
['20180117',5665.630],
['20180118',5640.690],
['20180119',5665.940],
['20180122',5763.140],
['20180123',5749.670],
['20180124',5859.920],
['20180125',5819.260],
['20180126',5804.720],
['20180129',5660.380],
['20180130',5646.010],
['20180131',5490.560],
['20180201',5301.650],
['20180202',5328.580],
['20180205',5268.230],
['20180206',4970.610],
['20180207',5011.090],
['20180208',5141.020],
['20180209',5004.930],
['20180212',5179.650],
['20180213',5190.380],
['20180214',5181.970],
['20180222',5313.420],
['20180223',5291.740],
['20180226',5506.620],
['20180227',5555.530],
['20180228',5598.950],
['20180301',5763.680],
['20180302',5673.550],
['20180305',5761.480],
['20180306',5806.550],
['20180307',5746.930],
['20180308',5762.110],
['20180309',5957.940],
['20180312',6070.530],
['20180313',6025.570],
['20180314',5909.980],
['20180315',5910.800],
['20180316',5838.190],
['20180319',5896.590],
['20180320',5909.550],
['20180321',5842.350],
['20180322',5820.370],
['20180323',5479.660],
['20180326',5642.080],
['20180327',5859.260],
['20180328',5809.570],
['20180329',5812.330],
['20180330',5970.220],
['20180402',6026.660],
['20180403',5944.280],
['20180404',5820.070],
['20180409',5842.590],
['20180410',5842.700],
['20180411',5868.530],
['20180412',5830.890],
['20180413',5863.410],
['20180416',5940.310],
['20180417',5717.420],
['20180418',5874.450],
['20180419',5862.860],
['20180420',5729.270],
['20180423',5635.470],
['20180424',5789.310],
['20180425',5801.110],
['20180426',5661.380],
['20180427',5641.020],
['20180502',5592.710],
['20180503',5717.880],
['20180504',5662.610],
['20180507',5769.600],
['20180508',5807.310],
['20180509',5791.770],
['20180510',5769.200],
['20180511',5679.670],
['20180514',5670.230],
['20180515',5739.790],
['20180516',5679.270],
['20180517',5649.790],
['20180518',5651.530],
['20180521',5773.910],
['20180522',5783.810],
['20180523',5728.170],
['20180524',5673.360],
['20180525',5541.940],
['20180528',5499.320],
['20180529',5479.900],
['20180530',5292.720],
['20180531',5354.520],
['20180601',5273.570],
['20180604',5263.950],
['20180605',5427.190],
['20180606',5416.890],
['20180607',5375.210],
['20180608',5334.080],
['20180611',5303.150],
['20180612',5341.590],
['20180613',5239.260],
['20180614',5218.010],
['20180615',5100.600],
['20180619',4751.110],
['20180620',4793.500],
['20180621',4592.720],
['20180622',4673.150],
['20180625',4627.890],
['20180626',4745.490],
['20180627',4707.850],
['20180628',4677.900],
['20180629',4902.560],
['20180702',4826.410],
['20180703',4933.690],
['20180704',4792.960],
['20180705',4683.120],
['20180706',4709.290],
['20180709',4835.140],
['20180710',4866.490],
['20180711',4709.670],
['20180712',4905.300],
['20180713',4923.770],
['20180716',4950.960],
['20180717',4964.660],
['20180718',4908.110],
['20180719',4872.310],
['20180720',4961.980],
['20180723',5044.870],
['20180724',5088.630],
['20180725',5087.670],
['20180726',4988.190],
['20180727',4935.810],
['20180730',4848.060],
['20180731',4832.610],
['20180801',4754.260],
['20180802',4614.770],
['20180803',4499.560],
['20180806',4422.250],
['20180807',4558.980],
['20180808',4446.700],
['20180809',4646.830],
['20180810',4686.840],
['20180813',4768.390],
['20180814',4707.100],
['20180815',4601.340],
['20180816',4563.430],
['20180817',4476.640],
['20180820',4554.750],
['20180821',4589.300],
['20180822',4511.730],
['20180823',4574.320],
['20180824',4557.740],
['20180827',4706.230],
['20180828',4705.350],
['20180829',4683.580],
['20180830',4590.120],
['20180831',4539.030],
['20180903',4549.080],
['20180904',4634.450],
['20180905',4560.920],
['20180906',4561.340],
['20180907',4488.010],
['20180910',4335.190],
['20180911',4366.530],
['20180912',4327.720],
['20180913',4378.060],
['20180914',4286.680],
['20180917',4220.430],
['20180918',4294.870],
['20180919',4344.370],
['20180920',4322.180],
['20180921',4390.060],
['20180925',4369.830],
['20180926',4387.900],
['20180927',4302.050],
['20180928',4331.430],
['20181008',4125.460],
['20181009',4095.610],
['20181010',4098.490],
['20181011',3784.210],
['20181012',3769.780],
['20181015',3727.160],
['20181016',3620.400],
['20181017',3696.940],
['20181018',3625.150],
['20181019',3749.280],
['20181022',3951.500],
['20181023',3851.430],
['20181024',3824.820],
['20181025',3781.910],
['20181026',3771.670],
['20181029',3742.590],
['20181030',3757.620],
['20181031',3815.670],
['20181101',3886.480],
['20181102',4051.220],
['20181105',4047.280],
['20181106',4023.650],
['20181107',4005.680],
['20181108',3954.260],
['20181109',3952.330],
['20181112',4101.020],
['20181113',4152.940],
['20181114',4136.680],
['20181115',4233.570],
['20181116',4287.720],
['20181119',4273.220],
['20181120',4126.660],
['20181121',4130.240],
['20181122',4133.360],
['20181123',3967.560],
['20181126',3953.790],
['20181127',3984.550],
['20181128',4053.770],
['20181129',3936.690],
['20181130',3978.270],
['20181203',4133.280],
['20181204',4133.750],
['20181205',4096.530],
['20181206',3988.510],
['20181207',4009.370],
['20181210',3974.500],
['20181211',4005.870],
['20181212',3990.050],
['20181213',4041.150],
['20181214',3928.990],
['20181217',3903.900],
['20181218',3872.630],
['20181219',3819.640],
['20181220',3844.810],
['20181221',3831.440],
['20181224',3874.870],
['20181225',3850.190],
['20181226',3824.480],
['20181227',3762.700],
['20181228',3744.440],
['20190102',3733.850],
['20190103',3686.340],
['20190104',3802.280],
['20190107',3906.380],
['20190108',3896.860],
['20190109',3913.060],
['20190110',3912.930],
['20190111',3946.280],
['20190114',3899.380],
['20190115',3976.580],
['20190116',3961.510],
['20190117',3899.830],
['20190118',3931.470],
['20190121',3964.000],
['20190122',3912.660],
['20190123',3903.450],
['20190124',3964.290],
['20190125',3956.750],
['20190128',3948.140],
['20190129',3874.330],
['20190130',3810.580],
['20190131',3787.480],
['20190201',3922.760],
['20190211',4068.490],
['20190212',4128.340],
['20190213',4262.920],
['20190214',4280.360],
['20190215',4266.730],
['20190218',4473.540],
['20190219',4502.440],
['20190220',4492.320],
['20190221',4498.600],
['20190222',4674.640],
['20190225',4981.680],
['20190226',4963.910],
['20190227',4884.460],
['20190228',4891.030],
['20190301',4932.490],
['20190304',5051.910],
['20190305',5268.810],
['20190306',5358.920],
['20190307',5448.170],
['20190308',5360.350],
['20190311',5568.420],
['20190312',5715.190],
['20190313',5436.740],
['20190314',5253.330],
['20190315',5265.580],
['20190318',5377.980],
['20190319',5439.840],
['20190320',5395.830],
['20190321',5491.190],
['20190322',5491.610],
['20190325',5427.060],
['20190326',5282.770],
['20190327',5273.400],
['20190328',5220.080],
['20190329',5411.890],
['20190401',5653.340],
['20190402',5669.460],
['20190403',5717.040],
['20190404',5699.580],
['20190408',5563.030],
['20190409',5576.810],
['20190410',5522.460],
['20190411',5397.860],
['20190412',5409.400],
['20190415',5351.910],
['20190416',5513.200],
['20190417',5524.680],
['20190418',5479.070],
['20190419',5523.570],
['20190422',5445.760],
['20190423',5341.970],
['20190424',5465.050],
['20190425',5241.590],
['20190426',5213.130],
['20190429',5010.880],
['20190430',5029.010],
['20190506',4591.690],
['20190507',4630.400],
['20190508',4628.990],
['20190509',4599.900],
['20190510',4824.880],
['20190513',4719.250],
['20190514',4692.310],
['20190515',4775.310],
['20190516',4747.960],
['20190517',4593.570],
['20190520',4627.650],
['20190521',4721.730],
['20190522',4750.870],
['20190523',4604.410],
['20190524',4529.270],
['20190527',4719.970],
['20190528',4724.440],
['20190529',4729.030],
['20190530',4658.710],
['20190531',4646.580],
['20190603',4610.000],
['20190604',4549.830],
['20190605',4565.150],
['20190606',4437.240],
['20190610',4526.040],
['20190611',4706.760],
['20190612',4668.680],
['20190613',4688.590],
['20190614',4565.410],
['20190617',4546.990],
['20190618',4560.360],
['20190619',4668.920],
['20190620',4759.430],
['20190621',4874.830],
['20190624',4846.610],
['20190625',4770.960],
['20190626',4778.700],
['20190627',4867.620],
['20190628',4796.550],
['20190701',5043.010],
['20190702',4990.220],
['20190703',4900.020],
['20190704',4860.110],
['20190705',4886.490],
['20190708',4699.390],
['20190709',4705.120],
['20190710',4695.070],
['20190711',4671.060],
['20190712',4676.430],
['20190715',4779.900],
['20190716',4792.910],
['20190717',4823.030],
['20190718',4705.870],
['20190719',4725.680],
['20190722',4636.840],
['20190723',4726.780],
['20190724',4817.570],
['20190725',4899.510],
['20190726',4894.940],
['20190729',4919.710],
['20190730',4912.880],
['20190731',4902.650],
['20190801',4894.700],
['20190802',4793.130],
['20190805',4721.380],
['20190806',4617.310],
['20190807',4558.160],
['20190808',4626.840],
['20190809',4561.520],
['20190812',4733.360],
['20190813',4683.900],
['20190814',4723.540],
['20190815',4802.590],
['20190816',4846.410],
['20190819',5078.470],
['20190820',5076.170],
['20190821',5099.910],
['20190822',5102.400],
['20190823',5086.850],
['20190826',5031.430],
['20190827',5139.590],
['20190828',5105.890],
['20190829',5148.460],
['20190830',5065.010],
['20190902',5248.390],
['20190903',5367.270],
['20190904',5411.040],
['20190905',5511.860],
['20190906',5555.500],
['20190909',5781.410],
['20190910',5711.210],
['20190911',5647.880],
['20190912',5678.650],
['20190916',5748.640],
['20190917',5590.700],
['20190918',5593.340],
['20190919',5705.780],
['20190920',5741.440],
['20190923',5744.720],
['20190924',5772.030],
['20190925',5585.500],
['20190926',5363.700],
['20190927',5465.250],
['20190930',5334.800],
['20191008',5278.040],
['20191009',5321.030],
['20191010',5418.890],
['20191011',5418.680],
['20191014',5538.330],
['20191015',5386.500],
['20191016',5365.960],
['20191017',5392.460],
['20191018',5288.060],
['20191021',5277.470],
['20191022',5376.390],
['20191023',5345.770],
['20191024',5328.050],
['20191025',5390.120],
['20191028',5610.290],
['20191029',5476.250],
['20191030',5436.920],
['20191031',5357.670],
['20191101',5408.370],
['20191104',5457.450],
['20191105',5500.210],
['20191106',5424.600],
['20191107',5472.800],
['20191108',5479.060],
['20191111',5353.680],
['20191112',5350.980],
['20191113',5384.480],
['20191114',5467.910],
['20191115',5420.790],
['20191118',5443.100],
['20191119',5567.170],
['20191120',5512.150],
['20191121',5507.850],
['20191122',5387.500],
['20191125',5261.620],
['20191126',5299.590],
['20191127',5342.500],
['20191128',5326.660],
['20191129',5353.600],
['20191202',5400.220],
['20191203',5446.250],
['20191204',5447.020],
['20191205',5555.760],
['20191206',5620.710],
['20191209',5649.680],
['20191210',5736.370],
['20191211',5684.430],
['20191212',5701.030],
['20191213',5787.660],
['20191216',5971.750],
['20191217',6042.270],
['20191218',6053.910],
['20191219',6014.660],
['20191220',5903.400],
['20191223',5732.140],
['20191224',5847.930],
['20191225',5942.470],
['20191226',5964.360],
['20191227',5833.370],
['20191230',5851.760],
['20191231',5861.100],
['20200102',6064.010],
['20200103',6104.970],
['20200106',6185.200],
['20200107',6254.910],
['20200108',6148.290],
['20200109',6310.230],
['20200110',6314.980],
['20200113',6470.810],
['20200114',6423.100],
['20200115',6504.060],
['20200116',6511.540],
['20200117',6476.850],
['20200120',6642.550],
['20200121',6560.220],
['20200122',6729.880],
['20200123',6471.430],
['20200203',5860.500],
['20200204',6011.570],
['20200205',6128.860],
['20200206',6355.020],
['20200207',6524.220],
['20200210',6519.080],
['20200211',6529.600],
['20200212',6725.180],
['20200213',6708.440],
['20200214',6743.670],
['20200217',7014.740],
['20200218',7200.170],
['20200219',7106.080],
['20200220',7304.620],
['20200221',7515.080],
['20200224',7812.760],
['20200225',7857.800],
['20200226',7402.960],
['20200227',7382.700],
['20200228',6895.730],
['20200302',7136.120],
['20200303',7217.710],
['20200304',7115.660],
['20200305',7146.320],
['20200306',7067.580],
['20200309',6628.460],
['20200310',6962.880],
['20200311',6775.680],
['20200312',6664.800],
['20200313',6668.300],
['20200316',6227.100],
['20200317',6268.050],
['20200318',6172.530],
['20200319',6319.740],
['20200320',6318.440],
['20200323',5927.870],
['20200324',6031.910],
['20200325',6196.090],
['20200326',6097.790],
['20200327',6010.750],
['20200330',5794.640],
['20200331',5767.690],
['20200401',5804.100],
['20200402',6080.400],
['20200403',6000.170],
['20200407',6214.680],
['20200408',6239.360],
['20200409',6269.740],
['20200410',6023.310],
['20200413',5880.980],
['20200414',6073.470],
['20200415',6066.020],
['20200416',6141.650],
['20200417',6197.320],
['20200420',6284.880],
['20200421',6240.740],
['20200422',6273.240],
['20200423',6171.060],
['20200424',6044.140],
['20200427',6022.910],
['20200428',6033.920],
['20200429',6041.640],
['20200430',6311.720],
['20200506',6499.910],
['20200507',6453.880],
['20200508',6542.740],
['20200511',6518.770],
['20200512',6551.230],
['20200513',6561.310],
['20200514',6534.140],
['20200515',6601.080],
['20200518',6392.970],
['20200519',6566.860],
['20200520',6458.360],
['20200521',6316.150],
['20200522',6186.790],
['20200525',6101.820],
['20200526',6277.580],
['20200527',6159.020],
['20200528',6145.960],
['20200529',6158.850],
['20200601',6451.520],
['20200602',6504.000],
['20200603',6509.720],
['20200604',6474.950],
['20200605',6533.120],
['20200608',6528.620],
['20200609',6563.350],
['20200610',6592.900],
['20200611',6585.650],
['20200612',6569.630],
['20200615',6491.120],
['20200616',6636.360],
['20200617',6653.350],
['20200618',6754.410],
['20200619',6799.960],
['20200622',6909.520],
['20200623',6970.940],
['20200624',7016.500],
['20200629',6916.830],
['20200630',7118.200],
['20200701',7142.910],
['20200702',7225.380],
['20200703',7262.690],
['20200706',7588.830],
['20200707',7768.450],
['20200708',7987.620],
['20200709',8248.190],
['20200710',8187.210],
['20200713',8449.610],
['20200714',8285.750],
['20200715',7913.710],
['20200716',7451.300],
['20200717',7474.810],
['20200720',7654.190],
['20200721',7687.090],
['20200722',7797.260],
['20200723',7693.200],
['20200724',7253.450],
['20200727',7290.130],
['20200728',7391.920],
['20200729',7668.550],
['20200730',7560.280],
['20200731',7725.320],
['20200803',7970.170],
['20200804',7848.680],
['20200805',7930.120],
['20200806',7924.330],
['20200807',7741.790],
['20200810',7727.470],
['20200811',7557.180],
['20200812',7533.260],
['20200813',7507.190],
['20200814',7638.600],
['20200817',7789.770],
['20200818',7767.220],
['20200819',7530.900],
['20200820',7500.120],
['20200821',7564.970],
['20200824',7721.180],
['20200825',7707.890],
['20200826',7482.540],
['20200827',7566.210],
['20200828',7661.710],
['20200831',7626.060],
['20200901',7682.520],
['20200902',7741.090],
['20200903',7635.750],
['20200904',7651.500],
['20200907',7478.230],
['20200908',7502.860],
['20200909',7218.230],
['20200910',7000.580],
['20200911',7158.310],
['20200914',7273.020],
['20200915',7280.470],
['20200916',7191.520],
['20200917',7228.790],
['20200918',7331.000],
['20200921',7285.380],
['20200922',7184.690],
['20200923',7234.250],
['20200924',7048.690],
['20200925',7010.050],
['20200928',6953.940],
['20200929',7049.470],
['20200930',7023.630]];
var source='wstock.net';
|
amaabca/ama_styles
|
config/routes.rb
|
<gh_stars>0
# frozen_string_literal: true
AMA::Styles::Engine.routes.draw do
end
|
taotaomima/Shopping0224
|
shopping-administrator-back/src/main/java/com/gtt/shoppingproductback/service/CustomerServiceImpl.java
|
package com.gtt.shoppingproductback.service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.gtt.shoppingproductback.dao.CustomerMapper;
import com.gtt.shoppingproductback.dto.in.CustomerCreateIn;
import com.gtt.shoppingproductback.dto.in.CustomerSearchIn;
import com.gtt.shoppingproductback.dto.in.CustomerSetStatusIn;
import com.gtt.shoppingproductback.dto.out.CustomerListOut;
import com.gtt.shoppingproductback.dto.out.CustomerOut;
import com.gtt.shoppingproductback.po.Customer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class CustomerServiceImpl implements CustomerService {
@Resource
private CustomerMapper customerMapper;
@Override
public Page<Customer> search(CustomerSearchIn customerSearchIn,Integer pageNum) {
PageHelper.startPage(pageNum,5);
Page<Customer> search = customerMapper.search(customerSearchIn.getUsername(),customerSearchIn.getRealName(),customerSearchIn.getStatus(),
customerSearchIn.getEmail(),customerSearchIn.getMobile());
return search;
}
@Override
public void disable(CustomerSetStatusIn customerSetStatusIn) {
Customer customer = new Customer();
customer.setCustomerId(customerSetStatusIn.getCustomerId());
customer.setStatus(customerSetStatusIn.getStatus());
customerMapper.updateByPrimaryKeySelective(customer);
}
@Override
public Customer getById(Integer customerId) {
Customer customer = customerMapper.selectByPrimaryKey(customerId);
return customer;
}
}
|
realrespecter/PUBG-FULL-SDK
|
SDK/PUBG_MediaAssets_parameters.hpp
|
#pragma once
// PUBG FULL SDK - Generated By Respecter (5.3.4.11 [06/03/2019]) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "PUBG_MediaAssets_classes.hpp"
namespace SDK
{
//---------------------------------------------------------------------------
//Parameters
//---------------------------------------------------------------------------
// Function MediaAssets.MediaPlayer.SupportsSeeking
struct UMediaPlayer_SupportsSeeking_Params
{
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.SupportsScrubbing
struct UMediaPlayer_SupportsScrubbing_Params
{
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.SupportsRate
struct UMediaPlayer_SupportsRate_Params
{
float* Rate; // (Parm, ZeroConstructor, IsPlainOldData)
bool* Unthinned; // (Parm, ZeroConstructor, IsPlainOldData)
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.SetVideoTexture
struct UMediaPlayer_SetVideoTexture_Params
{
class UMediaTexture** NewTexture; // (Parm, ZeroConstructor, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.SetSoundWave
struct UMediaPlayer_SetSoundWave_Params
{
class UMediaSoundWave** NewSoundWave; // (Parm, ZeroConstructor, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.SetRate
struct UMediaPlayer_SetRate_Params
{
float* Rate; // (Parm, ZeroConstructor, IsPlainOldData)
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.SetOverlays
struct UMediaPlayer_SetOverlays_Params
{
class UMediaOverlays** NewOverlays; // (Parm, ZeroConstructor, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.SetLooping
struct UMediaPlayer_SetLooping_Params
{
bool* Looping; // (Parm, ZeroConstructor, IsPlainOldData)
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.SetDesiredPlayerName
struct UMediaPlayer_SetDesiredPlayerName_Params
{
struct FName* PlayerName; // (Parm, ZeroConstructor, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.SelectTrack
struct UMediaPlayer_SelectTrack_Params
{
EMediaPlayerTrack* TrackType; // (Parm, ZeroConstructor, IsPlainOldData)
int* TrackIndex; // (Parm, ZeroConstructor, IsPlainOldData)
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.Seek
struct UMediaPlayer_Seek_Params
{
struct FTimespan* Time; // (ConstParm, Parm, OutParm, ReferenceParm)
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.Rewind
struct UMediaPlayer_Rewind_Params
{
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.Reopen
struct UMediaPlayer_Reopen_Params
{
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.Previous
struct UMediaPlayer_Previous_Params
{
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.Play
struct UMediaPlayer_Play_Params
{
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.Pause
struct UMediaPlayer_Pause_Params
{
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.OpenUrl
struct UMediaPlayer_OpenUrl_Params
{
class FString* URL; // (Parm, ZeroConstructor)
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.OpenSource
struct UMediaPlayer_OpenSource_Params
{
class UMediaSource** MediaSource; // (Parm, ZeroConstructor, IsPlainOldData)
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.OpenPlaylistIndex
struct UMediaPlayer_OpenPlaylistIndex_Params
{
class UMediaPlaylist** InPlaylist; // (Parm, ZeroConstructor, IsPlainOldData)
int* Index; // (Parm, ZeroConstructor, IsPlainOldData)
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.OpenPlaylist
struct UMediaPlayer_OpenPlaylist_Params
{
class UMediaPlaylist** InPlaylist; // (Parm, ZeroConstructor, IsPlainOldData)
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.OpenFile
struct UMediaPlayer_OpenFile_Params
{
class FString* FilePath; // (Parm, ZeroConstructor)
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.Next
struct UMediaPlayer_Next_Params
{
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.IsReady
struct UMediaPlayer_IsReady_Params
{
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.IsPreparing
struct UMediaPlayer_IsPreparing_Params
{
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.IsPlaying
struct UMediaPlayer_IsPlaying_Params
{
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.IsPaused
struct UMediaPlayer_IsPaused_Params
{
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.IsLooping
struct UMediaPlayer_IsLooping_Params
{
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.GetUrl
struct UMediaPlayer_GetUrl_Params
{
class FString ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm)
};
// Function MediaAssets.MediaPlayer.GetTrackLanguage
struct UMediaPlayer_GetTrackLanguage_Params
{
EMediaPlayerTrack* TrackType; // (Parm, ZeroConstructor, IsPlainOldData)
int* TrackIndex; // (Parm, ZeroConstructor, IsPlainOldData)
class FString ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm)
};
// Function MediaAssets.MediaPlayer.GetTrackDisplayName
struct UMediaPlayer_GetTrackDisplayName_Params
{
EMediaPlayerTrack* TrackType; // (Parm, ZeroConstructor, IsPlainOldData)
int* TrackIndex; // (Parm, ZeroConstructor, IsPlainOldData)
struct FText ReturnValue; // (Parm, OutParm, ReturnParm)
};
// Function MediaAssets.MediaPlayer.GetTime
struct UMediaPlayer_GetTime_Params
{
struct FTimespan ReturnValue; // (Parm, OutParm, ReturnParm)
};
// Function MediaAssets.MediaPlayer.GetSelectedTrack
struct UMediaPlayer_GetSelectedTrack_Params
{
EMediaPlayerTrack* TrackType; // (Parm, ZeroConstructor, IsPlainOldData)
int ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.GetReverseRates
struct UMediaPlayer_GetReverseRates_Params
{
bool* Unthinned; // (Parm, ZeroConstructor, IsPlainOldData)
struct FFloatRange ReturnValue; // (Parm, OutParm, ReturnParm)
};
// Function MediaAssets.MediaPlayer.GetRate
struct UMediaPlayer_GetRate_Params
{
float ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.GetPlayerName
struct UMediaPlayer_GetPlayerName_Params
{
struct FName ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.GetNumTracks
struct UMediaPlayer_GetNumTracks_Params
{
EMediaPlayerTrack* TrackType; // (Parm, ZeroConstructor, IsPlainOldData)
int ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.GetForwardRates
struct UMediaPlayer_GetForwardRates_Params
{
bool* Unthinned; // (Parm, ZeroConstructor, IsPlainOldData)
struct FFloatRange ReturnValue; // (Parm, OutParm, ReturnParm)
};
// Function MediaAssets.MediaPlayer.GetDuration
struct UMediaPlayer_GetDuration_Params
{
struct FTimespan ReturnValue; // (Parm, OutParm, ReturnParm)
};
// Function MediaAssets.MediaPlayer.GetDesiredPlayerName
struct UMediaPlayer_GetDesiredPlayerName_Params
{
struct FName ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.Close
struct UMediaPlayer_Close_Params
{
};
// Function MediaAssets.MediaPlayer.CanPlayUrl
struct UMediaPlayer_CanPlayUrl_Params
{
class FString* URL; // (Parm, ZeroConstructor)
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.CanPlaySource
struct UMediaPlayer_CanPlaySource_Params
{
class UMediaSource** MediaSource; // (Parm, ZeroConstructor, IsPlainOldData)
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlayer.CanPause
struct UMediaPlayer_CanPause_Params
{
bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlaylist.RemoveAt
struct UMediaPlaylist_RemoveAt_Params
{
int* Index; // (Parm, ZeroConstructor, IsPlainOldData)
};
// Function MediaAssets.MediaPlaylist.Remove
struct UMediaPlaylist_Remove_Params
{
class UMediaSource** MediaSource; // (Parm, ZeroConstructor, IsPlainOldData)
};
// Function MediaAssets.MediaPlaylist.Num
struct UMediaPlaylist_Num_Params
{
int ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlaylist.Insert
struct UMediaPlaylist_Insert_Params
{
class UMediaSource** MediaSource; // (Parm, ZeroConstructor, IsPlainOldData)
int* Index; // (Parm, ZeroConstructor, IsPlainOldData)
};
// Function MediaAssets.MediaPlaylist.GetRandom
struct UMediaPlaylist_GetRandom_Params
{
int InOutIndex; // (Parm, OutParm, ZeroConstructor, IsPlainOldData)
class UMediaSource* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlaylist.GetPrevious
struct UMediaPlaylist_GetPrevious_Params
{
int InOutIndex; // (Parm, OutParm, ZeroConstructor, IsPlainOldData)
class UMediaSource* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlaylist.GetNext
struct UMediaPlaylist_GetNext_Params
{
int InOutIndex; // (Parm, OutParm, ZeroConstructor, IsPlainOldData)
class UMediaSource* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlaylist.Get
struct UMediaPlaylist_Get_Params
{
int* Index; // (Parm, ZeroConstructor, IsPlainOldData)
class UMediaSource* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaPlaylist.Add
struct UMediaPlaylist_Add_Params
{
class UMediaSource** MediaSource; // (Parm, ZeroConstructor, IsPlainOldData)
};
// Function MediaAssets.FileMediaSource.SetFilePath
struct UFileMediaSource_SetFilePath_Params
{
class FString* path; // (Parm, ZeroConstructor)
};
// Function MediaAssets.MediaTexture.GetWidth
struct UMediaTexture_GetWidth_Params
{
int ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaTexture.GetHeight
struct UMediaTexture_GetHeight_Params
{
int ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function MediaAssets.MediaTexture.GetAspectRatio
struct UMediaTexture_GetAspectRatio_Params
{
float ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
|
nokia/osgi-microfeatures
|
com.alcatel.as.ioh.impl/src/com/alcatel/as/ioh/impl/client/ClientFactoryImpl.java
|
// Copyright 2000-2021 Nokia
//
// Licensed under the Apache License 2.0
// SPDX-License-Identifier: Apache-2.0
//
package com.alcatel.as.ioh.impl.client;
import java.util.*;
import java.net.*;
import java.nio.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
import com.alcatel.as.ioh.*;
import com.alcatel.as.ioh.client.*;
import com.alcatel.as.ioh.server.*;
import com.alcatel.as.ioh.impl.conf.*;
import org.osgi.framework.*;
import org.osgi.util.tracker.*;
import org.apache.log4j.Logger;
import com.alcatel.as.util.config.ConfigConstants;
import com.alcatel.as.service.concurrent.PlatformExecutors;
import alcatel.tess.hometop.gateways.reactor.*;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Deactivate;
import org.osgi.service.component.annotations.Modified;
import org.osgi.service.component.annotations.ConfigurationPolicy;
import org.osgi.service.component.annotations.ReferencePolicy;
import org.osgi.service.component.annotations.ReferenceCardinality;
import com.alcatel.as.service.discovery.Advertisement;
import com.alcatel_lucent.as.management.annotation.config.*;
@Component(service={ClientFactory.class}, configurationPolicy = ConfigurationPolicy.REQUIRE)
public class ClientFactoryImpl implements ClientFactory{
public static final Logger LOGGER = Logger.getLogger("as.ioh.client");
private volatile Map<String, ClusterInstance> _tcpClusters = new ConcurrentHashMap<String, ClusterInstance> ();
private volatile Map<String, ClusterInstance> _udpClusters = new ConcurrentHashMap<String, ClusterInstance> ();
private ReactorProvider _reactorProvider;
private PlatformExecutors _execs;
private String _agent;
private BundleContext _osgi;
@FileDataProperty(title="Client",
fileData="defTcpClient.txt",
required=true,
dynamic=true,
section="Tcp",
help="Indicates the destinations.")
public final static String CONF_TCP_CLIENT = "conf.client.tcp";
@FileDataProperty(title="Client",
fileData="defUdpClient.txt",
required=true,
dynamic=true,
section="Udp",
help="Indicates the destinations.")
public final static String CONF_UDP_CLIENT = "conf.client.udp";
@Reference
public void setReactorProvider (ReactorProvider provider){
LOGGER.info ("@Reference setReactorProvider");
_reactorProvider = provider;
}
@Reference
public void setPlatformExecutors (PlatformExecutors execs){
LOGGER.info ("@Reference setPlatformExecutors");
_execs = execs;
}
public PlatformExecutors getPlatformExecutors (){
return _execs;
}
@Reference(cardinality = ReferenceCardinality.AT_LEAST_ONE, policy = ReferencePolicy.DYNAMIC, target="(service.pid=system)")
public void setSystemConf (Dictionary<String, String> conf) throws Exception {
_agent = conf.get (ConfigConstants.INSTANCE_NAME);
LOGGER.info ("@Reference setSystemConf : "+_agent);
}
public void unsetSystemConf (Dictionary<String, String> conf) throws Exception {
// new bnd DS annotations require to have unset method for dynamic dependencies [...]
}
@Activate
public void activate (BundleContext ctx, Map<String, String> conf){
LOGGER.info ("@Activate");
_osgi = ctx;
GogoCommands.registerCommands (ctx);
update (conf);
}
public BundleContext getBundleContext (){ return _osgi;}
@Modified
public synchronized void update (Map<String, String> conf) {
LOGGER.info ("@Modified");
newTcpClientConfig (conf.get (CONF_TCP_CLIENT));
newUdpClientConfig (conf.get (CONF_UDP_CLIENT));
}
public synchronized void newTcpClientConfig (String xml){
ClientsConfiguration clientConf = null;
try{
clientConf = ClientsConfiguration.parse (xml, _agent);
}catch(Exception t){
LOGGER.error ("Exception while parsing tcp client configuration - configuration ignored : "+xml, t);
return;
}
for (ClientsConfiguration.Client client : clientConf.getClients ()){
ClusterInstance inst = new ClusterInstance (client.getId ()).read (client, clientConf.getProperties ());
_tcpClusters.put (inst.getId (), inst);
}
}
public synchronized void newUdpClientConfig (String xml){
ClientsConfiguration clientConf = null;
try{
clientConf = ClientsConfiguration.parse (xml, _agent);
}catch(Exception t){
LOGGER.error ("Exception while parsing udp client configuration - configuration ignored : "+xml, t);
return;
}
for (ClientsConfiguration.Client client : clientConf.getClients ()){
ClusterInstance inst = new ClusterInstance (client.getId ()).read (client, clientConf.getProperties ());
_udpClusters.put (inst.getId (), inst);
}
}
public TcpClient newTcpClient (String id, Map<String, Object> params){
if (id == null) id = ""; // play it safe
TcpClientImpl client = null;
params = setSystemProperties (cleanTcpProperties (params));
ClusterInstance cluster = _tcpClusters.get (id);
if (cluster == null){
client = new TcpClientImpl (this, id, params);
} else {
Property.fillDefaultProperties (params, cluster.getProperties ());
client = new TcpClientImpl (this, id, params);
for (ServerInstance server : cluster.getServers ()){
int n = Property.getIntProperty ("connect.size", server.getProperties (false), 1, false);
for (int i=0; i<n; i++){
Map<String, Object> props = server.getProperties (true);
props.put ("connect.size.index", i);
client.addDestination (server.getAddress (), null, props);
}
}
}
return client;
}
public UdpClient newUdpClient (String id, Map<String, Object> params){
if (id == null) id = ""; // play it safe
UdpClientImpl client = null;
params = setSystemProperties (cleanUdpProperties (params));
ClusterInstance cluster = _udpClusters.get (id);
if (cluster == null){
client = new UdpClientImpl (this, id, params);
} else {
Property.fillDefaultProperties (params, cluster.getProperties ());
client = new UdpClientImpl (this, id, params);
for (ServerInstance server : cluster.getServers ()){
Map<String, Object> props = server.getProperties (true);
client.addDestination (server.getAddress (), null, props);
}
}
return client;
}
public static class ClusterInstance {
private String _id, _toString;
private Map<String, Object> _props;
private List<ServerInstance> _servers = new ArrayList<ServerInstance> ();
private ClusterInstance (String id){
_id = id;
_toString = new StringBuilder ().append ("ClusterInstance[").append (_id).append (']').toString ();
}
public String toString (){
return _toString;
}
private ClusterInstance read (ClientsConfiguration.Client client, List<Property> defProps){
_props = Property.fillProperties (client.getProperties (), null);
Property.fillDefaultProperties (_props, defProps);
_props.put ("client.version", client.getVersion ());
cleanProperties (_props);
for (ServersConfiguration.Server server : client.getServers ().getServers ()){
try{
_servers.add (new ServerInstance (server, this));
}catch(Exception e){
LOGGER.error ("Invalid server configuration : "+server.getIP ());
}
}
LOGGER.info (this+" : defined : "+_props+" / "+_servers);
return this;
}
public String getId (){
return _id;
}
public List<ServerInstance> getServers (){
return _servers;
}
public Map<String, Object> getProperties (){ return _props;}
}
public static class ServerInstance {
private InetSocketAddress _address;
private Map<String, Object> _props;
private ServerInstance (ServersConfiguration.Server server, ClusterInstance cluster) throws Exception {
_address = new InetSocketAddress (InetAddress.getByName (server.getIP ()), server.getPort ());
_props = Property.fillProperties (server.getProperties (), null);
String name = server.getName ();
if (name==null) name = _address.getAddress().getHostAddress() + ":" + _address.getPort();
_props.put (Server.PROP_SERVER_NAME, name);
_props.put (Server.PROP_SERVER_IP, server.getIP ());
_props.put (Server.PROP_SERVER_PORT, server.getPort ());
cleanProperties (_props);
}
public Map<String, Object> getProperties (boolean copy){
if (!copy) return _props;
return (Map<String, Object>) ((HashMap<String, Object>)_props).clone ();
}
public InetSocketAddress getAddress (){ return _address;}
public String toString (){return _address.toString ();}
}
private static Map<String, Object> cleanTcpProperties (Map<String, Object> props){
if (props == null) return props = new HashMap<String, Object> ();
Object o = props.get (TcpClient.PROP_CONNECT_FROM);
if (o != null && o instanceof String){
try{
o = new InetSocketAddress (InetAddress.getByName ((String) o), 0);
props.put (TcpClient.PROP_CONNECT_FROM, o);
}catch(Exception e){
LOGGER.error ("Failed to parse connect.from", e);
throw new IllegalArgumentException ("Invalid connect.from property");
}
}
return props;
}
private static Map<String, Object> cleanUdpProperties (Map<String, Object> props){
if (props == null) props = new HashMap<String, Object> ();
else if (props.get ("bind.address") != null) return props;
Object ip = props.get (UdpClient.PROP_BIND_IP);
Object port = props.get (UdpClient.PROP_BIND_PORT);
if (ip == null) ip = "0.0.0.0";
if (port == null) port = "0";
try{
int i = Integer.parseInt (port.toString ());
if (i < 0 || i > 0xFFFF) throw new Exception ("Invalid port value : "+i);
InetSocketAddress add = new InetSocketAddress (InetAddress.getByName ((String) ip), i);
props.put ("bind.address", add);
}catch(Exception e){
LOGGER.error ("Failed to parse bind info", e);
throw new IllegalArgumentException ("Invalid bind properties");
}
return props;
}
private static Map<String, Object> cleanProperties (Map<String, Object> props){
return cleanUdpProperties (cleanTcpProperties (props));
}
private Map<String, Object> setSystemProperties (Map<String, Object> props){
if (props == null) props = new HashMap<String, Object> ();
props.put ("system.reactor.provider", _reactorProvider);
return props;
}
// called when client is in init()
public Object addAdvertListener (TcpClientImpl client, String moduleId, String instanceName){
if (LOGGER.isInfoEnabled ()) LOGGER.info ("ClientFactoryImpl : addAdvertListener : client="+client+" : module.id="+moduleId+"&instance.name="+instanceName);
return new AdvertTracker (client, moduleId, instanceName).open ();
}
public void removeAdvertListener (Object attachment){
AdvertTracker tracker = (AdvertTracker) attachment;
if (LOGGER.isInfoEnabled ()) LOGGER.info ("ClientFactoryImpl : removeAdvertListener : client="+tracker._client);
tracker.close ();
}
private class AdvertTracker implements ServiceTrackerCustomizer {
private TcpClientImpl _client;
private ServiceTracker _tracker;
private AdvertTracker(TcpClientImpl client, String moduleId, String instanceName) {
_client = client;
StringBuilder s = new StringBuilder ()
.append ("(&(objectClass=")
.append (Advertisement.class.getName())
.append (")(module.id=")
.append (moduleId).append (')');
if (instanceName != null) s.append ("(instance.name=").append (instanceName).append (')');
s.append (')');
try {
Filter f = _osgi.createFilter(s.toString ());
_tracker = new ServiceTracker(_osgi, f, this);
} catch (InvalidSyntaxException e) {
LOGGER.warn ("Failed to create tracker for client="+client+", filter="+s.toString (), e);
}
}
public AdvertTracker open() {
_tracker.open();
return this;
}
public void close() {
_tracker.close();
}
/**
* A new Advert is registering in the OSGi registry: handle it thread-safely
*/
@Override
public Object addingService(ServiceReference ref) {
final String instance = (String) ref.getProperty ("instance.name");
Advertisement advert = (Advertisement) _osgi.getService(ref);
final InetSocketAddress addr = new InetSocketAddress (advert.getIp(), advert.getPort());
LOGGER.warn ("ClientFactoryImpl : advertisementReceived : addDestination : "+instance+"@"+addr);
Runnable r = new Runnable (){
public void run (){
LOGGER.warn ("ClientFactoryImpl : advertisementReceived : addDestination : "+instance+"@"+addr+" to "+_client);
List<TcpClient.Destination> servers = _client.getDestinations ();
for (int i=0; i<servers.size (); i++){
TcpClient.Destination server = servers.get (i);
boolean match = instance.equals (server.attachment ());
if (match){
if (addr.equals (server.getRemoteAddress ())){
if (LOGGER.isInfoEnabled ()) LOGGER.info ("ClientFactoryImpl : "+instance+" already known with same address");
return;
} else {
if (LOGGER.isInfoEnabled ()) LOGGER.info ("ClientFactoryImpl : "+instance+" updating with new address");
servers.remove (i);
if (server.isOpen ()) server.close ();
break;
}
}
}
_client.addDestination (addr, instance, null);
}
};
_client.execute (r);
return instance;
}
/**
* An old Advert is unregistering from the OSGi registry: handle it thread-safely
*/
@Override
public void removedService(ServiceReference ref, Object attachment) {
final String instance = (String) attachment;
Runnable r = new Runnable (){
public void run (){
LOGGER.warn ("ClientFactoryImpl : un-advertisementReceived : "+instance+" for "+_client);
List<TcpClient.Destination> servers = _client.getDestinations ();
for (int i=0; i<servers.size (); i++){
TcpClient.Destination server = servers.get (i);
boolean match = instance.equals (server.attachment ());
if (match){
servers.remove (i);
if (server.isOpen ()) server.close ();
return;
}
}
}
};
_client.execute (r);
}
/**
* An existing advertisement is modified (not possible for now ...)
*/
@Override
public void modifiedService(ServiceReference ref, Object attachment) {
}
}
}
|
zyz610650/beanbox
|
beanbox-core/src/main/java/com/beanbox/beans/aware/Aware.java
|
<filename>beanbox-core/src/main/java/com/beanbox/beans/aware/Aware.java
package com.beanbox.beans.aware;
/**
* @author: @zyz
* ๆ ่ฎฐ็ฑปๆฅๅฃ๏ผๅฎ็ฐ่ฏฅๆฅๅฃๅฏไปฅ่ขซSpringๅฎนๅจๆ็ฅ
*/
public interface Aware {
}
|
github-60587294/crowdin-cli
|
src/main/java/com/crowdin/cli/commands/actions/ListBranchesAction.java
|
package com.crowdin.cli.commands.actions;
import com.crowdin.cli.client.CrowdinProjectFull;
import com.crowdin.cli.client.ProjectClient;
import com.crowdin.cli.commands.NewAction;
import com.crowdin.cli.commands.Outputter;
import com.crowdin.cli.commands.functionality.DryrunBranches;
import com.crowdin.cli.properties.PropertiesWithFiles;
import com.crowdin.cli.utils.console.ConsoleSpinner;
class ListBranchesAction implements NewAction<PropertiesWithFiles, ProjectClient> {
private boolean noProgress;
private boolean plainView;
public ListBranchesAction(boolean noProgress, boolean plainView) {
this.noProgress = noProgress || plainView;
this.plainView = plainView;
}
@Override
public void act(Outputter out, PropertiesWithFiles pb, ProjectClient client) {
CrowdinProjectFull project = ConsoleSpinner.execute(out, "message.spinner.fetching_project_info", "error.collect_project_info",
this.noProgress, this.plainView, client::downloadFullProject);
new DryrunBranches(project.getBranches())
.run(out, false, plainView);
}
}
|
thebigcx/micro
|
kernel/include/uapi/micro/fcntl.h
|
#pragma once
#define O_RDONLY 0x000
#define O_WRONLY 0x001
#define O_RDWR 0x002
#define O_CREAT 0100
#define O_EXCL 0200
#define O_NOCTTY 0400
#define O_TRUNC 01000
#define O_APPEND 02000
#define O_NONBLOCK 04000
#define O_DSYNC 010000
#define O_SYNC 04010000
#define O_RSYNC 04010000
#define O_DIRECTORY 0200000
#define O_NOFOLLOW 0400000
#define O_CLOEXEC 02000000
#define O_ASYNC 020000
#define O_DIRECT 040000
#define O_LARGEFILE 0100000
#define O_NOATIME 01000000
#define O_PATH 010000000
#define O_TMPFILE 020200000
#define F_DUPFD 0
#define F_DUPFD_CLOEXEC 1
#define F_GETFD 2
#define F_SETFD 3
#define F_GETFL 4
#define F_SETFL 5
#define F_SETLK 6
#define F_SETLKW 7
#define F_GETLK 8
#define FD_CLOEXEC 0
#define F_RDLCK 0
#define F_WRLCK 1
#define F_UNLCK 2
|
uva-slp/pauselab
|
app/spec/models/proposal_budget_spec.rb
|
require 'rails_helper'
RSpec.describe ProposalBudget, type: :model do
it "is valid with all fields" do
budget = build :proposal_budget
expect(budget).to be_valid
end
it "is not valid with one of fields missing" do
budget = build :proposal_budget, :artist_fees => ''
expect(budget).to_not be_valid
end
it "saves the total cost" do
budget = create :proposal_budget
cost =
budget.artist_fees +
budget.project_materials +
budget.printing +
budget.marketing +
budget.documentation +
budget.volunteers +
budget.insurance +
budget.events
expect(budget.cost).to eq cost
end
end
|
bsipocmpi/jetty.project
|
jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/TransformingFlusher.java
|
<gh_stars>1000+
//
// ========================================================================
// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
// ========================================================================
//
package org.eclipse.jetty.websocket.core.internal;
import java.util.ArrayDeque;
import java.util.Queue;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.IteratingCallback;
import org.eclipse.jetty.util.thread.AutoLock;
import org.eclipse.jetty.websocket.core.Frame;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This is used to iteratively transform or process a frame into one or more other frames.
* When a frame is ready to be processed {@link #onFrame(Frame, Callback, boolean)} is called.
* Subsequent calls to {@link #transform(Callback)} are made on each callback success until one of these calls returns
* true to indicate they are done processing the frame and are ready to receive a new one.
* The {@link Callback} passed in to both these method must be succeeded in order to continue processing.
*/
public abstract class TransformingFlusher
{
private final Logger log = LoggerFactory.getLogger(this.getClass());
private final AutoLock lock = new AutoLock();
private final Queue<FrameEntry> entries = new ArrayDeque<>();
private final IteratingCallback flusher = new Flusher();
private boolean finished = true;
private Throwable failure;
/**
* Called when a frame is ready to be transformed.
* @param frame the frame to transform.
* @param callback used to signal to start processing again.
* @param batch whether this frame can be batched.
* @return true to indicate that you have finished transforming this frame.
*/
protected abstract boolean onFrame(Frame frame, Callback callback, boolean batch);
/**
* Called to transform the frame given in {@link TransformingFlusher#onFrame(Frame, Callback, boolean)}.
* This method is called on each callback success until it returns true.
* If the call to {@link #onFrame(Frame, Callback, boolean)} returns true then this method will not be called.
* @param callback used to signal to start processing again.
* @return true to indicate that you have finished transforming this frame.
*/
protected abstract boolean transform(Callback callback);
public final void sendFrame(Frame frame, Callback callback, boolean batch)
{
FrameEntry entry = new FrameEntry(frame, callback, batch);
if (log.isDebugEnabled())
log.debug("Queuing {}", entry);
boolean enqueued = false;
try (AutoLock l = lock.lock())
{
if (failure == null)
enqueued = entries.add(entry);
}
if (enqueued)
flusher.iterate();
else
notifyCallbackFailure(callback, failure);
}
private void onFailure(Throwable t)
{
try (AutoLock l = lock.lock())
{
if (failure == null)
failure = t;
}
for (FrameEntry entry : entries)
notifyCallbackFailure(entry.callback, t);
entries.clear();
}
private FrameEntry pollEntry()
{
try (AutoLock l = lock.lock())
{
return entries.poll();
}
}
private class Flusher extends IteratingCallback implements Callback
{
private FrameEntry current;
@Override
protected Action process()
{
if (finished)
{
if (current != null)
notifyCallbackSuccess(current.callback);
current = pollEntry();
if (current == null)
return Action.IDLE;
if (log.isDebugEnabled())
log.debug("onFrame {}", current);
finished = onFrame(current.frame, this, current.batch);
return Action.SCHEDULED;
}
if (log.isDebugEnabled())
log.debug("transform {}", current);
finished = transform(this);
return Action.SCHEDULED;
}
@Override
protected void onCompleteFailure(Throwable t)
{
if (log.isDebugEnabled())
log.debug("onCompleteFailure {}", t.toString());
notifyCallbackFailure(current.callback, t);
current = null;
onFailure(t);
}
}
private void notifyCallbackSuccess(Callback callback)
{
if (log.isDebugEnabled())
log.debug("notifyCallbackSuccess {}", callback);
try
{
if (callback != null)
callback.succeeded();
}
catch (Throwable x)
{
log.warn("Exception while notifying success of callback {}", callback, x);
}
}
private void notifyCallbackFailure(Callback callback, Throwable failure)
{
if (log.isDebugEnabled())
log.debug("notifyCallbackFailure {} {}", callback, failure.toString());
try
{
if (callback != null)
callback.failed(failure);
}
catch (Throwable x)
{
log.warn("Exception while notifying failure of callback {}", callback, x);
}
}
}
|
cdebortoli/scpm
|
db/migrate/20110918131707_add_checklist_is_not_applicable_to_milestone.rb
|
<reponame>cdebortoli/scpm
class AddChecklistIsNotApplicableToMilestone < ActiveRecord::Migration
def self.up
add_column :milestones, :checklist_not_applicable, :integer, :default=>0
end
def self.down
remove_column :milestones, :checklist_not_applicable
end
end
|
xuanquanchen/Urolithiasis-diagnostic-system
|
back end/src/main/java/com/JNUHealthSupervisor/ucdas/DAO/UserRecordDAO.java
|
package com.JNUHealthSupervisor.ucdas.DAO;
import com.JNUHealthSupervisor.ucdas.VO.FeaturesRecordVO;
import com.JNUHealthSupervisor.ucdas.dto.FeaturesDTO;
public interface UserRecordDAO {
/**
* ๆฎ้็จๆท่ฏๆญ่ฎฐๅฝ้็ญ้ๆฅ่ฏข(only for user)
* @return {@code FeaturesRecordVO}
* @see FeaturesRecordVO
*/
public FeaturesRecordVO searchAll(String userId, int currentPage, int pageSize);
/**
* ๆฎ้็จๆท่ฏๆญ่ฎฐๅฝๆๆฃ่
ๅงๅๆฅ่ฏข(only for user)
* @return {@code FeaturesRecordVO}
* @see FeaturesRecordVO
*/
public FeaturesRecordVO searchByName(String userId, String name, int currentPage, int pageSize);
/**
* ๆฎ้็จๆท่ฏๆญ่ฎฐๅฝ่ฏๆญๆถ้ดๆฅ่ฏข(only for user)
* @return {@code FeaturesRecordVO}
* @see FeaturesRecordVO
*/
public FeaturesRecordVO searchByTime(String userId, String beginTime, String endTime, int currentPage, int pageSize);
/**
* ๆฎ้็จๆท่ฏๆญ่ฎฐๅฝๆๆฃ่
ๅงๅๅ่ฏๆญๆถ้ดๆฅ่ฏข(only for user)
* @return {@code FeaturesRecordVO}
* @see FeaturesRecordVO
*/
public FeaturesRecordVO searchByNameAndTime(String userId, String name, String beginTime, String endTime, int currentPage, int pageSize);
/**
* ่ฎฐๅฝๆฎ้็จๆท่ฏๆญ่ฎฐๅฝ(only for user)
* @return {@code int} ๆฐๆฎๅบๆนๅจๆกๆฐ
*/
public int record(String userId, FeaturesDTO features, double[] possibilties);
/**
* ่ฎฐๅฝๆธธๅฎข่ฏๆญ่ฎฐๅฝ(only for tourist)
* @return {@code int} ๆฐๆฎๅบๆนๅจๆกๆฐ
*/
public int recordForTourist(String userId, FeaturesDTO features, double[] possibilties);
}
|
ODCleanStore/ODCleanStore
|
odcleanstore/inputclient/src/main/java/cz/cuni/mff/odcleanstore/wsclient/soap/HttpClientForInputWS.java
|
package cz.cuni.mff.odcleanstore.wsclient.soap;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import java.net.Socket;
import java.net.URL;
import java.net.URLEncoder;
import java.net.UnknownHostException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import cz.cuni.mff.odcleanstore.comlib.SocketFactory;
import cz.cuni.mff.odcleanstore.comlib.io.HttpUtils;
import cz.cuni.mff.odcleanstore.comlib.io.InputStreamForHttp;
/**
* Implements simple http lcient for insert method of odcs-inputclient SOAP webservice.
*
* @author <NAME>
*/
public class HttpClientForInputWS {
private static final Pattern RESPONSE_FIRST_LINE_PATTERN;
private static final Pattern CONTENT_TYPE_PATTERN;
static {
RESPONSE_FIRST_LINE_PATTERN = Pattern.compile("^HTTP/1\\.[0-1]\\s*([0-9]{3}).*$", Pattern.CASE_INSENSITIVE);
CONTENT_TYPE_PATTERN = Pattern.compile("^\\s*Content-type\\s*:\\s*([^;]*);\\s*charset\\s*=\\s*\"?([^\"]*)\"?\\s*$",
Pattern.CASE_INSENSITIVE);
}
private URL serverURL;
private Socket socket;
private Writer writer;
private long contentLength;
private int responseCode = -1;
private String responseContentType;
private String responseContentCharset;
/**
* Create instance of simple http lcient for insert method of odcs-inputclient SOAP webservice.
*
* @param serverURL
* @param contentLength
* @throws UnknownHostException
* @throws IOException
* @throws KeyManagementException
* @throws NoSuchAlgorithmException
*/
public HttpClientForInputWS(URL serverURL, long contentLength) throws UnknownHostException, IOException,
KeyManagementException, NoSuchAlgorithmException {
this.serverURL = serverURL;
this.contentLength = contentLength;
if (serverURL.getProtocol().equalsIgnoreCase("https")) {
socket = SocketFactory.createAllTrustSSLSocket(serverURL.getHost(), serverURL.getPort());
} else {
socket = SocketFactory.createClientSocket(serverURL.getHost(), serverURL.getPort());
}
}
/**
* Write http reader and prepare writer of http content.
*
* @return writer for writing http content
* @throws IOException
*/
public Writer getWriter() throws IOException {
if (writer == null) {
OutputStream os = socket.getOutputStream();
sendRequestHeader(os);
writer = new OutputStreamWriter(os, "UTF-8");
}
return writer;
}
/**
* Read http header and prepare reader for reading http content.
*
* @return reader for reading http content
* @throws IOException
*/
public Reader getResponse() throws IOException {
InputStreamForHttp is = new InputStreamForHttp(socket.getInputStream());
String line = is.readAsciiLine();
if (line == null)
throw new IOException("Http header is empty");
Matcher m = RESPONSE_FIRST_LINE_PATTERN.matcher(line);
if (m.matches()) {
try {
responseCode = Integer.parseInt(m.group(1));
} catch (Exception e) {
throw new IOException("Not recognised http response code");
}
} else
throw new IOException("Not recognised http response");
line = is.readAsciiLine();
while (line != null && line.length() != 0) {
m = CONTENT_TYPE_PATTERN.matcher(line);
if (m.matches()) {
responseContentType = m.group(1);
responseContentCharset = m.group(2);
}
line = is.readAsciiLine();
}
if (responseContentCharset == null) {
responseContentCharset = "ISO-8859-1";
}
return new InputStreamReader(is, responseContentCharset);
}
/**
* @return http response code
*/
public int getResponseCode() {
return responseCode;
}
/**
* @return http response type
*/
public String getResponseContentType() {
return responseContentType == null ? "" : responseContentType;
}
/**
* @return http response character set
*/
public String getResponseContentCharSet() {
return responseContentCharset == null ? "" : responseContentCharset;
}
/**
* Send http request header to the server.
*
* @param os output stream for writing header
* @throws IOException
*/
private void sendRequestHeader(OutputStream os) throws IOException {
HttpUtils.writeHeaderLine(os, "POST %s HTTP/1.0", URLEncoder.encode(serverURL.getPath(), "UTF-8"));
HttpUtils.writeHeaderLine(os, "Content-Type:text/xml;charset=UTF-8");
HttpUtils.writeHeaderLine(os, "Content-Length:%d", contentLength);
HttpUtils.writeHeaderLine(os, "Accept:text/xml");
HttpUtils.writeHeaderLine(os, "Accept-Charset:UTF-8");
HttpUtils.writeHeaderLine(os, "SOAPAction: \"\"");
HttpUtils.writeHeaderLine(os, null);
os.flush();
}
/**
* Close socket without any exceptions.
*/
public void closeQuietly() {
if (socket != null) {
try {
socket.close();
} catch (Exception e) {
// do nothing
}
}
}
}
|
zpapakipos/dynabench-1
|
api/tools/adjust_vqa_test2015_tag.py
|
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# flake8: noqa
import ujson # isort:skip
import os # isort:skip
import sys # isort:skip
import sqlalchemy as db
from sqlalchemy import JSON
from common.config import config
sys.path.append("..") # isort:skip
from models.context import Context # isort:skip
from models.round import RoundModel # isort:skip
from models.task import TaskModel # isort:skip
def update_tag(filename, dbs, assert_length, old_tag, new_tag):
anns = None
with open(filename) as jsonFile:
anns = ujson.load(jsonFile)
images_list = []
for ann in anns["questions"]:
images_list.append(ann["image_id"])
unique_images_list = list(set(images_list))
print(f"{new_tag} image size: {len(unique_images_list)}")
assert (
len(unique_images_list) == assert_length
), f"{new_tag} has to be of length {assert_length}"
results = (
dbs.query(Context)
.filter(db.cast(Context.metadata_json, JSON)["id"].in_(unique_images_list))
.filter(Context.tag == old_tag) # 39937 -> 36807 (on dev db)
)
cids = [c.id for c in results.all()]
assert len(cids) == len(set(cids))
print(f"final cids length to be actioned on: {len(cids)}")
print(f"updating {new_tag}...")
updates = (
dbs.query(Context)
.filter(Context.id.in_(cids))
.update({"tag": new_tag}, synchronize_session="fetch")
)
dbs.commit()
print("done.")
def main():
filename_test_dev = "v2_OpenEnded_mscoco_test-dev2015_questions.json"
filename_test = "v2_OpenEnded_mscoco_test2015_questions.json"
zip_file = "v2_Questions_Test_mscoco.zip"
test2015_url = f"https://s3.amazonaws.com/cvmlp/vqa/mscoco/vqa/{zip_file}"
if not os.path.exists(filename_test_dev):
os.system(f"wget {test2015_url}")
os.system(f"unzip {zip_file}")
rid = 1
tm = TaskModel()
task = tm.getByShortName("VQA")
rm = RoundModel()
round = rm.getByTidAndRid(task.id, rid)
dbs = tm.dbs
update_tag(filename_test_dev, dbs, 36807, "test2015", "test-dev2015")
# commented out because already correct.
# update_tag(
# filename_test,
# dbs,
# 81434,
# "test2015"
# "test2015",
# )
if __name__ == "__main__":
main()
|
thomasmillergb/Year2-ruby-software-hut
|
spec/models/student_spec.rb
|
require 'spec_helper'
describe Student do
pending "add some examples to (or delete) #{__FILE__}"
end
|
afishr/utm-cp
|
Lab-2/ex8.c
|
#include <stdio.h>
#include <conio.h>
int main()
{
int tab[10][10], nill[10], x;
scanf("%d", &x);
for (int i = 0; i < x; ++i)
{
nill[i] = 1;
for (int j = 0; j < x; ++j)
{
scanf("%d", &tab[i][j]);
if (tab[i][j] == 0)
nill[i] = 0;
}
}
for (int i = 0; i < x; ++i)
{
if (nill[i])
{
printf("\n");
for (int j = 0; j < x; ++j)
{
printf("%d ", tab[i][j]);
}
}
}
_getch();
return 0;
}
|
kaka-lin/pycon.tw
|
src/events/migrations/0034_merge_20210131_1832.py
|
<gh_stars>10-100
# Generated by Django 3.0.7 on 2021-01-31 10:32
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('events', '0033_auto_20210130_2309'),
('events', '0033_auto_20210131_1548'),
]
operations = [
]
|
buithehoa/rspec-3-book
|
book-code/08-metadata/12/spec/spec_helper.rb
|
RSpec.configure do |config|
config.filter_run_when_matching :focus
end
RSpec.describe "With no examples focused" do
it "only runs if no other examples are focused" do
end
end
RSpec.describe "With an example focused" do
it "runs alone when focused", :focus => !!ENV['FOCUS_AN_EXAMPLE'] do
end
end
|
oliveiralecca/origamid-react
|
03-react-hooks/05-usecontext/appreact/src/ExContext.js
|
<filename>03-react-hooks/05-usecontext/appreact/src/ExContext.js
import React from 'react'
export const ExContext = React.createContext()
export const ExStorage = ({ children }) => {
const [dados, setDados] = React.useState(null)
// Faz o fetch assim que o usรกrio entrou no App, รฉ um efeito
React.useEffect(() => {
fetch('https://ranekapi.origamid.dev/json/api/produto/')
.then(response => response.json())
.then(json => setDados(json))
}, [])
function limparDados() {
setDados(null)
}
// Provider expondo os valores do contexto para o restante da aplicaรงรฃo onde eu importรก-los
return (
<ExContext.Provider value={{ dados, limparDados }}>
{children}
</ExContext.Provider>
)
}
|
deadmoroz369/tekwill-homework
|
src/com/tekwill/learning/basics/jan11/ValueOfPi.java
|
package com.tekwill.learning.basics.jan11;
import java.util.Scanner;
public class ValueOfPi {
public static void main(String[] args) {
System.out.println("Let's find the value of 3.14159! Enter a number in range of 0 to 200,000: ");
Scanner scanner = new Scanner(System.in);
int number = scanner.nextInt();
int odd = 1;
double pi = 0.0;
double currentTerm = 0.0;
for (int i = 1; i <= number; i++) {
if (i % 2 == 0) {
currentTerm = (double) -4 / odd;
} else {
currentTerm = (double) 4 / odd;
}
odd = odd + 2;
pi = pi + currentTerm;
}
System.out.printf("%.5f", pi);
}
}
|
tinyvampirepudge/ThinkInJavaPractice
|
app/src/main/java/com/tinytongtong/thinkinjavapractice/chapter08/part03/polymorphism/poly/constructors/package-info.java
|
<reponame>tinyvampirepudge/ThinkInJavaPractice<gh_stars>0
package com.tinytongtong.thinkinjavapractice.chapter08.part03.polymorphism.poly.constructors;
/**
* @Description: ๆ้ ๅจๅ
้จ็ๅคๆๆนๆณ็่กไธบ
*
* @Author <EMAIL>
* @Date 2019/1/15 1:50 PM
* @Version
*/
|
CJoriginal/cjlumberyard
|
dev/Gems/LmbrCentral/Code/Source/Shape/EditorPolygonPrismShapeComponent.cpp
|
<reponame>CJoriginal/cjlumberyard<filename>dev/Gems/LmbrCentral/Code/Source/Shape/EditorPolygonPrismShapeComponent.cpp<gh_stars>1-10
/*
* 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.
*
*/
#include "LmbrCentral_precompiled.h"
#include "EditorPolygonPrismShapeComponent.h"
#include <AzCore/Math/IntersectSegment.h>
#include <AzCore/Math/VectorConversions.h>
#include <AzCore/RTTI/ReflectContext.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
#include <AzToolsFramework/Entity/EditorEntityInfoBus.h>
#include <AzToolsFramework/Manipulators/ManipulatorBus.h>
#include <AzToolsFramework/Manipulators/HoverSelection.h>
#include "EditorShapeComponentConverters.h"
#include "ShapeDisplay.h"
#include "ShapeGeometryUtil.h"
namespace LmbrCentral
{
/**
* Util to calculate central position of prism (to draw the height manipulator)
*/
static AZ::Vector3 CalculateHeightManipulatorPosition(const AZ::PolygonPrism& polygonPrism)
{
const AZ::VertexContainer<AZ::Vector2>& vertexContainer = polygonPrism.m_vertexContainer;
AZ::Vector2 averageCenterPosition = AZ::Vector2::CreateZero();
for (const AZ::Vector2& vertex : vertexContainer.GetVertices())
{
averageCenterPosition += vertex;
}
return Vector2ToVector3(averageCenterPosition / vertexContainer.Size(), polygonPrism.GetHeight());
}
void EditorPolygonPrismShapeComponent::Activate()
{
EditorBaseShapeComponent::Activate();
AzFramework::EntityDebugDisplayEventBus::Handler::BusConnect(GetEntityId());
EntitySelectionEvents::Bus::Handler::BusConnect(GetEntityId());
EditorPolygonPrismShapeComponentRequestsBus::Handler::BusConnect(GetEntityId());
ToolsApplicationEvents::Bus::Handler::BusConnect();
m_polygonPrismShape.Activate(GetEntityId());
bool selected = false;
AzToolsFramework::EditorEntityInfoRequestBus::EventResult(
selected, GetEntityId(), &AzToolsFramework::EditorEntityInfoRequestBus::Events::IsSelected);
// placeholder - create initial polygon prism shape if empty
AZ::VertexContainer<AZ::Vector2>& vertexContainer = m_polygonPrismShape.GetPolygonPrism()->m_vertexContainer;
if (selected && vertexContainer.Empty())
{
vertexContainer.AddVertex(AZ::Vector2(-2.0f, -2.0f));
vertexContainer.AddVertex(AZ::Vector2(2.0f, -2.0f));
vertexContainer.AddVertex(AZ::Vector2(2.0f, 2.0f));
vertexContainer.AddVertex(AZ::Vector2(-2.0f, 2.0f));
CreateManipulators();
}
const auto containerChanged = [this]()
{
GenerateVertices();
// destroy and recreate manipulators when container is modified (vertices are added or removed)
DestroyManipulators();
CreateManipulators();
m_polygonPrismShape.ShapeChanged();
};
const auto shapeModified = [this]()
{
GenerateVertices();
m_polygonPrismShape.ShapeChanged();
RefreshManipulators();
};
const auto vertexAdded = [this, containerChanged](size_t index)
{
containerChanged();
AzToolsFramework::ManipulatorManagerId managerId = AzToolsFramework::ManipulatorManagerId(1);
m_vertexSelection.CreateTranslationManipulator(GetEntityId(), managerId,
AzToolsFramework::TranslationManipulators::Dimensions::Two,
m_polygonPrismShape.GetPolygonPrism()->m_vertexContainer.GetVertices()[index], index,
AzToolsFramework::ConfigureTranslationManipulatorAppearance2d);
};
m_polygonPrismShape.GetPolygonPrism()->SetCallbacks(
vertexAdded,
[containerChanged](size_t) { containerChanged(); },
shapeModified,
containerChanged,
containerChanged,
shapeModified);
// callback after vertices in the selection have moved
m_vertexSelection.m_onVertexPositionsUpdated = [this]()
{
// ensure we refresh the height manipulator after vertices are moved to ensure it stays central to the prism
m_heightManipulator->SetLocalTransform(
AZ::Transform::CreateTranslation(CalculateHeightManipulatorPosition(*m_polygonPrismShape.GetPolygonPrism())));
m_heightManipulator->SetBoundsDirty();
};
GenerateVertices();
}
void EditorPolygonPrismShapeComponent::Deactivate()
{
EditorBaseShapeComponent::Deactivate();
DestroyManipulators();
m_polygonPrismShape.Deactivate();
ToolsApplicationEvents::Bus::Handler::BusDisconnect();
EditorPolygonPrismShapeComponentRequestsBus::Handler::BusDisconnect();
EntitySelectionEvents::Bus::Handler::BusDisconnect();
AzFramework::EntityDebugDisplayEventBus::Handler::BusDisconnect();
}
void EditorPolygonPrismShapeComponent::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<EditorPolygonPrismShapeComponent, EditorBaseShapeComponent>()
->Version(2, &ClassConverters::UpgradeEditorPolygonPrismShapeComponent)
->Field("Configuration", &EditorPolygonPrismShapeComponent::m_polygonPrismShape)
;
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
{
editContext->Class<EditorPolygonPrismShapeComponent>(
"Polygon Prism Shape", "Provides polygon prism shape")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::Category, "Shape")
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/PolygonPrism.png")
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Editor/Icons/Components/Viewport/PolygonPrism.png")
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c))
->Attribute(AZ::Edit::Attributes::HelpPageURL, "http://docs.aws.amazon.com/console/lumberyard/userguide/polygon-prism-component")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(AZ::Edit::UIHandlers::Default, &EditorPolygonPrismShapeComponent::m_polygonPrismShape, "Configuration", "PolygonPrism Shape Configuration")
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
;
}
}
}
void EditorPolygonPrismShapeComponent::DisplayEntity(bool& handled)
{
DisplayShape(handled,
[this]() { return CanDraw(); },
[this](AzFramework::EntityDebugDisplayRequests* displayContext)
{
DrawPolygonPrismShape(
{ m_shapeColor, m_shapeWireColor, m_displayFilled },
m_polygonPrismMesh, *displayContext);
displayContext->SetColor(m_shapeWireColor);
AzToolsFramework::EditorVertexSelectionUtil::DisplayVertexContainerIndices(
*displayContext, m_vertexSelection,
AzToolsFramework::TransformUniformScale(
m_polygonPrismShape.GetCurrentTransform()), IsSelected());
},
m_polygonPrismShape.GetCurrentTransform());
}
void EditorPolygonPrismShapeComponent::BuildGameEntity(AZ::Entity* gameEntity)
{
if (auto component = gameEntity->CreateComponent<PolygonPrismShapeComponent>())
{
component->m_polygonPrismShape = m_polygonPrismShape;
}
if (m_visibleInGameView)
{
gameEntity->CreateComponent<PolygonPrismShapeDebugDisplayComponent>(
*m_polygonPrismShape.GetPolygonPrism());
}
}
void EditorPolygonPrismShapeComponent::OnTransformChanged(
const AZ::Transform& /*local*/, const AZ::Transform& world)
{
// update the space manipulators are in after the entity has moved
m_vertexSelection.RefreshSpace(world);
if (m_heightManipulator)
{
m_heightManipulator->SetSpace(world);
}
}
void EditorPolygonPrismShapeComponent::OnSelected()
{
// ensure any maniulators are destroyed before recreated - (for undo/redo)
DestroyManipulators();
CreateManipulators();
}
void EditorPolygonPrismShapeComponent::OnDeselected()
{
DestroyManipulators();
}
void EditorPolygonPrismShapeComponent::CreateManipulators()
{
bool selected = false;
AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(
selected, &AzToolsFramework::ToolsApplicationRequests::IsSelected, GetEntityId());
if (!selected)
{
return;
}
// if we have no vertices, do not attempt to create any manipulators
if (m_polygonPrismShape.GetPolygonPrism()->m_vertexContainer.Empty())
{
return;
}
AZStd::unique_ptr<AzToolsFramework::LineSegmentHoverSelection<AZ::Vector2>> polygonPrismHover =
AZStd::make_unique<AzToolsFramework::LineSegmentHoverSelection<AZ::Vector2>>();
polygonPrismHover->m_vertices = AZStd::make_unique<AzToolsFramework::VariableVerticesVertexContainer<AZ::Vector2>>(
m_polygonPrismShape.GetPolygonPrism()->m_vertexContainer);
m_vertexSelection.m_hoverSelection = AZStd::move(polygonPrismHover);
// create interface wrapping internal vertex container for use by vertex selection
m_vertexSelection.m_vertices =
AZStd::make_unique<AzToolsFramework::VariableVerticesVertexContainer<AZ::Vector2>>(
m_polygonPrismShape.GetPolygonPrism()->m_vertexContainer);
const AzToolsFramework::ManipulatorManagerId managerId = AzToolsFramework::ManipulatorManagerId(1);
m_vertexSelection.Create(GetEntityId(), managerId,
AzToolsFramework::TranslationManipulators::Dimensions::Two,
AzToolsFramework::ConfigureTranslationManipulatorAppearance2d);
// initialize height manipulator
m_heightManipulator = AZStd::make_unique<AzToolsFramework::LinearManipulator>(
GetEntityId(), m_polygonPrismShape.GetCurrentTransform());
m_heightManipulator->SetLocalTransform(
AZ::Transform::CreateTranslation(CalculateHeightManipulatorPosition(*m_polygonPrismShape.GetPolygonPrism())));
m_heightManipulator->SetAxis(AZ::Vector3::CreateAxisZ());
const float lineLength = 0.5f;
const float lineWidth = 0.05f;
const float coneLength = 0.28f;
const float coneRadius = 0.07f;
AzToolsFramework::ManipulatorViews views;
views.emplace_back(CreateManipulatorViewLine(*m_heightManipulator, AZ::Color(0.0f, 0.0f, 1.0f, 1.0f),
lineLength, lineWidth));
views.emplace_back(CreateManipulatorViewCone(*m_heightManipulator,
AZ::Color(0.0f, 0.0f, 1.0f, 1.0f), m_heightManipulator->GetAxis() *
(lineLength - coneLength), coneLength, coneRadius));
m_heightManipulator->SetViews(AZStd::move(views));
// height manipulator callbacks
m_heightManipulator->InstallMouseMoveCallback([this](
const AzToolsFramework::LinearManipulator::Action& action)
{
m_polygonPrismShape.GetPolygonPrism()->SetHeight(AZ::VectorFloat(
action.LocalPosition().GetZ()).GetMax(AZ::VectorFloat::CreateZero()));
m_heightManipulator->SetLocalTransform(
AZ::Transform::CreateTranslation(Vector2ToVector3(Vector3ToVector2(
action.LocalPosition()), action.LocalPosition().GetZ().GetMax(AZ::VectorFloat::CreateZero()))));
m_heightManipulator->SetBoundsDirty();
// ensure property grid values are refreshed
AzToolsFramework::ToolsApplicationNotificationBus::Broadcast(
&AzToolsFramework::ToolsApplicationNotificationBus::Events::InvalidatePropertyDisplay,
AzToolsFramework::Refresh_Values);
});
m_heightManipulator->Register(managerId);
}
void EditorPolygonPrismShapeComponent::DestroyManipulators()
{
// clear all manipulators when deselected
if (m_heightManipulator)
{
m_heightManipulator->Unregister();
m_heightManipulator.reset();
}
m_vertexSelection.Destroy();
}
void EditorPolygonPrismShapeComponent::AfterUndoRedo()
{
bool selected;
AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(
selected, &AzToolsFramework::ToolsApplicationRequests::IsSelected, GetEntityId());
if (selected)
{
DestroyManipulators();
CreateManipulators();
}
}
void EditorPolygonPrismShapeComponent::RefreshManipulators()
{
m_vertexSelection.RefreshLocal();
if (m_heightManipulator)
{
m_heightManipulator->SetLocalTransform(
AZ::Transform::CreateTranslation(CalculateHeightManipulatorPosition(*m_polygonPrismShape.GetPolygonPrism())));
m_heightManipulator->SetBoundsDirty();
}
}
void EditorPolygonPrismShapeComponent::GenerateVertices()
{
GeneratePolygonPrismMesh(
m_polygonPrismShape.GetPolygonPrism()->m_vertexContainer.GetVertices(),
m_polygonPrismShape.GetPolygonPrism()->GetHeight(), m_polygonPrismMesh);
}
} // namespace LmbrCentral
|
BulkSecurityGeneratorProject/dictionary
|
src/main/webapp/scripts/components/entities/translation/translation.search.service.js
|
<reponame>BulkSecurityGeneratorProject/dictionary
'use strict';
angular.module('dictionaryApp')
.factory('TranslationSearch', function ($resource) {
return $resource('api/_search/translations/:query', {}, {
'query': { method: 'GET', isArray: true},
'find' : { method: 'GET', isArray: true, url: 'api/translations/words/:wordId/languages/:toLanguageId',
parameter: {wordId: '@wordId', toLanguageId: '@toLanguageId'}}
});
});
|
pubnative/hybid-ios-mopub-mediation-demo
|
MoPub Mediation Demo/Pods/mopub-ios-sdk/MoPubSDK/NativeAds/Internal/MPMoPubNativeAdAdapter.h
|
<gh_stars>100-1000
//
// MPMoPubNativeAdAdapter.h
//
// Copyright 2018-2021 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//
#import "MPNativeAdAdapter.h"
@class MPAdConfiguration;
@interface MPMoPubNativeAdAdapter : NSObject <MPNativeAdAdapter>
@property (nonatomic, weak) id<MPNativeAdAdapterDelegate> delegate;
@property (nonatomic, readonly) NSArray *impressionTrackerURLs;
@property (nonatomic, readonly) NSArray *clickTrackerURLs;
@property (nonatomic) MPAdConfiguration *adConfiguration;
- (instancetype)initWithAdProperties:(NSMutableDictionary *)properties;
@end
|
zjhlogo/blink
|
source/foundation/File.cpp
|
<filename>source/foundation/File.cpp
/*!
* \file File.cpp
*
* \author zjhlogo
* \date 2019/11/15
*
*
*/
#include "File.h"
namespace blink
{
File::File() {}
File::File(const tstring& filePath, int flag /*= AM_READ*/) { open(filePath, flag); }
File::~File() { close(); }
bool File::readFileIntoString(tstring& strOut, const tstring& filePath)
{
File file;
if (!file.open(filePath)) return false;
auto fileSize = file.fileSize();
strOut.resize(fileSize);
file.read((void*)strOut.data(), fileSize);
return true;
}
bool File::readFileIntoBuffer(std::vector<uint8>& dataOut, const tstring& filePath)
{
File file;
if (!file.open(filePath)) return false;
auto fileSize = file.fileSize();
dataOut.resize(fileSize);
file.read((void*)dataOut.data(), fileSize);
return true;
}
} // namespace blink
|
Brest-Java-Course-2021-2/Rodion-Khripunov-University
|
web-app/src/main/java/com.epam.brest.web_app/validators/StudentValidator.java
|
<filename>web-app/src/main/java/com.epam.brest.web_app/validators/StudentValidator.java
package com.epam.brest.web_app.validators;
import com.epam.brest.model.Student;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;
import java.math.BigDecimal;
@Component
public class StudentValidator implements Validator {
@Override
public boolean supports(Class<?> clazz) {
return Student.class.equals(clazz);
}
@Override
public void validate(Object target, Errors errors) {
ValidationUtils.rejectIfEmpty(errors, "firstName", "studentFirstName.empty");
ValidationUtils.rejectIfEmpty(errors, "lastName", "studentLastName.empty");
ValidationUtils.rejectIfEmpty(errors, "enrollmentDate", "studentEnrollmentDate.empty");
ValidationUtils.rejectIfEmpty(errors, "email", "studentEmail.empty");
ValidationUtils.rejectIfEmpty(errors, "course", "studentCourse.empty");
ValidationUtils.rejectIfEmpty(errors, "rating", "studentRating.empty");
ValidationUtils.rejectIfEmpty(errors, "universityId", "studentUniversityId.empty");
Student student = (Student) target;
if (StringUtils.hasLength(student.getEmail())
&& !student.getEmail().matches("^(.+)@(.+)$")) {
errors.rejectValue("email", "studentEmail.NotAnEmail");
}
if (student.getCourse() != null) {
if (student.getCourse() < 1 || student.getCourse() > 5) {
errors.rejectValue("course", "studentCourse.outOfRange");
}
}
if (student.getRating() != null) {
if (student.getRating().compareTo(BigDecimal.ZERO) < 0 || student.getRating().compareTo(BigDecimal.TEN) > 0) {
errors.rejectValue("rating", "studentRating.outOfRange");
}
}
}
}
|
visualitypl/bchess
|
lib/bchess/helpers/field_between_helpers.rb
|
<gh_stars>1-10
module FieldBetweenHelpers
def row_fields(dcolumn, _drow)
smaller, bigger = [column, dcolumn].sort
(smaller + 1..bigger - 1).map { |c| [c, row] }
end
def column_fields(_dcolumn, drow)
smaller, bigger = [row, drow].sort
(smaller + 1..bigger - 1).map { |r| [column, r] }
end
def diagonal_fields(dcolumn, drow)
fields = []
if dcolumn > column
if drow > row
(dcolumn - column - 1).times do |i|
fields << [dcolumn - (i + 1), drow - (i + 1)]
end
else
(dcolumn - column - 1).times do |i|
fields << [dcolumn - (i + 1), drow + (i + 1)]
end
end
else
if drow > row
(column - dcolumn - 1).times do |i|
fields << [dcolumn + (i + 1), drow - (i + 1)]
end
else
(column - dcolumn - 1).times do |i|
fields << [dcolumn + (i + 1), drow + (i + 1)]
end
end
end
fields
end
def fields_between(dcolumn, drow)
return [] unless can_move_to_field?(dcolumn, drow)
if same_row?(drow)
row_fields(dcolumn, drow)
elsif same_column?(dcolumn)
column_fields(dcolumn, drow)
elsif same_diagonal?(dcolumn, drow)
diagonal_fields(dcolumn, drow)
else
[]
end
end
end
|
reels-research/iOS-Private-Frameworks
|
CoreUtils.framework/CURangingPeer.h
|
<filename>CoreUtils.framework/CURangingPeer.h
/* Generated by RuntimeBrowser
Image: /System/Library/PrivateFrameworks/CoreUtils.framework/CoreUtils
*/
@interface CURangingPeer : NSObject {
NSData * _deviceAddress;
NSData * _deviceIRK;
NSString * _deviceModel;
}
@property (nonatomic, copy) NSData *deviceAddress;
@property (nonatomic, copy) NSData *deviceIRK;
@property (nonatomic, copy) NSString *deviceModel;
- (void).cxx_destruct;
- (id)description;
- (id)deviceAddress;
- (id)deviceIRK;
- (id)deviceModel;
- (unsigned long long)hash;
- (bool)isEqual:(id)arg1;
- (void)setDeviceAddress:(id)arg1;
- (void)setDeviceIRK:(id)arg1;
- (void)setDeviceModel:(id)arg1;
@end
|
ppartarr/azure-sdk-for-java
|
sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosDatabaseContentResponseOnWriteTest.java
|
<filename>sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/CosmosDatabaseContentResponseOnWriteTest.java
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*
*/
package com.azure.cosmos;
import com.azure.cosmos.models.CosmosDatabaseProperties;
import com.azure.cosmos.models.CosmosDatabaseRequestOptions;
import com.azure.cosmos.models.CosmosDatabaseResponse;
import com.azure.cosmos.rx.TestSuiteBase;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Factory;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
public class CosmosDatabaseContentResponseOnWriteTest extends TestSuiteBase {
private final String preExistingDatabaseId = CosmosDatabaseForTest.generateId();
private final List<String> databases = new ArrayList<>();
private CosmosClient client;
private CosmosDatabase createdDatabase;
// Currently Gateway and Direct TCP support minimal response feature.
@Factory(dataProvider = "clientBuildersWithDirectTcpWithContentResponseOnWriteDisabled")
public CosmosDatabaseContentResponseOnWriteTest(CosmosClientBuilder clientBuilder) {
super(clientBuilder);
}
@BeforeClass(groups = {"emulator"}, timeOut = SETUP_TIMEOUT)
public void beforeClass() {
assertThat(this.client).isNull();
this.client = getClientBuilder().buildClient();
createdDatabase = createSyncDatabase(client, preExistingDatabaseId);
}
@AfterClass(groups = {"emulator"}, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true)
public void afterClass() {
safeDeleteSyncDatabase(createdDatabase);
for (String dbId : databases) {
safeDeleteSyncDatabase(client.getDatabase(dbId));
}
safeCloseSyncClient(client);
}
@Test(groups = {"emulator"}, timeOut = TIMEOUT)
public void createDatabase_withContentResponseOnWriteDisabled() {
CosmosDatabaseProperties databaseDefinition = new CosmosDatabaseProperties(CosmosDatabaseForTest.generateId());
databases.add(databaseDefinition.getId());
CosmosDatabaseResponse createResponse = client.createDatabase(databaseDefinition, new CosmosDatabaseRequestOptions());
validateDatabaseResponse(databaseDefinition, createResponse);
}
@Test(groups = {"emulator"}, timeOut = TIMEOUT)
public void readDatabase_withContentResponseOnWriteDisabled() throws Exception {
CosmosDatabase database = client.getDatabase(createdDatabase.getId());
CosmosDatabaseProperties properties = new CosmosDatabaseProperties(createdDatabase.getId());
CosmosDatabaseRequestOptions options = new CosmosDatabaseRequestOptions();
CosmosDatabaseResponse read = database.read();
validateDatabaseResponse(properties, read);
CosmosDatabaseResponse read1 = database.read(options);
validateDatabaseResponse(properties, read1);
}
private void validateDatabaseResponse(CosmosDatabaseProperties databaseDefinition, CosmosDatabaseResponse createResponse) {
// Basic validation
assertThat(createResponse.getProperties().getId()).isNotNull();
assertThat(createResponse.getProperties().getId())
.as("check Resource Id")
.isEqualTo(databaseDefinition.getId());
}
}
|
bluepichu/node_pcap
|
decode/vlan.js
|
function Vlan() {
this.priority = null;
this.canonical_format = null;
this.id = null;
}
// http://en.wikipedia.org/wiki/IEEE_802.1Q
Vlan.prototype.decode = function (raw_packet, offset) {
this.priority = (raw_packet[offset] & 0xE0) >> 5;
this.canonical_format = (raw_packet[offset] & 0x10) >> 4;
this.id = ((raw_packet[offset] & 0x0F) << 8) | raw_packet[offset + 1];
return this;
};
Vlan.prototype.decoderName = "vlan";
Vlan.prototype.eventsOnDecode = false;
Vlan.prototype.toString = function () {
return this.priority + " " + this.canonical_format + " " + this.id;
};
module.exports = Vlan;
|
santuan/gatby-stn
|
src/components/header.js
|
import { Link } from "gatsby"
import PropTypes from "prop-types"
import React from "react"
import Headroom from "react-headroom"
import IsoStn from "../animations/isoWelcome"
import "../styles/header.css"
import { FiSend } from "react-icons/fi"
const Header = () => (
<Headroom disableInlineStyles>
<div className="flex items-center justify-between w-full px-3 py-3 mx-auto duration-1000 transform max-w-7xl inner-wrapper">
<div className="w-40 font-mono text-xl font-bold tracking-wider uppercase logo md:w-64">
<Link
to="/"
aria-label="Santuan - Volver al inicio"
className="block pt-2 transition-all duration-700 ease-in-out transform motion-safe:hover:scale-105"
>
<IsoStn />
</Link>
</div>
<div className="hidden w-full text-right md:block">
<nav className="relative flex items-center justify-end md:space-x-8">
<Link
to="/galeria/"
className="relative font-mono text-lg font-bold text-white uppercase hover:opacity-100 opacity-80"
activeClassName="opacity-100"
>
<span>Imรกgenes</span>
</Link>
<Link
to="/blog/"
className="font-mono text-lg font-bold text-white uppercase hover:opacity-100 opacity-80"
activeClassName="opacity-100"
>
<span>Escritura</span>
</Link>
<Link
to="/colaboraciones/"
className="font-mono text-lg font-bold tracking-widest text-white uppercase hover:opacity-100 opacity-80"
activeClassName="opacity-100"
>
<span>www</span>
</Link>
<Link
to="/cooparaje/"
className="relative font-mono text-lg font-bold text-white uppercase hover:opacity-100 opacity-80"
activeClassName="opacity-100 !text-yellow-400 "
>
<span>Cooparaje</span>
<span class="absolute -top-1 -right-2 flex h-3 w-3">
<span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-yellow-400 opacity-75"></span>
<span class="relative inline-flex rounded-full h-3 w-3 bg-yellow-500"></span>
</span>
</Link>
<Link
to="/contacto/"
className="font-mono text-lg font-bold text-white uppercase hover:opacity-100 opacity-80"
activeClassName="opacity-100"
>
<span>
<FiSend />
</span>
</Link>
</nav>
</div>
</div>
</Headroom>
)
Header.propTypes = {
siteTitle: PropTypes.string,
}
Header.defaultProps = {
siteTitle: ``,
}
export default Header
|
linjiev5/EasyRecrui
|
src/main/java/jp/easyrecrui/repository/MessageToOperationRepository.java
|
package jp.easyrecrui.repository;
import java.util.ArrayList;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import jp.easyrecrui.entity.MessageToOperation;
@Repository
public interface MessageToOperationRepository extends JpaRepository<MessageToOperation, Integer> {
ArrayList<MessageToOperation> findAllByOrderByUpdateTimeDesc();
ArrayList<MessageToOperation> findByReadFalse();
ArrayList<MessageToOperation> findByUid(int uid);
void deleteByUid(int uid);
}
|
manipulateur/ofxRobotArm
|
src/world/WorkSurface3D.cpp
|
<gh_stars>100-1000
//
// WorkSurface3D.cpp
// example-surface-following
//
// Created by mad on 4/26/16.
//
//
//
// Copyright (c) 2016, 2021 <NAME>, <NAME>, and The Frank-Ratchye STUDIO for Creative Inquiry All rights reserved.
////
#include "WorkSurface3D.h"
namespace ofxRobotArm{
WorkSurface3D::WorkSurface3D(){
}
WorkSurface3D::~WorkSurface3D(){
}
void WorkSurface3D::setup(){
ofMesh m;
surfaceMesh = m;
}
void WorkSurface3D::setup(ofMesh mesh){
surfaceMesh = mesh;
// scale surface to meters and reposition for robot
ofVec3f offset = ofVec3f(0,.5,0);
for (auto &v : surfaceMesh.getVertices()){
v /= 100;
v+=offset;
}
}
void WorkSurface3D::setup(ofMesh mesh, vector<ofPolyline> polylines){
surfaceMesh = mesh;
// scale surface to meters and reposition for robot
ofVec3f offset = ofVec3f(0,.5,0);
for (auto &v : surfaceMesh.getVertices()){
v /= 100;
v+=offset;
}
// center polylines onto mesh
for (auto &pl : polylines){
for (auto &v : pl.getVertices())
v+=offset;
}
vector<ofPolyline> polylines3D;
project(surfaceMesh, polylines, polylines3D,0);
for (auto &pl : polylines3D){
Path3D p;
p.set(pl);
paths.push_back(p);
}
}
void WorkSurface3D::draw(bool showSrf=true, bool showWireframe=true, bool showNormals=false, bool showPaths=true){
ofPushMatrix();
ofPushStyle();
ofScale(1000, 1000, 1000); // scale from meters to mm when drawing
ofSetColor(255, 0, 255, 100);
if (showSrf)
surfaceMesh.draw();
if (showWireframe){
ofSetColor(ofColor::aqua, 100);
surfaceMesh.drawWireframe();
}
if (showNormals){
ofSetColor(ofColor::aqua, 100);
for (auto &face : surfaceMesh.getUniqueFaces()){
ofVec3f n = face.getFaceNormal();
n /= -100; // scale to meters & flip
ofVec3f pos = (face.getVertex(0) + face.getVertex(1) + face.getVertex(2)) / 3;
ofDrawLine(pos, pos+n);
}
}
if (showPaths){
ofSetLineWidth(3);
ofSetColor(0, 255, 255, 200);
for (auto &p : paths){
p.draw();
}
}
ofPopStyle();
ofPopMatrix();
}
void WorkSurface3D::keyPressed(int key){
ofVec3f offset;
offset.set(0,0,0);
float step = .01;
// move the work surface
if (key == OF_KEY_LEFT)
offset.x -= step;
else if (key == OF_KEY_RIGHT)
offset.x += step;
else if (key == OF_KEY_DOWN)
offset.y -= step;
else if (key == OF_KEY_UP)
offset.y += step;
transform(offset);
// rotate the work surface (in place)
if (key == 'R'){
ofMatrix4x4 m44;
ofVec3f centroid = getMesh().getCentroid();
// rotate about the x-axis 90ยบ
m44.setRotate(ofQuaternion(sqrt(.5),0,0,sqrt(.5)));
// move to origin to transform
m44.setTranslation(-1*centroid);
// apply tranformation
transform(m44);
// move back to origin
transform(centroid);
}
}
void WorkSurface3D::setMesh(ofMesh mesh, vector<ofPolyline> polylines2D){
surfaceMesh = mesh;
setPaths(polylines2D);
}
ofMesh WorkSurface3D::getMesh(){
return surfaceMesh;
}
void WorkSurface3D::setPaths(vector<ofPolyline> polylines2D){
vector<ofPolyline> polylines3D;
project(surfaceMesh, polylines2D, polylines3D, 0);
paths.clear();
for (auto &pl : polylines3D){
Path3D p;
p.set(pl);
paths.push_back(p);
}
}
vector<Path *> WorkSurface3D::getPaths(){
vector<Path *> pPaths;
for (auto &path : paths){
pPaths.push_back(&path);
}
return pPaths;
}
void WorkSurface3D::project(ofMesh & mesh, vector<ofPolyline> &paths2D, vector<ofPolyline> &paths, float srfOffset){
for (int i=0; i<paths2D.size(); i++){
ofPolyline pl = paths2D[i];
ofPolyline temp3D;
// find the closest face to the 2D path point
for (auto &v : pl.getVertices()){
float zHeight = v.z; // save the z height of the vertex
v.z = 0; // make point into 2D point
for (int i=0; i<mesh.getUniqueFaces().size(); i++){
// re-make the face as a 2D polyline so we can check
// if the toolpath point is inside ... hacky, but it works!
ofPolyline f;
f.addVertex(mesh.getFace(i).getVertex(0));
f.addVertex(mesh.getFace(i).getVertex(1));
f.addVertex(mesh.getFace(i).getVertex(2));
f.close();
f.getVertices()[0].z = 0;
f.getVertices()[1].z = 0;
f.getVertices()[2].z = 0;
// project the 2D point onto the 2D mesh face
if (f.inside(v)){
auto face = mesh.getFace(i);
// find the distance between our toolpath point and the mesh face
ofVec3f facePos = (mesh.getFace(i).getVertex(0)+mesh.getFace(i).getVertex(1)+mesh.getFace(i).getVertex(2))/3;
ofVec3f face2toolPt = v - facePos;
float projectedDist = face2toolPt.dot(glm::normalize(face.getFaceNormal()));
// use the distance as the length of a vertical projection vector
ofVec3f length = ofVec3f(0,0,-projectedDist - srfOffset);
// get point on surface
ofVec3f projectedPt = v-length;
// preserve any 3D offset normal to the surface
ofVec3f nOffset = face.getFaceNormal();
nOffset.scale(zHeight+srfOffset);
projectedPt -= nOffset;
// save the projected point and face normal
temp3D.addVertex(projectedPt);
}
}
}
temp3D.close();
paths.push_back(temp3D);
}
}
void WorkSurface3D::transform(ofVec3f p){
for (auto &v: surfaceMesh.getVertices()){
v += p;
}
for (auto &path : paths){
// move the path
for (auto &v : path.path.getVertices())
v += p;
// update the perp frames
path.buildPerpFrames(path.path);
}
}
void WorkSurface3D::transform(ofMatrix4x4 m44){
for (auto &v: surfaceMesh.getVertices()){
v += m44.getTranslation();
v = toOf(v) * m44.getRotate();
}
for (auto &path : paths){
// move the path
for (auto &v : path.path.getVertices()){
v += m44.getTranslation();
v = toOf(v) * m44.getRotate();
}
// update the perp frames
path.buildPerpFrames(path.path);
}
}
}
|
lemkova/Yorozuya
|
YorozuyaGSLib/source/_ANIMUSKEY.cpp
|
<reponame>lemkova/Yorozuya<filename>YorozuyaGSLib/source/_ANIMUSKEY.cpp<gh_stars>10-100
#include <_ANIMUSKEY.hpp>
START_ATF_NAMESPACE
char _ANIMUSKEY::CovDBKey()
{
using org_ptr = char (WINAPIV*)(struct _ANIMUSKEY*);
return (org_ptr(0x1401bf2e0L))(this);
};
bool _ANIMUSKEY::IsFilled()
{
using org_ptr = bool (WINAPIV*)(struct _ANIMUSKEY*);
return (org_ptr(0x14010e3a0L))(this);
};
void _ANIMUSKEY::LoadDBKey(char pl_byKey)
{
using org_ptr = void (WINAPIV*)(struct _ANIMUSKEY*, char);
(org_ptr(0x140120520L))(this, pl_byKey);
};
void _ANIMUSKEY::SetRelease()
{
using org_ptr = void (WINAPIV*)(struct _ANIMUSKEY*);
(org_ptr(0x140076350L))(this);
};
END_ATF_NAMESPACE
|
EBI-IntAct/editor
|
src/main/java/uk/ac/ebi/intact/editor/controller/curate/complex/ModelledParticipantImportController.java
|
<filename>src/main/java/uk/ac/ebi/intact/editor/controller/curate/complex/ModelledParticipantImportController.java
/**
* Copyright 2010 The European Bioinformatics Institute, and others.
*
* 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 uk.ac.ebi.intact.editor.controller.curate.complex;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.orchestra.conversation.annotations.ConversationName;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import psidev.psi.mi.jami.model.Feature;
import psidev.psi.mi.jami.model.ModelledFeature;
import uk.ac.ebi.intact.editor.controller.curate.ChangesController;
import uk.ac.ebi.intact.editor.controller.curate.interaction.AbstractParticipantImportController;
import uk.ac.ebi.intact.editor.controller.curate.interaction.ImportCandidate;
import uk.ac.ebi.intact.editor.services.curate.cvobject.CvObjectService;
import uk.ac.ebi.intact.jami.model.extension.IntactComplex;
import uk.ac.ebi.intact.jami.model.extension.IntactInteractor;
import uk.ac.ebi.intact.jami.model.extension.IntactModelledParticipant;
import uk.ac.ebi.intact.jami.model.extension.IntactStoichiometry;
import java.util.ArrayList;
import java.util.Collection;
/**
* @author Marine Dumousseau (<EMAIL>)
* @version $Id$
*/
@Controller
@Scope("conversation.access")
@ConversationName("general")
public class ModelledParticipantImportController extends AbstractParticipantImportController<IntactModelledParticipant> {
private static final Log log = LogFactory.getLog(ModelledParticipantImportController.class);
@Autowired
private ChangesController changesController;
@Autowired
private ComplexController interactionController;
@Override
protected void initialiseOtherProperties() {
// nothing to do
}
@Override
protected void processAddedParticipant(IntactModelledParticipant participant) {
interactionController.addParticipant(participant);
interactionController.setUnsavedChanges(true);
}
@Override
protected void doSave() {
interactionController.doSave(false);
}
@Override
protected IntactModelledParticipant toParticipant(ImportCandidate candidate) {
return toParticipant(candidate, interactionController.getComplex());
}
protected IntactModelledParticipant toParticipant(ImportCandidate candidate, IntactComplex interaction) {
IntactInteractor interactor = candidate.getInteractor();
if (getCvBiologicalRole() == null) {
CvObjectService cvObjectService = getCvService();
if (getCvBiologicalRole() == null) {
setCvBiologicalRole(cvObjectService.getDefaultBiologicalRole());
}
}
IntactModelledParticipant component = new IntactModelledParticipant(interactor);
component.setInteraction(interaction);
component.setBiologicalRole(getCvBiologicalRole());
component.setStoichiometry(new IntactStoichiometry(getMinStoichiometry(), getMaxStoichiometry()));
if (candidate.isChain() || candidate.isIsoform()) {
Collection<String> parentAcs = new ArrayList<String>();
if (interaction.getAc() != null) {
parentAcs.add(interaction.getAc());
addParentAcsTo(parentAcs, interaction);
}
changesController.markAsHiddenChange(interactor, interaction, parentAcs,
getParticipantImportService().getIntactDao().getSynchronizerContext().getInteractorSynchronizer(), "Interactor "+interactor.getShortName());
}
// add cloned features
for (Feature f : candidate.getClonedFeatures()){
component.addFeature((ModelledFeature)f);
}
return component;
}
/**
* Add all the parent acs of this interaction
*
* @param parentAcs
* @param inter
*/
protected void addParentAcsTo(Collection<String> parentAcs, IntactComplex inter) {
if (inter.getAc() != null) {
parentAcs.add(inter.getAc());
}
}
public ComplexController getInteractionController() {
return interactionController;
}
}
|
curationexperts/cur
|
app/controllers/checks_controller.rb
|
<reponame>curationexperts/cur
# frozen_string_literal: true
class ChecksController < ApplicationController
before_action :authenticate_user!
before_action :ensure_admin!
with_themed_layout 'dashboard'
def index
@results = OkComputer::Registry.all.run
end
private
def ensure_admin!
authorize! :read, :admin_dashboard
end
end
|
dotjay/talkback
|
talkback/src/main/java/focusmanagement/interpreter/WindowTransitionInfo.java
|
/*
* Copyright (C) 2017 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.android.accessibility.talkback.focusmanagement.interpreter;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.util.SparseArray;
import android.view.accessibility.AccessibilityEvent;
import java.util.HashSet;
import java.util.List;
/**
* A data structure to cache information during window transition.
*
* <p><strong>Window transition</strong> happens when the user opens/closes an application, dialog,
* soft keyboard, etc. An accessibility service might receive <b>multiple</b> {@link
* AccessibilityEvent#TYPE_WINDOW_STATE_CHANGED} events during the transition. This class caches two
* kinds of information from the events:
*
* <ul>
* <li>ID of window being changed, retrieved by {@link AccessibilityEvent#getWindowId()}
* <li>Title of window, retrieved by {@link AccessibilityEvent#getText()}
* </ul>
*/
public class WindowTransitionInfo {
private static final int WINDOW_ID_NONE = -1;
// We ignore TYPE_WINDOWS_CHANGED event here because it doesn't contain window ID/title
// information.
private static final int EVENT_MASK = AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
/**
* Caches window title retrieved from TYPE_WINDOW_STATE_CHANGED events during the window
* transition.
*/
private SparseArray<CharSequence> mCachedWindowTitlesFromEvents = new SparseArray<>();
/** Caches ID of windows changed during the transition. */
private HashSet<Integer> mStateChangedWindows = new HashSet<>();
/** Caches window title and ID from events. */
public void updateTransitionInfoFromEvent(@NonNull AccessibilityEvent event) {
if ((event.getEventType() & EVENT_MASK) == 0) {
return;
}
cacheWindowIdUnderTransition(event);
// For some apps, the title information only resides in TYPE_WINDOW_STATE_CHANGED events. Thus
// we need to cache and propagate the title properly.
cacheWindowTitleFromEvent(event);
}
/** Returns whether the window with given windowId is changed during transition. */
public boolean isWindowStateRecentlyChanged(int windowId) {
return mStateChangedWindows.contains(windowId);
}
/** Returns the window title retrieved from accessibility events. */
public CharSequence getWindowTitle(int windowId) {
return mCachedWindowTitlesFromEvents.get(windowId);
}
/** Clears all the cached information during the transition. */
public void clear() {
mCachedWindowTitlesFromEvents.clear();
mStateChangedWindows.clear();
}
@NonNull
SparseArray<CharSequence> getWindowTitleMap() {
return mCachedWindowTitlesFromEvents;
}
private void cacheWindowIdUnderTransition(@NonNull AccessibilityEvent event) {
int windowId = event.getWindowId();
if (windowId != WINDOW_ID_NONE) {
mStateChangedWindows.add(windowId);
}
}
private void cacheWindowTitleFromEvent(@NonNull AccessibilityEvent event) {
int windowId = event.getWindowId();
if (windowId == WINDOW_ID_NONE) {
return;
}
List<CharSequence> texts = event.getText();
if (texts == null || texts.size() == 0) {
return;
}
// Same logic as in ProcessorScreen. The event text could be a list of text gathered from the
// node tree inside the window(e.g. AlertDialog). We aggressively assume the first text to be
// the window title.
CharSequence title = texts.get(0);
if (!TextUtils.isEmpty(title)) {
mCachedWindowTitlesFromEvents.put(windowId, title);
}
}
}
|
alexunder/CellMatrix
|
kernel/tegra/drivers/hwmon/ina219.c
|
/*
* ina219.c - driver for TI INA219 current / power monitor sensor
*
* Copyright (c) 2011-2013, NVIDIA Corporation.
*
* The INA219 is a sensor chip made by Texas Instruments. It measures
* power, voltage and current on a power rail.
* Complete datasheet can be obtained from website:
* http://focus.ti.com/lit/ds/symlink/ina219.pdf
*
* 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.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/spinlock.h>
#include <linux/sysfs.h>
#include <linux/kobject.h>
#include <linux/hrtimer.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/mutex.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/err.h>
#include <linux/gpio.h>
#include <linux/device.h>
#include "linux/ina219.h"
#include <linux/init.h>
#include <linux/hwmon-sysfs.h>
#include <linux/hwmon.h>
#define DRIVER_NAME "ina219"
/* INA219 register offsets */
#define INA219_CONFIG 0
#define INA219_SHUNT 1
#define INA219_VOLTAGE 2
#define INA219_POWER 3
#define INA219_CURRENT 4
#define INA219_CAL 5
#define INA219_RESET 0x8000
#define busv_register_to_mv(x) (((x) >> 3) * 4)
#define shuntv_register_to_uv(x) ((x) * 10)
struct power_mon_data {
s32 voltage;
s32 currentInMillis;
s32 power;
};
struct ina219_data {
struct device *hwmon_dev;
struct i2c_client *client;
struct ina219_platform_data *pInfo;
struct power_mon_data pm_data;
struct mutex mutex;
int state;
};
#define STOPPED 0
#define RUNNING 1
/* Set non-zero to enable debug prints */
#define INA219_DEBUG_PRINTS 0
#if INA219_DEBUG_PRINTS
#define DEBUG_INA219(x) printk x
#else
#define DEBUG_INA219(x)
#endif
static s32 power_down_INA219(struct i2c_client *client)
{
s32 retval;
retval = i2c_smbus_write_word_data(client, INA219_CONFIG, 0);
if (retval < 0)
dev_err(&client->dev, "power down failure sts: 0x%x\n", retval);
return retval;
}
static s32 power_up_INA219(struct i2c_client *client, u16 config_data)
{
s32 retval;
struct ina219_data *data = i2c_get_clientdata(client);
retval = i2c_smbus_write_word_data(client, INA219_CONFIG,
__constant_cpu_to_be16(config_data));
if (retval < 0)
goto error;
retval = i2c_smbus_write_word_data(client, INA219_CAL,
__constant_cpu_to_be16(data->pInfo->calibration_data));
if (retval < 0)
goto error;
return 0;
error:
dev_err(&client->dev, "power up failure sts: 0x%x\n", retval);
return retval;
}
static s32 show_rail_name(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct i2c_client *client = to_i2c_client(dev);
struct ina219_data *data = i2c_get_clientdata(client);
return sprintf(buf, "%s\n", data->pInfo->rail_name);
}
static s32 show_voltage(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct i2c_client *client = to_i2c_client(dev);
struct ina219_data *data = i2c_get_clientdata(client);
s32 voltage_mV;
int cur_state;
mutex_lock(&data->mutex);
cur_state = data->state;
if (data->state == STOPPED)
if (power_up_INA219(client, data->pInfo->trig_conf) < 0)
goto error;
/* getting voltage readings in milli volts*/
voltage_mV =
(s16)be16_to_cpu(i2c_smbus_read_word_data(client,
INA219_VOLTAGE));
DEBUG_INA219(("Ina219 voltage reg Value: 0x%x\n", voltage_mV));
if (voltage_mV < 0)
goto error;
voltage_mV = busv_register_to_mv(voltage_mV);
DEBUG_INA219(("Ina219 voltage in mv: %d\n", voltage_mV));
DEBUG_INA219(("%s volt = %d\n", __func__, voltage_mV));
if (cur_state == STOPPED)
if (power_down_INA219(client) < 0)
goto error;
mutex_unlock(&data->mutex);
return sprintf(buf, "%d mV\n", voltage_mV);
error:
mutex_unlock(&data->mutex);
dev_err(dev, "%s: failed\n", __func__);
return -EAGAIN;
}
static s32 show_shunt_voltage(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct i2c_client *client = to_i2c_client(dev);
struct ina219_data *data = i2c_get_clientdata(client);
s32 voltage_uV;
int cur_state;
mutex_lock(&data->mutex);
cur_state = data->state;
if (data->state == STOPPED)
if (power_up_INA219(client, data->pInfo->trig_conf) < 0)
goto error;
/* getting voltage readings in milli volts*/
voltage_uV =
be16_to_cpu(i2c_smbus_read_word_data(client,
INA219_SHUNT));
DEBUG_INA219(("Ina219 voltage reg Value: 0x%x\n", voltage_uV));
if (voltage_uV < 0)
goto error;
voltage_uV = shuntv_register_to_uv(voltage_uV);
if (cur_state == STOPPED)
if (power_down_INA219(client) < 0)
goto error;
mutex_unlock(&data->mutex);
DEBUG_INA219(("%s volt = %d\n", __func__, voltage_uV));
return sprintf(buf, "%d uV\n", voltage_uV);
error:
mutex_unlock(&data->mutex);
dev_err(dev, "%s: failed\n", __func__);
return -EAGAIN;
}
static s32 show_power2(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct i2c_client *client = to_i2c_client(dev);
struct ina219_data *data = i2c_get_clientdata(client);
s32 power_mW;
s32 voltage_shunt_uV;
s32 voltage_bus_mV;
s32 inverse_shunt_resistor;
int cur_state;
#if INA219_DEBUG_PRINTS
s32 power_raw;
#endif
mutex_lock(&data->mutex);
cur_state = data->state;
if (data->state == STOPPED)
if (power_up_INA219(client, data->pInfo->trig_conf) < 0)
goto error;
voltage_shunt_uV = be16_to_cpu(i2c_smbus_read_word_data(client,
INA219_SHUNT));
if (voltage_shunt_uV < 0)
goto error;
voltage_shunt_uV = shuntv_register_to_uv(voltage_shunt_uV);
voltage_bus_mV = be16_to_cpu(i2c_smbus_read_word_data(client,
INA219_VOLTAGE));
if (voltage_bus_mV < 0)
goto error;
voltage_bus_mV = busv_register_to_mv(voltage_bus_mV);
/*avoid overflow*/
inverse_shunt_resistor = 1000/(data->pInfo->shunt_resistor);
power_mW = voltage_shunt_uV * inverse_shunt_resistor; /*current uAmps*/
power_mW = power_mW / 1000; /*current mAmps*/
power_mW = power_mW * (voltage_bus_mV); /*Power uW*/
power_mW = power_mW / 1000; /*Power mW*/
#if INA219_DEBUG_PRINTS
power_raw = be16_to_cpu(i2c_smbus_read_word_data(client, INA219_POWER));
power_raw *= data->pInfo->power_lsb;
power_raw /= data->pInfo->precision_multiplier;
DEBUG_INA219(("INA219: power_mW: %d, power_raw:%d\n", power_mW,
power_raw));
#endif
if (cur_state == STOPPED)
if (power_down_INA219(client) < 0)
goto error;
mutex_unlock(&data->mutex);
DEBUG_INA219(("%s pow = %d\n", __func__, power_mW));
return sprintf(buf, "%d mW\n", power_mW);
error:
mutex_unlock(&data->mutex);
dev_err(dev, "%s: failed\n", __func__);
return -EAGAIN;
}
/*This function is kept to support INA219 on cardhu*/
static s32 show_power(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct i2c_client *client = to_i2c_client(dev);
struct ina219_data *data = i2c_get_clientdata(client);
s32 retval;
s32 power_mW;
s32 voltage_mV;
s32 overflow, conversion;
int cur_state;
mutex_lock(&data->mutex);
cur_state = data->state;
if (data->state == STOPPED) {
if (power_up_INA219(client, data->pInfo->trig_conf) < 0) {
retval = -EAGAIN;
goto error;
}
} else {
mutex_unlock(&data->mutex);
return show_power2(dev, attr, buf);
}
/* check if the readings are valid */
do {
/* read power register to clear conversion bit */
retval = be16_to_cpu(i2c_smbus_read_word_data(client,
INA219_POWER));
if (retval < 0) {
dev_err(dev, "CNVR bit clearing failure sts: 0x%x\n",
retval);
goto error;
}
voltage_mV =
be16_to_cpu(i2c_smbus_read_word_data(client,
INA219_VOLTAGE));
DEBUG_INA219(("Ina219 voltage reg Value: 0x%x\n", voltage_mV));
overflow = voltage_mV & 1;
if (overflow) {
dev_err(dev, "overflow error\n");
goto error;
}
conversion = (voltage_mV >> 1) & 1;
DEBUG_INA219(("\n ina219 CNVR value:%d", conversion));
} while (!conversion);
/* getting power readings in milli watts*/
power_mW = be16_to_cpu(i2c_smbus_read_word_data(client,
INA219_POWER));
DEBUG_INA219(("Ina219 power Reg: 0x%x\n", power_mW));
power_mW *= data->pInfo->power_lsb;
if (data->pInfo->precision_multiplier)
power_mW /= data->pInfo->precision_multiplier;
DEBUG_INA219(("Ina219 power Val: %d\n", power_mW));
if (power_mW < 0)
goto error;
/* set ina219 to power down mode */
retval = power_down_INA219(client);
if (retval < 0)
goto error;
mutex_unlock(&data->mutex);
DEBUG_INA219(("%s pow = %d\n", __func__, power_mW));
return sprintf(buf, "%d mW\n", power_mW);
error:
mutex_unlock(&data->mutex);
dev_err(dev, "%s: failed\n", __func__);
return retval;
}
static s32 show_current2(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct i2c_client *client = to_i2c_client(dev);
struct ina219_data *data = i2c_get_clientdata(client);
s32 current_mA;
s32 voltage_uV;
s32 inverse_shunt_resistor;
int cur_state;
#if INA219_DEBUG_PRINTS
s32 current_raw;
#endif
mutex_lock(&data->mutex);
cur_state = data->state;
if (data->state == STOPPED)
if (power_up_INA219(client, data->pInfo->trig_conf) < 0)
goto error;
voltage_uV =
(s16)be16_to_cpu(i2c_smbus_read_word_data(client,
INA219_SHUNT));
if (voltage_uV < 0)
goto error;
inverse_shunt_resistor = 1000/(data->pInfo->shunt_resistor);
voltage_uV = shuntv_register_to_uv(voltage_uV);
current_mA = voltage_uV * inverse_shunt_resistor;
current_mA = current_mA / 1000;
#if INA219_DEBUG_PRINTS
current_raw =
(s16)be16_to_cpu(i2c_smbus_read_word_data(client,
INA219_CURRENT));
current_raw *= data->pInfo->power_lsb;
current_raw /= data->pInfo->divisor;
current_raw /= data->pInfo->precision_multiplier;
DEBUG_INA219(("%s current = %d current_raw=%d\n", __func__, current_mA,
current_raw));
#endif
if (cur_state == STOPPED)
if (power_down_INA219(client) < 0)
goto error;
mutex_unlock(&data->mutex);
return sprintf(buf, "%d mA\n", current_mA);
error:
dev_err(dev, "%s: failed\n", __func__);
mutex_unlock(&data->mutex);
return -EAGAIN;
}
/*This function is kept to support INA219 on cardhu*/
static s32 show_current(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct i2c_client *client = to_i2c_client(dev);
struct ina219_data *data = i2c_get_clientdata(client);
s32 retval;
s32 current_mA;
s32 voltage_mV;
s32 overflow, conversion;
int cur_state;
mutex_lock(&data->mutex);
cur_state = data->state;
if (data->state == STOPPED) {
if (power_up_INA219(client, data->pInfo->trig_conf) < 0) {
retval = -EAGAIN;
goto error;
}
} else {
mutex_unlock(&data->mutex);
show_current2(dev, attr, buf);
}
/* check if the readings are valid */
do {
/* read power register to clear conversion bit */
retval = be16_to_cpu(i2c_smbus_read_word_data(client,
INA219_POWER));
if (retval < 0) {
dev_err(dev, "CNVR bit clearing failure sts: 0x%x\n",
retval);
goto error;
}
voltage_mV =
be16_to_cpu(i2c_smbus_read_word_data(client,
INA219_VOLTAGE));
DEBUG_INA219(("Ina219 voltage reg Value: 0x%x\n", voltage_mV));
overflow = voltage_mV & 1;
if (overflow) {
dev_err(dev, "overflow error\n");
goto error;
}
conversion = (voltage_mV >> 1) & 1;
DEBUG_INA219(("\n ina219 CNVR value:%d", conversion));
} while (!conversion);
/* getting current readings in milli amps*/
current_mA = be16_to_cpu(i2c_smbus_read_word_data(client,
INA219_CURRENT));
DEBUG_INA219(("Ina219 current Reg: 0x%x\n", current_mA));
if (current_mA < 0)
goto error;
current_mA =
(current_mA * data->pInfo->power_lsb) / data->pInfo->divisor;
if (data->pInfo->precision_multiplier)
current_mA /= data->pInfo->precision_multiplier;
DEBUG_INA219(("Ina219 current Value: %d\n", current_mA));
if (cur_state == STOPPED)
if (power_down_INA219(client) < 0)
goto error;
mutex_unlock(&data->mutex);
DEBUG_INA219(("%s current = %d\n", __func__, current_mA));
return sprintf(buf, "%d mA\n", current_mA);
error:
mutex_unlock(&data->mutex);
dev_err(dev, "%s: failed\n", __func__);
return retval;
}
static int ina219_state_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct i2c_client *client = to_i2c_client(dev);
struct ina219_data *data = i2c_get_clientdata(client);
int count;
mutex_lock(&data->mutex);
count = sprintf(buf, "%d\n", data->state);
mutex_unlock(&data->mutex);
return count;
}
static int ina219_state_set(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t size)
{
struct i2c_client *client = to_i2c_client(dev);
struct ina219_data *data = i2c_get_clientdata(client);
int retval = -1;
long new;
retval = kstrtol(buf, 10, &new);
if (retval < 0 || new > INT_MAX || new < INT_MIN)
return -EINVAL;
mutex_lock(&data->mutex);
if ((new > 0) && (data->state == STOPPED))
retval = power_up_INA219(client, data->pInfo->cont_conf);
else if ((new == 0) && (data->state == RUNNING))
retval = power_down_INA219(client);
if (retval < 0) {
dev_err(dev, "Error in switching INA on/off!");
mutex_unlock(&data->mutex);
return -EAGAIN;
}
if (new)
data->state = RUNNING;
else
data->state = STOPPED;
mutex_unlock(&data->mutex);
return 1;
}
static struct sensor_device_attribute ina219[] = {
SENSOR_ATTR(shunt_voltage, S_IRUGO, show_shunt_voltage, NULL, 0),
SENSOR_ATTR(rail_name, S_IRUGO, show_rail_name, NULL, 0),
SENSOR_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 0),
SENSOR_ATTR(curr1_input, S_IRUGO, show_current, NULL, 0),
SENSOR_ATTR(curr2_input, S_IRUGO, show_current2, NULL, 0),
SENSOR_ATTR(power1_input, S_IRUGO, show_power, NULL, 0),
SENSOR_ATTR(power2_input, S_IRUGO, show_power2, NULL, 0),
SENSOR_ATTR(cur_state, 0644, ina219_state_show, ina219_state_set, 0),
};
static int ina219_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct ina219_data *data;
int err;
u8 i;
data = kzalloc(sizeof(struct ina219_data), GFP_KERNEL);
if (!data) {
err = -ENOMEM;
goto exit;
}
i2c_set_clientdata(client, data);
data->pInfo = client->dev.platform_data;
mutex_init(&data->mutex);
data->state = STOPPED;
/* reset ina219 */
err = i2c_smbus_write_word_data(client, INA219_CONFIG,
__constant_cpu_to_be16(INA219_RESET));
if (err < 0) {
dev_err(&client->dev, "ina219 reset failure status: 0x%x\n",
err);
goto exit_free;
}
for (i = 0; i < ARRAY_SIZE(ina219); i++) {
err = device_create_file(&client->dev, &ina219[i].dev_attr);
if (err) {
dev_err(&client->dev, "device_create_file failed.\n");
goto exit_free;
}
}
data->hwmon_dev = hwmon_device_register(&client->dev);
if (IS_ERR(data->hwmon_dev)) {
err = PTR_ERR(data->hwmon_dev);
goto exit_remove;
}
err = power_down_INA219(client);
if (err < 0) {
dev_err(&client->dev, "ina219 power-down failure status: 0x%x\n",
err);
goto exit_remove;
}
return 0;
exit_remove:
for (i = 0; i < ARRAY_SIZE(ina219); i++)
device_remove_file(&client->dev, &ina219[i].dev_attr);
exit_free:
kfree(data);
exit:
return err;
}
static int ina219_remove(struct i2c_client *client)
{
u8 i;
struct ina219_data *data = i2c_get_clientdata(client);
mutex_lock(&data->mutex);
power_down_INA219(client);
data->state = STOPPED;
mutex_unlock(&data->mutex);
hwmon_device_unregister(data->hwmon_dev);
for (i = 0; i < ARRAY_SIZE(ina219); i++)
device_remove_file(&client->dev, &ina219[i].dev_attr);
kfree(data);
return 0;
}
static const struct i2c_device_id ina219_id[] = {
{DRIVER_NAME, 0 },
{}
};
MODULE_DEVICE_TABLE(i2c, ina219_id);
static struct i2c_driver ina219_driver = {
.class = I2C_CLASS_HWMON,
.driver = {
.name = DRIVER_NAME,
},
.probe = ina219_probe,
.remove = ina219_remove,
.id_table = ina219_id,
};
static int __init ina219_init(void)
{
return i2c_add_driver(&ina219_driver);
}
static void __exit ina219_exit(void)
{
i2c_del_driver(&ina219_driver);
}
module_init(ina219_init);
module_exit(ina219_exit);
MODULE_LICENSE("GPL");
|
BuildingBridge/biznet
|
bitrix/modules/intranet/install/components/bitrix/intranet.user.search/templates/.default/script.js
|
<filename>bitrix/modules/intranet/install/components/bitrix/intranet.user.search/templates/.default/script.js
function JCEmployeeSelectControl(arParams)
{
var _this = this;
this.arParams = arParams; // {LANGUAGE_ID, ONSELECT, MULTIPLE, VALUE, SITE_ID, IS_EXTRANET, SESSID, NAME_TEMPLATE}
this.arEmployeesData = {};
this.multiple = this.arParams.MULTIPLE;
if (null != arParams.VALUE)
this.SetValue(arParams.VALUE);
this.div = null;
this._onkeypress = function(e)
{
if (null == e) e = window.event;
if (null == e) return;
if (e.keyCode == 27)
_this.CloseDialog();
}
// current value and its setter and getter
var current_value = this.multiple ? [] : 0;
this.SetValue = function(value)
{
if (this.multiple)
{
if (typeof value == 'string' || typeof value == 'object' && value.constructor == String)
value = value.split(',');
if (typeof value == 'object')
{
current_value = [];
for (var i = 0; i < value.length; i++)
{
var q = parseInt(value[i]);
if (!isNaN(q))
current_value[current_value.length] = q;
}
}
return typeof current_value == 'object';
}
else
{
current_value = parseInt(value);
return !isNaN(current_value);
}
}
this.GetValue = function(tostring)
{
if (this.multiple)
{
if (null == tostring) tostring = false;
if (tostring)
{
if (null != current_value)
return current_value.join(',');
}
return current_value;
}
else
{
return parseInt(current_value);
}
}
}
JCEmployeeSelectControl.prototype.OnSelect = function()
{
if (null != this.arParams.ONSELECT)
{
var value = this.GetValue();
if (this.arParams.GET_FULL_INFO)
{
if (!this.multiple)
{
value = this.arEmployeesData[value];
value.NAME = value.NAME.replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/&/g, '&');
}
else
{
var new_value = [];
for (var i = 0; i < value.length; i++)
{
var v = this.arEmployeesData[value[i]];
v.NAME = v.NAME.replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/&/g, '&');
new_value[new_value.length] = v;
}
value = new_value;
}
this.arParams.ONSELECT(value);
}
else
{
this.arParams.ONSELECT(value);
}
}
}
JCEmployeeSelectControl.prototype.Show = function(arParams)
{
if(null != this.div)
return;
var _this = this;
if (null == arParams) arParams = {};
if (null == arParams.id) arParams.id = 'employee_select_control';
if (null == arParams.className) arParams.className = '';
this.arParams.WIN = arParams;
CHttpRequest.Action = function(result) {_this._ShowWindow(result)};
var url = '/bitrix/components/bitrix/intranet.user.search/ajax.php?lang=' + this.arParams.LANGUAGE_ID + '&win_id=' +this.arParams.WIN.id + '&SITE_ID=' + this.arParams.SITE_ID + '&IS_EXTRANET=' + this.arParams.IS_EXTRANET + '&sessid=' + this.arParams.SESSID + '&nt=' + this.arParams.NAME_TEMPLATE;
var value = this.GetValue(true);
if ((this.multiple ? value.length : value) > 0)
url += '&value=' + value;
if (this.multiple)
url += '&multiple=Y';
ShowWaitWindow();
CHttpRequest.Send(url);
}
JCEmployeeSelectControl.prototype._ShowWindow = function(result)
{
CloseWaitWindow();
var _this = this;
this.div = document.body.appendChild(document.createElement("DIV"));
this.div.id = this.arParams.WIN.id;
this.div.className = "settings-float-form" + (this.arParams.WIN && this.arParams.WIN.className ? ' ' + this.arParams.WIN.className : '');
this.div.style.position = 'absolute';
this.div.style.zIndex = '2200';
if(!!BX.WindowManager && !!BX.WindowManager.Get())
{
this.div.style.zIndex = BX.WindowManager.GetZIndex();
}
this.div.innerHTML = result;
this.div.__object = this;
var obSize = BX.GetWindowSize();
var left = parseInt(obSize.scrollLeft + obSize.innerWidth/2 - this.div.offsetWidth/2);
var top = parseInt(obSize.scrollTop + obSize.innerHeight/2 - this.div.offsetHeight/2);
jsFloatDiv.Show(this.div, left, top, false, false);
jsUtils.onCustomEvent('onEmployeeSearchShow', {div: this.div});
BX.bind(document, "keypress", this._onkeypress);
}
JCEmployeeSelectControl.prototype.CloseDialog = function()
{
BX.unbind(document, "keypress", this._onkeypress);
jsUtils.onCustomEvent('onEmployeeSearchClose', {div: this.div});
jsFloatDiv.Close(this.div);
this.div.parentNode.removeChild(this.div);
this.div = null;
}
|
PacktPublishing/Modernizing-Enterprise-CMS-using-Pimcore
|
4. Creating documentes in Pimcore/tmp/vendor/pimcore/pimcore/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/abstract.js
|
/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Enterprise License (PEL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PEL
*/
pimcore.registerNS("pimcore.element.selector.abstract");
pimcore.element.selector.abstract = Class.create({
initialize: function (parent) {
this.parent = parent;
this.initStore();
if(this.parent.multiselect) {
this.searchPanel = new Ext.Panel({
layout: "border",
items: [this.getForm(), this.getSelectionPanel(), this.getResultPanel()]
});
} else {
this.searchPanel = new Ext.Panel({
layout: "border",
items: [this.getForm(), this.getResultPanel()]
});
}
var user = pimcore.globalmanager.get("user");
if(user.isAllowed("tags_search")) {
this.searchPanel.add(this.getTagsPanel());
}
this.parent.setSearch(this.searchPanel);
},
addToSelection: function (data) {
// check for dublicates
var existingItem = this.selectionStore.find("id", data.id);
if(existingItem < 0) {
this.selectionStore.add(data);
}
},
getTagsPanel: function() {
if(!this.tagsPanel) {
var considerAllChildTags = Ext.create("Ext.form.Checkbox", {
style: "margin-bottom: 0; margin-left: 5px",
fieldStyle: "margin-top: 0",
cls: "tag-tree-topbar",
boxLabel: t("consider_child_tags"),
listeners: {
change: function (field, checked) {
var proxy = this.store.getProxy();
proxy.setExtraParam("considerChildTags", checked);
this.search();
}.bind(this)
}
});
var tree = new pimcore.element.tag.tree();
tree.setAllowAdd(false);
tree.setAllowDelete(false);
tree.setAllowDnD(false);
tree.setAllowRename(false);
tree.setShowSelection(true);
tree.setCheckChangeCallback(function(tree) {
var tagIds = tree.getCheckedTagIds();
var proxy = this.store.getProxy();
proxy.setExtraParam("tagIds[]", tagIds);
this.search();
}.bind(this, tree));
this.tagsPanel = Ext.create("Ext.Panel", {
region: "west",
width: 300,
collapsedCls: "tag-tree-toolbar-collapsed",
collapsible: true,
collapsed: true,
autoScroll: true,
items: [tree.getLayout()],
title: t('filter_tags'),
tbar: [considerAllChildTags],
iconCls: "pimcore_icon_element_tags"
});
}
return this.tagsPanel;
},
getData: function () {
if(this.parent.multiselect) {
this.tmpData = [];
if(this.selectionStore.getCount() > 0) {
this.selectionStore.each(function (rec) {
this.tmpData.push(rec.data);
}.bind(this));
return this.tmpData;
} else {
// is the store is empty and a item is selected take this
var selected = this.getGrid().getSelectionModel().getSelected();
if(selected) {
this.tmpData.push(selected.data);
}
}
return this.tmpData;
} else {
var selected = this.getGrid().getSelectionModel().getSelected();
if(selected) {
return selected.getAt(0).data;
}
return null;
}
},
getPagingToolbar: function() {
var pagingToolbar = pimcore.helpers.grid.buildDefaultPagingToolbar(this.store);
return pagingToolbar;
},
onRowContextmenu: function (grid, record, tr, rowIndex, e, eOpts ) {
var menu = new Ext.menu.Menu();
var data = grid.getStore().getAt(rowIndex);
menu.add(new Ext.menu.Item({
text: t('add'),
iconCls: "pimcore_icon_add",
handler: function (data) {
var selModel = grid.getSelectionModel();
var selectedRows = selModel.getSelection();
for (var i = 0; i < selectedRows.length; i++) {
this.addToSelection(selectedRows[i].data);
}
}.bind(this, data)
}));
e.stopEvent();
menu.showAt(e.getXY());
},
getGridSelModel: function() {
return Ext.create('Ext.selection.RowModel', {mode: (this.parent.multiselect ? "MULTI" : "SINGLE")});
},
updateTabTitle: function(term) {
if(this.parent.tabPanel) {
this.parent.tabPanel.setTitle(t('search') + ': <i>' + term + '</i>');
}
}
});
|
joshsh/twitlogic
|
twitlogic-core/src/test/java/net/fortytwo/twitlogic/syntax/afterthought/impl/ReviewMatcherTest.java
|
package net.fortytwo.twitlogic.syntax.afterthought.impl;
import net.fortytwo.twitlogic.model.Hashtag;
import net.fortytwo.twitlogic.model.PlainLiteral;
import net.fortytwo.twitlogic.model.Resource;
import net.fortytwo.twitlogic.model.Triple;
import net.fortytwo.twitlogic.model.URIReference;
import net.fortytwo.twitlogic.syntax.MatcherTestBase;
import net.fortytwo.twitlogic.syntax.afterthought.DemoAfterthoughtMatcher;
import net.fortytwo.twitlogic.vocabs.RDF;
import net.fortytwo.twitlogic.vocabs.Review;
/**
* @author <NAME> (http://fortytwo.net).
*/
public class ReviewMatcherTest extends MatcherTestBase {
private static final Resource
THEBESTMOVIEEVER = new Hashtag("thebestmovieever");
private static final URIReference
HASREVIEW = new URIReference(Review.HASREVIEW),
MAXRATING = new URIReference(Review.MAXRATING),
MINRATING = new URIReference(Review.MINRATING),
RATING = new URIReference(Review.RATING),
REVIEW = new URIReference(Review.REVIEW),
REVIEWER = new URIReference(Review.REVIEWER),
TEXT = new URIReference(Review.TEXT),
TYPE = new URIReference(RDF.TYPE);
public void setUp() {
matcher = new DemoAfterthoughtMatcher();
}
public void testAll() throws Exception {
Resource review = bnode(bnodeIndex + 1);
assertExpected("IMHO, #thebestmovieever (3/5) is only so-so.",
new Triple(THEBESTMOVIEEVER, HASREVIEW, review),
new Triple(review, TYPE, REVIEW),
new Triple(review, RATING, new PlainLiteral("3")),
new Triple(review, MAXRATING, new PlainLiteral("5")),
new Triple(review, MINRATING, new PlainLiteral("0")),
// FIXME: restore this once the corresponding statement is restored in ReviewMatcher
// new Triple(review, REVIEWER, tweetContext.thisPerson()),
new Triple(review, TEXT, new PlainLiteral("IMHO, #thebestmovieever (3/5) is only so-so.")));
}
public void testOutOfRangeNumbers() throws Exception {
assertExpected("... #foo (3/6) ...");
assertExpected("... #foo (3/3) ...");
assertExpected("... #foo (5/4) ...");
assertExpected("... #foo (-1/5) ...");
}
}
|
bijancot/materikuliah
|
Semester 3/Praktikum Pemprograman Dasar 2/pertemuan yang tertunda/tugas/Modul6/src/modul6/Graph.java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package modul6;
import java.util.ArrayList;
/**
*
* @author yohan
*/
public class Graph {
ArrayList<GraphNode> nodes;
ArrayList<GraphEdge> edges;
/* set this.nodes into new Arraylist<GraphNode>
set this.edges into new Arraylist<GraphEdge>
*/
public Graph() {
this.nodes = new ArrayList<GraphNode>();
this.edges = new ArrayList<GraphEdge>();
}
void add_node(GraphNode new_node) {
this.nodes.add(new_node);
}
void add_edge(GraphEdge new_edge) {
this.edges.add(new_edge);
}
void remove_node(GraphNode deleted_node) {
this.nodes.remove(deleted_node);
int i = 0;
while (i < this.edges.size()) {
GraphEdge edge = edges.get(i);
if (edge.src == deleted_node || edge.dst == deleted_node) {
this.edges.remove(edge);
} else {
i++;
}
}
}
void remove_edge(GraphEdge deleted_edge) {
this.edges.remove(deleted_edge);
}
ArrayList<GraphEdge> get_edges_by_source_node(GraphNode node) {
ArrayList<GraphEdge> node_edges = new ArrayList<GraphEdge>();
for (int i = 0; i < this.edges.size(); i++) {
GraphEdge edge = this.edges.get(i);
if (edge.src == node || edge.dst == node) {
node_edges.add(edge);
}
}
return node_edges;
}
GraphNode get_node_by_data(int data) {
for (int i = 0; i < this.nodes.size(); i++) {
GraphNode node = this.nodes.get(i);
if (node.data == data) {
return node;
}
}
return null;
}
Tree to_tree(int root_data) {
TreeNode first_tree_node = new TreeNode(root_data);
first_tree_node = this.completing_tree_node(first_tree_node);
Tree t = new Tree(first_tree_node);
return t;
}
TreeNode completing_tree_node(TreeNode tree_node) {
int data = tree_node.data;
GraphNode graph_node = this.get_node_by_data(data);
ArrayList<GraphEdge> edges = this.get_edges_by_source_node(graph_node);
for (int i = 0; i < edges.size(); i++) {
GraphEdge edge = edges.get(i);
if (edge.src == graph_node) {
int new_data = edge.dst.data;
boolean should_add_new_data = true;
TreeNode current_tree_node = tree_node;
while (current_tree_node != null) {
if (current_tree_node.data == new_data) {
should_add_new_data = false;
break;
}
current_tree_node = current_tree_node.parent;
}
if (should_add_new_data) {
TreeNode new_tree_node = new TreeNode(new_data);
tree_node.add_child(new_tree_node, edge.distance);
int last_index = tree_node.children.size() - 1;
tree_node.children.set(last_index, this.completing_tree_node(new_tree_node));
}
}
}
return tree_node;
}
}
|
peterbeers/sekken
|
spec/integration/xignite_spec.rb
|
require 'spec_helper'
describe 'Integration with Xignite' do
# reference: http://www.xignite.com/product/global-security-master-data/api/GetSecurities/
subject(:client) { Sekken.new fixture('wsdl/xignite') }
let(:service_name) { :XigniteGlobalMaster }
let(:port_name) { :XigniteGlobalMasterSoap12 }
it 'returns a map of services and ports' do
expect(client.services).to eq(
'XigniteGlobalMaster' => {
ports: {
'XigniteGlobalMasterSoap' => {
type: 'http://schemas.xmlsoap.org/wsdl/soap/',
location: 'http://globalmaster.xignite.com/xglobalmaster.asmx'
},
'XigniteGlobalMasterSoap12' => {
type: 'http://schemas.xmlsoap.org/wsdl/soap12/',
location: 'http://globalmaster.xignite.com/xglobalmaster.asmx'
}
}
}
)
end
it 'knows the operations' do
operation = client.operation(service_name, port_name, :GetSecurities)
expect(operation.soap_action).to eq('http://www.xignite.com/services/GetSecurities')
expect(operation.endpoint).to eq('http://globalmaster.xignite.com/xglobalmaster.asmx')
namespace = 'http://www.xignite.com/services/'
expect(operation.body_parts).to eq([
[['GetSecurities'], { namespace: namespace, form: 'qualified', singular: true }],
[['GetSecurities', 'Identifiers'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
[['GetSecurities', 'IdentifierType'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
[['GetSecurities', 'AsOfDate'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }]
])
end
it 'creates an example header' do
operation = client.operation(service_name, port_name, :GetSecurities)
expect(operation.example_header).to eq(
Header: {
Username: 'string',
Password: '<PASSWORD>',
Tracer: 'string'
}
)
end
it 'creates an example body' do
operation = client.operation(service_name, port_name, :GetSecurities)
expect(operation.example_body).to eq(
GetSecurities: {
Identifiers: 'string',
IdentifierType: 'string',
AsOfDate: 'string'
}
)
end
it 'creates a request with a header' do
operation = client.operation(service_name, port_name, :GetSecurities)
operation.header = {
Header: {
Username: 'test',
Password: '<PASSWORD>',
Tracer: 'i-dont-know'
}
}
operation.body = {
GetSecurities: {
Identifiers: 'NESN.XVTX,BMW.XETR',
IdentifierType: 'Symbol',
AsOfDate: '6/4/2013'
}
}
expected = Nokogiri.XML('
<env:Envelope
xmlns:lol0="http://www.xignite.com/services/"
xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<lol0:Header>
<lol0:Username>test</lol0:Username>
<lol0:Password><PASSWORD></lol0:Password>
<lol0:Tracer>i-dont-know</lol0:Tracer>
</lol0:Header>
</env:Header>
<env:Body>
<lol0:GetSecurities>
<lol0:Identifiers>NESN.XVTX,BMW.XETR</lol0:Identifiers>
<lol0:IdentifierType>Symbol</lol0:IdentifierType>
<lol0:AsOfDate>6/4/2013</lol0:AsOfDate>
</lol0:GetSecurities>
</env:Body>
</env:Envelope>
')
expect(Nokogiri.XML operation.build).
to be_equivalent_to(expected).respecting_element_order
end
end
|
lonnywong/homebrew-core
|
Formula/dsh.rb
|
<gh_stars>10-100
class Dsh < Formula
desc "Dancer's shell, or distributed shell"
homepage "https://www.netfort.gr.jp/~dancer/software/dsh.html.en"
url "https://www.netfort.gr.jp/~dancer/software/downloads/dsh-0.25.10.tar.gz"
sha256 "520031a5474c25c6b3f9a0840e06a4fea4750734043ab06342522f533fa5b4d0"
license "GPL-2.0"
livecheck do
url "https://www.netfort.gr.jp/~dancer/software/downloads/"
regex(/href=.*?dsh[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_monterey: "a4100e069145478ff23600954f9e30f93ae3f8e2485cf254899a1ee281080b2a"
sha256 arm64_big_sur: "5e691ea82431b5921a5ce57f26e0219c0f5c38decd4249c3fb49beed4f284c4b"
sha256 monterey: "2fba1c82686d6522582b09a4d7048c8685a56b10ef355c3a2895f3d7a4ba1fbf"
sha256 big_sur: "8179e3e553da0ac7b40a6b69c0cd47283ce7ab80f399e0f84b57210fa8b6784b"
sha256 catalina: "96b9dda875dac2f33db11bd912a9fd1babac7c2baa76fc0036386442dafaabd2"
sha256 mojave: "e978724605a216f2e3ffc5df3ba12bb53e3150aa63b7d18779723e563a35f867"
sha256 high_sierra: "5d553941319eae8d839a53063057fff05b359eb13e53da2d7313c3d41fae88b0"
sha256 sierra: "9d694a476e5d74d7c3edbf284628e3f68c96c5a30c91b7fd3c624630805636ea"
sha256 el_capitan: "0b6a147235228473634c424e5e12671b6e9a4609ce6b732dd5ca9f56f335add5"
sha256 x86_64_yosemite: "fba83e836f8fa0ddca0a9c35f5f8781aabb0a3c7dfadc8eb6cd69ca1e2930cd0"
sha256 x86_64_linux: "b0489652a4291212811da8fdc746690777acbfaafd90f0dfd050fb4699e57734"
end
depends_on "libdshconfig"
on_macos do
depends_on "gnu-sed" => :build
end
def install
# Use GNU sed on macOS to avoid this build failure:
# sed: RE error: illegal byte sequence
# Reported to the upstream developer by email as a bug tracker does not exist.
ENV.prepend_path "PATH", Formula["gnu-sed"].libexec/"gnubin" if OS.mac?
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make", "install"
end
end
|
scele/bb-clientd
|
pkg/cas/tree_directory_walker.go
|
package cas
import (
"context"
"fmt"
remoteexecution "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
"github.com/buildbarn/bb-remote-execution/pkg/cas"
"github.com/buildbarn/bb-storage/pkg/digest"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
type treeDirectoryWalker struct {
fetcher IndexedTreeFetcher
treeDigest digest.Digest
}
// NewTreeDirectoryWalker creates a DirectoryWalker that assumes that
// all Directory messages are stored in a single Tree object in the
// Content Addressable Storage (CAS). This is the case for output
// directories of build actions.
func NewTreeDirectoryWalker(fetcher IndexedTreeFetcher, treeDigest digest.Digest) cas.DirectoryWalker {
return &treeRootDirectoryWalker{
treeDirectoryWalker: treeDirectoryWalker{
fetcher: fetcher,
treeDigest: treeDigest,
},
}
}
func (dw *treeDirectoryWalker) GetChild(childDigest digest.Digest) cas.DirectoryWalker {
return &treeChildDirectoryWalker{
treeDirectoryWalker: dw,
childDigest: childDigest.GetKey(digest.KeyWithoutInstance),
}
}
func (dw *treeDirectoryWalker) GetContainingDigest() digest.Digest {
return dw.treeDigest
}
type treeRootDirectoryWalker struct {
treeDirectoryWalker
}
func (dw *treeRootDirectoryWalker) GetDirectory(ctx context.Context) (*remoteexecution.Directory, error) {
indexedTree, err := dw.fetcher.GetIndexedTree(ctx, dw.treeDigest)
if err != nil {
return nil, err
}
if indexedTree.Root == nil {
return nil, status.Error(codes.InvalidArgument, "Tree does not contain a root directory")
}
return indexedTree.Root, nil
}
func (dw *treeRootDirectoryWalker) GetDescription() string {
return fmt.Sprintf("Tree %#v root directory", dw.treeDigest.String())
}
type treeChildDirectoryWalker struct {
*treeDirectoryWalker
childDigest string
}
func (dw *treeChildDirectoryWalker) GetDirectory(ctx context.Context) (*remoteexecution.Directory, error) {
indexedTree, err := dw.fetcher.GetIndexedTree(ctx, dw.treeDigest)
if err != nil {
return nil, err
}
child, ok := indexedTree.Children[dw.childDigest]
if !ok {
return nil, status.Error(codes.InvalidArgument, "Child directory not found in tree")
}
return child, nil
}
func (dw *treeChildDirectoryWalker) GetDescription() string {
return fmt.Sprintf("Tree %#v child directory %#v", dw.treeDigest.String(), dw.childDigest)
}
|
luka9001/Ume0622
|
pages/util/cache.js
|
<reponame>luka9001/Ume0622<filename>pages/util/cache.js
const data = {
data: '',//ๅนฟๅบ้กต้ขๅฐdetail้กต้ข data
type: '',//ๅนฟๅบ้กต้ขๅฐdetail้กต้ข type
userInfo: '',
rowHeight: 0,
language: [],
nlanguage: []
};
export default data;
|
felamaslen/calculator
|
src/store/configureStore.dev.js
|
/* eslint-disable no-underscore-dangle, global-require */
import { applyMiddleware, createStore, compose } from 'redux';
import createSagaMiddleware from 'redux-saga';
import { createLogger } from 'redux-logger';
import rootSaga from '../sagas';
import rootReducer from '../reducers';
import * as A from '../constants/actions';
const sagaMiddleware = createSagaMiddleware();
const SKIP_LOG_ACTIONS = [
A.INPUT_CHANGED
];
const logger = createLogger({
collapsed: true,
predicate: (getState, action) => SKIP_LOG_ACTIONS.indexOf(action.type) === -1
});
const newStore = initialState => {
const createStoreWithMiddleware = compose(
applyMiddleware(sagaMiddleware, logger)
)(createStore);
const store = createStoreWithMiddleware(
rootReducer,
initialState,
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__({
actionsBlacklist: SKIP_LOG_ACTIONS
})
);
sagaMiddleware.run(rootSaga);
if (module.hot) {
module.hot.accept('../reducers', () => {
store.replaceReducer(require('../reducers').default);
});
}
return store;
};
export default newStore;
|
Geller99/Fluxara
|
Client/src/features/SearchQuery.js
|
import React, { useState } from "react";
import { newsHandlerSecondary } from "./NewsAPI";
import Secondmodal from "./Modal2";
import "../style/features/header.css";
const SearchQuery = () => {
const [showModal, setModal] = useState(false);
const [item, setItem] = useState(null);
const result = [];
const openModal = () => {
setModal((prev) => !prev);
};
const changeHandler = (e) => {
setItem(e.target.value);
};
const submitHandler = () => {
newsHandlerSecondary(item, result);
openModal();
};
/*
Make news API requests based on keywords entered into a search bar...
return results in generated news tabs (Portals) that can be clicked and read
Result tabs clicked will open in a modal with scroll and full article
*/
return (
<form className="searchForm" onSubmit={(e) => e.preventDefault()}>
<input
onChange={changeHandler}
type="text"
className="searchForm_text"
placeholder="Search topic..."
/>
<div onClick={submitHandler} className="searchForm_icon">
{" "}
<button className="searchForm_button">Search</button>
</div>
{
<Secondmodal
setModal={setModal}
showModal={showModal}
result={result}
item={item}
/>
}
</form>
);
};
export default SearchQuery;
|
mtahmed/antnest
|
slave.py
|
<gh_stars>1-10
# Standard imports
import os
import socket
import time
# Custom imports
import messenger
import message
import node
import taskunit
class Slave(node.LocalNode):
'''An instance of this class represents a slave node.
A slave node can accept work units from a master and process and send the
results back.
'''
def __init__(self, port, ip=None):
'''
:param port: port number to run this slave on.
'''
config_filename = '%s-slave-config.json' % socket.gethostname()
config_path = os.path.join('config', config_filename)
super().__init__(config_path=config_path)
self.task_q = []
self.master_nodes = []
self.config['port'] = port
messenger_type = messenger.ZMQMessenger.TYPE_CLIENT
self.messenger = messenger.ZMQMessenger(type=messenger_type,
port=self.config['port'])
self.messenger.start()
for master in self.config['masters']:
master_hostname = master['hostname']
try:
master_port = master['port']
except KeyError:
master_port = messenger.UDPMessenger.DEFAULT_PORT
try:
master_ip = master['ip']
except:
master_ip = socket.gethostbyname(master['hostname'])
self.master_nodes.append(node.RemoteNode(master_hostname,
(master_ip, master_port)))
self.messenger.register_destination(master_hostname,
(master_ip, master_port))
# When everything is setup, associate with the master(s).
self.associate()
return
def associate(self):
'''Associate with the master(s).
This involves sending a status update to the master.
'''
for master in self.master_nodes:
self.messenger.connect(master.address)
print("Connected to %s:%s" % master.address)
return
def worker(self):
'''The main worker loop.
This method keeps running for the life of Slave. It asks for new
messages from this Slave's messenger. It then appropriately handles the
message. Some of the messages are TaskUnits that need to be run.
If the message happens to be a TaskUnit, then this method
executes the run() method of the TaskUnit and waits for it to complete.
It then sets the status of the TaskUnit appropriately and sends the it
back to the master through the messenger.
'''
for address, msg in self.messenger.receive(deserialize=False):
if msg == 'PONG':
print("SLAVE: PONG from %s:%d" % address)
elif msg['class'] == 'taskunit.TaskUnit':
#object_dict = msg.msg_payload.decode('utf-8')
tu = taskunit.TaskUnit.deserialize(msg)
# TODO(mtahmed): Run this in a new thread? Maybe? Investigate.
tu.run()
self.messenger.send_taskunit_result(tu, address)
|
FlameTinary/TYDemos
|
Demos/TYDrawDemo/TYDrawDemo/Views/TYLineLayer.h
|
//
// TYLineLayer.h
// TYDrawDemo
//
// Created by ็ฐๅฎ on 2019/7/25.
// Copyright ยฉ 2019 Sheldon. All rights reserved.
//
#import <QuartzCore/QuartzCore.h>
#import "TYBezierPath.h"
NS_ASSUME_NONNULL_BEGIN
@interface TYLineLayer : CALayer
@property(nonatomic, assign) UInt32 lineColor;
@property(nonatomic, assign) CGFloat lineWidth;
@property(nonatomic, strong) TYBezierPath *bezierPath;
@end
NS_ASSUME_NONNULL_END
|
gaoht/house
|
java/classes/cn/jiguang/c/e/a/b.java
|
<gh_stars>1-10
package cn.jiguang.c.e.a;
import cn.jiguang.api.JResponse;
import cn.jiguang.api.utils.ByteBufferUtils;
import cn.jiguang.api.utils.ProtocolUtil;
import cn.jiguang.c.e.a.a.c;
import java.nio.ByteBuffer;
public final class b
extends JResponse
{
private static final String[] z;
long a;
String b;
static
{
String[] arrayOfString = new String[4];
Object localObject1 = "#H\005!2\005O\007\"\016\023Y";
int i = -1;
int j = 0;
Object localObject3 = arrayOfString;
localObject1 = ((String)localObject1).toCharArray();
int k = localObject1.length;
int m;
int n;
int i1;
label42:
Object localObject2;
int i2;
label91:
label113:
Object localObject4;
int i3;
if (k <= 1)
{
m = 0;
n = j;
i1 = i;
j = m;
for (;;)
{
localObject2 = localObject1;
i2 = localObject2[m];
switch (j % 5)
{
default:
i = 96;
localObject2[m] = ((char)(i ^ i2));
j += 1;
if (k != 0) {
break label113;
}
m = k;
}
}
i = k;
localObject4 = localObject3;
i3 = n;
localObject2 = localObject1;
i2 = i1;
}
for (;;)
{
i1 = i2;
localObject1 = localObject2;
n = i3;
localObject3 = localObject4;
k = i;
m = j;
if (i > j) {
break label42;
}
localObject1 = new String((char[])localObject2).intern();
switch (i2)
{
default:
localObject4[i3] = localObject1;
localObject1 = "@\021W";
j = 1;
i = 0;
break;
case 0:
localObject4[i3] = localObject1;
localObject1 = ";\003?\f2Y\004=\017\016O\022\020@M\034\004(\016\004Y\005\004\004Z";
j = 2;
i = 1;
break;
case 1:
localObject4[i3] = localObject1;
j = 3;
localObject1 = "L\034\032>\007#S\0319\005\016HM";
i = 2;
break;
case 2:
localObject4[i3] = localObject1;
z = arrayOfString;
return;
i = 96;
break label91;
i = 60;
break label91;
i = 119;
break label91;
i = 77;
break label91;
m = 0;
i2 = i;
localObject2 = localObject1;
i3 = j;
localObject4 = localObject3;
i = k;
j = m;
}
}
}
public b(c paramc, ByteBuffer paramByteBuffer)
{
super(paramc, paramByteBuffer);
}
public final long a()
{
return this.a;
}
public final String b()
{
return this.b;
}
public final String getName()
{
return z[0];
}
protected final boolean isNeedParseeErrorMsg()
{
return false;
}
public final void parseBody()
{
super.parseBody();
ByteBuffer localByteBuffer = this.body;
this.a = ByteBufferUtils.getLong(localByteBuffer, this);
this.b = ProtocolUtil.getTlv2(localByteBuffer, this);
}
public final String toString()
{
return z[2] + this.a + z[3] + this.b + z[1] + super.toString();
}
public final void writeBody()
{
super.writeBody();
writeLong8(this.a);
writeTlv2(this.b);
}
}
/* Location: /Users/gaoht/Downloads/zirom/classes-dex2jar.jar!/cn/jiguang/c/e/a/b.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
|
Andrettin/Metternich
|
script/condition/commodity_condition.h
|
#pragma once
#include "economy/commodity.h"
#include "script/condition/condition.h"
#include "script/condition/condition_check_base.h"
namespace metternich {
class commodity;
template <typename T>
class commodity_condition final : public condition<T>
{
public:
commodity_condition(const std::string &commodity_identifier, const gsml_operator effect_operator)
: condition<T>(effect_operator)
{
this->commodity = commodity::get(commodity_identifier);
}
virtual const std::string &get_identifier() const override
{
static const std::string identifier = "commodity";
return identifier;
}
virtual bool check_assignment(const T *scope) const override
{
return this->check_equality(scope);
}
virtual bool check_equality(const T *scope) const override
{
//check whether the scope's commodity is the same as that for this condition
return scope->get_commodity() == this->commodity;
}
virtual void bind_condition_check(condition_check_base &check, const T *scope) const override
{
scope->connect(scope, &T::commodity_changed, scope, [&check](){ check.set_result_recalculation_needed(); }, Qt::ConnectionType::DirectConnection);
}
virtual std::string get_assignment_string() const override
{
return this->get_equality_string();
}
virtual std::string get_equality_string() const override
{
return "Commodity is " + this->commodity->get_name();
}
virtual std::string get_inequality_string() const override
{
return "Commodity is not " + this->commodity->get_name();
}
private:
const metternich::commodity *commodity = nullptr;
};
}
|
DimChris0/lima-charlie
|
sensor/executables/rpHCP_HostBasedSensor/collector_2_dns_tracker.c
|
/*
Copyright 2015 refractionPOINT
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 <rpal/rpal.h>
#include <librpcm/librpcm.h>
#include "collectors.h"
#include <notificationsLib/notificationsLib.h>
#include <libOs/libOs.h>
#include <rpHostCommonPlatformLib/rTags.h>
#include <kernelAcquisitionLib/kernelAcquisitionLib.h>
#define RPAL_FILE_ID 71
#ifdef RPAL_PLATFORM_WINDOWS
#include <windows_undocumented.h>
#pragma warning( disable: 4214 )
#include <WinDNS.h>
RPRIVATE HMODULE hDnsApi = NULL;
RPRIVATE DnsGetCacheDataTable_f getCache = NULL;
RPRIVATE DnsFree_f freeCacheEntry = NULL;
#endif
#define DNS_LABEL_MAX_SIZE 254
#define DNS_SANITY_MAX_RECORDS 50
#define DNS_KB_PACKET_BUFFER 128
#define DNS_A_RECORD 0x0001
#define DNS_AAAA_RECORD 0x001C
#define DNS_CNAME_RECORD 0x0005
// Labels in DNS can be literals or relative offsets.
// http://www.zytrax.com/books/dns/ch15/
#define DNS_LABEL_POINTER_INDICATOR 0xC0
#define DNS_LABEL_IS_OFFSET( pLabel ) ((pLabel)->nChar >= DNS_LABEL_POINTER_INDICATOR)
#define DNS_LABEL_POINTER_BASE 0xC000
#define DNS_LABEL_OFFSET( pLabel ) (rpal_ntoh16( *(RU16*)(pLabel) ) - DNS_LABEL_POINTER_BASE)
typedef struct
{
RU16 type;
RU16 unused;
RU32 flags;
RPNCHAR name;
} _dnsRecord;
#pragma pack(push, 1)
typedef struct
{
RU16 msgId;
RU8 rd : 1;
RU8 tc : 1;
RU8 aa : 1;
RU8 opCode : 4;
RU8 qr : 1;
RU8 rCode : 4;
RU8 reserved : 3;
RU8 ra : 1;
RU16 qdCount;
RU16 anCount;
RU16 nsCount;
RU16 arCount;
RU8 data[];
} DnsHeader;
typedef struct
{
RU8 nChar;
RU8 label[];
} DnsLabel;
typedef struct
{
RU16 recordType;
RU16 recordClass;
} DnsQuestionInfo;
typedef struct
{
RU16 recordType;
RU16 recordClass;
RU32 ttl;
RU16 rDataLength;
RU8 rData[];
} DnsResponseInfo;
#pragma pack(pop)
// Parses a label from a DNS packet and returns a pointer to the next byte after the label
// or label chain to be used to continue parsing the packet.
// If a human label is specified, will also assemble a human readable version of the labels
// in the buffer.
RPRIVATE
DnsLabel*
dnsReadLabels
(
DnsLabel* pLabel,
RCHAR humanLabel[ DNS_LABEL_MAX_SIZE ],
RPU8 packetStart,
RSIZET packetSize,
RU32 labelOffset,
RU32 recursiveDepth
)
{
RU32 copied = labelOffset;
if( 3 < recursiveDepth )
{
return NULL;
}
if( NULL == pLabel )
{
return NULL;
}
while( IS_WITHIN_BOUNDS( pLabel, sizeof( *pLabel ), packetStart, packetSize ) &&
( DNS_LABEL_IS_OFFSET( pLabel ) ||
( IS_WITHIN_BOUNDS( pLabel, sizeof( *pLabel ) + pLabel->nChar, packetStart, packetSize ) &&
0 != pLabel->nChar ) ) )
{
// It's possible for a pointer to be terminating a traditional label
if( DNS_LABEL_IS_OFFSET( pLabel ) )
{
// Pointer to a label
DnsLabel* tmpLabel = NULL;
RU16 offset = DNS_LABEL_OFFSET( pLabel );
if( !IS_WITHIN_BOUNDS( (RPU8)packetStart + offset, sizeof( RU16 ), packetStart, packetSize ) )
{
rpal_debug_warning( "error parsing dns packet" );
return NULL;
}
tmpLabel = (DnsLabel*)( (RPU8)packetStart + offset );
if( NULL == dnsReadLabels( tmpLabel, humanLabel, packetStart, packetSize, copied, recursiveDepth + 1 ) )
{
return NULL;
}
// Pointers are always terminating the label. So since there is
// no 0 terminated label we don't need to skip an extra byte, we
// just skip the current label pointer value.
pLabel = (DnsLabel*)( (RPU8)pLabel + sizeof( RU16 ) );
return pLabel;
}
else
{
if( DNS_LABEL_MAX_SIZE < copied + 1 + pLabel->nChar )
{
rpal_debug_warning( "error parsing dns packet" );
return NULL;
}
if( NULL != humanLabel )
{
if( 0 != copied )
{
humanLabel[ copied ] = '.';
copied++;
}
rpal_memory_memcpy( (RPU8)humanLabel + copied, pLabel->label, pLabel->nChar );
copied += pLabel->nChar;
}
pLabel = (DnsLabel*)( (RPU8)pLabel + pLabel->nChar + 1 );
}
}
// We do a last sanity check. A valid label parsing should end in a 0-val nChar within
// the buffer, so we check it's all valid, otherwise we'll assume an error and will return an error.
if( !IS_WITHIN_BOUNDS( pLabel, sizeof( *pLabel ), packetStart, packetSize ) ||
0 != pLabel->nChar )
{
rpal_debug_warning( "error parsing dns packet" );
return NULL;
}
// Get to the next valid byte, so we skip the 0-termination.
pLabel = (DnsLabel*)( (RPU8)pLabel + 1 );
return pLabel;
}
RPRIVATE
RVOID
_freeRecords
(
rBlob recs
)
{
RU32 i = 0;
_dnsRecord* pRec = NULL;
if( NULL != recs )
{
i = 0;
while( NULL != ( pRec = rpal_blob_arrElem( recs, sizeof( *pRec ), i++ ) ) )
{
if( NULL != pRec->name )
{
rpal_memory_free( pRec->name );
}
}
}
}
RPRIVATE
RS32
_cmpDns
(
_dnsRecord* rec1,
_dnsRecord* rec2
)
{
RS32 ret = 0;
if( NULL != rec1 &&
NULL != rec2 )
{
if( 0 == ( ret = rpal_memory_memcmp( rec1,
rec2,
sizeof( *rec1 ) - sizeof( RPWCHAR ) ) ) )
{
ret = rpal_string_strcmp( rec1->name, rec2->name );
}
}
return ret;
}
RPRIVATE
RVOID
dnsUmDiffThread
(
rEvent isTimeToStop
)
{
rSequence notif = NULL;
rBlob snapCur = NULL;
rBlob snapPrev = NULL;
_dnsRecord rec = { 0 };
_dnsRecord* pCurRec = NULL;
RU32 i = 0;
LibOsPerformanceProfile perfProfile = { 0 };
#ifdef RPAL_PLATFORM_WINDOWS
PDNSCACHEENTRY pDnsEntry = NULL;
PDNSCACHEENTRY pPrevDnsEntry = NULL;
#endif
perfProfile.enforceOnceIn = 1;
perfProfile.sanityCeiling = MSEC_FROM_SEC( 10 );
perfProfile.lastTimeoutValue = 100;
perfProfile.targetCpuPerformance = 0;
perfProfile.globalTargetCpuPerformance = GLOBAL_CPU_USAGE_TARGET;
perfProfile.timeoutIncrementPerSec = 1;
while( !rEvent_wait( isTimeToStop, 0 ) )
{
if( kAcq_isAvailable() )
{
if( NULL != snapPrev )
{
_freeRecords( snapPrev );
rpal_blob_free( snapPrev );
snapPrev = NULL;
}
// If kernel acquisition becomes available, try kernel again.
return;
}
libOs_timeoutWithProfile( &perfProfile, FALSE, isTimeToStop );
if( NULL != ( snapCur = rpal_blob_create( 0, 10 * sizeof( rec ) ) ) )
{
#ifdef RPAL_PLATFORM_WINDOWS
if( TRUE == getCache( &pDnsEntry ) )
{
while( NULL != pDnsEntry )
{
rec.flags = pDnsEntry->dwFlags;
rec.type = pDnsEntry->wType;
if( NULL != ( rec.name = rpal_string_strdup( pDnsEntry->pszName ) ) )
{
rpal_blob_add( snapCur, &rec, sizeof( rec ) );
}
pPrevDnsEntry = pDnsEntry;
pDnsEntry = pDnsEntry->pNext;
freeCacheEntry( pPrevDnsEntry->pszName, DnsFreeFlat );
freeCacheEntry( pPrevDnsEntry, DnsFreeFlat );
}
rpal_sort_array( rpal_blob_getBuffer( snapCur ),
rpal_blob_getSize( snapCur ) / sizeof( rec ),
sizeof( rec ),
_cmpDns );
}
#elif defined( RPAL_PLATFORM_MACOSX )
rpal_thread_sleep( MSEC_FROM_SEC( 2 ) );
#endif
// Do a general diff of the snapshots to find new entries.
if( NULL != snapPrev )
{
i = 0;
while( !rEvent_wait( isTimeToStop, 0 ) &&
NULL != ( pCurRec = rpal_blob_arrElem( snapCur, sizeof( rec ), i++ ) ) )
{
if( -1 == rpal_binsearch_array( rpal_blob_getBuffer( snapPrev ),
rpal_blob_getSize( snapPrev ) / sizeof( rec ),
sizeof( rec ),
pCurRec,
(rpal_ordering_func)_cmpDns ) )
{
if( NULL != ( notif = rSequence_new() ) )
{
rSequence_addSTRINGN( notif, RP_TAGS_DOMAIN_NAME, pCurRec->name );
rSequence_addRU16( notif, RP_TAGS_DNS_TYPE, pCurRec->type );
rSequence_addRU32( notif, RP_TAGS_DNS_FLAGS, pCurRec->flags );
hbs_timestampEvent( notif, 0 );
hbs_publish( RP_TAGS_NOTIFICATION_DNS_REQUEST, notif );
rSequence_free( notif );
}
}
}
}
}
if( NULL != snapPrev )
{
_freeRecords( snapPrev );
rpal_blob_free( snapPrev );
snapPrev = NULL;
}
snapPrev = snapCur;
snapCur = NULL;
libOs_timeoutWithProfile( &perfProfile, TRUE, isTimeToStop );
}
if( NULL != snapPrev )
{
_freeRecords( snapPrev );
rpal_blob_free( snapPrev );
snapPrev = NULL;
}
}
RPRIVATE
RVOID
processDnsPacket
(
KernelAcqDnsPacket* pDns
)
{
rSequence notification = NULL;
RU32 i = 0;
DnsLabel* pLabel = NULL;
DnsHeader* dnsHeader = NULL;
DnsResponseInfo* pResponseInfo = NULL;
RCHAR domain[ DNS_LABEL_MAX_SIZE ] = { 0 };
RU16 recordType = 0;
RU64 timestamp = 0;
Atom parentAtom = { 0 };
if( NULL == pDns )
{
return;
}
dnsHeader = (DnsHeader*)( (RPU8)pDns + sizeof( *pDns ) );
pLabel = (DnsLabel*)dnsHeader->data;
// We are parsing DNS packets coming from the kernel. They may:
// 1- Be requests and not responses, check there are Answers.
// 2- Be maliciously crafter packets so we need extra checking for sanity.
if( 0 == dnsHeader->anCount ||
0 == dnsHeader->qr ||
DNS_SANITY_MAX_RECORDS < rpal_ntoh16( dnsHeader->qdCount ) ||
DNS_SANITY_MAX_RECORDS < rpal_ntoh16( dnsHeader->anCount ) )
{
return;
}
// We need to walk the Questions first to get to the Answers
// but we don't really care to record them since they'll be repeated
// in the Answers.
for( i = 0; i < rpal_ntoh16( dnsHeader->qdCount ); i++ )
{
DnsQuestionInfo* pQInfo = NULL;
pLabel = dnsReadLabels( pLabel, NULL, (RPU8)dnsHeader, pDns->packetSize, 0, 0 );
pQInfo = (DnsQuestionInfo*)( pLabel );
if( !IS_WITHIN_BOUNDS( pQInfo, sizeof( *pQInfo ), dnsHeader, pDns->packetSize ) )
{
rpal_debug_warning( "error parsing dns packet" );
break;
}
pLabel = (DnsLabel*)( (RPU8)pQInfo + sizeof( *pQInfo ) );
}
if( !IS_WITHIN_BOUNDS( pLabel, sizeof( RU16 ), dnsHeader, pDns->packetSize ) )
{
rpal_debug_warning( "error parsing dns packet" );
return;
}
// This is what we care about, the Answers (which also point to each Question).
// We will emit one event per Answer so as to keep the DNS_REQUEST event flat and atomic.
for( i = 0; i < rpal_ntoh16( dnsHeader->anCount ); i++ )
{
pResponseInfo = NULL;
// This was the Question for this answer.
rpal_memory_zero( domain, sizeof( domain ) );
pLabel = dnsReadLabels( pLabel, domain, (RPU8)dnsHeader, pDns->packetSize, 0, 0 );
pResponseInfo = (DnsResponseInfo*)pLabel;
pLabel = (DnsLabel*)( (RPU8)pResponseInfo + sizeof( *pResponseInfo ) + rpal_ntoh16( pResponseInfo->rDataLength ) );
if( !IS_WITHIN_BOUNDS( pResponseInfo, sizeof( *pResponseInfo ), dnsHeader, pDns->packetSize ) )
{
rpal_debug_warning( "error parsing dns packet" );
break;
}
if( NULL == ( notification = rSequence_new() ) )
{
rpal_debug_warning( "error parsing dns packet" );
break;
}
// This is a timestamp coming from the kernel so it is not globally adjusted.
// We'll adjust it with the global offset.
timestamp = pDns->ts;
timestamp += MSEC_FROM_SEC( rpal_time_getGlobalFromLocal( 0 ) );
// Try to relate the DNS request to the owner process, this only works on OSX
// at the moment (since the kernel does not expose the PID at the packet capture
// stage), and even on OSX it's the DNSResolver process. So it's not super useful
// but regardless we have the mechanism here as it's better than nothing and when
// we add better resolving in the kernel it will work transparently.
parentAtom.key.process.pid = pDns->pid;
parentAtom.key.category = RP_TAGS_NOTIFICATION_NEW_PROCESS;
if( atoms_query( &parentAtom, timestamp ) )
{
HbsSetParentAtom( notification, parentAtom.id );
}
rSequence_addTIMESTAMP( notification, RP_TAGS_TIMESTAMP, timestamp );
rSequence_addSTRINGA( notification, RP_TAGS_DOMAIN_NAME, domain );
rSequence_addRU32( notification, RP_TAGS_PROCESS_ID, pDns->pid );
recordType = rpal_ntoh16( pResponseInfo->recordType );
rSequence_addRU16( notification, RP_TAGS_MESSAGE_ID, rpal_ntoh16( dnsHeader->msgId ) );
rSequence_addRU16( notification, RP_TAGS_DNS_TYPE, recordType );
if( DNS_A_RECORD == recordType )
{
rSequence_addIPV4( notification, RP_TAGS_IP_ADDRESS, *(RU32*)pResponseInfo->rData );
}
else if( DNS_AAAA_RECORD == recordType )
{
rSequence_addIPV6( notification, RP_TAGS_IP_ADDRESS, pResponseInfo->rData );
}
else if( DNS_CNAME_RECORD == recordType )
{
// CNAME records will have another label as a value and not an IP.
rpal_memory_zero( domain, sizeof( domain ) );
dnsReadLabels( (DnsLabel*)pResponseInfo->rData, domain, (RPU8)dnsHeader, pDns->packetSize, 0, 0 );
rSequence_addSTRINGA( notification, RP_TAGS_CNAME, domain );
}
else
{
// Right now we only care for A, CNAME and AAAA records.
rSequence_free( notification );
notification = NULL;
continue;
}
hbs_publish( RP_TAGS_NOTIFICATION_DNS_REQUEST, notification );
rSequence_free( notification );
notification = NULL;
}
}
RPRIVATE
RVOID
dnsKmDiffThread
(
rEvent isTimeToStop
)
{
RU8 new_from_kernel[ DNS_KB_PACKET_BUFFER * 1024 ] = { 0 };
RU8 prev_from_kernel[ DNS_KB_PACKET_BUFFER * 1024 ] = { 0 };
RU32 sizeInNew = 0;
RU32 sizeInPrev = 0;
KernelAcqDnsPacket* pPacket = NULL;
while( !rEvent_wait( isTimeToStop, 1000 ) )
{
rpal_memory_zero( new_from_kernel, sizeof( new_from_kernel ) );
sizeInNew = sizeof( new_from_kernel );
if( !kAcq_getNewDnsPackets( (KernelAcqDnsPacket*)new_from_kernel, &sizeInNew ) )
{
rpal_debug_warning( "kernel acquisition for new dns packets failed" );
break;
}
pPacket = (KernelAcqDnsPacket*)prev_from_kernel;
while( IS_WITHIN_BOUNDS( pPacket, sizeof( *pPacket ), prev_from_kernel, sizeInPrev ) &&
0 != pPacket->ts &&
IS_WITHIN_BOUNDS( pPacket, sizeof( *pPacket ) + pPacket->packetSize, prev_from_kernel, sizeInPrev ) )
{
processDnsPacket( pPacket );
pPacket = (KernelAcqDnsPacket*)( (RPU8)pPacket + sizeof( *pPacket ) + pPacket->packetSize );
}
rpal_memory_memcpy( prev_from_kernel, new_from_kernel, sizeInNew );
sizeInPrev = sizeInNew;
}
}
RPRIVATE
RPVOID
dnsDiffThread
(
rEvent isTimeToStop,
RPVOID ctx
)
{
UNREFERENCED_PARAMETER( ctx );
while( !rEvent_wait( isTimeToStop, 0 ) )
{
if( kAcq_isAvailable() )
{
rpal_debug_info( "running kernelmode acquisition dns notification" );
dnsKmDiffThread( isTimeToStop );
}
else if( !rEvent_wait( isTimeToStop, 0 ) )
{
rpal_debug_info( "running usermode acquisition dns notification" );
dnsUmDiffThread( isTimeToStop );
}
}
return NULL;
}
//=============================================================================
// COLLECTOR INTERFACE
//=============================================================================
rpcm_tag collector_2_events[] = { RP_TAGS_NOTIFICATION_DNS_REQUEST,
0 };
RBOOL
collector_2_init
(
HbsState* hbsState,
rSequence config
)
{
RBOOL isSuccess = FALSE;
UNREFERENCED_PARAMETER( config );
if( NULL != hbsState )
{
#ifdef RPAL_PLATFORM_WINDOWS
RWCHAR apiName[] = _WCH( "dnsapi.dll" );
RCHAR funcName1[] = "DnsGetCacheDataTable";
RCHAR funcName2[] = "DnsFree";
if( NULL != ( hDnsApi = LoadLibraryW( (RPWCHAR)&apiName ) ) )
{
// TODO: investigate the DnsQuery API on Windows to get the DNS resolutions.
if( NULL != ( getCache = (DnsGetCacheDataTable_f)GetProcAddress( hDnsApi, (RPCHAR)&funcName1 ) ) &&
NULL != ( freeCacheEntry = (DnsFree_f)GetProcAddress( hDnsApi, (RPCHAR)&funcName2 ) ) )
{
isSuccess = TRUE;
}
else
{
rpal_debug_warning( "failed to get dns undocumented function" );
FreeLibrary( hDnsApi );
}
}
else
{
rpal_debug_warning( "failed to load dns api" );
}
#elif defined( RPAL_PLATFORM_MACOSX )
isSuccess = TRUE;
#endif
if( isSuccess )
{
isSuccess = FALSE;
if( rThreadPool_task( hbsState->hThreadPool, dnsDiffThread, NULL ) )
{
isSuccess = TRUE;
}
}
}
return isSuccess;
}
RBOOL
collector_2_cleanup
(
HbsState* hbsState,
rSequence config
)
{
RBOOL isSuccess = FALSE;
UNREFERENCED_PARAMETER( config );
if( NULL != hbsState )
{
#ifdef RPAL_PLATFORM_WINDOWS
if( NULL != hDnsApi )
{
getCache = NULL;
freeCacheEntry = NULL;
FreeLibrary( hDnsApi );
}
#endif
isSuccess = TRUE;
}
return isSuccess;
}
RBOOL
collector_2_update
(
HbsState* hbsState,
rSequence update
)
{
RBOOL isSuccess = FALSE;
UNREFERENCED_PARAMETER( hbsState );
UNREFERENCED_PARAMETER( update );
return isSuccess;
}
//=============================================================================
// Collector Testing
//=============================================================================
HBS_DECLARE_TEST( dns_read_label )
{
RCHAR tmpText[ DNS_LABEL_MAX_SIZE ] = { 0 };
RPU8 buffer = NULL;
RU32 bufferSize = 0;
RU32 i = 0;
DnsLabel* pLabel = NULL;
RU8 label_1[] = { 0x03, 'w', 'w', 'w',
0x06, 'g', 'o', 'o', 'g', 'l', 'e',
0x03, 'c', 'o', 'm',
0x00 };
RU32 offset1 = 0;
RCHAR value1[] = { "www.google.com" };
DnsLabel* nextLabel1 = (DnsLabel*)( label_1 + sizeof( label_1 ) );
RU8 label_2[] = { 0xFF,
0x03, 'w', 'w', 'w',
0x06, 'g', 'o', 'o', 'g', 'l', 'e',
0x03, 'c', 'o', 'm',
0x00,
0x03, 'a', 'p', 'i',
DNS_LABEL_POINTER_INDICATOR, 0x05,
0x04, 'n', 'o', 'p', 'e',
0x00 };
RU32 offset2 = 17;
RCHAR value2[] = { "api.google.com" };
DnsLabel* nextLabel2 = (DnsLabel*)( label_2 + 23 );
RU8 label_3[] = { 0xFF,
0x03, 'w', 'w', 'w',
0x06, 'g', 'o', 'o', 'g', 'l', 'e',
0x03, 'c', 'o', 'm',
0x00,
0x02, 'l', 'c',
DNS_LABEL_POINTER_INDICATOR, 0x05,
DNS_LABEL_POINTER_INDICATOR, 0x14,
0x04, 'n', 'o', 'p', 'e',
0x00 };
RU32 offset3 = 22;
RCHAR value3[] = { "google.com" };
DnsLabel* nextLabel3 = (DnsLabel*)( label_3 + 24 );
RU8 label_4[] = { 0xFF,
0x03, 'w', 'w', 'w',
DNS_LABEL_POINTER_INDICATOR, 0x01,
DNS_LABEL_POINTER_INDICATOR, 0x05,
DNS_LABEL_POINTER_INDICATOR, 0x07,
DNS_LABEL_POINTER_INDICATOR, 0x09 };
RU32 offset4 = 11;
// Small fuzzing of the function.
for( i = 0; i < 100; i++ )
{
bufferSize = ( rpal_rand() % ( 128 * 1024 ) ) + 1024;
buffer = rpal_memory_alloc( bufferSize );
HBS_ASSERT_TRUE( NULL != buffer );
HBS_ASSERT_TRUE( CryptoLib_genRandomBytes( buffer, bufferSize ) );
pLabel = (DnsLabel*)buffer;
// Random data might contain something valid-looking so we can't assert == NULL.
// We just this just as a fuzz to make sure we generate no crashes.
rpal_memory_zero( tmpText, sizeof( tmpText ) );
dnsReadLabels( pLabel, tmpText, buffer, bufferSize, 0, 0 );
rpal_memory_free( buffer );
}
// Reading a simple single label.
pLabel = (DnsLabel*)( label_1 + offset1 );
buffer = label_1;
bufferSize = sizeof( label_1 );
rpal_memory_zero( tmpText, sizeof( tmpText ) );
HBS_ASSERT_TRUE( nextLabel1 == dnsReadLabels( pLabel, tmpText, buffer, bufferSize, 0, 0 ) );
HBS_ASSERT_TRUE( 0 == rpal_string_strcmpA( tmpText, value1 ) );
// Reading a label using a pointer.
// Also make sure that the pointer jump terminates the parsing (as per RFC).
pLabel = (DnsLabel*)( label_2 + offset2 );
buffer = label_2;
bufferSize = sizeof( label_2 );
rpal_memory_zero( tmpText, sizeof( tmpText ) );
HBS_ASSERT_TRUE( nextLabel2 == dnsReadLabels( pLabel, tmpText, buffer, bufferSize, 0, 0 ) );
HBS_ASSERT_TRUE( 0 == rpal_string_strcmpA( tmpText, value2 ) );
// Reading a label using a pointer to a pointer.
// Also make sure that the pointer jump terminates the parsing (as per RFC).
pLabel = (DnsLabel*)( label_3 + offset3 );
buffer = label_3;
bufferSize = sizeof( label_3 );
rpal_memory_zero( tmpText, sizeof( tmpText ) );
HBS_ASSERT_TRUE( nextLabel3 == dnsReadLabels( pLabel, tmpText, buffer, bufferSize, 0, 0 ) );
HBS_ASSERT_TRUE( 0 == rpal_string_strcmpA( tmpText, value3 ) );
// Reading a label using a pointer to a pointer to a pointer past max_depth. In this case we
// should not return a valid label.
pLabel = (DnsLabel*)( label_4 + offset4 );
buffer = label_4;
bufferSize = sizeof( label_4 );
rpal_memory_zero( tmpText, sizeof( tmpText ) );
HBS_ASSERT_TRUE( NULL == dnsReadLabels( pLabel, tmpText, buffer, bufferSize, 0, 0 ) );
}
HBS_DECLARE_TEST( dns_process_packet )
{
RPU8 buffer = NULL;
RU32 bufferSize = 0;
RU32 i = 0;
KernelAcqDnsPacket* packet = NULL;
RU32 nEvents = 0;
rSequence event = NULL;
RPCHAR domain = NULL;
RU32 ip4 = 0;
RU8 test_packet1[] = {
0x2c, 0xe5, 0xca, 0xb5, 0x5b, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xb2, 0xdf, 0x10, 0xac, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3b, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xdf, 0x10, 0xac,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00,
0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4d, 0x8f, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x03, 0x73, 0x73, 0x6c, 0x07, 0x67, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63,
0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00,
0x00, 0x00, 0x05, 0x00, 0x04, 0xac, 0xd9, 0x05, 0x63
};
RCHAR test_domain1[] = "ssl.gstatic.com";
RU32 test_ip1 = 0x6305d9ac;
rQueue notifQueue = NULL;
HBS_ASSERT_TRUE( rQueue_create( ¬ifQueue, rSequence_freeWithSize, 10 ) );
HBS_ASSERT_TRUE( notifications_subscribe( RP_TAGS_NOTIFICATION_DNS_REQUEST, NULL, 0, notifQueue, NULL ) );
// We keep the test here somewhat simple since the packet is validated by the caller
// above and the heavy structure validation is done at the label level. So we'll just
// fuzz it a bit.
for( i = 0; i < 100; i++ )
{
bufferSize = ( rpal_rand() % ( 128 * 1024 ) ) + 1024;
buffer = rpal_memory_alloc( bufferSize );
HBS_ASSERT_TRUE( NULL != buffer );
HBS_ASSERT_TRUE( CryptoLib_genRandomBytes( buffer, bufferSize ) );
packet = (KernelAcqDnsPacket*)buffer;
// Random data might contain something valid-looking so we can't assert
// that no event will be generated.
// We just this just as a fuzz to make sure we generate no crashes.
processDnsPacket( packet );
rpal_memory_free( buffer );
}
// Wipe the queue in case we generated events.
notifications_unsubscribe( RP_TAGS_NOTIFICATION_DNS_REQUEST, notifQueue, NULL );
rQueue_free( notifQueue );
// Try parsing sample packet 1
HBS_ASSERT_TRUE( rQueue_create( ¬ifQueue, rSequence_freeWithSize, 10 ) );
HBS_ASSERT_TRUE( notifications_subscribe( RP_TAGS_NOTIFICATION_DNS_REQUEST, NULL, 0, notifQueue, NULL ) );
processDnsPacket( (KernelAcqDnsPacket*)test_packet1 );
// Make sure we generate one event as expected.
HBS_ASSERT_TRUE( rQueue_getSize( notifQueue, &nEvents ) );
HBS_ASSERT_TRUE( 1 == nEvents );
if( HBS_ASSERT_TRUE( rQueue_remove( notifQueue, &event, NULL, 0 ) ) )
{
HBS_ASSERT_TRUE( rSequence_getSTRINGA( event, RP_TAGS_DOMAIN_NAME, &domain ) );
HBS_ASSERT_TRUE( 0 == rpal_string_strcmpA( domain, test_domain1 ) );
HBS_ASSERT_TRUE( rSequence_getIPV4( event, RP_TAGS_IP_ADDRESS, &ip4 ) );
HBS_ASSERT_TRUE( ip4 == test_ip1 );
rSequence_free( event );
}
notifications_unsubscribe( RP_TAGS_NOTIFICATION_DNS_REQUEST, notifQueue, NULL );
rQueue_free( notifQueue );
}
HBS_TEST_SUITE( 2 )
{
RBOOL isSuccess = FALSE;
if( NULL != hbsState &&
NULL != testContext )
{
HBS_RUN_TEST( dns_read_label );
HBS_RUN_TEST( dns_process_packet );
isSuccess = TRUE;
}
return isSuccess;
}
|
SpikeLavender/jdk-resource-code
|
sun/nio/fs/BasicFileAttributesHolder.java
|
<gh_stars>0
/*
* Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package sun.nio.fs;
import java.nio.file.attribute.BasicFileAttributes;
/**
* Implemented by objects that may hold or cache the attributes of a file.
*/
public interface BasicFileAttributesHolder {
/**
* Returns cached attributes (may be null). If file is a symbolic link then
* the attributes are the link attributes and not the final target of the
* file.
*/
BasicFileAttributes get();
/**
* Invalidates cached attributes
*/
void invalidate();
}
|
cypreess/aiostripe
|
aiostripe/multipart_data_generator.py
|
<reponame>cypreess/aiostripe
import io
import random
class MultipartDataGenerator(object):
def __init__(self, chunk_size=1028):
self.data = io.BytesIO()
self.line_break = '\r\n'
self.boundary = self._initialize_boundary()
self.chunk_size = chunk_size
def add_params(self, params):
for key, value in params.items():
if value is None:
continue
self._write(self.param_header())
self._write(self.line_break)
if hasattr(value, 'read'):
self._write('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, value.name))
self._write(self.line_break)
self._write('Content-Type: application/octet-stream')
self._write(self.line_break)
self._write(self.line_break)
self._write_file(value)
else:
self._write('Content-Disposition: form-data; name="%s"' % key)
self._write(self.line_break)
self._write(self.line_break)
self._write(value)
self._write(self.line_break)
def param_header(self):
return '--%s' % self.boundary
def get_post_data(self):
self._write('--%s--' % self.boundary)
self._write(self.line_break)
return self.data.getvalue()
def _write(self, value):
self.data.write(bytes(value, 'utf-8'))
def _write_file(self, f):
while True:
file_contents = f.read(self.chunk_size)
if not file_contents:
break
self._write(file_contents)
@staticmethod
def _initialize_boundary():
return random.randint(0, 2 ** 63)
|
UCLA-SEAL/ExampleCheck
|
code/chrome-extension/server/test/edu/ucla/cs/maple/server/PartialAnalysisTest.java
|
<filename>code/chrome-extension/server/test/edu/ucla/cs/maple/server/PartialAnalysisTest.java
package edu.ucla.cs.maple.server;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.HashMap;
import org.junit.Test;
import edu.ucla.cs.model.APICall;
import edu.ucla.cs.model.APISeqItem;
import edu.ucla.cs.utils.FileUtils;
public class PartialAnalysisTest {
@Test
public void testResolveParameterizedType() throws Exception {
String path = "test/snippet_with_parameterized_type.txt";
String snippet = FileUtils.readFileToString(path);
PartialProgramAnalyzer ppa = new PartialProgramAnalyzer(snippet);
HashMap<String, ArrayList<APISeqItem>> seqs = ppa.retrieveAPICallSequences();
ArrayList<APISeqItem> seq = seqs.get("foo");
APICall iteratorNext = (APICall)seq.get(2);
assertEquals("Iterator", iteratorNext.receiver_type);
System.out.println(seq);
}
@Test
public void testResolveFieldType() throws Exception {
String path = "test/snippet_with_field_type.txt";
String snippet = FileUtils.readFileToString(path);
PartialProgramAnalyzer ppa = new PartialProgramAnalyzer(snippet);
HashMap<String, ArrayList<APISeqItem>> seqs = ppa.retrieveAPICallSequences();
ArrayList<APISeqItem> seq = seqs.get("onTouchEvent");
APICall call = (APICall)seq.get(1);
assertEquals("ViewPager", call.receiver_type);
System.out.println(seq);
}
@Test
public void testResolveVariableType() throws Exception {
String path = "test/snippet_with_normal_type.txt";
String snippet = FileUtils.readFileToString(path);
PartialProgramAnalyzer ppa = new PartialProgramAnalyzer(snippet);
HashMap<String, ArrayList<APISeqItem>> seqs = ppa.retrieveAPICallSequences();
ArrayList<APISeqItem> seq = seqs.get("foo");
APICall close = (APICall)seq.get(seq.size() - 1);
assertEquals("BufferedReader", close.receiver_type);
System.out.println(seq);
}
@Test
public void testResolveVariableTypeInEnhancedForLoop() throws Exception {
String path = "test/snippet_enhanced_for.txt";
String snippet = FileUtils.readFileToString(path);
PartialProgramAnalyzer ppa = new PartialProgramAnalyzer(snippet);
HashMap<String, ArrayList<APISeqItem>> seqs = ppa.retrieveAPICallSequences();
ArrayList<APISeqItem> seq = seqs.get("foo");
APICall getAsString = (APICall)seq.get(5);
assertEquals("JsonElement", getAsString.receiver_type);
System.out.println(seq);
}
}
|
paullewallencom/vaadin-978-1-8495-1880-2
|
_/Chapter 6/06_01_validation-messages/src/main/java/com/app/MyVaadinUI.java
|
<reponame>paullewallencom/vaadin-978-1-8495-1880-2
package com.app;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.*;
import com.vaadin.ui.Button.ClickEvent;
/**
* The Application's "main" class
*/
@SuppressWarnings("serial")
public class MyVaadinUI extends UI {
@Override
protected void init(VaadinRequest request) {
final VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
setContent(layout);
TextField txt = new TextField("Enter PIN Code");
txt.addValidator(new PinValidator());
txt.setImmediate(true);
layout.addComponent(txt);
}
}
|
jetsaredim/gemp-swccg-public
|
gemp-swccg-cards/src/main/java/com/gempukku/swccgo/cards/set215/light/Card215_007.java
|
<gh_stars>10-100
package com.gempukku.swccgo.cards.set215.light;
import com.gempukku.swccgo.cards.AbstractSite;
import com.gempukku.swccgo.cards.GameConditions;
import com.gempukku.swccgo.common.*;
import com.gempukku.swccgo.filters.Filter;
import com.gempukku.swccgo.filters.Filters;
import com.gempukku.swccgo.game.PhysicalCard;
import com.gempukku.swccgo.game.SwccgGame;
import com.gempukku.swccgo.logic.TriggerConditions;
import com.gempukku.swccgo.logic.actions.RequiredGameTextTriggerAction;
import com.gempukku.swccgo.logic.actions.TopLevelGameTextAction;
import com.gempukku.swccgo.logic.effects.*;
import com.gempukku.swccgo.logic.timing.EffectResult;
import com.gempukku.swccgo.logic.timing.PassthruEffect;
import com.gempukku.swccgo.logic.timing.results.AboutToLeaveTableResult;
import java.util.Collections;
import java.util.List;
/**
* Set: Set 15
* Type: Location
* Subtype: Site
* Title: Death Star: Detention Block Corridor (V)
*/
public class Card215_007 extends AbstractSite {
public Card215_007() {
super(Side.LIGHT, Title.Detention_Block_Corridor, Title.Death_Star);
setVirtualSuffix(true);
setLocationDarkSideGameText("If Leia is about to be lost from a Death Star site, imprison her here instead (even if inactive).");
setLocationLightSideGameText("If you control with a spy, may use 2 Force to release Leia here (retrieve 1 Force).");
addIcon(Icon.DARK_FORCE, 1);
addIcons(Icon.SPECIAL_EDITION, Icon.INTERIOR_SITE, Icon.MOBILE, Icon.SCOMP_LINK, Icon.VIRTUAL_SET_15);
addKeywords(Keyword.PRISON);
}
@Override
protected List<TopLevelGameTextAction> getGameTextLightSideTopLevelActions(String playerOnLightSideOfLocation, SwccgGame game, PhysicalCard self, int gameTextSourceCardId) {
Filter captiveLeiaHere = Filters.and(Filters.Leia, Filters.here(self), Filters.captive);
if (GameConditions.controlsWith(game, playerOnLightSideOfLocation, self, Filters.spy)
&& GameConditions.canSpot(game, self, SpotOverride.INCLUDE_CAPTIVE, captiveLeiaHere)
&& GameConditions.canUseForce(game, playerOnLightSideOfLocation, 2)) {
TopLevelGameTextAction action = new TopLevelGameTextAction(self, playerOnLightSideOfLocation, gameTextSourceCardId);
action.setText("Use 2 Force to release Leia here");
action.appendCost(
new UseForceEffect(action, playerOnLightSideOfLocation, 2)
);
action.appendEffect(
new ReleaseCaptiveEffect(action, Filters.findFirstActive(game, self, SpotOverride.INCLUDE_CAPTIVE, captiveLeiaHere))
);
action.appendEffect(
new RetrieveForceEffect(action, playerOnLightSideOfLocation, 1)
);
return Collections.singletonList(action);
}
return null;
}
@Override
protected List<RequiredGameTextTriggerAction> getGameTextDarkSideRequiredAfterTriggers(String playerOnDarkSideOfLocation, SwccgGame game, EffectResult effectResult, final PhysicalCard self, int gameTextSourceCardId) {
if (TriggerConditions.isAboutToLeaveTable(game, effectResult, Filters.and(Filters.at(Filters.Death_Star_site), Filters.Leia))) {
final AboutToLeaveTableResult result = (AboutToLeaveTableResult) effectResult;
final PhysicalCard leia = result.getCardAboutToLeaveTable();
if (leia != null) {
final RequiredGameTextTriggerAction action = new RequiredGameTextTriggerAction(self, gameTextSourceCardId);
action.setText("Imprison Leia");
action.setPerformingPlayer(playerOnDarkSideOfLocation);
action.appendEffect(
new PassthruEffect(action) {
@Override
protected void doPlayEffect(SwccgGame game) {
result.getPreventableCardEffect().preventEffectOnCard(leia);
action.appendEffect(
new RestoreCardToNormalEffect(action, leia));
action.appendEffect(
new CaptureWithImprisonmentEffect(action, leia, self, leia.isUndercover(), leia.isMissing())
);
}
});
return Collections.singletonList(action);
}
}
return null;
}
}
|
akazad13/competitive-programming
|
Online Judges/UVA/12554-A special Birthday song.cpp
|
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
//#define for(n) for(int i=1;i<=n;i++)
int main()
{
string vec[20];
vec[1]=vec[5]=vec[9]=vec[13]="Happy";
vec[2]=vec[6]=vec[10]=vec[14]="birthday";
vec[3]=vec[7]=vec[11]=vec[15]="to";
vec[4]=vec[8]=vec[16]="you";
vec[12]="Rujia";
map<int,string> myMap;
string str;
int n;
cin>>n;
char ch=getchar();
for(int i=1;i<=n;i++)
{
getline(cin,str);
myMap[i]=str;
}
int m = n+(16-n%16);
for(int j=0;j<m;j++)
{
cout<<myMap[(j%n)+1]<<": "<<vec[(j%16)+1]<<endl;
}
return 0;
}
|
wuxin66/moby
|
pkg/mount/deprecated.go
|
<filename>pkg/mount/deprecated.go
package mount // import "github.com/docker/docker/pkg/mount"
// Deprecated: this package is not maintained and will be removed.
// Use github.com/moby/sys/mount and github.com/moby/sys/mountinfo instead.
import (
"github.com/moby/sys/mountinfo"
)
//nolint:golint
type (
// FilterFunc is a type.
// Deprecated: use github.com/moby/sys/mountinfo instead.
FilterFunc = func(*Info) (skip, stop bool)
// Info is a type
// Deprecated: use github.com/moby/sys/mountinfo instead.
Info struct {
ID, Parent, Major, Minor int
Root, Mountpoint, Opts, Optional, Fstype, Source, VfsOpts string
}
)
// Deprecated: use github.com/moby/sys/mountinfo instead.
//nolint:golint
var (
Mounted = mountinfo.Mounted
PrefixFilter = mountinfo.PrefixFilter
SingleEntryFilter = mountinfo.SingleEntryFilter
ParentsFilter = mountinfo.ParentsFilter
FstypeFilter = mountinfo.FSTypeFilter
)
// GetMounts is a function.
//
// Deprecated: use github.com/moby/sys/mountinfo.GetMounts() instead.
//nolint:golint
func GetMounts(f FilterFunc) ([]*Info, error) {
fi := func(i *mountinfo.Info) (skip, stop bool) {
return f(toLegacyInfo(i))
}
mounts, err := mountinfo.GetMounts(fi)
if err != nil {
return nil, err
}
mi := make([]*Info, len(mounts))
for i, m := range mounts {
mi[i] = toLegacyInfo(m)
}
return mi, nil
}
func toLegacyInfo(m *mountinfo.Info) *Info {
return &Info{
ID: m.ID,
Parent: m.Parent,
Major: m.Major,
Minor: m.Minor,
Root: m.Root,
Mountpoint: m.Mountpoint,
Opts: m.Options,
Fstype: m.FSType,
Source: m.Source,
VfsOpts: m.VFSOptions,
}
}
|
davidkpiano/azure-sdk-for-node
|
lib/services/serviceFabric/lib/models/backupProgressInfo.js
|
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* Describes the progress of a partition's backup.
*
*/
class BackupProgressInfo {
/**
* Create a BackupProgressInfo.
* @member {string} [backupState] Represents the current state of the
* partition backup operation. Possible values include: 'Invalid',
* 'Accepted', 'BackupInProgress', 'Success', 'Failure', 'Timeout'
* @member {date} [timeStampUtc] TimeStamp in UTC when operation succeeded or
* failed.
* @member {uuid} [backupId] Unique ID of the newly created backup.
* @member {string} [backupLocation] Location, relative to the backup store,
* of the newly created backup.
* @member {object} [epochOfLastBackupRecord] Specifies the epoch of the last
* record included in backup.
* @member {string} [epochOfLastBackupRecord.configurationNumber] The current
* configuration number of this Epoch. The configuration number is an
* increasing value that is updated whenever the configuration of this
* replica set changes.
* @member {string} [epochOfLastBackupRecord.dataLossNumber] The current
* dataloss number of this Epoch. The data loss number property is an
* increasing value which is updated whenever data loss is suspected, as when
* loss of a quorum of replicas in the replica set that includes the Primary
* replica.
* @member {string} [lsnOfLastBackupRecord] The LSN of last record included
* in backup.
* @member {object} [failureError] Denotes the failure encountered in
* performing backup operation.
* @member {string} [failureError.code] Defines the fabric error codes that
* be returned as part of the error object in response to Service Fabric API
* operations that are not successful. Following are the error code values
* that can be returned for a specific HTTP status code.
*
* - Possible values of the error code for HTTP status code 400 (Bad Request)
* - "FABRIC_E_INVALID_PARTITION_KEY"
* - "FABRIC_E_IMAGEBUILDER_VALIDATION_ERROR"
* - "FABRIC_E_INVALID_ADDRESS"
* - "FABRIC_E_APPLICATION_NOT_UPGRADING"
* - "FABRIC_E_APPLICATION_UPGRADE_VALIDATION_ERROR"
* - "FABRIC_E_FABRIC_NOT_UPGRADING"
* - "FABRIC_E_FABRIC_UPGRADE_VALIDATION_ERROR"
* - "FABRIC_E_INVALID_CONFIGURATION"
* - "FABRIC_E_INVALID_NAME_URI"
* - "FABRIC_E_PATH_TOO_LONG"
* - "FABRIC_E_KEY_TOO_LARGE"
* - "FABRIC_E_SERVICE_AFFINITY_CHAIN_NOT_SUPPORTED"
* - "FABRIC_E_INVALID_ATOMIC_GROUP"
* - "FABRIC_E_VALUE_EMPTY"
* - "FABRIC_E_BACKUP_IS_ENABLED"
* - "FABRIC_E_RESTORE_SOURCE_TARGET_PARTITION_MISMATCH"
* - "FABRIC_E_INVALID_FOR_STATELESS_SERVICES"
* - "FABRIC_E_INVALID_SERVICE_SCALING_POLICY"
* - "E_INVALIDARG"
*
* - Possible values of the error code for HTTP status code 404 (Not Found)
* - "FABRIC_E_NODE_NOT_FOUND"
* - "FABRIC_E_APPLICATION_TYPE_NOT_FOUND"
* - "FABRIC_E_APPLICATION_NOT_FOUND"
* - "FABRIC_E_SERVICE_TYPE_NOT_FOUND"
* - "FABRIC_E_SERVICE_DOES_NOT_EXIST"
* - "FABRIC_E_SERVICE_TYPE_TEMPLATE_NOT_FOUND"
* - "FABRIC_E_CONFIGURATION_SECTION_NOT_FOUND"
* - "FABRIC_E_PARTITION_NOT_FOUND"
* - "FABRIC_E_REPLICA_DOES_NOT_EXIST"
* - "FABRIC_E_SERVICE_GROUP_DOES_NOT_EXIST"
* - "FABRIC_E_CONFIGURATION_PARAMETER_NOT_FOUND"
* - "FABRIC_E_DIRECTORY_NOT_FOUND"
* - "FABRIC_E_FABRIC_VERSION_NOT_FOUND"
* - "FABRIC_E_FILE_NOT_FOUND"
* - "FABRIC_E_NAME_DOES_NOT_EXIST"
* - "FABRIC_E_PROPERTY_DOES_NOT_EXIST"
* - "FABRIC_E_ENUMERATION_COMPLETED"
* - "FABRIC_E_SERVICE_MANIFEST_NOT_FOUND"
* - "FABRIC_E_KEY_NOT_FOUND"
* - "FABRIC_E_HEALTH_ENTITY_NOT_FOUND"
* - "FABRIC_E_BACKUP_NOT_ENABLED"
* - "FABRIC_E_BACKUP_POLICY_NOT_EXISTING"
* - "FABRIC_E_FAULT_ANALYSIS_SERVICE_NOT_EXISTING"
*
* - Possible values of the error code for HTTP status code 409 (Conflict)
* - "FABRIC_E_APPLICATION_TYPE_ALREADY_EXISTS"
* - "FABRIC_E_APPLICATION_ALREADY_EXISTS"
* - "FABRIC_E_APPLICATION_ALREADY_IN_TARGET_VERSION"
* - "FABRIC_E_APPLICATION_TYPE_PROVISION_IN_PROGRESS"
* - "FABRIC_E_APPLICATION_UPGRADE_IN_PROGRESS"
* - "FABRIC_E_SERVICE_ALREADY_EXISTS"
* - "FABRIC_E_SERVICE_GROUP_ALREADY_EXISTS"
* - "FABRIC_E_APPLICATION_TYPE_IN_USE"
* - "FABRIC_E_FABRIC_ALREADY_IN_TARGET_VERSION"
* - "FABRIC_E_FABRIC_VERSION_ALREADY_EXISTS"
* - "FABRIC_E_FABRIC_VERSION_IN_USE"
* - "FABRIC_E_FABRIC_UPGRADE_IN_PROGRESS"
* - "FABRIC_E_NAME_ALREADY_EXISTS"
* - "FABRIC_E_NAME_NOT_EMPTY"
* - "FABRIC_E_PROPERTY_CHECK_FAILED"
* - "FABRIC_E_SERVICE_METADATA_MISMATCH"
* - "FABRIC_E_SERVICE_TYPE_MISMATCH"
* - "FABRIC_E_HEALTH_STALE_REPORT"
* - "FABRIC_E_SEQUENCE_NUMBER_CHECK_FAILED"
* - "FABRIC_E_NODE_HAS_NOT_STOPPED_YET"
* - "FABRIC_E_INSTANCE_ID_MISMATCH"
* - "FABRIC_E_BACKUP_IN_PROGRESS"
* - "FABRIC_E_RESTORE_IN_PROGRESS"
* - "FABRIC_E_BACKUP_POLICY_ALREADY_EXISTING"
*
* - Possible values of the error code for HTTP status code 413 (Request
* Entity Too Large)
* - "FABRIC_E_VALUE_TOO_LARGE"
*
* - Possible values of the error code for HTTP status code 500 (Internal
* Server Error)
* - "FABRIC_E_NODE_IS_UP"
* - "E_FAIL"
* - "FABRIC_E_SINGLE_INSTANCE_APPLICATION_ALREADY_EXISTS"
* - "FABRIC_E_SINGLE_INSTANCE_APPLICATION_NOT_FOUND"
* - "FABRIC_E_VOLUME_ALREADY_EXISTS"
* - "ABRIC_E_VOLUME_NOT_FOUND"
* - "SerializationError"
*
* - Possible values of the error code for HTTP status code 503 (Service
* Unavailable)
* - "FABRIC_E_NO_WRITE_QUORUM"
* - "FABRIC_E_NOT_PRIMARY"
* - "FABRIC_E_NOT_READY"
* - "FABRIC_E_RECONFIGURATION_PENDING"
* - "FABRIC_E_SERVICE_OFFLINE"
* - "E_ABORT"
* - "FABRIC_E_VALUE_TOO_LARGE"
*
* - Possible values of the error code for HTTP status code 504 (Gateway
* Timeout)
* - "FABRIC_E_COMMUNICATION_ERROR"
* - "FABRIC_E_OPERATION_NOT_COMPLETE"
* - "FABRIC_E_TIMEOUT". Possible values include:
* 'FABRIC_E_INVALID_PARTITION_KEY',
* 'FABRIC_E_IMAGEBUILDER_VALIDATION_ERROR', 'FABRIC_E_INVALID_ADDRESS',
* 'FABRIC_E_APPLICATION_NOT_UPGRADING',
* 'FABRIC_E_APPLICATION_UPGRADE_VALIDATION_ERROR',
* 'FABRIC_E_FABRIC_NOT_UPGRADING',
* 'FABRIC_E_FABRIC_UPGRADE_VALIDATION_ERROR',
* 'FABRIC_E_INVALID_CONFIGURATION', 'FABRIC_E_INVALID_NAME_URI',
* 'FABRIC_E_PATH_TOO_LONG', 'FABRIC_E_KEY_TOO_LARGE',
* 'FABRIC_E_SERVICE_AFFINITY_CHAIN_NOT_SUPPORTED',
* 'FABRIC_E_INVALID_ATOMIC_GROUP', 'FABRIC_E_VALUE_EMPTY',
* 'FABRIC_E_NODE_NOT_FOUND', 'FABRIC_E_APPLICATION_TYPE_NOT_FOUND',
* 'FABRIC_E_APPLICATION_NOT_FOUND', 'FABRIC_E_SERVICE_TYPE_NOT_FOUND',
* 'FABRIC_E_SERVICE_DOES_NOT_EXIST',
* 'FABRIC_E_SERVICE_TYPE_TEMPLATE_NOT_FOUND',
* 'FABRIC_E_CONFIGURATION_SECTION_NOT_FOUND',
* 'FABRIC_E_PARTITION_NOT_FOUND', 'FABRIC_E_REPLICA_DOES_NOT_EXIST',
* 'FABRIC_E_SERVICE_GROUP_DOES_NOT_EXIST',
* 'FABRIC_E_CONFIGURATION_PARAMETER_NOT_FOUND',
* 'FABRIC_E_DIRECTORY_NOT_FOUND', 'FABRIC_E_FABRIC_VERSION_NOT_FOUND',
* 'FABRIC_E_FILE_NOT_FOUND', 'FABRIC_E_NAME_DOES_NOT_EXIST',
* 'FABRIC_E_PROPERTY_DOES_NOT_EXIST', 'FABRIC_E_ENUMERATION_COMPLETED',
* 'FABRIC_E_SERVICE_MANIFEST_NOT_FOUND', 'FABRIC_E_KEY_NOT_FOUND',
* 'FABRIC_E_HEALTH_ENTITY_NOT_FOUND',
* 'FABRIC_E_APPLICATION_TYPE_ALREADY_EXISTS',
* 'FABRIC_E_APPLICATION_ALREADY_EXISTS',
* 'FABRIC_E_APPLICATION_ALREADY_IN_TARGET_VERSION',
* 'FABRIC_E_APPLICATION_TYPE_PROVISION_IN_PROGRESS',
* 'FABRIC_E_APPLICATION_UPGRADE_IN_PROGRESS',
* 'FABRIC_E_SERVICE_ALREADY_EXISTS',
* 'FABRIC_E_SERVICE_GROUP_ALREADY_EXISTS',
* 'FABRIC_E_APPLICATION_TYPE_IN_USE',
* 'FABRIC_E_FABRIC_ALREADY_IN_TARGET_VERSION',
* 'FABRIC_E_FABRIC_VERSION_ALREADY_EXISTS',
* 'FABRIC_E_FABRIC_VERSION_IN_USE', 'FABRIC_E_FABRIC_UPGRADE_IN_PROGRESS',
* 'FABRIC_E_NAME_ALREADY_EXISTS', 'FABRIC_E_NAME_NOT_EMPTY',
* 'FABRIC_E_PROPERTY_CHECK_FAILED', 'FABRIC_E_SERVICE_METADATA_MISMATCH',
* 'FABRIC_E_SERVICE_TYPE_MISMATCH', 'FABRIC_E_HEALTH_STALE_REPORT',
* 'FABRIC_E_SEQUENCE_NUMBER_CHECK_FAILED',
* 'FABRIC_E_NODE_HAS_NOT_STOPPED_YET', 'FABRIC_E_INSTANCE_ID_MISMATCH',
* 'FABRIC_E_VALUE_TOO_LARGE', 'FABRIC_E_NO_WRITE_QUORUM',
* 'FABRIC_E_NOT_PRIMARY', 'FABRIC_E_NOT_READY',
* 'FABRIC_E_RECONFIGURATION_PENDING', 'FABRIC_E_SERVICE_OFFLINE', 'E_ABORT',
* 'FABRIC_E_COMMUNICATION_ERROR', 'FABRIC_E_OPERATION_NOT_COMPLETE',
* 'FABRIC_E_TIMEOUT', 'FABRIC_E_NODE_IS_UP', 'E_FAIL',
* 'FABRIC_E_BACKUP_IS_ENABLED',
* 'FABRIC_E_RESTORE_SOURCE_TARGET_PARTITION_MISMATCH',
* 'FABRIC_E_INVALID_FOR_STATELESS_SERVICES', 'FABRIC_E_BACKUP_NOT_ENABLED',
* 'FABRIC_E_BACKUP_POLICY_NOT_EXISTING',
* 'FABRIC_E_FAULT_ANALYSIS_SERVICE_NOT_EXISTING',
* 'FABRIC_E_BACKUP_IN_PROGRESS', 'FABRIC_E_RESTORE_IN_PROGRESS',
* 'FABRIC_E_BACKUP_POLICY_ALREADY_EXISTING',
* 'FABRIC_E_INVALID_SERVICE_SCALING_POLICY', 'E_INVALIDARG',
* 'FABRIC_E_SINGLE_INSTANCE_APPLICATION_ALREADY_EXISTS',
* 'FABRIC_E_SINGLE_INSTANCE_APPLICATION_NOT_FOUND',
* 'FABRIC_E_VOLUME_ALREADY_EXISTS', 'FABRIC_E_VOLUME_NOT_FOUND',
* 'SerializationError'
* @member {string} [failureError.message] Error message.
*/
constructor() {
}
/**
* Defines the metadata of BackupProgressInfo
*
* @returns {object} metadata of BackupProgressInfo
*
*/
mapper() {
return {
required: false,
serializedName: 'BackupProgressInfo',
type: {
name: 'Composite',
className: 'BackupProgressInfo',
modelProperties: {
backupState: {
required: false,
serializedName: 'BackupState',
type: {
name: 'String'
}
},
timeStampUtc: {
required: false,
serializedName: 'TimeStampUtc',
type: {
name: 'DateTime'
}
},
backupId: {
required: false,
serializedName: 'BackupId',
type: {
name: 'String'
}
},
backupLocation: {
required: false,
serializedName: 'BackupLocation',
type: {
name: 'String'
}
},
epochOfLastBackupRecord: {
required: false,
serializedName: 'EpochOfLastBackupRecord',
type: {
name: 'Composite',
className: 'BackupEpoch'
}
},
lsnOfLastBackupRecord: {
required: false,
serializedName: 'LsnOfLastBackupRecord',
type: {
name: 'String'
}
},
failureError: {
required: false,
serializedName: 'FailureError',
type: {
name: 'Composite',
className: 'FabricErrorError'
}
}
}
}
};
}
}
module.exports = BackupProgressInfo;
|
Mumble-SRL/MBurger-iOS
|
MBurger/MBClient/MBElement/MBColorElement.h
|
<reponame>Mumble-SRL/MBurger-iOS<gh_stars>1-10
//
// MBColorElement.h
// MBurger
//
// Created by <NAME> on 06/05/2020.
// Copyright ยฉ 2020 Mumble. All rights reserved.
//
#import "MBElement.h"
#import <UIKit/UIKit.h>
/**
This class represents a MBurger color element.
*/
@interface MBColorElement : MBElement <NSCoding, NSSecureCoding>
/**
The hex value of the element.
*/
@property (nonatomic, retain, nullable) NSString *colorHex;
/**
Initializes a color element with an elementId and its value.
@see This function calls the super initializer `-[MBElement initWithElementId:Name:Order:Type:]`
@param elementId The id of the element.
@param name The name of the element.
@param order The order of the element.
@param colorHex The hex color of the element.
@return A newly created MBColorElement initialized with the elementId, the name and the value passed.
*/
- (nonnull instancetype) initWithElementId: (NSInteger) elementId Name: (nonnull NSString *) name Order: (NSInteger) order ColorHex: (nullable NSString *) colorHex;
/**
Retturns the color of this element
@return the color of this element.
*/
- (nullable UIColor *) color;
@end
|
xenron/sandbox-dev-lintcode
|
C++/building-outline.cpp
|
// Time: O(nlogn)
// Space: O(n)
// BST solution.
class Solution {
public:
enum {start, end, height};
struct Endpoint {
int height;
bool isStart;
};
/**
* @param buildings: A list of lists of integers
* @return: Find the outline of those buildings
*/
vector<vector<int>> buildingOutline(vector<vector<int>> &buildings) {
map<int, vector<Endpoint>> point_to_height; // Ordered, no duplicates.
for (const auto& building : buildings) {
point_to_height[building[start]].push_back({building[height], true});
point_to_height[building[end]].push_back({building[height], false});
}
vector<vector<int>> res;
map<int, int> height_to_count; // BST.
int curr_start = -1;
int curr_max = 0;
// Enumerate each point in increasing order.
for (const auto& kvp : point_to_height) {
const auto& point = kvp.first;
const auto& heights = kvp.second;
for (const auto& h : heights) {
if (h.isStart) {
++height_to_count[h.height];
} else {
--height_to_count[h.height];
if (height_to_count[h.height] == 0) {
height_to_count.erase(h.height);
}
}
}
if (height_to_count.empty() ||
curr_max != height_to_count.crbegin()->first) {
if (curr_max > 0) {
res.push_back({curr_start, point, curr_max});
}
curr_start = point;
curr_max = height_to_count.empty() ?
0 : height_to_count.crbegin()->first;
}
}
return res;
}
};
// Time: O(nlogn)
// Space: O(n)
// Divide and conquer solution.
class Solution2 {
public:
enum {start, end, height};
/**
* @param buildings: A list of lists of integers
* @return: Find the outline of those buildings
*/
vector<vector<int>> buildingOutline(vector<vector<int>> &buildings) {
return ComputeSkylineInInterval(buildings, 0, buildings.size());
}
// Divide and Conquer.
vector<vector<int>> ComputeSkylineInInterval(const vector<vector<int>>& buildings,
int left_endpoint, int right_endpoint) {
if (right_endpoint - left_endpoint <= 1) { // 0 or 1 skyline, just copy it.
return {buildings.cbegin() + left_endpoint,
buildings.cbegin() + right_endpoint};
}
int mid = left_endpoint + ((right_endpoint - left_endpoint) / 2);
auto left_skyline = ComputeSkylineInInterval(buildings, left_endpoint, mid);
auto right_skyline = ComputeSkylineInInterval(buildings, mid, right_endpoint);
return MergeSkylines(&left_skyline, &right_skyline);
}
// Merge Sort
vector<vector<int>> MergeSkylines(vector<vector<int>> *left_skyline, vector<vector<int>> *right_skyline) {
int i = 0, j = 0;
vector<vector<int>> merged;
while (i < left_skyline->size() && j < right_skyline->size()) {
if ((*left_skyline)[i][end] < (*right_skyline)[j][start]) {
merged.emplace_back(move((*left_skyline)[i++]));
} else if ((*right_skyline)[j][end] < (*left_skyline)[i][start]) {
merged.emplace_back(move((*right_skyline)[j++]));
} else if ((*left_skyline)[i][start] <= (*right_skyline)[j][start]) {
MergeIntersectSkylines(&merged,
&(*left_skyline)[i], &i,
&(*right_skyline)[j], &j);
} else { // (*left_skyline)[i][start] > (*right_skyline)[j][start].
MergeIntersectSkylines(&merged,
&(*right_skyline)[j], &j,
&(*left_skyline)[i], &i);
}
}
// Insert the remaining skylines.
merged.insert(merged.end(),
left_skyline->begin() + i, left_skyline->end());
merged.insert(merged.end(),
right_skyline->begin() + j, right_skyline->end());
return merged;
}
// (*a)[start] <= (*b)[start]
void MergeIntersectSkylines(vector<vector<int>> *merged,
vector<int> *a, int *a_idx,
vector<int> *b, int *b_idx) {
if ((*a)[end] <= (*b)[end]) {
if ((*a)[height] > (*b)[height]) { // |aaa|
if ((*b)[end] != (*a)[end]) { // |abb|b
(*b)[start] = (*a)[end];
merged->emplace_back(move(*a)), ++(*a_idx);
} else { // aaa
++(*b_idx); // abb
}
} else if ((*a)[height] == (*b)[height]) { // abb
(*b)[start] = (*a)[start], ++(*a_idx); // abb
} else { // (*a)[height] < (*b)[height].
if ((*a)[start] != (*b)[start]) { // bb
merged->push_back({(*a)[start], (*b)[start], (*a)[height]}); // |a|bb
}
++(*a_idx);
}
} else { // (*a)[end] > (*b)[end].
if ((*a)[height] >= (*b)[height]) { // aaaa
++(*b_idx); // abba
} else {
// |bb|
// |a||bb|a
if ((*a)[start] != (*b)[start]) {
merged->push_back({(*a)[start], (*b)[start], (*a)[height]});
}
(*a)[start] = (*b)[end];
merged->emplace_back(move(*b)), ++(*b_idx);
}
}
}
};
|
ryscheng/turnupthebaas
|
libtalek/message.go
|
<filename>libtalek/message.go
package libtalek
import "encoding/binary"
// message represents a emitted message by talek. It may be split into
// multiple parts by the client for transmission, and reassembled before
// being sent to the application.
type message struct {
contents []byte
// TODO: there's a cute data structure for efficiently tracking out of order
// receipt of messages. This is not that.
receivedEnd uint32
}
// fragmentHeaderLength encodes the length of a message fragment header
const fragmentHeaderLength = 5
// fragmentHeader encodes the header of each wire fragment a message is split into.
type fragmentHeader struct {
flag byte
left uint32
}
// fromBytes reconstructs a fragmentHeader from its wire format
func fromBytes(message []byte) *fragmentHeader {
if len(message) < fragmentHeaderLength {
return nil
}
f := new(fragmentHeader)
f.flag = message[0]
f.left = binary.LittleEndian.Uint32(message[1:5])
return f
}
// IsNewMessage indicates if this fragment represents the first fragment in a message
func (f *fragmentHeader) IsNewMessage() bool {
return (f.flag & 1) == 1
}
func newFragment(firstFragment bool, remainingLength uint32) *fragmentHeader {
f := new(fragmentHeader)
f.left = remainingLength
if firstFragment {
f.flag |= 1
}
return f
}
// ToBytes serializes a fragment header to a byte slice
func (f *fragmentHeader) ToBytes(buf []byte) {
buf[0] = f.flag
binary.LittleEndian.PutUint32(buf[1:5], f.left)
}
// newMessage creates a message from an underlying byte slice
func newMessage(msg []byte) *message {
m := new(message)
m.contents = msg
m.receivedEnd = uint32(len(m.contents))
return m
}
// Split divides a full message into a set of parts no larger than partSize.
func (m *message) Split(partSize int) [][]byte {
denom := (partSize - fragmentHeaderLength)
numMsgs := len(m.contents) / denom
if len(m.contents)%denom != 0 {
numMsgs++
}
messages := make([][]byte, numMsgs)
contentLength := len(m.contents)
remaining := len(m.contents)
for i := 0; i < len(messages); i++ {
part := make([]byte, partSize)
header := newFragment(i == 0, uint32(remaining))
header.ToBytes(part)
remaining -= copy(part[fragmentHeaderLength:], m.contents[contentLength-remaining:])
messages[i] = part
}
return messages
}
// Join Adds a newly received part to a partially reconstructed message
func (m *message) Join(part []byte) bool {
header := fromBytes(part)
if header == nil {
return false
}
if header.IsNewMessage() && m.receivedEnd == 0 {
m.contents = make([]byte, header.left)
}
if len(m.contents)-int(m.receivedEnd) != int(header.left) {
return false
}
copy(m.contents[m.receivedEnd:], part[fragmentHeaderLength:])
m.receivedEnd += uint32(len(part)) - fragmentHeaderLength
return m.receivedEnd >= uint32(len(m.contents))
}
// Retrieve provides the underlying bytes of a message when known.
func (m *message) Retrieve() []byte {
if m.receivedEnd >= uint32(len(m.contents)) {
return m.contents
}
return nil
}
|
AxelGard/university-projects
|
tddd38-cpp/exams/ten-190111/asg3.cc
|
<filename>tddd38-cpp/exams/ten-190111/asg3.cc
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <iostream>
using namespace std;
int entry_score(string entry)
{
// calculate the score of an entry
vector<int> result{};
transform(begin(entry), end(entry), begin(entry),
[](unsigned char c){ return tolower(c); });
transform(begin(entry), end(entry), begin(entry),
[](char c){ return int(c); });
adjacent_difference(begin(entry), end(entry), back_inserter(result));
result.erase(begin(result));
vector<double> weights(result.size());
iota(begin(weights), end(weights), 1.0);
transform(begin(weights), end(weights), begin(weights),
[size = weights.size()](double a){ return a / size; });
return inner_product(begin(result), end(result), begin(weights), 0.0);
}
int calculate_score(vector<string> const& list)
{
// calculate the score of a wishlist
vector<double> scores(list.size());
transform(begin(list), end(list), begin(scores), entry_score);
return accumulate(begin(scores), end(scores), 0);
}
int main()
{
{
vector<string> list { "Fortnite", "Playstation 4", "Dog" };
assert(calculate_score(list) == -62);
}
{
vector<string> list { "Charcoal", "C++ Primer", "World Peace" };
assert(calculate_score(list) == 35);
}
{
vector<string> list { "Fortnite", "C++ Primer" };
assert(calculate_score(list) == 20);
}
{
vector<string> list { "Playstation 4", "Charcoal", "C++ Primer" };
assert(calculate_score(list) == -17);
}
}
|
consyst-project/consyst-code
|
consys-invariants/invariant-demos/src/main/java/de/tuda/stg/consys/demo/invariantdemos/schema/tournament/Tournaments.java
|
//package de.tuda.stg.consys.demo.invariantdemos.schema.tournament;
//
//import de.tuda.stg.consys.annotations.invariants.ReplicatedModel;
//import de.tuda.stg.consys.annotations.methods.WeakOp;
//import de.tuda.stg.consys.core.legacy.CanBeMerged;
//
//import java.io.Serializable;
//
//
//// 1 EnrollTournament pre-condition: Invariant("forall(P:p,T:t):โ enrolled(p,t)=> player(p) and tournament(t)")
//// 2 Done: Invariant("forall(P:p):โ budget(p)>=0")
//// 3 Done: Invariant("forall(T:t):โ nrPlayers(t)<=Capacity")
//// 4 Done: Invariant("forall(T:t):โ active(t) => nrPlayers(t) >= 1")
//// 5 Kinda implemented in general but not sure where exactly we can say: Invariant("forall(T:t,P:p):โ active(t) and enrolled(p,t)=>participant(p,t)")
//@ReplicatedModel public class Tournaments implements CanBeMerged<Tournaments>, Serializable {
//
// //private final Set<Player> players = Sets.newHashSet();
// //private final Set<Tournament> tournaments = Sets.newHashSet();
//
// private final TwoPhaseSetPlayer players;
// private final TwoPhaseSetTournament tournaments;
//
// /*@
// @ public invariant (\forall Player p; players.contains(p); p.getBudget() >= 0);
// @ public invariant (\forall Tournament t; tournaments.contains(t); t.numOfPlayers() <= t.getCapacity() );
// @ public invariant (\forall Tournament t; tournaments.contains(t) && t.isActive(); t.numOfPlayers() >= 1);
// @*/
//
//
// /*@
// @ ensures players.isEmpty();
// @ ensures tournaments.isEmpty();
// @*/
// public Tournaments() {
// players = new TwoPhaseSetPlayer();
// tournaments = new TwoPhaseSetTournament();
// }
//
// // True("player($0)")
// // WeakOp
// /*@
// @ assignable players;
// @ ensures players.contains(p);
// @ ensures (\forall Player p2; \old(players.contains(p2)); players.contains(p2));
// @ ensures (\forall Player p2; players.contains(p2) && p2.equals(p) == false; \old(players.contains(p2)));
// @*/
// @WeakOp public void addPlayer(Player p) {
// players.add(p);
// }
//
// // False("player($0)")
// // StrongOp
// /*@
// @ requires players.contains(p);
// @ assignable players;
// @ ensures players.contains(p) == false;
// @ ensures (\forall Player p2; \old(players.contains(p2)) && p2.equals(p) == false; players.contains(p2));
// @ ensures (\forall Player p2; players.contains(p2); \old(players.contains(p2)));
// @*/
// @WeakOp public void removePlayer(Player p) {
// players.remove(p);
// }
//
// // True("tournament($0)")
// // WeakOp
// /*@
// @ assignable tournaments;
// @ ensures tournaments.contains(t);
// @ ensures (\forall Tournament t2; \old(tournaments.contains(t2)); tournaments.contains(t2));
// @ ensures (\forall Tournament t2; tournaments.contains(t2) && t2.equals(t) == false; \old(tournaments.contains(t2)));
// @*/
// @WeakOp public void addTournament(Tournament t) {
// tournaments.add(t);
// }
//
// // False("tournament($0)")
// // WeakOp
// /*@
// @ requires tournaments.contains(t);
// @ assignable tournaments;
// @ ensures tournaments.contains(t) == false;
// @ ensures (\forall Tournament t2; \old(tournaments.contains(t2)) && t2.equals(t) == false; tournaments.contains(t2));
// @ ensures (\forall Tournament t2; tournaments.contains(t2); \old(tournaments.contains(t2)));
// @*/
// @WeakOp public void removeTournament(Tournament t) {
// tournaments.remove(t);
// }
//
// // True("enrolled($0,$1)")
// // False("participant($0,$1)")
// // Increments("nrPlayers($1,1)")
// // Decrements("budget($0,1)")
// // StrongOp
//
// /*@
// @ requires tournaments.contains(t);
// @ requires players.contains(p);
// @ requires t.hasParticipant(p) == false;
// @ assignable p, t;
// @ ensures t.hasParticipant(p);
// @ ensures p.getBudget() == \old(p.getBudget()) - 1;
// @ ensures (\forall Player p2; \old(t.hasParticipant(p2)) ; t.hasParticipant(p2));
// @ ensures (\forall Player p2; t.hasParticipant(p2) && p2.equals(p) == false; \old(t.hasParticipant(p2)));
// @*/
// @WeakOp public void enrollTournament(Player p,Tournament t) {
// t.enroll(p);
// p.incBudget(-1);
// }
//
// // False("enrolled($0,$1)")
// // Decrements("nrPlayers($1,1)")
// // WeakOp
// /*@
// @ requires tournaments.contains(t);
// @ requires players.contains(p);
// @ requires t.hasParticipant(p);
// @ assignable t;
// @ ensures t.hasParticipant(p) == false;
// @ ensures (\forall Player p2; \old(t.hasParticipant(p2)) && p2.equals(p) == false; t.hasParticipant(p2));
// @ ensures (\forall Player p2; t.hasParticipant(p2); \old(t.hasParticipant(p2)));
// @*/
// @WeakOp public void disenrollTournament(Player p,Tournament t) {
// t.disenroll(p);
// }
//
// // True("active($0)")
// // True("participant(_,$0)")
// // WeakOp
// /*@
// @ requires tournaments.contains(t);
// @ requires t.isActive() == false;
// @ assignable t;
// @ ensures t.isActive();
// @ ensures (\forall Player p2; \old(t.hasParticipant(p2)) ; t.hasParticipant(p2));
// @ ensures (\forall Player p2; t.hasParticipant(p2); \old(t.hasParticipant(p2)));
// @*/
// @WeakOp public void beginTournament(Tournament t) {
// t.setActive(true);
// }
//
// // False("active($0)")
// // WeakOp
// /*@
// @ requires tournaments.contains(t);
// @ requires t.isActive();
// @ assignable t;
// @ ensures t.isActive() == false;
// @ ensures (\forall Player p2; \old(t.hasParticipant(p2)) ; t.hasParticipant(p2));
// @ ensures (\forall Player p2; t.hasParticipant(p2); \old(t.hasParticipant(p2)));
// @*/
// @WeakOp public void endTournament(Tournament t) {
// t.setActive(false);
// }
//
// // Increments("budget($0,$1)")
// // WeakOp
// /*@
// @ requires amount >= 0;
// @ assignable p;
// @ ensures p.getBudget() == \old(p.getBudget()) + amount;
// @*/
// @WeakOp
// public void addFunds(Player p, int amount) {
// p.incBudget(amount);
// }
//
// /*@
// @ ensures stateful(players.merge(other.players));
// @ ensures stateful(tournaments.merge(other.tournaments));
// @*/
// public void merge(Tournaments other) {
// players.merge(other.players);
// tournaments.merge(other.tournaments);
// }
//
//}
|
Fumaloko92/MSc-Thesis
|
17-05-2017/neuralturingmachines-master/src/com/anji/tournament/KRandomOppsTournament.java
|
<filename>17-05-2017/neuralturingmachines-master/src/com/anji/tournament/KRandomOppsTournament.java<gh_stars>1-10
/*
* Copyright (C) 2004 <NAME> and <NAME> This file is part of ANJI (Another NEAT Java
* Implementation). ANJI is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version. This program is distributed
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA created by <NAME>
*/
package com.anji.tournament;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Random;
import java.util.Set;
import com.anji.util.Configurable;
import com.anji.util.Properties;
import com.anji.util.Randomizer;
/**
* Each subject plays at least <i>k </i> games against a random set of opponents. Does not count
* opponent results (i.e., the k opponents chosen for each contestant each round).
*
* @author <NAME>
*/
public class KRandomOppsTournament extends SimpleTournament implements Configurable {
private final static String K_KEY = "krandomopps.k";
private static final int DEFAULT_K = 5;
private int k = DEFAULT_K;
private Set currentPlayerOpponents = new HashSet();
private PlayerPair currentPlayerPair;
private Iterator playerAndResultsIterator;
private Random rand = new Random();
/**
* default ctor; object must be initialized with <code>init()</code>
*/
public KRandomOppsTournament() {
// no-op
}
/**
* Note: this object overrides <code>aMatch</code> countOpponentResults to <code>false</code>
* @param aGame
* @param aWeights
* @param aK number of opponents for each subject
* @param aRand random number generator
*/
public KRandomOppsTournament( Game aGame, int aK, ScoringWeights aWeights, Random aRand ) {
super( aGame, aWeights );
k = aK;
rand = aRand;
}
/**
* @see com.anji.util.Configurable#init(com.anji.util.Properties)
*/
public void init( Properties props ) throws Exception {
super.init( props );
Randomizer randomizer = (Randomizer) props.singletonObjectProperty( Randomizer.class );
k = props.getIntProperty( K_KEY, DEFAULT_K );
rand = randomizer.getRand();
}
/**
* @see com.anji.tournament.SimpleTournament#hasNextPlayerPair()
*/
protected boolean hasNextPlayerPair() {
return ( currentPlayerPair != null )
&& ( ( currentPlayerOpponents.size() < k ) || ( playerAndResultsIterator.hasNext() ) );
}
/**
* @see com.anji.tournament.SimpleTournament#nextPlayerPair()
*/
protected PlayerPair nextPlayerPair() {
if ( currentPlayerPair != null ) {
// get next subject if we've hit k opponents
if ( currentPlayerOpponents.size() >= k ) {
if ( playerAndResultsIterator.hasNext() ) {
currentPlayerPair.contestant = (PlayerResults) playerAndResultsIterator.next();
currentPlayerPair.opponent = null;
currentPlayerOpponents.clear();
}
else
currentPlayerPair = null;
}
if ( currentPlayerPair != null ) {
// get next random opponent for current subject
do {
// we use a clone of the player results so that opponent results are not counted
PlayerResults playerResults = (PlayerResults) getResults().get(
rand.nextInt( getResults().size() ) );
currentPlayerPair.opponent = new PlayerResults( playerResults.getPlayer() );
} while ( currentPlayerPair.opponent.equals( currentPlayerPair.contestant )
|| currentPlayerOpponents.contains( currentPlayerPair.opponent ) );
currentPlayerOpponents.add( currentPlayerPair.opponent );
}
}
return currentPlayerPair;
}
/**
* @see com.anji.tournament.SimpleTournament#startTournament()
*/
protected void startTournament() {
int numPlayers = getResults().size();
if ( k > ( numPlayers - 1 ) )
throw new IllegalStateException( "not enough players (" + numPlayers
+ ") for k opponents (" + k + ")" );
currentPlayerOpponents.clear();
playerAndResultsIterator = getResults().iterator();
currentPlayerPair = new PlayerPair();
if ( playerAndResultsIterator.hasNext() )
currentPlayerPair.contestant = (PlayerResults) playerAndResultsIterator.next();
}
/**
* @see com.anji.tournament.SimpleTournament#getMaxScore()
*/
public int getMaxScore() {
return k * getGame().getMaxScore( getScoringWeights() );
}
/**
* @see com.anji.tournament.Tournament#getMinScore()
*/
public int getMinScore() {
return k * getGame().getMinScore( getScoringWeights() );
}
/**
* @see com.anji.tournament.SimpleTournament#endTournament()
*/
protected void endTournament() {
// no-op
}
}
|
ooici/pyon
|
prototype/speed/rpcspeed.py
|
<gh_stars>1-10
#!/usr/bin/env python
from pyon.net.endpoint import RPCClient
#from interface.services.idatastore_service import IDatastoreService
from interface.services.examples.hello.ihello_service import HelloServiceClient, IHelloService
from pyon.net.messaging import make_node
import gevent
import time
import base64
import os
import argparse
import msgpack
from pyon.core import bootstrap
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--datasize', type=int, help='Size of data in bytes')
parser.add_argument('-p', '--parallel', type=int, help='Number of parallel requests to run')
parser.add_argument('-m', '--msgpack', action='store_true', help='Encode data with msgpack')
parser.add_argument('-s', '--sysname', action='store', help='ION System Name')
parser.set_defaults(datasize=1024, parallel=1, sysname='tt')
opts = parser.parse_args()
bootstrap.sys_name = opts.sysname
bootstrap.bootstrap_pyon()
node,iowat=make_node()
#dsclient = RPCClient(node=node, name="datastore", iface=IDatastoreService)
hsclient = HelloServiceClient(node=node)#RPCClient(node=node, name="hello", iface=IHelloService)
# make data (bytes)
DATA_SIZE = opts.datasize
# base64 encoding wastes a lot of space, truncate it at the exact data size we requested
data = base64.urlsafe_b64encode(os.urandom(DATA_SIZE))[:DATA_SIZE]
if opts.msgpack:
data = msgpack.dumps(data)
PARALLEL = opts.parallel
print "Datasize:", DATA_SIZE, "Parallel:", PARALLEL
counter = [0] * PARALLEL
st = time.time()
def tick():
global counter, st
while True:
time.sleep(2)
ct = time.time()
elapsed_s = ct - st
sc = sum(counter)
mps = sc / elapsed_s
print counter, sc, "requests, per sec:", mps
def work(wid):
global counter
while True:
hsclient.noop(data)
#hsclient.hello(str(counter[wid]))
counter[wid] += 1
_gt = gevent.spawn(tick)
workers = []
for x in range(PARALLEL):
workers.append(gevent.spawn(work, x))
gevent.joinall([_gt] + workers)
|
goodspeed24e/2014iOT
|
test/openp2p/src/OpenP2P/Signal.cpp
|
<reponame>goodspeed24e/2014iOT
#include <map>
#include <boost/thread.hpp>
#include <OpenP2P/Condition.hpp>
#include <OpenP2P/Lock.hpp>
#include <OpenP2P/Mutex.hpp>
#include <OpenP2P/Signal.hpp>
#include <OpenP2P/Timeout.hpp>
namespace OpenP2P {
Signal::Signal() : isActivated_(false) { }
void Signal::activate() {
Lock lock(mutex_);
cond_.notifyAll();
isActivated_ = true;
}
void Signal::reset() {
Lock lock(mutex_);
isActivated_ = false;
}
bool Signal::isActivated() {
Lock lock(mutex_);
return isActivated_;
}
bool Signal::wait(Timeout timeout) {
Lock lock(mutex_);
if (!isActivated_) {
return cond_.wait(lock, timeout);
} else {
return true;
}
}
void Signal::cancel() {
cond_.notifyAll();
}
}
|
shuwenjin/dcwlt
|
dcwlt-api/dcwlt-api-system/src/main/java/com/dcits/dcwlt/system/api/factory/RemotePayBatchFallbackFactory.java
|
<reponame>shuwenjin/dcwlt
package com.dcits.dcwlt.system.api.factory;
import com.alibaba.fastjson.JSONObject;
import com.dcits.dcwlt.system.api.RemotePayBatchService;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
/**
* ๆฏไปๆน้ๆๅก้็บงๅค็
*
* @author zhangyd
*/
@Component
public class RemotePayBatchFallbackFactory implements FallbackFactory<RemotePayBatchService>
{
private static final Logger log = LoggerFactory.getLogger(RemotePayBatchFallbackFactory.class);
@Override
public RemotePayBatchService create(Throwable throwable)
{
log.error("ๆฏไปๆน้ๆๅก่ฐ็จๅคฑ่ดฅ: ", throwable.getMessage());
return new RemotePayBatchService()
{
@Override
public void statistics(String reportDate) throws Exception {
throw new Exception(throwable.getMessage());
}
@Override
public String schedulerController(String settleDate, String batchId, String serviceName) {
return "1";
}
};
}
}
|
insphereapplication/rhodes
|
spec/framework_spec/app/spec/core/method/name_spec.rb
|
require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/../../spec_helper'
require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/fixtures/classes'
describe "Method#name" do
ruby_version_is '1.8.7' do
it "returns the name of the method" do
"abc".method(:upcase).name.should == :upcase
end
it "returns the name even when aliased" do
obj = MethodSpecs::Methods.new
obj.method(:foo).name.should == :foo
obj.method(:bar).name.should == :bar
obj.method(:bar).unbind.bind(obj).name.should == :bar
end
end
end
|
rooby/earthsci
|
plugins/au.gov.ga.earthsci.bookmark.ui/src/au/gov/ga/earthsci/bookmark/ui/IBookmarksController.java
|
<gh_stars>10-100
/*******************************************************************************
* Copyright 2012 Geoscience Australia
*
* 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 au.gov.ga.earthsci.bookmark.ui;
import au.gov.ga.earthsci.bookmark.IBookmarkPropertyApplicator;
import au.gov.ga.earthsci.bookmark.model.IBookmark;
import au.gov.ga.earthsci.bookmark.model.IBookmarkList;
/**
* A controller interface for the bookmarks feature
*
* @author <NAME> (<EMAIL>)
*/
public interface IBookmarksController
{
/**
* Move the provided bookmarks to a new index in the current list.
* <p/>
* In the case where the provided bookmarks are not sequential, they will be
* inserted at the target index such that they are sequential and maintain
* the same relative order.
* <p/>
* If a given bookmark is not part of the current list it will be ignored
* for the purposes of this operation.
* <p/>
* Equivalent to
* {@code moveBookmarks(getCurrentList(), bookmarks, getCurrentList(), targetIndex);}
*
* @param bookmarks
* The bookmarks to move
* @param targetIndex
* The target index AS IT IS BEFORE THE MOVE
*/
void moveBookmarks(IBookmark[] bookmarks, int targetIndex);
/**
* Move the provided bookmarks between the source and target lists
* <p/>
* Bookmarks will be removed from the source list.
* <p/>
* In the case where the provided bookmarks are not sequential, they will be
* inserted at the target index such that they are sequential and maintain
* the same relative order.
*
* @param sourceList
* The source list
* @param bookmarks
* The bookmarks to move
* @param targetIndex
* The target index AS IT IS BEFORE THE MOVE
* @param targetList
* The target list
*/
void moveBookmarks(IBookmarkList sourceList, IBookmark[] bookmarks, IBookmarkList targetList, int targetIndex);
/**
* Copy the selected bookmarks and paste them into the current list at the
* target index
* <p/>
* In the case where the provided bookmarks are not sequential, they will be
* inserted at the target index such that they are sequential and maintain
* the same relative order.
*
* @param bookmarks
* The bookmarks to copy
* @param targetIndex
* The target index AS IT IS BEFORE THE COPY
*/
void copyBookmarks(IBookmark[] bookmarks, int targetIndex);
/**
* Copy the selected bookmarks and paste them into the target list at the
* target index
* <p/>
* In the case where the provided bookmarks are not sequential, they will be
* inserted at the target index such that they are sequential and maintain
* the same relative order.
*
* @param sourceList
* The source list
* @param bookmarks
* The bookmarks to copy
* @param targetList
* The targetList
* @param targetIndex
* The target index AS IT IS BEFORE THE COPY
*/
void copyBookmarks(IBookmarkList sourceList, IBookmark[] bookmarks, IBookmarkList targetList, int targetIndex);
/**
* Create a new bookmark and append it to the given bookmark list.
*
* @param list
* The list append the new bookmark to
*
* @return The created bookmark
*/
IBookmark createNew(IBookmarkList list);
/**
* Create a new bookmark and append it to the current bookmark list
*
* @return The created bookmark
*/
IBookmark createNew();
/**
* Apply the given bookmark using appropriate
* {@link IBookmarkPropertyApplicator}s and user preferences.
*
* @param bookmark
* The bookmark to apply
*/
void apply(IBookmark bookmark);
/**
* Launch an editor to collect user edits to the provided bookmark.
*
* @param bookmark
* The bookmark to edit
*/
void edit(IBookmark bookmark);
/**
* Delete the given bookmark from the current list
*
* @param bookmark
* The bookmark to delete
*/
void delete(IBookmark bookmark);
/**
* Delete the given bookmarks from the current list
*
* @param bookmarks
* The bookmarks to delete
*/
void delete(IBookmark... bookmarks);
/**
* Return the currently selected bookmark list
*
* @return The currently selected bookmark list
*/
IBookmarkList getCurrentList();
/**
* Set the currently selected bookmark list
*/
void setCurrentList(IBookmarkList list);
/**
* Play through the given bookmark list, starting at the given bookmark.
* <p/>
* If the given bookmark does not exist in the list, or is <code>null</code>
* , play from the start of the given list.
*
* @param list
* The bookmark list to play through
* @param bookmark
* The bookmark to start at
*/
void play(IBookmarkList list, IBookmark bookmark);
/**
* Play through the current bookmark list, starting at the given bookmark.
* <p/>
* If the given bookmark does not exist in the current list, or is
* <code>null</code>, play from the start of the current list.
*
* @param bookmark
* The bookmark to start at in the current list
*/
void play(IBookmark bookmark);
/**
* Create a new bookmark list and add it to the current bookmarks model
* <p/>
* Implementations may prompt the user to provide a name for the list.
*
* @return The newly created list
*/
IBookmarkList createNewBookmarkList();
/**
* Prompt the user to rename the provided bookmark list
*
* @param list
* The list to rename
*/
void renameBookmarkList(IBookmarkList list);
/**
* Delete the bookmark list from the current bookmarks model.
* <p/>
* Implementations may prompt the user to confirm deletion
* <p/>
* If the list being deleted is the current list, will change current list
* to default list. Will not delete the model's default list.
*
* @param list
* The list to delete
*
* @return <code>true</code> if the list was deleted; <code>false</code>
* otherwise
*/
boolean deleteBookmarkList(IBookmarkList list);
/**
* @return Whether there are any actively playing lists
*/
boolean isPlaying();
/**
* Stop any running playlists
*/
void stop();
/**
* Set the UI view this controller links to
*/
void setView(BookmarksPart part);
}
|
SoylentGraham/ofxSoylent
|
src/scope_ptr.h
|
#pragma once
#include <functional>
// generic smart pointer with a lambda for release
template<typename TYPE>
class scope_ptr : public NonCopyable
{
public:
scope_ptr(std::function<void(TYPE&)> ReleaseFunc) :
mObject ( nullptr ),
mReleaseFunc ( ReleaseFunc )
{
}
~scope_ptr()
{
Release();
}
void Release()
{
if ( mObject && mReleaseFunc )
mReleaseFunc(mObject);
mObject = nullptr;
}
public:
TYPE mObject;
std::function<void(TYPE&)> mReleaseFunc;
};
|
Awybupt/data-structure
|
algorithm/newgeek1.cpp
|
/**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
https://www.nowcoder.com/practice/8a19cbe657394eeaac2f6ea9b0f6fcf6?tpId=13&tqId=11157&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-interviews%2Fquestion-ranking
*/
class Solution {
public:
TreeNode* digui(vector<int> pre,vector<int> vin,int pleft,int pright,int vleft,int vright){
TreeNode* ans=NULL;
if(pleft<pright)
{
for (int i=vleft;i<vright;i++)
{
if (vin[i]==pre[pleft])
{
int distance=i-vleft;
ans =new TreeNode(pre[pleft]);
ans->left=digui(pre,vin,pleft+1,pleft+distance+1,vleft,i);
ans->right=digui(pre,vin,pleft+distance+1,pright,vleft+distance+1,vright);
break;
}
}
}
return ans;
}
TreeNode* reConstructBinaryTree(vector<int> pre,vector<int> vin) {
int arrayLen=pre.size();
TreeNode* ans=digui(pre,vin,0,arrayLen,0,arrayLen);
return ans;
}
};
|
archsolar/AncientArcher
|
AAEngine/src/Scene/Plane.h
|
#pragma once
#include "../Base/UniqueInstance.h"
#include "../../include/AncientArcher/ShaderType.h"
#include "../Renderer/MeshDrawInfo.h"
namespace AA {
class Plane : public UniqueInstance {
public:
Plane();
void Draw();
SHADERTYPE shadertype;
MeshDrawInfo *meshdrawinfo;
private:
};
} // end namespace AA
|
mmamiah/junit-utils
|
user-guide/src/test/java/lu/mms/common/quality/samples/assets/mockvalue/MockValueExample2Test.java
|
<filename>user-guide/src/test/java/lu/mms/common/quality/samples/assets/mockvalue/MockValueExample2Test.java<gh_stars>0
package lu.mms.common.quality.samples.assets.mockvalue;
import lu.mms.common.quality.assets.mockvalue.MockValue;
import lu.mms.common.quality.assets.mockvalue.MockValueExtension;
import lu.mms.common.quality.samples.models.mockvalue.Identity;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.junit.jupiter.MockitoExtension;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo;
// tag::example[]
@ExtendWith({MockitoExtension.class, MockValueExtension.class})
class MockValueExample2Test {
@InjectMocks
private Identity sut;
@MockValue("${identity-default-value}")
private String idDefaultValue = "id_123";
@Test
void shouldFindTheIdWhenInitializedWithMockValue() {
// Act / Assert
assertThat(sut.getId(), equalTo(idDefaultValue));
}
}
// end::example[]
|
jingcao80/Elastos
|
Sources/Elastos/Frameworks/Droid/Base/Core/src/elastos/droid/content/CSyncContext.cpp
|
<filename>Sources/Elastos/Frameworks/Droid/Base/Core/src/elastos/droid/content/CSyncContext.cpp
//=========================================================================
// Copyright (C) 2012 The Elastos 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.
//=========================================================================
#include "elastos/droid/ext/frameworkext.h"
#include "Elastos.Droid.Os.h"
#include "elastos/droid/content/CSyncContext.h"
#include "elastos/droid/os/SystemClock.h"
using Elastos::Droid::Os::SystemClock;
namespace Elastos {
namespace Droid {
namespace Content {
const Int64 CSyncContext::HEARTBEAT_SEND_INTERVAL_IN_MS;
CAR_INTERFACE_IMPL(CSyncContext, Object, ISyncContext)
CAR_OBJECT_IMPL(CSyncContext)
CSyncContext::CSyncContext()
: mLastHeartbeatSendTime(0)
{}
CSyncContext::~CSyncContext()
{}
ECode CSyncContext::SetStatusText(
/* [in] */ const String& message)
{
return UpdateHeartbeat();
}
ECode CSyncContext::OnFinished(
/* [in] */ ISyncResult* result)
{
if (NULL != mSyncContext) {
FAIL_RETURN(mSyncContext->OnFinished(result))
}
return NOERROR;
}
ECode CSyncContext::GetSyncContextBinder(
/* [out] */ IBinder** binder)
{
VALIDATE_NOT_NULL(binder)
*binder = IBinder::Probe(mSyncContext);
REFCOUNT_ADD(*binder)
return NOERROR;
}
ECode CSyncContext::constructor(
/* [in] */ IISyncContext* syncContextInterface)
{
mSyncContext = syncContextInterface;
mLastHeartbeatSendTime = 0;
return NOERROR;
}
ECode CSyncContext::UpdateHeartbeat()
{
Int64 now = SystemClock::GetElapsedRealtime();
if (now < mLastHeartbeatSendTime + HEARTBEAT_SEND_INTERVAL_IN_MS) return NOERROR;
mLastHeartbeatSendTime = now;
if (NULL != mSyncContext) {
FAIL_RETURN(mSyncContext->SendHeartbeat())
}
return NOERROR;
}
}
}
}
|
Utqrsh04/The-Complete-FAANG-Preparation
|
1]. DSA/3]. 450 DSA by ( Love Babbar Bhaiya )/C++/04]. Searching & Sorting/_17)_Sort_by_Set_Bit_Count.cpp
|
// Link : https://practice.geeksforgeeks.org/problems/sort-by-set-bit-count1153/1
/*
Given an array of integers, sort the array (in descending order) according to count of set bits in binary representation of array elements.
Note: For integers having same number of set bits in their binary representation, sort according to their position in the original array i.e., a stable sort.
Example 1:
Input:
arr[] = {5, 2, 3, 9, 4, 6, 7, 15, 32};
Output:
15 7 5 3 9 6 2 4 32
Explanation:
The integers in their binary
representation are:
15 - 1111
7 - 0111
5 - 0101
3 - 0011
9 - 1001
6 - 0110
2 - 0010
4 - 0100
32 - 10000
hence the non-increasing sorted order is:
{15}, {7}, {5, 3, 9, 6}, {2, 4, 32}*/
#include <bits/stdc++.h>
using namespace std;
class Solution{
public:
static bool compare(int a, int b)
{
// __builtin_popcount is a stl to count set bits.
return __builtin_popcount(a) > __builtin_popcount(b);
}
void sortBySetBitCount(int arr[], int n)
{
// Your code goes here
stable_sort(arr,arr+n,compare);
}
};
// { Driver Code Starts.
int main()
{
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
Solution ob;
ob.sortBySetBitCount(arr, n);
for (int i = 0; i < n; i++)
cout << arr[i] << " ";
cout << endl;
}
return 0;
}
// } Driver Code Ends
|
ScriptonBasestar-Lib/sb-tools-java
|
threading/src/main/java/org/scriptonbasestar/tool/threading/RunnableManager.java
|
package org.scriptonbasestar.tool.threading;
/**
* @author archmagece
* @with sb-tool-java
* @since 2015-07-27-18
* <p>
* Runnable ์ค๋ ๋ ๊ฐ์์ ํ์ด๋ผ๋๊ฐ
*/
public class RunnableManager {
}
|
shockerjue/Gameserver
|
dataaccess/src/baghost/baghost.cpp
|
<reponame>shockerjue/Gameserver
#include "baghost.h"
namespace goods {
}
|
dh-linghaibin/wireless_plc
|
code/wireless_oia/device/include/sm16703p.h
|
<reponame>dh-linghaibin/wireless_plc<gh_stars>1-10
/*
* This file is part of the
*
* Copyright (c) 2016-2018 linghaibin
*
*/
#ifndef _SM16703P_H_
#define _SM16703P_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "gd32f10x.h"
void sm16703p_init(void);
#ifdef __cplusplus
}
#endif
#endif
|
JJLewis/Comp1511
|
lab07/horizontal_balance.c
|
<reponame>JJLewis/Comp1511<gh_stars>1-10
// <NAME> (<EMAIL>)
// Apr 12 2017
//
#include <stdio.h>
#include "captcha.h"
double get_horizontal_balance(int height, int width, int pixels[height][width]) {
int column_sum = 0;
int n_black_pixels = 0;
int v = 0;
while (v < height) {
int h = 0;
while (h < width) {
if (pixels[v][h] == 1) {
n_black_pixels++;
column_sum += h;
}
h++;
}
v++;
}
return ((double)column_sum / n_black_pixels + 0.5) / width;
}
|
guillaume-plantevin/VeeSeeVSTRack
|
plugins/community/repos/mental/src/MentalSums.cpp
|
///////////////////////////////////////////////////
//
// Mental Sums summing - VCV Module
//
// Strum 2017
//
///////////////////////////////////////////////////
#include "mental.hpp"
namespace rack_plugin_mental {
struct MentalSums : Module {
enum ParamIds {
NUM_PARAMS
};
enum InputIds {
INPUT_1,
INPUT_2,
INPUT_3,
INPUT_4,
INPUT_5,
INPUT_2_1,
INPUT_2_2,
INPUT_2_3,
INPUT_2_4,
INPUT_2_5,
NUM_INPUTS
};
enum OutputIds {
OUTPUT_1,
OUTPUT_2,
NUM_OUTPUTS
};
float sum_out_1 = 0.0;
float sum_out_2 = 0.0;
MentalSums() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {}
void step() override;
};
void MentalSums::step()
{
sum_out_1 = 0.0;
sum_out_2 = 0.0;
for (int i = 0 ; i < 5 ; i++)
{
sum_out_1 += inputs[INPUT_1 + i].value;
sum_out_2 += inputs[INPUT_2_1 + i].value;
}
outputs[OUTPUT_1].value = sum_out_1;
outputs[OUTPUT_2].value = sum_out_2;
}
////////////////////////////////////////////////////////////////
struct MentalSumsWidget : ModuleWidget {
MentalSumsWidget(MentalSums *module);
};
MentalSumsWidget::MentalSumsWidget(MentalSums *module) : ModuleWidget(module)
{
setPanel(SVG::load(assetPlugin(plugin, "res/MentalSums.svg")));
addOutput(Port::create<OutPort>(Vec(3, 22), Port::OUTPUT, module, MentalSums::OUTPUT_1));
addOutput(Port::create<OutPort>(Vec(3, 190), Port::OUTPUT, module, MentalSums::OUTPUT_2));
addInput(Port::create<InPort>(Vec(3, 58), Port::INPUT, module, MentalSums::INPUT_1));
addInput(Port::create<InPort>(Vec(3, 83), Port::INPUT, module, MentalSums::INPUT_2));
addInput(Port::create<InPort>(Vec(3, 108), Port::INPUT, module, MentalSums::INPUT_3));
addInput(Port::create<InPort>(Vec(3, 133), Port::INPUT, module, MentalSums::INPUT_4));
addInput(Port::create<InPort>(Vec(3, 158), Port::INPUT, module, MentalSums::INPUT_5));
addInput(Port::create<InPort>(Vec(3, 230), Port::INPUT, module, MentalSums::INPUT_2_1));
addInput(Port::create<InPort>(Vec(3, 255), Port::INPUT, module, MentalSums::INPUT_2_2));
addInput(Port::create<InPort>(Vec(3, 280), Port::INPUT, module, MentalSums::INPUT_2_3));
addInput(Port::create<InPort>(Vec(3, 305), Port::INPUT, module, MentalSums::INPUT_2_4));
addInput(Port::create<InPort>(Vec(3, 330), Port::INPUT, module, MentalSums::INPUT_2_5));
}
} // namespace rack_plugin_mental
using namespace rack_plugin_mental;
RACK_PLUGIN_MODEL_INIT(mental, MentalSums) {
Model *modelMentalSums = Model::create<MentalSums, MentalSumsWidget>("mental", "MentalSums", "Summing Mixer", MIXER_TAG, UTILITY_TAG);
return modelMentalSums;
}
|
ilincasuzana/robertalab
|
OpenRobertaParent/OpenRobertaRobot/src/main/java/de/fhg/iais/roberta/inter/mode/sensor/IBrickKey.java
|
<filename>OpenRobertaParent/OpenRobertaRobot/src/main/java/de/fhg/iais/roberta/inter/mode/sensor/IBrickKey.java<gh_stars>0
package de.fhg.iais.roberta.inter.mode.sensor;
/**
* The enumeration implementing this interface should contain all the keys available on the robot.
*
* @author kcvejoski
*/
public interface IBrickKey extends IPort {
}
|
josehu07/SplitFS
|
kernel/linux-5.4/drivers/gpu/drm/msm/msm_atomic.c
|
<reponame>josehu07/SplitFS
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2014 Red Hat
* Author: <NAME> <<EMAIL>>
*/
#include <drm/drm_atomic_uapi.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_vblank.h>
#include "msm_atomic_trace.h"
#include "msm_drv.h"
#include "msm_gem.h"
#include "msm_kms.h"
int msm_atomic_prepare_fb(struct drm_plane *plane,
struct drm_plane_state *new_state)
{
struct msm_drm_private *priv = plane->dev->dev_private;
struct msm_kms *kms = priv->kms;
if (!new_state->fb)
return 0;
drm_gem_fb_prepare_fb(plane, new_state);
return msm_framebuffer_prepare(new_state->fb, kms->aspace);
}
static void msm_atomic_async_commit(struct msm_kms *kms, int crtc_idx)
{
unsigned crtc_mask = BIT(crtc_idx);
trace_msm_atomic_async_commit_start(crtc_mask);
mutex_lock(&kms->commit_lock);
if (!(kms->pending_crtc_mask & crtc_mask)) {
mutex_unlock(&kms->commit_lock);
goto out;
}
kms->pending_crtc_mask &= ~crtc_mask;
kms->funcs->enable_commit(kms);
/*
* Flush hardware updates:
*/
trace_msm_atomic_flush_commit(crtc_mask);
kms->funcs->flush_commit(kms, crtc_mask);
mutex_unlock(&kms->commit_lock);
/*
* Wait for flush to complete:
*/
trace_msm_atomic_wait_flush_start(crtc_mask);
kms->funcs->wait_flush(kms, crtc_mask);
trace_msm_atomic_wait_flush_finish(crtc_mask);
mutex_lock(&kms->commit_lock);
kms->funcs->complete_commit(kms, crtc_mask);
mutex_unlock(&kms->commit_lock);
kms->funcs->disable_commit(kms);
out:
trace_msm_atomic_async_commit_finish(crtc_mask);
}
static enum hrtimer_restart msm_atomic_pending_timer(struct hrtimer *t)
{
struct msm_pending_timer *timer = container_of(t,
struct msm_pending_timer, timer);
struct msm_drm_private *priv = timer->kms->dev->dev_private;
queue_work(priv->wq, &timer->work);
return HRTIMER_NORESTART;
}
static void msm_atomic_pending_work(struct work_struct *work)
{
struct msm_pending_timer *timer = container_of(work,
struct msm_pending_timer, work);
msm_atomic_async_commit(timer->kms, timer->crtc_idx);
}
void msm_atomic_init_pending_timer(struct msm_pending_timer *timer,
struct msm_kms *kms, int crtc_idx)
{
timer->kms = kms;
timer->crtc_idx = crtc_idx;
hrtimer_init(&timer->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
timer->timer.function = msm_atomic_pending_timer;
INIT_WORK(&timer->work, msm_atomic_pending_work);
}
static bool can_do_async(struct drm_atomic_state *state,
struct drm_crtc **async_crtc)
{
struct drm_connector_state *connector_state;
struct drm_connector *connector;
struct drm_crtc_state *crtc_state;
struct drm_crtc *crtc;
int i, num_crtcs = 0;
if (!(state->legacy_cursor_update || state->async_update))
return false;
/* any connector change, means slow path: */
for_each_new_connector_in_state(state, connector, connector_state, i)
return false;
for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
if (drm_atomic_crtc_needs_modeset(crtc_state))
return false;
if (++num_crtcs > 1)
return false;
*async_crtc = crtc;
}
return true;
}
/* Get bitmask of crtcs that will need to be flushed. The bitmask
* can be used with for_each_crtc_mask() iterator, to iterate
* effected crtcs without needing to preserve the atomic state.
*/
static unsigned get_crtc_mask(struct drm_atomic_state *state)
{
struct drm_crtc_state *crtc_state;
struct drm_crtc *crtc;
unsigned i, mask = 0;
for_each_new_crtc_in_state(state, crtc, crtc_state, i)
mask |= drm_crtc_mask(crtc);
return mask;
}
void msm_atomic_commit_tail(struct drm_atomic_state *state)
{
struct drm_device *dev = state->dev;
struct msm_drm_private *priv = dev->dev_private;
struct msm_kms *kms = priv->kms;
struct drm_crtc *async_crtc = NULL;
unsigned crtc_mask = get_crtc_mask(state);
bool async = kms->funcs->vsync_time &&
can_do_async(state, &async_crtc);
trace_msm_atomic_commit_tail_start(async, crtc_mask);
kms->funcs->enable_commit(kms);
/*
* Ensure any previous (potentially async) commit has
* completed:
*/
trace_msm_atomic_wait_flush_start(crtc_mask);
kms->funcs->wait_flush(kms, crtc_mask);
trace_msm_atomic_wait_flush_finish(crtc_mask);
mutex_lock(&kms->commit_lock);
/*
* Now that there is no in-progress flush, prepare the
* current update:
*/
kms->funcs->prepare_commit(kms, state);
/*
* Push atomic updates down to hardware:
*/
drm_atomic_helper_commit_modeset_disables(dev, state);
drm_atomic_helper_commit_planes(dev, state, 0);
drm_atomic_helper_commit_modeset_enables(dev, state);
if (async) {
struct msm_pending_timer *timer =
&kms->pending_timers[drm_crtc_index(async_crtc)];
/* async updates are limited to single-crtc updates: */
WARN_ON(crtc_mask != drm_crtc_mask(async_crtc));
/*
* Start timer if we don't already have an update pending
* on this crtc:
*/
if (!(kms->pending_crtc_mask & crtc_mask)) {
ktime_t vsync_time, wakeup_time;
kms->pending_crtc_mask |= crtc_mask;
vsync_time = kms->funcs->vsync_time(kms, async_crtc);
wakeup_time = ktime_sub(vsync_time, ms_to_ktime(1));
hrtimer_start(&timer->timer, wakeup_time,
HRTIMER_MODE_ABS);
}
kms->funcs->disable_commit(kms);
mutex_unlock(&kms->commit_lock);
/*
* At this point, from drm core's perspective, we
* are done with the atomic update, so we can just
* go ahead and signal that it is done:
*/
drm_atomic_helper_commit_hw_done(state);
drm_atomic_helper_cleanup_planes(dev, state);
trace_msm_atomic_commit_tail_finish(async, crtc_mask);
return;
}
/*
* If there is any async flush pending on updated crtcs, fold
* them into the current flush.
*/
kms->pending_crtc_mask &= ~crtc_mask;
/*
* Flush hardware updates:
*/
trace_msm_atomic_flush_commit(crtc_mask);
kms->funcs->flush_commit(kms, crtc_mask);
mutex_unlock(&kms->commit_lock);
/*
* Wait for flush to complete:
*/
trace_msm_atomic_wait_flush_start(crtc_mask);
kms->funcs->wait_flush(kms, crtc_mask);
trace_msm_atomic_wait_flush_finish(crtc_mask);
mutex_lock(&kms->commit_lock);
kms->funcs->complete_commit(kms, crtc_mask);
mutex_unlock(&kms->commit_lock);
kms->funcs->disable_commit(kms);
drm_atomic_helper_commit_hw_done(state);
drm_atomic_helper_cleanup_planes(dev, state);
trace_msm_atomic_commit_tail_finish(async, crtc_mask);
}
|
agustinaindah/wonderdeal
|
app/src/main/java/id/wonderdeal/wonderdealapps/utils/ServiceInterface.java
|
<reponame>agustinaindah/wonderdeal<gh_stars>0
package id.wonderdeal.wonderdealapps.utils;
import id.wonderdeal.wonderdealapps.model.BaseResponse;
import retrofit2.Call;
import retrofit2.Response;
/**
* Created by agustinaindah on 12/09/2017.
*/
public interface ServiceInterface {
Call<BaseResponse> callBackResponse(ApiService apiService);
void showProgress();
void hideProgress();
void responseSuccess(Response<BaseResponse> response);
void responseFailed(Response<BaseResponse> response);
void failed(Throwable t);
}
|
ClundXIII/acp-java
|
src/main/java/co/clai/access/AccessibleModuleHelper.java
|
<filename>src/main/java/co/clai/access/AccessibleModuleHelper.java
package co.clai.access;
public class AccessibleModuleHelper extends AccessibleHelper {
private final String moduleName;
public AccessibleModuleHelper(String moduleName) {
super(false);
this.moduleName = moduleName;
}
@Override
public boolean hasAccess(AccessFilter f) {
return (f.getModule().equals(moduleName));
}
@Override
public boolean hasAccess(AccessFilter f, CommunityAsset a) {
if (f.getModule().equals(moduleName)) {
if (a.matchesAsset(f)) {
return true;
}
}
return false;
}
}
|
eziomou/library-backend
|
spring-rest-api/src/main/java/pl/zmudzin/library/spring/reservation/ReserveBookRequest.java
|
<filename>spring-rest-api/src/main/java/pl/zmudzin/library/spring/reservation/ReserveBookRequest.java
package pl.zmudzin.library.spring.reservation;
import javax.validation.constraints.NotNull;
public final class ReserveBookRequest {
@NotNull
private String bookId;
public ReserveBookRequest() {
}
public ReserveBookRequest(@NotNull String bookId) {
this.bookId = bookId;
}
public String getBookId() {
return bookId;
}
public void setBookId(String bookId) {
this.bookId = bookId;
}
}
|
theclashingfritz/Cog-Invasion-Online-Dump
|
encodings/utf_16_be.py
|
<filename>encodings/utf_16_be.py
# uncompyle6 version 3.2.4
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
# Embedded file name: encodings.utf_16_be
import codecs
encode = codecs.utf_16_be_encode
def decode(input, errors='strict'):
return codecs.utf_16_be_decode(input, errors, True)
class IncrementalEncoder(codecs.IncrementalEncoder):
def encode(self, input, final=False):
return codecs.utf_16_be_encode(input, self.errors)[0]
class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
_buffer_decode = codecs.utf_16_be_decode
class StreamWriter(codecs.StreamWriter):
encode = codecs.utf_16_be_encode
class StreamReader(codecs.StreamReader):
decode = codecs.utf_16_be_decode
def getregentry():
return codecs.CodecInfo(name='utf-16-be', encode=encode, decode=decode, incrementalencoder=IncrementalEncoder, incrementaldecoder=IncrementalDecoder, streamreader=StreamReader, streamwriter=StreamWriter)
|
pister/wint
|
wint-framework/src/main/java/wint/lang/utils/merger/DestPools.java
|
package wint.lang.utils.merger;
import wint.lang.magic.Transformer;
import java.util.Collection;
import java.util.Map;
/**
* User: huangsongli
* Date: 15/3/4
* Time: ไธๅ10:20
*/
public class DestPools {
public static <K, D> DestPool<K, D> toDestPool(Map<K, D> map) {
return new MapDestPool<K, D>(map);
}
public static <K, D> DestPool<K, D> toDestPool(Collection<D> collection, Transformer<D, K> objectToKey) {
return new CollectionDestPool<K, D>(collection, objectToKey);
}
}
|
fabriziogiudici/bluemarine2-src
|
modules/Persistence/src/test/java/it/tidalwave/bluemarine2/persistence/impl/DefaultPersistenceTest.java
|
<filename>modules/Persistence/src/test/java/it/tidalwave/bluemarine2/persistence/impl/DefaultPersistenceTest.java
/*
* *********************************************************************************************************************
*
* blueMarine II: Semantic Media Centre
* http://tidalwave.it/projects/bluemarine2
*
* Copyright (C) 2015 - 2021 by Tidalwave s.a.s. (http://tidalwave.it)
*
* *********************************************************************************************************************
*
* 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.
*
* *********************************************************************************************************************
*
* git clone https://bitbucket.org/tidalwave/bluemarine2-src
* git clone https://github.com/tidalwave-it/bluemarine2-src
*
* *********************************************************************************************************************
*/
package it.tidalwave.bluemarine2.persistence.impl;
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.io.IOException;
import java.io.Reader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.apache.commons.io.FileUtils;
import org.eclipse.rdf4j.repository.Repository;
import org.eclipse.rdf4j.repository.RepositoryConnection;
import org.eclipse.rdf4j.repository.sail.SailRepository;
import org.eclipse.rdf4j.rio.RDFFormat;
import org.eclipse.rdf4j.sail.Sail;
import org.eclipse.rdf4j.sail.memory.MemoryStore;
import org.eclipse.rdf4j.sail.nativerdf.NativeStore;
import it.tidalwave.util.Key;
import it.tidalwave.messagebus.MessageBus;
import it.tidalwave.bluemarine2.message.PowerOnNotification;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import it.tidalwave.bluemarine2.commons.test.SpringTestSupport;
import static java.nio.charset.StandardCharsets.UTF_8;
import static it.tidalwave.util.test.FileComparisonUtilsWithPathNormalizer.*;
import static it.tidalwave.bluemarine2.persistence.PersistencePropertyNames.*;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.*;
/***********************************************************************************************************************
*
* @author <NAME>
*
**********************************************************************************************************************/
public class DefaultPersistenceTest extends SpringTestSupport
{
private static final Path TEST_WORKSPACE = Paths.get("target/workspace");
/** Everything happens here, and this folder is scratched at the beginning of each test. */
private static final Path TEST_STORAGE_FOLDER = TEST_WORKSPACE.resolve("storageFolder");
/** The original file with triples to import. */
private static final Path TEST_IMPORT_FILE = Paths.get("target/test-classes/triples.n3");
/** The import file is copied here, since it could be renamed. */
private static final Path TEST_IMPORT_FILE_COPY = TEST_WORKSPACE.resolve("triples.n3");
private static final Path TEST_TILDE_FILE = TEST_WORKSPACE.resolve("triples.n3~");
private static final Path EMPTY_STORE = Paths.get("target/test-classes/empty.n3");
private static final Path TEST_EXPORT_FILE = Paths.get("target/test-results/export.n3");
private DefaultPersistence underTest;
private MessageBus messageBus;
/*******************************************************************************************************************
*
******************************************************************************************************************/
public DefaultPersistenceTest()
{
super("META-INF/PersistenceTestBeans.xml");
}
/*******************************************************************************************************************
*
******************************************************************************************************************/
@BeforeMethod
public void setup()
throws IOException
{
underTest = context.getBean(DefaultPersistence.class);
messageBus = context.getBean(MessageBus.class);
FileUtils.deleteDirectory(TEST_WORKSPACE.toFile());
Files.createDirectories(TEST_WORKSPACE);
Files.copy(TEST_IMPORT_FILE, TEST_IMPORT_FILE_COPY);
}
/*******************************************************************************************************************
*
******************************************************************************************************************/
@Test
public void must_use_MemoryStore_when_no_configuration()
throws Exception
{
// given
final PowerOnNotification powerOnNotification = new PowerOnNotification(Collections.emptyMap());
// when
underTest.onPowerOnNotification(powerOnNotification);
// then
assertThat(underTest.sail, is(instanceOf(MemoryStore.class)));
// verify(messageBus).publish(new PersistenceInitializedNotification()); // FIXME
// verifyNoMoreInteractions(messageBus);
}
/*******************************************************************************************************************
*
******************************************************************************************************************/
@Test
public void must_use_NativeStore_when_STORAGE_FOLDER_configured()
throws Exception
{
// given
final Map<Key<?>, Object> properties = new HashMap<>();
properties.put(STORAGE_FOLDER, TEST_STORAGE_FOLDER);
final PowerOnNotification powerOnNotification = new PowerOnNotification(properties);
// when
underTest.onPowerOnNotification(powerOnNotification);
// then
assertThat(underTest.sail, is(instanceOf(NativeStore.class)));
underTest.exportToFile(TEST_EXPORT_FILE);
// rewriteN3(EMPTY_STORE);
assertSameContents(EMPTY_STORE, TEST_EXPORT_FILE);
// verify(messageBus).publish(new PersistenceInitializedNotification()); // FIXME
// verifyNoMoreInteractions(messageBus);
}
/*******************************************************************************************************************
*
******************************************************************************************************************/
@Test
public void must_use_NativeStore_when_STORAGE_FOLDER_configured_and_not_scratch()
throws Exception
{
// given
createPreviousStorageFrom(TEST_IMPORT_FILE);
final Map<Key<?>, Object> properties = new HashMap<>();
properties.put(STORAGE_FOLDER, TEST_STORAGE_FOLDER);
final PowerOnNotification powerOnNotification = new PowerOnNotification(properties);
// when
underTest.onPowerOnNotification(powerOnNotification);
// then
assertThat(underTest.sail, is(instanceOf(NativeStore.class)));
underTest.exportToFile(TEST_EXPORT_FILE);
rewriteN3(TEST_IMPORT_FILE, false);
rewriteN3(TEST_EXPORT_FILE, true); // FIXME: why is needed?
assertSameContents(TEST_IMPORT_FILE, TEST_EXPORT_FILE);
// verify(messageBus).publish(new PersistenceInitializedNotification()); // FIXME
// verifyNoMoreInteractions(messageBus);
}
/*******************************************************************************************************************
*
******************************************************************************************************************/
@Test
public void must_use_NativeStore_and_import_when_STORAGE_FOLDER_and_IMPORT_FILE_configured()
throws Exception
{
// given
final Map<Key<?>, Object> properties = new HashMap<>();
properties.put(STORAGE_FOLDER, TEST_STORAGE_FOLDER);
properties.put(IMPORT_FILE, TEST_IMPORT_FILE_COPY);
final PowerOnNotification powerOnNotification = new PowerOnNotification(properties);
// when
underTest.onPowerOnNotification(powerOnNotification);
// then
assertThat(underTest.sail, is(instanceOf(NativeStore.class)));
underTest.exportToFile(TEST_EXPORT_FILE);
rewriteN3(TEST_IMPORT_FILE, false);
rewriteN3(TEST_EXPORT_FILE, true); // FIXME: why is needed?
assertSameContents(TEST_IMPORT_FILE, TEST_EXPORT_FILE);
assertThat(Files.exists(TEST_IMPORT_FILE_COPY), is(true));
assertThat(Files.exists(TEST_TILDE_FILE), is(false));
// verify(messageBus).publish(new PersistenceInitializedNotification()); // FIXME
// verifyNoMoreInteractions(messageBus);
}
/*******************************************************************************************************************
*
******************************************************************************************************************/
@Test
public void must_use_NativeStore_and_import_when_STORAGE_FOLDER_and_IMPORT_FILE_configured_and_rename_import_file()
throws Exception
{
// given
final Map<Key<?>, Object> properties = new HashMap<>();
properties.put(STORAGE_FOLDER, TEST_STORAGE_FOLDER);
properties.put(IMPORT_FILE, TEST_IMPORT_FILE_COPY);
properties.put(RENAME_IMPORT_FILE, true);
final PowerOnNotification powerOnNotification = new PowerOnNotification(properties);
// when
underTest.onPowerOnNotification(powerOnNotification);
// then
assertThat(underTest.sail, is(instanceOf(NativeStore.class)));
underTest.exportToFile(TEST_EXPORT_FILE);
rewriteN3(TEST_IMPORT_FILE, false);
rewriteN3(TEST_EXPORT_FILE, true); // FIXME: why is needed?
assertSameContents(TEST_IMPORT_FILE, TEST_EXPORT_FILE);
assertThat(Files.exists(TEST_IMPORT_FILE_COPY), is(false));
assertThat(Files.exists(TEST_TILDE_FILE), is(true));
// verify(messageBus).publish(new PersistenceInitializedNotification()); // FIXME
// verifyNoMoreInteractions(messageBus);
}
/*******************************************************************************************************************
*
******************************************************************************************************************/
private static void createPreviousStorageFrom (@Nonnull final Path path)
throws Exception
{
final Sail sail = new NativeStore(TEST_STORAGE_FOLDER.toFile());
final Repository repository = new SailRepository(sail);
repository.initialize();
try (final RepositoryConnection connection = repository.getConnection();
final Reader reader = Files.newBufferedReader(TEST_IMPORT_FILE, UTF_8))
{
connection.add(reader, TEST_IMPORT_FILE.toUri().toString(), RDFFormat.N3);
connection.commit();
}
repository.shutDown();
}
}
|
GTLugo/Chivalric
|
chivalric/build/tmp/expandedArchives/forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3-sources.jar_b77944a67449ffcc9dcc6ef1ff5cf49e/net/minecraft/client/gui/overlay/PlayerTabOverlayGui.java
|
package net.minecraft.client.gui.overlay;
import com.google.common.collect.ComparisonChain;
import com.google.common.collect.Ordering;
import com.mojang.authlib.GameProfile;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import java.util.Comparator;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.IngameGui;
import net.minecraft.client.network.play.ClientPlayNetHandler;
import net.minecraft.client.network.play.NetworkPlayerInfo;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerModelPart;
import net.minecraft.scoreboard.ScoreCriteria;
import net.minecraft.scoreboard.ScoreObjective;
import net.minecraft.scoreboard.ScorePlayerTeam;
import net.minecraft.scoreboard.Scoreboard;
import net.minecraft.util.IReorderingProcessor;
import net.minecraft.util.Util;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.IFormattableTextComponent;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.GameType;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
public class PlayerTabOverlayGui extends AbstractGui {
private static final Ordering<NetworkPlayerInfo> ENTRY_ORDERING = Ordering.from(new PlayerTabOverlayGui.PlayerComparator());
private final Minecraft mc;
private final IngameGui guiIngame;
private ITextComponent footer;
private ITextComponent header;
/** The last time the playerlist was opened (went from not being renderd, to being rendered) */
private long lastTimeOpened;
/** Weither or not the playerlist is currently being rendered */
private boolean visible;
public PlayerTabOverlayGui(Minecraft mcIn, IngameGui guiIngameIn) {
this.mc = mcIn;
this.guiIngame = guiIngameIn;
}
public ITextComponent getDisplayName(NetworkPlayerInfo p_200262_1_) {
return p_200262_1_.getDisplayName() != null ? this.func_238524_a_(p_200262_1_, p_200262_1_.getDisplayName().deepCopy()) : this.func_238524_a_(p_200262_1_, ScorePlayerTeam.func_237500_a_(p_200262_1_.getPlayerTeam(), new StringTextComponent(p_200262_1_.getGameProfile().getName())));
}
private ITextComponent func_238524_a_(NetworkPlayerInfo p_238524_1_, IFormattableTextComponent p_238524_2_) {
return p_238524_1_.getGameType() == GameType.SPECTATOR ? p_238524_2_.mergeStyle(TextFormatting.ITALIC) : p_238524_2_;
}
/**
* Called by GuiIngame to update the information stored in the playerlist, does not actually render the list,
* however.
*/
public void setVisible(boolean visible) {
if (visible && !this.visible) {
this.lastTimeOpened = Util.milliTime();
}
this.visible = visible;
}
public void func_238523_a_(MatrixStack p_238523_1_, int p_238523_2_, Scoreboard p_238523_3_, @Nullable ScoreObjective p_238523_4_) {
ClientPlayNetHandler clientplaynethandler = this.mc.player.connection;
List<NetworkPlayerInfo> list = ENTRY_ORDERING.sortedCopy(clientplaynethandler.getPlayerInfoMap());
int i = 0;
int j = 0;
for(NetworkPlayerInfo networkplayerinfo : list) {
int k = this.mc.fontRenderer.getStringPropertyWidth(this.getDisplayName(networkplayerinfo));
i = Math.max(i, k);
if (p_238523_4_ != null && p_238523_4_.getRenderType() != ScoreCriteria.RenderType.HEARTS) {
k = this.mc.fontRenderer.getStringWidth(" " + p_238523_3_.getOrCreateScore(networkplayerinfo.getGameProfile().getName(), p_238523_4_).getScorePoints());
j = Math.max(j, k);
}
}
list = list.subList(0, Math.min(list.size(), 80));
int i4 = list.size();
int j4 = i4;
int k4;
for(k4 = 1; j4 > 20; j4 = (i4 + k4 - 1) / k4) {
++k4;
}
boolean flag = this.mc.isIntegratedServerRunning() || this.mc.getConnection().getNetworkManager().isEncrypted();
int l;
if (p_238523_4_ != null) {
if (p_238523_4_.getRenderType() == ScoreCriteria.RenderType.HEARTS) {
l = 90;
} else {
l = j;
}
} else {
l = 0;
}
int i1 = Math.min(k4 * ((flag ? 9 : 0) + i + l + 13), p_238523_2_ - 50) / k4;
int j1 = p_238523_2_ / 2 - (i1 * k4 + (k4 - 1) * 5) / 2;
int k1 = 10;
int l1 = i1 * k4 + (k4 - 1) * 5;
List<IReorderingProcessor> list1 = null;
if (this.header != null) {
list1 = this.mc.fontRenderer.trimStringToWidth(this.header, p_238523_2_ - 50);
for(IReorderingProcessor ireorderingprocessor : list1) {
l1 = Math.max(l1, this.mc.fontRenderer.func_243245_a(ireorderingprocessor));
}
}
List<IReorderingProcessor> list2 = null;
if (this.footer != null) {
list2 = this.mc.fontRenderer.trimStringToWidth(this.footer, p_238523_2_ - 50);
for(IReorderingProcessor ireorderingprocessor1 : list2) {
l1 = Math.max(l1, this.mc.fontRenderer.func_243245_a(ireorderingprocessor1));
}
}
if (list1 != null) {
fill(p_238523_1_, p_238523_2_ / 2 - l1 / 2 - 1, k1 - 1, p_238523_2_ / 2 + l1 / 2 + 1, k1 + list1.size() * 9, Integer.MIN_VALUE);
for(IReorderingProcessor ireorderingprocessor2 : list1) {
int i2 = this.mc.fontRenderer.func_243245_a(ireorderingprocessor2);
this.mc.fontRenderer.func_238407_a_(p_238523_1_, ireorderingprocessor2, (float)(p_238523_2_ / 2 - i2 / 2), (float)k1, -1);
k1 += 9;
}
++k1;
}
fill(p_238523_1_, p_238523_2_ / 2 - l1 / 2 - 1, k1 - 1, p_238523_2_ / 2 + l1 / 2 + 1, k1 + j4 * 9, Integer.MIN_VALUE);
int l4 = this.mc.gameSettings.getChatBackgroundColor(553648127);
for(int i5 = 0; i5 < i4; ++i5) {
int j5 = i5 / j4;
int j2 = i5 % j4;
int k2 = j1 + j5 * i1 + j5 * 5;
int l2 = k1 + j2 * 9;
fill(p_238523_1_, k2, l2, k2 + i1, l2 + 8, l4);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.enableAlphaTest();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
if (i5 < list.size()) {
NetworkPlayerInfo networkplayerinfo1 = list.get(i5);
GameProfile gameprofile = networkplayerinfo1.getGameProfile();
if (flag) {
PlayerEntity playerentity = this.mc.world.getPlayerByUuid(gameprofile.getId());
boolean flag1 = playerentity != null && playerentity.isWearing(PlayerModelPart.CAPE) && ("Dinnerbone".equals(gameprofile.getName()) || "Grumm".equals(gameprofile.getName()));
this.mc.getTextureManager().bindTexture(networkplayerinfo1.getLocationSkin());
int i3 = 8 + (flag1 ? 8 : 0);
int j3 = 8 * (flag1 ? -1 : 1);
AbstractGui.blit(p_238523_1_, k2, l2, 8, 8, 8.0F, (float)i3, 8, j3, 64, 64);
if (playerentity != null && playerentity.isWearing(PlayerModelPart.HAT)) {
int k3 = 8 + (flag1 ? 8 : 0);
int l3 = 8 * (flag1 ? -1 : 1);
AbstractGui.blit(p_238523_1_, k2, l2, 8, 8, 40.0F, (float)k3, 8, l3, 64, 64);
}
k2 += 9;
}
this.mc.fontRenderer.func_243246_a(p_238523_1_, this.getDisplayName(networkplayerinfo1), (float)k2, (float)l2, networkplayerinfo1.getGameType() == GameType.SPECTATOR ? -1862270977 : -1);
if (p_238523_4_ != null && networkplayerinfo1.getGameType() != GameType.SPECTATOR) {
int l5 = k2 + i + 1;
int i6 = l5 + l;
if (i6 - l5 > 5) {
this.func_175247_a_(p_238523_4_, l2, gameprofile.getName(), l5, i6, networkplayerinfo1, p_238523_1_);
}
}
this.func_238522_a_(p_238523_1_, i1, k2 - (flag ? 9 : 0), l2, networkplayerinfo1);
}
}
if (list2 != null) {
k1 = k1 + j4 * 9 + 1;
fill(p_238523_1_, p_238523_2_ / 2 - l1 / 2 - 1, k1 - 1, p_238523_2_ / 2 + l1 / 2 + 1, k1 + list2.size() * 9, Integer.MIN_VALUE);
for(IReorderingProcessor ireorderingprocessor3 : list2) {
int k5 = this.mc.fontRenderer.func_243245_a(ireorderingprocessor3);
this.mc.fontRenderer.func_238407_a_(p_238523_1_, ireorderingprocessor3, (float)(p_238523_2_ / 2 - k5 / 2), (float)k1, -1);
k1 += 9;
}
}
}
protected void func_238522_a_(MatrixStack p_238522_1_, int p_238522_2_, int p_238522_3_, int p_238522_4_, NetworkPlayerInfo p_238522_5_) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(GUI_ICONS_LOCATION);
int i = 0;
int j;
if (p_238522_5_.getResponseTime() < 0) {
j = 5;
} else if (p_238522_5_.getResponseTime() < 150) {
j = 0;
} else if (p_238522_5_.getResponseTime() < 300) {
j = 1;
} else if (p_238522_5_.getResponseTime() < 600) {
j = 2;
} else if (p_238522_5_.getResponseTime() < 1000) {
j = 3;
} else {
j = 4;
}
this.setBlitOffset(this.getBlitOffset() + 100);
this.blit(p_238522_1_, p_238522_3_ + p_238522_2_ - 11, p_238522_4_, 0, 176 + j * 8, 10, 8);
this.setBlitOffset(this.getBlitOffset() - 100);
}
private void func_175247_a_(ScoreObjective objective, int p_175247_2_, String name, int p_175247_4_, int p_175247_5_, NetworkPlayerInfo info, MatrixStack p_175247_7_) {
int i = objective.getScoreboard().getOrCreateScore(name, objective).getScorePoints();
if (objective.getRenderType() == ScoreCriteria.RenderType.HEARTS) {
this.mc.getTextureManager().bindTexture(GUI_ICONS_LOCATION);
long j = Util.milliTime();
if (this.lastTimeOpened == info.getRenderVisibilityId()) {
if (i < info.getLastHealth()) {
info.setLastHealthTime(j);
info.setHealthBlinkTime((long)(this.guiIngame.getTicks() + 20));
} else if (i > info.getLastHealth()) {
info.setLastHealthTime(j);
info.setHealthBlinkTime((long)(this.guiIngame.getTicks() + 10));
}
}
if (j - info.getLastHealthTime() > 1000L || this.lastTimeOpened != info.getRenderVisibilityId()) {
info.setLastHealth(i);
info.setDisplayHealth(i);
info.setLastHealthTime(j);
}
info.setRenderVisibilityId(this.lastTimeOpened);
info.setLastHealth(i);
int k = MathHelper.ceil((float)Math.max(i, info.getDisplayHealth()) / 2.0F);
int l = Math.max(MathHelper.ceil((float)(i / 2)), Math.max(MathHelper.ceil((float)(info.getDisplayHealth() / 2)), 10));
boolean flag = info.getHealthBlinkTime() > (long)this.guiIngame.getTicks() && (info.getHealthBlinkTime() - (long)this.guiIngame.getTicks()) / 3L % 2L == 1L;
if (k > 0) {
int i1 = MathHelper.floor(Math.min((float)(p_175247_5_ - p_175247_4_ - 4) / (float)l, 9.0F));
if (i1 > 3) {
for(int j1 = k; j1 < l; ++j1) {
this.blit(p_175247_7_, p_175247_4_ + j1 * i1, p_175247_2_, flag ? 25 : 16, 0, 9, 9);
}
for(int l1 = 0; l1 < k; ++l1) {
this.blit(p_175247_7_, p_175247_4_ + l1 * i1, p_175247_2_, flag ? 25 : 16, 0, 9, 9);
if (flag) {
if (l1 * 2 + 1 < info.getDisplayHealth()) {
this.blit(p_175247_7_, p_175247_4_ + l1 * i1, p_175247_2_, 70, 0, 9, 9);
}
if (l1 * 2 + 1 == info.getDisplayHealth()) {
this.blit(p_175247_7_, p_175247_4_ + l1 * i1, p_175247_2_, 79, 0, 9, 9);
}
}
if (l1 * 2 + 1 < i) {
this.blit(p_175247_7_, p_175247_4_ + l1 * i1, p_175247_2_, l1 >= 10 ? 160 : 52, 0, 9, 9);
}
if (l1 * 2 + 1 == i) {
this.blit(p_175247_7_, p_175247_4_ + l1 * i1, p_175247_2_, l1 >= 10 ? 169 : 61, 0, 9, 9);
}
}
} else {
float f = MathHelper.clamp((float)i / 20.0F, 0.0F, 1.0F);
int k1 = (int)((1.0F - f) * 255.0F) << 16 | (int)(f * 255.0F) << 8;
String s = "" + (float)i / 2.0F;
if (p_175247_5_ - this.mc.fontRenderer.getStringWidth(s + "hp") >= p_175247_4_) {
s = s + "hp";
}
this.mc.fontRenderer.drawStringWithShadow(p_175247_7_, s, (float)((p_175247_5_ + p_175247_4_) / 2 - this.mc.fontRenderer.getStringWidth(s) / 2), (float)p_175247_2_, k1);
}
}
} else {
String s1 = TextFormatting.YELLOW + "" + i;
this.mc.fontRenderer.drawStringWithShadow(p_175247_7_, s1, (float)(p_175247_5_ - this.mc.fontRenderer.getStringWidth(s1)), (float)p_175247_2_, 16777215);
}
}
public void setFooter(@Nullable ITextComponent footerIn) {
this.footer = footerIn;
}
public void setHeader(@Nullable ITextComponent headerIn) {
this.header = headerIn;
}
public void resetFooterHeader() {
this.header = null;
this.footer = null;
}
@OnlyIn(Dist.CLIENT)
static class PlayerComparator implements Comparator<NetworkPlayerInfo> {
private PlayerComparator() {
}
public int compare(NetworkPlayerInfo p_compare_1_, NetworkPlayerInfo p_compare_2_) {
ScorePlayerTeam scoreplayerteam = p_compare_1_.getPlayerTeam();
ScorePlayerTeam scoreplayerteam1 = p_compare_2_.getPlayerTeam();
return ComparisonChain.start().compareTrueFirst(p_compare_1_.getGameType() != GameType.SPECTATOR, p_compare_2_.getGameType() != GameType.SPECTATOR).compare(scoreplayerteam != null ? scoreplayerteam.getName() : "", scoreplayerteam1 != null ? scoreplayerteam1.getName() : "").compare(p_compare_1_.getGameProfile().getName(), p_compare_2_.getGameProfile().getName(), String::compareToIgnoreCase).result();
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.