content
stringlengths 10
4.9M
|
---|
package main
import (
"crypto/tls"
"errors"
"flag"
"fmt"
"io/ioutil"
"math"
"net"
"net/url"
"os"
"sort"
"strconv"
"strings"
"time"
)
const USAGE = `makeRequest
Usage:
makeRequest --url=<URL> [--profile=<COUNT>]
makeRequest --help
Flags:
--url=<URL> The URL that this program will make a request to
--profile=<COUNT> The number of times our program will make a request to <URL> and display stats
--help Display the usage of this program
`
const HEADER = "GET %v HTTP/1.0\r\nHost: %v\r\n\r\n"
var dialer = net.Dialer{
Timeout: time.Minute,
}
func checkError(err error) {
if err != nil {
fmt.Fprintf(os.Stderr, "Fatal error: %s", err.Error())
os.Exit(1)
}
}
func validate(displayHelp bool, urlStr string, profileCount int) error {
if flag.NFlag() > 2 || flag.NFlag() == 0 {
return errors.New("Invalid number of flags. Add --help to see available flags")
}
if flag.NFlag() == 2 && (urlStr == "" || profileCount < 0) {
return errors.New("Invalid flags supplied. Add --help to see available flags")
}
if displayHelp == true {
fmt.Print(USAGE)
os.Exit(0)
}
if urlStr == "" {
return errors.New("Invalid flag supplied. Add --help to see available flags")
}
return nil
}
func makeRequest(u *url.URL) (string, int) {
conn, err := tls.DialWithDialer(&dialer, "tcp", fmt.Sprintf("%s:https", u.Hostname()), nil)
checkError(err)
reqHeader := fmt.Sprintf(HEADER, u.Path, u.Hostname())
defer conn.Close()
_, err = conn.Write([]byte(reqHeader))
checkError(err)
res, err := ioutil.ReadAll(conn)
checkError(err)
resStr := string(res)
status, _ := strconv.Atoi(strings.Split(resStr, " ")[1])
return resStr, status
}
func profile(url *url.URL, profileCount int) {
var times []int
var errors []int
maxSize := float64(0)
minSize := math.MaxFloat64
totalTime := 0
for i := 1; i <= profileCount; i++ {
startTime := time.Now()
res, status := makeRequest(url)
resTime := int(time.Since(startTime).Milliseconds())
resSize := float64(len(res))
totalTime += resTime
times = append(times, resTime)
if status != 200 {
errors = append(errors, status)
}
minSize = math.Min(minSize, resSize)
maxSize = math.Max(maxSize, resSize)
}
sort.Ints(times)
median := times[profileCount/2]
if len(times)%2 == 0 {
median = (times[profileCount/2] + times[profileCount/2-1]) / 2
} else {
median = times[profileCount/2]
}
meanTime := int(float64(totalTime) / float64(profileCount))
successPercentage := (float64(profileCount) - float64(len(errors))) / float64(profileCount) * 100
fmt.Println("Profile information for: ", strings.ToLower(url.Hostname()))
fmt.Println("Number of requests: ", profileCount)
fmt.Println("The fastest time (ms): ", times[0])
fmt.Println("The slowest time (ms): ", times[profileCount-1])
fmt.Println("The mean time (ms): ", meanTime)
fmt.Println("The median time (ms): ", median)
fmt.Println("The percentage of requests that succeeded: ", successPercentage, "%")
fmt.Println("The error codes returned that weren't a success: ", errors)
fmt.Println("The size in bytes of the smallest response: ", int(minSize))
fmt.Println("The size in bytes of the largest response: ", int(maxSize))
}
func main() {
helpPtr := flag.Bool("help", false, "Help command")
urlPtr := flag.String("url", "", "URL")
profilePtr := flag.Int("profile", -1, "URL")
flag.Parse()
err := validate(*helpPtr, *urlPtr, *profilePtr)
checkError(err)
urlStr := *urlPtr
if urlStr[:4] != "http" {
urlStr = "https://" + urlStr
}
url, err := url.Parse(urlStr)
checkError(err)
if url.Path == "" {
url.Path = "/"
}
if *profilePtr <= 0 {
res, _ := makeRequest(url)
fmt.Println(res)
} else {
profile(url, *profilePtr)
}
}
|
<gh_stars>1-10
package ast
// Ident node represents a identifier.
type Ident struct {
NamePos int
Name string
}
// NewIdent returns a new ident node.
func NewIdent(namePos int, name string) *Ident {
return &Ident{
NamePos: namePos,
Name: name,
}
}
// Pos implementations for expression nodes.
func (e *Ident) Pos() int { return e.NamePos }
// End implementations for expression nodes.
func (e *Ident) End() int { return e.NamePos + len(e.Name) }
func (*Ident) exprNode() {}
|
package sdk
import (
"context"
"github.com/ethereum/go-ethereum/core/types"
"testing"
"time"
)
func TestMockBackend_SubscribeNewTransaction(t *testing.T) {
backend := NewMockBackend()
ch := make(chan *types.Transaction, 1)
sub := backend.SubscribeNewTransaction(ch)
defer sub.Unsubscribe()
sdk := NewSDKWithBackend(backend)
admin, _ := retrieveAccount(PredefinedPrivateKeys[0])
_, _ = sdk.DeployManager(context.Background(), admin)
select {
case <-ch:
case <-time.After(time.Second):
t.Fatal("transaction is not fed")
}
}
func TestMockEthereum_MineWhenTx(t *testing.T) {
eth := NewMockEthereum()
eth.Start()
sdk := NewSDKWithBackend(eth.Backend)
admin, _ := retrieveAccount(PredefinedPrivateKeys[0])
_, err := sdk.DeployManagerSync(context.Background(), admin)
if err != nil {
t.Fatal(err)
}
_, err = sdk.DeployManagerSync(context.Background(), admin)
if err != nil {
t.Fatal(err)
}
addr, err := sdk.DeployManagerSync(context.Background(), admin)
if err != nil {
t.Fatal(err)
}
_, err = sdk.DeployManagerSync(context.Background(), admin)
if err != nil {
t.Fatal(err)
}
time.Sleep(200 * time.Millisecond)
eth.Stop()
currentHead, err := eth.Backend.HeaderByNumber(context.Background(), nil)
if err != nil {
t.Fatal(err)
}
eth.Backend.Commit()
code, err := eth.Backend.CodeAt(context.Background(), addr.address(), currentHead.Number)
if err != nil {
t.Fatal(err)
}
if len(code) == 0 {
t.Fatal("deploy reverted")
}
}
|
def run_and_verify_status_xml(expected_entries = [],
*args):
exit_code, output, errput = run_and_verify_svn(None, None, [],
'status', '--xml', *args)
if len(errput) > 0:
raise Failure
doc = parseString(''.join(output))
entries = doc.getElementsByTagName('entry')
def getText(nodelist):
rc = []
for node in nodelist:
if node.nodeType == node.TEXT_NODE:
rc.append(node.data)
return ''.join(rc)
actual_entries = {}
for entry in entries:
wcstatus = entry.getElementsByTagName('wc-status')[0]
commit = entry.getElementsByTagName('commit')
author = entry.getElementsByTagName('author')
rstatus = entry.getElementsByTagName('repos-status')
actual_entry = {'wcprops' : wcstatus.getAttribute('props'),
'wcitem' : wcstatus.getAttribute('item'),
}
if wcstatus.hasAttribute('revision'):
actual_entry['wcrev'] = wcstatus.getAttribute('revision')
if (commit):
actual_entry['crev'] = commit[0].getAttribute('revision')
if (author):
actual_entry['author'] = getText(author[0].childNodes)
if (rstatus):
actual_entry['rprops'] = rstatus[0].getAttribute('props')
actual_entry['ritem'] = rstatus[0].getAttribute('item')
actual_entries[entry.getAttribute('path')] = actual_entry
if expected_entries != actual_entries:
raise Failure('\n' + '\n'.join(difflib.ndiff(
pprint.pformat(expected_entries).splitlines(),
pprint.pformat(actual_entries).splitlines())))
|
// returns URL for pending shell view iff there is one and there is NOT an
// active view. result returned in VT_BSTR variant
HRESULT CIEFrameAuto::_QueryPendingUrl(VARIANT *pvarResult)
{
HRESULT hres = E_FAIL;
if (_psb)
{
IShellView *psv;
if (SUCCEEDED(_psb->QueryActiveShellView(&psv)))
{
SAFERELEASE(psv);
}
else
{
IOleCommandTarget *pct;
hres = ExecPending(_pmsc, IID_PPV_ARG(IOleCommandTarget, &pct), NULL);
if (SUCCEEDED(hres))
{
hres = pct->Exec(&CGID_ShellDocView, SHDVID_GETPENDINGURL, 0, NULL, pvarResult);
pct->Release();
}
}
}
return hres;
}
|
// Listen subscribes to the specified message type and calls the specified handler when fired
func (mm *MessageManager) Listen(messageType string, handler MessageHandler) MessageHandlerId {
mm.Lock()
defer mm.Unlock()
if mm.listeners == nil {
mm.listeners = make(map[string][]HandlerIDPair)
}
handlerID := getNewHandlerID()
newHandlerIDPair := HandlerIDPair{MessageHandlerId: handlerID, MessageHandler: handler}
mm.listeners[messageType] = append(mm.listeners[messageType], newHandlerIDPair)
return handlerID
}
|
/* =========================================================
* InvalidParameterException.java
*
* Author: <NAME>
* Created: Nov 13, 2007 4:30 PM
*
* Description
* --------------------------------------------------------
* This error is used to notify when an invalid parameter is passed.
*
* Change Log
* --------------------------------------------------------
* Init.Date Ref. Description
* --------------------------------------------------------
*
* =======================================================*/
package Goliath.Exceptions;
/**
* This error is used to notify when an invalid parameter was passed
* @version 1.0 Nov 13, 2007
* @author <NAME>
**/
public class InvalidParameterException extends Goliath.Exceptions.UncheckedException
{
private String m_cParameterName;
private Object m_oValue;
/**
* Creates a new instance of InvalidParameterException
* InvalidParameterException should be thrown whenever a call to a method occurs with an invalid parameter value
*
* @param tcMessage The message for the exception
* @param tcParameter The parameter name that was invalid
* @param toValue The invalid value
*/
public InvalidParameterException(String tcMessage, String tcParameter, java.lang.Object toValue)
{
super(tcMessage);
m_cParameterName = tcParameter;
m_oValue = toValue;
}
/**
* Creates a new instance of InvalidParameterException
* InvalidParameterException should be thrown whenever a call to a method occurs with an invalid parameter value
*
* @param tcMessage The message for the exception
* @param tcParameter The parameter name that was invalid
*/
public InvalidParameterException(String tcMessage, String tcParameter)
{
super(tcMessage);
m_cParameterName = tcParameter;
}
/**
* Creates a new instance of InvalidParameterException
* InvalidParameterException should be thrown whenever a call to a method occurs with an invalid parameter value
*
* @param tcParameter The parameter name that was invalid
*/
public InvalidParameterException(String tcParameter)
{
super(Goliath.Constants.Strings.AN_INVALID_PARAMETER_VALUE_WAS_PASSED.replaceAll(Goliath.Constants.ReplacementTokens.PARAMETER, tcParameter));
m_cParameterName = tcParameter;
}
/**
* Creates a new instance of InvalidParameterException
* InvalidParameterException should be thrown whenever a call to a method occurs with an invalid parameter value
*
* @param tcParameter The parameter name that was invalid
* @param toValue The invalid value
*/
public InvalidParameterException(String tcParameter, Object toValue)
{
super(Goliath.Constants.Strings.AN_INVALID_PARAMETER_VALUE_WAS_PASSED.replaceAll(Goliath.Constants.ReplacementTokens.PARAMETER, tcParameter));
m_oValue = toValue;
}
/**
* Gets the invalid parameter name if known
* @return the parameter that was invalid
*/
public String getParameter()
{
return m_cParameterName;
}
/**
* Gets the invalid value if known
* @return the value that was invalid
*/
public Object getValue()
{
return m_oValue;
}
}
|
package com.example.a68.listapplication;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.util.ArrayList;
import java.util.Arrays;
public class MainActivity extends AppCompatActivity implements AdapterView.OnItemLongClickListener{
private String[] ciudades = {"bogota", "cali", "medellin", "pasto"};
private ArrayList<String> cities;
private ArrayAdapter<String> arrayAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
cities = new ArrayList<String>(Arrays.asList(ciudades));
ListView listView = (ListView) findViewById(R.id.list);
arrayAdapter = new ArrayAdapter<String>
(this, android.R.layout.simple_list_item_1, cities);
arrayAdapter = new CustomArrayAdapter(this, cities);
listView.setAdapter(arrayAdapter);
listView.setOnItemLongClickListener(this);
RecyclerView mRecyclerView = (RecyclerView) findViewById(R.id.my_recycler_view);
mRecyclerView.setHasFixedSize(true);
LinearLayoutManager mLayoutManager = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(mLayoutManager);
CustomRecyclerView mAdapter = new CustomRecyclerView(cities);
mRecyclerView.setAdapter(mAdapter);
}
public void add(View view) {
cities.add("Manizales");
arrayAdapter.notifyDataSetChanged();
}
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
cities.remove(position);
arrayAdapter.notifyDataSetChanged();
return false;
}
}
|
<reponame>Luminoth/nature-of-code
//! Creature components
use bevy::prelude::*;
use bevy_inspector_egui::Inspectable;
use bevy_prototype_lyon::prelude::*;
use crate::bundles::creatures::*;
use crate::bundles::physics::*;
use crate::resources::*;
use super::particles::*;
use super::physics::*;
// TODO: move all of these constants to the simulation params
// except maybe the colors
// fly is much larger than an actual fly
// so that they're actually visible
const FLY_COLOR: Color = Color::WHITE;
pub const FIREFLY_COLOR: Color = Color::YELLOW_GREEN;
const FLY_MASS: f32 = 1.0;
const FLY_DRAG: f32 = 0.01;
pub const FLY_SIZE: f32 = 0.05 / FLY_MASS;
const FLY_REPEL_ACCEL: f32 = 0.01;
const FLY_ACCEL: f32 = 5.0;
const FISH_BODY_COLOR: Color = Color::SILVER;
const FISH_HEAD_COLOR: Color = Color::SALMON;
const FISH_MASS: f32 = 15.0;
const FISH_DRAG: f32 = 0.03;
pub const FISH_WIDTH: f32 = 0.3 / FISH_MASS;
pub const FISH_LENGTH: f32 = 0.6 / FISH_MASS;
const FISH_REPEL_ACCEL: f32 = 0.01;
const FISH_ACCEL: f32 = 1.0;
const SNAKE_BODY_COLOR: Color = Color::MAROON;
const SNAKE_HEAD_COLOR: Color = Color::ORANGE_RED;
const SNAKE_MASS: f32 = 2.0;
const SNAKE_DRAG: f32 = 0.04;
pub const SNAKE_WIDTH: f32 = 0.1 / SNAKE_MASS;
pub const SNAKE_LENGTH: f32 = 0.8 / SNAKE_MASS;
const SNAKE_REPEL_ACCEL: f32 = 0.01;
const SNAKE_GROUND_ACCEL: f32 = 8.0;
//const SNAKE_WATER_ACCEL: f32 = 1.0;
/// Shared creature component
#[derive(Debug, Default, Component, Inspectable)]
pub struct Creature {
#[inspectable(read_only)]
pub acceleration_direction: Vec2,
}
/// Flies fly
#[derive(Debug, Default, Component, Inspectable)]
pub struct Fly {
pub acceleration: f32,
pub repel_acceleration: f32,
}
impl Fly {
fn firefly_particles(random: &mut Random, color: Color) -> ParticleSystem {
// TODO: we can calculate the required capacity
// from the spawn rate and lifespan
let mut particles = ParticleSystem::with_capacity("Firefly", color, 20);
particles.spawn_rate = 0.05;
particles.particle_lifespan = 0.5;
particles.max_speed = random.normal(0.5, 0.1);
particles.size = Vec2::splat(0.05);
particles
}
/// Spawn a fly
#[allow(dead_code)]
pub fn spawn(
commands: &mut Commands,
random: &mut Random,
i: usize,
position: Vec2,
color: Color,
) {
let is_firefly = random.coin();
if is_firefly {
info!("spawning firefly {} at {}", i, position);
} else {
info!("spawning fly {} at {}", i, position);
}
let mass = FLY_MASS; // TODO: modifier
let size = Vec2::new(FLY_SIZE, FLY_SIZE) * mass;
let mut bundle = commands.spawn_bundle(FlyBundle {
fly: Fly {
acceleration: FLY_ACCEL,
repel_acceleration: FLY_REPEL_ACCEL,
},
creature: Creature::default(),
physical: PhysicsBundle::new_dynamic(position.extend(40.0), size, mass, FLY_DRAG),
});
bundle.with_children(|parent| {
parent
.spawn_bundle(GeometryBuilder::build_as(
&shapes::Ellipse {
radii: size * 0.5,
..Default::default()
},
DrawMode::Fill(FillMode {
color: if is_firefly { FIREFLY_COLOR } else { FLY_COLOR },
options: FillOptions::default(),
}),
Transform::default(),
))
.insert(Name::new("Model"))
.insert(Oscillator {
angle: Vec2::new(random.random_range(0.0..2.0 * std::f32::consts::PI), 0.0),
velocity: Vec2::new(10.0, 0.0),
amplitude: Vec2::new(0.1, 0.0),
});
});
if is_firefly {
bundle
.insert(Name::new(format!("Firefly {}", i)))
.with_children(|parent| {
parent
.spawn_bundle(FireflyBundle {
particles: Self::firefly_particles(random, color),
..Default::default()
})
.insert(Name::new("Particles"));
});
} else {
bundle.insert(Name::new(format!("Fly {}", i)));
}
}
}
/// Fireflies fly... and glow
#[derive(Debug, Default, Component, Inspectable)]
pub struct Firefly;
/// Fish swim
#[derive(Debug, Default, Component, Inspectable)]
pub struct Fish {
pub acceleration: f32,
pub repel_acceleration: f32,
}
impl Fish {
pub fn particles(random: &mut Random, color: Color) -> ParticleSystem {
// TODO: we can calculate the required capacity
// from the spawn rate and lifespan
let mut particles = ParticleSystem::with_capacity("Fish", color, 20);
particles.spawn_rate = 0.05;
particles.particle_lifespan = 0.5;
particles.max_speed = random.normal(0.3, 0.1);
particles
}
/// Spawn a fish
#[allow(dead_code)]
pub fn spawn(
commands: &mut Commands,
random: &mut Random,
i: usize,
position: Vec2,
color: Color,
) {
info!("spawning fish {} at {}", i, position);
let mass = FISH_MASS; // TODO: modifier
let size = Vec2::new(FISH_WIDTH, FISH_LENGTH) * mass;
let head_size = Vec2::new(size.x * 0.5, size.y * 0.25);
commands
.spawn_bundle(FishBundle {
fish: Fish {
acceleration: FISH_ACCEL,
repel_acceleration: FISH_REPEL_ACCEL,
},
creature: Creature::default(),
physical: PhysicsBundle::new_dynamic(position.extend(0.0), size, mass, FISH_DRAG),
})
.insert(Name::new(format!("Fish {}", i)))
.with_children(|parent| {
parent
.spawn_bundle(GeometryBuilder::build_as(
&shapes::Ellipse {
radii: size * 0.5,
..Default::default()
},
DrawMode::Fill(FillMode {
color: FISH_BODY_COLOR,
options: FillOptions::default(),
}),
Transform::default(),
))
.insert(Name::new("Model"))
.with_children(|parent| {
parent
.spawn_bundle(GeometryBuilder::build_as(
&shapes::Ellipse {
radii: head_size * 0.5,
..Default::default()
},
DrawMode::Fill(FillMode {
color: FISH_HEAD_COLOR,
options: FillOptions::default(),
}),
Transform::from_translation(Vec3::new(
0.0,
size.y * 0.5 - head_size.y * 0.5,
1.0,
)),
))
.insert(Name::new("Head"));
})
.insert(Oscillator {
angle: Vec2::new(random.random_range(0.0..2.0 * std::f32::consts::PI), 0.0),
velocity: Vec2::new(20.0, 0.0),
amplitude: Vec2::new(0.1, 0.0),
});
parent
.spawn_bundle(FishParticlesBundle {
particles: Self::particles(random, color),
transform: Transform::from_translation(Vec3::new(0.0, -size.y * 0.5, 1.0)),
..Default::default()
})
.insert(Name::new("Particles"));
});
}
}
/// Snakes snek
#[derive(Debug, Default, Component, Inspectable)]
pub struct Snake {
pub ground_acceleration: f32,
pub repel_acceleration: f32,
}
impl Snake {
/// Spawn a snake
#[allow(dead_code)]
pub fn spawn(commands: &mut Commands, random: &mut Random, i: usize, position: Vec2) {
info!("spawning snake {} at {}", i, position);
let mass = SNAKE_MASS; // TODO: modifier
let size = Vec2::new(SNAKE_WIDTH, SNAKE_LENGTH) * mass;
let head_size = Vec2::splat(size.x * 0.5);
commands
.spawn_bundle(SnakeBundle {
snake: Snake {
ground_acceleration: SNAKE_GROUND_ACCEL,
repel_acceleration: SNAKE_REPEL_ACCEL,
},
creature: Creature::default(),
physical: PhysicsBundle::new_dynamic(position.extend(20.0), size, mass, SNAKE_DRAG),
})
.insert(Name::new(format!("Snake {}", i)))
.with_children(|parent| {
parent
.spawn_bundle(GeometryBuilder::build_as(
&shapes::Ellipse {
radii: size * 0.5,
..Default::default()
},
DrawMode::Fill(FillMode {
color: SNAKE_BODY_COLOR,
options: FillOptions::default(),
}),
Transform::default(),
))
.insert(Name::new("Model"))
.with_children(|parent| {
parent
.spawn_bundle(GeometryBuilder::build_as(
&shapes::Ellipse {
radii: head_size * 0.5,
..Default::default()
},
DrawMode::Fill(FillMode {
color: SNAKE_HEAD_COLOR,
options: FillOptions::default(),
}),
Transform::from_translation(Vec3::new(
0.0,
size.y * 0.5 - head_size.y * 0.5,
1.0,
)),
))
.insert(Name::new("Head"));
})
.insert(Oscillator {
angle: Vec2::new(random.random_range(0.0..2.0 * std::f32::consts::PI), 0.0),
velocity: Vec2::new(30.0, 0.0),
amplitude: Vec2::new(0.1, 0.0),
});
});
}
}
|
<filename>returns/_generated/pipe.py
# -*- coding: utf-8 -*-
from functools import reduce
from returns.functions import compose
def _pipe(*functions):
"""
Allows to compose a value and up to 7 functions that use this value.
Each next function uses the previos result as an input parameter.
Here's how it should be used:
.. code:: python
>>> from returns.pipeline import pipe
# => executes: str(float(int('1')))
>>> pipe(int, float, str)('1')
'1.0'
See also:
- https://stackoverflow.com/a/41585450/4842742
- https://github.com/gcanti/fp-ts/blob/master/src/pipeable.ts
"""
return lambda initial: reduce(compose, functions)(initial)
|
activate_mse = 1
activate_adaptation_imp = 1
activate_adaptation_d1 = 1
weight_d2 = 1.0
weight_mse = 1.0
refinement = 1
n_epochs_refinement = 10
lambda_regul = [0.01]
lambda_regul_s = [0.01]
threshold_value = [0.95]
compute_variance = False
random_seed = [1985] if not compute_variance else [1985, 2184, 51, 12, 465]
class DannMNISTUSPS(object):
MAX_NB_PROCESSES = 3
DEBUG = False
BINARY = "experiments/launcher/digits_binary.py"
GRID = {
"-mode": ["dann"],
"-upper_bound": [1],
"-adaptive_lr": [1],
"-is_balanced": [1],
"-source": ["MNIST"],
"-target": ["USPS"],
"-epoch_to_start_align": [11],
"-n_epochs": [100],
"-batch_size": [128],
"-initialize_model": [1],
"-init_batch_size": [32],
"-refinement": [refinement],
"-n_epochs_refinement": [n_epochs_refinement],
"-lambda_regul": lambda_regul,
"-lambda_regul_s": lambda_regul_s,
"-threshold_value": threshold_value,
"-random_seed": random_seed
}
class DannIgnoreMNISTUSPS(object):
MAX_NB_PROCESSES = 3
DEBUG = False
BINARY = "experiments/launcher/digits_binary.py"
GRID = {
"-mode": ["dann"],
"-upper_bound": [1],
"-adaptive_lr": [1],
"-is_balanced": [1],
"-source": ["MNIST"],
"-target": ["USPS"],
"-epoch_to_start_align": [11],
"-n_epochs": [100],
"-batch_size": [128],
"-initialize_model": [1],
"-init_batch_size": [32],
"-adapt_only_first": [1],
"-refinement": [refinement],
"-n_epochs_refinement": [n_epochs_refinement],
"-lambda_regul": lambda_regul,
"-threshold_value": threshold_value,
"-random_seed": random_seed
}
class DannZeroImputMNISTUSPS(object):
MAX_NB_PROCESSES = 3
DEBUG = False
BINARY = "experiments/launcher/digits_binary.py"
GRID = {
"-mode": ["dann"],
"-upper_bound": [0],
"-adaptive_lr": [1],
"-is_balanced": [1],
"-source": ["MNIST"],
"-target": ["USPS"],
"-epoch_to_start_align": [11],
"-n_epochs": [100],
"-batch_size": [128],
"-initialize_model": [1],
"-init_batch_size": [32],
"-init_lr": [10 ** -2.5],
"-refinement": [refinement],
"-n_epochs_refinement": [n_epochs_refinement],
"-lambda_regul": lambda_regul,
"-threshold_value": threshold_value,
"-random_seed": random_seed
}
class DannImputMNISTUSPS(object):
MAX_NB_PROCESSES = 2
DEBUG = False
BINARY = "experiments/launcher/digits_binary.py"
GRID = {
"-mode": ["dann_imput"],
"-adaptive_lr": [1],
"-is_balanced": [1],
"-source": ["MNIST"],
"-target": ["USPS"],
"-epoch_to_start_align": [11],
"-stop_grad": [0],
"-n_epochs": [100],
"-batch_size": [128],
"-initialize_model": [1],
"-init_batch_size": [32],
"-weight_d2": [weight_d2],
"-weight_mse": [weight_mse],
"-activate_mse": [activate_mse],
"-activate_adaptation_imp": [activate_adaptation_imp],
"-activate_adaptation_d1": [activate_adaptation_d1],
"-init_lr": [10 ** -2],
"-refinement": [refinement],
"-n_epochs_refinement": [n_epochs_refinement],
"-lambda_regul": lambda_regul,
"-lambda_regul_s": lambda_regul_s,
"-threshold_value": threshold_value,
"-random_seed": random_seed
}
class DjdotMNISTUSPS(object):
MAX_NB_PROCESSES = 2
DEBUG = False
BINARY = "experiments/launcher/digits_binary.py"
GRID = {
"-mode": ["djdot"],
"-upper_bound": [1],
"-is_balanced": [1],
"-djdot_alpha": [0.1],
"-adaptive_lr": [1],
"-source": ["MNIST"],
"-target": ["USPS"],
"-epoch_to_start_align": [11],
"-n_epochs": [100],
"-batch_size": [500],
"-initialize_model": [1],
"-init_batch_size": [32],
"-init_lr": [10 ** -2],
"-random_seed": random_seed
}
class DjdotIgnoreMNISTUSPS(object):
MAX_NB_PROCESSES = 2
DEBUG = False
BINARY = "experiments/launcher/digits_binary.py"
GRID = {
"-mode": ["djdot"],
"-upper_bound": [1],
"-is_balanced": [1],
"-djdot_alpha": [0.1],
"-adaptive_lr": [1],
"-source": ["MNIST"],
"-target": ["USPS"],
"-epoch_to_start_align": [11],
"-n_epochs": [100],
"-batch_size": [500],
"-initialize_model": [1],
"-output_fig": [1],
"-init_batch_size": [32],
"-init_lr": [10 ** -2],
"-adapt_only_first": [1],
"-random_seed": random_seed
}
class DjdotZeroImputMNISTUSPS(object):
MAX_NB_PROCESSES = 2
DEBUG = False
BINARY = "experiments/launcher/digits_binary.py"
GRID = {
"-mode": ["djdot"],
"-upper_bound": [0],
"-adaptive_lr": [1],
"-is_balanced": [1],
"-djdot_alpha": [0.1],
"-source": ["MNIST"],
"-target": ["USPS"],
"-epoch_to_start_align": [11],
"-n_epochs": [100],
"-batch_size": [500],
"-initialize_model": [1],
"-init_batch_size": [32],
"-init_lr": [10 ** -2],
"-random_seed": random_seed
}
class DjdotImputMNISTUSPS(object):
MAX_NB_PROCESSES = 2
DEBUG = False
BINARY = "experiments/launcher/digits_binary.py"
GRID = {
"-mode": ["djdot_imput"],
"-adaptive_lr": [1],
"-source": ["MNIST"],
"-target": ["USPS"],
"-is_balanced": [1],
"-epoch_to_start_align": [11],
"-stop_grad": [1],
"-djdot_alpha": [0.1],
"-bigger_reconstructor": [1],
"-n_epochs": [100],
"-batch_size": [500],
"-initialize_model": [1],
"-init_batch_size": [32],
"-init_lr": [10 ** -2],
"-activate_mse": [activate_mse],
"-activate_adaptation_imp": [activate_adaptation_imp],
"-activate_adaptation_d1": [activate_adaptation_d1],
"-random_seed": random_seed
}
|
package io.nutz.nutzsite.module.open.api;
import io.nutz.nutzsite.common.wxpay.util.WXPayUtil;
import io.nutz.nutzsite.common.wxpay.util.WebChatUtil;
import io.swagger.annotations.Api;
import org.dom4j.DocumentException;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.POST;
import org.nutz.mvc.annotation.Param;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;
/**
* 微信小程序 操作处理
*
* @author yuhaiming
* @date 2018-12-05
*/
@Api("微信小程序")
@IocBean
@At("/open/weixin")
public class OpenWeixinController {
/**
* 日志对象
*/
protected Logger log = LoggerFactory.getLogger(getClass());
/**
* 开发者接入验证 确认请求来自微信服务器
*
* @param signature 微信加密签名
* @param timestamp 时间戳
* @param nonce 随机数
* @param echostr 成为开发者验证
* @param request
* @param response
* @throws IOException
*/
@At
public void get( @Param("signature") String signature,
@Param("timestamp") String timestamp,
@Param("nonce") String nonce,
@Param( "echostr") String echostr,
HttpServletRequest request,
HttpServletResponse response) throws IOException {
//消息来源可靠性验证
//确认此次GET请求来自微信服务器,原样返回echostr参数内容,则接入生效,成为开发者成功,否则接入失败
PrintWriter out = response.getWriter();
if (WebChatUtil.checkSignature(signature, timestamp, nonce)) {
System.out.println("=======请求校验成功======" + echostr);
out.print(echostr);
}
out.close();
out = null;
}
/**
* 带参数的二维码 事件处理
* @param body XML信息
* @param request
* @param response
*/
@At
@POST
public void post(@Param("body") String body, HttpServletRequest request, HttpServletResponse response) {
//设置回复内容编码方式为UTF-8,防止乱码
System.out.println("================================微信URL回调测试=========================");
System.out.println(body);
response.setCharacterEncoding("utf-8");
//从工具类中获取XML解析之后的map
try (PrintWriter out = response.getWriter() ) {
Map<String, String> map = WXPayUtil.xmlToMap(body);
//获取发送方账号
String fromUserName = map.get("FromUserName");
//接收方账号(开发者微信号)
String toUserName = map.get("ToUserName");
//消息类型
String msgType = map.get("MsgType");
//文本内容
String content = map.get("Content");
String event = map.get("Event");
String eventKey =map.get("EventKey");
log.info("发送方账号:" + fromUserName + ",接收方账号(开发者微信号):" + toUserName + ",消息类型:" + msgType + ",文本内容:" + content);
//回复消息
if ("event".equals(msgType)) {
//根据开发文档要求构造XML字符串,本文为了让流程更加清晰,直接拼接
//这里在开发的时候可以优化,将回复的文本内容构造成一个java类
//然后使用XStream(com.thoughtworks.xstream.XStream)将java类转换成XML字符串,后面将会使用这个方法。
//而且由于参数中没有任何特殊字符,为简单起见,没有添加<![CDATA[xxxxx]]>
if("CLICK".equals(event)){
String replyMsg = "<xml>" +
"<ToUserName>" + fromUserName + "</ToUserName>" +
"<FromUserName>" + toUserName + "</FromUserName>" +
"<CreateTime>" + System.currentTimeMillis() / 1000 + "</CreateTime>" +
"<MsgType><![CDATA[text]]></MsgType><Content><![CDATA["+ eventKey +"]]></Content>" +
"</xml>";
//响应消息
log.info("响应消息:" + replyMsg);
//我们这里将用户发送的消息原样返回
out.print(replyMsg);
log.info("==============响应成功==================");
}
}
} catch (IOException e) {
log.error("获取输入流失败", e);
} catch (DocumentException e) {
log.error("读取XML失败", e);
} catch (Exception e) {
e.printStackTrace();
}
}
}
|
<gh_stars>0
package yhao.micro.service.workflow.apilist.model.approve;
import io.swagger.annotations.ApiModelProperty;
import yhao.infra.common.model.Entity;
import yhao.micro.service.workflow.apilist.model.flow.FlowProcessDefinitionModel;
import yhao.micro.service.workflow.apilist.model.task.TaskNodeModel;
import java.util.List;
/**
* @Description: 所有任务的处理进度信息
* @Created by ql on 2018/12/16 18:34
* @Version: v1.0
*/
public class TaskInfoModel extends Entity<String> {
@ApiModelProperty(value = "当前节点ID")
private String currentNodeId;
@ApiModelProperty(value = "流程定义信息")
private FlowProcessDefinitionModel flowProcessDefinitionModel;
@ApiModelProperty(value = "当前任务所有节点信息")
private List<TaskNodeModel> taskNodeModelList;
public String getCurrentNodeId() {
return currentNodeId;
}
public void setCurrentNodeId(String currentNodeId) {
this.currentNodeId = currentNodeId;
}
public FlowProcessDefinitionModel getFlowProcessDefinitionModel() {
return flowProcessDefinitionModel;
}
public void setFlowProcessDefinitionModel(FlowProcessDefinitionModel flowProcessDefinitionModel) {
this.flowProcessDefinitionModel = flowProcessDefinitionModel;
}
public List<TaskNodeModel> getTaskNodeModelList() {
return taskNodeModelList;
}
public void setTaskNodeModelList(List<TaskNodeModel> taskNodeModelList) {
this.taskNodeModelList = taskNodeModelList;
}
}
|
#include <stdio.h>
#include <stdlib.h>
// variable is place holders FOR SOMETHING ELSE ( IS THAT SIMPLE ! YES IT IS. :) )
// in more technical language it is memory location OF bunch of data-types where actual data is stored.
// RULES
// you have to start variable name with UPPERCASE or LOWERCASE , no NUMBERS first.
// NO SPACING
// NO SYMBOLS OTHER THAN UNDERSCORES
// Don't name a variable any name of functions
int main()
{
//specify what kind of data you want to store in ( integer , float , strings )
int age;
// assign value ( = ) is use for assign values
age=21;// you can also do mathematical operations here (try "age=2018-1998")
printf("Dhruv is %d years old",age);
//here age is variable , so it is not in between quotations.
// Now you know what6 we do with converging characters.
return 0;
}
|
The benefits of the 5-week Table Stars @school program as part of physical education in primary schools – A pilot intervention study
The Table Stars @school program was launched in 2010 to serve as a first introduction to table tennis in primary school children. The main aims of this pilot intervention study were 1. to evaluate the effect of Table Stars @school on the perceptuo-motor skills and selective attention in primary school children in comparison to regular physical education and 2. to find out how many and which children benefited more from Table Stars @school compared to regular physical education. A pilot intervention study was carried out including 177 children between 6 to 12 years from two regular primary schools. All children were tested by means of four perceptuo-motor tests (static balance, walking backwards, speed while dribbling, eye hand coordination) and a selective attention task (map mission). Both schools were exposed to both the Table Stars @school program and regular physical education in a different order. The results revealed no differences between the regular physical education classes and the Table Stars @school program on group level. However, both interventions showed different responders. Consequently, Table Stars @school seems to fit in as it meets the level of improvement of regular physical education classes and it can be of added value by addressing other children to improve perceptuo-motor skills and selective attention. Nevertheless, intensifying the program and/or integrating it into regular physical education is recommended to increase the effects and better add to the broader development of children.
|
<reponame>MaxAtslega/magic-home-desktop
import React, { Component } from 'react'
import { Container, DeviceName, ModelName, ControlItems, ControlItem } from './Device.styles'
import { BiRocket } from 'react-icons/bi'
import { FiPower } from 'react-icons/Fi'
interface Props {
currentDeviceColor: string;
name: string;
model: string;
online: boolean;
}
export default class Device extends Component<Props> {
constructor (props: Props) {
super(props)
}
render () {
return (
<Container colorBorder={this.props.online ? this.props.currentDeviceColor : '#E3E5E8'}>
<DeviceName>{this.props.name}</DeviceName>
<ModelName>{this.props.model}</ModelName>
<ControlItems>
{this.props.online ? <ControlItem colorItem={'#130f40'}><BiRocket/></ControlItem> : null}
<ControlItem colorItem={this.props.online ? '#44bd32' : '#ff0000'}><FiPower/></ControlItem>
</ControlItems>
</Container>
)
}
}
|
import { filter } from 'fuzzaldrin-plus';
import { isEqual } from 'lodash';
import React, {
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from 'react';
import {
createFixtureTree,
FlatFixtureTreeItem,
flattenFixtureTree,
} from 'react-cosmos-shared2/fixtureTree';
import { FixtureId, FixtureList } from 'react-cosmos-shared2/renderer';
import {
black60,
grey128,
grey160,
grey176,
grey208,
grey224,
grey248,
grey64,
HelpCircleIcon,
quick,
SearchIcon,
} from 'react-cosmos-shared2/ui';
import styled from 'styled-components';
import {
KEY_DOWN,
KEY_ENTER,
KEY_ESC,
KEY_FWD_SLASH,
KEY_TAB,
KEY_UP,
} from '../../shared/keys';
import { FixtureSearchResult } from './FixtureSearchResult';
import { FixtureSearchShortcuts } from './FixtureSearchShortcuts';
type Props = {
searchText: string;
fixturesDir: string;
fixtureFileSuffix: string;
fixtures: FixtureList;
selectedFixtureId: null | FixtureId;
onSetSearchText: (searchText: string) => unknown;
onClose: () => unknown;
onSelect: (fixtureId: FixtureId, revealFixture: boolean) => unknown;
};
type ActiveFixturePath = null | string;
type FixtureItemsByPath = Record<string, FlatFixtureTreeItem>;
export function FixtureSearchOverlay({
searchText,
fixturesDir,
fixtureFileSuffix,
fixtures,
selectedFixtureId,
onSetSearchText,
onClose,
onSelect,
}: Props) {
// Fixture items are memoized purely to minimize computation
const fixtureItems = useMemo<FixtureItemsByPath>(() => {
const fixtureTree = createFixtureTree({
fixtures,
fixturesDir,
fixtureFileSuffix,
});
const flatFixtureTree = flattenFixtureTree(fixtureTree);
return flatFixtureTree.reduce((acc, item) => {
const cleanPath = [...item.parents, item.fileName];
if (item.name) cleanPath.push(item.name);
return { ...acc, [cleanPath.join(' ')]: item };
}, {});
}, [fixtures, fixturesDir, fixtureFileSuffix]);
const onInputChange = useCallback(
(e: React.ChangeEvent<HTMLInputElement>) => {
onSetSearchText(e.currentTarget.value);
},
[onSetSearchText]
);
const [matchingFixturePaths, setMatchingFixturePaths] = useState(
getMatchingFixturePaths(fixtureItems, searchText)
);
const [activeFixturePath, setActiveFixturePath] = useState<ActiveFixturePath>(
() => {
const selectedFixturePath =
selectedFixtureId && findFixturePath(fixtureItems, selectedFixtureId);
return selectedFixturePath || getFirstFixturePath(matchingFixturePaths);
}
);
useEffect(() => {
const newMatchingFixturePaths = getMatchingFixturePaths(
fixtureItems,
searchText
);
if (!isEqual(newMatchingFixturePaths, matchingFixturePaths)) {
setMatchingFixturePaths(newMatchingFixturePaths);
// Reset active fixture to first matching fixture when search changes
// WARNING: Putting this in a separate effect with only matchingFixturePaths
// as a dependency looks nicer, but creates a flicker between some renders.
// On searchText change, the component would first render a new list of
// matching fixture paths (which may or may not contain the activeFixturePath),
// and only in the (albeit almost instant) 2nd render would activeFixturePath
// be updated to equal the first of the new list of matching fixture paths.
setActiveFixturePath(getFirstFixturePath(newMatchingFixturePaths));
}
}, [fixtureItems, matchingFixturePaths, searchText]);
const onInputKeyDown = useMemo(() => {
function handleEscape() {
onClose();
}
function handleEnter() {
if (activeFixturePath !== null) {
const { fixtureId } = fixtureItems[activeFixturePath];
onSelect(fixtureId, true);
}
}
function handleUp() {
if (activeFixturePath) {
const fixtureIndex = matchingFixturePaths.indexOf(activeFixturePath);
if (fixtureIndex > 0) {
setActiveFixturePath(matchingFixturePaths[fixtureIndex - 1]);
}
}
}
function handleDown() {
if (activeFixturePath) {
const fixtureIndex = matchingFixturePaths.indexOf(activeFixturePath);
if (fixtureIndex < matchingFixturePaths.length - 1) {
setActiveFixturePath(matchingFixturePaths[fixtureIndex + 1]);
}
}
}
function handleTab() {
const matchingFixtureCount = matchingFixturePaths.length;
if (matchingFixtureCount > 0) {
if (!activeFixturePath) {
setActiveFixturePath(matchingFixturePaths[0]);
} else {
const fixtureIndex = matchingFixturePaths.indexOf(activeFixturePath);
const lastMatch = fixtureIndex === matchingFixtureCount - 1;
if (lastMatch) {
setActiveFixturePath(matchingFixturePaths[0]);
} else {
setActiveFixturePath(matchingFixturePaths[fixtureIndex + 1]);
}
}
}
}
function handleTabReverse() {
const matchingFixtureCount = matchingFixturePaths.length;
if (matchingFixtureCount > 0) {
if (!activeFixturePath) {
setActiveFixturePath(matchingFixturePaths[matchingFixtureCount - 1]);
} else {
const fixtureIndex = matchingFixturePaths.indexOf(activeFixturePath);
const lastMatch = fixtureIndex === 0;
if (lastMatch) {
setActiveFixturePath(
matchingFixturePaths[matchingFixtureCount - 1]
);
} else {
setActiveFixturePath(matchingFixturePaths[fixtureIndex - 1]);
}
}
}
}
function handleQuestionMark(e: React.KeyboardEvent) {
if (e.shiftKey) {
e.preventDefault();
setShowShortcuts(prev => !prev);
}
}
return (e: React.KeyboardEvent) => {
switch (e.keyCode) {
case KEY_ESC:
e.preventDefault();
return handleEscape();
case KEY_ENTER:
e.preventDefault();
return handleEnter();
case KEY_UP:
e.preventDefault();
return handleUp();
case KEY_DOWN:
e.preventDefault();
return handleDown();
case KEY_TAB:
e.preventDefault();
return e.shiftKey ? handleTabReverse() : handleTab();
case KEY_FWD_SLASH:
return handleQuestionMark(e);
default:
// Nada
}
};
}, [
onClose,
activeFixturePath,
fixtureItems,
onSelect,
matchingFixturePaths,
]);
const inputRef = useRef<HTMLInputElement>(null);
// Auto focus when search input is created
useEffect(() => {
if (inputRef.current) {
inputRef.current.focus();
inputRef.current.select();
}
}, []);
// 1. Prevent click propagation to overlay element (which calls onClose)
// 2. Keep user focused on search input while search is open
const onContentClick = useCallback((e: React.MouseEvent) => {
e.stopPropagation();
if (inputRef.current) {
inputRef.current.focus();
}
}, []);
const [showShortcuts, setShowShortcuts] = useState(false);
const handleToggleHelp = useCallback(() => {
setShowShortcuts(prev => !prev);
}, []);
return (
<OverlayIE11 data-testid="fixtureSearchOverlay" onClick={onClose}>
<Content data-testid="fixtureSearchContent" onClick={onContentClick}>
<InputContainer>
<SearchIconContainer>
<SearchIcon />
</SearchIconContainer>
<SearchInput
ref={inputRef}
type="text"
placeholder="Fixture search"
value={searchText}
onChange={onInputChange}
onKeyDown={onInputKeyDown}
/>
<HelpButton selected={showShortcuts} onClick={handleToggleHelp}>
<HelpCircleIcon />
</HelpButton>
</InputContainer>
<ShortcutsContainer visible={showShortcuts}>
<FixtureSearchShortcuts />
</ShortcutsContainer>
<ResultsViewport>
<ResultsContainer>
{matchingFixturePaths.map(cleanFixturePath => (
<FixtureSearchResult
key={cleanFixturePath}
cleanFixturePath={cleanFixturePath}
fixtureItem={fixtureItems[cleanFixturePath]}
active={cleanFixturePath === activeFixturePath}
onSelect={onSelect}
/>
))}
{matchingFixturePaths.length === 0 && (
<NoResults>No results</NoResults>
)}
</ResultsContainer>
</ResultsViewport>
</Content>
</OverlayIE11>
);
}
function findFixturePath(
fixtureItems: FixtureItemsByPath,
fixtureId: FixtureId
) {
const fixturePaths = Object.keys(fixtureItems);
return fixturePaths.find(fixturePath =>
isEqual(fixtureItems[fixturePath].fixtureId, fixtureId)
);
}
function getFirstFixturePath(fixturePaths: string[]): null | string {
return fixturePaths.length > 0 ? fixturePaths[0] : null;
}
function getMatchingFixturePaths(
fixtureItems: FixtureItemsByPath,
searchText: string
): string[] {
const fixturePaths = Object.keys(fixtureItems);
if (searchText === '') {
return fixturePaths;
}
const fixtureSearchTexts: string[] = [];
fixturePaths.forEach(cleanFixturePath => {
const { fixtureId, parents } = fixtureItems[cleanFixturePath];
const { path, name } = fixtureId;
// Allow fixtures to be searched by their entire file path, suffixed by
// their name in the case of named fixtures, as well as by parent path,
// allowing users to query results in the format they are displayed
const searchPath = [path];
if (name) searchPath.push(name);
searchPath.push(...parents);
fixtureSearchTexts.push(searchPath.join(' '));
});
const machingFixtureSearchTexts = filter(fixtureSearchTexts, searchText);
return machingFixtureSearchTexts.map(fixtureSearchText => {
const fixtureIndex = fixtureSearchTexts.indexOf(fixtureSearchText);
return fixturePaths[fixtureIndex];
});
}
const Overlay = styled.div`
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: ${black60};
`;
const OverlayIE11 = styled(Overlay)`
z-index: 10;
`;
const Content = styled.div`
position: absolute;
top: 20%;
left: 50%;
transform: translate(-50%, 0);
width: 80%;
max-width: 640px;
border-radius: 3px;
background: ${grey248};
box-shadow: rgba(15, 15, 15, 0.05) 0px 0px 0px 1px,
rgba(15, 15, 15, 0.1) 0px 5px 10px, rgba(15, 15, 15, 0.2) 0px 15px 40px;
display: flex;
flex-direction: column;
overflow: hidden;
`;
const InputContainer = styled.div`
flex-shrink: 0;
display: flex;
flex-direction: row;
align-items: center;
height: 48px;
padding: 0 12px;
user-select: none;
cursor: text;
`;
const SearchIconContainer = styled.div`
flex-shrink: 0;
width: 20px;
height: 20px;
margin: 2px 0 0 0;
padding: 0 10px 0 6px;
color: ${grey176};
`;
const SearchInput = styled.input`
flex: 1;
border: none;
background: transparent;
color: ${grey64};
outline: none;
font-size: 16px;
line-height: 32px;
::placeholder {
color: ${grey160};
}
`;
const HelpButton = styled.div<{ selected: boolean }>`
flex-shrink: 0;
width: 20px;
height: 20px;
margin: 2px 0 0 0;
padding: 6px;
border-radius: 50%;
background: ${props => (props.selected ? grey224 : 'transparent')};
color: ${props => (props.selected ? grey128 : grey176)};
cursor: pointer;
transition: background ${quick}s, color ${quick}s;
:hover {
color: ${grey128};
}
`;
const ShortcutsContainer = styled.div<{ visible: boolean }>`
height: ${props => (props.visible ? 72 : 0)}px;
overflow: hidden;
opacity: ${props => (props.visible ? 1 : 0)};
transition: height ${quick}s, opacity ${quick}s;
user-select: none;
`;
const ResultsViewport = styled.div`
max-height: 336px;
border-top: 1px solid ${grey208};
background: ${grey224};
overflow-x: hidden;
overflow-y: auto;
`;
const ResultsContainer = styled.div`
padding: 8px 0;
`;
const NoResults = styled.div`
padding: 0 24px 0 48px;
line-height: 32px;
font-size: 14px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
user-select: none;
color: ${grey128};
`;
|
<reponame>DiSiqueira/MySlackBotTwo<filename>pkg/plugins/wolfram/wolfram.go
package wolfram
import (
"fmt"
"github.com/disiqueira/MySlackBotTwo/pkg/bot"
"github.com/disiqueira/MySlackBotTwo/pkg/provider"
"strings"
)
const (
multivac = "INSUFFICIENT DATA FOR A MEANINGFUL ANSWER"
)
var (
api provider.Wolfram
)
func init() {
bot.RegisterCommand(
"wolfram",
"Answer any question in natural language",
"question",
wolfram)
}
func getProvider() provider.Wolfram {
if api == nil {
api = provider.NewWolfram(bot.Configs().WolframToken())
}
return api
}
func wolfram(command *bot.Cmd) (string, error) {
wolframAnswer, err := getProvider().Ask(command.RawArgs)
if err != nil {
return "",err
}
var plainTextList []string
for _, pod := range wolframAnswer.Queryresult.Pods {
plainTextList = filterAndAddToList(plainTextList,fmt.Sprintf("*%s:*", pod.Title))
for _, subPod := range pod.Subpods {
plainTextList = filterAndAddToList(plainTextList, fmt.Sprintf("*%s:*", subPod.Title))
plainTextList = filterAndAddToList(plainTextList, subPod.Plaintext)
}
}
if len(plainTextList) == 0 {
return multivac,nil
}
return strings.Join(plainTextList, "\n"), nil
}
func filterAndAddToList(list []string, item string) []string {
item = strings.Replace(item, "|", ":", -1)
item = strings.TrimSpace(item)
if item != "" && len(item) > 3 {
return append(list, item)
}
return list
}
|
/*
* Copyright 2020 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.diffplug.gradle;
import com.diffplug.common.base.Errors;
import com.diffplug.common.base.StandardSystemProperty;
import com.diffplug.gradle.p2.P2Model;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.File;
import java.lang.reflect.Field;
import java.nio.file.Path;
import java.util.Optional;
import org.gradle.api.Project;
/**
* There are a few things which goomph
* needs to cache on the developer's machine.
* They are described exhaustively by this
* class.
*
* - {@link #p2bootstrap()}
* - {@link #pdeBootstrap()}
* - {@link #pdeBootstrapUrl()}
* - {@link #bundlePool()}
* - {@link #workspaces()}
*
* All these values can be overridden either by setting the
* value of the `public static override_whatever` variable.
*
* If your gradle build is split across multiple files using
* `apply from:`, then these static variables will get wiped
* out. You can fix this by setting a project property
* as such: `project.ext.goomph_override_whatever=something`
*/
@SuppressFBWarnings("MS_SHOULD_BE_FINAL")
public class GoomphCacheLocations {
private static final String ROOT = ".goomph";
/** Initializes overrides based on project properties named "goomph_override_whatever" */
public static void initFromProject(Project project) {
for (Field field : GoomphCacheLocations.class.getFields()) {
Object value = project.getProperties().get("goomph_" + field.getName());
if (value != null) {
Errors.rethrow().run(() -> field.set(null, value));
}
}
}
/**
* {@link com.diffplug.gradle.eclipse.MavenCentralMapping} needs to look at p2 metadata
* to know what the version numbers are for the specific
* bundles of a given eclipse release are.
*
* Rather than downloading this metadata over and over, we only
* download it once, and cache the results here.
*/
public static File eclipseReleaseMetadata() {
return defOverride(ROOT + "/eclipse-release-metadata", override_eclipseReleaseMetadata);
}
public static File override_eclipseReleaseMetadata = null;
/**
* When Goomph creates an IDE for you, it must
* also create an eclipse workspace. Unfortunately,
* that workspace cannot be a subdirectory of the
* project directory (an eclipse limitation). This is a
* problem for single-project builds.
*
* As a workaround, we put all eclipse workspaces in a central
* location, which is tied to their project directory. Whenever
* a new workspace is created, we do a quick check to make there
* aren't any stale workspaces. If the workspace has gone stale,
* we delete it.
*/
public static File workspaces() {
return defOverride(ROOT + "/ide-workspaces", override_workspaces);
}
public static File override_workspaces = null;
/**
* Location where the p2-bootstrap application should be downloaded from.
*
* Goomph's p2 tasks rely on the eclipse [p2 director application](https://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fp2_director.html&cp=2_0_20_2).
* It is distributed within the Eclipse SDK. But rather
* than requiring the entire SDK, we have packaged just
* the jars required for p2 director into a ~7MB download
* available on bintray as [goomph-p2-bootstrap](https://bintray.com/diffplug/opensource/goomph-p2-bootstrap/view).
*
* This only gets downloaded if you use {@link P2Model}.
*
* Defaults to `https://dl.bintray.com/diffplug/opensource/com/diffplug/gradle/goomph-p2-bootstrap/`. If you override, it still
* needs to follow the correct versioning scheme. e.g. if you want to relocate to `https://intranet/goomph-p2-boostrap`, then
* the artifact will need to be available at `https://intranet/goomph-p2-boostrap/4.5.2/goomph-p2-bootstrap.zip`
*
* As new versions of p2bootstrap come out, you will have to update your internal URL cache, but these releases are infrequent.
*/
public static Optional<String> p2bootstrapUrl() {
return Optional.ofNullable(override_p2bootstrapUrl);
}
public static String override_p2bootstrapUrl = null;
/**
* Location where the p2-bootstrap application
* is cached: `~/.goomph/p2-bootstrap`.
*
* Goomph's p2 tasks rely on the eclipse [p2 director application](https://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fp2_director.html&cp=2_0_20_2).
* It is distributed within the Eclipse SDK. But rather
* than requiring the entire SDK, we have packaged just
* the jars required for p2 director into a ~7MB download
* available on bintray as [goomph-p2-bootstrap](https://bintray.com/diffplug/opensource/goomph-p2-bootstrap/view).
*
* This only gets downloaded if you use {@link P2Model}.
*/
public static File p2bootstrap() {
return defOverride(ROOT + "/p2-bootstrap", override_p2bootstrap);
}
public static File override_p2bootstrap = null;
/**
* Location where the pde-bootstrap application should be downloaded from.
*
* Goomph's pde tasks rely on the eclipse [p2 director application](https://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fp2_director.html&cp=2_0_20_2).
* It is distributed within the Eclipse SDK. The Package is
* downloaded and installed during configuration from official eclipse
* repository.
*
* Defaults to official update site of the selected Eclipse Release. If you override, it still
* needs to follow the correct versioning scheme. e.g. if you want to relocate to `https://intranet/goomph-pde-boostrap`, then
* the artifact will need to be available at `https://intranet/goomph-pde-boostrap/4.5.2/goomph-pde-bootstrap.zip`
*
* As new versions of pdeBootstrap come out, you will have to update your internal URL cache, but these releases are infrequent.
*/
public static Optional<String> pdeBootstrapUrl() {
return Optional.ofNullable(override_pdeBootstrapUrl);
}
public static String override_pdeBootstrapUrl = null;
/**
* Location where eclipse instances with PDE build
* are cached: `~/.goomph/pde-bootstrap`.
*/
public static File pdeBootstrap() {
return defOverride(ROOT + "/pde-bootstrap", override_pdeBootstrap);
}
public static File override_pdeBootstrap = null;
/**
* Bundle pool used for caching jars and
* assembling disjoint eclipse installs: `~/.p2/pool`
*
* If you are using [Oomph](https://projects.eclipse.org/projects/tools.oomph)
* to create lots of eclipse installations, then this will go a lot
* faster if you cache all of their jars in a central location.
*
* Oomph does this by default in the given location.
*/
public static File bundlePool() {
//return defOverride(".p2/pool", override_bundlePool);
return defOverride(ROOT + "/shared-bundles", override_bundlePool);
}
public static File override_bundlePool = null;
private static File defOverride(String userHomeRelative, File override) {
return Optional.ofNullable(override).orElseGet(() -> {
return userHome().resolve(userHomeRelative).toFile();
});
}
private static Path userHome() {
return new File(StandardSystemProperty.USER_HOME.value()).toPath();
}
}
|
/* This is part of the netCDF package.
Copyright 2006 University Corporation for Atmospheric Research/Unidata.
See COPYRIGHT file for conditions of use.
This test was provided by Jeff Whitaker as an example of a bug,
specifically a segfault when re-writing an NC_CHAR attribute as
an NC_STRING attribute.
See https://github.com/Unidata/netcdf-c/issues/149
$Id$
*/
#include <netcdf.h>
#include <config.h>
#include <nc_tests.h>
#include "err_macros.h"
#include <string.h>
#define FILE_NAME "tst_atts_string_rewrite.nc"
int main() {
int dataset_id;
const char *attstring[1] = {"bar"};
int res = 0;
printf("\n*** Testing overwriting text attribute with string attribute.\n");
printf("\n***Creating file...");
res = nc_create(FILE_NAME, NC_NETCDF4, &dataset_id); if(res) ERR;
printf("Success\n");
printf("Creating global attribute with nc_put_att_text...");
res = nc_put_att_text(dataset_id, NC_GLOBAL, "foo", 3, "bar");
printf("Success\n");
printf("Overwriting global attribute with nc_put_att_string...");
res = nc_put_att_string(dataset_id, NC_GLOBAL, "foo", 1, attstring);
printf("Success\n");
printf("Closing file...");
res = nc_close(dataset_id);
printf("Success\n");
printf("Test Finished.\n");
SUMMARIZE_ERR;
FINAL_RESULTS;
}
|
<reponame>elsys/c-programming-hw<filename>B/04/04/03_zadacha.c<gh_stars>10-100
#include <stdio.h>
#include <stdlib.h>
int main()
{
char string[100];
int c=0,bukvi[26]={0};
fgets(string,100,stdin);
while(string[c] != '\0')
{
if(string[c]>='a'&&string[c]<='z')
bukvi[string[c]-'a']++;
else if(string[c]>='A'&&string[c]<='Z')
bukvi[string[c]-'A']++;c=c+1;
}
for(c=0;c<26;c++)
{
if (bukvi[c]!=0)
printf("%c - %d\n",c+'a',bukvi[c]);
}
}
|
def buscar_pessoa(id):
try:
pessoa = database.search(Query().id == id)[0]
except IndexError:
return {'message': 'Pessoa not found!'}, 404
return jsonify(pessoa)
|
print("Challenge 5: WAF that takes a input n and computer n+nn+nnn.")
y = int(input("Input an integer : "))
n1 = int( "%s" % y )
n2 = int( "%s%s" % (y,y) )
n3 = int( "%s%s%s" % (y,y,y) )
print (n1+n2+n3)
|
/**
* Create an implicit intent based on the given URI.
*/
public static Intent createUriIntent(String intentAction, String intentUri) {
if (intentAction == null) {
intentAction = Intent.ACTION_VIEW;
}
return new Intent(intentAction, Uri.parse(intentUri))
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
| Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
}
|
// GetAddr returns the localhost IPv4 TCP address with the
// designated port
func GetAddr(tcpSocketPort int) (*net.TCPAddr, error) {
return &net.TCPAddr{
IP: net.IPv4(127, 0, 0, 1),
Port: tcpSocketPort,
}, nil
}
|
<reponame>atlasapi/atlas<gh_stars>10-100
package org.atlasapi.remotesite.channel4.pmlsd.epg;
import org.atlasapi.media.entity.Alias;
import org.atlasapi.media.entity.Publisher;
import org.atlasapi.remotesite.channel4.pmlsd.C4AtomApi;
import org.atlasapi.remotesite.channel4.pmlsd.C4PmlsdModule;
import org.atlasapi.remotesite.channel4.pmlsd.C4UriExtractor;
import org.atlasapi.remotesite.channel4.pmlsd.epg.model.C4EpgEntry;
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class C4EpgEntryUriExtractor implements C4UriExtractor<C4EpgEntry, C4EpgEntry, C4EpgEntry>{
private final Pattern uriPattern = Pattern.compile(
"https?://(.+).channel4.com/([^/]+)/([^./]+)(.atom|/4od.atom|/episode-guide/series-(\\d+)(.atom|/episode-(\\d+).atom))"
);
private static final String ATLAS_URI_FORMAT = "http://%s/pmlsd/%s";
private static final int SERIES_NUMBER_GROUP = 5;
private static final int BRAND_NAME_GROUP = 3;
private static final String SERIES_URI_INFIX = "/episode-guide/series-";
@Override
public Optional<C4UriAndAliases> uriForBrand(Publisher publisher, C4EpgEntry entry){
if (!entry.hasRelatedLink()) {
return Optional.empty();
}
String linkUri = entry.getRelatedLink();
Matcher matcher = uriPattern.matcher(linkUri);
if (!matcher.matches()) {
return Optional.empty();
}
return Optional.of(C4UriAndAliases.create(
String.format(ATLAS_URI_FORMAT, publisherHost(publisher), matcher.group(3))
));
}
@Override
public Optional<C4UriAndAliases> uriForSeries(Publisher publisher, C4EpgEntry entry){
if (!entry.hasRelatedLink()) {
return Optional.empty();
}
String linkUri = entry.getRelatedLink();
Matcher matcher = uriPattern.matcher(linkUri);
if (!matcher.matches()) {
return Optional.empty();
}
String seriesNumber = matcher.group(SERIES_NUMBER_GROUP);
if (seriesNumber == null) {
return Optional.empty();
}
return Optional.of(C4UriAndAliases.create(
String.format(
ATLAS_URI_FORMAT,
publisherHost(publisher),
matcher.group(BRAND_NAME_GROUP) + SERIES_URI_INFIX + seriesNumber
)
));
}
@Override
public Optional<C4UriAndAliases> uriForItem(Publisher publisher, C4EpgEntry entry){
return Optional.of(C4UriAndAliases.create(
String.format(ATLAS_URI_FORMAT, publisherHost(publisher), entry.programmeId()),
new Alias(C4AtomApi.ALIAS, entry.programmeId()),
new Alias(C4AtomApi.ALIAS_FOR_BARB, entry.programmeId())
));
}
@Override
public Optional<C4UriAndAliases> uriForClip(Publisher publisher, C4EpgEntry remote) {
throw new UnsupportedOperationException("Clips not supported as not ingested from EPG");
}
private String publisherHost(Publisher publisher) {
String host = C4PmlsdModule.PUBLISHER_TO_CANONICAL_URI_HOST_MAP.get(publisher);
if (host == null) {
throw new IllegalArgumentException("Could not map publisher " + publisher.key() + " to a canonical URI host");
}
return host;
}
}
|
# -*- coding: utf-8 -*-
import abc
from datetime import datetime, timedelta
import os
from typing import List, Optional, Tuple, Union
import torch
import torch.nn as nn
import torch.distributed as dist
from torch.optim import Adam
from torch.optim.lr_scheduler import ExponentialLR
from supar.parsers.parser import Parser
from supar.models.multiparsing import MultiBiaffineDependencyModel
from supar.utils import Config, Dataset, Embedding
from supar.utils.fn import ispunct
from supar.utils.logging import init_logger, logger, progress_bar
from supar.utils.data import JointDataset, MultitaskDataLoader, JointDataLoader, DataLoader
from supar.utils.parallel import DistributedDataParallel as DDP
from supar.utils.metric import Metric, AttachmentMetric
from supar.utils.parallel import is_master
from supar.utils.field import Field, SubwordField
from supar.utils.common import bos, pad, unk
from supar.utils.transform import CoNLL
from supar.utils.optim import MultiTaskOptimizer, MultiTaskScheduler
class MultiTaskParser(Parser):
NAME = None
MODEL = None
def __init__(self, args, model, transform):
super().__init__(args, model, transform)
self.transforms = self.transform
def train_loop(self, task_names, train_loader, dev_loaders, test_loaders,
args, train_mode='train', save_prefix=None):
assert len(task_names) == len(dev_loaders) == len(test_loaders)
if train_mode == 'finetune':
lr = args.lr / 10
else:
lr = args.lr
task_names = task_names + ['total']
self.optimizer = MultiTaskOptimizer(self.model, args.task_names,
args.optimizer_type, lr, args.mu,
args.nu, args.epsilon)
self.scheduler = MultiTaskScheduler(self.optimizer, **args)
elapsed = timedelta()
best_e = {tname: 1 for tname in task_names}
best_metrics = {tname: AttachmentMetric() for tname in task_names}
for epoch in range(1, args.epochs + 1):
start = datetime.now()
logger.info(f"Epoch {epoch} / {args.epochs}:")
self._train(train_loader, train_mode=train_mode)
losses, metrics = self._multi_evaluate(dev_loaders, task_names)
for tname in task_names:
logger.info(f"{tname:6} - {'dev:':6} - loss: {losses[tname]:.4f} - {metrics[tname]}")
if metrics[tname] > best_metrics[tname]:
best_e[tname] = epoch
best_metrics[tname] = metrics[tname]
if is_master():
if save_prefix:
model_name = f"{save_prefix}-{tname}.model"
else:
model_name = f"{tname}.model"
model_path = args.exp_dir / model_name
self.save(model_path)
logger.info(f"Saved model: {model_path}")
for tname in task_names:
if save_prefix:
model_name = f"{save_prefix}-{tname}.model"
else:
model_name = f"{tname}.model"
logger.info(f"{model_name:4} - Best epoch {best_e[tname]} - {best_metrics[tname]}")
t = datetime.now() - start
logger.info(f"{t}s elapsed\n")
elapsed += t
if epoch - max(best_e.values()) >= args.patience:
break
logger.info(f"{train_mode}ing completed")
for tname, test_loader in zip(task_names, test_loaders):
logger.info(f"Task Name: {tname}")
args.path = args.exp_dir / f"{tname}.model"
loss, metric = self.load(**args)._evaluate(test_loader, tname)
logger.info(f"Epoch {best_e[tname]} saved")
logger.info(f"{'dev:':6} - {best_metrics[tname]}")
logger.info(f"{'test:':6} - {metric}")
logger.info(f"{elapsed}s elapsed, {elapsed / epoch}s/epoch\n")
return best_metrics
def train(self, train, dev, test, train_mode='train', buckets=32,
batch_size=5000, lr=2e-3, mu=.9, nu=.9, epsilon=1e-12, clip=5.0,
decay=.75, decay_steps=5000, epochs=5000, patience=100, verbose=True,
**kwargs):
args = Config().update(locals())
init_logger(logger, verbose=args.verbose)
for transform in self.transforms:
transform.train()
if dist.is_initialized():
args.batch_size = args.batch_size // dist.get_world_size()
train, dev, test = [], [], []
for train_f, dev_f, test_f, transform in zip(args.train, args.dev,
args.test, self.transforms):
train.append(Dataset(transform, train_f, **args))
dev.append(Dataset(transform, dev_f))
test.append(Dataset(transform, test_f))
for trainD, devD, testD, tname in zip(train, dev, test, args.task_names):
logger.info(f"Building for {tname}")
trainD.build(args.batch_size, args.buckets, True,
dist.is_initialized())
devD.build(args.batch_size, args.buckets)
testD.build(args.batch_size, args.buckets)
logger.info(f"{'train:':6} {trainD}\n"
f"{'dev:':6} {devD}\n"
f"{'test:':6} {testD}\n")
if args.joint_loss:
joint_train = JointDataset(train, args.task_names)
joint_train.build(args.batch_size, args.buckets, True,
dist.is_initialized())
train_loader = joint_train.loader
else:
train_loader = MultitaskDataLoader(args.task_names, train)
if args.loss_weights:
assert len(args.loss_weights) == len(args.task_names)
self.args.loss_weights = {
task_name: float(loss_ratio)
for task_name, loss_ratio in zip(args.task_names,
args.loss_weights)
}
else:
self.args.loss_weights = {
task_name: 1.0
for task_name in args.task_names
}
dev_loaders = [d.loader for d in dev]
test_loaders = [d.loader for d in test]
logger.info(f"{self.model}\n")
if dist.is_initialized():
self.model = DDP(self.model, device_ids=[args.local_rank],
find_unused_parameters=True)
if train_mode == 'train':
train_metrics = self.train_loop(args.task_names, train_loader,
dev_loaders, test_loaders, args)
else:
_, train_metrics = self._multi_evaluate(dev_loaders, args.task_names)
logger.info("Dev Metrics before finetuning")
for tname, dev_loader in zip(args.task_names, dev_loaders):
logger.info(f"Task Name: {tname}")
args.path = args.exp_dir / f"{tname}.model"
loss, metric = self.load(**args)._evaluate(dev_loader, tname)
logger.info(f"{tname:5}: {metric}")
if args.finetune or train_mode == 'finetune':
logger.info("Starting Finetuning ...")
finetuned_metrics = {tname: {} for tname in train_metrics.keys()}
for start_task in train_metrics.keys():
for task_id, finetune_task in enumerate(args.task_names):
logger.info(f"Finetuning model: {start_task}.model with {finetune_task} data")
args.path = args.exp_dir / f"{start_task}.model"
args.loss_weights = self.args.loss_weights
parser = self.load(**args)
if args.finetune == 'partial':
parser.model.freeze_shared()
# Choose only one element from the list
finetune_task_list = args.task_names[task_id: task_id + 1]
finetune_train_loader = MultitaskDataLoader(finetune_task_list, train[task_id: task_id + 1])
finetune_dev_loaders = dev_loaders[task_id: task_id + 1]
finetune_test_loaders = test_loaders[task_id: task_id + 1]
finetuned_metrics[start_task].update(
parser.train_loop(
finetune_task_list,
finetune_train_loader,
finetune_dev_loaders,
finetune_test_loaders,
args,
train_mode='finetune',
save_prefix=f'{args.finetune}-{start_task}',
))
for start_task, tmetrics in train_metrics.items():
logger.info(f"Dev Metrics for {start_task}: {tmetrics}")
for finetuned_task_name, fmetrics in finetuned_metrics[start_task].items():
logger.info(f"Dev Metrics for {start_task}-{finetuned_task_name}: {fmetrics}")
def evaluate(self, data, buckets=8, batch_size=5000, **kwargs):
"""
If a model file is specified in the --path argument, then that model is
loaded and evaluated. Instead, if the experiment directory is specified,
then a random .model file is first loaded to set things up. Then all
.model files present in directory are evaluated in the following fashion:
- {task}.model is tested on {task} data
- total.model is tested on all provided data
- Model ending with "*-{task}.model" are tested on {task}
"""
args = self.args.update(locals())
init_logger(logger, verbose=args.verbose)
for transform in self.transforms:
transform.train()
for task, data_list in zip(args.task, args.data):
# args.task_names was saved in parser while training
# args.task was provided as cmd line args while evaluation
task_id = args.task_names.index(task)
if args.path.is_file():
paths = [args.path]
else:
paths = []
paths += list(args.path.glob(f"*-{task}.model"))
paths += list(args.path.glob('total.model'))
paths += list(args.path.glob(f'{task}.model'))
for data in data_list:
dataset = Dataset(self.transforms[task_id], data, proj=args.proj)
dataset.build(args.batch_size, args.buckets)
for path in paths:
parser = self.load(path)
start = datetime.now()
loss, metric = parser._evaluate(dataset.loader, task)
logger.info(f"Data={os.path.split(data)[-1]}\tModel={path.name}\tMetric={metric}")
return loss, metric
def predict(self, data, pred=None, buckets=8, batch_size=5000, prob=False,
**kwargs):
args = self.args.update(locals())
init_logger(logger, verbose=args.verbose)
for transform in self.transforms:
transform.eval()
if args.prob:
transform.append(Field('probs'))
original_path = args.path
for task, data_list in zip(args.task, args.data):
# args.task_names was saved in parser while training
# args.task was provided as cmd line args while evaluation
task_id = args.task_names.index(task)
transform = self.transforms[task_id]
if args.path.is_file():
paths = [args.path]
else:
paths = []
paths += list(args.path.glob(f"*-{task}.model"))
paths += list(args.path.glob('total.model'))
paths += list(args.path.glob(f'{task}.model'))
for data in data_list:
for path in paths:
logger.info("Loading the data")
dataset = Dataset(transform, data)
dataset.build(args.batch_size, args.buckets)
logger.info(f"\n{dataset}")
args.path = path
parser = self.load(path)
print(path)
logger.info(f"Making predictions on {data} using {path.name}")
start = datetime.now()
preds = parser._predict(dataset.loader, task)
elapsed = datetime.now() - start
for name, value in preds.items():
setattr(dataset, name, value)
if is_master():
if not hasattr(args, 'pred') or args.pred is None:
pred = args.exp_dir / f"{path.stem}-{os.path.split(data)[-1]}"
logger.info(f"Saving predicted results to {pred}")
transform.save(pred, dataset.sentences)
logger.info(f"{elapsed}s elapsed, {len(dataset) / elapsed.total_seconds():.2f} Sents/s")
args.path = original_path
return dataset
@classmethod
def load(cls, path, **kwargs):
"""
If a path to a model file is specified, then it loads that model. If the
experiment directory is provided in the path instead, then it randomly
loads the a model file (with .model ext)
"""
if path.is_file():
# return super(Parser, cls).load(path, **kwargs)
return super().load(path, **kwargs)
else:
for p in path.glob('*.model'):
return super().load(p, **kwargs)
@torch.no_grad()
@abc.abstractmethod
def _evaluate(self, loader, task_name):
raise NotImplementedError
@torch.no_grad()
def _multi_evaluate(self, loaders, task_names):
losses = {tname: 1 for tname in task_names}
metrics = {tname: AttachmentMetric() for tname in task_names}
for loader, tname in zip(loaders, task_names):
losses[tname], metrics[tname] = self._evaluate(loader, tname)
losses['total'] = sum(losses.values())
total_metric = AttachmentMetric()
for m in metrics.values():
total_metric += m
metrics['total'] = total_metric
return losses, metrics
class MultiBiaffineDependencyParser(MultiTaskParser):
NAME = 'multi-biaffine-dependency'
MODEL = MultiBiaffineDependencyModel
def __init__(self, args, model, transforms):
"""
A CoNLL transform object takes in the following Field objects:
- WORD: Word embeddings
- Supposed to be build on the train set.
- For MultitaskParser we build on the combined train set of
all tasks. This will have to change when we use different
languages.
- FEAT: Char/Bert/POS embeddings
- Just like WORD. Should be built on train set and for MTP,
we build on the combined train.
- ARC: Arcs labels
- This are word indices indicating where the arc starts and
where it ends.
- REL: Dependency relations
- These are relations different for different tasks, for
e.g. the ones for UD and SUD are different. This is retrieved by
passing the ~ConLL.get_arcs~ function the Field constuctor
- Hence, we cannot build them on ~combined_train~ just the
way we do for WORD and FEAT. Hence, we build it
individually for different train sets for each
corresponding task. This is what leads to different
transform objects for different tasks.
Hence while retrieving each of the fields in this constructor, we simply
retrieve the first WORD, FEAT and ARC from the first transform.
In the future when we want to use the Parser for different
languages or for train sets from completely different domains
we might want to build WORD and FEAT separately for each
train set, the way we do for RELs.
Also, when we move onto doing constituency and dependency, we
will have to see how to treat ARC.
"""
super().__init__(args, model, transforms)
transform = transforms[0]
self.WORD, self.CHAR, self.BERT = transform.FORM
# if self.args.feat in ('char', 'bert'): #new
# self.WORD, self.FEAT = transform.FORM
# else:
# self.WORD, self.FEAT = transform.FORM, transform.CPOS
self.ARC, self.REL = transform.HEAD, [t.DEPREL for t in transforms]
self.puncts = torch.tensor([
i for s, i in self.WORD.vocab.stoi.items() if ispunct(s)
]).to(self.args.device)
def train(self, train, dev, test, buckets=32, batch_size=5000, punct=False,
tree=False, proj=False, partial=False, verbose=True, **kwargs):
return super().train(**Config().update(locals()))
def evaluate(self, data, buckets=8, batch_size=5000, punct=False, tree=True,
proj=False, partial=False, verbose=True, **kwargs):
return super().evaluate(**Config().update(locals()))
def predict(self, data, pred=None, buckets=8, batch_size=5000, prob=False,
tree=True, proj=False, verbose=True, **kwargs):
return super().predict(**Config().update(locals()))
def _separate_train(self, loader, train_mode='train'):
self.model.train()
bar, metric = progress_bar(loader), AttachmentMetric()
for words, *feats, arcs, rels, task_name in bar: #new
self.optimizer.set_mode(task_name, train_mode)
self.scheduler.set_mode(task_name, train_mode)
self.optimizer.zero_grad()
mask = words.ne(self.WORD.pad_index)
# ignore the first token of each sentence
mask[:, 0] = 0
s_arc, s_rel = self.model(words, feats, task_name)
loss = self.model.loss(s_arc, s_rel, arcs, rels, mask,
self.args.partial)
loss *= self.args.loss_weights[task_name]
loss.backward()
nn.utils.clip_grad_norm_(self.model.parameters(), self.args.clip)
self.optimizer.step()
self.scheduler.step()
arc_preds, rel_preds = self.model.decode(s_arc, s_rel, mask)
if self.args.partial:
mask &= arcs.ge(0)
# ignore all punctuation if not specified
if not self.args.punct:
mask &= words.unsqueeze(-1).ne(self.puncts).all(-1)
metric(arc_preds, rel_preds, arcs, rels, mask)
bar.set_postfix_str(
f"lr: {self.scheduler.get_last_lr(task_name)[0]:.4e} - loss: {loss:.4f} - {metric}"
)
def _joint_train(self, loader, train_mode='train'):
self.model.train()
bar, metric = progress_bar(loader), AttachmentMetric()
self.optimizer.set_mode(self.args.task_names, train_mode)
self.scheduler.set_mode(self.args.task_names, train_mode)
for inputs, targets in bar:
words, *feats = inputs.values()
self.optimizer.zero_grad()
mask = words.ne(self.WORD.pad_index)
# ignore the first token of each sentence
mask[:, 0] = 0
shared_out = self.model.shared_forward(words, feats)
losses = []
s_arcs, s_rels = {}, {}
for t_name, t_targets in targets.items():
arcs, rels = t_targets['arcs'], t_targets['rels']
s_arc, s_rel = self.model.unshared_forward(shared_out, t_name)
s_arcs[t_name], s_rels[t_name] = s_arc, s_rel
loss = self.model.loss(s_arc, s_rel, arcs, rels, mask,
self.args.partial)
losses.append(loss)
joint_loss = sum(losses)
joint_loss.backward()
nn.utils.clip_grad_norm_(self.model.parameters(), self.args.clip)
self.optimizer.step()
self.scheduler.step()
# Calculating train metric. Can be skipped
for t_name, t_targets in targets.items():
arcs, rels = t_targets['arcs'], t_targets['rels']
s_arc, s_rel = s_arcs[t_name], s_rels[t_name]
arc_preds, rel_preds = self.model.decode(s_arc, s_rel, mask)
if self.args.partial:
mask &= arcs.ge(0)
# ignore all punctuation if not specified
if not self.args.punct:
mask &= words.unsqueeze(-1).ne(self.puncts).all(-1)
metric(arc_preds, rel_preds, arcs, rels, mask)
bar.set_postfix_str(
f"lr: {self.scheduler.get_last_lr()[0]:.4e} - loss: {joint_loss:.4f} - {metric}"
)
def _train(self, loader, train_mode='train'):
if self.args.joint_loss and train_mode == 'train':
self._joint_train(loader, train_mode=train_mode)
else:
self._separate_train(loader, train_mode=train_mode)
@torch.no_grad()
def _evaluate(self, loader, task_name):
self.model.eval()
total_loss, metric = 0, AttachmentMetric()
if task_name not in self.model.args.task_names:
return total_loss, metric
for words, *feats, arcs, rels in loader:
mask = words.ne(self.WORD.pad_index)
# ignore the first token of each sentence
mask[:, 0] = 0
s_arc, s_rel = self.model(words, feats, task_name)
loss = self.model.loss(s_arc, s_rel, arcs, rels, mask,
self.args.partial)
arc_preds, rel_preds = self.model.decode(s_arc, s_rel, mask,
self.args.tree,
self.args.proj)
if self.args.partial:
mask &= arcs.ge(0)
# ignore all punctuation if not specified
if not self.args.punct:
mask &= words.unsqueeze(-1).ne(self.puncts).all(-1)
total_loss += loss.item()
metric(arc_preds, rel_preds, arcs, rels, mask)
total_loss /= len(loader)
return total_loss, metric
@torch.no_grad()
def _predict(self, loader, task_name):
# args.task_names was saved in parser while training
# args.task was provided as cmd line args while evaluation
task_id = self.args.task_names.index(task_name)
self.model.eval()
preds = {}
arcs, rels, probs = [], [], []
for words, *feats in progress_bar(loader):
mask = words.ne(self.WORD.pad_index)
# ignore the first token of each sentence
mask[:, 0] = 0
lens = mask.sum(1).tolist()
s_arc, s_rel = self.model(words, feats, task_name)
arc_preds, rel_preds = self.model.decode(s_arc, s_rel, mask,
self.args.tree,
self.args.proj)
arcs.extend(arc_preds[mask].split(lens))
rels.extend(rel_preds[mask].split(lens))
if hasattr(self.args, 'pred') and self.args.prob:
arc_probs = s_arc.softmax(-1)
probs.extend([
prob[1:i + 1, :i + 1].cpu()
for i, prob in zip(lens, arc_probs.unbind())
])
arcs = [seq.tolist() for seq in arcs]
rels = [self.REL[task_id].vocab[seq.tolist()] for seq in rels]
preds = {'arcs': arcs, 'rels': rels}
if hasattr(self.args, 'pred') and self.args.prob:
preds['probs'] = probs
return preds
@classmethod
def build(cls, path, min_freq=2, fix_len=20, **kwargs):
args = Config(**locals())
args.device = 'cuda' if torch.cuda.is_available() else 'cpu'
os.makedirs(os.path.dirname(path), exist_ok=True)
if os.path.exists(path) and not args.build:
parser = cls.load(**args)
parser.model = cls.MODEL(**parser.args)
parser.model.load_pretrained(parser.WORD.embed).to(args.device)
return parser
logger.info("Building the fields")
WORD = Field('words', pad=pad, unk=unk, bos=bos, lower=True)
TAG, CHAR, BERT = None, None, None
if 'tag' in args.feat:
TAG = Field('tags', bos=bos)
if 'char' in args.feat:
CHAR = SubwordField('chars', pad=pad, unk=unk, bos=bos, fix_len=args.fix_len)
if 'bert' in args.feat:
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained(args.bert)
BERT = SubwordField('bert',
pad=tokenizer.pad_token,
unk=tokenizer.unk_token,
bos=tokenizer.bos_token or tokenizer.cls_token,
fix_len=args.fix_len,
tokenize=tokenizer.tokenize)
BERT.vocab = tokenizer.get_vocab()
# if args.feat == 'char':
# FEAT = SubwordField('chars', pad=pad, unk=unk, bos=bos,
# fix_len=args.fix_len)
# elif args.feat == 'bert':
# from transformers import AutoTokenizer
# tokenizer = AutoTokenizer.from_pretrained(args.bert)
# FEAT = SubwordField('bert', pad=tokenizer.pad_token,
# unk=tokenizer.unk_token, bos=tokenizer.bos_token
# or tokenizer.cls_token, fix_len=args.fix_len,
# tokenize=tokenizer.tokenize)
# FEAT.vocab = tokenizer.get_vocab()
# else:
# FEAT = Field('tags', bos=bos)
ARC = Field('arcs', bos=bos, use_vocab=False, fn=CoNLL.get_arcs)
RELS = [Field('rels', bos=bos) for i in range(len(args.task_names))]
transforms = [CoNLL(FORM=(WORD, CHAR, BERT), POS=TAG, HEAD=ARC, DEPREL=REL) for REL in RELS]
# if args.feat in ('char', 'bert'):
# transforms = [
# CoNLL(FORM=(WORD, FEAT), HEAD=ARC, DEPREL=REL) for REL in RELS
# ]
# else:
# transforms = [
# CoNLL(FORM=WORD, CPOS=FEAT, HEAD=ARC, DEPREL=REL) for REL in RELS
# ]
# HACK for creating a combined train object.
# TODO: Think of something better. This is UGLY af
train = [
Dataset(transform, train_f, **args)
for train_f, transform in zip(args.train, transforms)
]
combined_train = Dataset(transforms[0], args.train[0], **args)
for i in range(1, len(train)):
combined_train.sentences += train[i].sentences
WORD.build(combined_train, args.min_freq,
(Embedding.load(args.embed, args.unk) if args.embed else None))
if TAG is not None:
TAG.build(combined_train)
if CHAR is not None:
CHAR.build(combined_train)
# FEAT.build(combined_train)
from collections import Counter
rel_counters = []
for REL, trainD in zip(RELS, train):
c = Counter()
for s in trainD.sentences:
c.update(s.rels)
rel_counters.append(c)
REL.build(trainD)
args.update({
'n_words': WORD.vocab.n_init,
'n_tags': len(TAG.vocab) if TAG is not None else None,
'n_chars': len(CHAR.vocab) if CHAR is not None else None,
'char_pad_index': CHAR.pad_index if CHAR is not None else None,
'bert_pad_index': BERT.pad_index if BERT is not None else None,
# 'n_feats': len(FEAT.vocab),
'n_rels': [len(REL.vocab) for REL in RELS],
'pad_index': WORD.pad_index,
'unk_index': WORD.unk_index,
'bos_index': WORD.bos_index,
# 'feat_pad_index': FEAT.pad_index,
})
model = cls.MODEL(**args)
model.load_pretrained(WORD.embed).to(args.device)
return cls(args, model, transforms)
|
/**
* @author Nikolay Chugunov
* @version: $Revision: 1.4 $
*/
public class ComplexTest extends TestCase {
private final Vector classLoaders = new Vector();
static Logger log = Logger.global;
// isStop is used only by testMultiThread
private boolean isStop = false;
private long memoryBefore;
private final long totalMemory = Runtime.getRuntime()
.totalMemory();
private final long niose = 10000;
private Vector threads = new Vector();
int numberOfElements;
static int numberOfElementInArray;
private static int numberOfStartedOfTests = 0;
protected void setUp() throws Exception {
numberOfStartedOfTests++;
numberOfElements = Integer.parseInt(System
.getProperty("stresstests.numberOfElements"));
numberOfElementInArray = (int)totalMemory / numberOfElements;
assertTrue(totalMemory < Integer.MAX_VALUE);
assertEquals(Runtime.getRuntime().maxMemory() + "", totalMemory + "");
System.gc();
memoryBefore= Runtime.getRuntime().freeMemory();
log.info("Total memory: " + totalMemory);
log.info("Free memory before: " + memoryBefore);
}
public void testOneThread() throws Exception {
try {
while (ReliabilityRunner.isActive()) {
ClassLoader classLoader = new SimpleClassLoader();
classLoaders.add(classLoader);
classLoader.loadClass(LoadedClass.class.getName())
.newInstance();
}
} catch (OutOfMemoryError e) {
}
verify(20000 * numberOfElements);
}
public void testMultiThread() throws Exception {
// numberOfElementInArray = (int)totalMemory / numberOfElements;
// log.info(numberOfElementInArray + "");
try {
while (ReliabilityRunner.isActive() && !isStop) {
Runnable runnable = new Runnable() {
public void run() {
try {
ClassLoader classLoader = new SimpleClassLoader();
classLoaders.add(classLoader);
classLoader.loadClass(LoadedClass.class.getName())
.newInstance();
} catch (OutOfMemoryError e) {
isStop = true;
} catch (Throwable e) {
isStop = true;
assertTrue(false);
}
}
};
Thread thread = new Thread(runnable);
thread.start();
threads.add(thread);
}
} catch (OutOfMemoryError e) {
isStop = true;
}
classLoaders.removeAllElements();
for (int i = 0; i < threads.size(); i++) {
((Thread)threads.get(i)).join();
}
verify(60000 * numberOfElements);
}
protected void tearDown() throws Exception {
if (numberOfStartedOfTests == 2) {
System.exit(ReliabilityRunner.RESULT_PASS);
}
}
private void verify(double error) {
classLoaders.removeAllElements();
System.gc();
long memoryAfter = Runtime.getRuntime().freeMemory();
log.info("Free memory after: " + memoryAfter);
log.info((memoryBefore - memoryAfter) + "");
log.info((error + niose) + "");
assertTrue(memoryBefore - memoryAfter < error + niose);
}
}
|
def from_json(cls, json_string: str):
if json_string is None or len(json_string) == 0 or json_string == ABCPropertyGraphConstants.NEO4j_NONE:
return None
d = json.loads(json_string)
ret = cls()
ret.set_fields(**d)
return ret
|
package chargify
type Customer struct {
Id int `json:"id,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Organization string `json:"organization,omitempty"`
Email string `json:"email,omitempty"`
CreatedAt *FormattedTime `json:"created_at,omitempty"`
UpdatedAt *FormattedTime `json:"updated_at,omitempty"`
Reference string `json:"reference,omitempty"`
Address string `json:"address,omitempty"`
Address2 string `json:"address_2,omitempty"`
City string `json:"city,omitempty"`
State string `json:"state,omitempty"`
Zip string `json:"zip,omitempty"`
Country string `json:"country,omitempty"`
Phone string `json:"phone,omitempty"`
PortalInviteLastSentAt *FormattedTime `json:"portal_invite_last_sent_at,omitempty"`
PortalInviteLastAcceptedAt *FormattedTime `json:"portal_invite_last_accepted_at,omitempty"`
Verified bool `json:"verified,omitempty"`
PortalCustomerCreatedAt *FormattedTime `json:"portal_customer_created_at,omitempty"`
CcEmails string `json:"cc_emails,omitempty"`
TaxExempt bool `json:"tax_exempt,omitempty"`
}
type CreditCard struct {
Id int `json:"id,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
MaskedCardNumber string `json:"masked_card_number,omitempty"`
CardType string `json:"card_type,omitempty"`
ExpirationMonth int `json:"expiration_month,omitempty"`
ExpirationYear int `json:"expiration_year,omitempty"`
CustomerId int `json:"customer_id,omitempty"`
CurrentVault string `json:"current_vault,omitempty"`
VaultToken string `json:"vault_token,omitempty"`
BillingAddress string `json:"billing_address,omitempty"`
BillingCity string `json:"billing_city,omitempty"`
BillingState string `json:"billing_state,omitempty"`
BillingZip string `json:"billing_zip,omitempty"`
BillingCountry string `json:"billing_country,omitempty"`
CustomerVaultToken string `json:"customer_vault_token,omitempty"`
BillingAddress2 string `json:"billing_address_2,omitempty"`
PaymentType string `json:"payment_type,omitempty"`
}
|
// Copyright 2016 union-find-rs Developers
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.
extern crate test;
use std::io::{BufRead, BufReader};
use std::fs::File;
use {Union, UnionFind};
use self::test::Bencher;
lazy_static! {
static ref TINY: Input = Input::from_file("etc/tinyUF.txt");
static ref MEDIUM: Input = Input::from_file("etc/mediumUF.txt");
static ref LARGE: Input = Input::from_file("etc/largeUF.txt");
}
struct Cache<T> {
input: &'static Input,
init: Option<T>,
union1: Option<T>,
union2: Option<T>,
find1: Option<T>,
find2: Option<T>,
}
impl<T> Cache<T> {
fn new(input: &'static Input) -> Cache<T> {
Cache {
input: input,
init: None,
union1: None,
union2: None,
find1: None,
find2: None,
}
}
fn init<V>(&mut self) -> &T
where
T: UnionFind<V>,
V: Union + Default,
{
if let None = self.init {
self.init = Some(self.input.init());
}
self.init.as_ref().unwrap()
}
fn union1<V>(&mut self) -> &T
where
T: UnionFind<V> + Clone,
V: Union + Default,
{
if let None = self.union1 {
let mut uf = self.init().clone();
self.input.union(&mut uf);
self.union1 = Some(uf);
}
self.union1.as_ref().unwrap()
}
fn union2<V>(&mut self) -> &T
where
T: UnionFind<V> + Clone,
V: Union + Default,
{
if let None = self.union2 {
let mut uf = self.union1().clone();
self.input.union(&mut uf);
self.union2 = Some(uf);
}
self.union2.as_ref().unwrap()
}
fn find1<V>(&mut self) -> &T
where
T: UnionFind<V> + Clone,
V: Union + Default,
{
if let None = self.find1 {
let mut uf = self.union1().clone();
self.input.find_all(&mut uf);
self.find1 = Some(uf);
}
self.find1.as_ref().unwrap()
}
fn find2<V>(&mut self) -> &T
where
T: UnionFind<V> + Clone,
V: Union + Default,
{
if let None = self.find2 {
let mut uf = self.union1().clone();
self.input.find_all(&mut uf);
self.find2 = Some(uf);
}
self.find2.as_ref().unwrap()
}
}
#[derive(Clone, Debug)]
struct Input {
size: usize,
conn: Vec<(usize, usize)>,
}
impl Input {
fn from_file(name: &str) -> Input {
let mut reader = BufReader::new(File::open(name).unwrap());
let mut buf = String::new();
let _ = reader.read_line(&mut buf).unwrap();
let size = buf.trim().parse::<usize>().unwrap();
buf.clear();
let mut conn = vec![];
while reader.read_line(&mut buf).unwrap() > 0 {
{
let mut sp = buf.trim().split_whitespace();
let a = sp.next().unwrap().parse::<usize>().unwrap();
let b = sp.next().unwrap().parse::<usize>().unwrap();
conn.push((a, b));
}
buf.clear();
}
Input {
size: size,
conn: conn,
}
}
fn init<T, V>(&self) -> T
where
T: UnionFind<V>,
V: Union + Default,
{
T::new(self.size)
}
fn union<T, V>(&self, uf: &mut T)
where
T: UnionFind<V>,
V: Union,
{
for &(p, q) in &self.conn {
uf.union(p, q);
}
}
fn find_all<T, V>(&self, uf: &mut T)
where
T: UnionFind<V>,
V: Union,
{
for i in 0..uf.size() {
let _ = uf.find(i);
}
}
fn bench_clone_from<T, V>(&self, bencher: &mut Bencher, cache: &mut Cache<T>)
where
T: UnionFind<V> + Clone,
V: Union + Default,
{
let base = cache.init();
let mut uf = base.clone();
bencher.iter(|| {
uf.clone_from(&base);
});
}
fn bench_union1<T, V>(&self, bencher: &mut Bencher, cache: &mut Cache<T>)
where
T: UnionFind<V> + Clone,
V: Union + Default,
{
let base = cache.init();
let mut uf = base.clone();
bencher.iter(|| {
uf.clone_from(&base);
self.union(&mut uf);
});
}
fn bench_union2<T, V>(&self, bencher: &mut Bencher, cache: &mut Cache<T>)
where
T: UnionFind<V> + Clone,
V: Union + Default,
{
let base = cache.union1();
let mut uf = base.clone();
bencher.iter(|| {
uf.clone_from(&base);
self.union(&mut uf);
});
}
fn bench_union3<T, V>(&self, bencher: &mut Bencher, cache: &mut Cache<T>)
where
T: UnionFind<V> + Clone,
V: Union + Default,
{
let base = cache.union2();
let mut uf = base.clone();
bencher.iter(|| {
uf.clone_from(&base);
self.union(&mut uf);
});
}
fn bench_find1<T, V>(&self, bencher: &mut Bencher, cache: &mut Cache<T>)
where
T: UnionFind<V> + Clone,
V: Union + Default,
{
let base = cache.union1();
let mut uf = base.clone();
bencher.iter(|| {
uf.clone_from(&base);
self.find_all(&mut uf);
});
}
fn bench_find2<T, V>(&self, bencher: &mut Bencher, cache: &mut Cache<T>)
where
T: UnionFind<V> + Clone,
V: Union + Default,
{
let base = cache.find1();
let mut uf = base.clone();
bencher.iter(|| {
uf.clone_from(&base);
self.find_all(&mut uf);
});
}
fn bench_find3<T, V>(&self, bencher: &mut Bencher, cache: &mut Cache<T>)
where
T: UnionFind<V> + Clone,
V: Union + Default,
{
let base = cache.find2();
let mut uf = base.clone();
bencher.iter(|| {
uf.clone_from(&base);
self.find_all(&mut uf);
});
}
}
macro_rules! bench_fns_for_type_with_input {
($ty:ty, $input:path) => {
use std::sync::Mutex;
use ::bench::Cache;
lazy_static!{
static ref CACHE: Mutex<Cache<$ty>> = Mutex::new(Cache::new(&$input));
}
#[bench]
fn clone_from(bencher: &mut ::bench::test::Bencher) {
$input.bench_clone_from::<$ty, _>(bencher, &mut CACHE.lock().unwrap());
}
#[bench]
fn union1(bencher: &mut ::bench::test::Bencher) {
$input.bench_union1::<$ty, _>(bencher, &mut CACHE.lock().unwrap());
}
#[bench]
fn union2(bencher: &mut ::bench::test::Bencher) {
$input.bench_union2::<$ty, _>(bencher, &mut CACHE.lock().unwrap());
}
#[bench]
fn union3(bencher: &mut ::bench::test::Bencher) {
$input.bench_union3::<$ty, _>(bencher, &mut CACHE.lock().unwrap());
}
#[bench]
fn find1(bencher: &mut ::bench::test::Bencher) {
$input.bench_find1::<$ty, _>(bencher, &mut CACHE.lock().unwrap());
}
#[bench]
fn find2(bencher: &mut ::bench::test::Bencher) {
$input.bench_find2::<$ty, _>(bencher, &mut CACHE.lock().unwrap());
}
#[bench]
fn find3(bencher: &mut ::bench::test::Bencher) {
$input.bench_find3::<$ty, _>(bencher, &mut CACHE.lock().unwrap());
}
}
}
macro_rules! bench_fns_for_type {
($ty:ty) => {
mod tiny { bench_fns_for_type_with_input!($ty, ::bench::TINY); }
mod medium { bench_fns_for_type_with_input!($ty, ::bench::MEDIUM); }
mod large { bench_fns_for_type_with_input!($ty, ::bench::LARGE); }
}
}
mod quick_union {
mod by_size {
bench_fns_for_type!(::QuickUnionUf<::UnionBySize>);
}
mod by_rank {
bench_fns_for_type!(::QuickUnionUf<::UnionByRank>);
}
mod by_size_rank {
bench_fns_for_type!(::QuickUnionUf<::UnionBySizeRank>);
}
mod by_rank_size {
bench_fns_for_type!(::QuickUnionUf<::UnionByRankSize>);
}
}
mod quick_find {
mod by_size {
bench_fns_for_type!(::QuickFindUf<::UnionBySize>);
}
mod by_rank {
bench_fns_for_type!(::QuickFindUf<::UnionByRank>);
}
mod by_size_rank {
bench_fns_for_type!(::QuickFindUf<::UnionBySizeRank>);
}
mod by_rank_size {
bench_fns_for_type!(::QuickFindUf<::UnionByRankSize>);
}
}
|
use crate::core::CoinData;
use console::{self, style, StyledObject, Term};
use prettytable::{Cell, Row, Table};
use url::{ParseError, Url};
pub fn clear_console() {
let term = Term::stdout();
term.clear_screen().unwrap();
}
pub fn parse_url(url: &str) -> Result<Url, ParseError> {
match Url::parse(url) {
Ok(url) => Ok(url),
Err(error) if error == ParseError::RelativeUrlWithoutBase => {
let url_with_base = format!("{}{}", "http://", url);
Url::parse(url_with_base.as_str())
}
Err(error) => Err(error),
}
}
fn get_coin_color(name: String) -> StyledObject<String> {
let result = match name.as_ref() {
"Bitcoin" => style(name).yellow(),
"Litecoin" => style(name).blue(),
"Ethereum" => style(name).magenta(),
_ => style(name).yellow(),
};
return result.to_owned();
}
pub fn pretty_print(data: Vec<CoinData>) -> Result<(), ()> {
clear_console();
let mut table = Table::new();
for item in data {
table.add_row(Row::new(vec![
Cell::new(&get_coin_color(item.name).to_string()),
Cell::new(
&item
.market_data
.current_price
.get("usd")
.unwrap()
.to_string(),
),
Cell::new(&format!(
"24h Price Change: {:.4}%",
item.market_data
.price_change_percentage_24h_in_currency
.get("usd")
.unwrap()
.to_string()
)),
]));
}
table.printstd();
return Ok(());
}
|
def unit_sort(text):
if text.startswith("-"):
return 0, text
elif text.endswith("ns"):
return 1, text
elif text.endswith("us"):
return 2, text
elif text.endswith("ms"):
return 3, text
|
Former New Orleans Police Officer Jeffrey Lehrmann was sentenced Wednesday to three years in federal prison for his part in the cover-up of the Danziger Bridge shootings, our partners at the New Orleans Times-Picayune reported today.
Lehrmann is one of 11 officers who have been charged in the Sept. 4, 2005 incident, in which police officers opened fire on unarmed civilians, killing two and wounding four others. He was the first of five officers to cooperate with federal investigators.
Lehrmann pleaded guilty in February to concealing a crime, after coming forward and disclosing his role in an extensive cover-up that followed the shootings.
According to the bill of information filed by the U.S. Department of Justice, Lehrmann “participated in the creation of false reports” and provided “false information to investigating agents.” He is the first to be sentenced in the case and is expected to testify in the trial of other officers.
ProPublica, the Times-Picayune and PBS Frontline have been investigating the circumstances around the shooting of 10 unarmed civilians by NOPD in the days after Hurricane Katrina.
In addition to the Danziger Bridge case, the killings of Henry Glover, Danny Brumfield, and Matthew McDonald, and the shooting of Keenon McCann remain open federal investigations.
In August, in response to reports by ProPublica, the Times-Picayune and PBS Frontline, federal investigators also launched an inquiry into allegations that high-ranking officers in the NOPD gave orders authorizing police to shoot looters in the chaotic days after the hurricane .
In all, there are at least nine open federal investigations into misconduct by the NOPD, most dealing with incidents that took place after Katrina. So far, 16 NOPD officers have been charged. Another two have been charged in a case from July 2005.
— Sabrina Shankman, ProPublica
|
/**
* Generates a <code>Projection</code> to establish whether or not the
* history contains an <code>Attachment</code>
*/
public class HasAttachmentsProjectionProvider
implements ProjectionProvider {
/**
* JAVADOC Method Level Comments
*
* @param type JAVADOC.
* @param bean JAVADOC.
*/
@Override
public void provide(String type, SearchBean bean) {
bean.addProjection(new HasAttachmentsProjection(bean.getAliasByType().get(type), type));
}
}
|
def writeFace(self, val, what='f'):
val = [v + 1 for v in val]
if self._hasValues and self._hasNormals:
val = ' '.join(['%i/%i/%i' % (v, v, v) for v in val])
elif self._hasNormals:
val = ' '.join(['%i//%i' % (v, v) for v in val])
elif self._hasValues:
val = ' '.join(['%i/%i' % (v, v) for v in val])
else:
val = ' '.join(['%i' % v for v in val])
self.writeLine('%s %s' % (what, val))
|
use super::{
BallPositionConstraint, BallPositionGroundConstraint, FixedPositionConstraint,
FixedPositionGroundConstraint, PrismaticPositionConstraint, PrismaticPositionGroundConstraint,
};
#[cfg(feature = "dim3")]
use super::{RevolutePositionConstraint, RevolutePositionGroundConstraint};
#[cfg(all(feature = "dim3", feature = "simd-is-enabled"))]
use super::{WRevolutePositionConstraint, WRevolutePositionGroundConstraint};
#[cfg(feature = "simd-is-enabled")]
use super::{
WBallPositionConstraint, WBallPositionGroundConstraint, WFixedPositionConstraint,
WFixedPositionGroundConstraint, WPrismaticPositionConstraint,
WPrismaticPositionGroundConstraint,
};
use crate::dynamics::{IntegrationParameters, Joint, JointParams, RigidBodySet};
#[cfg(feature = "simd-is-enabled")]
use crate::math::SIMD_WIDTH;
use crate::math::{Isometry, Real};
pub(crate) enum AnyJointPositionConstraint {
BallJoint(BallPositionConstraint),
BallGroundConstraint(BallPositionGroundConstraint),
#[cfg(feature = "simd-is-enabled")]
WBallJoint(WBallPositionConstraint),
#[cfg(feature = "simd-is-enabled")]
WBallGroundConstraint(WBallPositionGroundConstraint),
FixedJoint(FixedPositionConstraint),
FixedGroundConstraint(FixedPositionGroundConstraint),
#[cfg(feature = "simd-is-enabled")]
WFixedJoint(WFixedPositionConstraint),
#[cfg(feature = "simd-is-enabled")]
WFixedGroundConstraint(WFixedPositionGroundConstraint),
// GenericJoint(GenericPositionConstraint),
// GenericGroundConstraint(GenericPositionGroundConstraint),
// #[cfg(feature = "simd-is-enabled")]
// WGenericJoint(WGenericPositionConstraint),
// #[cfg(feature = "simd-is-enabled")]
// WGenericGroundConstraint(WGenericPositionGroundConstraint),
PrismaticJoint(PrismaticPositionConstraint),
PrismaticGroundConstraint(PrismaticPositionGroundConstraint),
#[cfg(feature = "simd-is-enabled")]
WPrismaticJoint(WPrismaticPositionConstraint),
#[cfg(feature = "simd-is-enabled")]
WPrismaticGroundConstraint(WPrismaticPositionGroundConstraint),
#[cfg(feature = "dim3")]
RevoluteJoint(RevolutePositionConstraint),
#[cfg(feature = "dim3")]
RevoluteGroundConstraint(RevolutePositionGroundConstraint),
#[cfg(all(feature = "dim3", feature = "simd-is-enabled"))]
WRevoluteJoint(WRevolutePositionConstraint),
#[cfg(all(feature = "dim3", feature = "simd-is-enabled"))]
WRevoluteGroundConstraint(WRevolutePositionGroundConstraint),
#[allow(dead_code)] // The Empty variant is only used with parallel code.
Empty,
}
impl AnyJointPositionConstraint {
pub fn from_joint(joint: &Joint, bodies: &RigidBodySet) -> Self {
let rb1 = &bodies[joint.body1];
let rb2 = &bodies[joint.body2];
match &joint.params {
JointParams::BallJoint(p) => AnyJointPositionConstraint::BallJoint(
BallPositionConstraint::from_params(rb1, rb2, p),
),
JointParams::FixedJoint(p) => AnyJointPositionConstraint::FixedJoint(
FixedPositionConstraint::from_params(rb1, rb2, p),
),
// JointParams::GenericJoint(p) => AnyJointPositionConstraint::GenericJoint(
// GenericPositionConstraint::from_params(rb1, rb2, p),
// ),
JointParams::PrismaticJoint(p) => AnyJointPositionConstraint::PrismaticJoint(
PrismaticPositionConstraint::from_params(rb1, rb2, p),
),
#[cfg(feature = "dim3")]
JointParams::RevoluteJoint(p) => AnyJointPositionConstraint::RevoluteJoint(
RevolutePositionConstraint::from_params(rb1, rb2, p),
),
}
}
#[cfg(feature = "simd-is-enabled")]
pub fn from_wide_joint(joints: [&Joint; SIMD_WIDTH], bodies: &RigidBodySet) -> Self {
let rbs1 = array![|ii| &bodies[joints[ii].body1]; SIMD_WIDTH];
let rbs2 = array![|ii| &bodies[joints[ii].body2]; SIMD_WIDTH];
match &joints[0].params {
JointParams::BallJoint(_) => {
let joints = array![|ii| joints[ii].params.as_ball_joint().unwrap(); SIMD_WIDTH];
AnyJointPositionConstraint::WBallJoint(WBallPositionConstraint::from_params(
rbs1, rbs2, joints,
))
}
JointParams::FixedJoint(_) => {
let joints = array![|ii| joints[ii].params.as_fixed_joint().unwrap(); SIMD_WIDTH];
AnyJointPositionConstraint::WFixedJoint(WFixedPositionConstraint::from_params(
rbs1, rbs2, joints,
))
}
// JointParams::GenericJoint(_) => {
// let joints = array![|ii| joints[ii].params.as_generic_joint().unwrap(); SIMD_WIDTH];
// AnyJointPositionConstraint::WGenericJoint(WGenericPositionConstraint::from_params(
// rbs1, rbs2, joints,
// ))
// }
JointParams::PrismaticJoint(_) => {
let joints =
array![|ii| joints[ii].params.as_prismatic_joint().unwrap(); SIMD_WIDTH];
AnyJointPositionConstraint::WPrismaticJoint(
WPrismaticPositionConstraint::from_params(rbs1, rbs2, joints),
)
}
#[cfg(feature = "dim3")]
JointParams::RevoluteJoint(_) => {
let joints =
array![|ii| joints[ii].params.as_revolute_joint().unwrap(); SIMD_WIDTH];
AnyJointPositionConstraint::WRevoluteJoint(
WRevolutePositionConstraint::from_params(rbs1, rbs2, joints),
)
}
}
}
pub fn from_joint_ground(joint: &Joint, bodies: &RigidBodySet) -> Self {
let mut rb1 = &bodies[joint.body1];
let mut rb2 = &bodies[joint.body2];
let flipped = !rb2.is_dynamic();
if flipped {
std::mem::swap(&mut rb1, &mut rb2);
}
match &joint.params {
JointParams::BallJoint(p) => AnyJointPositionConstraint::BallGroundConstraint(
BallPositionGroundConstraint::from_params(rb1, rb2, p, flipped),
),
JointParams::FixedJoint(p) => AnyJointPositionConstraint::FixedGroundConstraint(
FixedPositionGroundConstraint::from_params(rb1, rb2, p, flipped),
),
// JointParams::GenericJoint(p) => AnyJointPositionConstraint::GenericGroundConstraint(
// GenericPositionGroundConstraint::from_params(rb1, rb2, p, flipped),
// ),
JointParams::PrismaticJoint(p) => {
AnyJointPositionConstraint::PrismaticGroundConstraint(
PrismaticPositionGroundConstraint::from_params(rb1, rb2, p, flipped),
)
}
#[cfg(feature = "dim3")]
JointParams::RevoluteJoint(p) => AnyJointPositionConstraint::RevoluteGroundConstraint(
RevolutePositionGroundConstraint::from_params(rb1, rb2, p, flipped),
),
}
}
#[cfg(feature = "simd-is-enabled")]
pub fn from_wide_joint_ground(joints: [&Joint; SIMD_WIDTH], bodies: &RigidBodySet) -> Self {
let mut rbs1 = array![|ii| &bodies[joints[ii].body1]; SIMD_WIDTH];
let mut rbs2 = array![|ii| &bodies[joints[ii].body2]; SIMD_WIDTH];
let mut flipped = [false; SIMD_WIDTH];
for ii in 0..SIMD_WIDTH {
if !rbs2[ii].is_dynamic() {
std::mem::swap(&mut rbs1[ii], &mut rbs2[ii]);
flipped[ii] = true;
}
}
match &joints[0].params {
JointParams::BallJoint(_) => {
let joints = array![|ii| joints[ii].params.as_ball_joint().unwrap(); SIMD_WIDTH];
AnyJointPositionConstraint::WBallGroundConstraint(
WBallPositionGroundConstraint::from_params(rbs1, rbs2, joints, flipped),
)
}
JointParams::FixedJoint(_) => {
let joints = array![|ii| joints[ii].params.as_fixed_joint().unwrap(); SIMD_WIDTH];
AnyJointPositionConstraint::WFixedGroundConstraint(
WFixedPositionGroundConstraint::from_params(rbs1, rbs2, joints, flipped),
)
}
// JointParams::GenericJoint(_) => {
// let joints = array![|ii| joints[ii].params.as_generic_joint().unwrap(); SIMD_WIDTH];
// AnyJointPositionConstraint::WGenericGroundConstraint(
// WGenericPositionGroundConstraint::from_params(rbs1, rbs2, joints, flipped),
// )
// }
JointParams::PrismaticJoint(_) => {
let joints =
array![|ii| joints[ii].params.as_prismatic_joint().unwrap(); SIMD_WIDTH];
AnyJointPositionConstraint::WPrismaticGroundConstraint(
WPrismaticPositionGroundConstraint::from_params(rbs1, rbs2, joints, flipped),
)
}
#[cfg(feature = "dim3")]
JointParams::RevoluteJoint(_) => {
let joints =
array![|ii| joints[ii].params.as_revolute_joint().unwrap(); SIMD_WIDTH];
AnyJointPositionConstraint::WRevoluteGroundConstraint(
WRevolutePositionGroundConstraint::from_params(rbs1, rbs2, joints, flipped),
)
}
}
}
pub fn solve(&self, params: &IntegrationParameters, positions: &mut [Isometry<Real>]) {
match self {
AnyJointPositionConstraint::BallJoint(c) => c.solve(params, positions),
AnyJointPositionConstraint::BallGroundConstraint(c) => c.solve(params, positions),
#[cfg(feature = "simd-is-enabled")]
AnyJointPositionConstraint::WBallJoint(c) => c.solve(params, positions),
#[cfg(feature = "simd-is-enabled")]
AnyJointPositionConstraint::WBallGroundConstraint(c) => c.solve(params, positions),
AnyJointPositionConstraint::FixedJoint(c) => c.solve(params, positions),
AnyJointPositionConstraint::FixedGroundConstraint(c) => c.solve(params, positions),
#[cfg(feature = "simd-is-enabled")]
AnyJointPositionConstraint::WFixedJoint(c) => c.solve(params, positions),
#[cfg(feature = "simd-is-enabled")]
AnyJointPositionConstraint::WFixedGroundConstraint(c) => c.solve(params, positions),
// AnyJointPositionConstraint::GenericJoint(c) => c.solve(params, positions),
// AnyJointPositionConstraint::GenericGroundConstraint(c) => c.solve(params, positions),
// #[cfg(feature = "simd-is-enabled")]
// AnyJointPositionConstraint::WGenericJoint(c) => c.solve(params, positions),
// #[cfg(feature = "simd-is-enabled")]
// AnyJointPositionConstraint::WGenericGroundConstraint(c) => c.solve(params, positions),
AnyJointPositionConstraint::PrismaticJoint(c) => c.solve(params, positions),
AnyJointPositionConstraint::PrismaticGroundConstraint(c) => c.solve(params, positions),
#[cfg(feature = "simd-is-enabled")]
AnyJointPositionConstraint::WPrismaticJoint(c) => c.solve(params, positions),
#[cfg(feature = "simd-is-enabled")]
AnyJointPositionConstraint::WPrismaticGroundConstraint(c) => c.solve(params, positions),
#[cfg(feature = "dim3")]
AnyJointPositionConstraint::RevoluteJoint(c) => c.solve(params, positions),
#[cfg(feature = "dim3")]
AnyJointPositionConstraint::RevoluteGroundConstraint(c) => c.solve(params, positions),
#[cfg(all(feature = "dim3", feature = "simd-is-enabled"))]
AnyJointPositionConstraint::WRevoluteJoint(c) => c.solve(params, positions),
#[cfg(all(feature = "dim3", feature = "simd-is-enabled"))]
AnyJointPositionConstraint::WRevoluteGroundConstraint(c) => c.solve(params, positions),
AnyJointPositionConstraint::Empty => unreachable!(),
}
}
}
|
module Exchange where
-- Type "Exchange" with value constructor "Euro/Real/Dollar"
data Exchange = Dollar | Euro | Real deriving Show
-- Type "Money" with value constructor "Money{value, cur}"
data Money = Money {value :: Double, cur :: Exchange} deriving Show
-- Function that receives a Money and convert it to Dollar unit
convertDollar :: Money -> Double
convertDollar (Money val Dollar) = val
convertDollar (Money val Euro) = val * 0.84
convertDollar (Money val Real) = val * 5.58
-- Function that receives a Money and convert it to Euro unit
convertEuro :: Money -> Double
convertEuro (Money val Euro) = val
convertEuro (Money val Dollar) = val * 1.19
convertEuro (Money val Real) = val * 6.63
-- Function that receives a Money and convert it to Real unit
convertReal :: Money -> Double
convertReal (Money val Real) = val
convertReal (Money val Dollar) = val * 0.18
convertReal (Money val Euro) = val * 0.15
-- Function that receives a list of Money and convert all to Real unit
convertAllReal :: [Money] -> [Double]
convertAllReal listMoney = [convertReal m | m <- listMoney]
maxCurrency :: [Money] -> Double
maxCurrency listCurrency = (maximum) [value m | m <- listCurrency]
|
#include<iostream>
#include<vector>
#include<cstring>
#define N 100010
using namespace std;
int n,k,ch=0;
int a[N],c[N];
vector<int> b[N],ans;
void dfs(int x)
{
if(c[x]==2)
return;
c[x]=1;
for(int i=0;i<b[x].size();i++)
{
int y=b[x][i];
if(c[y]==1)
{
ch=1;
return;
}
dfs(y);
}
c[x]=2;
ans.push_back(x);
}
int main()
{
int i;
cin>>n>>k;
for(i=0;i<k;i++)
{
cin>>a[i];
}
for(i=1;i<=n;i++)
{
int x;
cin>>x;
while(x--)
{
int v;
cin>>v;
b[i].push_back(v);
}
}
for(i=0;i<k;i++)
{
dfs(a[i]);
if(ch==1)
{
cout<<"-1";
return 0;
}
}
int l=ans.size();
cout<<l<<endl;
for(i=0;i<l;i++)
{
cout<<ans[i]<<" ";
}
}
|
#! /usr/bin/python
__author__="Guillermo Candia Huerta"
__date__ ="$24-05-2010 01:15:04 AM$"
def resolver( n, m, a):
b1 = (n/a)
b2 = (m/a)
rn = n%a
rm = m%a
b = b1 * b2
if rn != 0 and rm != 0: b += 1 + b1 + b2
if rn == 0 and rm != 0: b += b1
if rn != 0 and rm == 0: b += b2
return b
# rn = n % a
# rm = m % a
#
# if nn == 0 and nm == 0: return 1
# if nn == 0: return nm
# if nm == 0: return nn
#
# if rn == rm == 0: return nn * nm
# if rn == 0: return nn*nm+nm
# if nm == 0: return nn*nm+nn
#
# return nn*nm+nn+nm+1
if __name__ == "__main__":
n, m, a = map(int, raw_input().split())
b = resolver(n, m, a)
print str(b)
|
// NewWarningWriter returns an implementation of WarningHandler that outputs code 299 warnings to the specified writer.
func NewWarningWriter(out io.Writer, opts WarningWriterOptions) *warningWriter {
h := &warningWriter{out: out, opts: opts}
if opts.Deduplicate {
h.written = map[string]struct{}{}
}
return h
}
|
<gh_stars>1-10
//! Handler which replaces output by fixed data
//! it can be used e.g. to clear the sensitive data
//! `"secred_password"` -> `"***"
//!
//! # Example
//! ```
//! use streamson_lib::{handler, matcher, strategy::{self, Strategy}};
//! use std::sync::{Arc, Mutex};
//!
//! let handler = Arc::new(Mutex::new(handler::Replace::new(br#"***"#.to_vec())));
//! let matcher = matcher::Simple::new(r#"{"users"}[]{"password"}"#).unwrap();
//!
//! let mut convert = strategy::Convert::new();
//!
//! // Set the matcher for convert strategy
//! convert.add_matcher(Box::new(matcher), handler);
//!
//! for input in vec![
//! br#"{"users": [{"password": "<PASSWORD>", "name": "first"}, {"#.to_vec(),
//! br#""password": "<PASSWORD>", "name": "second}]}"#.to_vec(),
//! ] {
//! for converted_data in convert.process(&input).unwrap() {
//! println!("{:?}", converted_data);
//! }
//! }
//! ```
use super::Handler;
use crate::{error, path::Path, streamer::Token};
use std::{any::Any, str::FromStr};
/// Replace handler which converts matched data to fixed output
#[derive(Debug)]
pub struct Replace {
/// Data which will be returned instead of matched data
new_data: Vec<u8>,
}
impl Replace {
/// Creates a new handler which replaces matched data by fixed output
pub fn new(new_data: Vec<u8>) -> Self {
Self { new_data }
}
}
impl FromStr for Replace {
type Err = error::Handler;
fn from_str(input: &str) -> Result<Self, Self::Err> {
Ok(Self::new(input.to_string().into_bytes()))
}
}
impl Handler for Replace {
fn end(
&mut self,
_path: &Path,
_matcher_idx: usize,
_token: Token,
) -> Result<Option<Vec<u8>>, error::Handler> {
Ok(Some(self.new_data.clone()))
}
fn is_converter(&self) -> bool {
true
}
fn as_any(&self) -> &dyn Any {
self
}
}
|
//---------------------------------------------------------- -*- Mode: C++ -*-
// $Id: KfsWrite.cc 163 2008-09-21 20:06:37Z sriramsrao $
//
// Created 2006/10/02
// Author: <NAME>
//
// Copyright 2008 Quantcast Corp.
// Copyright 2006-2008 Kosmix Corp.
//
// This file is part of Kosmos File System (KFS).
//
// 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.
//
// All the code to deal with writes from the client.
//----------------------------------------------------------------------------
#include "KfsClient.h"
#include "KfsClientInt.h"
#include "common/properties.h"
#include "common/log.h"
#include "meta/kfstypes.h"
#include "libkfsIO/Checksum.h"
#include "Utils.h"
#include <cerrno>
#include <iostream>
#include <string>
using std::string;
using std::ostringstream;
using std::istringstream;
using std::min;
using std::max;
using std::cout;
using std::endl;
using namespace KFS;
static bool NeedToRetryWrite(int status)
{
return ((status == -EHOSTUNREACH) || (status == -ETIMEDOUT) || (status
== -KFS::EBADCKSUM) || (status == -KFS::ESERVERBUSY));
}
static bool NeedToRetryAllocation(int status)
{
return ((status == -EHOSTUNREACH) || (status == -ETIMEDOUT) || (status
== -EBUSY) || (status == -KFS::EBADVERS) || (status
== -KFS::EALLOCFAILED));
}
///
/// @brief 将numBytes的数据写入chunkserver
/// @note 不需要为数据分块,WriteToServer函数已经完成分块工作了
///
ssize_t KfsClientImpl::Write(int fd, const char *buf, size_t numBytes)
{
MutexLock l(&mMutex);
size_t nwrote = 0;
ssize_t numIO = 0;
int res;
if (!valid_fd(fd) || mFileTable[fd] == NULL || mFileTable[fd]->openMode
== O_RDONLY)
{
KFS_LOG_VA_INFO("Write to fd: %d failed---fd is likely closed", fd);
return -EBADF;
}
FileAttr *fa = FdAttr(fd);
if (fa->isDirectory)
return -EISDIR;
FilePosition *pos = FdPos(fd);
//
// Loop thru chunk after chunk until we write the desired #
// of bytes.
// 写数据到服务器,由WriteToServer决定,每次最多写入一个块
while (nwrote < numBytes)
{
size_t nleft = numBytes - nwrote;
// Don't need this: if we don't have the lease, don't
// know where the chunk is, allocation will get that info.
// LocateChunk(fd, pos->chunkNum);
// need to retry here...
// 为数据分配存储块,如果需要的话
if ((res = DoAllocation(fd)) < 0)
{
// allocation failed...bail
break;
}
// 指定默认chunkserver
if (pos->preferredServer == NULL)
{
numIO = OpenChunk(fd);
if (numIO < 0)
{
// KFS_LOG_VA_DEBUG("OpenChunk(%lld)", numIO);
break;
}
}
if (nleft < ChunkBuffer::BUF_SIZE || FdBuffer(fd)->dirty)
{
// either the write is small or there is some dirty
// data...so, aggregate as much as possible and then it'll
// get flushed
numIO = WriteToBuffer(fd, buf + nwrote, nleft);
}
else
{
// write is big and there is nothing dirty...so,
// write-thru
numIO = WriteToServer(fd, pos->chunkOffset, buf + nwrote, nleft);
}
if (numIO < 0)
{
string errstr = ErrorCodeToStr(numIO);
// KFS_LOG_VA_DEBUG("WriteToXXX:%s", errstr.c_str());
break;
}
nwrote += numIO;
numIO = Seek(fd, numIO, SEEK_CUR);
if (numIO < 0)
{
// KFS_LOG_VA_DEBUG("Seek(%lld)", numIO);
break;
}
}
if (nwrote == 0 && numIO < 0)
return numIO;
if (nwrote != numBytes)
{
KFS_LOG_VA_DEBUG("----Write done: asked: %llu, got: %llu-----",
numBytes, nwrote);
}
return nwrote;
}
///
/// @brief 将数据写入缓冲区,如果需要则同步一些数据
/// @note 每次最多写满一个缓冲区的数据
///
ssize_t KfsClientImpl::WriteToBuffer(int fd, const char *buf, size_t numBytes)
{
ssize_t numIO;
size_t lastByte;
FilePosition *pos = FdPos(fd);
ChunkBuffer *cb = FdBuffer(fd);
// if the buffer has dirty data and this write doesn't abut it,
// or if buffer is full, flush the buffer before proceeding.
// XXX: Reconsider buffering to do a read-modify-write of
// large amounts of data.
// 如果写入的数据位置与缓冲区位置不是相同的,并且缓冲区数据已经修改过了,这时需要同部服务器
if (cb->dirty && cb->chunkno != pos->chunkNum)
{
int status = FlushBuffer(fd);
if (status < 0)
return status;
}
// 为buffer分配内存
cb->allocate();
off_t start = pos->chunkOffset - cb->start;
size_t previous = cb->length;
// 如果缓冲区已满,并且需要同步数据
if (cb->dirty && ((start != (off_t) previous) || (previous
== ChunkBuffer::BUF_SIZE)))
{
int status = FlushBuffer(fd);
if (status < 0)
return status;
}
if (!cb->dirty)
{
cb->chunkno = pos->chunkNum;
cb->start = pos->chunkOffset;
cb->length = 0;
cb->dirty = true;
}
// ensure that write doesn't straddle chunk boundaries
numBytes = min(numBytes, (size_t)(KFS::CHUNKSIZE - pos->chunkOffset));
if (numBytes == 0)
return 0;
// max I/O we can do
numIO = min(ChunkBuffer::BUF_SIZE - cb->length, numBytes);
assert(numIO> 0);
// KFS_LOG_VA_DEBUG("Buffer absorbs write...%d bytes", numIO);
// chunkBuf[0] corresponds to some offset in the chunk,
// which is defined by chunkBufStart.
// chunkOffset corresponds to the position in the chunk
// where the "filepointer" is currently at.
// Figure out where the data we want copied into starts
start = pos->chunkOffset - cb->start;
assert(start >= 0 && start < (off_t) ChunkBuffer::BUF_SIZE);
memcpy(&cb->buf[start], buf, numIO);
lastByte = start + numIO;
// update the size according to where the last byte just
// got written.
if (lastByte > cb->length)
cb->length = lastByte;
return numIO;
}
///
/// @brief 将fd指定的文件的缓存同步到服务器上,并清空该缓存
///
ssize_t KfsClientImpl::FlushBuffer(int fd)
{
ssize_t numIO = 0;
ChunkBuffer *cb = FdBuffer(fd);
if (cb->dirty)
{
numIO = WriteToServer(fd, cb->start, cb->buf, cb->length);
if (numIO >= 0)
{
cb->dirty = false;
// we just flushed the buffer...so, there is no data in it
cb->length = 0;
}
}
return numIO;
}
///
/// @param [in] fd 文件描述符
/// @param [in] offset 在chunk内的偏移地址
/// @param [in] buf 要写入的数据
/// @param [in] 要传输的数据量
/// @note 每次写入的数据最多有一个块!!这个是由DoLargeWriteToServer这个函数决定的!\n
/// @note 在该版本中,DoLargeWriteToServer和DoSmallWriteToServer是同一个函数
///
ssize_t KfsClientImpl::WriteToServer(int fd, off_t offset, const char *buf,
size_t numBytes)
{
assert(KFS::CHUNKSIZE - offset >= 0);
// 最大可用字节数只可能是给定字节数或者最大字节数中较小的一个
size_t numAvail = min(numBytes, (size_t)(KFS::CHUNKSIZE - offset));
int res = 0;
for (int retryCount = 0; retryCount < NUM_RETRIES_PER_OP; retryCount++)
{
// Same as read: align writes to checksum block boundaries
// 如果写完之后,写入的数据不会跨过一个校验块,则直接写入数据到服务器
if (offset + numAvail <= OffsetToChecksumBlockEnd(offset))
{
res = DoSmallWriteToServer(fd, offset, buf, numBytes);
KFS_LOG_VA_INFO("Doing small write to server result: %d\n", res);
}
else
{
struct timeval startTime, endTime;
double timeTaken;
gettimeofday(&startTime, NULL);
res = DoLargeWriteToServer(fd, offset, buf, numBytes);
KFS_LOG_VA_INFO("Doing large write to server result: %d\n", res);
gettimeofday(&endTime, NULL);
timeTaken = (endTime.tv_sec - startTime.tv_sec) + (endTime.tv_usec
- startTime.tv_usec) * 1e-6;
if (timeTaken > 5.0)
{
KFS_LOG_VA_INFO("Writes thru chain for chunk %lld are taking: %.3f secs",
GetCurrChunk(fd)->chunkId, timeTaken);
}
KFS_LOG_VA_DEBUG("Total Time to write data to server(s): %.4f secs", timeTaken);
}
if (res >= 0)
break;
if ((res == -EHOSTUNREACH) || (res == -KFS::EBADVERS))
{
// one of the hosts is non-reachable (aka dead); so, wait
// and retry. Since one of the servers has a write-lease, we
// need to wait for the lease to expire before retrying.
Sleep(KFS::LEASE_INTERVAL_SECS);
}
if (res == -KFS::ELEASEEXPIRED)
{
ChunkAttr *chunk = GetCurrChunk(fd);
ServerLocation loc = chunk->chunkServerLoc[0];
KFS_LOG_VA_INFO("Server %s says lease expired for %lld.%lld ...re-doing allocation",
loc.ToString().c_str(), chunk->chunkId, chunk->chunkVersion);
Sleep(KFS::LEASE_INTERVAL_SECS / 2);
}
if ((res == -EHOSTUNREACH) || (res == -KFS::EBADVERS) || (res
== -KFS::ELEASEEXPIRED))
{
// save the value of res; in case we tried too many times
// and are giving up, we need the error to propogate
int r;
if ((r = DoAllocation(fd, true)) < 0)
return r;
continue;
}
if (res < 0)
{
// any other error
string errstr = ErrorCodeToStr(res);
KFS_LOG_VA_INFO("Write failed because of error: %s", errstr.c_str());
break;
}
}
return res;
}
///
/// @brief 为文件分配存储位置
/// @note 若force为真,则不论该块是否已经分配,都为之分配一个块
///
int KfsClientImpl::DoAllocation(int fd, bool force)
{
ChunkAttr *chunk = NULL;
FileAttr *fa = FdAttr(fd);
int res = 0;
if (IsCurrChunkAttrKnown(fd))
chunk = GetCurrChunk(fd);
// 如果force为真,则强制执行
if (chunk && force)
chunk->didAllocation = false;
if ((chunk == NULL) || (chunk->chunkId == (kfsChunkId_t) -1)
|| (!chunk->didAllocation))
{
// if we couldn't locate the chunk, it must be a new one.
// also, if it is an existing chunk, force an allocation
// if needed (which'll cause version # bumps, lease
// handouts etc).
for (uint8_t retryCount = 0; retryCount < NUM_RETRIES_PER_OP; retryCount++)
{
if (retryCount)
{
KFS_LOG_DEBUG("Allocation failed...will retry after a few secs");
if (res == -EBUSY)
// the metaserver says it can't get us a lease for
// the chunk. so, wait for a lease interval to
// expire and then retry
Sleep(KFS::LEASE_INTERVAL_SECS);
else
Sleep(RETRY_DELAY_SECS);
}
// 为fd分配存储位置
res = AllocChunk(fd);
if ((res >= 0) || (!NeedToRetryAllocation(res)))
{
break;
}
// allocation failed...retry
}
if (res < 0)
// allocation failed...bail
return res;
chunk = GetCurrChunk(fd);
assert(chunk != NULL);
chunk->didAllocation = true;
if (force)
{
KFS_LOG_VA_DEBUG("Forced allocation version: %lld",
chunk->chunkVersion);
}
// XXX: This is incorrect...you may double-count for
// allocations that occurred due to lease expirations.
++fa->chunkCount;
}
return 0;
}
#if 0
ssize_t
KfsClientImpl::DoSmallWriteToServer(int fd, off_t offset, const char *buf, size_t numBytes)
{
ssize_t numIO;
// 获取到文件当前读写位置的指针
FilePosition *pos = FdPos(fd);
// 获取当前文件指针所在chunk的chunk号
ChunkAttr *chunk = GetCurrChunk(fd);
// 生成写数据的命令,要写的数据也放入到命令当中
vector<WriteInfo> w;
WritePrepareOp op(nextSeq(), chunk->chunkId, chunk->chunkVersion);
// get the socket for the master
ServerLocation loc = chunk->chunkServerLoc[0];
TcpSocket *masterSock = pos->GetChunkServerSocket(loc);
op.offset = offset;
op.numBytes = min(numBytes, KFS::CHUNKSIZE);
op.AttachContentBuf(buf, numBytes);
op.contentLength = op.numBytes;
w.resize(chunk->chunkServerLoc.size());
// 向各个chunk服务器中写入数据,并向master发送同步命令
for (uint8_t retryCount = 0; retryCount < NUM_RETRIES_PER_OP; retryCount++)
{
if (retryCount)
{
KFS_LOG_VA_DEBUG("Will retry write after %d secs",
RETRY_DELAY_SECS);
Sleep(RETRY_DELAY_SECS);
op.seq = nextSeq();
}
for (uint32_t i = 0; i < chunk->chunkServerLoc.size(); i++)
{
// chunk是当前指针所在的chunk,所以s得到的是对应的chunkserver
ServerLocation l = chunk->chunkServerLoc[i];
TcpSocket *s = pos->GetChunkServerSocket(l);
assert(op.contentLength == op.numBytes);
numIO = DoOpCommon(&op, s);
w[i].serverLoc = l;
// 若操作成功,则记录主机名:端口 写操作序号
if (op.status == 0)
{
istringstream ist(op.writeIdStr);
ServerLocation loc;
int64_t id;
ist >> loc.hostname;
ist >> loc.port;
ist >> id;
w[i].writeId = id;
continue;
}
if (NeedToRetryWrite(op.status))
{
break;
}
w[i].writeId = -1;
}
// 如果在上边的操作中有一个需要重试,则进行重试操作
if (NeedToRetryWrite(op.status))
{
// do a retry
continue;
}
// 向master chunk server发送同步数据命令
WriteSyncOp cop(nextSeq(), chunk->chunkId, chunk->chunkVersion, w);
numIO = DoOpCommon(&cop, masterSock);
op.status = cop.status;
if (!NeedToRetryWrite(op.status))
{
break;
} // else ...retry
}
// op.status > 0,说明该chunk的大小应该括大了
if (op.status >= 0 && (off_t)chunk->chunkSize < offset + op.status)
{
// grow the chunksize only if we wrote past the last byte in the chunk
chunk->chunkSize = offset + op.status;
// if we wrote past the last byte of the file, then grow the
// file size. Note that, chunks 0..chunkNum-1 are assumed to
// be full. So, take the size of the last chunk and to that
// add the size of the "full" chunks to get the size
FileAttr *fa = FdAttr(fd);
off_t eow = chunk->chunkSize + (pos->chunkNum * KFS::CHUNKSIZE);
fa->fileSize = max(fa->fileSize, eow);
}
numIO = op.status;
op.ReleaseContentBuf();
if (numIO >= 0)
{
KFS_LOG_VA_DEBUG("Wrote to server (fd = %d), %lld bytes",
fd, numIO);
}
return numIO;
}
#endif
///
/// @note 小数据写和大数据写合并,用同一种方法
///
ssize_t KfsClientImpl::DoSmallWriteToServer(int fd, off_t offset,
const char *buf, size_t numBytes)
{
return DoLargeWriteToServer(fd, offset, buf, numBytes);
}
///
/// @brief 向文件末尾写入数据
/// @param [in] fd 文件描述符
/// @param [in] offset chunk内偏移
/// @return 返回写入的字节数目
/// @note 写入的数据只能小于或等于一个chunk的最大值
///
ssize_t KfsClientImpl::DoLargeWriteToServer(int fd, off_t offset,
const char *buf, size_t numBytes)
{
size_t numAvail, numWrote = 0;
ssize_t numIO;
FilePosition *pos = FdPos(fd); // 文件当前读写位置
ChunkAttr *chunk = GetCurrChunk(fd); // 文件当前chunk
// 指定master服务器为第一个服务器
ServerLocation loc = chunk->chunkServerLoc[0];
TcpSocket *masterSock = FdPos(fd)->GetChunkServerSocket(loc);
vector<WritePrepareOp *> ops; // 写操作
vector<WriteInfo> writeId;
assert(KFS::CHUNKSIZE - offset >= 0);
// 保证写入的数据不超过一个chunk的大小
numAvail = min(numBytes, (size_t)(KFS::CHUNKSIZE - offset));
// cout << "Pushing to server: " << offset << ' ' << numBytes << endl;
// get the write id
// 为每一个chunkserver分配一个写ID
numIO = AllocateWriteId(fd, offset, numBytes, writeId, masterSock);
if (numIO < 0)
{
KFS_LOG_VA_INFO("AllocateWriteId failed: %d", numIO);
return numIO;
}
// Split the write into a bunch of smaller ops
// 将写数据的操作按校验块分配成一个一个的小操作,存储在ops中;这样就可以形成一个
// 流水线操作方法,能够充分利用带宽
cout << " ### Start to write perpared Ops with write ID: " << numIO << endl;
while (numWrote < numAvail)
{
WritePrepareOp *op = new WritePrepareOp(nextSeq(), chunk->chunkId,
chunk->chunkVersion, writeId);
op->numBytes = min(MAX_BYTES_PER_WRITE_IO, numAvail - numWrote);
if ((op->numBytes % CHECKSUM_BLOCKSIZE) != 0)
{
// if the write isn't aligned to end on a checksum block
// boundary, then break the write into two parts:
//(1) start at offset and end on a checksum block boundary
//(2) is the rest, which is less than the size of checksum
//block
// This simplifies chunkserver code: either the writes are
// multiples of checksum blocks or a single write which is
// smaller than a checksum block.
if (op->numBytes > CHECKSUM_BLOCKSIZE)
op->numBytes = (op->numBytes / CHECKSUM_BLOCKSIZE)
* CHECKSUM_BLOCKSIZE;
// else case #2 from above comment and op->numBytes is setup right
}
assert(op->numBytes > 0);
op->offset = offset + numWrote;
// similar to read, breakup the write if it is straddling
// checksum block boundaries.
if (OffsetToChecksumBlockStart(op->offset) != op->offset)
{
op->numBytes = min((size_t)(OffsetToChecksumBlockEnd(op->offset)
- op->offset), op->numBytes);
}
op->AttachContentBuf(buf + numWrote, op->numBytes);
op->contentLength = op->numBytes;
op->checksum = ComputeBlockChecksum(op->contentBuf, op->contentLength);
// op->checksum = 0;
numWrote += op->numBytes;
ops.push_back(op);
}
// For pipelined data push to work, we break the write into a
// sequence of smaller ops and push them to the master; the master
// then forwards each op to one replica, who then forwards to
// next.
printf("\033[34m\033[1m" "Start to do pipelining!\n" "\033[0m");
for (int retryCount = 0; retryCount < NUM_RETRIES_PER_OP; retryCount++)
{
if (retryCount != 0)
{
// 若第一次写数据失败,则重新分配写序号,然后重试
KFS_LOG_VA_INFO("Will retry write after %d secs",
RETRY_DELAY_SECS);
Sleep(RETRY_DELAY_SECS);
KFS_LOG_DEBUG("Starting retry sequence...");
// get the write id
numIO = AllocateWriteId(fd, offset, numBytes, writeId, masterSock);
if (numIO < 0)
{
KFS_LOG_INFO("Allocate write id failed...retrying");
continue;
}
// for each op bump the sequence #
for (vector<WritePrepareOp *>::size_type i = 0; i < ops.size(); i++)
{
ops[i]->seq = nextSeq();
ops[i]->status = 0;
ops[i]->writeInfo = writeId;
assert(ops[i]->contentLength == ops[i]->numBytes);
}
}
// 将数据通过流水线发送给master服务器,并获取发送结果
printf("\033[34m\033[1m" "DoPipelinedWrite!\n" "\033[0m");
numIO = DoPipelinedWrite(fd, ops, masterSock);
cout << " ### " << "Doing pipelined write: " << numIO << endl;
assert(numIO != -KFS::EBADVERS);
if ((numIO == 0) || (numIO == -KFS::ELEASEEXPIRED))
{
// all good or the server lease expired; so, we have to
// redo the allocation and such
break;
}
if (NeedToRetryWrite(numIO) || (numIO == -EINVAL))
{
// retry; we can get an EINVAL if the server died in the
// midst of a push: after we got write-id and sent it
// data, it died and restarted; so, when we send commit,
// it doesn't know the write-id and returns an EINVAL
string errstr = ErrorCodeToStr(numIO);
KFS_LOG_VA_INFO("Retrying write because of error: %s", errstr.c_str());
continue;
}
if (numIO < 0)
{
KFS_LOG_VA_INFO("Write failed...chunk = %lld, version = %lld, offset = %lld, bytes = %lld",
ops[0]->chunkId, ops[0]->chunkVersion, ops[0]->offset,
ops[0]->numBytes);
assert(numIO != -EBADF);
break;
}
KFS_LOG_VA_INFO("Pipelined write did: %d", numIO);
}
//KFS_LOG_INFO("Start to do WritePerparedOps!");
printf("\033[34m\033[1m" "Start to do recycle Prepared Ops!\n" "\033[0m");
// figure out how much was committed
// 统计发送的数据量,并且清空已经发送了的数据缓存
numIO = 0;
for (vector<KfsOp *>::size_type i = 0; i < ops.size(); ++i)
{
WritePrepareOp *op = static_cast<WritePrepareOp *> (ops[i]);
if (op->status < 0)
{
cout << "Ops with no." << i << " failed: " << op->status << endl;
numIO = op->status;
}
else if (numIO >= 0)
{
numIO += op->status;
}
op->ReleaseContentBuf();
delete op;
}
cout << "Num of bytes wrote: " << numIO << endl;
KFS_LOG_INFO("Set the size of chunks!");
if (numIO >= 0 && (off_t) chunk->chunkSize < offset + numIO)
{
// grow the chunksize only if we wrote past the last byte in the chunk
chunk->chunkSize = offset + numIO;
// if we wrote past the last byte of the file, then grow the
// file size. Note that, chunks 0..chunkNum-1 are assumed to
// be full. So, take the size of the last chunk and to that
// add the size of the "full" chunks to get the size
FileAttr *fa = FdAttr(fd);
// 更新文件大小:我们假定当前写的块就是文件的最后一个块
off_t eow = chunk->chunkSize + (pos->chunkNum * KFS::CHUNKSIZE);
fa->fileSize = max(fa->fileSize, eow);
}
if (numIO != (ssize_t) numBytes)
{
KFS_LOG_VA_INFO("Wrote to server (fd = %d), %lld bytes, was asked %llu bytes",
fd, numIO, numBytes);
}
KFS_LOG_VA_INFO("Wrote to server (fd = %d), %lld bytes",
fd, numIO);
return numIO;
}
///
/// @brief 为该chunk的写数据分配写序号
/// @note 每一个chunk都要分配一个属于自己的序号,通过writeId返回
///
int KfsClientImpl::AllocateWriteId(int fd, off_t offset, size_t numBytes,
vector<WriteInfo> &writeId, TcpSocket *masterSock)
{
ChunkAttr *chunk = GetCurrChunk(fd); // 文件当前读写位置(所在的chunk)
WriteIdAllocOp op(nextSeq(), chunk->chunkId, chunk->chunkVersion, offset,
numBytes);
int res;
// 向master服务器请求写数据,这个请求中包含该chunk所有的拷贝的服务器地址
op.chunkServerLoc = chunk->chunkServerLoc;
res = DoOpSend(&op, masterSock);
if (res < 0)
return res;
if (op.status < 0)
return op.status;
// 接收服务器的回复
res = DoOpResponse(&op, masterSock);
if (res < 0)
return res;
if (op.status < 0)
return op.status;
// get rid of any old stuff
writeId.clear();
writeId.reserve(op.chunkServerLoc.size());
istringstream ist(op.writeIdStr);
for (uint32_t i = 0; i < chunk->chunkServerLoc.size(); i++)
{
ServerLocation loc;
int64_t id;
ist >> loc.hostname;
ist >> loc.port;
ist >> id;
cout << " ### Write ID: " << id << endl;
writeId.push_back(WriteInfo(loc, id));
}
return 0;
}
///
/// @brief 分别将数据发送到masterSock中
///
int KfsClientImpl::PushData(int fd, vector<WritePrepareOp *> &ops,
uint32_t start, uint32_t count, TcpSocket *masterSock)
{
uint32_t last = min((size_t)(start + count), ops.size());
int res = 0;
for (uint32_t i = start; i < last; i++)
{
cout << ops[i]->Show() << endl;
printf("\033[1m" "DoOpSend from PushData->masterSock\n" "\033[0m");
res = DoOpSend(ops[i], masterSock);
if (res < 0)
break;
}
return res;
}
///
/// @brief 向服务器发送写数据确认命令
///
int KfsClientImpl::SendCommit(int fd, vector<WriteInfo> &writeId,
TcpSocket *masterSock, WriteSyncOp &sop)
{
ChunkAttr *chunk = GetCurrChunk(fd);
int res = 0;
sop.Init(nextSeq(), chunk->chunkId, chunk->chunkVersion, writeId);
res = DoOpSend(&sop, masterSock);
if (res < 0)
return sop.status;
return 0;
}
int KfsClientImpl::GetCommitReply(WriteSyncOp &sop, TcpSocket *masterSock)
{
int res;
// 返回传输的数据量
res = DoOpResponse(&sop, masterSock);
if (res < 0)
return sop.status;
return sop.status;
}
///
/// @brief 发送一系列数据
/// @return 返回发送结果
/// @note 将数据分成更小的分组,每次发送一个分组的数据,同时发送第二个分组的数据,并对前一组\n
/// @note 进行确认; 如果一组数据失败,则所有发送均失败
///
int KfsClientImpl::DoPipelinedWrite(int fd, vector<WritePrepareOp *> &ops,
TcpSocket *masterSock)
{
int res;
vector<WritePrepareOp *>::size_type next, minOps;
WriteSyncOp syncOp[2];
if (ops.size() == 0)
{
return 0;
}
printf("\033[34m\033[1m" "There are %d ops to be done!\n" "\033[0m", ops.size());
// push the data to the server; to avoid bursting the server with
// a full chunk, do it in a pipelined fashion:
// -- send 512K of data; do a flush; send another 512K; do another flush
// -- every time we get an ack back, we send another 512K
//
// we got 2 commits: current is the one we just sent; previous is
// the one for which we are expecting a reply
int prevCommit = 0;
int currCommit = 1;
// 再将一系列的写操作分成不同的组,分别发送
minOps = min((size_t)(MIN_BYTES_PIPELINE_IO / MAX_BYTES_PER_WRITE_IO) / 2,
ops.size());
// 向服务器发送0到minOps这几个数据
printf("\033[34m\033[1m" "Start to push data to server!\n" "\033[0m");
res = PushData(fd, ops, 0, minOps, masterSock);
if (res < 0)
goto error_out;
// 发送确认请求,确认刚才的操作已经完成:确认是否所有的chunkserver都完成了这次操作
res = SendCommit(fd, ops[0]->writeInfo, masterSock, syncOp[0]);
if (res < 0)
goto error_out;
for (next = minOps; next < ops.size(); next += minOps)
{
res = PushData(fd, ops, next, minOps, masterSock);
if (res < 0)
goto error_out;
res = SendCommit(fd, ops[next]->writeInfo, masterSock,
syncOp[currCommit]);
if (res < 0)
goto error_out;
// 接收上一次发出的确认结果
res = GetCommitReply(syncOp[prevCommit], masterSock);
prevCommit = currCommit;
currCommit++;
currCommit %= 2;
// 上一次的发送失败,退出循环,对刚才发出的命令进行确认
if (res < 0)
// the commit for previous failed; there is still the
// business of getting the reply for the "current" one
// that we sent out.
break;
}
res = GetCommitReply(syncOp[prevCommit], masterSock);
error_out: if (res < 0)
{ // 找出错误信息
// res will be -1; we need to pick out the error from the op that failed
for (uint32_t i = 0; i < ops.size(); i++)
{
if (ops[i]->status < 0)
{
res = ops[i]->status;
break;
}
}
}
// 如果有错误出现,则所有的操作均标记为错误;否则,状态位标记成发送的字节数
// set the status for each op: either all were successful or none was.
for (uint32_t i = 0; i < ops.size(); i++)
{
if (res < 0)
ops[i]->status = res;
else
ops[i]->status = ops[i]->numBytes;
}
return res;
}
int KfsClientImpl::IssueCommit(int fd, vector<WriteInfo> &writeId,
TcpSocket *masterSock)
{
ChunkAttr *chunk = GetCurrChunk(fd);
WriteSyncOp sop(nextSeq(), chunk->chunkId, chunk->chunkVersion, writeId);
int res;
res = DoOpSend(&sop, masterSock);
if (res < 0)
return sop.status;
res = DoOpResponse(&sop, masterSock);
if (res < 0)
return sop.status;
return sop.status;
}
|
<filename>src/component/leaf/Button/Button.tsx
import React from "react";
import { Trans } from "react-i18next";
import { ReactNode } from "react-markdown";
export default class Button extends React.Component<{className?:string|(string|false)[],onInteract:()=>void,text:string,disabled?:boolean}> {
onInteract():void {
if (this.props.disabled) return;
this.props.onInteract();
}
onClick = (e:React.MouseEvent):void => this.onInteract();
onKeyPress = (e:React.KeyboardEvent):void => {
const { key } = e;
switch (key) {
case "Enter":
case " ":
this.onInteract();
break;
}
};
render():ReactNode {
const className = (typeof(this.props.className) === "string" ?
this.props.className :
this.props.className?.filter(v=>v!==false).map(v=>(v as string).trim()).join(" ")
)?.trim();
return (
<button className={className} onClick={this.onClick} onKeyPress={this.onKeyPress}
disabled={this.props.disabled}>
<Trans>{this.props.text}</Trans>
</button>
);
}
}
|
The Kingdom of Aksum (Tigrinya: ስልጣነ ኣኽሱም also known as the Kingdom of Axum, or the Aksumite Empire) was an ancient kingdom located in what is now Tigray Region (northern Ethiopia) and Eritrea.[2][3] Axumite Emperors were powerful sovereigns, styling themselves King of kings, king of Aksum, Himyar, Raydan, Saba, Salhen, Tsiyamo, Beja and of Kush.[4] Ruled by the Aksumites, it existed from approximately 100 AD to 940 AD. The polity was centered in the city of Axum and grew from the proto-Aksumite Iron Age period around the 4th century BC to achieve prominence by the 1st century AD. Aksum became a major player on the commercial route between the Roman Empire and Ancient India. The Aksumite rulers facilitated trade by minting their own Aksumite currency, with the state establishing its hegemony over the declining Kingdom of Kush. It also regularly entered the politics of the kingdoms on the Arabian Peninsula and eventually extended its rule over the region with the conquest of the Himyarite Kingdom. The Manichaei prophet Mani (died 274 AD) regarded Axum as one of the four great powers of his time, the others being Persia, Rome, and China.[2][5]
The Aksumites erected a number of monumental stelae, which served a religious purpose in pre-Christian times. One of these granite columns is the largest such structure in the world, at 90 feet.[6] Under Ezana (fl. 320–360) Aksum adopted Christianity. In the 7th century, early Muslims from Mecca sought refuge from Quraysh persecution by travelling to the kingdom, a journey known in Islamic history as the First Hijra.[7][8]
The kingdom's ancient capital, also called Axum, is now a town in Tigray Region (northern Ethiopia). The Kingdom used the name "Ethiopia" as early as the 4th century.[9][10] Tradition claims Axum as the alleged resting place of the Ark of the Covenant and the purported home of the Queen of Sheba.[11]
Historical records [ edit ]
Aksum is mentioned in the first-century AD Periplus of the Erythraean Sea as an important market place for the trade in ivory, which was exported throughout the ancient world. It states that the ruler of Aksum in the first century was Zoskales, who, besides ruling the kingdom, likewise controlled land near the Red Sea: Adulis (near Massawa) and lands through the highlands of present-day Eritrea. He is also said to have been familiar with Greek literature.
4. Below Ptolemais of the Hunts, at a distance of about three thousand stadia, there is Adulis, a port established by law, lying at the inner end of a bay that runs in toward the south. Before the harbor lies the so-called Mountain Island, about two hundred stadia seaward from the very head of the bay, with the shores of the mainland close to it on both sides. Ships bound for this port now anchor here because of attacks from the land. They used formerly to anchor at the very head of the bay, by an island called Diodorus, close to the shore, which could be reached on foot from the land; by which means the barbarous natives attacked the island. Opposite Mountain Island, on the mainland twenty stadia from shore, lies Adulis, a fair-sized village, from which there is a three-days' journey to Coloe, an inland town and the first market for ivory. From that place to the city of the people called Auxumites there is a five days' journey more; to that place all the ivory is brought from the country beyond the Nile through the district called Cyeneum, and thence to Adulis. Practically the whole number of elephants and rhinoceros that are killed live in the places inland, although at rare intervals they are hunted on the seacoast even near Adulis. Before the harbor of that market-town, out at sea on the right hand, there lie a great many little sandy islands called Alalaei, yielding tortoise-shell, which is brought to market there by the Fish-Eaters. ... 6. There are imported into these places, undressed cloth made in Egypt for the Berbers; robes from Arsinoe; cloaks of poor quality dyed in colors; double-fringed linen mantles; many articles of flint glass, and others of murrhine, made in Diospolis; and brass, which is used for ornament and in cut pieces instead of coin; sheets of soft copper, used for cooking-utensils and cut up for bracelets and anklets for the women; iron, which is made into spears used against the elephants and other wild beasts, and in their wars. Besides these, small axes are imported, and adzes and swords; copper drinking-cups, round and large; a little coin for those coming to the market; wine of Laodicea and Italy, not much; olive oil, not much; for the king, gold and silver plate made after the fashion of the country, and for clothing, military cloaks, and thin coats of skin, of no great value. Likewise from the district of Ariaca across this sea, there are imported Indian iron, and steel, and Indian cotton cloth; the broad cloth called monache and that called sagmatogene, and girdles, and coats of skin and mallow-colored cloth, and a few muslins, and colored lac. There are exported from these places ivory, and tortoiseshell and rhinoceros-horn. The most from Egypt is brought to this market from the month of January to September, that is, from Tybi to Thoth; but seasonably they put to sea about the month of September.[12]
History [ edit ]
Origins [ edit ]
Largely on the basis of Carlo Conti Rossini's theories and prolific work on Ethiopian history, Aksum was previously thought to have been founded by the Sabaeans, who spoke a language from the Semitic branch of the Afroasiatic language family. Evidence suggests that Semitic-speaking Aksumites semiticized the Agaw people, who originally spoke other Afroasiatic languages from the family's Cushitic branch, and had already established an independent civilisation in the territory before the arrival of the Sabaeans.[9][a][13]
An Axumite jar spout
Scholars like Stuart Munro-Hay thus point to the existence of an older kingdom known as D'mt, which flourished in the area between the tenth and fifth centuries BC, prior to the proposed Sabaean migration in the fourth or fifth century BC. They also cite evidence indicating that Sabaean settlers resided in the region for little more than a few decades.[9]
The Ge'ez language is no longer universally thought of, as previously assumed, to be an offshoot of Sabaean or Old South Arabian,[14] and there is some linguistic (though not written) evidence of Semitic languages being spoken in Eritrea and Ethiopia since approximately 2000 BC.[15] However, the Ge'ez script later replaced Epigraphic South Arabian in the Kingdom of Aksum.
Sabaean influence is now thought to have been minor, limited to a few localities, and disappearing after a few decades or a century, perhaps representing a trading or military colony in some sort of symbiosis or military alliance with the civilization of D'mt or some proto-Aksumite state.[9] Kitchen et al. (2009) argue that the Ethiopian Semitic languages were brought to the Ethiopian and Eritrean plateau from the Arabian Peninsula around 2850 years ago, an introduction that Ehret (1988) suggests was associated with the establishment of some of the first local complex societies.[16]
Over 95% of Aksum remains unexplored beneath the modern city, its surrounding area and central Ethiopia.
Empire [ edit ]
The Ezana Stone records negus Ezana's conversion to Christianity and his subjugation of various neighboring peoples, including Meroë
Axumite Menhir in Balaw Kalaw (Metera) near Senafe
The Kingdom of Aksum was a trading empire centered in Eritrea and northern Ethiopia.[17] It existed from approximately 100–940 AD, growing from the Iron Age proto-Aksumite period c. fourth century BC to achieve prominence by the first century AD.
According to the Book of Aksum, Aksum's first capital, Mazaber, was built by Itiyopis, son of Cush.[18] The capital was later moved to Axum in northern Ethiopia. The Kingdom used the name "Ethiopia" as early as the fourth century.[9][19]
The Empire of Aksum at its height at times extended across most of present-day Eritrea, Ethiopia, Somalia, Djibouti, Sudan, Egypt, Yemen and Saudi Arabia. The capital city of the empire was Aksum, now in northern Ethiopia. Today a smaller community, the city of Aksum was once a bustling metropolis, cultural and economic center. Two hills and two streams lie on the east and west expanses of the city; perhaps providing the initial impetus for settling this area. Along the hills and plain outside the city, the Aksumites had cemeteries with elaborate grave stones called stelee or obelisks. Other important cities included Yeha, Hawulti-Melazo, Matara, Adulis, and Qohaito, the last three of which are now in Eritrea. By the reign of Endubis in the late third century, it had begun minting its own currency and was named by Mani as one of the four great powers of his time along with the Sasanian Empire, Roman Empire, and "Three Kingdoms" China. The Aksumites adopted Christianity as its state religion in 325 or 328 under King Ezana, and was the first state ever to use the image of the cross on its coins.[20][21]
Around 330 AD, Ezana of Axum led his army into the Kingdom of Meroë, conquering and sacking the town itself. A large stone monument was left there, and the conquest is also related on Ezana Stone.[22]
Around 520, King Kaleb sent an expedition to Yemen against the Jewish Himyarite king Dhu Nuwas, who was persecuting the Christian community there. For nearly half a century south Arabia would become an Ethiopian protectorate under Abraha and his son Masruq[23]
Dhu Nuwas was deposed and killed and Kaleb appointed a Christian Himyarite, Esimiphaios ("Sumuafa Ashawa"), as his viceroy. However, around 525 this viceroy was deposed by the Aksumite general Abraha with support of Ethiopians who had settled in Yemen, and withheld tribute to Kaleb. When Kaleb sent another expedition against Abraha this force defected, killing their commander, and joining Abraha. Another expedition sent against them was defeated, leaving Yemen under Abraha's rule, although payment of a tribute resumed, where he continued to promote the Christian faith until his death.
After Abraha's death, his son Masruq Abraha continued the Axumite vice-royalty in Yemen, resuming payment of tribute to Axum. However, his half-brother Ma'd-Karib revolted. After being denied by Justinian, Ma'd-Karib sought help from Khosrow I, the Sassanid Persian Emperor, thus triggering the Abyssinian–Persian wars.
Khosrow who sent a small fleet and army under commander Vahrez to depose the current king of Yemen. The war culminated with the Siege of Sana'a, capital of Axumite Yemen. After its fall in 570, and Masruq death, Ma'd-Karib's son, Saif, was put on the throne. In 575, the war resumed again, after Saif was killed by Axumites. The Persian general Vahrez led another army of 8000, ending Axum rule in Yemen and becoming hereditary governor of Yemen.
According to Munro-Hay, these wars may have been Aksum's swan-song as a great power, with an overall weakening of Aksumite authority and over-expenditure in money and manpower.
According to Ethiopian traditions, Kaleb eventually abdicated and retired to a monastery. It is also possible that Ethiopia was affected by the Plague of Justinian around this time.[9]
14th century illustration showing the king of Aksum declining the request of a Meccan delegation to yield up the Muslims
Aksum, though weakened, remained a strong empire and trading power until the rise of Islam in the 7th century. However, unlike the relations between the Islamic powers and Christian Europe, Aksum (see Sahama), was on good terms with its Islamic neighbors and provided shelter to Muhammad's early followers around 615.[2][5] Nevertheless, as early as 640, Umar sent a naval expedition against Adulis, the Expedition of Alqammah bin Mujazziz, but it was eventually defeated.[24]
Aksumite naval power also declined throughout the period, though in 702 Aksumite pirates were able to invade the Hejaz and occupy Jeddah. In retaliation, however, Sulayman ibn Abd al-Malik was able to take the Dahlak Archipelago from Aksum, which became Muslim from that point on, though it later recovered in the ninth century and became a vassal to the Emperor of Ethiopia.[25]
Decline [ edit ]
Early 20th century copy of an Umayyad mural from Qusayr Amra , depicting a late Aksumite king (first half of the eight century).
Eventually, the Islamic Empire took control of the Red Sea and Egypt, pushing Aksum into economic isolation. Northwest of Aksum, in modern-day Sudan, the Christian states of Makuria and Alodia lasted till the 13th century before becoming Islamic. Aksum, isolated, nonetheless still remained Christian.[9]
After a second golden age in the early 6th century[9] the empire began to decline in the mid 6th century,[26] eventually ceasing its production of coins in the early 7th century. Around this same time, the Aksumite population was forced to go farther inland to the highlands for protection, abandoning Aksum as the capital. Arab writers of the time continued to describe Ethiopia (no longer referred to as Aksum) as an extensive and powerful state, though they had lost control of most of the coast and their tributaries. While land was lost in the north, it was gained in the south; and, though Ethiopia was no longer an economic power, it still attracted Arab merchants. The capital was moved to a new location, currently unknown, though it may have been called Ku'bar or Jarmi.[9]
Local history holds that, around 960, a Jewish Queen named Yodit (Judith) or "Gudit" defeated the empire and burned its churches and literature. While there is evidence of churches being burned and an invasion around this time, her existence has been questioned by some modern authors. Another possibility is that the Aksumite power was ended by a southern pagan queen named Bani al-Hamwiyah, possibly of the tribe al-Damutah or Damoti (Sidama). It is clear from contemporary sources that a female usurper did indeed rule the country at this time, and that her reign ended some time before 1003. After a short Dark Age, the Aksumite Empire was succeeded by the Agaw Zagwe dynasty in the 11th or 12th century (most likely around 1137), although limited in size and scope. However, Yekuno Amlak, who killed the last Zagwe king and founded the modern Solomonic dynasty around 1270 traced his ancestry and his right to rule from the last emperor of Aksum, Dil Na'od. It should be mentioned that the end of the Aksumite Empire didn't mean the end of Aksumite culture and traditions; for example, the architecture of the Zagwe dynasty at Lalibela and Yemrehana Krestos Church shows heavy Aksumite influence.[9]
Other reasons for the decline are more scientific in nature. Climate change and trade isolation are probably also large reasons for the decline of the culture. The local subsistence base was substantially augmented by a climatic shift during the 1st century AD that reinforced the spring rains, extended the rainy season from 3 1/2 to six or seven months, vastly improved the surface and subsurface water supply, doubled the length of the growing season, and created an environment comparable to that of modern central Ethiopia (where two crops can be grown per annum without the aid of irrigation). This appears to explain how one of the marginal agricultural environments of Ethiopia was able to support the demographic base that made this far flung commercial empire possible. It may also explain why no Aksumite rural settlement expansion into the moister, more fertile, and naturally productive lands of Begemder or Lasta can be verified during the heyday of Aksumite power. As international profits from the exchange network declined, Aksum lost its ability to control its own raw material sources and that network collapsed. The already persistent environmental pressure of a large population to maintain a high level of regional food production had to be intensified. The result was a wave of soil erosion that began on a local scale c. 650 and attained catastrophic proportions after 700. Presumably complex socio-economic inputs compounded the problem. These are traditionally reflected in declining maintenance, deterioration and partial abandonment of marginal crop land, shifts to destructive pastoral exploitation, and eventual, wholesale and irreversible land degradation. This syndrome was possibly accelerated by an apparent decline in rainfall reliability beginning 730–760, with the presumed result that an abbreviated modern growing season was reestablished during the 9th century.[27]
Foreign relations, trade, and economy [ edit ]
Aksum was an important participant in international trade from the 1st century AD ( Periplus of the Erythraean Sea ) until circa the later part of the 1st millennium when it succumbed to a long decline against pressures from the various Islamic powers leagued against it.
The economically important northern Silk Road and southern Spice (Eastern) trade routes. The sea routes around the horn of Africa and the Indian sub-continent made Aksum an important trading port for nearly a millennium.
Covering parts of what is now northern Ethiopia and southern and eastern Eritrea, Aksum was deeply involved in the trade network between India and the Mediterranean (Rome, later Byzantium), exporting ivory, tortoise shell, gold and emeralds, and importing silk and spices.[2][5] Aksum's access to both the Red Sea and the Upper Nile enabled its strong navy to profit in trade between various African (Nubia), Arabian (Yemen), and Indian states.
The main exports of Aksum were, as would be expected of a state during this time, agricultural products. The land was much more fertile during the time of the Aksumites than now, and their principal crops were grains such as wheat and barley. The people of Aksum also raised cattle, sheep, and camels. Wild animals were also hunted for things such as ivory and rhinoceros horns. They traded with Roman traders as well as with Egyptian and Persian merchants. The empire was also rich with gold and iron deposits. These metals were valuable to trade, but another mineral was also widely traded: salt. Salt was abundant in Aksum and was traded quite frequently.[28][8]
It benefited from a major transformation of the maritime trading system that linked the Roman Empire and India. This change took place around the start of the 1st century. The older trading system involved coastal sailing and many intermediary ports. The Red Sea was of secondary importance to the Persian Gulf and overland connections to the Levant. Starting around 100 BC a route from Egypt to India was established, making use of the Red Sea and using monsoon winds to cross the Arabian Sea directly to southern India. By about 100 AD, the volume of traffic being shipped on this route had eclipsed older routes. Roman demand for goods from southern India increased dramatically, resulting in greater number of large ships sailing down the Red Sea from Roman Egypt to the Arabian Sea and India.[29][30]
The Kingdom of Aksum was ideally located to take advantage of the new trading situation. Adulis soon became the main port for the export of African goods, such as ivory, incense, gold, slaves, and exotic animals. In order to supply such goods the kings of Aksum worked to develop and expand an inland trading network. A rival, and much older trading network that tapped the same interior region of Africa was that of the Kingdom of Kush, which had long supplied Egypt with African goods via the Nile corridor. By the 1st century AD, however, Aksum had gained control over territory previously Kushite. The Periplus of the Erythraean Sea explicitly describes how ivory collected in Kushite territory was being exported through the port of Adulis instead of being taken to Meroë, the capital of Kush. During the 2nd and 3rd centuries AD the Kingdom of Aksum continued to expand their control of the southern Red Sea basin. A caravan route to Egypt was established which bypassed the Nile corridor entirely. Aksum succeeded in becoming the principal supplier of African goods to the Roman Empire, not least as a result of the transformed Indian Ocean trading system.[32]
Society [ edit ]
The Aksumite population consisted of Semitic-speaking people (collectively known as Habeshas),[33][34][35] Cushitic-speaking people, and Nilo-Saharan-speaking people (the Kunama and Nara).
The Aksumite kings had the official title ነገሠ ፡ ነገሠተ ngś ngśt - King of Kings (later vocalization Ge'ez ንጉሠ ፡ ነገሥት nigūśa nagaśt, Modern Ethiosemitic nigūse negest).
Aksumites had a modified feudal system to farm the land.[20][21]
Culture [ edit ]
Ruins of Al–Qalis Church or Kaaba Abraha, cathedral built by Abraha in Sana'a between 527 and 560
.
The Empire of Aksum is notable for a number of achievements, such as its own alphabet, the Ge'ez script which was eventually modified to include vowels, becoming an abugida. Furthermore, in the early times of the empire, around 1700 years ago, giant Obelisks to mark emperors' (and nobles') tombs (underground grave chambers) were constructed, the most famous of which is the Obelisk of Aksum.
Under Emperor Ezana, Aksum adopted Christianity in place of its former polytheistic and Judaic religions around 325. This gave rise to the present day Ethiopian Orthodox Tewahedo Church (only granted autonomy from the Coptic Church in 1959), and Eritrean Orthodox Tewahdo Church (granted autonomy from the Ethiopian Orthodox church in 1993). Since the schism with orthodoxy following the Council of Chalcedon (451), it has been an important Miaphysite church, and its scriptures and liturgy continue to be in Ge'ez.[2][5]
Religion [ edit ]
Before its conversion to Christianity, the Aksumites practiced a polytheistic religion related to the religion practiced in southern Arabia. This included the use of the crescent-and-disc symbol used in southern Arabia and the northern horn.[36] In the UNESCO sponsored General History of Africa French archaeologist Francis Anfray, suggests that the pagan Aksumites worshipped Astar, his son, Mahrem, and Beher.[37]
Coins of king Endybis , 227–35 AD. British Museum . The left one reads ΑΞΩΜΙΤΩ BICIΔΑΧΥ, possily "man of Dachu, (king) of Axumites", linguistically mixed(?). The right one reads in Greek ΕΝΔΥΒΙC ΒΑCΙΛΕΥC, "King Endybis".
Steve Kaplan argues that with Aksumite culture came a major change in religion, with only Astar remaining of the old gods, the others being replaced by what he calls a "triad of indigenous divinities, Mahrem, Beher and Medr." He also suggests that Aksum culture was significantly influenced by Judaism, saying that "The first carriers of Judaism reached Ethiopia between the rise of the Aksumite kingdom at the beginning of the Common Era and conversion to Christianity of King Ezana in the fourth century." He believes that although Ethiopian tradition suggests that these were present in large numbers, that "A relatively small number of texts and individuals dwelling in the cultural, economic, and political center could have had a considerable impact." and that "their influence was diffused throughout Ethiopian culture in its formative period. By the time Christianity took hold in the fourth century, many of the originally Hebraic-Jewish elements had been adopted by much of the indigenous population and were no longer viewed as foreign characteristics. Nor were they perceived as in conflict with the acceptance of Christianity."[38]
Before converting to Christianity King Ezana II's coins and inscriptions show that he might have worshiped the gods Astar, Beher, Meder/Medr, and Mahrem. Another of Ezana's inscriptions is clearly Christian and refers to "the Father, the Son, and the Holy Spirit".[39] Around 324 AD the King Ezana II was converted to Christianity by his teacher Frumentius, the founder of the Ethiopian Orthodox Church.[40][8] Frumentius taught the emperor while he was young, and it is believed that at some point staged the conversion of the empire.[29][30] We know that the Aksumites converted to Christianity because in their coins they replaced the disc and crescent with the cross. Frumentius was in contact with the Church of Alexandria, and was appointed Bishop of Ethiopia around the year 330. The Church of Alexandria never closely managed the affairs of the churches in Aksum, allowing them to develop their own unique form of Christianity.[20][21] However, the Church of Alexandria probably did retain some influence considering that the churches of Aksum followed the Church of Alexandria into Oriental Orthodoxy by rejecting the Fourth Ecumenical Council of Chalcedon.[41] Aksum is also the alleged home of the holy relic the Ark of the Covenant. The Ark is said to have been placed in the Church of Our Lady Mary of Zion by Menelik I for safekeeping.[2][5]
Ethiopian sources [ edit ]
Ethiopian sources such as the Kebra Nagast and the Fetha Nagast[42][8] describe Aksum as a Jewish Kingdom. The Kebra Nagast contains a narrative of how the Queen of Sheba/Queen Makeda of Ethiopia met King Solomon and traces Ethiopia's to Menelik I, her son by King Solomon of Israel. In its existing form the Kebra Nagast is at least 700 years old and is considered by the Ethiopian Orthodox Tewahedo Church to be a reliable and historic work.
Coinage [ edit ]
The Empire of Aksum was one of the first African polities economically and politically ambitious enough to issue its own coins,[29][30] which bore legends in Ge'ez and Greek. From the reign of Endubis up to Armah (approximately 270 to 610), gold, silver and bronze coins were minted. Issuing coinage in ancient times was an act of great importance in itself, for it proclaimed that the Aksumite Empire considered itself equal to its neighbors. Many of the coins are used as signposts about what was happening when they were minted. An example being the addition of the cross to the coin after the conversion of the empire to Christianity. The presence of coins also simplified trade, and was at once a useful instrument of propaganda and a source of profit to the empire.
Architecture [ edit ]
Homely architecture [ edit ]
Ruins of the Dungur palace in Axum
In general, elite Aksumite buildings such as palaces were constructed atop podia built of loose stones held together with mud-mortar, with carefully cut granite corner blocks which rebated back a few centimeters at regular intervals as the wall got higher, so the walls narrowed as they rose higher. These podia are often all that survive of Aksumite ruins. Above the podia, walls were generally build with alternating layers of loose stone (often whitewashed, like at Yemrehana Krestos Church) and horizontal wooden beams, with smaller round wooden beams set in the stonework often projecting out of the walls (these are called 'monkey heads') on the exterior and sometimes the interior. Both the podia and the walls above exhibited no long straight stretches, but were indented at regular intervals so that any long walls consisted of a series of recesses and salients. This helped to strengthen the walls. Worked granite was used for architectural features including columns, bases, capitals, doors, windows, paving, water spouts (often shaped like lion heads) and so on, as well as enormous flights of stairs that often flanked the walls of palace pavilions on several sides. Doors and windows were usually framed by stone or wooden cross-members, linked at the corners by square 'monkey heads', though simple lintels were also used. Many of these Aksumite features are seen carved into the famous stelae as well as in the later rock hewn churches of Tigray and Lalibela.[9]
Palaces usually consisted of a central pavilion surrounded by subsidiary structures pierced by doors and gates that provided some privacy (see Dungur for an example). The largest of these structures now known is the Ta'akha Maryam, which measured 120 × 80m, though as its pavilion was smaller than others discovered it is likely that others were even larger.[9]
Some clay models of houses survive to give us an idea of what smaller dwellings were like. One depicts a round hut with a conical roof thatched in layers, while another depicts a rectangular house with rectangular doors and windows, a roof supported by beams that end in 'monkey heads', and a parapet and water spout on the roof. Both were found in Hawelti. Another depicts a square house with what appear to be layers of pitched thatch forming the roof.[9]
Stelae [ edit ]
The stelae (hawilt/hawilti in local languages) are perhaps the most identifiable part of the Aksumite architectural legacy. These stone towers served to mark graves and represent a magnificent multi-storied palace. They are decorated with false doors and windows in typical Aksumite design. The largest of these towering obelisks would measure 33 meters high had it not fractured. The Stelae have most of their mass out of the ground, but are stabilized by massive underground counter-weights. The stone was often engraved with a pattern or emblem denoting the king's or the noble's rank.[20][21]
In literature [ edit ]
The Aksumite Empire is portrayed as the main ally of Byzantium in the Belisarius series by David Drake and Eric Flint published by Baen Books. The series takes place during the reign of Kaleb, who in the series was assassinated by the Malwa in 532 at the Ta'akha Maryam and succeeded by his youngest son Eon bisi Dakuen.
In the Elizabeth Wein series The Lion Hunters, Mordred and his family take refuge in Aksum after the fall of Camelot. Kaleb is the ruler in the first book; he passes his sovereignty onto his son Gebre Meskal, who rules during the Plague of Justinian.
Gallery [ edit ]
Reconstruction of Dungur
The largest Aksumite stele, broken where it fell.
Aksumite-era Amphora from Asmara.
The Obelisk of Aksum after being returned to Ethiopia.
Model of the Ta'akha Maryam palace.
Aksumite water-spouts in the shape of lion heads.
Aksumite jar with figural spout.
Tombs beneath the stele field.
Entrance to the Tomb Of The False Door.
The Stelae Park in Aksum.
Small stelae in the Gudit Stelae Field
Another stelae field in Aksum.
A Zagwe church at Lalibela in a clear Aksumite style.
Aksumite gold coins.
Aksum stelle and ruins
Aksum stelle in desert
See also [ edit ]
Notes [ edit ]
^ [9] Munro-Hays explains, "Evidently the arrival of Sabaean influences does not represent the beginning of Ethiopian civilisation.... Semiticized Agaw peoples are thought to have migrated from south-eastern Eritrea possibly as early as 2000 BC, bringing their 'proto-Ethiopic' language, ancestor of Ge'ez and the other Ethiopian Semitic languages, with them; and these and other groups had already developed specific cultural and linguistic identities by the time any Sabaean influences arrived."
References [ edit ]
Further reading [ edit ]
Bausi, Alessandro (2018). "Translations in Late Antique Ethiopia" (PDF) . Egitto crocevia di traduzioni . EUT Edizioni Università di Trieste. 1 : 69–100. ISBN 978-88-8303-937-9.
Phillipson, David W. (1998). Ancient Ethiopia. Aksum: Its Antecedents and Successors . The British Museum Press. ISBN 0-7141-2763-9.
Yule (ed.), Paul A. (2013). Late Antique Arabia Ẓafār, Capital of Ḥimyar, Rehabilitation of a ‘Decadent’ Society, Excavations of the Ruprecht-Karls-Universität Heidelberg 1998–2010 in the Highlands of the Yemen. Abhandlungen Deutsche Orient-Gesellschaft, vol. 29, Wiesbaden, pp. 251-4. ISBN 978-3-447-06935-9.
|
<filename>spring-cloud-gray-server/src/main/java/cn/springcloud/gray/server/dao/repository/UserRepository.java<gh_stars>100-1000
package cn.springcloud.gray.server.dao.repository;
import cn.springcloud.gray.server.dao.model.UserDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;
@Repository
public interface UserRepository extends JpaRepository<UserDO, String>, JpaSpecificationExecutor<UserDO> {
UserDO findByAccount(String account);
}
|
/**
* Resolve the imports.
*
* @param resolver import resolver
*/
@Override
public void resolveImports(Consumer<TypeInfo> resolver) {
fields.forEach(f -> f.resolveImports(resolver));
methods.forEach(m -> m.resolveImports(resolver));
}
|
/**
* Get the current sample rate on the module.
*
* This assumes one entry in the scan list.
* This is a global setting for the module and effects all channels.
*
* @return Sample rate.
*/
float AnalogModule::GetSampleRate()
{
tRioStatusCode localStatus = NiFpga_Status_Success;
uint32_t ticksPerConversion = m_module->readLoopTiming(&localStatus);
wpi_setError(localStatus);
uint32_t ticksPerSample = ticksPerConversion * GetNumActiveChannels();
return (float)kTimebase / (float)ticksPerSample;
}
|
Interaction of tyrosine-based sorting signals with clathrin-associated proteins.
Tyrosine-based signals within the cytoplasmic domain of integral membrane proteins mediate clathrin-dependent protein sorting in the endocytic and secretory pathways. A yeast two-hybrid system was used to identify proteins that bind to tyrosine-based signals. The medium chains (mu 1 and mu 2) of two clathrin-associated protein complexes (AP-1 and AP-2, respectively) specifically interacted with tyrosine-based signals of several integral membrane proteins. The interaction was confirmed by in vitro binding assays. Thus, it is likely that the medium chains serve as signal-binding components of the clathrin-dependent sorting machinery.
|
/**
* Copyright (C) 2004-2014 the original author or authors. See the notice.md file distributed with
* this work for additional information regarding copyright ownership.
*
* 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 virtuozo.infra;
import java.util.Date;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
public enum DateFormat implements Format<Date> {
ABBR_DAY_OF_WEEK(DateTimeFormat.getFormat("ccccc")),
DATE_FULL(DateTimeFormat.getFormat(PredefinedFormat.DATE_FULL)),
DATE_LONG(DateTimeFormat.getFormat(PredefinedFormat.DATE_LONG)),
DATE_MEDIUM(DateTimeFormat.getFormat(PredefinedFormat.DATE_MEDIUM)),
DATE_SHORT(DateTimeFormat.getFormat(PredefinedFormat.DATE_SHORT)),
DATE_TIME_FULL(DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_FULL)),
DATE_TIME_LONG(DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_LONG)),
DATE_TIME_MEDIUM(DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_MEDIUM)),
DATE_TIME_SHORT(DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_SHORT)),
DAY(DateTimeFormat.getFormat(PredefinedFormat.DAY)),
HOUR24_MINUTE(DateTimeFormat.getFormat(PredefinedFormat.HOUR24_MINUTE)),
HOUR24_MINUTE_SECOND(DateTimeFormat.getFormat(PredefinedFormat.HOUR24_MINUTE_SECOND)),
MINUTE_SECOND(DateTimeFormat.getFormat(PredefinedFormat.MINUTE_SECOND)),
MONTH(DateTimeFormat.getFormat(PredefinedFormat.MONTH)),
MONTH_ABBR(DateTimeFormat.getFormat(PredefinedFormat.MONTH_ABBR)),
MONTH_ABBR_DAY(DateTimeFormat.getFormat(PredefinedFormat.MONTH_ABBR_DAY)),
MONTH_DAY(DateTimeFormat.getFormat(PredefinedFormat.MONTH_DAY)),
MONTH_NUM_DAY(DateTimeFormat.getFormat(PredefinedFormat.MONTH_NUM_DAY)),
MONTH_WEEKDAY_DAY(DateTimeFormat.getFormat(PredefinedFormat.MONTH_WEEKDAY_DAY)),
TIME_FULL(DateTimeFormat.getFormat(PredefinedFormat.TIME_FULL)),
TIME_LONG(DateTimeFormat.getFormat(PredefinedFormat.TIME_LONG)),
TIME_MEDIUM(DateTimeFormat.getFormat(PredefinedFormat.TIME_MEDIUM)),
TIME_SHORT(DateTimeFormat.getFormat(PredefinedFormat.TIME_SHORT)),
YEAR(DateTimeFormat.getFormat(PredefinedFormat.YEAR)),
YEAR_MONTH(DateTimeFormat.getFormat(PredefinedFormat.YEAR_MONTH)),
YEAR_MONTH_ABBR(DateTimeFormat.getFormat(PredefinedFormat.YEAR_MONTH_ABBR)),
YEAR_MONTH_ABBR_DAY(DateTimeFormat.getFormat(PredefinedFormat.YEAR_MONTH_ABBR_DAY)),
YEAR_MONTH_DAY(DateTimeFormat.getFormat(PredefinedFormat.YEAR_MONTH_DAY)),
YEAR_MONTH_NUM(DateTimeFormat.getFormat(PredefinedFormat.YEAR_MONTH_NUM)),
YEAR_MONTH_NUM_DAY(DateTimeFormat.getFormat(PredefinedFormat.YEAR_MONTH_NUM_DAY)),
YEAR_MONTH_WEEKDAY_DAY(DateTimeFormat.getFormat(PredefinedFormat.YEAR_MONTH_WEEKDAY_DAY)),
YEAR_QUARTER(DateTimeFormat.getFormat(PredefinedFormat.YEAR_QUARTER)),
YEAR_QUARTER_ABBR(DateTimeFormat.getFormat(PredefinedFormat.YEAR_QUARTER_ABBR)),
ISO_8601(DateTimeFormat.getFormat(PredefinedFormat.ISO_8601)),
ISO_8601_NO_TIMEZONE(DateTimeFormat.getFormat("yyyy-MM-dd'T'HH:mm:ss"));
private final DateTimeFormat wrapped;
private DateFormat(DateTimeFormat wrapped) {
this.wrapped = wrapped;
}
public Date unformat(String value) {
return SimpleValidator.isEmptyOrNull(value) ? null : this.wrapped.parseStrict(value);
}
public String format(Date value) {
return value == null ? null : this.wrapped.format(value);
}
public String pattern() {
return this.wrapped.getPattern();
}
}
|
import { DeviceEventEmitter } from 'react-native';
import HoneywellScanner from 'react-native-honeywell-scanner-v2';
const startReader = () => {
if (HoneywellScanner.isCompatible) {
return HoneywellScanner.startReader().then((claimed: any) => {
console.log(claimed ? 'Barcode reader is claimed' : 'Barcode reader is busy');
});
}
}
const stopReader = () => {
if (HoneywellScanner.isCompatible) {
return HoneywellScanner.stopReader();
}
}
const addListener = (fn: (receivedData: any) => void) => {
if (HoneywellScanner.isCompatible) {
HoneywellScanner.onBarcodeReadSuccess((event: any) => {
DeviceEventEmitter.emit('onScanReceive', { scanCode: event.data });
});
}
DeviceEventEmitter.addListener('onScanReceive', fn);
}
const removeListener = () => {
if (HoneywellScanner.isCompatible) {
HoneywellScanner.offBarcodeReadSuccess();
}
return DeviceEventEmitter.removeAllListeners('onScanReceive');
}
export { startReader, stopReader, addListener, removeListener }
|
<gh_stars>0
/************************************************************************
* *
* Copyright (C) 2012 OVSM/IPGP *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* This program is part of 'Projet TSUAREG - INTERREG IV Caraïbes'. *
* It has been co-financed by the European Union and le Ministère de *
* l'Ecologie, du Développement Durable, des Transports et du Logement. *
* *
************************************************************************/
#define SEISCOMP_COMPONENT Md
#include "md.h"
#include "l4c1hz.h"
#include <seiscomp3/processing/waveformprocessor.h>
#include <seiscomp3/math/filter/stalta.h>
#include <seiscomp3/math/filter/iirfilter.h>
#include <seiscomp3/math/filter/butterworth.h>
#include <seiscomp3/logging/log.h>
#include <seiscomp3/core/strings.h>
#include <seiscomp3/seismology/magnitudes.h>
#include <seiscomp3/math/mean.h>
#include <seiscomp3/math/filter/seismometers.h>
#include <seiscomp3/math/restitution/fft.h>
#include <seiscomp3/math/geo.h>
#include <iostream>
#include <boost/bind.hpp>
#include <unistd.h>
#define _DEPTH_MAX 200.0
#define _SIGNAL_WINDOW_END 30.0
#define _LINEAR_CORRECTION 1.0
#define _OFFSET 0.0
#define _SNR_MIN 1.2
#define _DELTA_MAX 400.0
#define _MD_MAX 5.0
#define _FMA -0.87
#define _FMB 2.0
#define _FMD 0.0035
#define _FMF 0.0
#define _FMZ 0.0
#define _STACOR 0.0 //! not fully implemented !
/**
* Seismometer selection
* 1 for Wood-Anderson
* 2 for Seismometer 5 sec
* 3 for WWSSN LP ? filter
* 4 for WWSSN SP? filter
* 5 for Generic Seismometer ? filter
* 6 for Butterworth Low Pass ? filter
* 7 for Butterwoth High Pass ? filter
* 8 for Butterworth Band Pass ? filter
* 9 for L4C 1Hz seismometer
**/
#define _SEISMO 9
#define _BUTTERWORTH ""
ADD_SC_PLUGIN("Md duration magnitude plugin", "IPGP <www.ipgp.fr>", 0, 1, 1)
#define AMPTAG "[Amp] [Md]"
#define MAGTAG "[Mag] [Md]"
using namespace Seiscomp;
using namespace Seiscomp::Math;
using namespace Seiscomp::Processing;
/*----[ AMPLITUDE PROCESSOR CLASS ]----*/
IMPLEMENT_SC_CLASS_DERIVED(AmplitudeProcessor_Md, AmplitudeProcessor, "AmplitudeProcessor_Md");
REGISTER_AMPLITUDEPROCESSOR(AmplitudeProcessor_Md, "Md");
struct ampConfig {
double DEPTH_MAX;
double SIGNAL_WINDOW_END;
double SNR_MIN;
double DELTA_MAX;
double MD_MAX;
double FMA;
double FMB;
double FMD;
double FMF;
double FMZ;
double STACOR;
int SEISMO;
std::string BUTTERWORTH;
};
ampConfig aFile;
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
AmplitudeProcessor_Md::AmplitudeProcessor_Md() :
AmplitudeProcessor("Md") {
setSignalStart(0.);
setSignalEnd(150.);
setMinSNR(aFile.SNR_MIN);
setMaxDist(8);
_computeAbsMax = true;
_isInitialized = false;
}
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
AmplitudeProcessor_Md::AmplitudeProcessor_Md(const Core::Time& trigger) :
AmplitudeProcessor(trigger, "Md") {
setSignalStart(0.);
setSignalEnd(150.);
setMinSNR(aFile.SNR_MIN);
setMaxDist(8);
_computeAbsMax = true;
_isInitialized = false;
computeTimeWindow();
}
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool AmplitudeProcessor_Md::setup(const Settings& settings) {
if ( !AmplitudeProcessor::setup(settings) )
return false;
bool isButterworth = false;
try {
aFile.SEISMO = settings.getInt("md.seismo");
std::string type;
switch ( aFile.SEISMO ) {
case 1:
type = "WoodAnderson";
break;
case 2:
type = "Seismo5sec";
break;
case 3:
type = "WWSSN LP";
break;
case 4:
type = "WWSSN SP";
break;
case 5:
type = "Generic Seismometer";
break;
case 6:
type = "Butterworth Low Pass";
isButterworth = true;
break;
case 7:
type = "Butterworth High Pass";
isButterworth = true;
break;
case 8:
type = "Butterworth Band Pass";
isButterworth = true;
break;
case 9:
type = "L4C 1Hz Seismometer";
break;
default:
break;
}
SEISCOMP_DEBUG("%s sets SEISMO to %s [%s.%s]", AMPTAG, type.c_str(),
settings.networkCode.c_str(), settings.stationCode.c_str());
}
catch ( ... ) {
aFile.SEISMO = _SEISMO;
SEISCOMP_ERROR("%s can not read SEISMO value from configuration file [%s.%s]", AMPTAG,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
if ( isButterworth == true ) {
try {
aFile.BUTTERWORTH = settings.getString("md.butterworth");
SEISCOMP_DEBUG("%s sets Butterworth filter to %s [%s.%s]", AMPTAG,
aFile.BUTTERWORTH.c_str(), settings.networkCode.c_str(),
settings.stationCode.c_str());
}
catch ( ... ) {
aFile.BUTTERWORTH = _BUTTERWORTH;
SEISCOMP_ERROR("%s can not read Butterworth filter value from configuration file [%s.%s]", AMPTAG,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
}
try {
aFile.DEPTH_MAX = settings.getDouble("md.depthmax");
SEISCOMP_DEBUG("%s sets DEPTH MAX to %.2f [%s.%s]", AMPTAG, aFile.DEPTH_MAX,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
catch ( ... ) {
aFile.DEPTH_MAX = _DEPTH_MAX;
SEISCOMP_ERROR("%s can not read DEPTH MAX value from configuration file [%s.%s]", AMPTAG,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
try {
aFile.DELTA_MAX = settings.getDouble("md.deltamax");
SEISCOMP_DEBUG("%s sets DELTA MAX to %.2f [%s.%s]", AMPTAG, aFile.DELTA_MAX,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
catch ( ... ) {
aFile.DELTA_MAX = _DELTA_MAX;
SEISCOMP_ERROR("%s can not read DELTA MAX value from configuration file [%s.%s]", AMPTAG,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
try {
aFile.SNR_MIN = settings.getDouble("md.snrmin");
SEISCOMP_DEBUG("%s sets SNR MIN to %.2f [%s.%s]", AMPTAG, aFile.SNR_MIN,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
catch ( ... ) {
aFile.SNR_MIN = _SNR_MIN;
SEISCOMP_ERROR("%s can not read SNR MIN value from configuration file [%s.%s]", AMPTAG,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
try {
aFile.MD_MAX = settings.getDouble("md.mdmax");
SEISCOMP_DEBUG("%s sets MD MAX to %.2f [%s.%s]", AMPTAG, aFile.MD_MAX,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
catch ( ... ) {
aFile.MD_MAX = _MD_MAX;
SEISCOMP_ERROR("%s can not read MD MAX value from configuration file [%s.%s]", AMPTAG,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
try {
aFile.FMA = settings.getDouble("md.fma");
SEISCOMP_DEBUG("%s sets FMA to %.4f [%s.%s]", AMPTAG, aFile.FMA,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
catch ( ... ) {
aFile.FMA = _FMA;
SEISCOMP_ERROR("%s can not read FMA value from configuration file [%s.%s]", AMPTAG,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
try {
aFile.FMB = settings.getDouble("md.fmb");
SEISCOMP_DEBUG("%s sets FMB to %.4f [%s.%s]", AMPTAG, aFile.FMB,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
catch ( ... ) {
aFile.FMB = _FMB;
SEISCOMP_ERROR("%s can not read FMB value from configuration file [%s.%s]", AMPTAG,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
try {
aFile.FMD = settings.getDouble("md.fmd");
SEISCOMP_DEBUG("%s sets FMD to %.4f [%s.%s]", AMPTAG, aFile.FMD,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
catch ( ... ) {
aFile.FMD = _FMD;
SEISCOMP_ERROR("%s can not read FMD value from configuration file [%s.%s]", AMPTAG,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
try {
aFile.FMF = settings.getDouble("md.fmf");
SEISCOMP_DEBUG("%s sets FMF to %.4f [%s.%s]", AMPTAG, aFile.FMF,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
catch ( ... ) {
aFile.FMF = _FMF;
SEISCOMP_ERROR("%s can not read FMF value from configuration file [%s.%s]", AMPTAG,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
try {
aFile.FMZ = settings.getDouble("md.fmz");
SEISCOMP_DEBUG("%s sets FMZ to %.4f [%s.%s]", AMPTAG, aFile.FMZ,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
catch ( ... ) {
aFile.FMZ = _FMZ;
SEISCOMP_ERROR("%s can not read FMZ value from configuration file [%s.%s]",
AMPTAG, settings.networkCode.c_str(), settings.stationCode.c_str());
}
_isInitialized = true;
return true;
}
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void AmplitudeProcessor_Md::initFilter(double fsamp) {
if ( !_enableResponses ) {
SEISCOMP_DEBUG("Using custom responses");
Math::Filtering::InPlaceFilter<double>* f;
switch ( aFile.SEISMO ) {
case 1:
AmplitudeProcessor::setFilter(new Filtering::IIR::WoodAndersonFilter<
double>(Velocity));
break;
case 2:
AmplitudeProcessor::setFilter(new Filtering::IIR::Seismometer5secFilter<
double>(Velocity));
break;
case 3:
AmplitudeProcessor::setFilter(new Filtering::IIR::WWSSN_LP_Filter<
double>(Velocity));
break;
case 4:
AmplitudeProcessor::setFilter(new Filtering::IIR::WWSSN_SP_Filter<
double>(Velocity));
break;
case 5:
AmplitudeProcessor::setFilter(new Filtering::IIR::GenericSeismometer<
double>(Velocity));
break;
case 6:
f = new Math::Filtering::IIR::ButterworthLowpass<double>(3, 1, 15);
AmplitudeProcessor::setFilter(f);
break;
case 7:
f = new Math::Filtering::IIR::ButterworthHighpass<double>(3, 1, 15);
AmplitudeProcessor::setFilter(f);
break;
case 8:
f = new Math::Filtering::IIR::ButterworthBandpass<double>(3, 1, 15, 1, true);
AmplitudeProcessor::setFilter(f);
break;
case 9:
AmplitudeProcessor::setFilter(new Filtering::IIR::L4C_1Hz_Filter<
double>(Velocity));
break;
default:
SEISCOMP_ERROR("%s can not initialize the chosen filter, "
"please review your configuration file", AMPTAG);
break;
}
}
else
AmplitudeProcessor::setFilter(NULL);
AmplitudeProcessor::initFilter(fsamp);
}
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
int AmplitudeProcessor_Md::capabilities() const {
return MeasureType;
}
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
AmplitudeProcessor::IDList
AmplitudeProcessor_Md::capabilityParameters(Capability cap) const {
if ( cap == MeasureType ) {
IDList params;
params.push_back("AbsMax");
params.push_back("MinMax");
return params;
}
return AmplitudeProcessor::capabilityParameters(cap);
}
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool AmplitudeProcessor_Md::setParameter(Capability cap,
const std::string& value) {
if ( cap == MeasureType ) {
if ( value == "AbsMax" ) {
_computeAbsMax = true;
return true;
}
else if ( value == "MinMax" ) {
_computeAbsMax = false;
return true;
}
return false;
}
return AmplitudeProcessor::setParameter(cap, value);
}
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool AmplitudeProcessor_Md::deconvolveData(Response* resp,
DoubleArray& data,
int numberOfIntegrations) {
if ( numberOfIntegrations < -1 )
return false;
SEISCOMP_DEBUG("Inside deconvolve function");
double m, n;
Math::Restitution::FFT::TransferFunctionPtr tf =
resp->getTransferFunction(numberOfIntegrations < 0 ? 0 : numberOfIntegrations);
if ( !tf )
return false;
Math::GroundMotion gm;
if ( numberOfIntegrations < 0 )
gm = Math::Displacement;
else
gm = Math::Velocity;
Math::Restitution::FFT::TransferFunctionPtr cascade;
Math::SeismometerResponse::WoodAnderson woodAndersonResp(gm);
Math::SeismometerResponse::Seismometer5sec seis5sResp(gm);
Math::SeismometerResponse::L4C_1Hz l4c1hzResp(gm);
Math::Restitution::FFT::PolesAndZeros woodAnderson(woodAndersonResp);
Math::Restitution::FFT::PolesAndZeros seis5sec(seis5sResp);
Math::Restitution::FFT::PolesAndZeros l4c1hz(l4c1hzResp);
SEISCOMP_DEBUG("SEISMO = %d", aFile.SEISMO);
switch ( aFile.SEISMO ) {
case 1:
cascade = *tf / woodAnderson;
break;
case 2:
cascade = *tf / seis5sec;
break;
case 9:
SEISCOMP_INFO("%s Applying filter L4C 1Hz to data", AMPTAG);
cascade = *tf / l4c1hz;
break;
default:
cascade = tf;
SEISCOMP_INFO("%s No seismometer specified, no signal reconvolution performed", AMPTAG);
return false;
break;
}
// Remove linear trend
Math::Statistics::computeLinearTrend(data.size(), data.typedData(), m, n);
Math::Statistics::detrend(data.size(), data.typedData(), m, n);
return Math::Restitution::transformFFT(data.size(), data.typedData(),
_stream.fsamp, cascade.get(), _config.respTaper, _config.respMinFreq,
_config.respMaxFreq);
}
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool AmplitudeProcessor_Md::computeAmplitude(const DoubleArray& data, size_t i1,
size_t i2, size_t si1, size_t si2,
double offset, AmplitudeIndex* dt,
AmplitudeValue* amplitude,
double* period, double* snr) {
double amax, Imax, ofs_sig, amp_sig;
DoubleArrayPtr d;
if ( *snr < aFile.SNR_MIN )
SEISCOMP_DEBUG("%s computed SNR is under configured SNR MIN", AMPTAG);
if ( _computeAbsMax ) {
size_t imax = find_absmax(data.size(), data.typedData(), si1, si2, offset);
amax = fabs(data[imax] - offset);
dt->index = imax;
}
else {
int lmin, lmax;
find_minmax(lmin, lmax, data.size(), data.typedData(), si1, si2, offset);
amax = data[lmax] - data[lmin];
dt->index = (lmin + lmax) * 0.5;
dt->begin = lmin - dt->index;
dt->end = lmax - dt->index;
}
Imax = dt->index;
SEISCOMP_DEBUG("%s Amplitude max: %.2f", AMPTAG, amax);
//! searching for Coda second by second through the end of the window
//! TODO: elevate accuracy by using a nanometers scale (maybe)
unsigned int i = si1;
bool hasEndSignal = false;
double calculatedSnr = -1;
for (i = (int) Imax; i < i2; i = i + 1 * (int) _stream.fsamp) {
int window_end = i + 1 * (int) _stream.fsamp;
d = static_cast<DoubleArray*>(data.slice(i, window_end));
//! computes pre-arrival offset
ofs_sig = d->median();
//! computes rms after removing offset
amp_sig = 2 * d->rms(ofs_sig);
if ( amp_sig / *_noiseAmplitude <= aFile.SNR_MIN ) {
SEISCOMP_DEBUG("%s End of signal found! (%.2f <= %.2f)", AMPTAG,
(amp_sig / *_noiseAmplitude), aFile.SNR_MIN);
hasEndSignal = true;
calculatedSnr = amp_sig / *_noiseAmplitude;
break;
}
}
if ( !hasEndSignal ) {
SEISCOMP_ERROR("%s SNR stayed over configured SNR_MIN! (%.2f > %.2f), "
"skipping magnitude calculation for this station", AMPTAG,
calculatedSnr, aFile.SNR_MIN);
return false;
}
dt->index = i;
//amplitude->value = 2 * amp_sig; //! actually it would have to be max. peak-to-peak
amplitude->value = amp_sig;
if ( _streamConfig[_usedComponent].gain != 0.0 )
amplitude->value /= _streamConfig[_usedComponent].gain;
else {
setStatus(MissingGain, 0.0);
return false;
}
// Convert m/s to nm/s
amplitude->value *= 1.E09;
*period = i - i1 + (_config.signalBegin * _stream.fsamp);
SEISCOMP_DEBUG("%s calculated event amplitude = %.2f", AMPTAG, amplitude->value);
SEISCOMP_DEBUG("%s calculated signal end at %.2f ms from P phase", AMPTAG, *period);
return true;
}
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
double AmplitudeProcessor_Md::timeWindowLength(double distance_deg) const {
if ( !_isInitialized ) {
aFile.MD_MAX = _MD_MAX;
aFile.FMA = _FMA;
aFile.FMZ = _FMZ;
aFile.DEPTH_MAX = _DEPTH_MAX;
aFile.STACOR = _STACOR;
aFile.FMD = _FMD;
aFile.FMB = _FMB;
aFile.FMF = _FMF;
aFile.SNR_MIN = _SNR_MIN;
aFile.DELTA_MAX = _DELTA_MAX;
aFile.SIGNAL_WINDOW_END = _SIGNAL_WINDOW_END;
aFile.SEISMO = _SEISMO;
aFile.BUTTERWORTH = _BUTTERWORTH;
}
double distance_km = Math::Geo::deg2km(distance_deg);
double windowLength = (aFile.MD_MAX - aFile.FMA - (aFile.FMZ * aFile.DEPTH_MAX)
- aFile.STACOR - (aFile.FMD * distance_km)) / (aFile.FMB + aFile.FMF);
windowLength = pow(10, windowLength) + aFile.SIGNAL_WINDOW_END;
SEISCOMP_DEBUG("%s Requesting stream of %.2fsec for current station", AMPTAG, windowLength);
return windowLength;
}
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
/*----[ END OF AMPLITUDE PROCESSOR CLASS ]----*/
/*----[ MAGNITUDE PROCESSOR CLASS ]----*/
IMPLEMENT_SC_CLASS_DERIVED(MagnitudeProcessor_Md, MagnitudeProcessor, "MagnitudeProcessor_Md");
REGISTER_MAGNITUDEPROCESSOR(MagnitudeProcessor_Md, "Md");
struct magConfig {
double DEPTH_MAX;
double LINEAR_CORRECTION;
double OFFSET;
double DELTA_MAX;
double MD_MAX;
double FMA;
double FMB;
double FMD;
double FMF;
double FMZ;
double STACOR;
};
magConfig mFile;
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
MagnitudeProcessor_Md::MagnitudeProcessor_Md() :
MagnitudeProcessor("Md") {
_linearCorrection = mFile.LINEAR_CORRECTION;
_constantCorrection = mFile.OFFSET;
}
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool MagnitudeProcessor_Md::setup(const Settings& settings) {
try {
mFile.DELTA_MAX = settings.getDouble("md.deltamax");
SEISCOMP_DEBUG("%s sets DELTA MAX to %.2f [%s.%s]", MAGTAG, mFile.DELTA_MAX,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
catch ( ... ) {
mFile.DELTA_MAX = _DELTA_MAX;
SEISCOMP_ERROR("%s can not read DELTA MAX value from configuration file [%s.%s]",
MAGTAG, settings.networkCode.c_str(), settings.stationCode.c_str());
}
try {
mFile.DEPTH_MAX = settings.getDouble("md.depthmax");
SEISCOMP_DEBUG("%s sets DEPTH MAX to %.2f [%s.%s]", MAGTAG, mFile.DEPTH_MAX,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
catch ( ... ) {
mFile.DEPTH_MAX = _DEPTH_MAX;
SEISCOMP_ERROR("%s can not read DEPTH MAX value from configuration file [%s.%s]",
MAGTAG, settings.networkCode.c_str(), settings.stationCode.c_str());
}
try {
mFile.MD_MAX = settings.getDouble("md.mdmax");
SEISCOMP_DEBUG("%s sets MD MAX to %.2f [%s.%s]", MAGTAG, mFile.MD_MAX,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
catch ( ... ) {
mFile.MD_MAX = _MD_MAX;
SEISCOMP_ERROR("%s can not read MD MAX value from configuration file [%s.%s]",
MAGTAG, settings.networkCode.c_str(), settings.stationCode.c_str());
}
try {
mFile.LINEAR_CORRECTION = settings.getDouble("md.linearcorrection");
SEISCOMP_DEBUG("%s sets LINEAR CORRECTION to %.2f [%s.%s]", MAGTAG,
mFile.LINEAR_CORRECTION, settings.networkCode.c_str(), settings.stationCode.c_str());
}
catch ( ... ) {
mFile.LINEAR_CORRECTION = _LINEAR_CORRECTION;
SEISCOMP_ERROR("%s can not read LINEAR CORRECTION value from configuration file [%s.%s]",
MAGTAG, settings.networkCode.c_str(), settings.stationCode.c_str());
}
try {
mFile.OFFSET = settings.getDouble("md.offset");
SEISCOMP_DEBUG("%s sets OFFSET to %.2f [%s.%s]", MAGTAG, mFile.OFFSET,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
catch ( ... ) {
mFile.OFFSET = _OFFSET;
SEISCOMP_ERROR("%s can not read OFFSET value from configuration file [%s.%s]",
MAGTAG, settings.networkCode.c_str(), settings.stationCode.c_str());
}
try {
mFile.FMA = settings.getDouble("md.fma");
SEISCOMP_DEBUG("%s sets FMA to %.4f [%s.%s]", MAGTAG, mFile.FMA,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
catch ( ... ) {
mFile.FMA = _FMA;
SEISCOMP_ERROR("%s can not read FMA value from configuration file [%s.%s]",
MAGTAG, settings.networkCode.c_str(), settings.stationCode.c_str());
}
try {
mFile.FMB = settings.getDouble("md.fmb");
SEISCOMP_DEBUG("%s sets FMB to %.4f [%s.%s]", MAGTAG, mFile.FMB,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
catch ( ... ) {
mFile.FMB = _FMB;
SEISCOMP_ERROR("%s can not read FMB value from configuration file [%s.%s]",
MAGTAG, settings.networkCode.c_str(), settings.stationCode.c_str());
}
try {
mFile.FMD = settings.getDouble("md.fmd");
SEISCOMP_DEBUG("%s sets FMD to %.4f [%s.%s]", MAGTAG, mFile.FMD,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
catch ( ... ) {
mFile.FMD = _FMD;
SEISCOMP_ERROR("%s can not read FMD value from configuration file [%s.%s]",
MAGTAG, settings.networkCode.c_str(), settings.stationCode.c_str());
}
try {
mFile.FMF = settings.getDouble("md.fmf");
SEISCOMP_DEBUG("%s sets FMF to %.4f [%s.%s]", MAGTAG, mFile.FMF,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
catch ( ... ) {
mFile.FMF = _FMF;
SEISCOMP_ERROR("%s can not read FMF value from configuration file [%s.%s]",
MAGTAG, settings.networkCode.c_str(), settings.stationCode.c_str());
}
try {
mFile.FMZ = settings.getDouble("md.fmz");
SEISCOMP_DEBUG("%s sets FMZ to %.4f [%s.%s]", MAGTAG, mFile.FMZ,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
catch ( ... ) {
mFile.FMZ = _FMZ;
SEISCOMP_ERROR("%s can not read FMZ value from configuration file [%s.%s]",
MAGTAG, settings.networkCode.c_str(), settings.stationCode.c_str());
}
try {
mFile.STACOR = settings.getDouble("md.stacor");
SEISCOMP_DEBUG("%s sets STACOR to %.4f [%s.%s]", MAGTAG, mFile.STACOR,
settings.networkCode.c_str(), settings.stationCode.c_str());
}
catch ( ... ) {
mFile.STACOR = _STACOR;
SEISCOMP_ERROR("%s can not read STACOR value from configuration file [%s.%s]",
MAGTAG, settings.networkCode.c_str(), settings.stationCode.c_str());
}
return true;
}
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
MagnitudeProcessor::Status
MagnitudeProcessor_Md::computeMagnitude(double amplitude, double period,
double delta, double depth,
double& value) {
double epdistkm;
epdistkm = Math::Geo::deg2km(delta);
SEISCOMP_DEBUG("%s --------------------------------", MAGTAG);
SEISCOMP_DEBUG("%s | PARAMETERS | VALUE |", MAGTAG);
SEISCOMP_DEBUG("%s --------------------------------", MAGTAG);
SEISCOMP_DEBUG("%s | delta max | %.2f ", MAGTAG, mFile.DELTA_MAX);
SEISCOMP_DEBUG("%s | depth max | %.2f ", MAGTAG, mFile.DEPTH_MAX);
SEISCOMP_DEBUG("%s | md max | %.2f ", MAGTAG, mFile.MD_MAX);
SEISCOMP_DEBUG("%s | fma | %.4f ", MAGTAG, mFile.FMA);
SEISCOMP_DEBUG("%s | fmb | %.4f ", MAGTAG, mFile.FMB);
SEISCOMP_DEBUG("%s | fmd | %.4f ", MAGTAG, mFile.FMD);
SEISCOMP_DEBUG("%s | fmf | %.4f ", MAGTAG, mFile.FMF);
SEISCOMP_DEBUG("%s | fmz | %.4f ", MAGTAG, mFile.FMZ);
SEISCOMP_DEBUG("%s | stacor | %.4f ", MAGTAG, mFile.STACOR);
SEISCOMP_DEBUG("%s --------------------------------", MAGTAG);
SEISCOMP_DEBUG("%s | (f-p) | %.2f sec ", MAGTAG, period);
SEISCOMP_DEBUG("%s | seismic depth | %.2f km ", MAGTAG, depth);
SEISCOMP_DEBUG("%s | epicenter dist | %.2f km ", MAGTAG, epdistkm);
SEISCOMP_DEBUG("%s --------------------------------", MAGTAG);
if ( amplitude <= 0. ) {
value = 0;
SEISCOMP_ERROR("%s calculated amplitude is wrong, "
"no magnitude will be calculated", MAGTAG);
return Error;
}
if ( (mFile.DELTA_MAX) < epdistkm ) {
SEISCOMP_ERROR("%s epicenter distance is out of configured range, "
"no magnitude will be calculated", MAGTAG);
return DistanceOutOfRange;
}
value = mFile.FMA + mFile.FMB * log10(period) + (mFile.FMF * period)
+ (mFile.FMD * epdistkm) + (mFile.FMZ * depth) + mFile.STACOR;
if ( value > mFile.MD_MAX )
SEISCOMP_WARNING("%s Calculated magnitude is beyond max Md value [value= %.2f]",
MAGTAG, value);
return OK;
}
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
/*----[ END OF MAGNITUDE PROCESSOR CLASS ]----*/
|
/**
* Create and register a new singleton instance of the ScanManager
* MBean in the given {@link MBeanServerConnection}.
* @param mbs The MBeanServer in which the new singleton instance
* should be created.
* @throws JMException The MBeanServer connection raised an exception
* while trying to instantiate and register the singleton MBean
* instance.
* @throws IOException There was a connection problem while trying to
* communicate with the underlying MBeanServer.
* @return A proxy for the registered MBean.
**/
public static ScanManagerMXBean register(MBeanServerConnection mbs)
throws IOException, JMException {
final ObjectInstance moi =
mbs.createMBean(ScanManager.class.getName(),SCAN_MANAGER_NAME);
final ScanManagerMXBean proxy =
JMX.newMXBeanProxy(mbs,moi.getObjectName(),
ScanManagerMXBean.class,true);
return proxy;
}
|
Policy wonks call it the “last mile” - the infrastructure needed to get high-speed internet down those long and sparsely populated country roads. It’s expensive, and private companies are unlikely to recoup that investment from just a couple of households.
And while Virginia’s candidates for governor agree something needs to be done, they don’t quite agree over how to fund it.
Mallory Noe-Payne has details.
Virginia’s chosen to deal with the last mile by paying for it itself. The state provides money to private internet companies, localities chip in, then the company can build the infrastructure needed to reach underserved areas. Hayes Framme is Deputy Secretary of Virginia’s Department of Commerce and Trade.
“It’s not investments for investments' sake,” he says “There is a goal here, there’s a why are we doing it. And the why are we doing it is because broadband -- you could argue -- is the new electricity. It is an economic necessity for all parts of the state.”
But funding is limited, only about a million dollars. The demand for that money far oustrips the supply. Both candidates for Governor agree there should be more, what they don’t agree on is where it should come from.
Related Coverage: Rural Broadband Competitors Come to the Table to Talk Last-Mile Solutions
Democrat Ralph Northam would allocate more tax money to those existing grant programs. Republican Ed Gillespie would loan money to localities, to build and own the infrastructure themselves. But Framme says there are a couple of challenges Virginia has faced in the past.
“Do (localities) want to own the infrastructure themselves, outright? And are the private providers willing to use a publicly owned infrastructure?” asks Framme.
Both candidates say they would keep working with private internet companies, and would continue existing projects to map which communities still need access.
Another challenge is organizing all the state’s efforts, which include projects in southside and southwest Virginia funded by the Virginia Tobacco Commission. Northam says he will point one point person in charge of everything, while Gillespie advocates distributing responsibilities among a few cabinet secretaries.
This report, provided by Virginia Public Radio, was made possible with support from the Virginia Education Association.
|
#include "bits/stdc++.h"
using namespace std;
int main(void) {
string s;
cin >> s;
int iend = s.size();
for(int i=0;i<iend;i++) {
s.pop_back();
if(s.size() % 2 == 0) {
if(s.substr(0,s.size()/2) == s.substr(s.size()/2, s.size()/2)) break;
}
}
cout << s.size() << endl;
}
|
A waning boom in U.S. crop prices will cut annual farm profits 27 percent this year from a record, potentially denting demand for Deere & Co. tractors and Monsanto Co. chemicals, the government said.
Agricultural net income will be $95.8 billion, down from a revised $130.5 billion last year, the U.S. Department of Agriculture said today in its first 2014 forecast. Income for major crops including corn, soybeans and wheat will be $189.4 billion, down 12 percent, while all expenses for feed, chemicals and other items will be $348.2 billion, down 11 percent.
Flat demand for corn to make ethanol and fewer exports to China may halt gains in farmland values after a 37 percent jump since 2009, leaving farmers with less to invest. The farm law President Barack Obama signed last week also will cut government spending on agriculture, further eroding profit.
“We’re looking at an era of about three, four, five, years of reduced profitability in agriculture,” Matthew Roberts, an economist at Ohio State University in Columbus, said before the report was released. Without significant disruptions to crop production, “by 2015, 2016, farms that expanded very rapidly over the last few years could be vulnerable, and we would see the first significant farm failures.”
The slump in the value of U.S. crops will erode prosperity in Corn Belt states, harming rural business and, if sustained, may lead to a wave of farm failures for the first time in a generation, Roberts said.
Livestock Revenue
In November, the department had estimated 2013 profit at a record $131 billion, and the most since 1973 when adjusted for inflation. About 2.6 million people worked on farms in 2012, according to the USDA, with another 13.9 million in food-related industries. The combined total equals 9.2 percent of the total U.S. workforce.
For 2014, livestock producers’ revenue will be $183.4 billion, up 0.7 percent from last year. Among farm expenses, animal feed, the biggest single cost, will be $52.1 billion, down 1 percent from 2013 because of the lower cost of corn. Seeds will cost $21.6 billion, up 1.5 percent.
Futures for corn, the most valuable U.S. crop, sold on the Chicago Board of Trade slumped 40 percent in 2013, the most since at least 1960, according to data compiled by Bloomberg. Soybeans, the No. 2 crop, fell 8.3 percent and wheat plunged 22 percent.
Lower Prices
Archer-Daniels-Midland Co. said lower corn prices prompt farmers to hold their crop, reducing profit because the company has less to ship, Chief Operating Officer Juan Ricardo Luciano said in a conference call last week.
Lower prices may cut tractor and combine production as much as 10 percent this quarter at Agco Corp., maker of Massey Ferguson products, Chief Executive Officer Martin Richenhagen said last week.
U.S. loans for farm machinery are at a two-year low, the Kansas City Federal Reserve said last month. Lower crop prices will make farmland less attractive to investors and discourage farmers from seeking financing, which may hurt purchases throughout rural areas, Nathan Kauffman, an economist with the Kansas City Fed, said in an interview last week.
For seed-seller Dave Kestel in Manhattan, Illinois, a drop in profit is evident. Customers who paid more to buy profitable corn now demand less expensive soybean seeds.
Tightening Belts
“Everyone is tightening their belts,” said Kestel, who sells DuPont Co. seeds while raising 1,200 acres of corn and soybeans about 60 miles southwest of Chicago. “We’ve had a windfall the past few years. Moving forward, it’s scary.”
Farmers produced a record 13.925 billion bushels of corn last year, the USDA said yesterday. Corn used for ethanol was 5 million bushels for the current year, little changed from three years ago. Farm goods sold to China may drop to $21.5 billion this year from $23.5 billion in 2013, the USDA said in December.
Government subsidies to agriculture will be $6.1 billion, down 45 percent from last year. The farm bill signed by Obama last week, hailed by farmer groups as a way to better target aid toward producers during times when they need it, probably won’t add much to profit this year, said Patrick Westhoff, an agricultural economist at the University of Missouri in Columbia.
The law ends a $5 billion annual crop subsidy and relies on subsidized federal crop insurance to guard against floods, drought, pests and other risks.
|
<gh_stars>0
"""
Module to select the most important features for a model.
"""
from typing import List
import logging
import pandas as pd
import shap
def select_features_with_shap(k: int, model, model_type: str, X: pd.DataFrame, y) -> List[str]:
"""
Select the most relevant features for the `model`.
This computes the shap values to see which features are more important.
Selects the features whose shap values have greater variance.
Args:
k (int): Number of features to select
model: Model that will be used to predict. Must implement scikit-learn API.
model_type (str): Type of the model. At the moment only ``'tree'`` is supported.
This includes decision trees, random-forests, and gradient boosting methods based on trees.
X (DataFrame): Features data.
y (array-like): Target variable data.
Returns:
List[str]: List with the names of the selected features.
Raises:
ValueError: If `k` is not positive.
If `model_type` is not correct.
"""
if k < 0:
raise ValueError("Number of features k must be positive")
if model_type not in ['tree']:
raise ValueError(f"model_type '{model_type}' is not currently supported")
model.fit(X, y) # train model
# compute shap values
explainer = shap.TreeExplainer(model)
shap_values = explainer.shap_values(X)
# select features with higher shap value variance
features_idx = (-shap_values.var(axis=0)).argsort()[:k]
feature_names = list(X.columns[features_idx])
logging.getLogger(__name__).info(f"'{k}' most imoprtant features selected")
return feature_names
|
import { initializeFocusRects } from './initializeFocusRects';
import { IsFocusHiddenClassName, IsFocusVisibleClassName, setFocusVisibility } from './setFocusVisibility';
import * as getWindow from './dom/getWindow';
describe('setFocusVisibility', () => {
let classNames: string[] = [];
// tslint:disable-next-line:no-any
const mockWindow: { [key: string]: any } = {
addEventListener: (name: string, callback: Function) => {
mockWindow[name] = callback;
},
document: {
body: {
classList: {
contains: (name: string) => classNames.indexOf(name) > -1,
add: (name: string) => classNames.indexOf(name) < 0 && classNames.push(name),
remove: (name: string) => classNames.indexOf(name) > -1 && classNames.splice(classNames.indexOf(name), 1),
toggle: (name: string, val: boolean) => {
const hasClass = classNames.indexOf(name) > -1;
if (hasClass !== val) {
if (hasClass) {
classNames.splice(classNames.indexOf(name), 1);
} else {
classNames.push(name);
}
}
}
}
}
}
};
const mockTarget = {
ownerDocument: {
defaultView: mockWindow
}
};
beforeEach(() => {
spyOn(getWindow, 'getWindow').and.returnValue(mockWindow);
classNames = [];
// tslint:disable-next-line:deprecation
initializeFocusRects(mockWindow as Window);
});
it('hints to show focus', () => {
setFocusVisibility(true);
expect(classNames.indexOf(IsFocusHiddenClassName) > -1).toEqual(false);
expect(classNames.indexOf(IsFocusVisibleClassName) > -1).toEqual(true);
});
it('hints to hide focus', () => {
setFocusVisibility(true);
expect(classNames.indexOf(IsFocusHiddenClassName) > -1).toEqual(false);
expect(classNames.indexOf(IsFocusVisibleClassName) > -1).toEqual(true);
setFocusVisibility(false);
expect(classNames.indexOf(IsFocusHiddenClassName) > -1).toEqual(true);
expect(classNames.indexOf(IsFocusVisibleClassName) > -1).toEqual(false);
});
it('hints to show focus with target specified', () => {
setFocusVisibility(true, mockTarget as Element);
expect(classNames.indexOf(IsFocusHiddenClassName) > -1).toEqual(false);
expect(classNames.indexOf(IsFocusVisibleClassName) > -1).toEqual(true);
});
it('hints to hide focus with target specified', () => {
setFocusVisibility(true, mockTarget as Element);
expect(classNames.indexOf(IsFocusHiddenClassName) > -1).toEqual(false);
expect(classNames.indexOf(IsFocusVisibleClassName) > -1).toEqual(true);
setFocusVisibility(false, mockTarget as Element);
expect(classNames.indexOf(IsFocusHiddenClassName) > -1).toEqual(true);
expect(classNames.indexOf(IsFocusVisibleClassName) > -1).toEqual(false);
});
});
|
Endoscopic reversal of vertical banded gastroplasty: a novel use of electroincision.
Vertical banded gastroplasty (VBG) was introduced in 1982 as a restrictive form of weight loss surgery through the creation of a pouch using a vertical staple line and outlet restriction with a silastic band . However, the popularity of VBG has waned due to high adverse event rates and the need for surgical revision . We present the case of an endoscopic reversal of a VBG using electroincision (▶Video 1). A 49-year-old woman with a history of VBG presented with nausea, episodic vomiting, and dysphagia. A computed tomography scan revealed no signs of obstruction (▶Fig. 1). Upper endoscopy demonstrated a large gastrogastric fistula at the staple line with the silastic band eroding into the lumen (▶Fig. 2). Between the gastrogastric fistula and the eroded band, there was a septum of gastric tissue. The tissue pedicles holding the silastic band were incised using a endoscopic submucosal dissection knife, and the band was removed (▶Fig. 3 a). The decision was made to reverse the VBG given the patient’s symptoms and that the size of the gastrogastric fistula precluded successful endoscopic closure. The gastric septum was then divided (▶Fig. 3b). Hemoclips were placed in areas of mild bleeding. Repeat endoscopic examination 2 months later revealed a healed resection site with complete reversal of her prior VBG anatomy (▶Fig. 4). The patient had complete resolution of all symptoms. VBGs are associated with high rates of long-term failure due to band erosions, gastric outlet stenosis, and inadequate weight loss . Specifically, band erosions may occur after 1%–3% of VBGs . Methods for removal of eroded bands include the use of Nd:YAG laser, electroincision, and electrosurgical scissors . In our case, we used electroincision to remove the eroded band and also reverse the VBG, resulting in durable symptom control. In conclusion, endoscopic reversal of VBG can be considered in patients with similar presentations.
|
/// take draw function F and draw screen with it
pub fn draw_screen(
&self,
mut drawer: impl FnMut(Positioned<Tile>) -> GameResult<()>,
) -> GameResult<()> {
// floor => item & character
self.dungeon.draw(&mut drawer)?;
self.dungeon.draw_ranges().into_iter().try_for_each(|path| {
let cd = self.dungeon.path_to_cd(&path);
if self.player.pos == path {
return drawer(Positioned(cd, self.player.tile()));
};
if let Some(item) = self.dungeon.get_item(&path) {
return drawer(Positioned(cd, item.tile()));
}
if let Some(enemy) = self.enemies.get_enemy(&path) {
if self.dungeon.draw_enemy(&self.player.pos, &path) {
return drawer(Positioned(cd, enemy.tile()));
}
}
Ok(())
})
}
|
NEW YORK (AP) — The U.S. television audience plummeted for the World Cup draw without the presence of the Americans in the 32-nation field.
English-language coverage Friday on Fox’s FS1 averaged 65,000 viewers from 10-11:05 a.m. EST, down 87 percent from a record average of 489,000 for the 2014 draw televised by ESPN2 from 11:30 a.m.-1:30 p.m. EST on Dec. 6, 2013.
U.S. English-language viewers for the draw four years ago topped the previous high of 364,000 on Dec. 19, 1993, for the 1994 World Cup, the first in the United States.
Spanish-language coverage on Telemundo and Universo, both owned by NBCUniversal, averaged 300,000 viewers, down 70 percent from 1 million in 2013 on Univision. The networks said 273,000 tuned in on Telemundo and 27,000 on Universo.
The Americans’ streak of seven World Cup appearances ended when the U.S. was eliminated with a 2-1 loss in October at Trinidad and Tobago.
Next year’s World Cup final appears headed for a television conflict. The July 15 game in Moscow is scheduled for be televised by Fox starting at 6 p.m. local time, which is 11 a.m. EDT. Earlier this week, the All-England Club said the men’s singles final of Wimbledon on the same day will keep its traditional start time of 2 p.m. in London, which is 9 a.m. EDT. The tennis will be broadcast in the U.S. by ESPN.
“We face competition every day, and it’s not uncommon for even a top-shelf event to sometimes face a circumstance like this,” Burke Magnus, ESPN’s executive vice president of programming and scheduling, said in a statement.
|
/// Initializes a new XIdleHookClient for a socket at the given path.
pub fn new<P: AsRef<Path>>(path: P) -> Result<Self, io::Error> {
let stream = UnixStream::connect(path)?;
Ok(XIdleHookClient { stream })
}
|
Series-Connected Hybrid Outsert Coil Winding Hardware Design
The National High Magnetic Field Laboratory (NHMFL) has designed and is constructing a Series-Connected Hybrid (SCH) magnet system in Tallahassee, FL. Before the construction of the magnet system can begin many obstacles have to be solved through hardware design and winding practices. The hardware has to have the strength to handle the stresses of winding as well as retaining maximum functionality. The NHMFL will overcome these issues by running several analysis calculations and by producing three model coils for practicing functionality. Two model coils have been built and necessary changes to design and winding procedures have occurred through the practices. These changes will be presented and have been implemented into our winding procedures.
|
// append a new node at the end not for this lab
public void append ( any newData){
Node newNode = new Node(newData, null);
if (head == null) {
head = newNode;
return;
}
Node last = head;
while (last.next != null)
last = last.next;
last.next = newNode;
return;
}
|
from subprocess import check_output
import sys
import re
#Small script for auto-generating provider functionality from help command
data = check_output(["multipass", "help"]).decode(sys.stdout.encoding)
options = data.split("Available commands:")[1].strip()
command_info = re.split("\s{2,}", options)
commands = [c for c in command_info if " " not in c]
with open("providerBody.py", 'w') as f:
for command in commands:
f_body = f"""
def {command}(self):
os.system("multipass {command}")
"""
f.write(f_body)
|
<gh_stars>1-10
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.01.0622 */
/* @@MIDL_FILE_HEADING( ) */
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 500
#endif
/* verify that the <rpcsal.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCSAL_H_VERSION__
#define __REQUIRED_RPCSAL_H_VERSION__ 100
#endif
#include "rpc.h"
#include "rpcndr.h"
#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif /* __RPCNDR_H_VERSION__ */
#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
#ifndef __windows2Edevices2Ehaptics_h__
#define __windows2Edevices2Ehaptics_h__
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
/* Forward Declarations */
#ifndef ____FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_FWD_DEFINED__
#define ____FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_FWD_DEFINED__
typedef interface __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback;
#endif /* ____FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_FWD_DEFINED__ */
#ifndef ____FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_FWD_DEFINED__
#define ____FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_FWD_DEFINED__
typedef interface __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback;
#endif /* ____FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_FWD_DEFINED__ */
#ifndef ____FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__
#define ____FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__
typedef interface __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice;
#endif /* ____FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__ */
#ifndef ____FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__
#define ____FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__
typedef interface __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice;
#endif /* ____FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__ */
#ifndef ____FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_FWD_DEFINED__
#define ____FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_FWD_DEFINED__
typedef interface __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback;
#endif /* ____FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_FWD_DEFINED__ */
#ifndef ____FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__
#define ____FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__
typedef interface __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice;
#endif /* ____FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__ */
#ifndef ____FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_FWD_DEFINED__
#define ____FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_FWD_DEFINED__
typedef interface __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus;
#endif /* ____FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_FWD_DEFINED__ */
#ifndef ____FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_FWD_DEFINED__
#define ____FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_FWD_DEFINED__
typedef interface __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus;
#endif /* ____FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_FWD_DEFINED__ */
#ifndef ____FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__
#define ____FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__
typedef interface __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice;
#endif /* ____FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__ */
#ifndef ____FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__
#define ____FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__
typedef interface __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice;
#endif /* ____FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__ */
#ifndef ____FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__
#define ____FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__
typedef interface __FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice __FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice;
#endif /* ____FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__ */
#ifndef ____FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__
#define ____FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__
typedef interface __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice;
#endif /* ____FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__ */
#ifndef ____x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics_FWD_DEFINED__
#define ____x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics_FWD_DEFINED__
typedef interface __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics;
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace Devices {
namespace Haptics {
interface IKnownSimpleHapticsControllerWaveformsStatics;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
#endif /* __cplusplus */
#endif /* ____x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics_FWD_DEFINED__ */
#ifndef ____x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_FWD_DEFINED__
#define ____x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_FWD_DEFINED__
typedef interface __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController;
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace Devices {
namespace Haptics {
interface ISimpleHapticsController;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
#endif /* __cplusplus */
#endif /* ____x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_FWD_DEFINED__ */
#ifndef ____x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback_FWD_DEFINED__
#define ____x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback_FWD_DEFINED__
typedef interface __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback;
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace Devices {
namespace Haptics {
interface ISimpleHapticsControllerFeedback;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
#endif /* __cplusplus */
#endif /* ____x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback_FWD_DEFINED__ */
#ifndef ____x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice_FWD_DEFINED__
#define ____x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice_FWD_DEFINED__
typedef interface __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice;
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace Devices {
namespace Haptics {
interface IVibrationDevice;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
#endif /* __cplusplus */
#endif /* ____x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice_FWD_DEFINED__ */
#ifndef ____x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics_FWD_DEFINED__
#define ____x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics_FWD_DEFINED__
typedef interface __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics;
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace Devices {
namespace Haptics {
interface IVibrationDeviceStatics;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
#endif /* __cplusplus */
#endif /* ____x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics_FWD_DEFINED__ */
/* header files for imported files */
#include "inspectable.h"
#include "AsyncInfo.h"
#include "EventToken.h"
#include "Windows.Foundation.h"
#ifdef __cplusplus
extern "C"{
#endif
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0000 */
/* [local] */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#include <windows.foundation.collections.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace Devices {
namespace Haptics {
class SimpleHapticsControllerFeedback;
} /*Haptics*/
} /*Devices*/
} /*Windows*/
}
#endif
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace Devices {
namespace Haptics {
interface ISimpleHapticsControllerFeedback;
} /*Haptics*/
} /*Devices*/
} /*Windows*/
}
#endif
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0000 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0000_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0000_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0331 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0331 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0331_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0331_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0001 */
/* [local] */
#ifndef DEF___FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_USE
#define DEF___FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation { namespace Collections {
template <>
struct __declspec(uuid("b7d297d6-9666-5c9e-9dcc-5c382eae6750"))
IIterator<ABI::Windows::Devices::Haptics::SimpleHapticsControllerFeedback*> : IIterator_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::Devices::Haptics::SimpleHapticsControllerFeedback*, ABI::Windows::Devices::Haptics::ISimpleHapticsControllerFeedback*>> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.Collections.IIterator`1<Windows.Devices.Haptics.SimpleHapticsControllerFeedback>"; }
};
typedef IIterator<ABI::Windows::Devices::Haptics::SimpleHapticsControllerFeedback*> __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_t;
#define ____FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_FWD_DEFINED__
#define __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback ABI::Windows::Foundation::Collections::__FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_t
/* ABI */ } /* Windows */ } /* Foundation */ } /* Collections */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_USE */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0001 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0001_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0001_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0332 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0332 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0332_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0332_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0002 */
/* [local] */
#ifndef DEF___FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_USE
#define DEF___FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation { namespace Collections {
template <>
struct __declspec(uuid("8894a0df-33b0-57b0-aa1a-9255eee72dd5"))
IIterable<ABI::Windows::Devices::Haptics::SimpleHapticsControllerFeedback*> : IIterable_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::Devices::Haptics::SimpleHapticsControllerFeedback*, ABI::Windows::Devices::Haptics::ISimpleHapticsControllerFeedback*>> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.Collections.IIterable`1<Windows.Devices.Haptics.SimpleHapticsControllerFeedback>"; }
};
typedef IIterable<ABI::Windows::Devices::Haptics::SimpleHapticsControllerFeedback*> __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_t;
#define ____FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_FWD_DEFINED__
#define __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback ABI::Windows::Foundation::Collections::__FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_t
/* ABI */ } /* Windows */ } /* Foundation */ } /* Collections */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_USE */
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace Devices {
namespace Haptics {
class VibrationDevice;
} /*Haptics*/
} /*Devices*/
} /*Windows*/
}
#endif
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace Devices {
namespace Haptics {
interface IVibrationDevice;
} /*Haptics*/
} /*Devices*/
} /*Windows*/
}
#endif
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0002 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0002_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0002_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0333 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0333 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0333_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0333_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0003 */
/* [local] */
#ifndef DEF___FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice_USE
#define DEF___FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation { namespace Collections {
template <>
struct __declspec(uuid("24e9b323-eef1-533f-ad38-de8fc8ca5692"))
IIterator<ABI::Windows::Devices::Haptics::VibrationDevice*> : IIterator_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::Devices::Haptics::VibrationDevice*, ABI::Windows::Devices::Haptics::IVibrationDevice*>> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.Collections.IIterator`1<Windows.Devices.Haptics.VibrationDevice>"; }
};
typedef IIterator<ABI::Windows::Devices::Haptics::VibrationDevice*> __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice_t;
#define ____FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__
#define __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice ABI::Windows::Foundation::Collections::__FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice_t
/* ABI */ } /* Windows */ } /* Foundation */ } /* Collections */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice_USE */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0003 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0003_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0003_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0334 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0334 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0334_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0334_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0004 */
/* [local] */
#ifndef DEF___FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice_USE
#define DEF___FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation { namespace Collections {
template <>
struct __declspec(uuid("1a40c994-8810-5688-9362-c4bb51018552"))
IIterable<ABI::Windows::Devices::Haptics::VibrationDevice*> : IIterable_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::Devices::Haptics::VibrationDevice*, ABI::Windows::Devices::Haptics::IVibrationDevice*>> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.Collections.IIterable`1<Windows.Devices.Haptics.VibrationDevice>"; }
};
typedef IIterable<ABI::Windows::Devices::Haptics::VibrationDevice*> __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice_t;
#define ____FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__
#define __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice ABI::Windows::Foundation::Collections::__FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice_t
/* ABI */ } /* Windows */ } /* Foundation */ } /* Collections */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice_USE */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0004 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0004_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0004_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0335 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0335 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0335_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0335_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0005 */
/* [local] */
#ifndef DEF___FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_USE
#define DEF___FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation { namespace Collections {
template <>
struct __declspec(uuid("51f54b04-bb9d-5c7b-8f5f-67f8caf4b003"))
IVectorView<ABI::Windows::Devices::Haptics::SimpleHapticsControllerFeedback*> : IVectorView_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::Devices::Haptics::SimpleHapticsControllerFeedback*, ABI::Windows::Devices::Haptics::ISimpleHapticsControllerFeedback*>> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.Collections.IVectorView`1<Windows.Devices.Haptics.SimpleHapticsControllerFeedback>"; }
};
typedef IVectorView<ABI::Windows::Devices::Haptics::SimpleHapticsControllerFeedback*> __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_t;
#define ____FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_FWD_DEFINED__
#define __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback ABI::Windows::Foundation::Collections::__FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_t
/* ABI */ } /* Windows */ } /* Foundation */ } /* Collections */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_USE */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0005 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0005_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0005_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0336 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0336 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0336_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0336_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0006 */
/* [local] */
#ifndef DEF___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_USE
#define DEF___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation { namespace Collections {
template <>
struct __declspec(uuid("485aa8a6-2d29-5d34-b8d9-b0c961c17f7f"))
IVectorView<ABI::Windows::Devices::Haptics::VibrationDevice*> : IVectorView_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::Devices::Haptics::VibrationDevice*, ABI::Windows::Devices::Haptics::IVibrationDevice*>> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.Collections.IVectorView`1<Windows.Devices.Haptics.VibrationDevice>"; }
};
typedef IVectorView<ABI::Windows::Devices::Haptics::VibrationDevice*> __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_t;
#define ____FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__
#define __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice ABI::Windows::Foundation::Collections::__FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_t
/* ABI */ } /* Windows */ } /* Foundation */ } /* Collections */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_USE */
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace Devices {
namespace Haptics {
enum VibrationAccessStatus;
} /*Haptics*/
} /*Devices*/
} /*Windows*/
}
#endif
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0006 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0006_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0006_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0337 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0337 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0337_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0337_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0007 */
/* [local] */
#ifndef DEF___FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_USE
#define DEF___FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation {
template <>
struct __declspec(uuid("a38b59db-4ef1-5bd2-89ef-f1d9f1faca96"))
IAsyncOperationCompletedHandler<enum ABI::Windows::Devices::Haptics::VibrationAccessStatus> : IAsyncOperationCompletedHandler_impl<enum ABI::Windows::Devices::Haptics::VibrationAccessStatus> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.AsyncOperationCompletedHandler`1<Windows.Devices.Haptics.VibrationAccessStatus>"; }
};
typedef IAsyncOperationCompletedHandler<enum ABI::Windows::Devices::Haptics::VibrationAccessStatus> __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_t;
#define ____FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_FWD_DEFINED__
#define __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus ABI::Windows::Foundation::__FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_t
/* ABI */ } /* Windows */ } /* Foundation */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_USE */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0007 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0007_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0007_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0338 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0338 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0338_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0338_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0008 */
/* [local] */
#ifndef DEF___FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_USE
#define DEF___FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation {
template <>
struct __declspec(uuid("076b2611-5614-55a5-9c58-f9d17a8f0b79"))
IAsyncOperation<enum ABI::Windows::Devices::Haptics::VibrationAccessStatus> : IAsyncOperation_impl<enum ABI::Windows::Devices::Haptics::VibrationAccessStatus> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.IAsyncOperation`1<Windows.Devices.Haptics.VibrationAccessStatus>"; }
};
typedef IAsyncOperation<enum ABI::Windows::Devices::Haptics::VibrationAccessStatus> __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_t;
#define ____FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_FWD_DEFINED__
#define __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus ABI::Windows::Foundation::__FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_t
/* ABI */ } /* Windows */ } /* Foundation */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_USE */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0008 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0008_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0008_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0339 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0339 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0339_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0339_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0009 */
/* [local] */
#ifndef DEF___FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice_USE
#define DEF___FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation {
template <>
struct __declspec(uuid("4e22a135-f59a-546d-9fcf-82deb833d968"))
IAsyncOperationCompletedHandler<ABI::Windows::Devices::Haptics::VibrationDevice*> : IAsyncOperationCompletedHandler_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::Devices::Haptics::VibrationDevice*, ABI::Windows::Devices::Haptics::IVibrationDevice*>> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.AsyncOperationCompletedHandler`1<Windows.Devices.Haptics.VibrationDevice>"; }
};
typedef IAsyncOperationCompletedHandler<ABI::Windows::Devices::Haptics::VibrationDevice*> __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice_t;
#define ____FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__
#define __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice ABI::Windows::Foundation::__FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice_t
/* ABI */ } /* Windows */ } /* Foundation */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice_USE */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0009 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0009_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0009_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0340 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0340 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0340_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0340_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0010 */
/* [local] */
#ifndef DEF___FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice_USE
#define DEF___FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation {
template <>
struct __declspec(uuid("44193494-e331-50ca-bb61-6a71bd9b01c4"))
IAsyncOperation<ABI::Windows::Devices::Haptics::VibrationDevice*> : IAsyncOperation_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::Devices::Haptics::VibrationDevice*, ABI::Windows::Devices::Haptics::IVibrationDevice*>> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.IAsyncOperation`1<Windows.Devices.Haptics.VibrationDevice>"; }
};
typedef IAsyncOperation<ABI::Windows::Devices::Haptics::VibrationDevice*> __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice_t;
#define ____FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__
#define __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice ABI::Windows::Foundation::__FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice_t
/* ABI */ } /* Windows */ } /* Foundation */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice_USE */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0010 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0010_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0010_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0341 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0341 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0341_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0341_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0011 */
/* [local] */
#ifndef DEF___FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_USE
#define DEF___FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation {
template <>
struct __declspec(uuid("096f6389-6757-56df-af12-cfe1d8f23fc1"))
IAsyncOperationCompletedHandler<__FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice*> : IAsyncOperationCompletedHandler_impl<__FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice*> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.AsyncOperationCompletedHandler`1<Windows.Foundation.Collections.IVectorView`1<Windows.Devices.Haptics.VibrationDevice>>"; }
};
typedef IAsyncOperationCompletedHandler<__FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice*> __FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_t;
#define ____FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__
#define __FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice ABI::Windows::Foundation::__FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_t
/* ABI */ } /* Windows */ } /* Foundation */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_USE */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0011 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0011_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0011_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0342 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0342 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0342_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0342_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0012 */
/* [local] */
#ifndef DEF___FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_USE
#define DEF___FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation {
template <>
struct __declspec(uuid("bda8b138-7862-59f3-bfd9-5f1cb063df02"))
IAsyncOperation<__FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice*> : IAsyncOperation_impl<__FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice*> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.IAsyncOperation`1<Windows.Foundation.Collections.IVectorView`1<Windows.Devices.Haptics.VibrationDevice>>"; }
};
typedef IAsyncOperation<__FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice*> __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_t;
#define ____FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_FWD_DEFINED__
#define __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice ABI::Windows::Foundation::__FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_t
/* ABI */ } /* Windows */ } /* Foundation */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_USE */
#if defined(__cplusplus)
}
#endif // defined(__cplusplus)
#include <Windows.Foundation.h>
#if defined(__cplusplus)
extern "C" {
#endif // defined(__cplusplus)
#if !defined(__cplusplus)
typedef struct __x_ABI_CWindows_CFoundation_CTimeSpan __x_ABI_CWindows_CFoundation_CTimeSpan;
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
typedef enum __x_ABI_CWindows_CDevices_CHaptics_CVibrationAccessStatus __x_ABI_CWindows_CDevices_CHaptics_CVibrationAccessStatus;
#endif /* end if !defined(__cplusplus) */
#endif
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace Devices {
namespace Haptics {
class SimpleHapticsController;
} /*Haptics*/
} /*Devices*/
} /*Windows*/
}
#endif
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0012 */
/* [local] */
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace Foundation {
typedef struct TimeSpan TimeSpan;
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace Devices {
namespace Haptics {
typedef enum VibrationAccessStatus VibrationAccessStatus;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0012_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0012_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0343 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0343 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0343_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0343_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0013 */
/* [local] */
#ifndef DEF___FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback
#define DEF___FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0013 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0013_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0013_v0_0_s_ifspec;
#ifndef ____FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_INTERFACE_DEFINED__
#define ____FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_INTERFACE_DEFINED__
/* interface __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback */
/* [unique][uuid][object] */
/* interface __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("b7d297d6-9666-5c9e-9dcc-5c382eae6750")
__FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback : public IInspectable
{
public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Current(
/* [retval][out] */ __RPC__deref_out_opt ABI::Windows::Devices::Haptics::ISimpleHapticsControllerFeedback **current) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HasCurrent(
/* [retval][out] */ __RPC__out boolean *hasCurrent) = 0;
virtual HRESULT STDMETHODCALLTYPE MoveNext(
/* [retval][out] */ __RPC__out boolean *hasCurrent) = 0;
virtual HRESULT STDMETHODCALLTYPE GetMany(
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) ABI::Windows::Devices::Haptics::ISimpleHapticsControllerFeedback **items,
/* [retval][out] */ __RPC__out unsigned int *actual) = 0;
};
#else /* C style interface */
typedef struct __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedbackVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Current )(
__RPC__in __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This,
/* [retval][out] */ __RPC__deref_out_opt __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback **current);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HasCurrent )(
__RPC__in __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This,
/* [retval][out] */ __RPC__out boolean *hasCurrent);
HRESULT ( STDMETHODCALLTYPE *MoveNext )(
__RPC__in __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This,
/* [retval][out] */ __RPC__out boolean *hasCurrent);
HRESULT ( STDMETHODCALLTYPE *GetMany )(
__RPC__in __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This,
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback **items,
/* [retval][out] */ __RPC__out unsigned int *actual);
END_INTERFACE
} __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedbackVtbl;
interface __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback
{
CONST_VTBL struct __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedbackVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_get_Current(This,current) \
( (This)->lpVtbl -> get_Current(This,current) )
#define __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_get_HasCurrent(This,hasCurrent) \
( (This)->lpVtbl -> get_HasCurrent(This,hasCurrent) )
#define __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_MoveNext(This,hasCurrent) \
( (This)->lpVtbl -> MoveNext(This,hasCurrent) )
#define __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_GetMany(This,capacity,items,actual) \
( (This)->lpVtbl -> GetMany(This,capacity,items,actual) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0014 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0014 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0014_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0014_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0344 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0344 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0344_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0344_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0015 */
/* [local] */
#ifndef DEF___FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback
#define DEF___FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0015 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0015_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0015_v0_0_s_ifspec;
#ifndef ____FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_INTERFACE_DEFINED__
#define ____FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_INTERFACE_DEFINED__
/* interface __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback */
/* [unique][uuid][object] */
/* interface __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("8894a0df-33b0-57b0-aa1a-9255eee72dd5")
__FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback : public IInspectable
{
public:
virtual HRESULT STDMETHODCALLTYPE First(
/* [retval][out] */ __RPC__deref_out_opt __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback **first) = 0;
};
#else /* C style interface */
typedef struct __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedbackVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
HRESULT ( STDMETHODCALLTYPE *First )(
__RPC__in __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This,
/* [retval][out] */ __RPC__deref_out_opt __FIIterator_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback **first);
END_INTERFACE
} __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedbackVtbl;
interface __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback
{
CONST_VTBL struct __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedbackVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_First(This,first) \
( (This)->lpVtbl -> First(This,first) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0016 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIIterable_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0016 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0016_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0016_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0345 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0345 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0345_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0345_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0017 */
/* [local] */
#ifndef DEF___FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice
#define DEF___FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0017 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0017_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0017_v0_0_s_ifspec;
#ifndef ____FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice_INTERFACE_DEFINED__
#define ____FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice_INTERFACE_DEFINED__
/* interface __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice */
/* [unique][uuid][object] */
/* interface __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("24e9b323-eef1-533f-ad38-de8fc8ca5692")
__FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice : public IInspectable
{
public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Current(
/* [retval][out] */ __RPC__deref_out_opt ABI::Windows::Devices::Haptics::IVibrationDevice **current) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HasCurrent(
/* [retval][out] */ __RPC__out boolean *hasCurrent) = 0;
virtual HRESULT STDMETHODCALLTYPE MoveNext(
/* [retval][out] */ __RPC__out boolean *hasCurrent) = 0;
virtual HRESULT STDMETHODCALLTYPE GetMany(
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) ABI::Windows::Devices::Haptics::IVibrationDevice **items,
/* [retval][out] */ __RPC__out unsigned int *actual) = 0;
};
#else /* C style interface */
typedef struct __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDeviceVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Current )(
__RPC__in __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [retval][out] */ __RPC__deref_out_opt __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice **current);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HasCurrent )(
__RPC__in __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [retval][out] */ __RPC__out boolean *hasCurrent);
HRESULT ( STDMETHODCALLTYPE *MoveNext )(
__RPC__in __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [retval][out] */ __RPC__out boolean *hasCurrent);
HRESULT ( STDMETHODCALLTYPE *GetMany )(
__RPC__in __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice **items,
/* [retval][out] */ __RPC__out unsigned int *actual);
END_INTERFACE
} __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDeviceVtbl;
interface __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice
{
CONST_VTBL struct __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDeviceVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice_get_Current(This,current) \
( (This)->lpVtbl -> get_Current(This,current) )
#define __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice_get_HasCurrent(This,hasCurrent) \
( (This)->lpVtbl -> get_HasCurrent(This,hasCurrent) )
#define __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice_MoveNext(This,hasCurrent) \
( (This)->lpVtbl -> MoveNext(This,hasCurrent) )
#define __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice_GetMany(This,capacity,items,actual) \
( (This)->lpVtbl -> GetMany(This,capacity,items,actual) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0018 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0018 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0018_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0018_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0346 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0346 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0346_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0346_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0019 */
/* [local] */
#ifndef DEF___FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice
#define DEF___FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0019 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0019_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0019_v0_0_s_ifspec;
#ifndef ____FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice_INTERFACE_DEFINED__
#define ____FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice_INTERFACE_DEFINED__
/* interface __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice */
/* [unique][uuid][object] */
/* interface __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("1a40c994-8810-5688-9362-c4bb51018552")
__FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice : public IInspectable
{
public:
virtual HRESULT STDMETHODCALLTYPE First(
/* [retval][out] */ __RPC__deref_out_opt __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice **first) = 0;
};
#else /* C style interface */
typedef struct __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDeviceVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
HRESULT ( STDMETHODCALLTYPE *First )(
__RPC__in __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [retval][out] */ __RPC__deref_out_opt __FIIterator_1_Windows__CDevices__CHaptics__CVibrationDevice **first);
END_INTERFACE
} __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDeviceVtbl;
interface __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice
{
CONST_VTBL struct __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDeviceVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice_First(This,first) \
( (This)->lpVtbl -> First(This,first) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0020 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIIterable_1_Windows__CDevices__CHaptics__CVibrationDevice */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0020 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0020_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0020_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0347 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0347 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0347_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0347_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0021 */
/* [local] */
#ifndef DEF___FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback
#define DEF___FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0021 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0021_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0021_v0_0_s_ifspec;
#ifndef ____FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_INTERFACE_DEFINED__
#define ____FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_INTERFACE_DEFINED__
/* interface __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback */
/* [unique][uuid][object] */
/* interface __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("51f54b04-bb9d-5c7b-8f5f-67f8caf4b003")
__FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback : public IInspectable
{
public:
virtual HRESULT STDMETHODCALLTYPE GetAt(
/* [in] */ unsigned int index,
/* [retval][out] */ __RPC__deref_out_opt ABI::Windows::Devices::Haptics::ISimpleHapticsControllerFeedback **item) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Size(
/* [retval][out] */ __RPC__out unsigned int *size) = 0;
virtual HRESULT STDMETHODCALLTYPE IndexOf(
/* [in] */ __RPC__in_opt ABI::Windows::Devices::Haptics::ISimpleHapticsControllerFeedback *item,
/* [out] */ __RPC__out unsigned int *index,
/* [retval][out] */ __RPC__out boolean *found) = 0;
virtual HRESULT STDMETHODCALLTYPE GetMany(
/* [in] */ unsigned int startIndex,
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) ABI::Windows::Devices::Haptics::ISimpleHapticsControllerFeedback **items,
/* [retval][out] */ __RPC__out unsigned int *actual) = 0;
};
#else /* C style interface */
typedef struct __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedbackVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
HRESULT ( STDMETHODCALLTYPE *GetAt )(
__RPC__in __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This,
/* [in] */ unsigned int index,
/* [retval][out] */ __RPC__deref_out_opt __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback **item);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Size )(
__RPC__in __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This,
/* [retval][out] */ __RPC__out unsigned int *size);
HRESULT ( STDMETHODCALLTYPE *IndexOf )(
__RPC__in __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback *item,
/* [out] */ __RPC__out unsigned int *index,
/* [retval][out] */ __RPC__out boolean *found);
HRESULT ( STDMETHODCALLTYPE *GetMany )(
__RPC__in __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback * This,
/* [in] */ unsigned int startIndex,
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback **items,
/* [retval][out] */ __RPC__out unsigned int *actual);
END_INTERFACE
} __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedbackVtbl;
interface __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback
{
CONST_VTBL struct __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedbackVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_GetAt(This,index,item) \
( (This)->lpVtbl -> GetAt(This,index,item) )
#define __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_get_Size(This,size) \
( (This)->lpVtbl -> get_Size(This,size) )
#define __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_IndexOf(This,item,index,found) \
( (This)->lpVtbl -> IndexOf(This,item,index,found) )
#define __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_GetMany(This,startIndex,capacity,items,actual) \
( (This)->lpVtbl -> GetMany(This,startIndex,capacity,items,actual) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0022 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0022 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0022_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0022_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0348 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0348 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0348_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0348_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0023 */
/* [local] */
#ifndef DEF___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice
#define DEF___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0023 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0023_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0023_v0_0_s_ifspec;
#ifndef ____FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_INTERFACE_DEFINED__
#define ____FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_INTERFACE_DEFINED__
/* interface __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice */
/* [unique][uuid][object] */
/* interface __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("485aa8a6-2d29-5d34-b8d9-b0c961c17f7f")
__FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice : public IInspectable
{
public:
virtual HRESULT STDMETHODCALLTYPE GetAt(
/* [in] */ unsigned int index,
/* [retval][out] */ __RPC__deref_out_opt ABI::Windows::Devices::Haptics::IVibrationDevice **item) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Size(
/* [retval][out] */ __RPC__out unsigned int *size) = 0;
virtual HRESULT STDMETHODCALLTYPE IndexOf(
/* [in] */ __RPC__in_opt ABI::Windows::Devices::Haptics::IVibrationDevice *item,
/* [out] */ __RPC__out unsigned int *index,
/* [retval][out] */ __RPC__out boolean *found) = 0;
virtual HRESULT STDMETHODCALLTYPE GetMany(
/* [in] */ unsigned int startIndex,
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) ABI::Windows::Devices::Haptics::IVibrationDevice **items,
/* [retval][out] */ __RPC__out unsigned int *actual) = 0;
};
#else /* C style interface */
typedef struct __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDeviceVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
HRESULT ( STDMETHODCALLTYPE *GetAt )(
__RPC__in __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [in] */ unsigned int index,
/* [retval][out] */ __RPC__deref_out_opt __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice **item);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Size )(
__RPC__in __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [retval][out] */ __RPC__out unsigned int *size);
HRESULT ( STDMETHODCALLTYPE *IndexOf )(
__RPC__in __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice *item,
/* [out] */ __RPC__out unsigned int *index,
/* [retval][out] */ __RPC__out boolean *found);
HRESULT ( STDMETHODCALLTYPE *GetMany )(
__RPC__in __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [in] */ unsigned int startIndex,
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice **items,
/* [retval][out] */ __RPC__out unsigned int *actual);
END_INTERFACE
} __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDeviceVtbl;
interface __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice
{
CONST_VTBL struct __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDeviceVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_GetAt(This,index,item) \
( (This)->lpVtbl -> GetAt(This,index,item) )
#define __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_get_Size(This,size) \
( (This)->lpVtbl -> get_Size(This,size) )
#define __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_IndexOf(This,item,index,found) \
( (This)->lpVtbl -> IndexOf(This,item,index,found) )
#define __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_GetMany(This,startIndex,capacity,items,actual) \
( (This)->lpVtbl -> GetMany(This,startIndex,capacity,items,actual) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0024 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0024 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0024_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0024_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0349 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0349 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0349_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0349_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0025 */
/* [local] */
#ifndef DEF___FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus
#define DEF___FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0025 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0025_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0025_v0_0_s_ifspec;
#ifndef ____FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_INTERFACE_DEFINED__
#define ____FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_INTERFACE_DEFINED__
/* interface __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus */
/* [unique][uuid][object] */
/* interface __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("a38b59db-4ef1-5bd2-89ef-f1d9f1faca96")
__FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE Invoke(
/* [in] */ __RPC__in_opt __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus *asyncInfo,
/* [in] */ AsyncStatus status) = 0;
};
#else /* C style interface */
typedef struct __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatusVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus * This);
HRESULT ( STDMETHODCALLTYPE *Invoke )(
__RPC__in __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus * This,
/* [in] */ __RPC__in_opt __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus *asyncInfo,
/* [in] */ AsyncStatus status);
END_INTERFACE
} __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatusVtbl;
interface __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus
{
CONST_VTBL struct __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatusVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_Invoke(This,asyncInfo,status) \
( (This)->lpVtbl -> Invoke(This,asyncInfo,status) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0026 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0026 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0026_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0026_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0350 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0350 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0350_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0350_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0027 */
/* [local] */
#ifndef DEF___FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus
#define DEF___FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0027 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0027_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0027_v0_0_s_ifspec;
#ifndef ____FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_INTERFACE_DEFINED__
#define ____FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_INTERFACE_DEFINED__
/* interface __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus */
/* [unique][uuid][object] */
/* interface __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("076b2611-5614-55a5-9c58-f9d17a8f0b79")
__FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus : public IInspectable
{
public:
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Completed(
/* [in] */ __RPC__in_opt __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus *handler) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Completed(
/* [retval][out] */ __RPC__deref_out_opt __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus **handler) = 0;
virtual HRESULT STDMETHODCALLTYPE GetResults(
/* [retval][out] */ __RPC__out enum ABI::Windows::Devices::Haptics::VibrationAccessStatus *results) = 0;
};
#else /* C style interface */
typedef struct __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatusVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Completed )(
__RPC__in __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus * This,
/* [in] */ __RPC__in_opt __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus *handler);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Completed )(
__RPC__in __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus * This,
/* [retval][out] */ __RPC__deref_out_opt __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationAccessStatus **handler);
HRESULT ( STDMETHODCALLTYPE *GetResults )(
__RPC__in __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus * This,
/* [retval][out] */ __RPC__out enum __x_ABI_CWindows_CDevices_CHaptics_CVibrationAccessStatus *results);
END_INTERFACE
} __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatusVtbl;
interface __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus
{
CONST_VTBL struct __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatusVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_put_Completed(This,handler) \
( (This)->lpVtbl -> put_Completed(This,handler) )
#define __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_get_Completed(This,handler) \
( (This)->lpVtbl -> get_Completed(This,handler) )
#define __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_GetResults(This,results) \
( (This)->lpVtbl -> GetResults(This,results) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0028 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0028 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0028_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0028_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0351 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0351 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0351_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0351_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0029 */
/* [local] */
#ifndef DEF___FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice
#define DEF___FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0029 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0029_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0029_v0_0_s_ifspec;
#ifndef ____FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice_INTERFACE_DEFINED__
#define ____FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice_INTERFACE_DEFINED__
/* interface __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice */
/* [unique][uuid][object] */
/* interface __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("4e22a135-f59a-546d-9fcf-82deb833d968")
__FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE Invoke(
/* [in] */ __RPC__in_opt __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice *asyncInfo,
/* [in] */ AsyncStatus status) = 0;
};
#else /* C style interface */
typedef struct __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDeviceVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice * This);
HRESULT ( STDMETHODCALLTYPE *Invoke )(
__RPC__in __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [in] */ __RPC__in_opt __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice *asyncInfo,
/* [in] */ AsyncStatus status);
END_INTERFACE
} __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDeviceVtbl;
interface __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice
{
CONST_VTBL struct __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDeviceVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice_Invoke(This,asyncInfo,status) \
( (This)->lpVtbl -> Invoke(This,asyncInfo,status) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0030 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0030 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0030_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0030_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0352 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0352 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0352_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0352_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0031 */
/* [local] */
#ifndef DEF___FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice
#define DEF___FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0031 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0031_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0031_v0_0_s_ifspec;
#ifndef ____FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice_INTERFACE_DEFINED__
#define ____FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice_INTERFACE_DEFINED__
/* interface __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice */
/* [unique][uuid][object] */
/* interface __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("44193494-e331-50ca-bb61-6a71bd9b01c4")
__FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice : public IInspectable
{
public:
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Completed(
/* [in] */ __RPC__in_opt __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice *handler) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Completed(
/* [retval][out] */ __RPC__deref_out_opt __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice **handler) = 0;
virtual HRESULT STDMETHODCALLTYPE GetResults(
/* [retval][out] */ __RPC__deref_out_opt ABI::Windows::Devices::Haptics::IVibrationDevice **results) = 0;
};
#else /* C style interface */
typedef struct __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDeviceVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Completed )(
__RPC__in __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [in] */ __RPC__in_opt __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice *handler);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Completed )(
__RPC__in __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [retval][out] */ __RPC__deref_out_opt __FIAsyncOperationCompletedHandler_1_Windows__CDevices__CHaptics__CVibrationDevice **handler);
HRESULT ( STDMETHODCALLTYPE *GetResults )(
__RPC__in __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [retval][out] */ __RPC__deref_out_opt __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice **results);
END_INTERFACE
} __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDeviceVtbl;
interface __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice
{
CONST_VTBL struct __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDeviceVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice_put_Completed(This,handler) \
( (This)->lpVtbl -> put_Completed(This,handler) )
#define __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice_get_Completed(This,handler) \
( (This)->lpVtbl -> get_Completed(This,handler) )
#define __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice_GetResults(This,results) \
( (This)->lpVtbl -> GetResults(This,results) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0032 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0032 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0032_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0032_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0353 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0353 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0353_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0353_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0033 */
/* [local] */
#ifndef DEF___FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice
#define DEF___FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0033 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0033_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0033_v0_0_s_ifspec;
#ifndef ____FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_INTERFACE_DEFINED__
#define ____FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_INTERFACE_DEFINED__
/* interface __FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice */
/* [unique][uuid][object] */
/* interface __FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("096f6389-6757-56df-af12-cfe1d8f23fc1")
__FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE Invoke(
/* [in] */ __RPC__in_opt __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice *asyncInfo,
/* [in] */ AsyncStatus status) = 0;
};
#else /* C style interface */
typedef struct __FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDeviceVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice * This);
HRESULT ( STDMETHODCALLTYPE *Invoke )(
__RPC__in __FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [in] */ __RPC__in_opt __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice *asyncInfo,
/* [in] */ AsyncStatus status);
END_INTERFACE
} __FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDeviceVtbl;
interface __FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice
{
CONST_VTBL struct __FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDeviceVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_Invoke(This,asyncInfo,status) \
( (This)->lpVtbl -> Invoke(This,asyncInfo,status) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0034 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0034 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0034_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0034_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0354 */
/* interface __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0354 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0354_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics2Eidl_0000_0354_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0035 */
/* [local] */
#ifndef DEF___FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice
#define DEF___FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0035 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0035_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0035_v0_0_s_ifspec;
#ifndef ____FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_INTERFACE_DEFINED__
#define ____FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_INTERFACE_DEFINED__
/* interface __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice */
/* [unique][uuid][object] */
/* interface __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("bda8b138-7862-59f3-bfd9-5f1cb063df02")
__FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice : public IInspectable
{
public:
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Completed(
/* [in] */ __RPC__in_opt __FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice *handler) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Completed(
/* [retval][out] */ __RPC__deref_out_opt __FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice **handler) = 0;
virtual HRESULT STDMETHODCALLTYPE GetResults(
/* [retval][out] */ __RPC__deref_out_opt __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice **results) = 0;
};
#else /* C style interface */
typedef struct __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDeviceVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Completed )(
__RPC__in __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [in] */ __RPC__in_opt __FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice *handler);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Completed )(
__RPC__in __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [retval][out] */ __RPC__deref_out_opt __FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice **handler);
HRESULT ( STDMETHODCALLTYPE *GetResults )(
__RPC__in __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice * This,
/* [retval][out] */ __RPC__deref_out_opt __FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice **results);
END_INTERFACE
} __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDeviceVtbl;
interface __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice
{
CONST_VTBL struct __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDeviceVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_put_Completed(This,handler) \
( (This)->lpVtbl -> put_Completed(This,handler) )
#define __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_get_Completed(This,handler) \
( (This)->lpVtbl -> get_Completed(This,handler) )
#define __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_GetResults(This,results) \
( (This)->lpVtbl -> GetResults(This,results) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0036 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice */
#if !defined(__cplusplus)
#if !defined(__cplusplus)
/* [v1_enum] */
enum __x_ABI_CWindows_CDevices_CHaptics_CVibrationAccessStatus
{
VibrationAccessStatus_Allowed = 0,
VibrationAccessStatus_DeniedByUser = 1,
VibrationAccessStatus_DeniedBySystem = 2,
VibrationAccessStatus_DeniedByEnergySaver = 3
} ;
#endif /* end if !defined(__cplusplus) */
#endif
#if !defined(____x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics_INTERFACE_DEFINED__)
extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_Windows_Devices_Haptics_IKnownSimpleHapticsControllerWaveformsStatics[] = L"Windows.Devices.Haptics.IKnownSimpleHapticsControllerWaveformsStatics";
#endif /* !defined(____x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics_INTERFACE_DEFINED__) */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0036 */
/* [local] */
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace Devices {
namespace Haptics {
/* [v1_enum] */
enum VibrationAccessStatus
{
VibrationAccessStatus_Allowed = 0,
VibrationAccessStatus_DeniedByUser = 1,
VibrationAccessStatus_DeniedBySystem = 2,
VibrationAccessStatus_DeniedByEnergySaver = 3
} ;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0036_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0036_v0_0_s_ifspec;
#ifndef ____x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics_INTERFACE_DEFINED__
#define ____x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics_INTERFACE_DEFINED__
/* interface __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics */
/* [uuid][object] */
/* interface ABI::Windows::Devices::Haptics::IKnownSimpleHapticsControllerWaveformsStatics */
/* [uuid][object] */
EXTERN_C const IID IID___x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics;
#if defined(__cplusplus) && !defined(CINTERFACE)
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace Devices {
namespace Haptics {
MIDL_INTERFACE("3D577EF7-4CEE-11E6-B535-001BDC06AB3B")
IKnownSimpleHapticsControllerWaveformsStatics : public IInspectable
{
public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Click(
/* [out][retval] */ __RPC__out UINT16 *value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BuzzContinuous(
/* [out][retval] */ __RPC__out UINT16 *value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RumbleContinuous(
/* [out][retval] */ __RPC__out UINT16 *value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Press(
/* [out][retval] */ __RPC__out UINT16 *value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Release(
/* [out][retval] */ __RPC__out UINT16 *value) = 0;
};
extern const __declspec(selectany) IID & IID_IKnownSimpleHapticsControllerWaveformsStatics = __uuidof(IKnownSimpleHapticsControllerWaveformsStatics);
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#else /* C style interface */
typedef struct __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStaticsVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Click )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics * This,
/* [out][retval] */ __RPC__out UINT16 *value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BuzzContinuous )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics * This,
/* [out][retval] */ __RPC__out UINT16 *value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RumbleContinuous )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics * This,
/* [out][retval] */ __RPC__out UINT16 *value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Press )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics * This,
/* [out][retval] */ __RPC__out UINT16 *value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Release )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics * This,
/* [out][retval] */ __RPC__out UINT16 *value);
END_INTERFACE
} __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStaticsVtbl;
interface __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics
{
CONST_VTBL struct __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStaticsVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics_get_Click(This,value) \
( (This)->lpVtbl -> get_Click(This,value) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics_get_BuzzContinuous(This,value) \
( (This)->lpVtbl -> get_BuzzContinuous(This,value) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics_get_RumbleContinuous(This,value) \
( (This)->lpVtbl -> get_RumbleContinuous(This,value) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics_get_Press(This,value) \
( (This)->lpVtbl -> get_Press(This,value) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics_get_Release(This,value) \
( (This)->lpVtbl -> get_Release(This,value) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____x_ABI_CWindows_CDevices_CHaptics_CIKnownSimpleHapticsControllerWaveformsStatics_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0037 */
/* [local] */
#if !defined(____x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_INTERFACE_DEFINED__)
extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_Windows_Devices_Haptics_ISimpleHapticsController[] = L"Windows.Devices.Haptics.ISimpleHapticsController";
#endif /* !defined(____x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_INTERFACE_DEFINED__) */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0037 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0037_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0037_v0_0_s_ifspec;
#ifndef ____x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_INTERFACE_DEFINED__
#define ____x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_INTERFACE_DEFINED__
/* interface __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController */
/* [uuid][object] */
/* interface ABI::Windows::Devices::Haptics::ISimpleHapticsController */
/* [uuid][object] */
EXTERN_C const IID IID___x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController;
#if defined(__cplusplus) && !defined(CINTERFACE)
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace Devices {
namespace Haptics {
MIDL_INTERFACE("3D577EF9-4CEE-11E6-B535-001BDC06AB3B")
ISimpleHapticsController : public IInspectable
{
public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Id(
/* [out][retval] */ __RPC__deref_out_opt HSTRING *value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SupportedFeedback(
/* [out][retval] */ __RPC__deref_out_opt __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback **value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsIntensitySupported(
/* [out][retval] */ __RPC__out boolean *value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsPlayCountSupported(
/* [out][retval] */ __RPC__out boolean *value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsPlayDurationSupported(
/* [out][retval] */ __RPC__out boolean *value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsReplayPauseIntervalSupported(
/* [out][retval] */ __RPC__out boolean *value) = 0;
virtual HRESULT STDMETHODCALLTYPE StopFeedback( void) = 0;
virtual HRESULT STDMETHODCALLTYPE SendHapticFeedback(
/* [in] */ __RPC__in_opt ABI::Windows::Devices::Haptics::ISimpleHapticsControllerFeedback *feedback) = 0;
virtual HRESULT STDMETHODCALLTYPE SendHapticFeedbackWithIntensity(
/* [in] */ __RPC__in_opt ABI::Windows::Devices::Haptics::ISimpleHapticsControllerFeedback *feedback,
/* [in] */ DOUBLE intensity) = 0;
virtual HRESULT STDMETHODCALLTYPE SendHapticFeedbackForDuration(
/* [in] */ __RPC__in_opt ABI::Windows::Devices::Haptics::ISimpleHapticsControllerFeedback *feedback,
/* [in] */ DOUBLE intensity,
/* [in] */ ABI::Windows::Foundation::TimeSpan playDuration) = 0;
virtual HRESULT STDMETHODCALLTYPE SendHapticFeedbackForPlayCount(
/* [in] */ __RPC__in_opt ABI::Windows::Devices::Haptics::ISimpleHapticsControllerFeedback *feedback,
/* [in] */ DOUBLE intensity,
/* [in] */ INT32 playCount,
/* [in] */ ABI::Windows::Foundation::TimeSpan replayPauseInterval) = 0;
};
extern const __declspec(selectany) IID & IID_ISimpleHapticsController = __uuidof(ISimpleHapticsController);
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#else /* C style interface */
typedef struct __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Id )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController * This,
/* [out][retval] */ __RPC__deref_out_opt HSTRING *value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SupportedFeedback )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController * This,
/* [out][retval] */ __RPC__deref_out_opt __FIVectorView_1_Windows__CDevices__CHaptics__CSimpleHapticsControllerFeedback **value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsIntensitySupported )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController * This,
/* [out][retval] */ __RPC__out boolean *value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsPlayCountSupported )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController * This,
/* [out][retval] */ __RPC__out boolean *value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsPlayDurationSupported )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController * This,
/* [out][retval] */ __RPC__out boolean *value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsReplayPauseIntervalSupported )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController * This,
/* [out][retval] */ __RPC__out boolean *value);
HRESULT ( STDMETHODCALLTYPE *StopFeedback )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController * This);
HRESULT ( STDMETHODCALLTYPE *SendHapticFeedback )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback *feedback);
HRESULT ( STDMETHODCALLTYPE *SendHapticFeedbackWithIntensity )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback *feedback,
/* [in] */ DOUBLE intensity);
HRESULT ( STDMETHODCALLTYPE *SendHapticFeedbackForDuration )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback *feedback,
/* [in] */ DOUBLE intensity,
/* [in] */ __x_ABI_CWindows_CFoundation_CTimeSpan playDuration);
HRESULT ( STDMETHODCALLTYPE *SendHapticFeedbackForPlayCount )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback *feedback,
/* [in] */ DOUBLE intensity,
/* [in] */ INT32 playCount,
/* [in] */ __x_ABI_CWindows_CFoundation_CTimeSpan replayPauseInterval);
END_INTERFACE
} __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerVtbl;
interface __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController
{
CONST_VTBL struct __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_get_Id(This,value) \
( (This)->lpVtbl -> get_Id(This,value) )
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_get_SupportedFeedback(This,value) \
( (This)->lpVtbl -> get_SupportedFeedback(This,value) )
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_get_IsIntensitySupported(This,value) \
( (This)->lpVtbl -> get_IsIntensitySupported(This,value) )
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_get_IsPlayCountSupported(This,value) \
( (This)->lpVtbl -> get_IsPlayCountSupported(This,value) )
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_get_IsPlayDurationSupported(This,value) \
( (This)->lpVtbl -> get_IsPlayDurationSupported(This,value) )
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_get_IsReplayPauseIntervalSupported(This,value) \
( (This)->lpVtbl -> get_IsReplayPauseIntervalSupported(This,value) )
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_StopFeedback(This) \
( (This)->lpVtbl -> StopFeedback(This) )
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_SendHapticFeedback(This,feedback) \
( (This)->lpVtbl -> SendHapticFeedback(This,feedback) )
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_SendHapticFeedbackWithIntensity(This,feedback,intensity) \
( (This)->lpVtbl -> SendHapticFeedbackWithIntensity(This,feedback,intensity) )
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_SendHapticFeedbackForDuration(This,feedback,intensity,playDuration) \
( (This)->lpVtbl -> SendHapticFeedbackForDuration(This,feedback,intensity,playDuration) )
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_SendHapticFeedbackForPlayCount(This,feedback,intensity,playCount,replayPauseInterval) \
( (This)->lpVtbl -> SendHapticFeedbackForPlayCount(This,feedback,intensity,playCount,replayPauseInterval) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0038 */
/* [local] */
#if !defined(____x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback_INTERFACE_DEFINED__)
extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_Windows_Devices_Haptics_ISimpleHapticsControllerFeedback[] = L"Windows.Devices.Haptics.ISimpleHapticsControllerFeedback";
#endif /* !defined(____x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback_INTERFACE_DEFINED__) */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0038 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0038_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0038_v0_0_s_ifspec;
#ifndef ____x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback_INTERFACE_DEFINED__
#define ____x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback_INTERFACE_DEFINED__
/* interface __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback */
/* [uuid][object] */
/* interface ABI::Windows::Devices::Haptics::ISimpleHapticsControllerFeedback */
/* [uuid][object] */
EXTERN_C const IID IID___x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback;
#if defined(__cplusplus) && !defined(CINTERFACE)
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace Devices {
namespace Haptics {
MIDL_INTERFACE("3D577EF8-4CEE-11E6-B535-001BDC06AB3B")
ISimpleHapticsControllerFeedback : public IInspectable
{
public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Waveform(
/* [out][retval] */ __RPC__out UINT16 *value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Duration(
/* [out][retval] */ __RPC__out ABI::Windows::Foundation::TimeSpan *value) = 0;
};
extern const __declspec(selectany) IID & IID_ISimpleHapticsControllerFeedback = __uuidof(ISimpleHapticsControllerFeedback);
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#else /* C style interface */
typedef struct __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedbackVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Waveform )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback * This,
/* [out][retval] */ __RPC__out UINT16 *value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Duration )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback * This,
/* [out][retval] */ __RPC__out __x_ABI_CWindows_CFoundation_CTimeSpan *value);
END_INTERFACE
} __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedbackVtbl;
interface __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback
{
CONST_VTBL struct __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedbackVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback_get_Waveform(This,value) \
( (This)->lpVtbl -> get_Waveform(This,value) )
#define __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback_get_Duration(This,value) \
( (This)->lpVtbl -> get_Duration(This,value) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsControllerFeedback_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0039 */
/* [local] */
#if !defined(____x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice_INTERFACE_DEFINED__)
extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_Windows_Devices_Haptics_IVibrationDevice[] = L"Windows.Devices.Haptics.IVibrationDevice";
#endif /* !defined(____x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice_INTERFACE_DEFINED__) */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0039 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0039_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0039_v0_0_s_ifspec;
#ifndef ____x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice_INTERFACE_DEFINED__
#define ____x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice_INTERFACE_DEFINED__
/* interface __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice */
/* [uuid][object] */
/* interface ABI::Windows::Devices::Haptics::IVibrationDevice */
/* [uuid][object] */
EXTERN_C const IID IID___x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice;
#if defined(__cplusplus) && !defined(CINTERFACE)
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace Devices {
namespace Haptics {
MIDL_INTERFACE("40F21A3E-8844-47FF-B312-06185A3844DA")
IVibrationDevice : public IInspectable
{
public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Id(
/* [out][retval] */ __RPC__deref_out_opt HSTRING *value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SimpleHapticsController(
/* [out][retval] */ __RPC__deref_out_opt ABI::Windows::Devices::Haptics::ISimpleHapticsController **value) = 0;
};
extern const __declspec(selectany) IID & IID_IVibrationDevice = __uuidof(IVibrationDevice);
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#else /* C style interface */
typedef struct __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Id )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice * This,
/* [out][retval] */ __RPC__deref_out_opt HSTRING *value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SimpleHapticsController )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice * This,
/* [out][retval] */ __RPC__deref_out_opt __x_ABI_CWindows_CDevices_CHaptics_CISimpleHapticsController **value);
END_INTERFACE
} __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceVtbl;
interface __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice
{
CONST_VTBL struct __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice_get_Id(This,value) \
( (This)->lpVtbl -> get_Id(This,value) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice_get_SimpleHapticsController(This,value) \
( (This)->lpVtbl -> get_SimpleHapticsController(This,value) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____x_ABI_CWindows_CDevices_CHaptics_CIVibrationDevice_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0040 */
/* [local] */
#if !defined(____x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics_INTERFACE_DEFINED__)
extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_Windows_Devices_Haptics_IVibrationDeviceStatics[] = L"Windows.Devices.Haptics.IVibrationDeviceStatics";
#endif /* !defined(____x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics_INTERFACE_DEFINED__) */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0040 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0040_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0040_v0_0_s_ifspec;
#ifndef ____x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics_INTERFACE_DEFINED__
#define ____x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics_INTERFACE_DEFINED__
/* interface __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics */
/* [uuid][object] */
/* interface ABI::Windows::Devices::Haptics::IVibrationDeviceStatics */
/* [uuid][object] */
EXTERN_C const IID IID___x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics;
#if defined(__cplusplus) && !defined(CINTERFACE)
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace Devices {
namespace Haptics {
MIDL_INTERFACE("53E2EDED-2290-4AC9-8EB3-1A84122EB71C")
IVibrationDeviceStatics : public IInspectable
{
public:
virtual HRESULT STDMETHODCALLTYPE RequestAccessAsync(
/* [out][retval] */ __RPC__deref_out_opt __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus **operation) = 0;
virtual HRESULT STDMETHODCALLTYPE GetDeviceSelector(
/* [out][retval] */ __RPC__deref_out_opt HSTRING *result) = 0;
virtual HRESULT STDMETHODCALLTYPE FromIdAsync(
/* [in] */ __RPC__in HSTRING deviceId,
/* [out][retval] */ __RPC__deref_out_opt __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice **operation) = 0;
virtual HRESULT STDMETHODCALLTYPE GetDefaultAsync(
/* [out][retval] */ __RPC__deref_out_opt __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice **operation) = 0;
virtual HRESULT STDMETHODCALLTYPE FindAllAsync(
/* [out][retval] */ __RPC__deref_out_opt __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice **operation) = 0;
};
extern const __declspec(selectany) IID & IID_IVibrationDeviceStatics = __uuidof(IVibrationDeviceStatics);
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#else /* C style interface */
typedef struct __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStaticsVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
HRESULT ( STDMETHODCALLTYPE *RequestAccessAsync )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics * This,
/* [out][retval] */ __RPC__deref_out_opt __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationAccessStatus **operation);
HRESULT ( STDMETHODCALLTYPE *GetDeviceSelector )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics * This,
/* [out][retval] */ __RPC__deref_out_opt HSTRING *result);
HRESULT ( STDMETHODCALLTYPE *FromIdAsync )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics * This,
/* [in] */ __RPC__in HSTRING deviceId,
/* [out][retval] */ __RPC__deref_out_opt __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice **operation);
HRESULT ( STDMETHODCALLTYPE *GetDefaultAsync )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics * This,
/* [out][retval] */ __RPC__deref_out_opt __FIAsyncOperation_1_Windows__CDevices__CHaptics__CVibrationDevice **operation);
HRESULT ( STDMETHODCALLTYPE *FindAllAsync )(
__RPC__in __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics * This,
/* [out][retval] */ __RPC__deref_out_opt __FIAsyncOperation_1___FIVectorView_1_Windows__CDevices__CHaptics__CVibrationDevice **operation);
END_INTERFACE
} __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStaticsVtbl;
interface __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics
{
CONST_VTBL struct __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStaticsVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics_RequestAccessAsync(This,operation) \
( (This)->lpVtbl -> RequestAccessAsync(This,operation) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics_GetDeviceSelector(This,result) \
( (This)->lpVtbl -> GetDeviceSelector(This,result) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics_FromIdAsync(This,deviceId,operation) \
( (This)->lpVtbl -> FromIdAsync(This,deviceId,operation) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics_GetDefaultAsync(This,operation) \
( (This)->lpVtbl -> GetDefaultAsync(This,operation) )
#define __x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics_FindAllAsync(This,operation) \
( (This)->lpVtbl -> FindAllAsync(This,operation) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____x_ABI_CWindows_CDevices_CHaptics_CIVibrationDeviceStatics_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0041 */
/* [local] */
#ifndef RUNTIMECLASS_Windows_Devices_Haptics_KnownSimpleHapticsControllerWaveforms_DEFINED
#define RUNTIMECLASS_Windows_Devices_Haptics_KnownSimpleHapticsControllerWaveforms_DEFINED
extern const __declspec(selectany) _Null_terminated_ WCHAR RuntimeClass_Windows_Devices_Haptics_KnownSimpleHapticsControllerWaveforms[] = L"Windows.Devices.Haptics.KnownSimpleHapticsControllerWaveforms";
#endif
#ifndef RUNTIMECLASS_Windows_Devices_Haptics_SimpleHapticsController_DEFINED
#define RUNTIMECLASS_Windows_Devices_Haptics_SimpleHapticsController_DEFINED
extern const __declspec(selectany) _Null_terminated_ WCHAR RuntimeClass_Windows_Devices_Haptics_SimpleHapticsController[] = L"Windows.Devices.Haptics.SimpleHapticsController";
#endif
#ifndef RUNTIMECLASS_Windows_Devices_Haptics_SimpleHapticsControllerFeedback_DEFINED
#define RUNTIMECLASS_Windows_Devices_Haptics_SimpleHapticsControllerFeedback_DEFINED
extern const __declspec(selectany) _Null_terminated_ WCHAR RuntimeClass_Windows_Devices_Haptics_SimpleHapticsControllerFeedback[] = L"Windows.Devices.Haptics.SimpleHapticsControllerFeedback";
#endif
#ifndef RUNTIMECLASS_Windows_Devices_Haptics_VibrationDevice_DEFINED
#define RUNTIMECLASS_Windows_Devices_Haptics_VibrationDevice_DEFINED
extern const __declspec(selectany) _Null_terminated_ WCHAR RuntimeClass_Windows_Devices_Haptics_VibrationDevice[] = L"Windows.Devices.Haptics.VibrationDevice";
#endif
/* interface __MIDL_itf_windows2Edevices2Ehaptics_0000_0041 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0041_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Edevices2Ehaptics_0000_0041_v0_0_s_ifspec;
/* Additional Prototypes for ALL interfaces */
unsigned long __RPC_USER HSTRING_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in HSTRING * );
unsigned char * __RPC_USER HSTRING_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in HSTRING * );
unsigned char * __RPC_USER HSTRING_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out HSTRING * );
void __RPC_USER HSTRING_UserFree( __RPC__in unsigned long *, __RPC__in HSTRING * );
unsigned long __RPC_USER HSTRING_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in HSTRING * );
unsigned char * __RPC_USER HSTRING_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in HSTRING * );
unsigned char * __RPC_USER HSTRING_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out HSTRING * );
void __RPC_USER HSTRING_UserFree64( __RPC__in unsigned long *, __RPC__in HSTRING * );
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif
|
<reponame>Leyonce/SimpleWeatherStation
/*
* 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 sensorapp;
import java.sql.SQLException;
import sensorapp.station.ConcreteDisplay.StationUI;
/**
*
* @author leo
*/
public class SensorApp {
public static void main(String[] args) throws SQLException {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(StationUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(StationUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(StationUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(StationUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
StationUI station = StationUI.getInstance();
station.setVisible(true);
//
// Sensor sensor1 = Station.getInstance().createSensor("Temp1", SensorType.TEMPERATURE.toString(), new Location());
//// System.out.println(sensor1);
//// Station.getInstance().startSensor(sensor1);
// Sensor sensor2 = Station.getInstance().createSensor("Humi1", SensorType.HUMIDITY.toString(), new Location());
//// System.out.println(sensor2);
//// Station.getInstance().startSensor(sensor2);
// Sensor sensor3 = Station.getInstance().createSensor("Press1", SensorType.PRESSURE.toString(), new Location());
//// System.out.println(sensor3);
//// Station.getInstance().startSensor(sensor3);
// Sensor sensor4 = Station.getInstance().createSensor("Wind1", SensorType.WIND_VELOCITY.toString(), new Location());
//// System.out.println(sensor4);
//// Station.getInstance().startSensor(sensor4);
}
}
|
Dave Hause had it all figured out by his late 20s: he was the singer in a successful punk band, the Loved Ones; ran his own construction business in Philadelphia when he wasn’t touring; and was happily married. Then it all fell apart: the band petered out, construction work dried up when the economy tanked in 2009 and he and his wife split up — a string of events that laid the foundation for his new solo album “Devour,” premiering today on Speakeasy.
It’s an album divided into thirds as Hause, 35, reflects on his origins growing up in an evangelical Christian household in working-class Philadelphia, how that informs his present circumstances and what may come in the future. The song on “Devour” are bracing, downhearted anthems that are at once gritty, frank and catchy. Read more about Hause and listen to the album.
|
def plr(self,
polygon: Polygon,
splitter: Segment) -> RootedPolygons:
vertices_in_interval = cut(polygon.border,
splitter.start,
splitter.end)
if len(vertices_in_interval) < 3:
current_polygon_part = EMPTY
else:
contour = Contour(shrink_collinear_vertices(
Contour(vertices_in_interval)))
current_polygon_part = Polygon(contour)
pred_poly_by_line = self.pred_poly_by_line(polygon, splitter=splitter)
return RootedPolygons(root=current_polygon_part,
predecessors=pred_poly_by_line)
|
<reponame>PowerRocker/rpi_spark_examples
# eye
# pupil
# Upper eyelid
# Lower eyelid
# nose
# mouth
# Upper lip
# Lower lip
# eyebrow
from JMRPiSpark.Drives.Screen.SScreen import SSRect
class Organ:
# Screen Canvas
_cavas = None
# SSRect class
_ssrect = None
_ssrect_last = None
def __init__(self, cavas, x, y, width, height):
self._cavas = cavas
self._ssrect = SSRect(x, y, width, height)
self._ssrect_last = SSRect(x, y, width, height)
def rest(self):
self._ssrect_last = SSRect( self._ssrect.x, self._ssrect.y, self._ssrect.height, self._ssrect.width )
def draw(self):
raise NotImplementedError
class Eye(Organ):
closedEye = False
def draw(self):
self._cavas.ellipse( self._ssrect.rectToArray(), 1 if closedEye!=False else 0, 1 )
class Eyelid(Organ):
openPercent = 1
def draw(self):
self._cavas.ellipse( self._ssrect.rectToArray(), 1 , 0 )
class Pupil(Organ):
def draw(self):
self._cavas.ellipse( self._ssrect.rectToArray(), 0 , 0 )
class Nose(Organ):
pass
class Lip(Organ):
pass
class Eyebrow(Organ):
pass
class SmileFace:
pass
|
#include <bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define rep(a, b, c) for (int a = b; a < c; a++)
#define sz(x) (int)x.size()
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
const ll M = ll(1e9) + 7;
vi num, st;
vector<vector<pii>> ed;
int Time;
template<class F>
int dfs(int at, int par, F& f) {
int me = num[at] = ++Time, e, y, top = me;
for (auto pa : ed[at]) if (pa.second != par) {
tie(y, e) = pa;
if (num[y]) {
top = min(top, num[y]);
if (num[y] < me)
st.push_back(e);
} else {
int si = sz(st);
int up = dfs(y, e, f);
top = min(top, up);
if (up == me) {
st.push_back(e);
f(vi(st.begin() + si, st.end()));
st.resize(si);
}
else if (up < me) st.push_back(e);
else { /* e is a bridge */ }
}
}
return top;
}
template<class F>
void bicomps(F f) {
num.assign(sz(ed), 0);
rep(i,0,sz(ed)) if (!num[i]) dfs(i, -1, f);
}
vi bfs(int s, vector<bool>& bad) {
int n = ed.size();
vi d(n, -1);
deque<int> q({s});
d[s] = 0;
while (!q.empty()) {
int u = q.front(); q.pop_front();
for (auto [v, id] : ed[u]) {
if (d[v] == -1 || d[v] > d[u] + !bad[id]) {
d[v] = d[u] + !bad[id];
if (!bad[id]) q.push_back(v);
else q.push_front(v);
}
}
}
return d;
}
void solve() {
int n, m;
cin >> n >> m;
ed.resize(n);
vector<pii> edges;
rep (i, 0, m) {
int u, v;
cin >> u >> v;
u--, v--;
ed[u].emplace_back(v, edges.size());
ed[v].emplace_back(u, edges.size());
edges.emplace_back(u, v);
}
vector<bool> bad(edges.size());
bicomps([&](const vi& elist) {
for (int e : elist)
bad[e] = 1;
});
vi d1 = bfs(0, bad);
int far = 0;
rep (i, 0, n)
if (d1[i] > d1[far])
far = i;
vi d2 = bfs(far, bad);
cout << *max_element(all(d2)) << '\n';
}
int main() {
cin.tie(0)->sync_with_stdio(0);
cin.exceptions(cin.failbit);
solve();
return 0;
}
|
<filename>ssgetpy/matrix.py
import os
import time
import requests
from tqdm.auto import tqdm
from . import bundle
from .config import SS_DIR, SS_ROOT_URL
class MatrixList(list):
def _repr_html_(self):
body = "".join(r.to_html_row() for r in self)
return f"<table>{Matrix.html_header()}<tbody>{body}</tbody></table>"
def __getitem__(self, expr):
result = super().__getitem__(expr)
return MatrixList(result) if isinstance(expr, slice) else result
def download(self, format="MM", destpath=None, extract=False):
with tqdm(total=len(self), desc="Overall progress") as pbar:
for matrix in self:
matrix.download(format, destpath, extract)
pbar.update(1)
class Matrix:
"""
A `Matrix` object represents an entry in the SuiteSparse matrix collection.
It has the following attributes:
`id` : The unique identifier for the matrix in the database.
`group`: The name of the group this matrix belongs to.
`name` : The name of this matrix.
`rows` : The number of rows.
`cols` : The number of columns.
`nnz` : The number of non-zero elements.
`dtype`: The datatype of non-zero elements: `real`, `complex` or `binary`
`is2d3d`: True if this matrix comes from a 2D or 3D discretization.
`isspd` : True if this matrix is symmetric, positive definite
`kind` : The underlying problem domain
"""
attr_list = [
"Id",
"Group",
"Name",
"Rows",
"Cols",
"NNZ",
"DType",
"2D/3D Discretization?",
"SPD?",
"Pattern Symmetry",
"Numerical Symmetry",
"Kind",
"Spy Plot",
]
@staticmethod
def html_header():
return (
"<thead>"
+ "".join(f"<th>{attr}</th>" for attr in Matrix.attr_list)
+ "</thead>"
)
def __init__(
self,
identifier,
group,
name,
rows,
cols,
nnz,
dtype,
is2d3d,
isspd,
psym,
nsym,
kind,
):
self.id = identifier
self.group = group
self.name = name
self.rows = rows
self.cols = cols
self.nnz = nnz
self.dtype = dtype
self.is2d3d = not not is2d3d
self.isspd = not not isspd
self.psym = psym
self.nsym = nsym
self.kind = kind
def to_tuple(self):
"""
Returns the fields in a `Matrix` instance in a tuple.
"""
return (
self.id,
self.group,
self.name,
self.rows,
self.cols,
self.nnz,
self.dtype,
self.is2d3d,
self.isspd,
self.psym,
self.nsym,
self.kind,
self.icon_url(),
)
def _render_item_html(self, key, value):
if key == "Spy Plot":
return f'<img src="{value}">'
if key == "Group":
return f'<a href="{self.group_info_url()}" target="_blank">{value}</a>'
if key == "Name":
return f'<a href="{self.matrix_info_url()}" target="_blank">{value}</a>'
if key in ("Pattern Symmetry", "Numerical Symmetry"):
return f"{value:0.2}"
if key in ("2D/3D Discretization?", "SPD?"):
return "Yes" if value else "No"
return str(value)
def to_html_row(self):
return (
"<tr>"
+ "".join(
f"<td>{self._render_item_html(key, value)}</td>"
for key, value in zip(Matrix.attr_list, self.to_tuple())
)
+ "</tr>"
)
def _filename(self, format="MM"):
if format == "MM" or format == "RB":
return self.name + ".tar.gz"
elif format == "MAT":
return self.name + ".mat"
else:
raise ValueError("Format must be 'MM', 'MAT' or 'RB'")
def _defaultdestpath(self, format="MM"):
return os.path.join(SS_DIR, format, self.group)
def icon_url(self):
return "/".join((SS_ROOT_URL, "files", self.group, self.name + ".png"))
def group_info_url(self):
return "/".join((SS_ROOT_URL, self.group))
def matrix_info_url(self):
return "/".join((SS_ROOT_URL, self.group, self.name))
def url(self, format="MM"):
"""
Returns the URL for this `Matrix` instance.
"""
fname = self._filename(format)
directory = format.lower() if format == "MAT" else format
return "/".join((SS_ROOT_URL, directory, self.group, fname))
def localpath(self, format="MM", destpath=None, extract=False):
destpath = destpath or self._defaultdestpath(format)
# localdestpath is the directory containing the unzipped files
# in the case of MM and RB (if extract is true) or
# the file itself in the case of MAT (or if extract is False)
localdest = os.path.join(destpath, self._filename(format))
localdestpath = (
localdest
if (format == "MAT" or not extract)
else os.path.join(destpath, self.name)
)
return localdestpath, localdest
def download(self, format="MM", destpath=None, extract=False):
"""
Downloads this `Matrix` instance to the local machine,
optionally unpacking any TAR.GZ files.
"""
# destpath is the directory containing the matrix
# It is of the form ~/.PyUFGet/MM/HB
destpath = destpath or self._defaultdestpath(format)
# localdest is matrix file (.MAT or .TAR.GZ)
# if extract = True, localdestpath is the directory
# containing the unzipped matrix
localdestpath, localdest = self.localpath(format, destpath, extract)
if not os.access(localdestpath, os.F_OK):
# Create the destination path if necessary
os.makedirs(destpath, exist_ok=True)
response = requests.get(self.url(format), stream=True)
content_length = int(response.headers["content-length"])
with open(localdest, "wb") as outfile, tqdm(
total=content_length, desc=self.name, unit="B"
) as pbar:
for chunk in response.iter_content(chunk_size=4096):
outfile.write(chunk)
pbar.update(4096)
time.sleep(0.1)
if extract and (format == "MM" or format == "RB"):
bundle.extract(localdest)
return localdestpath, localdest
def __str__(self):
return str(self.to_tuple())
def __repr__(self):
return "Matrix" + str(self.to_tuple())
def _repr_html_(self):
return (
f"<table>{Matrix.html_header()}"
+ f"<tbody>{self.to_html_row()}</tbody></table>"
)
|
/**
* Tasks executor with a limited queue.
*/
public class LimitedServiceExecutor implements ServiceExecutor {
private static final Logger LOG = LoggerFactory.getLogger(LimitedServiceExecutor.class);
private final int queueLimit;
private final ExecutorService delegate;
private final AtomicInteger queueSize = new AtomicInteger();
public LimitedServiceExecutor(int queueLimit, ExecutorService delegate) {
this.queueLimit = queueLimit;
this.delegate = delegate;
}
public static ExecutorService createForkJoinPool(String threadName, int defaultWorkers) {
return new ForkJoinPool(defaultWorkers, createForkJoinThreadFactory(threadName, defaultWorkers), null, true);
}
public static ExecutorService createFixedThreadPool(String threadName, int defaultWorkers) {
return Executors.newFixedThreadPool(defaultWorkers, new NamedThreadFactory(threadName, defaultWorkers));
}
@Override
public void execute(@Nonnull Runnable command) {
if (LOG.isDebugEnabled()) {
int size = queueSize.get() + 1;
if (size > queueLimit + 10) {
LOG.debug("Queue overflow: {} > {}", size, queueLimit);
}
}
delegate.execute(command);
}
@Override
public void execute(Session session, ExceptionHandler handler, ServiceRunnable runnable) {
if (!reserveQueue(1)) {
handler.handleException(session, ServiceOverloadException.INSTANCE);
return;
}
delegate.execute(() -> {
try {
run(session, handler, runnable);
} finally {
queueSize.decrementAndGet();
}
});
}
@Override
public void run(Session session, ExceptionHandler handler, ServiceRunnable runnable) {
try {
runnable.run();
} catch (ServerRuntimeException e) {
handler.handleException(session, e);
} catch (NoSuchElementException e) {
handler.handleException(session, new ClientBadRequestException(e));
} catch (IOException | RuntimeException e) {
handler.handleException(session, new ServerRuntimeException(e));
}
}
@Override
public boolean reserveQueue(int tasksNum) {
int v1;
int v2;
do {
v1 = queueSize.get();
v2 = v1 + tasksNum;
if (v2 > queueLimit) {
return false;
}
} while (!queueSize.compareAndSet(v1, v2));
return true;
}
@Override
public void releaseQueueOnce() {
queueSize.decrementAndGet();
}
@Override
public void awaitAndShutdown() {
try {
delegate.shutdown();
if (!delegate.awaitTermination(60, TimeUnit.SECONDS)) {
delegate.shutdownNow();
if (!delegate.awaitTermination(30, TimeUnit.SECONDS)) {
throw new InterruptedException();
}
}
} catch (InterruptedException e) {
LOG.error("Error: executor can't shutdown on its own", e);
Thread.currentThread().interrupt();
}
}
private static ForkJoinPool.ForkJoinWorkerThreadFactory createForkJoinThreadFactory(
String threadName, int defaultWorkers
) {
return new ForkJoinPool.ForkJoinWorkerThreadFactory() {
private final AtomicInteger threadNumber = new AtomicInteger(1);
@Override
public ForkJoinWorkerThread newThread(ForkJoinPool pool) {
String name = NamedThreadFactory.buildName(threadName, threadNumber.getAndIncrement(), defaultWorkers);
ForkJoinWorkerThread t = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool);
t.setName(name);
return t;
}
};
}
}
|
/**
* Updates the state and the state covariance matrix using a radar measurement.
* @param {MeasurementPackage} meas_package
*/
void UKF::UpdateRadar(MeasurementPackage meas_package) {
n_z_ = n_z_radar;
R = R_radar;
Zsig = MatrixXd(n_z_, 2 * n_aug_ + 1);
for (unsigned int i = 0; i < 2 * n_aug_ + 1; i++) {
double rho = sqrt(Xsig_pred_.col(i)[0]*Xsig_pred_.col(i)[0] + Xsig_pred_.col(i)[1]*Xsig_pred_.col(i)[1]);
double psi = atan2(Xsig_pred_.col(i)[1],Xsig_pred_.col(i)[0]);
double phi = Xsig_pred_.col(i)[3];
double rhodot = Xsig_pred_.col(i)[2]*(Xsig_pred_.col(i)[0]*cos(phi) + Xsig_pred_.col(i)[1]*sin(phi))/rho;
Zsig.col(i) << rho, psi, rhodot;
}
Update(meas_package);
return;
}
|
def build_report(self, file_path:str, title: str, results: dict) -> None:
curdoc().theme = REPORT_THEME
page_builder = PageBuilder()
pages = []
for asset_class_id, asset_class_results in results.items():
pages.append(page_builder.build_page(asset_class_id, asset_class_results))
output_file(file_path, title=title)
tabs = Tabs(tabs=pages)
save(tabs)
|
/*
* Hair2 License
*
* Copyright (C) 2008 <NAME>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.mhu.hair.plugin.ui;
import java.awt.BorderLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.util.Iterator;
import java.util.Timer;
import java.util.TimerTask;
import java.util.TreeMap;
import javax.swing.AbstractButton;
import javax.swing.BoxLayout;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JToggleButton;
import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import com.documentum.fc.client.IDfCollection;
import com.documentum.fc.client.IDfFolder;
import com.documentum.fc.client.IDfPersistentObject;
import com.documentum.fc.client.IDfQuery;
import com.documentum.fc.client.IDfSysObject;
import com.documentum.fc.common.DfException;
import com.documentum.fc.common.DfId;
import com.documentum.fc.common.IDfId;
import de.mhu.hair.api.ApiLayout;
import de.mhu.hair.api.ApiObjectChanged;
import de.mhu.hair.api.ApiObjectHotSelect;
import de.mhu.hair.api.ApiSystem;
import de.mhu.hair.dctm.DMConnection;
import de.mhu.hair.plugin.Plugin;
import de.mhu.hair.plugin.PluginConfig;
import de.mhu.hair.plugin.PluginNode;
import de.mhu.hair.plugin.ui.DMList.Listener;
import de.mhu.hair.tools.ObjectTool;
import de.mhu.lib.ATimerTask;
import de.mhu.lib.resources.ImageProvider;
import de.mhu.lib.swing.PopupButton;
import de.mhu.lib.swing.PopupListener;
import de.mhu.res.img.LUF;
public class DocumentPlugin extends AbstractHotSelectMenu implements Plugin,
ApiObjectChanged {
private DMConnection con;
private PluginNode node;
private IDfFolder selected;
private JButton bReload;
//private JToggleButton bShowVersions;
protected boolean showVersions;
private DMList list;
private Timer timer;
private PopupButton bFilter;
protected boolean showDeleted;
protected boolean showFolders;
protected void apiObjectDepricated0() {
list.getLabel().setIcon(LUF.DOT_RED);
}
protected void apiObjectHotSelected0(DMConnection con,
IDfPersistentObject[] parents2, IDfPersistentObject[] obj)
throws Exception {
showObj(con, parents2, obj);
list.getLabel().setIcon(LUF.DOT_GREEN);
}
public void destroyPlugin() throws Exception {
}
public void initPlugin(PluginNode pNode, PluginConfig pConfig)
throws Exception {
con = (DMConnection) pNode.getSingleApi(DMConnection.class);
timer = ((ApiSystem)pNode.getSingleApi(ApiSystem.class)).getTimer();
node = pNode;
showFolders = true;
initUI();
node.addApi(ApiObjectChanged.class, this);
try {
((ApiLayout) pNode.getSingleApi(ApiLayout.class)).setComponent(
this, pConfig.getNode());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (pConfig.getNode().getAttribute("listen").indexOf("_obj.hotselect_") >= 0) {
initHotSelectMenu(pNode, pConfig, this);
pNode.addApi(ApiObjectHotSelect.class, this);
}
if (pConfig.getNode().getAttribute("listen").indexOf("_obj.last_") >= 0) {
IDfPersistentObject obj = con.getPersistentObject(pConfig
.getProperty("objid"));
if (obj instanceof IDfFolder)
showObj(con, (IDfFolder) obj);
}
}
private void showObj(DMConnection con2, IDfPersistentObject obj) {
showObj(con2, null, new IDfPersistentObject[] { obj } );
}
private void showObj(DMConnection con2, IDfPersistentObject[] parents, IDfPersistentObject[] obj) {
try {
list.setConnection(con2);
// if invalide object
if (obj == null || obj.length < 1 || obj[0] == null ) {
list.clear();
return;
}
IDfFolder sel = null;
// if selectino is a document or a folder
if ( !(obj[0] instanceof IDfFolder) ) {
if ( parents != null && parents.length > 0 && parents[0] != null && (parents[0] instanceof IDfFolder) ) {
sel = (IDfFolder)parents[0];
} else {
sel = (IDfFolder)con.getExistingObject( obj[0].getRepeatingString("i_folder_id", 0) );
}
} else {
sel = (IDfFolder)obj[0];
}
// maybe clean up list
if ( this.selected == null || sel == null || ! this.selected.equals( sel ) ) {
list.clear();
this.selected = sel;
}
list.getLabel().setText(ObjectTool.getPath(selected));
if ( list.getTable().getRowCount() == 0 ) {
String dql = "select SUBSTR(r_object_id,0,2),UPPER(object_name),r_object_id,object_name,r_object_type,a_content_type,language_code,r_version_label,r_creation_date from ";
if ( showFolders )
dql+="dm_sysobject ";
else
dql+="dm_document ";
if ( showDeleted )
dql+="(deleted) ";
else
if ( showVersions )
dql+="(all) ";
dql+="where any i_folder_id='" + selected.getObjectId() +
"' order by 1 desc,2,r_creation_date,language_code";
IDfQuery query = con2.createQuery(dql);
IDfCollection res = query.execute(con2.getSession(),
IDfQuery.EXEC_QUERY);
list.merge(res);
list.updateHeader();
res.close();
}
if ( !(obj[0] instanceof IDfFolder) ) {
list.getTable().getSelectionModel().clearSelection();
for ( int i = 0; i < list.getTable().getRowCount(); i++) {
String idA = list.getUserObject( i );
for ( IDfPersistentObject objB : obj ) {
String idB = objB.getObjectId().getId();
if ( idA.equals( idB ) )
list.getTable().getSelectionModel().addSelectionInterval(i, i);
}
}
}
list.getLabel().setIcon(LUF.DOT_GREEN);
} catch (Exception e) {
e.printStackTrace();
list.clear();
}
}
// public void show(DMConnection con2, IDfFolder object) {
// con = con2;
// selected = object;
// setWorking(true);
// timer.schedule(new ATimerTask() {
//
// public void run0() throws Exception {
//
// label.setText(ObjectTool.getPath(selected));
// listModel.removeAllElements();
// String dql = "";
// if (showVersions)
// dql = "select r_object_id,object_name,r_object_type,a_content_type,language_code,r_version_label from dm_document (all) where any i_folder_id='"
// + selected.getObjectId() + "'";
// else
// dql = "select r_object_id,object_name,r_object_type,a_content_type,language_code,r_version_label from dm_document where any i_folder_id='"
// + selected.getObjectId() + "'";
//
// IDfQuery query = con.createQuery(dql);
//
// IDfCollection res = query.execute(con.getSession(),
// IDfQuery.READ_QUERY);
//
//// final TreeMap v = new TreeMap();
//// while (res.next()) {
//// // System.out.println( "FOUND CHILD: " + res.getString(
//// // "object_name" ) );
//// String key = res.getString("object_name");
////
//// String[] cVersion = new String[res
//// .getValueCount("r_version_label")];
//// for (int z = 0; z < cVersion.length; z++) {
//// cVersion[z] = res.getRepeatingString("r_version_label",
//// z);
//// key = key + "_" + cVersion[z];
//// }
////
//// v.put(key, new NodeValue(new DfId(res
//// .getString("r_object_id")), selected.getObjectId(),
//// res.getString("object_name"), res
//// .getString("r_object_type"), res
//// .getString("a_content_type"), res
//// .getString("language_code"), cVersion));
//// }
//// res.close();
////
//// SwingUtilities.invokeLater(new Runnable() {
////
//// public void run() {
//// for (Iterator i = v.values().iterator(); i.hasNext();) {
//// NodeValue value = (NodeValue) i.next();
//// listModel.addElement(value);
//// }
//// }
////
//// });
//
// }
//
// public void onFinal(boolean isError) {
// setWorking(false);
// }
//
// }, 100);
//
// }
private void initUI() {
setLayout(new BorderLayout());
list = new DMList("", new ListListener(), new String[] { "object_name","r_object_type","a_content_type","language_code","r_version_label" }, "r_object_id");
list.getTable().setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
DocumentTableCellRenderer renderer = new DocumentTableCellRenderer(list);
renderer.setColName(0);
renderer.setColType(1);
renderer.setColContentType(2);
renderer.setColLang(3);
renderer.setColVersion(4);
list.getTable().setDefaultRenderer(Object.class, renderer);
add(list, BorderLayout.CENTER);
JPanel accessories = new JPanel();
accessories.setLayout(new BoxLayout(accessories,BoxLayout.X_AXIS));
// list.addListSelectionListener(new ListSelectionListener() {
//
// public void valueChanged(ListSelectionEvent arg0) {
//
// if (arg0.getValueIsAdjusting())
// return;
//
// // System.out.println( "Document send HotSelect " );
// Object[] value = list.getSelectedValues();
// try {
// if (value == null) {
// ApiObjectHotSelect[] list = (ApiObjectHotSelect[]) node
// .getApi(ApiObjectHotSelect.class);
// if (list == null)
// return;
//
// for (int i = 0; i < list.length; i++)
// try {
// list[i].apiObjectHotSelected(con, null, null);
// } catch (Throwable t) {
// t.printStackTrace();
// }
// return;
// }
//
// final IDfPersistentObject[] obj = new IDfPersistentObject[value.length];
// final IDfPersistentObject[] parents = new IDfPersistentObject[value.length];
//
// for (int i = 0; i < value.length; i++) {
// obj[i] = con.getPersistentObject(((NodeValue) value[i])
// .getId());
// if (((NodeValue) value[i]).getParentId() != null)
// parents[i] = con
// .getPersistentObject(((NodeValue) value[i])
// .getParentId());
// }
//
// final ApiObjectHotSelect[] list = (ApiObjectHotSelect[]) node
// .getApi(ApiObjectHotSelect.class);
// if (list == null)
// return;
//
// for (int i = 0; i < list.length; i++)
// try {
// if (!list[i].equals(DocumentPlugin.this)
// && !(list[i] instanceof TreePlugin))
// list[i].apiObjectDepricated();
// } catch (Throwable t) {
// t.printStackTrace();
// }
//
// timer.schedule(new TimerTask() {
//
// public void run() {
// for (int i = 0; i < list.length; i++)
// try {
// if (!list[i].equals(DocumentPlugin.this)
// && !(list[i] instanceof TreePlugin))
// list[i].apiObjectHotSelected(con,
// parents, obj);
// } catch (Throwable t) {
// t.printStackTrace();
// }
// }
//
// }, 1);
//
// } catch (DfException e) {
// e.printStackTrace();
// }
//
// }
//
// });
//
bReload = new JButton();
bReload.setBorderPainted(false);
bReload.setRolloverEnabled(true);
bReload.setMargin(new Insets(0, 0, 0, 0));
bReload.setIcon(LUF.RELOAD_ICON);
bReload.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
list.getLabel().setText("");
list.clear();
showObj(con, selected);
}
});
bFilter = new PopupButton(LUF.FILTER_ICON,"Filter");
bFilter.addCheckbox("Show Folders", new PopupListener() {
public void beforeVisible(AbstractButton c) {
}
public void actionPerformed(ActionEvent e) {
showFolders = ((JCheckBoxMenuItem)e.getSource()).isSelected();
list.clear();
showObj(con, selected);
}
}).setSelected(showFolders);
bFilter.addCheckbox("Show Versions", new PopupListener() {
public void beforeVisible(AbstractButton c) {
}
public void actionPerformed(ActionEvent e) {
showVersions = ((JCheckBoxMenuItem)e.getSource()).isSelected();
list.clear();
showObj(con, selected);
}
}).setSelected(showVersions);
bFilter.addCheckbox("Show Deleted", new PopupListener() {
public void beforeVisible(AbstractButton c) {
}
public void actionPerformed(ActionEvent e) {
showDeleted = ((JCheckBoxMenuItem)e.getSource()).isSelected();
list.clear();
showObj(con, selected);
}
}).setSelected(showDeleted);
accessories.add(bFilter);
accessories.add(bReload);
//
// JPanel panel1 = new JPanel();
// panel1.setLayout(new BorderLayout());
//
// JPanel panel2 = new JPanel();
// panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS));
// panel2.add(bShowVersions);
// panel2.add(bReload);
//
// panel1.add(label, BorderLayout.NORTH);
// panel1.add(panel2, BorderLayout.EAST);
// add(panel1, BorderLayout.NORTH);
list.setAccessory( accessories );
}
public void objectsChanged(int mode, IDfPersistentObject[] objects) {
}
public class ListListener extends DMListUserFieldObjListener {
public ListListener() {
super(node);
}
public boolean isCellEditable(DMList list, int row, int col) {
return false;
}
public boolean isEditable(DMList list) {
return false;
}
public boolean selectionValueChanged(ListSelectionEvent e,String[] ids) {
if (ids == null) return false;
int[] rows = list.getTable().getSelectedRows();
DfId[] dfids = new DfId[rows.length];
for ( int i = 0; i < ids.length; i++ )
dfids[i] = new DfId(list.getUserObject(rows[i]));
actionSelect2(dfids);
return true;
}
public void mouseClickedEvent(DMList list, String[] ids, MouseEvent me) {
try {
if (me.getButton() == MouseEvent.BUTTON1
&& me.getClickCount() == 1) {
// no more
} else {
super.mouseClickedEvent(list, ids, me);
}
} catch (Exception e) {
e.printStackTrace();
}
}
protected void actionSelect2(IDfId[] id) {
try {
if (id == null || id.length == 0) {
ApiObjectHotSelect[] list = (ApiObjectHotSelect[]) node
.getApi(ApiObjectHotSelect.class);
if (list == null)
return;
for (int i = 0; i < list.length; i++)
try {
list[i].apiObjectHotSelected(con, null, null);
} catch (Throwable t) {
t.printStackTrace();
}
return;
}
final IDfPersistentObject[] obj = new IDfPersistentObject[id.length];
final IDfPersistentObject[] parents = new IDfPersistentObject[id.length];
for (int i = 0; i < id.length; i++) {
obj[i] = con.getPersistentObject( id[i] );
parents[i] = selected;
}
final ApiObjectHotSelect[] list = (ApiObjectHotSelect[]) node
.getApi(ApiObjectHotSelect.class);
if (list == null)
return;
for (int i = 0; i < list.length; i++)
try {
if (!list[i].equals(DocumentPlugin.this)
&& !(list[i] instanceof TreePlugin))
list[i].apiObjectDepricated();
} catch (Throwable t) {
t.printStackTrace();
}
timer.schedule(new TimerTask() {
public void run() {
for (int i = 0; i < list.length; i++)
try {
if (!list[i].equals(DocumentPlugin.this)
&& !(list[i] instanceof TreePlugin))
list[i].apiObjectHotSelected(con,
parents, obj);
} catch (Throwable t) {
t.printStackTrace();
}
}
}, 1);
} catch (DfException e) {
e.printStackTrace();
}
}
public boolean valueChangedEvent(DMList list, int row, int col,
Object oldValue, Object newValue) {
return false;
}
}
}
|
<reponame>jtharris/chip8<gh_stars>10-100
package system
import (
"github.com/nsf/termbox-go"
"time"
)
// TerminalRenderer renders a virtual machine to a terminal using termbox
type TerminalRenderer struct {
shouldQuit bool
}
// Start the render loop, terminating when the escape key is pressed
func (t *TerminalRenderer) Start(vm *VirtualMachine) {
err := termbox.Init()
if err != nil {
panic(err)
}
for !t.shouldQuit {
t.updateKeys(vm)
t.render(&vm.Pixels)
time.Sleep(time.Millisecond)
}
termbox.Close()
}
func (t *TerminalRenderer) render(d *Display) {
termbox.Clear(termbox.ColorBlack, termbox.ColorBlack)
drawBorder()
for col := 0; col < 64; col++ {
for row := range d {
if d.PixelSetAt(col, row) {
termbox.SetCell(col+1, row+1, ' ', termbox.ColorGreen, termbox.ColorGreen)
}
}
}
termbox.Flush()
}
func drawBorder() {
for col := 0; col < 66; col++ {
termbox.SetCell(col, 0, '\u2550', termbox.ColorGreen, termbox.ColorDefault)
termbox.SetCell(col, 33, '\u2550', termbox.ColorGreen, termbox.ColorDefault)
}
for row := 1; row < 33; row++ {
termbox.SetCell(0, row, '\u2551', termbox.ColorGreen, termbox.ColorDefault)
termbox.SetCell(65, row, '\u2551', termbox.ColorGreen, termbox.ColorDefault)
}
}
var termKeyMap = []rune{'x', '1', '2', '3', 'q', 'w', 'e', 'a', 's', 'd', 'z', 'c', '4', 'r', 'f', 'v'}
func (t *TerminalRenderer) updateKeys(vm *VirtualMachine) {
// Gather up all the keyboard events for 2ms then exit
time.AfterFunc(time.Millisecond*2, termbox.Interrupt)
for {
ev := termbox.PollEvent()
if ev.Type == termbox.EventKey {
for i, char := range termKeyMap {
if char == ev.Ch {
vm.Keyboard[i] = true
break
}
}
if ev.Key == termbox.KeyEsc {
t.shouldQuit = true
return
}
} else if ev.Type == termbox.EventInterrupt {
return
}
}
}
|
<gh_stars>10-100
package amf3
const MaxInt int = 268435455
const MinInt int = -268435456
const UTF8Empty byte = 0x01
const (
TypeUndefined byte = 0x00
TypeNull = 0x01
TypeFalse = 0x02
TypeTrue = 0x03
TypeInteger = 0x04
TypeDouble = 0x05
TypeString = 0x06
TypeXmlDoc = 0x07
TypeDate = 0x08
TypeArray = 0x09
TypeObject =0x0A
TypeXml = 0x0B
TypeByteArray = 0x0C
TypeVectorInt = 0x0D
TypeVectorUint = 0x0E
TypeVectorDouble = 0x0F
TypeVectorObject = 0x10
TypeDictionary = 0x11
)
|
/**
* Base class for schedulers (pools) for Drillbits. Derived classes implement
* various policies for node selection. This class handles the common tasks such
* as holding the Drillbit launch specification, providing Drillbit- specific
* behaviors and so on.
* <p>
* The key purpose of this class is to abstract Drillbit-speicific code from the
* rest of the AM cluster controller. We do so for several reasons: ease of
* testing (we can use mock tasks), ability to handle additional server types in
* the future, and a way to keep each module focused on a single task (as the
* controller and its state machine is complex enough without mixing in Drillbit
* specifics.)
*/
public abstract class AbstractDrillbitScheduler
extends PersistentTaskScheduler {
/**
* Interface to provide Drill-bit specific behavior. Ideally, this class would
* provide the interface to gracefully shut down a Drillbit, but Drill has no
* API to do graceful shutdown in this release. (The only graceful shutdown is
* by issuing a SIGTERM from the node runing the Drillbit, but YARN has no way
* to do this, despite active discussions on several YARN JIRA entries.
*/
public class DrillbitManager extends AbstractTaskManager {
/**
* Allow only one concurrent container request by default to ensure that the
* node blacklist mechanism works to ensure that the RM does not allocate
* two containers on the same node.
*/
@Override
public int maxConcurrentAllocs() {
return 1;
}
@Override
public void allocated(EventContext context) {
// One drillbit per node, so reserve the node
// just allocated.
context.controller.getNodeInventory().reserve(context.task.container);
}
@Override
public void completed(EventContext context) {
// This method is called for all completed tasks, even those that
// completed (were cancelled) before a container was allocated.
// If we have no container, then we have nothing to tell the
// node inventory.
if (context.task.container != null) {
context.controller.getNodeInventory().release(context.task.container);
}
analyzeResult(context);
}
@Override
public boolean isLive(EventContext context) {
ZKRegistry reg = (ZKRegistry) context.controller.getProperty(ZKRegistry.CONTROLLER_PROPERTY);
return reg.isRegistered(context.task);
}
/**
* Analyze the result. Drillbits should not exit, but this one did. It might
* be because we asked it to exit, which is fine. Otherwise, the exit is
* unexpected and we should 1) provide the admin with an explanation, and 2)
* prevent retries after a few tries.
*
* @param context
*/
private void analyzeResult(EventContext context) {
Task task = context.task;
// If we cancelled the Drill-bit, just unblacklist the
// host so we can run another drillbit on it later.
if (task.isCancelled()) {
return;
}
// The Drill-bit stopped on its own.
// Maybe the exit status will tell us something.
int exitCode = task.completionStatus.getExitStatus();
// We can also consider the runtime.
long duration = task.uptime() / 1000;
// The ZK state may also help.
boolean registered = task.trackingState != Task.TrackingState.NEW;
// If the exit code was 1, then the script probably found
// an error. Only retry once.
if (registered || task.getTryCount() < 2) {
// Use the default retry policy.
return;
}
// Seems to be a mis-configuration. The Drill-bit exited quickly and
// did not register in ZK. Also, we've tried twice now with no luck.
// Assume the node is bad.
String hostName = task.getHostName();
StringBuilder buf = new StringBuilder();
buf.append(task.getLabel()).append(" on host ").append(hostName)
.append(" failed with status ").append(exitCode).append(" after ")
.append(duration).append(" secs. with");
if (!registered) {
buf.append("out");
}
buf.append(" ZK registration");
if (duration < 60 && !registered) {
buf.append(
"\n Probable configuration problem, check Drill log file on host ")
.append(hostName).append(".");
}
LOG.error(buf.toString());
task.cancelled = true;
// Mark the host as permanently blacklisted. Leave it
// in YARN's blacklist.
context.controller.getNodeInventory().blacklist(hostName);
}
}
private static final Log LOG = LogFactory
.getLog(AbstractDrillbitScheduler.class);
public AbstractDrillbitScheduler(String type, String name, int quantity) {
super(type, name, quantity);
isTracked = true;
setTaskManager(new DrillbitManager());
}
}
|
Investigation of concrete crack repair by electrochemical deposition
Cracks in reinforced concrete structures are inevitable in the process of use. Cracks not only affect the aesthetics of the structure appearance, but also affect the overall performance of the structure and shorten its life. Traditional methods are limited for repairing cracks in reinforced concrete in an aqueous environment. Electrochemical deposition is a relatively new method for repairing cracks in reinforced concrete, which fills and heals cracks in concrete, and increases the alkalinity of the surroundings of the reinforcing steel in concrete, slowing down the reinforcing steel corrosion caused by harmful substances. In this study, the changes in the surface coverage of the concrete specimens during the repair process were studied. Three different concentrations of electrolyte solutions were tested with three different intensities of electric current. The test results showed that the surface coverage of the concrete specimens was increasing during the repair process. The repair depths of the cracks on the specimens were measured by three different intensities of electric current to three different concentrations of electrolyte solutions at different times. The results showed that the repair rate of the crack depth of the specimens increased and then decreased with the increase of the current intensity. It can be concluded that the rate of crack repair increases with the current intensity and then decreases with the increase of electrolyte solution concentration.
|
Australia’s national rail network will reportedly be privatised, possibly through a share market listing, under plans to be announced in the federal budget tomorrow night.
Treasurer Joe Hockey will outline a plan to sell the Australian Rail Track Corporation as part of a suite of measures to shrink bureaucracy and provide an exit for government from some areas of operations where the private sector can step in.
The ARTC manages over 8,500kms of interstate track across South Australia, Victoria, WA, Queensland and NSW. It maintains the national rail network, runs its capital investment, and sells access to rail operators. The sale has been discussed as an option for years and was contemplated by the Commission of Audit in its report to the government last year.
The audit commission noted:
In 2012-13, the Corporation reported annual infrastructure maintenance expenses of $174.6 million. Also, in recent years there has been a significant level of investment as part of past stimulus packages, resulting in improved track reliability and transit times on some sections of track. A major capital investment programme in excess of $3 billion is committed to 2017-18.
However, the audit commission also said “in recent years some of the capital projects undertaken by the Australian Rail Track Corporation have had marginal benefit-cost ratios, were not needed to meet future demand projections or did not effectively address expected capacity constraints”.
The commission valued the fixed assets of the ARTC at $4.4 billion. (For comparison, the Medibank Private float last year raised almost $5.7 billion.) With the government facing a deficit of some $45 billion, a valuation in that region won’t put a huge dent in the red column, but it all helps.
There’s more at The Australian.
Business Insider Emails & Alerts Site highlights each day to your inbox. Email Address Join
Follow Business Insider Australia on Facebook, Twitter, LinkedIn, and Instagram.
|
/**
* An {@link Iterable} and {@link Iterator} of {@link Part} instances from a
* {@link HttpServletRequest}.
*
* @author Oliver Richers
* @author Alexander Schmidt
*/
class AjaxFileUploadList implements Iterable<IDomFileUpload>, Iterator<IDomFileUpload> {
private final Iterator<Part> iterator;
private Part current;
/**
* Constructs a new {@link AjaxFileUploadList} with the specified first
* {@link Part} and an {@link Iterator} of {@link Part} instances.
*
* @param part
* the first {@link Part} (never <i>null</i>)
* @param iterator
* the {@link Iterator} to the following {@link Part} instances
* (never <i>null</i>)
*/
public AjaxFileUploadList(Part part, Iterator<Part> iterator) {
this.current = Objects.requireNonNull(part);
this.iterator = Objects.requireNonNull(iterator);
if (!isCurrentOkay()) {
findNext();
}
}
@Override
public boolean hasNext() {
if (current == null) {
findNext();
}
return current != null;
}
@Override
public IDomFileUpload next() {
if (current == null) {
throw new NoSuchElementException();
}
Part tmp = current;
current = null;
return new AjaxFileUpload(tmp);
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
@Override
public Iterator<IDomFileUpload> iterator() {
return this;
}
private boolean isCurrentOkay() {
return current != null && !isFormField(current) && !current.getName().isEmpty();
}
private boolean isFormField(Part part) {
return part.getSubmittedFileName() == null;
}
private void findNext() {
while (iterator.hasNext()) {
current = iterator.next();
if (isCurrentOkay()) {
return;
}
}
current = null;
}
}
|
/// Create Transaction from UnsignedTransaction and an array of proofs in the same order as
/// UnsignedTransaction.inputs
pub fn from_unsigned_tx(
unsigned_tx: UnsignedTransaction,
proofs: Vec<ProofBytes>,
) -> Result<Self, TransactionError> {
let inputs = unsigned_tx
.inputs
.enumerated()
.try_mapped(|(index, unsigned_input)| {
proofs
.get(index)
.map(|proof| Input::from_unsigned_input(unsigned_input, proof.clone()))
.ok_or_else(|| {
TransactionError::InvalidArgument(format!(
"no proof for input index: {}",
index
))
})
})?;
Ok(Transaction::new(
inputs,
unsigned_tx.data_inputs,
unsigned_tx.output_candidates,
)?)
}
|
"""IP fragments tests."""
|
// The providePathSuggestion provide filesystem completion
func providePathSuggestion(args ...string) []prompt.Suggest {
l := len(args)
if l == 0 {
return []prompt.Suggest{}
}
path := args[l-1]
if !strings.HasSuffix(path, "*") {
path = path + "*"
}
files, _ := filepath.Glob(path)
var ret []prompt.Suggest
for i, file := range files {
if i > 16 {
return ret
} else {
ret = append(ret, prompt.Suggest{Text: file})
}
}
return ret
}
|
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
module Database.Tables.Partners where
import qualified Data.Text as T
import Database.Esqueleto
import Database.Persist.TH
share
[mkPersist sqlSettings, mkMigrate "migratePartners"]
[persistLowerCase|
Partners
name Int
logo T.Text
url T.Text
deriving Show
|]
|
/**
* @license Use of this source code is governed by an MIT-style license that
* can be found in the LICENSE file at https://github.com/cartant/rxjs-tslint-rules
*/
import { expect } from "chai";
import * as semver from "semver";
import {
knownObservables,
knownOperators,
knownPipeableOperators,
knownPrototypeMethods,
knownStaticMethods,
} from "./knowns";
import * as peer from "./peer";
describe("knowns", () => {
it("should determine the observable factories", () => {
expect(knownObservables).to.have.property("concat");
expect(knownObservables).to.have.property("from");
expect(knownObservables).to.have.property("merge");
expect(knownObservables).to.have.property("of");
});
it("should determine the operators", () => {
expect(knownOperators).to.have.property("concatMap");
expect(knownOperators).to.have.property("exhaustMap");
expect(knownOperators).to.have.property("flatMap");
expect(knownOperators).to.have.property("mergeMap");
expect(knownOperators).to.have.property("switchMap");
});
it("should determine the pipeable operators", () => {
expect(knownPipeableOperators).to.have.property("concatMap");
expect(knownPipeableOperators).to.have.property("exhaustMap");
expect(knownPipeableOperators).to.have.property("flatMap");
expect(knownPipeableOperators).to.have.property("mergeMap");
expect(knownPipeableOperators).to.have.property("switchMap");
});
it("should determine the prototype methods", () => {
expect(knownPrototypeMethods).to.have.property("forEach");
if (semver.satisfies(peer.version, ">=5.5.0-beta.5")) {
expect(knownPrototypeMethods).to.have.property("pipe");
expect(knownPrototypeMethods).to.have.property("toPromise");
}
});
it("should determine the static methods", () => {
expect(knownStaticMethods).to.have.property("create");
});
});
|
Analyses and redesign of a technological device for automated assembly, using Design for Manufacturing and Assembly approach
This paper aims to present a theoretical approach and a case study within a research upon product and process design methods in terms of manufacturing and assembly – supported by DFMA (Design for Manufacturing and Assembly) techniques. Application of the integrated design capabilities provided by DFMA approach is illustrated with a case study on the development of a technological device for automated assembly of an industrial electrical plug inlet. The analysis and redesign using DFMA philosophy and advanced 3D design capabilities provided by CATIA V5 is an advanced engineering method for designing an innovative product in order to simplify the product, to quantify improvements and to reduce manufacturing and assembly costs. The new design of the studied product has been compared with the existing one from the aspect of parts quantity, handling time, assembly time and design efficiency. Finally, the study presents also some related conclusions together with further research directions.
Introduction. Problem statement
In the last decades, significant progress has been made in all stages of product design and development.
According to Boothroyd, designing is the first step in the manufacturing process and is the place where most of the important decisions that influence the final cost of a product are taken .
The interest of researchers around the world about this domain has continuously raised, many researches, studies and methodologies have been developed in recent years that has led to major technological results. An advanced design philosophy, which we consider useful to be applied even from the early design phases is Design for Manufacturing and Assembly (DFMA) developed by Boothroyd, Dewhurst, and Knight , which aims to minimize the overall cost of product manufacturing, through reducing the production cost, shortening the implementation time of the new product, and increasing the quality level. These are vital requirements that cannot be neglected by manufacturing companies which need to pay more and more attention to be competitive on a global dynamic market.
This paper is part of a wider research regarding the development of new or existing products, based on a conceptual model which has been taking into consideration advanced design philosophies such as Axiomatic Design , Design for Excellence and Concurrent Engineering together with CAD/CAE tools. The further on presented case study and theoretical considerations represent a
Theoretical backgrounds. Research problem substantiation
Design for Manufacturing and Assembly (DFMA) consists of two main components which are Design for Assembly (DFA) and Design for Manufacturing (DFM).
When the application of DFMA principles is considered, the first step is to analyze the product in terms of assembly by applying the set of rules and principles provided by the DFA technique. Design for Assembly (DFA) is a methodology that aims to simplify the product by focusing on parts count reduction by eliminating unnecessary parts, by integrating them with other parts and by parts variants reduction, thus improving product quality and minimizing the assembly problems .
The second step is applying DFM (Design for Manufacturing) guidelines, which have the role to optimize the product configuration from the manufacturing perspective by focusing on two main design aspects: first of them is selecting the adequate manufacturing processes chain for each component followed by optimizing the geometry part design for the chosen processes chain .
In James Bralla's view, the most significant benefits with design for manufacturing (DFM) comes from design for assembly (DFA) because simplifying the product so that it has fewer parts, leads to an easier and faster to fabricate assembly .
It has been proven that the best results achieved in product development come from parts count reduction, because it eliminates unnecessary manufacturing and assembly costs. Designing with fewer parts means fewer assembly operations and the facility required to make a product is also less, this lead to fewer mistakes and more throughput. Another best improvement is given by reduction of parts variants which enables to identify parts families and the use of standard components, the benefits being a common assembly sequence and reduced tooling and storage costs .
These are key requirements that optimize a product in terms of manufacturability, the main responsibility to achieve them dropping on the product-process designers, which have the main role to find solutions to get the best design. Optimizing the part design to simplify manufacturing and assembly process requires a vast knowledge of every available manufacturing and assembly process.
Fortunately, by using some advanced design philosophies such as DfX/DFA/DFM together with CAD/CAM integrated solutions engineers can systematically study assemblies with the goal to identify and correct downstream issues in the design stage, leading to the reduction of the cycle time and the product development costs of the product. Applying in the same time DFA/DFM design principles with CAD/CAM tools helps to optimize assembly tasks and manufacturing processes even in the earliest stages of design when revisions are least expensive and easiest to make.
DFM Pro for SolidWorks provided by Geometric is an example of such advanced tool that has been utilized in this larger research , for analyzing the considered device for automated assembly, in order to achieve the best design for each part in terms of manufacturability. The achieved results have been presented in previous work where issues of DFM were treated.
The theoretical approach is sustained by a case study bellow presented, which shows an example of design analysis based on Design for Assembly (DFA) considerations upon assembly efficiency of the components from an industrial device for automated assembly.
Case study
As case study, the research paper presents an approach on the application of the Design for Assembly theory integrated together with Catia V5 CAD software for increasing the effectiveness and efficiency of analyses and design activities for a product assembly in connection with the necessity of development of a technological device for automated assembly. The description of the device and the working principle have been shown in previous works , hereby in this paper only the analysis of the assembly efficiency of the product is summarized.
Design Assembly Efficiency -Methodology
Design for Assembly (DFA) methodology that is applied in this work to analyze the product is the Boothroyd DFMA method . This method is characterized by the using of a measure of the DFA index or assembly efficiency of the proposed design. The main objectives of this research are to analyze the assembly efficiency of the initial design, and then based on the achieved results to redesign the assembled product. To validate the improvements that are made on the assembly, one needs to calculate the assembly index for redesigned product, which must be higher than for the current design.
This procedure helps designers to minimize the assembly time and cost and also manufacturing labor for the products. The two main factors that are taken into consideration when a product or subassembly is analyzed, are : • The number of parts in a product; • The easiness of handling, insertion, and fastening of the parts. Accordingly with this method, the process of manual assembly can be divided into two separate areas, manual handling and manual insertion. For each of them, a classification and encoding system gives a time standard system for designers to use in estimating manual assembly times.
The assembled product which is subjected to the analysis to illustrate how the DFA technique is applied in practice is shown in figure 1. This device is composed of many parts that are secured using especially screws and nuts. The assembly of this product first involves securing a series of parts together in subassemblies using screws and then securing the resulting assembly into the final product, again using screws.
First of all, the device is disassembled, and the current number of parts is written down in table 1.
The main parameters which influence the assembly index, as total symmetry of the part, handling time, insertion time, total assembly time and assembly cost for each part are also written in the table.
Features of the part such as size, thickness, weight, flexibility, slipperiness, the necessity of using two hands, the necessity of using grasping tools, the necessity of optical magnification and necessity of mechanical assistance are taken into consideration to find the appropriate value of time needed for the manual handling of the part into an assembly . The manual insertion analysis refers to the accessibility of assembly location, ease of operation of an assembly tool, visibility of assembly location, ease of alignment and positioning during assembly and depth of insertion, when is selected the value of time required to perform this operation.
One of the main geometric design features that affects the time required to grasp and orient a part is its own symmetry, which refers to the necessity of rotation the part around its own axis, called alpha rotation and the rotation of the part around its axis of insertion, called beta rotation.
Design Assembly Efficiency -Results
In the last column of the table 1 is established the theoretical part count based on the importance of the parts in the assembly functioning. Each part is noted with 0 or 1: if the part is less important to the functioning of the product receives the number 0 and the part can be eliminated, if the part is important in the functioning of the product is noted with number 1, which means that these parts need to be kept or can be eliminated by redesigned or integrated with other parts, to keep or improve the functioning of the device.
The current analyzed device is composed of a number of 159 parts, from which 93 are considered as theoretical parts count. The basic assembly time estimated for theoretical parts is about 3 s. In this way, for the initial design it is necessary a time of 915.85 seconds to get the assembled product which gives us a DFA index of 30.4 %.
The DFA index is given by : where represents the number of theoretical parts, is estimated time for assembling a theoretical part and is necessary time for assembling the analysed product.
Redesign for the indexing mounting table subassembly. Results and discussion
By applying DFA approaches, a few parts have been nominated for a complete removal, such as screws and nuts, and other parts have been redesigned and integrated with other parts, which has led to a large reduction in the number of parts. For the new design, DFA index value has risen to 26.8%, meaning that the assembly process is more efficient.
The subassemblies further on presented in the paper have been analyzed and redesigned by applying the DFA technique and using the advanced design capabilities provided by Catia V5, the detailed design activities and 3D modelling tasks, have been solved. The subassembly of tubular shaft and pressure plate performs a circular movement, being a very important part for the function of the studied product and its removal is not allowed. Provided by the DFA technique, the three criteria for separate parts have been applied for this subassembly: the tubular shaft does not move relative to the pressure plate, these parts do not have to be of different material and the tubular shaft clearly does not have to be separate from the pressure plate in order to allow the assembly of the pressure plate to the other subassembly of the product. None of these three criteria have been met and these parts have been redesigned and integrated one into another to achieve a single part. In this way, the total number of parts of the subassembly has been reduced from seven to four, also supported by a reduction in the number of screws needed for assembling with other parts. The new achieved part has brought a few advantages in terms of assembly, time and cost reduction.
Another subassembly that has been passed through radical redesigning, but also keeping its role, is cam subassembly. The cam is the central part of the product that requires special attention in the manufacturing and assembly process. In the initial design, the cam was assembled through five pins with the support plate. Assembling and functioning analysis by applying the same three criteria as in the previous case, gave us suggestions for redesigning, which led to simplifying the subassembly, achieving an improved design for the cam with a single hole, and reducing the number of parts from seven to one. The new cam is locked by a screw, its round hole allows for continuous adjustment of the cam position instead of the square hole that is difficult to manufacture and allows a step adjustment.
Conclusions
In this paper, an application of DFMA philosophy and especially design for assembly (DFA) approach used to analyze and redesign an industrial equipment for automated assembly and the benefits of integration with some advanced 3D design tools like Catia V5 are presented. Through this study, DFMA presents a successful method of increasing design efficiency and reducing the number of parts, especially for the assembly process, which also has advantages for the manufacturing process. It is necessary to measure the impact of each component part in order to identify the overall performance of the existing product and to consider the possibility of changes or improvements of the current design.
Design for Assembly (DFA) method leads to a cheaper design because more efficient actions are taken to anticipate requirements for the beginning of the product development. In this way the assembly problems are reduced and the ideas to prepare the manufacturing chain are easy to take to achieve the best design.
The present case study succeeds in demonstrating the importance of implementing these guidelines in the design process, because we can minimize the number of parts that are not useful in the product, by elimination or integration, without affecting the function of the product or sometime improving it.
Studies will be continued upon the use of some other DfX philosophies and integrated engineering tools, within Product Design and Development improvement.
|
package com.couchbase.lite;
import com.couchbase.lite.auth.AuthorizerFactory;
import com.couchbase.lite.auth.AuthorizerFactoryManager; // https://github.com/couchbase/couchbase-lite-java-core/issues/41
import com.couchbase.lite.auth.BuiltInAuthorizerFactory;
import java.util.ArrayList;
/**
* Option flags for Manager initialization.
*/
public class ManagerOptions {
/**
* No modifications to databases are allowed.
*/
private boolean readOnly;
private AuthorizerFactoryManager authorizerFactoryManager; // https://github.com/couchbase/couchbase-lite-java-core/issues/41
// https://github.com/couchbase/couchbase-lite-java-core/issues/41
public ManagerOptions() {
this(new AuthorizerFactoryManager(new ArrayList<AuthorizerFactory>() {{ add(new BuiltInAuthorizerFactory()); }}));
}
// https://github.com/couchbase/couchbase-lite-java-core/issues/41
public ManagerOptions(AuthorizerFactoryManager authorizerFactoryManager) {
this.authorizerFactoryManager = authorizerFactoryManager;
}
public boolean isReadOnly() {
return readOnly;
}
public void setReadOnly(boolean readOnly) {
this.readOnly = readOnly;
}
// https://github.com/couchbase/couchbase-lite-java-core/issues/41
public AuthorizerFactoryManager getAuthorizerFactoryManager() { return authorizerFactoryManager; }
// https://github.com/couchbase/couchbase-lite-java-core/issues/41
public void setAuthorizerFactoryManager(AuthorizerFactoryManager authorizerFactoryManager) { this.authorizerFactoryManager = authorizerFactoryManager; }
}
|
Other claims about Sessions’s record similarly dissolved under scrutiny. White House Chief of Staff Reince Priebus insisted Sessions “worked his heart out” to get a posthumous medal for the civil-rights activist Rosa Parks; Sessions did not even sponsor the bill, he was one of 82 co-sponsors. Trump allies ran ads praising Sessions as a civil-rights hero, showing him at the Selma anniversary march with Representative John Lewis, who had actually testified against Sessions’s confirmation.
Sessions’s allies pointed to his work reducing the crack-powder cocaine disparity––but that was a compromise bill that did not entirely remove the disparity precisely because Sessions himself opposed doing so. Sessions supporters cited his 2006 vote for the reauthorization of the Voting Rights Act, but he did so along with 97 other Senators; and also gave a speech arguing a key part of the landmark civil rights law was unconstitutional on the Senate floor the day of the vote. Years later, when part of the law was struck down paving the way for a flurry of restrictive state voting laws, he praised the decision.
Which is to say nothing of his record on immigrants, women’s rights, and LGBT rights. Sessions is on record opposing Supreme Court decisions striking down laws banning homosexual sex and same-sex marriage and he opposed the repeal of the policy forbidding gays and lesbians to serve openly in the military. He voted against the Lilly Ledbetter Act, the Violence Against Women Act, and said it would be a “stretch” to describe grabbing a woman’s genitals, as the president once bragged about doing, as sexual assault. He has spent years campaigning for restrictions on Muslim immigration to the United States, and defended Trump’s proposal to ban Muslims from entering the country.
Sessions’s advocates might have simply defended his conservative political positions on the merits. Instead, they portrayed him as having an “outstanding” civil rights record, in the words of Press Secretary Sean Spicer, an argument that was Trumpian in its dishonesty, not simply incorrect but ostentatiously false.
Perhaps some conservatives believed the spin. Civil-rights groups did not. During his confirmation hearing, when he was seeking the votes he would need to secure the position of attorney general, Sessions sought to assuage them.
“I deeply understand the history of civil rights and the horrendous impact that relentless and systemic discrimination and the denial of voting rights has had on our African-American brothers and sisters. I have witnessed it,” Sessions told the Senate in January. “I understand the demands for justice and fairness made by the L.G.B.T. community. I understand the lifelong scars born by women who are victims of assault and abuse.”
That kinder, softer Jeff Sessions was absent as he took the oath of office on Thursday morning. In his place was the Sessions that everyone, from his most hardened detractors to his staunchest supporters, would recognize.
|
<filename>daemons/node/node_hardware.py
import multiprocessing
import subprocess
import os
class NodeHardware(object):
def __init__(self):
self.waiting = []
def available_cpus( self, priority, active_cores ):
cpus = multiprocessing.cpu_count()
interruptable = 0
for key, coredata in active_cores.items():
if coredata["priority"] < priority:
interruptable = interruptable + 1
available = cpus - len(active_cores)
return available, interruptable
def start_job( self, remaproot, jobid, numcores, data ):
self.waiting = data["cores"]
for i in range( 0, numcores ):
coredata = data["cores"][i]
jobid = None
appdir = None
if "jobid" in coredata:
jobid = coredata["jobid"]
if "appdir" in coredata:
appdir = coredata["appdir"]
if jobid == None or appdir == None:
return False
appdir = os.path.join( remaproot, "job", jobid, "app", appdir )
env = os.environ
pythonpath = ""
if "PYTHONPATH" in env:
pythonpath = env["PYTHONPATH"]
pythonpath = pythonpath + ":" + appdir
else:
pythonpath = appdir
env["PYTHONPATH"] = pythonpath
path = ""
thisdir = os.path.dirname( os.path.realpath(__file__) )
coredir = os.path.abspath( os.path.join( thisdir, "..", "core" ) )
path = path + coredir
daemonfile = os.path.join( path, "core_daemon.py" )
subprocess.Popen(["python3.4", daemonfile, remaproot], env=env)
return True
def grab_work_item( self ):
if len(self.waiting) > 0:
# Just grab any item
return self.waiting.pop()
return None
|
package cellsociety.grid;
import cellsociety.cells.Cell;
import cellsociety.cells.EmptyCell;
import cellsociety.cells.FireCell;
import cellsociety.cells.ForagerCell;
import cellsociety.cells.GameOfLifeCell;
import cellsociety.cells.Neighbors;
import cellsociety.cells.PercolationCell;
import cellsociety.cells.PredatorCell;
import cellsociety.cells.PreyCell;
import cellsociety.cells.SegregationCell;
import cellsociety.cells.SugarCell;
import cellsociety.cells.WatorCell;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Random;
/**
* Class that holds cell in proper formation for simulation.
*
* @author <NAME>
*/
public class Grid {
private Cell[][] grid;
private Type type;
private int width;
private int height;
private String fileName;
private Map<String, Double> params;
private Neighbors neighborDirections;
private String populateType;
private final String RANDOM = "RANDOM";
/**
* Constructor for Grid objects, creates a new grid based on the specifications passed in from the
* XML file.
*
* @param width number of columns of cell
* @param height number of rows of cell
* @param fileName .txt file with initial layout of grid
* @param type type of simulation to run
* @param params map of parameters needed for simulation
*/
public Grid(int width, int height, String fileName, Type type, Map<String, Double> params,
Neighbors neighborDirections, String populateType) {
grid = new Cell[height][width];
this.type = type;
this.width = width;
this.height = height;
this.params = params;
this.fileName = fileName;
this.neighborDirections = neighborDirections;
this.populateType = populateType;
if (populateType.equals(RANDOM)) {
populateRandomly();
} else {
readFile(fileName);
}
initializeCells();
}
/**
* Reads the .txt file passed in from the XML parser and creates the starting layout based on it.
*
* @param fileName .txt file with initial layout
*/
protected void readFile(String fileName) {
Scanner reader = new Scanner(getClass().getClassLoader().getResourceAsStream(fileName));
int row = 0;
while (reader.hasNextLine()) {
String line = reader.nextLine();
String[] gridRow = line.split("");
for (int col = 0; col < gridRow.length; col++) {
int cellState = Integer.parseInt(gridRow[col]);
setCellWithType(row, col, cellState, neighborDirections);
}
row++;
}
}
/**
* Allows grid to be populated randomly instead of from a .txt file.
*/
protected void populateRandomly() {
Random rand = new Random();
for (int i = 0; i < grid.length; i++) {
for (int j = 0; j < grid[i].length; j++) {
setCellWithType(i, j, type.getStates().get(rand.nextInt(type.getStates().size())),
neighborDirections);
}
}
}
/**
* Creates a cell at the indicated position with the indicated state.
*
* @param row row location for the new cell
* @param col column location for the new cell
* @param cellState initial state for the new cell
*/
protected void setCellWithType(int row, int col, int cellState, Neighbors neighborDirections) {
Map<Type, Cell> cellData = createCellTypeMap(row, col, cellState, neighborDirections);
setCellAtLocation(row, col, cellData.get(type));
}
/**
* Eliminates need for lots of if statements to determine cell type by instead loading the cells
* and their type into a map to be selected with a get method.
*
* @param row row location for the new cell
* @param col column location for the new cell
* @param cellState initial state of the new cell
* @return map with types as keys and cells as values
*/
private Map<Type, Cell> createCellTypeMap(int row, int col, int cellState,
Neighbors neighborDirections) {
Map<Type, Cell> data = new HashMap<>();
Cell wator = new EmptyCell(WatorCell.EMPTY, row, col);
if (type == Type.WATOR && cellState == WatorCell.PREDATOR) {
wator = new PredatorCell(cellState, row, col, params, neighborDirections);
} else if (type == Type.WATOR && cellState == WatorCell.PREY) {
wator = new PreyCell(cellState, row, col, params, neighborDirections);
}
data.put(Type.FIRE, new FireCell(cellState, row, col, params, neighborDirections));
data.put(Type.LIFE, new GameOfLifeCell(cellState, row, col, neighborDirections));
data.put(Type.PERCOLATION, new PercolationCell(cellState, row, col, neighborDirections));
data.put(Type.SEGREGATION,
new SegregationCell(cellState, row, col, params, neighborDirections));
data.put(Type.EMPTY, new EmptyCell(0, row, col));
data.put(Type.WATOR, wator);
data.put(Type.ANTS, new ForagerCell(cellState, row, col, neighborDirections));
data.put(Type.SUGARSCAPE, new SugarCell(cellState, row, col, params, neighborDirections));
return data;
}
/**
* Allows access to cell objects at specific locations.
*
* @param row row of cell
* @param col col of cell
* @return Cell object located at indicated position in grid
*/
public Cell getCellAtLocation(int row, int col) {
if (isInBounds(row, col)) {
return grid[row][col];
}
return null;
}
/**
* Allows a cell object to be places at the specified location.
*
* @param row row of cell
* @param col col of cell
* @param cell Cell object to put at indicated location in grid
*/
public void setCellAtLocation(int row, int col, Cell cell) {
if (isInBounds(row, col)) {
grid[row][col] = cell;
}
}
/**
* Creates a list of the cell's neighbors depending on the rules specified in the cell and passes
* it back to the cell to be used on simulation updates.
*
* @param row row location of the cell
* @param col column location of the cell
* @param cell cell whose neighbors are being determined within the function
*/
public void setNeighbors(int row, int col, Cell cell) {
int[][] directions = cell.getNeighborDirections();
List<Cell> neighbors = new ArrayList<>();
for (int[] direction : directions) {
Cell neighbor = getCellAtLocation(row + direction[0], col + direction[1]);
if (neighbor != null) {
neighbors.add(neighbor);
}
}
cell.setNeighbors(neighbors);
}
/**
* When the controller moves cell objects around, they need to be re-initialized in order to have
* the correct neighbors.
*/
public void initializeCells() {
for (int i = 0; i < grid.length; i++) {
for (int j = 0; j < grid[i].length; j++) {
if (grid[i][j] == null) {
setCellAtLocation(i, j, new EmptyCell(0, i, j));
}
setNeighbors(i, j, grid[i][j]);
}
}
}
/**
* Determines if coordinates are in grid.
*
* @param i row location
* @param j column location
* @return true if given coordinates are in bounds
*/
protected boolean isInBounds(int i, int j) {
return i >= 0 && i < grid.length && j >= 0 && j < grid[i].length;
}
/**
* Allows access to size of grid so controller can iterate over grid.
*
* @return array with width at index 0 and height at index 1
*/
public int[] getSizeOfGrid() {
return new int[]{height, width};
}
/**
* Allows controller to make a deep copy of the grid to update the simulation without altering the
* existing values.
* <p>
* This gave a flag on design coach, but we believe it is necessary as we need to create a copy of
* the new grid and then return it, so there is no other way to write the method
*
* @return newGrid deep copy of current grid
*/
public Grid getCopyOfGrid() {
Grid newGrid = copySelf();
for (int i = 0; i < grid.length; i++) {
for (int j = 0; j < grid[i].length; j++) {
newGrid.setCellAtLocation(i, j, this.getCellAtLocation(i, j));
newGrid.getCellAtLocation(i, j).setNeighbors(this.getCellAtLocation(i, j).getNeighbors());
}
}
return newGrid;
}
/**
* Allows controller to create a copy of the current grid.
*
* @return new grid instance with same instance variables as old grid.
*/
protected Grid copySelf() {
return new Grid(this.width, this.height, this.fileName, this.type, this.params,
this.neighborDirections, this.populateType);
}
/**
* Allows access to simulation parameters so GridToXML can put them in the new XML file.
*
* @return map of simulation parameters
*/
public Map<String, Double> getParams() {
return params;
}
/**
* Allows Grid subclasses to access the grid type.
*
* @return grid type
*/
protected Type getType() {
return type;
}
/**
* Allows Grid subclasses to access neighbor directions of grid.
*
* @return directions to neighbors of each cell
*/
protected Neighbors getNeighborDirections() {
return neighborDirections;
}
/**
* Allows Grid subclasses to access the name of the file with the initial layout.
*
* @return file name of .txt file with grid layout
*/
protected String getFileName() {
return fileName;
}
/**
* Allows Grid subclasses to access whether or not they should populate randomly or from file.
*
* @return random or manual population type
*/
protected String getPopulateType() {
return populateType;
}
}
|
/**
* Modify a smart contract instance to have the given parameter values.
* <p>
* Any null field is ignored (left unchanged).
* <p>
* If only the contractInstanceExpirationTime is being modified, then no signature is
* needed on this transaction other than for the account paying for the transaction itself.
* <p>
* But if any of the other fields are being modified, then it must be signed by the adminKey.
* <p>
* The use of adminKey is not currently supported in this API, but in the future will
* be implemented to allow these fields to be modified, and also to make modifications
* to the state of the instance.
* <p>
* If the contract is created with no admin key, then none of the fields can be
* changed that need an admin signature, and therefore no admin key can ever be added.
* So if there is no admin key, then things like the bytecode are immutable.
* But if there is an admin key, then they can be changed. For example, the
* admin key might be a threshold key, which requires 3 of 5 binding arbitration judges to
* agree before the bytecode can be changed. This can be used to add flexibility to the management
* of smart contract behavior. But this is optional. If the smart contract is created
* without an admin key, then such a key can never be added, and its bytecode will be immutable.
*/
public final class ContractUpdateTransaction extends Transaction<ContractUpdateTransaction> {
private final ContractUpdateTransactionBody.Builder builder;
@Nullable
ContractId contractId = null;
@Nullable
AccountId proxyAccountId = null;
@Nullable
FileId bytecodeFileId = null;
public ContractUpdateTransaction() {
builder = ContractUpdateTransactionBody.newBuilder();
}
ContractUpdateTransaction(LinkedHashMap<TransactionId, LinkedHashMap<AccountId, com.hedera.hashgraph.sdk.proto.Transaction>> txs) throws InvalidProtocolBufferException {
super(txs);
builder = bodyBuilder.getContractUpdateInstance().toBuilder();
if (builder.hasContractID()) {
contractId = ContractId.fromProtobuf(builder.getContractID());
}
if (builder.hasProxyAccountID()) {
proxyAccountId = AccountId.fromProtobuf(builder.getProxyAccountID());
}
if (builder.hasFileID()) {
bytecodeFileId = FileId.fromProtobuf(builder.getFileID());
}
}
ContractUpdateTransaction(com.hedera.hashgraph.sdk.proto.TransactionBody txBody) {
super(txBody);
builder = bodyBuilder.getContractUpdateInstance().toBuilder();
if (builder.hasContractID()) {
contractId = ContractId.fromProtobuf(builder.getContractID());
}
if (builder.hasProxyAccountID()) {
proxyAccountId = AccountId.fromProtobuf(builder.getProxyAccountID());
}
if (builder.hasFileID()) {
bytecodeFileId = FileId.fromProtobuf(builder.getFileID());
}
}
@Nullable
public ContractId getContractId() {
return contractId;
}
/**
* Sets the Contract ID instance to update.
*
* @param contractId The ContractId to be set
* @return {@code this}
*/
public ContractUpdateTransaction setContractId(ContractId contractId) {
Objects.requireNonNull(contractId);
requireNotFrozen();
this.contractId = contractId;
return this;
}
@Nullable
public Instant getExpirationTime() {
return builder.hasExpirationTime() ? InstantConverter.fromProtobuf(builder.getExpirationTime()) : null;
}
/**
* Sets the expiration of the instance and its account to this time (
* no effect if it already is this time or later).
*
* @param expirationTime The Instant to be set for expiration time
* @return {@code this}
*/
public ContractUpdateTransaction setExpirationTime(Instant expirationTime) {
Objects.requireNonNull(expirationTime);
requireNotFrozen();
builder.setExpirationTime(InstantConverter.toProtobuf(expirationTime));
return this;
}
@Nullable
public Key getAdminKey() {
return builder.hasAdminKey() ? Key.fromProtobufKey(builder.getAdminKey()) : null;
}
/**
* Sets a new admin key for this contract.
*
* @param adminKey The Key to be set
* @return {@code this}
*/
public ContractUpdateTransaction setAdminKey(Key adminKey) {
Objects.requireNonNull(adminKey);
requireNotFrozen();
builder.setAdminKey(adminKey.toProtobufKey());
return this;
}
@Nullable
public AccountId getProxyAccountId() {
return proxyAccountId;
}
/**
* Sets the ID of the account to which this account is proxy staked.
* <p>
* If proxyAccountID is null, or is an invalid account, or is an account
* that isn't a node, then this account is automatically proxy staked to a
* node chosen by the network, but without earning payments.
* <p>
* If the proxyAccountID account refuses to accept proxy staking, or if it is
* not currently running a node, then it will behave as if proxyAccountID was null.
*
* @param proxyAccountId The AccountId to be set
* @return {@code this}
*/
public ContractUpdateTransaction setProxyAccountId(AccountId proxyAccountId) {
Objects.requireNonNull(proxyAccountId);
requireNotFrozen();
this.proxyAccountId = proxyAccountId;
return this;
}
@Nullable
public Duration getAutoRenewPeriod() {
return builder.hasAutoRenewPeriod() ? DurationConverter.fromProtobuf(builder.getAutoRenewPeriod()) : null;
}
/**
* Sets the auto renew period for this contract.
*
* @param autoRenewPeriod The Duration to be set for auto renewal
* @return {@code this}
*/
public ContractUpdateTransaction setAutoRenewPeriod(Duration autoRenewPeriod) {
Objects.requireNonNull(autoRenewPeriod);
requireNotFrozen();
builder.setAutoRenewPeriod(DurationConverter.toProtobuf(autoRenewPeriod));
return this;
}
@Nullable
public FileId getBytecodeFileId() {
return bytecodeFileId;
}
/**
* Sets the file ID of file containing the smart contract byte code.
* <p>
* A copy will be made and held by the contract instance, and have the same expiration
* time as the instance.
*
* @param bytecodeFileId The FileId to be set
* @return {@code this}
*/
public ContractUpdateTransaction setBytecodeFileId(FileId bytecodeFileId) {
Objects.requireNonNull(bytecodeFileId);
requireNotFrozen();
this.bytecodeFileId = bytecodeFileId;
return this;
}
public String getContractMemo() {
return builder.getMemoWrapper().getValue();
}
/**
* Sets the memo associated with the contract (max: 100 bytes).
*
* @param memo The memo to be set
* @return {@code this}
*/
public ContractUpdateTransaction setContractMemo(String memo) {
requireNotFrozen();
builder.setMemoWrapper(StringValue.of(memo));
return this;
}
public ContractUpdateTransaction clearMemo() {
requireNotFrozen();
builder.clearMemoWrapper();
return this;
}
ContractUpdateTransactionBody.Builder build() {
if (contractId != null) {
builder.setContractID(contractId.toProtobuf());
}
if (proxyAccountId != null) {
builder.setProxyAccountID(proxyAccountId.toProtobuf());
}
if (bytecodeFileId != null) {
builder.setFileID(bytecodeFileId.toProtobuf());
}
return builder;
}
@Override
void validateChecksums(Client client) throws BadEntityIdException {
if (contractId != null) {
contractId.validateChecksum(client);
}
if (bytecodeFileId != null) {
bytecodeFileId.validateChecksum(client);
}
if (proxyAccountId != null) {
proxyAccountId.validateChecksum(client);
}
}
@Override
MethodDescriptor<com.hedera.hashgraph.sdk.proto.Transaction, TransactionResponse> getMethodDescriptor() {
return SmartContractServiceGrpc.getUpdateContractMethod();
}
@Override
boolean onFreeze(TransactionBody.Builder bodyBuilder) {
bodyBuilder.setContractUpdateInstance(build());
return true;
}
@Override
void onScheduled(SchedulableTransactionBody.Builder scheduled) {
scheduled.setContractUpdateInstance(build());
}
}
|
/**
* Passes on the event to a separate thread that will call
* {@link #asyncCallAppenders(LogEvent)}.
*/
@Override
protected void callAppenders(final LogEvent event) {
populateLazilyInitializedFields(event);
if (!delegate.tryEnqueue(event, this)) {
handleQueueFull(event);
}
}
|
/**
* A {@link Configurator} is able to configure several internal instances like {@link JAXBContext} and {@link Marshaller}.<br>
* <br>
* To do this <b>override</b> any method available.<br>
* <br>
* Example:
*
* <pre>
* new Configurator()
* {
* @Override
* public void configure( Marshaller marshaller )
* {
* marshaller.setProperty( "com.sun.xml.bind.xmlHeaders", "<!DOCTYPE ....>\n" ); *
* }
* }
* </pre>
*
* @author Omnaest
*/
public static abstract class Configurator
{
/**
* Configures the {@link Marshaller}
*
* @param marshaller
* @throws Exception
*/
public void configure( Marshaller marshaller ) throws Exception
{
}
/**
* Configures the {@link JAXBContext}
*
* @param jaxbContext
* @throws Exception
*/
public void configure( JAXBContext jaxbContext ) throws Exception
{
}
}
|
/**
* MongoDB database migrations using MongoBee.
*/
package org.investhood.app.config.dbmigrations;
|
The separation properties for closures of toric orbits
A subset X of a vector space V is said to have the"Separation Property"if it separates linear forms in the following sense: given a pair (a, b) of linearly independent forms on V there is a point x on X such that a(x)=0 and b(x) is not equal to 0. A more geometric way to express this is the following: every homogeneous hyperplane H in V is linearly spanned by its intersection with X. The separation property was first asked for conjugacy classes in simple Lie algebras. We give an answer for orbit closures in representation spaces of an algebraic torus. We consider also the strong and the weak separation properties. It turns out that toric orbits well illustrate these concepts.
Introduction
1. Let V be a vector space over a field k and G be a connected reductive algebraic group. Consider a linear action G : V . Properties of the closure of an orbit Gv ⊂ V can be sorted into four groups: (1) "combinatorial" (the number of orbits in Gv, the graph of the orbit adherence relation, . . .), (2) geometrical (the smoothness, the normality, the Cohen-Macaulay property, types of singularities, . . .), (3) topological (the contractibility, the simple connectedness, the computation of homologies and cohomologies, higher homotopy groups, . . .), (4) properties of the embedding Gv ⊂ V (the dimension of the linear span, hyperplane sections, a description of the ideal defining the variety, . . .).
In this paper we consider the separation properties. In our opinion they belong to the most natural properties of the fourth group.
Definition 1.
A subset X of a vector space V has the separation property (briefly (SP)) if for any pair of linearly independent linear functions α, β ∈ V * there exists a point x ∈ X such that α(x) = 0 and β(x) = 0.
In other words, the separation property for X ⊂ V means that H ∩ X ⊆ H ′ for any pair H = H ′ of homogeneous hyperplanes in V . Or, equivalently, for any homogeneous hyperplane H the intersection H ∩ X linearly spans H.
For projective spaces we have a similar definition: a subset Y ⊂ P(V ) has the separation property if for any pair D = D ′ of hyperplanes in P(V ) we have D ∩ Y ⊆ D ′ . Remark 1. Let α ∈ V * and H α be the corresponding hyperplane. If either X ∩ H α is empty or X ∩ H α is zero or X ⊆ H α , then it is easy to see that X has not (SP).
For the first time the separation property was asked by J. C. Jantzen in connection with the paper of A. Premet : Question. Let k be an algebraically closed field, G be a simple algebraic group, and g be its tangent algebra. Is it true that the minimal nilpotent orbit of the adjoint action in g has the separation property?
The answer was obtained in the work . It is affirmative for all simple groups except for Sp 2n . Example 1. Consider the Lie algebra sl 2 . Here the minimal nilpotent orbit consists of the following matrices: It is easy to see that M has not the separation property. In fact, b = 0 implies a = 0 for a matrix from M .
The notions of the "strong" and the "weak" separation properties also were introduced in .
Definition 2.
A closed affine cone X ⊆ V of dimension ≥ 2 has the strong separation property (briefly (SSP)) if for any linear subspace W ⊆ V of codimension 2 we have codim X W ∩ X = 2.
There is a similar definition for a closed projective subvariety. A closed subvariety Y ⊆ P(V ) has the strong separation property if for any linear subspace L ⊆ P(V ) of codimension 2 we have codim Y L ∩ Y = 2.
Remark 2. The strong separation property for a closed projective subvariety Y ⊆ P(V ) (closed affine cone X ⊆ V ) implies the separation property.
Proof. Consider the projective case. Suppose that (SP) does not hold. This means that there exist two different hyperplanes H α and H β in P(V ) such that H α ∩ Y ⊆ H β . Then (H α ∩ H β ) ∩ Y = H α ∩ Y has the codimension ≤ 1 in Y (see ) and (SSP) does not hold.
In the affine case it is sufficient to notice that (SP) (resp. (SSP)) for a closed affine cone is equivalent to (SP) (resp. (SSP)) for its projectivization.
The next example shows that (SP) does not imply (SSP). It has not (SP) as it contains the subspace a = b = 0. By direct calculation it is easy to check that N has (SP). (It also follows from Theorem 3 of this work. Consider the linear action T = (k * ) 3 : . Note that N is isomorphic to T (1, 1, 1, 1).)
Definition 3.
A subset X of a vector space V has the weak separation property (briefly (WSP)) if for any pair of homogeneous hyperplanes H = H ′ we have H ∩ X = H ′ ∩ X (in the set-theoretical sense).
The definition of the weak separation property for a subset of a projective space is similar.
It is obvious that the separation property implies the weak separation property.
Example 3. It is easy to check that the subvariety M of nilpotent matrices in sl 2 has (WSP) and has not (SP). (This also follows from Theorems 3 and 4 of this work. Consider the linear action T = (k * ) 2 : .) The following theorems are proved in .
Theorem . Let G be a connected semisimple group and V (λ) be its Weyl module corresponding to a highest weight λ with numerical marks n i . Denote by O min ⊂ V (λ) the orbit of a highest vector. Then: (1) O min satisfies (SSP) ⇐⇒ λ is a fundamental weight; (2) O min satisfies (SP) ⇐⇒ n i ≤ 1 for any i; Theorem . Let G : V be an irreducible representation of a connected semisimple group G. If O min satisfies (SP), then any G-orbit in V satisfies (SP).
Theorem . Suppose that char k = 0 and G : V is an irreducible representation of a semisimple group G. Then a generic G-orbit in V satisfies (SP).
2. The aim of this work is to investigate the separation properties for closures of toric orbits in vector and projective spaces over an algebraically closed field. This is a primary generalization of Theorem to the case of reducible representations of reductive groups.
Let T be an algebraic torus, Λ be the lattice of characters of T , and V be a vector space over an algebraically closed field k. Consider a linear action T : V , where t(x 1 , . . . , x n ) = (χ 1 (t)x 1 , . . . , χ n (t)x n ). Let Σ be the semigroup in Λ generated by the characters χ 1 , . . . , χ n and K be the cone in Λ ⊗ Z Q generated by Σ. (1) the cone K is strictly convex; (2) Q + χ i is an edge of K for any i; For a projective action of a torus we have: Theorem 3'. The orbit closure X = T (1 : . . . : 1) ⊂ P(V ) satisfies (SP) if and only if the following conditions hold: (1) the point χ i is a vertex of the convex hull conv{χ 1 , . . . , χ n } for any i; The proofs are based on the fact that if the separation property fails on some pair of hyperplanes, then there exist such T -invariant hyperplanes. To prove this statement we introduce the notion of the characteristic variety of a subset X ⊂ V (or X ⊂ P(V )): After that we prove: Suppose that an affine subvariety X ⊂ V is irreducible, is not contained in a homogeneous hyperplane, meets any homogeneous hyperplane and dim X > 1. Then Ch(X) is closed in P(V * ) × P(V * ).
Finally we apply the fact that an algebraic torus acting on a projective variety has a fixed point. More precisely: Proposition 3. If X does not satisfy (SP) and Ch(X) is closed, then there exists a pair ( α , β ) ∈ Ch(X) such that α, β are T -semiinvariant and linearly independent.
Proposition 3 allows to simplify the proof of the criterion of the separation property for SL 2 -orbits of binary forms obtained in the thesis of K. Baur.
if and only if f has a linear factor of multiplicity one.
For the weak separation property we obtain the following theorems. (1) the cone K is strictly convex; (2) there are no more then one characters χ i in the interior of any face of K (in particular, Q + χ i = Q + χ j for i = j). I am grateful to my adviser Ivan V. Arzhantsev for the subject of this work, the permanent support, and numerous remarks and ideas. I also thank Dmitri A. Timashev for important comments and detection of a gap in the preliminary version of the text.
Hypersurfaces
Proposition 1. Let S ⊂ V be a hypersurface. Then (1) S does not satisfy (SP) ⇐⇒ S can be defined by an equation x n 2 + x 1 F = 0 in some coordinate system for some n ∈ N and F ∈ k ; (2) S does not satisfy (WSP) ⇐⇒ S can be defined by an equation x n 1 + x m 2 + x 1 x 2 F = 0 in some coordinate system for some n, m ∈ N and F ∈ k ; (3) a homogeneous hypersurface S does not satisfy (SSP) ⇐⇒ S can be defined by an equation x 1 F 1 + x 2 F 2 = 0 in some coordinate system for some homogeneous polynomials F 1 , F 2 ∈ k of the same degree.
Proof. Let S be defined by an equation P = 0. We may assume that P has no multiple factors. Since the field k is algebraically closed, it follows that P is defined uniquely up to a constant.
(1) If P has the form x n 2 + x 1 F in some coordinate system, then S ∩ H x 1 ⊆ H x 2 and S has not (SP).
Conversely, if S has not (WSP), then we can choose a coordinate system such that S ∩ H x 2 = S ∩ H x 1 . Statement (1) implies that in this coordinate system P = x n 1 + x 2 F 1 = x m 2 + x 1 F 2 (up to the proportionality of the basis vectors). This implies P = x n 1 + x m 2 + x 1 x 2 F . (3) If P has the form x 1 F 1 + x 2 F 2 in some coordinate system, then the subspace in V defined by the equations x 1 = 0, x 2 = 0 has the codimension one in S and S has not (SSP).
Conversely, if S has not (SSP), then we can choose a coordinate system such that the subspace in V defined by the equations x 1 = 0, x 2 = 0 has the codimension ≤ 1 in S (this implies that this subvariety is contained in S). The ideal generated by the polynomials x 1 , x 2 is radical, so, by Hilbert's nullstellentsatz, P = x 1 F 1 + x 2 F 2 .
Denote by I(X) the ideal of a closed affine subvariety X ⊆ V . Proposition 2. Let X ⊆ V be a closed affine subvariety. Then (1) X does not satisfy (SP) if and only if X is contained in a hyperpsurface S such that S does not satisfy (SP); (2) X does not satisfy (WSP) if and only if X is contained in a hypersurface S such that S does not satisfy (WSP).
Proof. Suppose that X has (SP) (resp. (WSP)). It is evident that any subset Z in V such that X ⊆ Z has (SP) (resp. (WSP)). Now we shall prove the converse implication. Suppose that X has not (SP). Then there exist linearly independent α, β ∈ V * such that H α ∩ X ⊆ H β . By Hilbert's nullstellentsatz, this holds if and only if β n = f + gα for some n ∈ N, g ∈ k , f ∈ I(X). Let S be the zero set of f . Then X ⊆ S and, by Proposition 1, S has not (SP).
Suppose that X has not (WSP). Then there exist linearly independent They hold if and only if rad(I(X), α) = rad(I(X), αβ) and rad(I(X), β) = rad(I(X), αβ) (here (I(X), f ) is the ideal generated by I(X) and f ). We have Let S be the zero set of the polynomial f 1 + f 2 . Then S contains X and, by the previous proposition, has not (WSP).
Remark 3. Let us remark that the analogous statement does not hold for (SSP). In fact, let X be a closed affine cone of dimension ≥ 2 and f ∈ I(X) be a homogeneous polynomial. Then the homogeneous hypersurface defined by the equation x 1 f (x) = 0 contains X and has not (SSP). Moreover, we shall give an example of a closed affine cone having (SSP) and containing in an irreducible hypersurface such that this hypersurface has not (SSP).
Example 4. Let X ⊂ V be a closed irreducible affine cone of codimension ≥ 2 having (SSP). There exist homogeneous coprime f, p ∈ I(X). Consider the subspace W = V ⊕k 2 (x, y are coordinates in the last two items). Denote by S the hypersurface in W defined by the equation f x m + py = 0 (where deg p = deg f + m − 1) and by Y the closed affine cone X ⊕ k 2 ⊂ W . Then S has not (SSP) and is irreducible. Note that Y ⊂ S.
We shall prove that Y has (SSP). It is sufficient to prove that X ⊂ V has (SSP) implies X ′ = X ⊕ k ⊂ V ′ = V ⊕ k has (SSP). Assume the converse. Let (SSP) fail for X ′ on the subspace U ′ ⊂ V ′ defined by equations The first case. Let α and β be not proportional. Here and we obtain a contradiction with the fact that X has (SSP). The second case. If α = cβ, then U ′ can be defined by the equations we have a contradiction.
(1) Y does not satisfy (SP) if and only if Y is contained in a hypersurface R such that it does not satisfy (SP); (2) Y does not satisfy (WSP) if and only if Y is contained in a hypersurface R such that it does not satisfy (WSP).
Proof. Consider the vector space V and the closed affine cone X ⊆ V over Y . The cone X has (SP) (resp. (WSP)) if and only if Y has (SP) (resp. (WSP)).
(1) If Y ⊆ R and R has not (SP), then X ⊆ S, where S is the affine cone over R in V and S has not (SP). This implies that X has not (SP).
Conversely, if X has not (SP), then, by Proposition 1, there exists a hypersurface S ⊂ V such that X ⊆ S and S has not (SP). Let S be defined by the equation f = 0, where f ∈ I(X). By Proposition 1, f has the form x n 2 + x 1 F in some coordinate system. As the ideal I is homogeneous, the homogeneous component of degree n of this equation belongs to I(X). This component has the form x n 2 + x 1 F ′ . Hence the corresponding projective hypersurface contains Y and has not (SP).
(2) If Y ⊆ R and R has not (WSP), then X ⊆ S, where S is the affine cone over R in V and S has not (WSP). This implies that X has not (WSP).
If X has not (WSP), then, by Proposition 1, there exists a hypersurface S ⊂ V such that X ⊆ S and S has not (WSP). Let S be defined by f = 0, where f ∈ I(X). By Proposition 1, f has the form x n 1 + x m 2 + x 1 x 2 F in some coordinate system. As the ideal I(X) is homogeneous, the homogeneous components of degrees n and m of this equation belong to I(X). If n = m, then this component has the form x n 1 + x n 2 + x 1 x 2 F ′ and corresponding projective hypersurface contains Y and has not (WSP). If n = m, then these components have the forms This homogeneous polynomial of degree mn belongs to I(X) and the projective hypersurface defined by it has not (WSP).
It was proved in that the strong separation property is a property of open type in the following sense. Recall that a family of d-dimensional subvarieties in P(V ) is a closed subvariety F ⊂ B ×P(V ), where B is an algebraic variety such that the projection pr B induces the surjective morphism p : F → B and any fiber of this morphism has the dimension d. Proposition
Characteristic varieties
Let X be a subset in a vector space V . Definition 4. The characteristic variety Ch(X) of a subset X is the subset in P(V * ) × P(V * ) consisting of the following pairs: Definition 5. The weak characteristic variety Chw(X) of a subset X is the subset in P(V * ) × P(V * ) consisting of the following pairs: We shall need the following theorem.
Theorem 2. Suppose that an algebraic subvariety X ⊂ V is irreducible, is not contained in a homogeneous hyperplane, meets any homogeneous hyperplane and dim X > 1. Then Ch(X) and Chw(X) are closed.
Remark 5. If the conditions of the theorem hold for any irreducible compo- Proof. Consider the closed subvariety (1) The variety M is irreducible. We prove this in Lemma 1 below.
(3) Let W ⊆ P(V * )×P(V * ) be closed and irreducible. We have φ −1 (W ) = (W ×X)∩R, where R ⊂ P(V * )×P(V * )×V is defined by the equation α(x) = 0. Therefore φ −1 (W ) is a hypersurface in the irreducible variety W × X and any irreducible component of φ −1 (W ) has the dimension dim X + dim W − 1 (φ −1 (W ) is not empty as X meets any hyperplane and φ −1 (W ) does not coincide with W × X as X is not contained in a hyperplane).
Thus the morphism φ is open. This proves Theorem 2.
Theorem 2 implies the similar theorem for a subset in a projective space (the definition of the characteristic variety in the projective case is analogous).
Theorem 2'. Suppose that an algebraic subvariety Y ⊂ P(V ) is irreducible and is not contained in a hyperplane. Then Ch(Y ) and Chw(Y ) are closed.
Proof. Let X ⊂ V be the cone corresponding to Y . Note that Ch(X) = Ch(Y ). Applying Theorem 2 to X, we conclude that Ch(X) is closed.
The case of a T -invariant subvariety
Let T be an algebraic torus linearly acting on a vector space V and X be a T -invariant subset in V . Then Ch(X) is a T -invariant subset in P(V * ) × P(V * ).
Proposition 3. If X has not the separation property and Ch(X) is closed, then there exists a pair ( α , β ) ∈ Ch(X) such that α, β are Tsemiinvariant and linearly independent.
Proof. Fix a T -semiinvariant basis {x 1 , . . . , x n } in V * . Let λ i be the weight of x i .
Note that the supports of the vectors α ′ , β ′′ do not intersect. (Here the support of a vector v is the set of basis vectors along which v has nonzero coordinates; the support of v is the support of v.) Thus we obtain T ( α ′ , β ′′ )∩D = ∅ and the desired point is a T -fixed point in T ( α ′ , β ′′ ). Proof. We have to prove that the separation property fails on a pair of Tsemiinvariant linear functions.
(1) If X is contained in a homogeneous hyperplane, then X is contained in a T -invariant homogeneous hyperplane and (SP) fails on a T -semiinvariant pair.
(2) If X does not meet a homogeneous hyperplane, then there exist f, g ∈ k , such that f g = 1. If the functions f and g are not Tsemiinvariant, then we consider their weight decompositions. Since k has no zero divisors, it follows that after the multiplication in the left side of the equality we obtain the sum of weight functions with different weights. There exists a one-parameter subgroup having different pairing with all weights from the weight decompositions of f and g. This one-parameter subgroup defines the order on weight functions. The products of the highest and the lowest terms can not be cancelled, so we have a contradiction. Thus X does not meet a T -invariant homogeneous hyperplane.
(3) If dim X = 1, then either X is a curve of T -fixed points or X is a closure of an orbit of a one-dimensional torus. In the first case X is contained in the subspace defined by the equations x i = 0, where λ i = 0.
In the second case (SP) fails on any pair of coordinate functions x i , x j such that either λ i = 0 or λ i , λ j = 0.
(4) If X is not contained in a homogeneous hyperplane, meets any homogeneous hyperplane and dim X > 1, then, by Theorem 2, Ch(X) is closed and, by Proposition 3, (SP) fails for X on a pair of T -semiinvariant functions.
Application to binary forms
Let char k = 0. Consider the vector space k n of binary forms of degree n, where SL 2 acts by the natural way and k * acts by homotheties.
K. Baur proved the following theorem in .
Theorem We give the proof of this theorem here. Corollary 1 allows to simplify it (see Proposition 4 below).
The proof consists of some lemmas. Proof.
Suppose that O f has not (SP), namely there exist homogeneous hyper- Proof. It is sufficient to prove that If the separation property does not hold, then X is contained in a hypersurface of the form h k i + h j F = 0, where F is a polynomial in the variables h m (see Corollary 1). Putting in this equation coordinates of points from X, we get a polynomial in the variables a, b, c, d identically equal to zero. This implies that h k i is divisible by h j (as a polynomial in a, b, c, d). It is easy to see that this can not be true for any i, j, k.
The following lemma combining with Lemma 3 completes the proof of the Theorem.
Lemma 5. If f ∈ k n has a linear factor of multiplicity one, then Proof. We may assume that f has the form x(y + a 2 x) . . . (y + a n x). Let t 2 a 2 x) . . . (y + t 2 a n x) → xy n−1 as t → 0.
The closure of a toric orbit in a vector space
Let T be an algebraic torus and Λ be the lattice of its characters. Consider a linear action T : V , where t(x 1 , . . . , x n ) = (χ 1 (t)x 1 , . . . , χ n (t)x n ). Let Σ be the semigroup in Λ generated by the characters χ 1 , . . . , χ n and K be the cone in Λ ⊗ Z Q generated by Σ.
We are interested in the question if X = T v has the separation property. If the vector v has a zero coordinate, then X is contained in a homogeneous hyperplane and has not (SP). If any coordinate of v is non-zero, then, up to the proportionality of the basis vectors, we may assume that v = (1, . . . , 1). It can also be assumed that the kernel of inefficiency of the action T : V is finite (i.e., dim X = dim T , or the cone K is bodily).
Now we give an algorithm for a construction of a finite system of binomials defining X. Denote by W the sublattice in Z n defined by the system of equations To any point c = (c 1 , . . . , c n ) of this sublattice we put in correspondence the binomial Then W ∩ D I is a finitely generated semigroup. Let us construct a system of generators of W ∩ D I (for example, if d 1 , . . . , d k ∈ W ∩ D I is a system of generators of the cone Q + (W ∩ D I ), then the set { s i d i | 0 ≤ s i ≤ 1} ∩ D I generates W ∩ D I ). Now we consider the union of such systems of generators of the semigroups W ∩ D I over all octants and prove that the corresponding set of binomials generates the ideal I(X).
Proof. (1) If K contains a line, then there exist c 1 , . . . , c n ∈ Z + such that c i = 0 for some i and c i χ i = 0. Therefore X is contained in a hypersurface x c 1 1 · . . . · x cn n = 1 and does not meet the hyperplane x j = 0, where c j = 0. Consequently, X has not (SP).
(2) If Q + χ i is not an edge of K, then there exist c 1 , . . . , c n ∈ Z + such that c i χ i = j =i c j χ j , c i ∈ N. If χ i = 0, then X does not meet the hyperplane x i = 0 and has not (SP). If χ i = 0, then there exists c j = 0, j = i. This means that x ∈ X, x j = 0 implies x i = 0 and (SP) does not hold. The case Q + χ i = Q + χ j can be proved by the same arguments.
(3) Now we prove the converse implication. Consider the case dim T = 1. The set {χ 1 , . . . , χ n } satisfies the conditions of the theorem only if dim V = 1. In this case X = V if χ 1 = 0 and X = {1} if χ 1 = 0 and X has (SP). Now let dim X > 1. Note that X is not contained in a hyperplane (otherwise there exist i = j such that χ i = χ j ) and meets any hyperplane (since K is strictly convex and χ i = 0 for any i, it follows that 0 ∈ X). Hence, by Theorem 2, Ch(X) is closed. If X has not (SP), then, by Corollary 1, X is contained in the hypersurface x l i + x j F for some i = j, F ∈ k , l ∈ N. By Lemma 6, it follows that x l i − x c 1 1 . . . x cn n ∈ I(X) for some c 1 , . . . , c n ∈ Z + , c j > 0, i.e., lχ i = c m χ m . If l ≤ c i , then since χ j = 0, we have a contradiction with condition (1). Otherwise we have a contradiction with χ i ∈< χ 1 , . . . , χ i−1 , χ i+1 , . . . , χ n > Q + . Suppose that among p i there are no equations of such form. We shall prove that X has (SP) applying Theorem 3.
(a) The cone K is strictly convex and χ i = 0 for any i since 0 ∈ X.
(b) Suppose that Q + χ i is not an edge of K or Q + χ i = Q + χ j . This means that some equation of the form . . x cn n , where c k ≥ 0, c i > 0 and some c j > 0, j = i, vanishes on X. On the other hand, (0, . . . , x i = 1, . . . , 0) ∈ X and we have a contradiction. By Theorem 3, it follows that X has (SP) and the implication (1) ⇒ (3) is proved.
Remark 9. We say that a variety Y ⊂ V is binomial if Y can be defined by a system of binomials. In particular, the closure of an orbit of a torus is binomial. Moreover, it is easy to see that a binomial variety is the closure of some toric orbit if and only if it is irreducible. The following example shows that the statement of Corollary 2 does not hold for an arbitrary binomial variety.
Example 8. Consider the binomial variety Y ⊂ k 4 defined by the equations Any hypersurface x i x j = x l x m has (SP). It is easy to check that (SP) (and even (WSP)) for Y fails on the functions x 1 − ax 2 and x 1 − bx 2 , where a, b = ±1, a = b (since Y is an union of four coordinate axes and the lines x 1 = ±x 2 = ±x 3 = ±x 4 with an even number of minuses). (1) the cone K is strictly convex; (2) there are no more then one characters χ i in the interior of any face of K (in particular, Q + χ i = Q + χ j for i = j).
Proof. (1) If K contains a line, then there exist c 1 , . . . , c n ∈ Z + such that c j , c k = 0 for some j = k and c i χ i = 0. Consequently, X is contained in the hypersurface x c 1 1 · . . . · x cn n = 1 and does not meet the hyperplanes x j = 0 and x k = 0. Therefore X has not (WSP).
(2) Let condition (2) do not hold, i.e, there are two characters (let us assume that they are χ 1 , χ 2 ) in the interior of the face of K generated by and X has not (WSP).
(3) Let us prove the converse implication. Consider the case dim T = 1. The cone K satisfies the conditions of the theorem if and only if either dim V = 1 or dim V = 2 and t(x 1 , x 1 ) = (x 1 , t m x 2 ), where m = 0. In the first case X has (SP) and it is easy to see that in the second case X has (WSP). Now let dim T ≥ 2. Assume the converse. Let the cone K satisfy the conditions of Theorem 4 and the weak separation property fails for X on linearly independent functions α = a 1 x 1 + . . . + a n x n , β = b 1 x 1 + . . . + b n x n .
If M is a cone generated by some edges of K and δ is a linear function, then denote by δ M the restriction of δ to the subspace in V defined by the equations x i = 0, where χ i ∈ M .
Remark 10. Let L be a proper face of K and W ⊂ V be the subspace defined by the equations x i = 0, where χ i ∈ L. Note that X ∩ W is the closure of the T -orbit of the point with the coordinates x i = 1 for χ i ∈ L and x i = 0 for χ i ∈ L. Since the characters of the representation T : V satisfy the conditions of the theorem, it follows that the characters of the representation T : W satisfy the same conditions. By inductions over dim V , we may assume that X ∩ W ⊂ W has (WSP). Since H α L ∩ X ∩ W = H β L ∩ X ∩ W , it follows that α L and β L are linearly dependent.
The first case. Suppose that χ i = 0 for any i. This implies s n 2 0 = − a j n 1 a m (n 1 − n 2 ) (if a m = 0 or n 1 − n 2 is divisible by char k, then n 1 is divisible by char k and we repeat the previous arguments). Also, we have Note that s 0 is a root of ( * * ). Putting obtained formulae in ( * * ), we get a m a j n 2 − b m a j n 1 + b j a m (n 1 − n 2 ) = 0.
Since ( * * ) also has a multiple root, then, by the same arguments, we have the symmetric equation Summing the obtained equations, we get (a j − b j )(a m − b m ) = 0. Thus we have a contradiction with Remark 11.
Step 3. Consider the case of arbitrary α, β. In the case dim T = 2 we have a contradiction with Step 2. Now let dim T > 2. We say thatK is a subcone of K ifK is generated by a finite number of vectors from K. Note that the interior of a subcone is contained in the interior of one of the faces of K. Consider the subcone K ′ of K generated by the characters χ i such that a i = 0 or b i = 0. Since α K ′ and β K ′ are not proportional, it follows that there exists a face L 1 of codimension 1 in K ′ such that α L 1 and β L 1 are not proportional. If χ m is contained in the interior of L 1 , then χ m is contained in the interior of K. Indeed, assume the converse. Let χ i be an interior point of a proper face of K and χ i belong to the interior of L 1 . Then L 1 is contained in this face of K. By Remark 10, the linear functions α L 1 and β L 1 are proportional and we have a contradiction. For the same reason, there exists a face L 2 of codimension one in L 1 such that α L 2 and β L 2 are not proportional. Thus we can find a 2-dimensional face L r with this property. There exists a oneparameter subgroup γ : k * → T such that γ(s)α → α Lr , γ(s)β → β Lr as s → 0. Since Chw(X) is closed, it follows that ( α Lr , β Lr ) ∈ Chw(X) and we can apply Step 2.
The second case. Suppose that χ i = 0 for some i (we may assume that i = 1). If a 1 = b 1 = 0, then consider the image X ′ ⊂ W of X under the projection along the first basis vector (here W is a subspace defined by the equation x 1 = 0). The characters of the representation T : W are nonzero and satisfy the conditions of the theorem. The first case implies that X ′ ⊂ W has (WSP). But (WSP) fails for X ′ ⊂ W on the restriction on W of the functions α, β. This is a contradiction.
Proof. Let X = V and x a 1 1 . . . x an n − x b 1 1 . . . x bn n ∈ I(X), where there exists i with a i = b i . We may assume that a i = 0 or b i = 0 for any i. Let a 1 > 0. Since X is a cone, it follows that there exists b i > 0 and where V i = H x 1 ∩ H x i . This implies that there exists i such that dim X ∩ V i = dim X ∩ H x 1 and X ∩ V i has the codimension ≤ 1 in X.
Remark 12. The proof of Theorem 5 is true for any cone which is contained in a binomial hypersurface, in particular, for binomial cones.
Question. Let X be a closed irreducible T -invariant subvariety in a Tmodule V such that X has not (WSP) (resp. (SSP)). Is it true that (WSP) (resp. (SSP)) for X fails on a pair of T -semiinvariant linear functions? 7. The closure of a toric orbit in a projective space Let T : P(V ), t(x 1 : . . . : x n ) = (χ 1 (t)x 1 : . . . : χ n (t)x n ). We are interested in the question if Y = T w (w ∈ P(V )) has the separation properties. As in the previous section we may assume that w = (1 : . . . : 1). It also can be assumed that the kernel of inefficiency of the action T : P(V ) is finite, i.e., dim X = dim T . (1) the point χ i is a vertex of the convex hull conv{χ 1 , . . . , χ n } for any i ; (2) χ i = χ j for i = j.
Remark 13. If any hyperplane section of X ⊂ P(V ) is reduced (i.e., it is a sum of prime divisors), then X has (SP) (see ). If X is the orbit of a highest vector in an irreducible representation of a reductive group, then this condition is equivalent to (SP) (see ). This is not true for an orbit closure of a torus. Consider the action of the torus T = (k * ) 2 : P(k 4 ), (t 1 , t 2 )(x 0 : x 1 : x 2 : x 3 ) = (t 1 t 2 2 x 0 , t 1 t 2 x 1 , t 3 1 x 2 , t 2 2 x 3 ). The orbit closure of the point (1 : 1 : 1 : 1) is the hypersurface defined by the equation x 0 x 2 1 = x 2 x 2 3 . It has (SP) and its intersection with H x 0 is not reduced. Proof. The proof follows from Theorem 5.
|
/**
* Add an item and all items which allow to navigate to him to show item
* set. Return true if we have been able to find a path to this item.
*
* @param itemId
* id of item to show
* @return true if we have been able to find a path to this item.
*/
protected boolean addItemToShow(UUID itemId) {
_itemsToShow.add(itemId);
Item item = CadseCore.getLogicalWorkspace().getItem(itemId);
Stack<Item> pathToRoot = new Stack<Item>();
if (!findPathToRoot(item, pathToRoot)) {
return false;
}
Item curItem = pathToRoot.pop();
while (curItem != null) {
if (curItem != item) {
_itemsToShow.add(curItem.getId());
}
if (!pathToRoot.isEmpty()) {
curItem = pathToRoot.pop();
} else {
curItem = null;
}
}
return true;
}
|
// Delete is called when an exposed service is deleted
// Clears the service form the todo list
func (s *LoadBalancerStrategy) Delete(svc *v1.Service) error {
delete(s.todo, fmt.Sprintf("%s/%s", svc.Namespace, svc.Name))
return nil
}
|
Michel Ancel, creator of Rayman, has built a level for Super Mario Maker.
The famed French developer can be seen experimenting with Nintendo's upcoming Mario level creator in the video below.
He even uses graph paper! This guy knows his stuff.
Which is unsurprising, really - Ancel has had a hand in designing every major Rayman release, right up to the most recent Rayman Legends.
Super Mario Maker will launch with 60 levels included, built by Nintendo and others.
Ancel is currently working on PlayStation 4-exclusive animal adventure Wild at his new independent games studio - Wild Sheep, aided by some of his Ubisoft Montpellier colleagues.
Ancel is also still technically a Ubisoft employee, although the company has not commented on what he is currently working on.
The status of his long-awaited Beyond Good and Evil sequel is also currently unknown. It has been in and out of production countless times since the original game's launch back in 2003.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.